Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

Reflection Assembly Question #1474

Closed
Closed

Description

@wjk

I am trying to write a piece of CoreRT-based code that implements ResourceManager in a CoreRT-friendly, albeit Windows-only, way. To do this I am using a build-time script to extract the manifest resource streams from the compiled .NET assemblies, and compile them into a native object using rc.exe. I would then use a custom ResourceManager class to extract the appropriate blob from the compiled RC file using Win32 APIs, and pass it into ResourceReader.

However, for this to work, I need to create an index with three items: the name of the assembly containing the resource, the name of the resource as embedded in the assembly, and a unique key used to retrieve the correct resource data. It is the first item that is causing me grief.

When I call typeof(Something).GetTypeInfo().Assembly.GetName().Name in my C# code, I get varying results. If Something == System.Object, or any other type in System.Private.CoreLib.dll or any of the System.Private.Reflection assemblies, it reports the correct assembly name. If I use a type contained in any other assembly, it resolves to a RuntimeNoMetadataTypeInfo and throws an exception. (I then crash in __not_yet_implemented because the code calls through to the default, stubbed ResourceManager class while trying to retrieve the exception message.) I cannot for the life of me determine the difference between the System.Private.* assemblies and any other assembly (be it from CoreFX or one of my own) as far as TypeInfo.Assembly is concerned. Can anyone offer me any pointers? Thanks!

Activity

  1. MichalStrehovsky commented on Jul 7, 2016

    @MichalStrehovsky
    Member

    Thanks for the detailed bug report! The issue you're seeing affects all types referenced from a typeof(Y) expression that are otherwise not constructed (there's no new Y() in the program). The fix is inbound.

  2. MichalStrehovsky commented on Jul 7, 2016

    @MichalStrehovsky
    Member

    @wjk ResourceManager is a big beast with a lot of challenges. If you would like to contribute, do keep us posted if you would like early feedback! All contributions are welcome.

  3. jkotas commented on Jul 7, 2016

    @jkotas
    Member

    cc @tarekgh since he has been looking into the resource manager before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions