Fix InvalidCastException when exception filter contains a switch expression#48260
Merged
Conversation
RikkiGibson
approved these changes
Oct 5, 2020
Member
Member
Currently I don't think it's possible to cause the compiler to crash due to this, because the exception filter prologue is only introduced by subsequent lowering passes (specifically SpillSequenceSpiller which calls However, I think we should just do the same fix here. |
Member
|
Thanks @Youssef1313! |
333fred
added a commit
to 333fred/roslyn
that referenced
this pull request
Oct 30, 2020
…ervice * upstream/master: (131 commits) Fix SyntaxGenerator.InsertMembers for records (dotnet#48862) Register 64-bit Server GC brokered services Reduce length of the paths we make for temporary generated files Fix InvalidCastException when exception filter contains a switch expression (dotnet#48260) Use frozen partial semantics for commit. Renames Flip Simplify Simplify make things work in OOP add tests Remove Support add-using in Razor Show Analyzers that only contain source generators Remove unnecessary use of CODE_STYLE versioning. Update to roslyn-analyzers 3.3.2-beta1.20528.2 Don't crash when adding a parameter to the end of an extension method (dotnet#49007) Use TextDiff service Continue to map push diagnostics for razor. Procdump in integration tests (dotnet#48981) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Hopefully fixes #48259
This is a very quick fix by looking into the exception and stacktrace in SharpLab:
I found a similar cast in:
roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_TryStatement.cs
Line 91 in cf55f3a
Can you please review if this have a similar bug?