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

C#: Fix assembly attribute extraction in standalone mode #14792

Merged
merged 1 commit into from
Nov 16, 2023

Conversation

tamasvajk
Copy link
Contributor

@tamasvajk tamasvajk commented Nov 15, 2023

This PR tries to fix assembly attribute extraction in standalone mode. I can't reliably repro the issue, but occasionally we're seeing the below exception:

Exception has occurred: CLR/System.ArgumentOutOfRangeException
Exception thrown: 'System.ArgumentOutOfRangeException' in Microsoft.CodeAnalysis.dll: 'Specified argument was out of the range of valid values.'
   at Microsoft.CodeAnalysis.SeparatedSyntaxList`1.get_Item(Int32 index)
   at Microsoft.CodeAnalysis.SeparatedSyntaxList`1.Enumerator.get_Current()
   at Semmle.Extraction.CSharp.Populators.TypeContainerVisitor.VisitAttributeList(AttributeListSyntax node) in .../ql/csharp/extractor/Semmle.Extraction.CSharp/Populators/TypeContainerVisitor.cs:line 92

I don't know if this fix is really fixing the problem, but it avoids using Microsoft.CodeAnalysis.SeparatedSyntaxList1.Enumerator.get_Current()`, which might be causing the issue.

@github-actions github-actions bot added the C# label Nov 15, 2023
@tamasvajk tamasvajk changed the title C#: Add test for assembly attributes in standalone extraction C#: Extract assembly attributes in standalone extraction Nov 15, 2023
@tamasvajk tamasvajk changed the title C#: Extract assembly attributes in standalone extraction C#: Fix assembly attribute extraction in standalone mode Nov 15, 2023
@tamasvajk tamasvajk marked this pull request as ready for review November 15, 2023 12:47
@tamasvajk tamasvajk requested a review from a team as a code owner November 15, 2023 12:47
Copy link
Contributor

@michaelnebel michaelnebel left a comment

Choose a reason for hiding this comment

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

LGTM 👍
It will be interesting to see, if this yields crashes as well
The enumeration logic seems quite complicated (I just peeked the decompiled code). Does it make sense to run DCA to see if this has any semantical change that the tests didn't catch?

@tamasvajk
Copy link
Contributor Author

DCA doesn't show any change.

@tamasvajk tamasvajk merged commit 14268f3 into github:main Nov 16, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants