相关疑难解决方法(0)

如何在编码的编译代码中调试/中断

我有一个应用程序动态加载c#源文件并作为插件运行它们.当我在调试模式下运行主应用程序时,是否可以调试到动态程序集?显然设置断点是有问题的,因为源不是原始项目的一部分,但我是否应该介入或打破代码的异常?

有没有办法让编码器生成这个或什么的PDB?

这是我用于动态compliation的代码.

CSharpCodeProvider codeProvider = new CSharpCodeProvider(new Dictionary<string, string>() { { "CompilerVersion", "v3.5" } });
//codeProvider.
ICodeCompiler icc = codeProvider.CreateCompiler();

CompilerParameters parameters = new CompilerParameters();
parameters.GenerateExecutable = false;
parameters.GenerateInMemory = true;
parameters.CompilerOptions = string.Format("/lib:\"{0}\"", Application.StartupPath);
parameters.ReferencedAssemblies.Add("System.dll");
parameters.ReferencedAssemblies.Add("System.Core.dll");


CompilerResults results = icc.CompileAssemblyFromSource(parameters, Source);
DLL.CreateInstance(t.FullName, false, BindingFlags.Default, null, new object[] { engine }, null, null);
Run Code Online (Sandbox Code Playgroud)

.net c# debugging code-generation

21
推荐指数
2
解决办法
9294
查看次数

在Visual Studio .NET中调试动态加载的程序集

我正在使用C#和反射来加载和调用程序集中的方法.我有程序集本身的源代码.我需要做些什么才能使调试器进入(而不是结束)动态加载的程序集的代码?

如果我在....调用线上按F11,它只是跨过它..

谢谢

c# reflection debugging

13
推荐指数
2
解决办法
1万
查看次数

如何使用Reflection.Emit调试在运行时生成的IL代码

我试图在运行时使用Reflection.Emit命名空间中的DynamicMethod类生成一些代码但由于某种原因它抛出"VerificationException".这是我试图使用的IL代码...

ldarg.1
ldarg.0
ldfld, System.String FirstName
callvirt, Void Write(System.String)
ldarg.1
ldarg.0
ldfld, System.String LastName
callvirt, Void Write(System.String)
ldarg.1
ldarg.0
ldfld, Int32 Age
callvirt, Void Write(Int32)
ret
Run Code Online (Sandbox Code Playgroud)

我需要一种方法来调试生成的IL代码.我有什么选择?我正在使用VS2008专业版.

.net c# vb.net

9
推荐指数
1
解决办法
7744
查看次数

标签 统计

c# ×3

.net ×2

debugging ×2

code-generation ×1

reflection ×1

vb.net ×1