Skip to content

Cant load non US resources in netcoreapp2.0 #8503

Closed

Description

@SimonCropp
  • netcoreapp2.0. 2.0.0-preview2-006497
  • console app that is doing some basic assembly loading
  • australia culture

When i run i get the following exception

Assert Failure
Expression: [Recursive resource lookup bug]
Description: Infinite recursion during resource lookup within System.Private.CoreLib.  This may be a bug in System.Private.CoreLib, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names.  Resource name: ArgumentNull_Generic
Stack Trace:
   at System.SR.InternalGetResourceString(String key)
   at System.SR.GetResourceString(String resourceKey, String defaultString)
   at System.ArgumentNullException..ctor(String paramName)
   at System.Runtime.Loader.AssemblyLoadContext.GetLoadContext(Assembly assembly)
   at System.Reflection.Assembly.LoadFromResolveHandler(Object sender, ResolveEventArgs args)
   at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks, IntPtr ptrLoadContextBinder)
   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 System.SR.InternalGetResourceString(String key)
   at System.SR.GetResourceString(String resourceKey, String defaultString)
   at System.ArgumentNullException..ctor(String paramName)
   at System.Runtime.Loader.AssemblyLoadContext.GetLoadContext(Assembly assembly)
   at System.Reflection.Assembly.LoadFromResolveHandler(Object sender, ResolveEventArgs args)
   at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks, IntPtr ptrLoadContextBinder)
   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 System.SR.InternalGetResourceString(String key)
   at System.SR.GetResourceString(String resourceKey, String defaultString)
   at System.BadImageFormatException..ctor()
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)

If i hack it back to US Culture it runs fine

Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

Activity

  1. tarekgh commented on Jul 10, 2017

    @tarekgh
    Member

    @SimonCropp this looks same issue we fixed which @jkotas pointed at dotnet/corefx#21095. could you please try the latest netcoreapp package and let's know if the problem still there or not?

    https://www.nuget.org/packages/Microsoft.NETCore.App/2.0.0-preview2-25407-01

    Also if you have sample project you can share, we can validate that too. Thanks.

  2. timbussmann commented on Jul 21, 2017

    @timbussmann

    I'm seeing the same behavior using preview2-25407-01 using "de-DE" culture

  3. tarekgh commented on Jul 21, 2017

    @tarekgh
    Member

    @timbussmann could you please share small project repro the issue so we can investigate it? also tell us what OS you are using and which version. Thanks.

  4. timbussmann commented on Jul 21, 2017

    @timbussmann

    @tarekgh I have a repro sample using NServiceBus. I haven't been able to isolate the issue further yet but I simplified my sample as much as possible. I'll try to see whether I can isolate a repro without using NServiceBus on Monday. Here's the repository with the repro: https://github.com/timbussmann/Repro

  5. tarekgh commented on Jul 21, 2017

    @tarekgh
    Member

    Thanks @timbussmann

    Which OS version you are running on? and what is your culture settings? I mean, are you running on de-DE machine?

  6. timbussmann commented on Jul 21, 2017

    @timbussmann

    @tarekgh I'm running on Windows 10 build 14393.1480. I'm using the de-CH region settings. This results in CurrentUICulture being "de-DE", while CurrentCulture is "de-CH" in .net apps.

  7. tarekgh commented on Jul 21, 2017

    @tarekgh
    Member

    @timbussmann I can repro it with your project. thanks for sharing that.

  8. tarekgh commented on Jul 22, 2017

    @tarekgh
    Member

    @kouvel is going to look at fixing this issue. I have a simple repro now too.

  9. karelz commented on Aug 25, 2017

    @karelz
    Member

    @tarekgh was it fixed in 2.0.0, or do we need to make more changes in servicing?

  10. kouvel commented on Aug 25, 2017

    @kouvel
    Contributor

    This should be fixed in the 2.0.0 branch now, it wasn't auto-closed by dotnet/corefx#22553 for some reason. Going ahead and closing.

  11. danmoseley commented on Nov 15, 2017

    @danmoseley
    Contributor
  12. transferred this issue fromdotnet/coreclron Jan 31, 2020
  13. added this to the 2.0.x milestone on Jan 31, 2020
  14. ghost locked as resolved and limited conversation to collaborators on Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions