Skip to content
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

Add ability to find symbol in mono corelib and in other platform locations #26

Merged
merged 10 commits into from
Feb 12, 2021

Conversation

carlossanlop
Copy link
Member

@carlossanlop carlossanlop commented Feb 3, 2021

If a symbol is not found in the main project, we look for it in the referenced projects. If one of the projects happens to be System.Private.CoreLib, and we don't find the symbol in the Libraries version, then we have to try to find it in the Mono version.

If a symbol has multiple implementations for different platforms, ensure to port comments to those files too.

cc @safern

ProjectInformation? pd = null;
INamedTypeSymbol? symbol = null;

if (TryFindSymbolInReferencedProject(projectPath, docsType.FullName, isMono: false, out pd, out symbol) ||
Copy link
Member

@safern safern Feb 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not exactly what I meant.

What I meant is if the symbol location is under src/libraries/ tree. Even when the compilation doesn't set RuntimeFlavor=mono, it could resolve symbols where it's location is: src/coreclr/System.Private.CoreLib/*, and that is when the symbol would appear in the mono and coreclr System.Private.CoreLib.

Basically the way that you have it, this first call to TryFindSymbolInReferenceProject will always return true for projectFileName == 'System.Private.CoreLIb. The reason for that is because both System.Private.CoreLib need to have the same public apis defined.

So basically what you have to do is.

call TryFindSymbolInReferencedProject(....), then if that is successful, then check symbol.location file path and if the file path lives under src/coreclr/* then that is when you need to call in TryFindSymbolInReferencedPRoject(..., isMono: true, ...).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok thanks.
I need an example of this though. I can use an API from System.IO.FileSystem, like FileStream, to try to find a mono implementation. I think that type is one of those cases.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@safern I think I am doing the right thing now. PTAL when you get a chance.

@carlossanlop carlossanlop changed the title Add ability to find symbol in mono corelib Add ability to find symbol in mono corelib and in other platform locations Feb 9, 2021
Only look inside referenced projects that are explicitly included and not explicitly excluded (by namespace).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants