Skip to content

C#: Handle non-critical exception in CIL local variable extraction #6578

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

Merged
merged 1 commit into from
Sep 1, 2021

Conversation

tamasvajk
Copy link
Contributor

@tamasvajk tamasvajk commented Aug 31, 2021

Fixes #6439.

I couldn't find a better way of handling this than catching the exception, logging it, and proceed with extraction. The assembly causing the issues was Microsoft.mshtml. ILSpy has similar issue when displaying the IL from this assembly. ildasm has no such issue.

@tamasvajk tamasvajk requested a review from a team as a code owner August 31, 2021 12:30
@github-actions github-actions bot added the C# label Aug 31, 2021

for (var l = 0; l < this.locals.Length; ++l)
if (!hasError)
Copy link
Contributor

Choose a reason for hiding this comment

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

I have a slight preference for if (hasError) return, as it reduces indentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We're still able to CIL extract the body even through we had trouble with the local variables, so we can't return early. Also, this method has yield returns , which can't be inside try-catch blocks. That's why this hasError was introduced. It's ugly, but I didn't have any better idea.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I mistakenly read the } on line 152 as the end of the method.

@tamasvajk tamasvajk merged commit e9ff6e8 into github:main Sep 1, 2021
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.

Unexpected C# extractor error: Uncaught exception. The method or operation is not implemented
2 participants