Hi Barry
I have written the scripting engine as you suggested.
And that approach is working fine
Now I am getting stuck problems such as:
"Common Language Runtime detected an invalid program."
"Bad method token."
I have success with methods such as:
public void Test() {
}//method
and this one worked temporarily:
public int Test() {
return 3;
}//method
but not with such exotic methods as:
public string Test(string a, string b) {
return a + b;
}//method
this one is interesting:
public string Test() {
return "hello";
}//method
the string literal is not included in the method body IL
so that can never work ...
and some signature problems solved with:
SignatureHelper sh = SignatureHelper.GetLocalVarSigHelper();
dii.SetLocalSignature(sh.GetSignature());
I am getting the impression that the IL has to be "rebound" a bit like
rebasing a DLL
Have you had any success?
John
[quoted text, click to view] On Mar 15, 7:43 am, "John Rivers" <firs...@btinternet.com> wrote:
> That is a very good idea *-)
>
> At last my scripting engine will work ...
>
> - pass Source code to method in DLL in new AppDomain
> - method compiles and returns IL bytecode as byte[]
> - Unload AppDomain
> - create DynamicMethod with returned bytecode
>
> Thanks Barry
>
> On Mar 15, 1:10 am, Barry Kelly <barry.j.ke...@gmail.com> wrote:
>
>
>
> > John Rivers wrote:
> > > Thanks for your reply
>
> > > Unfortunately I can only call
> > > MethodBase.GetMethodBody() and GetILAsByteArray()
> > > on a loaded assembly
> > > which is what I am trying to avoid
> > > as you can not unload dot net DLL
>
> > You could do it in another AppDomain, and marshal the array across, no?
>
> > That way, you can unload the other AppDomain and the assemblies in it.
>
> > -- Barry
>
> > --
http://barrkel.blogspot.com/- Hide quoted text -
>
> - Show quoted text -