cachedTypes in AssemblyNamesTypeResolutionService is unreachable
See original GitHub issueProblem description:
Here the field cachedTypes is currently unreachable because it relies on Assembly.GlobalAssemblyCache which is false in .NET Core and IsNetFrameworkAssembly, which is also always false because it tests if assembly Location path is .NET Framework path, while (on Windows) .NET Core assemblies are on C:\Program Files\dotnet\shared\Microsoft.NETCore.App\... path.
Actual behavior:
Types are not cached
Expected behavior:
.NET Core types are cached (?)
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
.NET assembly info
... AssemblyNamespacePair · AssemblyNamespaceReferenceNamespaceLink · AssemblyNamesTypeResolutionService · AssemblyNameUtility · AssemblyNameVersion ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

/cc @jeffschwMSFT It looks like @hughbe fixed the GAC checking here: https://github.com/dotnet/winforms/commit/5e0710c9b943adf4b0b1ab1aa4d266791f81850b#diff-a2cbb3dd218c63ebe4e00266618b9ef5R828, but this still checks IsNetFrameworkPath: https://github.com/dotnet/winforms/blob/f3ae8f699f703645904e384e9ce16316f2ee23c6/src/System.Windows.Forms/src/System/Resources/ResXDataNode.cs#L791.
Since .NETCore is an xcopy-able framework, you shouldn’t really be checking any specific path dotnet\shared.
I think to really answer this question you need to understand the reasoning behind this statement: https://github.com/dotnet/winforms/blob/f3ae8f699f703645904e384e9ce16316f2ee23c6/src/System.Windows.Forms/src/System/Resources/ResXDataNode.cs#L927
I’m not sure what this code is imaging might change over the lifetime of these statics: it’s not like it can unload assemblies once they’ve been loaded so future requests for the same type must result in the same type even if it is not cached (since the assembly is effectively cached by the runtime).
@ericstj
Might be related to VS usage of ITypeResolutionService, after a build the WinForms Designer will load the newly built version so maybe its referring to that, to avoid having cached the old version of the assembly.