Skip to content

Commit

Permalink
Fix #914: Exception when viewing an internal class in Roslyn assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
siegfriedpammer committed Dec 2, 2017
1 parent 930ed37 commit 9b13fe3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ICSharpCode.Decompiler/IL/ControlFlow/SwitchDetection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ void ProcessBlock(Block block, ref bool blockContainerNeedsCleanup)
KeyValuePair<LongSet, ILInstruction> defaultSection;
if (analysisSuccess && UseCSharpSwitch(analysis, out defaultSection)) {
// complex multi-block switch that can be combined into a single SwitchInstruction

var sw = new SwitchInstruction(new LdLoc(analysis.SwitchVariable));
ILInstruction switchValue = new LdLoc(analysis.SwitchVariable);
if (switchValue.ResultType == StackType.Unknown) {
// switchValue must have a result type of either I4 or I8
switchValue = new Conv(switchValue, PrimitiveType.I8, false, TypeSystem.Sign.Signed);
}
var sw = new SwitchInstruction(switchValue);
foreach (var section in analysis.Sections) {
sw.Sections.Add(new SwitchSection {
Labels = section.Key,
Expand Down

0 comments on commit 9b13fe3

Please sign in to comment.