Thanks.

Placing the referenced assembly in the same folder as the generated one
solved the issue. Many thanks!


On Tue, May 27, 2014 at 4:22 PM, Jb Evain <[email protected]> wrote:

> It does. "Unable to resolve token" is a pretty broad error message,
> and it might indicate that peverify is unable to resolve the assembly
> in which the reference is defined.
>
> Jb
>
> On Tue, May 27, 2014 at 1:00 PM, Lior Tal <[email protected]> wrote:
> > Not sure. Actually the referenced assembly was not placed in the same
> folder
> > as the tested assembly. It sjould probably fail...
> >
> > I thought peverify only verified the integrity of the tested assembly,
> > without resolving dependencies.
> >
> > On 27 May 2014 13:27, "Jb Evain" <[email protected]> wrote:
> >>
> >> Hi,
> >>
> >> I don't see any obvious issue here.
> >>
> >> Is peverify able to resolve the assembly in which the method is defined?
> >>
> >> Jb
> >>
> >> On Tue, May 27, 2014 at 10:52 AM, Lior Tal <[email protected]> wrote:
> >> > Hi All,
> >> >
> >> > I'm using Mono.Cecil to dynamically generate an assembly. I'm
> >> > encountering
> >> > an error when attempting to verify the generated assembly using
> >> > PEVerify:
> >> >
> >> > An example for an error:
> >> >
> >> > [IL]: Error: [D:\Output.dll :
> >> >
> >> >
> com.flurry.org.codehaus.jackson.map.util.Comparators::getArrayComparator][offset
> >> > 0x0000000A] Unable to resolve token.
> >> >
> >> > In this offset in IL i am calling a method that is referenced from
> >> > another
> >> > assembly. I am not sure whether i am using the API correctly.
> >> >
> >> > Here's my code:
> >> >
> >> >             var assemblyDefinition = new
> >> > AssemblyNameDefinition("Output",
> >> > new Version(1, 0, 0, 0));
> >> >             var asm =
> >> > AssemblyDefinition.CreateAssembly(assemblyDefinition,
> >> > "Output", ModuleKind.Dll);
> >> >
> >> >             // The generated assembly imports a type from the current
> >> > assembly to call its method.
> >> >             var proxy = asm.MainModule.Import(typeof(JavaProxy));
> >> >             var td = proxy.Resolve();
> >> >
> >> >             var methodDefinition = td.Methods.First(md => md.Name ==
> >> > "Call");
> >> >             var methodReference =
> >> > asm.MainModule.Import(methodDefinition);
> >> >
> >> > Later on, adding a call to the methodReference:
> >> >
> >> >
> method.Body.Instructions.Add(Instruction.Create(OpCodes.Ldstr,
> >> > newType.FullName));
> >> >
> method.Body.Instructions.Add(Instruction.Create(OpCodes.Ldstr,
> >> > method.Name));
> >> >
> method.Body.Instructions.Add(Instruction.Create(OpCodes.Call,
> >> > methodReference));
> >> >
> method.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
> >> >
> >> >
> >> > What am i doing wrong?
> >> >
> >> > Any help would be appreciated.
> >> >
> >> > Thanks,
> >> > Lior
> >> >
> >> >
> >> > --
> >> > --
> >> > --
> >> > 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.
> >>
> >> --
> >> --
> >> --
> >> 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.
> >
> > --
> > --
> > --
> > 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.
>
> --
> --
> --
> 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.
>

-- 
-- 
--
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.

Reply via email to