question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cachedTypes in AssemblyNamesTypeResolutionService is unreachable

See original GitHub issue

Problem 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:open
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ericstjcommented, May 24, 2019

/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).

0reactions
weltkantecommented, May 24, 2019

@ericstj

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

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

.NET assembly info
... AssemblyNamespacePair · AssemblyNamespaceReferenceNamespaceLink · AssemblyNamesTypeResolutionService · AssemblyNameUtility · AssemblyNameVersion ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found