You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
net 5 Cannot read resources that depend on serialization #48159
This question was cross-posted to dotnet/winforms (dotnet/winforms#4556) and answered there. I don't think it requires any action in this repository. However, the NotSupportedException is misleading because the deserialization actually works. The issue is that an underlying FileNotFoundException is hidden from the API consumer and makes it much harder to diagnose what is going on.
Even wrapping the FileNotFoundException as InnerException would be helpful because now it's invisible unless the debugger has the Just my code option turned off (it's on by default).
@ericstj There's another WinForms issue (dotnet/winforms#4528) where I filed the detailed description earlier. And yet another one that I filed for another version tolerant issues that's moved in the private dotnet/winforms-designer repository. I was told that it's on the WinForms team radar now but I appreciate any help with getting it resolved once and for all.
In this case I didn't even publish this .NET 5 Windows Application at all. I made an Installer project in the same VS solution to put the whole shebang on the target computer. (It's still beta, and will work on trimming later). It works fine when installed and run on my development machine, but not when installed and run on the production box using the same installer. So this seems to show that the Icon resource data is included in the installer data I think. I'll have to look a little more at this. The target machine is an Azure VM Windows Server, so there's a possible significant difference there compared to my Windows 10 development environment.
It works fine when installed and run on my development machine
There's a feature in the host that will load missing assemblies from the NuGet cache, which would be present on your dev machine. I'm pretty sure you're hitting a file not found here like the original report. You could prove that by debugging the installed app and looking for the caught FileNotFoundException, or just procmon it to find the missing file. My guess is that it is System.Drawing.Common.dll. It's entirely possible that there is some other relevant inner exception here.
@joperezr can we make the fix to add the appropriate inner exception here so that it will be easier for folks to debug?
ghost added
in-prThere is an active PR which will close this issue when it is merged
Activity
filipnavara commentedon Feb 11, 2021
This question was cross-posted to dotnet/winforms (dotnet/winforms#4556) and answered there. I don't think it requires any action in this repository. However, the
NotSupportedExceptionis misleading because the deserialization actually works. The issue is that an underlyingFileNotFoundExceptionis hidden from the API consumer and makes it much harder to diagnose what is going on.filipnavara commentedon Feb 11, 2021
Suggestion: area-System.Resources
cc @ericstj @stephentoub w.r.t. the unhelpful exception that has totally incorrect message:
runtime/src/libraries/System.Private.CoreLib/src/System/Resources/ResourceReader.cs
Lines 952 to 965 in 42009d1
Even wrapping the
FileNotFoundExceptionasInnerExceptionwould be helpful because now it's invisible unless the debugger has theJust my codeoption turned off (it's on by default).LiorBanai commentedon Feb 11, 2021
@filipnavara Thanks!
ericstj commentedon Feb 11, 2021
I have reactivated the WinForms issue because what the designer is doing is broken.
I think we can update the inner exception here.
filipnavara commentedon Feb 11, 2021
@ericstj There's another WinForms issue (dotnet/winforms#4528) where I filed the detailed description earlier. And yet another one that I filed for another version tolerant issues that's moved in the private dotnet/winforms-designer repository. I was told that it's on the WinForms team radar now but I appreciate any help with getting it resolved once and for all.
joperezr commentedon Feb 11, 2021
Sounds good, I'll add the inner exception then so that it doesn't get thrown away.
4 remaining items
Budsy commentedon May 5, 2021
In this case I didn't even publish this .NET 5 Windows Application at all. I made an Installer project in the same VS solution to put the whole shebang on the target computer. (It's still beta, and will work on trimming later). It works fine when installed and run on my development machine, but not when installed and run on the production box using the same installer. So this seems to show that the Icon resource data is included in the installer data I think. I'll have to look a little more at this. The target machine is an Azure VM Windows Server, so there's a possible significant difference there compared to my Windows 10 development environment.
ericstj commentedon Jul 27, 2022
There's a feature in the host that will load missing assemblies from the NuGet cache, which would be present on your dev machine. I'm pretty sure you're hitting a file not found here like the original report. You could prove that by debugging the installed app and looking for the caught FileNotFoundException, or just procmon it to find the missing file. My guess is that it is
System.Drawing.Common.dll. It's entirely possible that there is some other relevant inner exception here.@joperezr can we make the fix to add the appropriate inner exception here so that it will be easier for folks to debug?
joperezr commentedon Jul 27, 2022
Sure, sent out #72957 to address this.