Sorry, I make some mistakes. Such program can only run when the original program defines two variables..if the program contains varibles less than two, it can't work...
WHY? What did I miss? 在 2016年3月5日星期六 UTC+8下午4:19:32,[email protected]写道: > > I encounter a strange problem: CLR always tells me that there exists > invalid IL in methods, when the method is .ctor or there is nothing in the > code. > > but other methods can go right. For example, there is a .ctor method, and > its original IL like this: > > .ctor{ > IL_0000: ldarg.0 > IL_0001: call System.Void System.Object::.ctor() > IL_0006: ret > } > > after I modify it, it is like: > .ctor { > IL_0000: ldloc.0 > IL_0001: ldloc.1 > IL_0002: ldstr "IL_0000: ldarg " > IL_0007: stloc.0 > IL_0008: ldstr "..\..\..\MyLibrary\bin\Debug\trace.txt" > IL_000d: stloc.1 > IL_000e: ldloc.0 > IL_000f: ldloc.1 > IL_0010: call System.Void > MyLibrary.Scheduler::Write(System.String,System.String) > IL_0015: stloc.1 > IL_0016: stloc.0 > > IL_0017: ldarg.0 > IL_0018: ldloc.0 > IL_0019: ldloc.1 > IL_001a: ldstr "IL_0001: call System.Void System.Object::.ctor() " > IL_001f: stloc.0 > IL_0020: ldstr "..\..\..\MyLibrary\bin\Debug\trace.txt" > IL_0025: stloc.1 > IL_0026: ldloc.0 > IL_0027: ldloc.1 > IL_0028: call System.Void > MyLibrary.Scheduler::Write(System.String,System.String) > IL_002d: stloc.1 > IL_002e: stloc.0 > IL_002f: call System.Void System.Object::.ctor() > > IL_0034: ret > } > After modification, the program should output the running instruction > trace in a txt. And I have tried it in other program, it can work well. > > But when it comes to .ctor method or the method with nothing in it, the > CLR will give such error: there exists invalid instructions in program. > > What mistake have I made? Can you give me some advices?Thank you. > -- -- -- mono-cecil --- You received this message because you are subscribed to the Google Groups "mono-cecil" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
