Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8691049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:02:30+00:00 2026-06-13T00:02:30+00:00

After reading Larry Osterman’s response on the very same issue I am trying to

  • 0

After reading Larry Osterman’s response on the very same issue I am trying to solve at the moment, I thought I had found the answer to my question.

For the record, the question was : how can I from .Net (non-WinRT) list the types in a WinRT assembly ( mine are .dll files apparently, not .Winmd)

I therefore used the following code snippet :

//note, this wrapper function returns the metadata file name and token
// it immediately releases the importer pointer


static Tuple<string, UInt32> ResolveTypeName(string typename)
{
    string path;
    object importer = null;
    UInt32 token;

    try
    {
        var hr = RoGetMetaDataFile(typename, IntPtr.Zero, out path, out importer, out token);


        //TODO: check HR for error


        return Tuple.Create(path, token);
    }
    finally
    {
        Marshal.ReleaseComObject(importer);
    }
}


[DllImport("WinTypes.dll")]
static extern UInt32 RoGetMetaDataFile(
    [MarshalAs(UnmanagedType.HString)] string name,
    IntPtr metaDataDispenser,
    [MarshalAs(UnmanagedType.HString)] out string metaDataFilePath,
    [MarshalAs(UnmanagedType.Interface)] out object metaDataImport,
    out UInt32 typeDefToken);

( found on https://gist.github.com/2920743)

Unfortunately, I get a non-zero HResult.

I referred to the documentation and found this :

HR_RESULT_FROM_WIN32(ERROR_NO_PACKAGE) The function was called from a
process that is not in a Windows Store app.

Does that mean it is not possible to list the types from .Net (non-WinRT) at all ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:02:32+00:00Added an answer on June 13, 2026 at 12:02 am

    RoGetMetaDataFile is used to load a metadata file from within an app package. It locates the metadata file in which the named type is defined, loads that metadata file, and returns an IMetaDataImport interface pointer that represents that metadata file.

    From ordinary .NET code you can call RuntimeEnvironment.GetRuntimeInterfaceAsIntPtr (or GetRuntimeInterfaceAsObject) to get the current runtime’s IMetaDataDispenser interface pointer, which can be used to load arbitrary modules for inspection.

    From native code, you can call ICLRMetaHost::GetRuntime to load a runtime, then from that object call ICLRRuntimeInfo::GetInterface to get its IMetaDataDispenser interface pointer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After reading the famous (and only) article about trying to explain why asmxs should
After reading lots of sample code into this matter, I'm trying to figure out
After reading similar questions with many variants, I'm still stuck on this issue. Here's
After reading several questions about .gitignore I have found no one that could answer
After reading Joel's article on Unicode , I still feel very unsure of my
after reading few post in this forum on this topic i had better understanding
After reading this question regarding Linux: Open Terminal From Eclipse I have the same
After reading documentation of underscore.js I found (to my surprise) that actually not all
After reading this , I found that there isn't much of a difference between
After reading many articles on Prism. I am still confused!! I am trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.