-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net 5 Cannot read resources that depend on serialization #4556
Comments
The underlying reason is this: #4528 There are mismatched assembly versions written in the .resx file by the designer and the ones compiled into the application. You can see it for yourself if you disable "Just my code" in Debugging options and then enable first chance exception for "FileNotFoundException". It will show you which assembly/version fails to load (likely |
Additionally, if you are using VS 16.9 Preview it ships with 5.0.2xx preview SDK. This is automatically picked up as the latest one even though it contains assemblies that are older than the shipping version (5.0.3 at the moment). Workaround is to force compilation with the right SDK version through
|
Thanks for the explanation but this is still not clear to me.. I'm running inside Visual studio with 5.0.3 installed so what incorrect dll are compiled into the resx? should VS takes the currently installed? |
The WinForms designer runs with the latest non-preview .NET version installed on the computer (5.0.3 at the moment). When it serializes the resources into the .resx file it writes something like this: <assembly alias="System.Windows.Forms.Primitives" name="System.Windows.Forms.Primitives, Version=5.0.3.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="label_Title.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms.Primitives">
<value>0, 3, 3, 3</value>
</data> Notice that the |
oh I see now. Thanks! |
but what is the solution for this in this case (global.json is workaround)... |
I am hoping the team will act on #4528 and either fix the library versions or the designer. Meanwhile you can use the workaround with the |
OK. Thanks 🙂 |
Designer needs to serializer a version tolerant string to resx. This is important for multi-targeting. The resx should only contain versions that match what’s in the GA ref pack. Applications are not “targeting” servicing updates to the runtime. @DustinCampbell |
This is fixed in the latest VisualStudio version(yet to be shipped). We will be writing equivalent .NET framework type in to the Resx, wherever applicable. Framework types are resolved in all core versions. And for all other ( Core only types) , we will be removing the version number from the serialized type. |
The root cause has been fixed in the latest VS. |
Duplicate of #4528 |
Hi,
We moved to net 5.0.3 (from net 5) and now we are getting the above exception in Winform form in the Designer on lines like:
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.btnOpenProtocolsFolder.Image = ((System.Drawing.Image)(resources.GetObject("btnOpenProtocolsFolder.Image")));
what could e the reason?
The text was updated successfully, but these errors were encountered: