[Mono-bugs] [Bug 78570][Wis] Changed - Wrong/missing strack trace
information for nested type method
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Mon Jun 5 15:58:31 EDT 2006
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 rodrigobamboo at gmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=78570
--- shadow/78570 2006-06-03 13:26:26.000000000 -0400
+++ shadow/78570.tmp.14598 2006-06-05 15:58:31.000000000 -0400
@@ -1,12 +1,12 @@
Bug#: 78570
Product: Mono: Runtime
Version: 1.1
OS: unknown
OS Details: Windows XP
-Status: NEEDINFO
+Status: REOPENED
Resolution:
Severity: Unknown
Priority: Wishlist
Component: debug
AssignedTo: martin at ximian.com
ReportedBy: rodrigobamboo at gmail.com
@@ -100,6 +100,95 @@
------- Additional Comments From miguel at ximian.com 2006-06-03 13:26 -------
Please provide a small C#-based test case that illustrates the problem.
In addition, I realize this is an urgent bug for you, but the only
person that can fix this will not be around to fix this bug on time
for your release he is on vacation.
+
+------- Additional Comments From rodrigobamboo at gmail.com 2006-06-05 15:58 -------
+using System;
+using System.IO;
+using System.Reflection.Emit;
+using System.Reflection;
+using System.Diagnostics.SymbolStore;
+
+namespace BugReport
+{
+ public interface IFoo
+ {
+ void Bar();
+ }
+
+ class Program
+ {
+ const string DocumentPath = "/temp/test.cs";
+
+ static void Main(string[] args)
+ {
+ IFoo foo = EmitFoo();
+ try
+ {
+ foo.Bar();
+ }
+ catch (Exception x)
+ {
+ Assert(x.StackTrace.IndexOf(DocumentPath) != -1);
+ }
+ }
+
+ static void Assert(bool condition)
+ {
+ if (!condition) throw new ApplicationException();
+ }
+
+ static IFoo EmitFoo()
+ {
+ AppDomain currentDomain = AppDomain.CurrentDomain;
+ string fname = Path.Combine(currentDomain.BaseDirectory,
+"bugged.dll");
+
+ AssemblyName name = new AssemblyName();
+ name.Name = Path.GetFileNameWithoutExtension(fname);
+
+ AssemblyBuilder builder =
+currentDomain.DefineDynamicAssembly(name, AssemblyBuilderAccess.Save,
+Path.GetDirectoryName(fname), null);
+ ModuleBuilder module =
+builder.DefineDynamicModule(Path.GetFileName(fname), true);
+ ISymbolDocumentWriter document =
+module.DefineDocument(DocumentPath, SymDocumentType.Text,
+SymLanguageType.CSharp, Guid.Empty);
+
+ TypeBuilder outer = module.DefineType("Outer",
+TypeAttributes.Public | TypeAttributes.Class, typeof(object));
+ TypeBuilder inner = outer.DefineNestedType("Inner",
+TypeAttributes.NestedPublic | TypeAttributes.Class, typeof(object));
+ string typeName = "Outer+Inner";
+ //comment out the two lines above and uncomment the two lines
+ // below to see mono working
+ //TypeBuilder inner = module.DefineType("Inner",
+TypeAttributes.Public | TypeAttributes.Class, typeof(object));
+ //string typeName = "Inner";
+ inner.AddInterfaceImplementation(typeof(IFoo));
+
+ MethodBuilder foo = inner.DefineMethod("Bar",
+MethodAttributes.Public | MethodAttributes.Virtual, typeof(void), new
+Type[0]);
+ ILGenerator il = foo.GetILGenerator();
+ il.MarkSequencePoint(document, 10, 0, 11, 0);
+ il.ThrowException(typeof(ApplicationException));
+ // MONO uses the next sequence point as the line number
+for the
+ // exception above
+ il.MarkSequencePoint(document, 10, 0, 11, 0);
+ il.Emit(OpCodes.Ret);
+
+ inner.CreateType();
+ outer.CreateType();
+
+ builder.Save(Path.GetFileName(fname));
+ return
+(IFoo)Activator.CreateInstance(Assembly.LoadFrom(fname).GetType(typeName));
+ }
+ }
+}
+
More information about the mono-bugs
mailing list