-
Notifications
You must be signed in to change notification settings - Fork 1.9k
C#: Improve db consistency by removing assembly id #2814
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
Conversation
a2d682b to
e3ac473
Compare
| @@ -1,3 +1,9 @@ | |||
| | Program.cs:18:21:18:22 | c1 | Assembly1.dll:0:0:0:0 | Class | | |||
| | Program.cs:18:21:18:22 | c1 | Assembly2.dll:0:0:0:0 | Class | | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hvitved I'm not sure whether this is a desired change in behaviour. The reason for the change is that the local variable has a type given by a typeref which is no longer qualified with the assembly id. Therefore, the type of the local variable maps to all matching types, which is three different types in this case.
To recover the original behaviour, the extractor simply needs to populate a type as opposed to a typeref in the local variable's type field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think types of local variables should be treated specially, what do you think?
hvitved
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor things, otherwise LGTM. Could you elaborate a bit on the type of DB consistency errors that are removed by this change?
e3ac473 to
4c7d413
Compare
…rwise, an entity with the wrong (cached) nullability could be created.
|
This pull request introduces 1 alert when merging ead9167 into 243dea7 - view on LGTM.com new alerts:
|
| } | ||
|
|
||
| readonly IDictionary<object, ICachedEntity> objectEntityCache = new Dictionary<object, ICachedEntity>(); | ||
| readonly IDictionary<object, ICachedEntity> symbolEntityCache = new Dictionary<object, ICachedEntity>(10000, new SymbolComparer()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to change object to ISymbol here and in SymbolComparer, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I originally had some difficulty converting an IDictionary<ISymbol, ICachedEntity> to IDictionary<object, ICachedEntity> but managed to work around it in the end. The result is better, so thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
This addresses an issue that occurs particularly with .NET Core, where classes can be defined in more than one assembly. Particularly, the assembly
Private.CoreLibduplicates much of the standard library, fromSystem.Runtimeand so on. Relaxing the qualifiers on IDs in some places removes many of the dangling references in the database.