SqlClient: missing NeutralResourcesLanguage attribute?

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

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (12 by maintainers)

Most upvoted comments