-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot get internal members of a Type from within INamedTypeSymbol #24412
Comments
You may be looking for the |
I am not even using semantic model - I do not need it for my purpose. Just pulling the type straight from the compilation and checking its members. Can you give me a code example? This is not my code that I am investigating - this code is referenced by my code. |
It seems like I resolved the problem but not without a hack. one has to set a hidden property MetadataImportOptions of the compilation to MetadataImportOptions.All (which is 2). Both the CSharpCompilationOptions.MetadataImportOptions member and MetadataImportOptions enumeration are internal to Microsort.CodeAnalysis assembly. I had to use reflection to be able to set it. In particular I did something like:
(byte) 2 is the MetadataImportOptions.All option. |
I opened #24425 requesting to open up the API for setting MetadataImportOptions. |
|
cool thanks |
I am getting a referenced type from a Roslyn Compilation by using Compilation.GetTypeByMetadataName(...) method. Then I use INamedTypeSymbol.GetMembers() method to get all its member symbols. I am getting all public and protected symbols but neither private nor internal. I do not care much about private member symbols, but internals are a must for me. Is there any way to get them from a Roslyn compilation?
The text was updated successfully, but these errors were encountered: