Thank you for referring me to peverify :)!

It seem like I have an error for each type defined, hehe.


[token  0x02000002] Type load failed.
[token  0x02000003] Type load failed.
[token  0x02000004] Type load failed.
[token  0x02000005] Type load failed.
[token  0x02000006] Type load failed.
[token  0x02000007] Type ....

then a few of these:

[MD]: Error: TypeDef that is not an Interface and not the Object class 
extends Nil token. [token:0x0200000D]

And last but not least, lots of
[MD]: Error: Method is marked Static but calling convention=0x00000020 is 
marked HASTHIS. [token:0x060002A1]

Which now seem to be the cause =)

I added the following:

if(function.IsStatic)
function.HasThis = false;

And that resolved the problem!

Den torsdagen den 23:e januari 2014 kl. 10:50:31 UTC+1 skrev Jb Evain:
>
> Could be. Your best bet is to run peverify on the assembly, it will 
> tell you if you're emitting something valid or not. 
>
> On Thu, Jan 23, 2014 at 10:32 AM, karl patrik johansson 
> <[email protected] <javascript:>> wrote: 
> > I have removed the function.Attributes = MethodAttributes... 
> > completely, generating the .dll again, updated the reference for the new 
> > project but still give me the same error. 
> > 
> > Is there any other reasons why this error could occour? 
> > 
> > Like, does it have anything to do with the defined Type that the 
> function is 
> > in? or even the AssemblyDefinition? 
> > 
> > Karl 
> > 
> > Den torsdagen den 23:e januari 2014 kl. 10:25:51 UTC+1 skrev Jb Evain: 
> >> 
> >> Hi, 
> >> 
> >> On Thu, Jan 23, 2014 at 10:18 AM, karl patrik johansson 
> >> <[email protected]> wrote: 
> >> > Error 8 'PapyrusDotNet.Core.Debug.MessageBox()' is not supported by 
> the 
> >> > language 
> >> > 
> C:\Users\Karlj\Dropbox\Projects\Active\PapyrusDotNet\TestDll\GodMode.cs 
> >> > 26 4 
> >> > TestDll 
> >> > 
> >> > 
> >> > the function 
> >> > public static void PapyrusDotNet.Core.Debug.MessageBox(string msg) 
> >> > is a empty method, as its just a dummy 
> >> > 
> >> > 
> >> > Attributes used when creating the function: 
> >> > function.Attributes = MethodAttributes.Public | 
> >> > Mono.Cecil.MethodAttributes.FamANDAssem | 
> >> > Mono.Cecil.MethodAttributes.Family 
> >> > | Mono.Cecil.MethodAttributes.Static | 
> >> > Mono.Cecil.MethodAttributes.HideBySig; 
> >> 
> >> That's 3 different visibility here. You're going to have to choose one 
> :) 
> >> 
> >> Plus the bitflags are masked, so I suggest you use the properties. 
> >> 
> >> Also if you're doing: 
> >> 
> >> > var function = new MethodDefinition(state.Name, 
> MethodAttributes.Public, 
> >> > MainModule.TypeSystem.Void); 
> >> > function.IsStatic = true; 
> >> 
> >> The .Attributes = line is superfluous. 
> >> 
> >> The rest looks good. 
> >> 
> >> Jb 
> > 
> > -- 
> > -- 
> > -- 
> > 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] <javascript:>. 
> > For more options, visit https://groups.google.com/groups/opt_out. 
>

-- 
-- 
--
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/groups/opt_out.

Reply via email to