thank you Jb,
I tried using ILDASM and changing the code and then rebuild my DLL ILASM.
two funny things:

   1. the same code which I grabbed from my generated IL, works fine with
   this way of building assembly
   2. I was able to call a non-existing method from one of my types which
   where in the built assembly! (its not that important now)


and the *.maxstack  130 *was not the source of problem.
but I've got more confused now. my hand written IL which works is here, you
can compare it with generated IL

  *.method /*06000252*/ private hidebysig **
          instance void  Init() cil managed
  {
    // Code size       1049 (0x419)
    .maxstack  130
    .locals /*11000008*/ init (int32 V_0,
             int32 V_1,
             bool V_2)

    nop
    call       valuetype [mscorlib]System.DateTime
[mscorlib]System.DateTime::get_Now()
    ldc.i4     0x7d8
    ldc.i4     0xb
    ldc.i4     0x12
    newobj     instance void [mscorlib]System.DateTime::.ctor(int32,
                                          int32,
                                          int32)
    call       bool [mscorlib]System.DateTime::op_GreaterThan(valuetype
[mscorlib]System.DateTime,
                                          valuetype
[mscorlib]System.DateTime)
    ldc.i4.0
    ceq
    brtrue.s   IL_0000
    ldstr      "WW91ciBMaWNlbnNlIElzIEV4cGlyZWQ="
    call       string
Negasht.Avl.App.MapControls.MapControl::d809d35285984881a241ab0519a9c147(string)
    newobj     instance void [mscorlib]System.Exception::.ctor(string)
    throw


    IL_0000:  nop
    IL_0001:  ldarg.0
    IL_0002:  call       class
[System/*23000003*/]System.Collections.Specialized.NameValueCollection/*0100011E*/
[System.Configuration/*23000014*/]System.Configuration.ConfigurationManager/*0100011D*/::get_AppSettings()
/* 0A000274 */*

On Tue, Nov 18, 2008 at 6:20 PM, Jb Evain <[EMAIL PROTECTED]> wrote:

>
> Hey,
>
> On 11/18/08, Knight Commander <[EMAIL PROTECTED]> wrote:
> > I've create an application which injects some code in each method which
> it
> > finds in a give assembly.
> > everything works find, but a single method, behaves in a way that CLR
> throws
> > "invalid program exception"
> >  as i investigated by comparing my generated code with what must be
> > generated, there were no difference but the max stack which has grown
> from 4
> > to 130!
> > this increase in maxStack is not normal, max stack of any other method as
> > increased by one!
> >
> > any suggestions?
>
> Are you using Cecil from svn head? If not, check with that.
>
> If you do, I'll need a way to reproduce the issue to investigate. But
> .maxstack is not supposed to be really used by the CLR. So it could be
> something else.
>
> What if you dissassemble using ildasm/change the maxstack/re-assemble
> with ilasm, does it work? If not, it could be Cecil writing a wrong
> assembly, or you generating wrong code.
>
> --
> Jb Evain  <[EMAIL PROTECTED]>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---

Reply via email to