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

Bug: EquatablePortableExecutableReference throws FileNotFoundException #1897

Open
chsienki opened this issue Jan 15, 2025 · 1 comment
Open

Comments

@chsienki
Copy link

Description

EquatablePortableExecutableReference calls .GetMetadataId() to determine if two references are the same:

return other.Reference.GetMetadataId() == Reference.GetMetadataId();

However, in the IDE it's possible that a reference is a MissingMetadataReference. This will unconditionally throw a FileNotFoundException :

https://github.com/dotnet/roslyn/blob/23f8f05fd7ac83e79907096ac5fed533138f10b7/src/Workspaces/Core/Portable/Serialization/SerializerService_Reference.cs#L531

The generator should guard against this condition instead of crashing.

Steps To Reproduce

An example of this issue is captured here, including an internal only accessible memory dump of when the issue occurs https://developercommunity.visualstudio.com/t/Feature-X-is-currently-unavailable-due-t/10803095

Expected Behavior

The generator should not crash.

Version Info

Latest

Additional Context

No response

@manodasanW
Copy link
Member

@chsienki Is there a trivial way to create a scenario where the reference is a MissingMetadataReference to confirm the fix works?

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

No branches or pull requests

2 participants