Hi!,

I´m working with cecil to modify a library.

When I add some code to the assembly, Cecils seems to make some
changes in my code that makes the assembly not to work correctly.
The real source code is:
string sURL;
                        sURL = "http://www.eazel.es";;

                        WebRequest wrGETURL;

IL:
IL_0000:  nop
  IL_0001:  ldstr      "http://www.eazel.es";
  IL_0006:  stloc.0
  IL_0007:  ldloc.0
  IL_0008:  call       class [System]System.Net.WebRequest
[System]System.Net.WebRequest::Create(string)

And I´m adding a call to Console.WriteLine at the beginning. But when
I save the new assembly with Cecil:
IL_0000:  nop
  IL_0001:  ldstr      bytearray (68 00 74 00 74 00 70 00 3A 00 2F 00
2F 00 77 00   // h.t.t.p.:././.w.
                                  77 00 77 00 2E 00 65 00 61 00 7A 00
65 00 6C 00   // w.w...e.a.z.e.l.
                                  2E 00 65 00 73 00 FD
FF )                         // ..e.s...
  IL_0006:  stloc.0
  IL_0007:  ldstr      "Code added in Main"
  IL_000c:  call       void
[mscorlib]System.Console::WriteLine(string)
  IL_0011:  ldloc.0
  IL_0012:  call       class [System]System.Net.WebRequest
[System]System.Net.WebRequest::Create(string)

It changes the string to a bytearray and  makes webrequest not to work
because the URI format is invalid.

Please help.

Regards


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

Reply via email to