开发者

Debugging executed CodeDom?

开发者 https://www.devze.com 2023-03-23 20:20 出处:网络
I am using codedom to execute some code. Is it possible to stop somehow the execution? here is how i run the code:

I am using codedom to execute some code. Is it possible to stop somehow the execution? here is how i run the code:

Dim SourceCode as String="... some VB code"
Dim MyProvider As New VBCodeProvider
Dim cp As New CompilerParameters
Dim cr As CompilerResults = MyProvider.Comp开发者_如何学JAVAileAssemblyFromSource(cp, SourceCode)
Dim methInfo As MethodInfo = cr.CompiledAssembly.GetType("Class1").GetMethod("Main")
methInfo.Invoke(Nothing, Nothing)

my idea is to put this in a threadworker and if I need to stop it, i stop the thread... but is there a better solution maybe? Thanks :)

0

精彩评论

暂无评论...
验证码 换一张
取 消