Skip to content

Commit 38be737

Browse files
authored
Merge pull request #4093 from mansellan/4046
VB6 - Fix project and component events
2 parents 27f33e3 + 4b6147c commit 38be737

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Rubberduck.VBEditor.VB6/SafeComWrappers/VB/VBProject.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Diagnostics;
34
using System.Linq;
45
using System.Runtime.InteropServices;
56
using System.Text.RegularExpressions;
@@ -63,7 +64,20 @@ public EnvironmentMode Mode
6364
return 0;
6465
}
6566

66-
return (EnvironmentMode) EbMode();
67+
// Note - the value returned by the EbMode function does NOT match with the EnvironmentMode enum, hence remapped below.
68+
var ebMode = EbMode();
69+
switch (ebMode)
70+
{
71+
case 0:
72+
return EnvironmentMode.Design;
73+
case 1:
74+
return EnvironmentMode.Run;
75+
case 2:
76+
return EnvironmentMode.Break;
77+
default:
78+
Debug.Assert(false, $"Unexpected value '{ebMode}' returned from EbMode");
79+
return EnvironmentMode.Design;
80+
}
6781
}
6882
}
6983

0 commit comments

Comments
 (0)