After compiling some old academic code, which is supposed to work with older version of Oxygene, I constantly run into the System.Resources.MissingManifestResourceException exception in the line, which loads an icon for the form:
self.Icon := (resources.GetObject('$this.Icon') as System.Drawing.Icon)
When I remove the line it fails elsewhere while trying to load a string from resources, so it seems quite constant problem when accessing resources.
Searching for a resolution I have found this which lead to reviewing Build Action settings for the .resx files in the project, which lead to two conclusions:
For .resx files tight to the module (main.resx displayed as sub folder of main.pas) I can only choose Compile or Content from the VS 2017 GUI.
I have manually changed this field in the project source to (suggested in the thread mentioned above) EmbeddedResource and it seems when using ILSpy tool that the resource finally IS embedded in the assembly, however
It still fails with the same exception.
I have also found this thread on your talk board which does not help but references this post, which subject sounds promising but when I try to click displays Sorry, you don't have access to that topic!.
This seems to be a bug in VS, I’ll log an issue. thanx.
The name of the resource file will depend on it’s path relative to the project, and also on it’s DependentUpon/DesignableClassName name.
If this is the .resx for a WinForms class, make sure the .resx has a DependentUpon tag inside the project that points to the form code file; and that the form code file has a DesignableClassName tag that has the form’s name.
If these are not present, the resource file will get a “wrong” name, and the resource cannot be fondant runtime. You can see the name of the resource with ILSpy. For a Winforms resx, it should get the class name fo your form, from the DesignableClassName tag.
Do you recall where these files were created? from template, or manually? in VS?
I’ll review if that’s something we want to change (Elements supports operating systems with case sensitive filenames, where ion tear the case could matter, but that does seem like a rather corner-case scenario…
I’ve made it case insensitive; seams only reasonable. The chance that someone has two forms with the same name and only differing in case is low, and that’d be insane, anyways