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.

missing NeutralResourcesLanguage attribute?

See original GitHub issue

Describe the bug

When loading an efcore 3.1.1 project using reflection, an exception is thrown by Microsoft.Data.SqlClient looking for the en-US satellite assembly (which doesn’t exist).

I am unfamiliar with ResourceManager and satellite assemblies but it looks like it might be that the Microsoft.Data.SqlClient.dll assembly is missing [assembly: NeutralResourcesLanguage("en-US")] ?

Stack trace:
System.TypeInitializationException: The type initializer for 'Microsoft.Data.SqlClient.SqlConnection' threw an exception. 
---> System.TypeInitializationException: The type initializer for 'Microsoft.Data.SqlClient.SqlConnectionFactory' threw an exception. 
---> System.TypeInitializationException: The type initializer for 'Microsoft.Data.SqlClient.SqlPerformanceCounters' threw an exception. 
---> System.TypeInitializationException: The type initializer for 'Microsoft.Data.Common.ADP' threw an exception. 
---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Data.SqlClient.resources, Version=1.10.19324.4, Culture=en-US, PublicKeyToken=23ec7fc2d6eaa4a5' or one of its dependencies. The system cannot find the file specified. 
---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Data.SqlClient.resources' or one of its dependencies. The system cannot find the file specified.
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.Load(String assemblyString)
   at CareEvolution.DatabaseMigrations.DatabaseMigrator.AssemblyResolve(Object sender, ResolveEventArgs args)
   at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
   --- End of inner exception stack trace ---
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(String name, CultureInfo culture, Version version, Boolean throwOnFileNotFound, StackCrawlMark& stackMark)
   at System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(CultureInfo lookForCulture, StackCrawlMark& stackMark)
   at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
   at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
   at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
   at Microsoft.Data.Common.ADP..cctor()

To reproduce

I can try to extract a sample if that would be helpful.

Expected behavior

A satellite assembly should’t be loaded for en-US, since those resources are in the main assembly.

Further technical details

Microsoft.Data.SqlClient version: 1.10.19324.4 .NET target: Framework 4.8 SQL Server version: N/A Operating system: Windows 10

Additional context Here is a capture from procmon when this exception occurred, can see the files that .NET is looking for. image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
BradBarnichcommented, Feb 26, 2020
0reactions
sharpninjacommented, Nov 25, 2020

We shall wait for more interest in this request from different audiences

I have this issue in Azure DevOps running Cake Build with Microsoft.Data.SqllClient

Read more comments on GitHub >

github_iconTop Results From Across the Web

The [NeutralResourceLanguage] attribute is missing on ...
After adding the NeutralResourcesLanguage("en-US"), I got another error from app hub saying that I can't change previously submitted language.
Read more >
NeutralResourcesLanguageAttri...
In desktop apps, the NeutralResourcesLanguageAttribute attribute informs the resource manager of an app's default culture and the location of its resources. By ...
Read more >
Mark assemblies with NeutralResourcesLanguageAttribute ...
The NeutralResourcesLanguageAttribute attribute informs the resource manager of an app's default culture. If the default culture's resources ...
Read more >
Mark assemblies with NeutralResourcesLanguageAttribute-C
The NeutralResourcesLanguage attribute tells the resource manager about the language used in your neutral resources (the resources whose filename don't have ...
Read more >
Make the Best of .NET Resource Files
Drill down on some under-documented techniques for using resource files in your .NET apps, and learn to customize these files for different ...
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