[Mono-bugs] [Bug 31470][Nor] Changed - unnecessary leave after throw

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
4 Oct 2002 08:58:02 -0000

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by lupus@ximian.com.


--- shadow/31470	Fri Oct  4 00:20:50 2002
+++ shadow/31470.tmp.25986	Fri Oct  4 04:58:02 2002
@@ -3,13 +3,13 @@
 Version: unspecified
 OS: unknown
 OS Details: 
 Status: NEW   
 Severity: Unknown
-Priority: Minor
+Priority: Normal
 Component: Misc
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: dietmar@ximian.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
@@ -174,6 +174,32 @@
 I do not know that this can be fixed with MCS at all
 ------- Additional Comments From miguel@ximian.com  2002-10-04 00:20 -------
 Resetting priority to minor for now.
 I think this should be worked around in our runtime
+------- Additional Comments From lupus@ximian.com  2002-10-04 04:58 -------
+The code si invalid IL code, there is no way to work around this mcs
+bug (caused by a reflection API misfeature).
+The fix in the runtime is to throw an InvalidProgramException and
+avoid the loop, but there is no way that kind of code can be executed.
+mcs needs to guarantee that at the end of the exception blocks
+there is some IL code (either from the C# code or generated
+automatically by mcs).
+You should ask martin how he solved the other bug I referenced above
+(there is some discussion in that bug report, too).
+I don't know how martin fixed the other case, but here is my
+suggestion: after each EndExceptionBlock() call mcs should check if
+it needs to emit some more code (as part of the method).
+If there is no more code to emit, mcs needs to guarantee that the
+method has valid IL code and as such, it needs to insert something
+like this:
+  newobj [mscorlib]System.Exception::.ctor()
+  throw
+This is the easiest thing to do since you don't have to deal with
+returning a value if the method doesn't return void.
+Note that this code is never executed anyway, but it needs to be there
+for the code to be valid.
+Also note that mcs produces the invalid code also when running on the
+ms runtime.