Why Does GENNET40 (.NET to Synergy Interop Generator) Generate a .NODEBUG for Interop Code?
When utilizing GENNET40 (https://www.synergex.com/docs/index.htm#tools/toolsChap4Gennet40utility.htm) 3 distinct files are generally generated as per the documentation (assuming you use interop.dbl as your output name):
- interop.dbl
- interop.inc
- interop1.dbl
.nodebug .include interop1.dbl
According to the documentation for .NODEBUG (https://www.synergex.com/docs/#lrm/lrmChap5NODEBUG.htm) this instructs the compiler to emit code that causes the runtime to be unable to set breakpoints within this code.
What is the design rationale for doing this?
Internally at Computers Unlimited we have several scripts that at a high level simply discards this tool generated interop.dbl and instead opts to use interop1.dbl (renaming it to interop.dbl).
While it is understandable that this is a significant amount of generated code internally when debugging we find it very useful to set breakpoints within the generated code. For example we usually set a breakpoint on the "new DotNetAssembly(string)" call as this (for us) is usually the first time the interop assembly is being invoked. It is often helpful to attach a CLR Debugger right before/shortly after this call. Other times we have set debugging points just prior to the execution of the interop call to ensure that the proper variables are being sent or evaluating their return for error conditions.
Is this bad? If so why?
How are other developers utilizing this API?
Is there a better way?
We’re definitely open to feedback on this, so if others have input, please share it here or with our Developer Support team. (FYI, the .NODEBUG was added in Synergy/DE 10.3.3d.)