D
dbwNick
Hallo,
I have a problem getting the line number of an exception thrown in an
executable generated using ICodeCompiler (from a source text file) and
then invoked.
I catch the TargetInvocationException in Invoke, but line number of
where the exception in the ICodeCompiler executable is thrown is
missing! However assemblies referenced by this executable can show
line numbers (if debug versions)
All that is said regarding the code compiled is that the exception was
at Main().
CompilerParameters.IncludeDebugInformation is set to True
Source snippet shown below:
Thanks for any help,
Nick
CompilerParameters cp = new CompilerParameters(assemblynames);
cp.GenerateExecutable = true;
cp.GenerateInMemory = true;
cp.IncludeDebugInformation = true;
TempFileCollection tfc = new TempFileCollection();
CompilerResults cr = new CompilerResults(tfc);
cr = icc.CompileAssemblyFromFile(cp, fileName);
If successful I invoke using:
System.Reflection.MethodInfo m = cr.CompiledAssembly.EntryPoint;
try{
m.Invoke(null, null);
}
catch(TargetInvocationException tie)
{
Console.WriteLine(tie.ToString());
Console.WriteLine(tie.InnerException.ToString());
}
I have a problem getting the line number of an exception thrown in an
executable generated using ICodeCompiler (from a source text file) and
then invoked.
I catch the TargetInvocationException in Invoke, but line number of
where the exception in the ICodeCompiler executable is thrown is
missing! However assemblies referenced by this executable can show
line numbers (if debug versions)
All that is said regarding the code compiled is that the exception was
at Main().
CompilerParameters.IncludeDebugInformation is set to True
Source snippet shown below:
Thanks for any help,
Nick
CompilerParameters cp = new CompilerParameters(assemblynames);
cp.GenerateExecutable = true;
cp.GenerateInMemory = true;
cp.IncludeDebugInformation = true;
TempFileCollection tfc = new TempFileCollection();
CompilerResults cr = new CompilerResults(tfc);
cr = icc.CompileAssemblyFromFile(cp, fileName);
If successful I invoke using:
System.Reflection.MethodInfo m = cr.CompiledAssembly.EntryPoint;
try{
m.Invoke(null, null);
}
catch(TargetInvocationException tie)
{
Console.WriteLine(tie.ToString());
Console.WriteLine(tie.InnerException.ToString());
}