gpz, on 20 May 2014 - 05:08 AM, said:
Currently the .NET compiler in OpenRails is configured to compile directly into memory. Due to a bug (unimplemented feature?) in .NET in this case the debug info cannot be utilized. The compiler can be configured to compile to file instead, but in this case we must tell it where to save this file. This way the debug information could be used.
Not sure where you thought there was a bug, but the debugging problem is easily fixed: CompileAssemblyFromFile, not CompileAssemblyFromSource. :oldstry:
I've made this change and also adjusted the CompilerParameters so that we only generate debug information if you're running Open Rails under a debugger. It would be okay to always generate it because it is automatically deleted if you are not using a debugger, but it seems unnecessary to create it and then immediately delete it. It may be worth not always generating it when using a debugger though, as it'll leave a small temp file around (which can't be deleted because Visual Studio loads it), but I'm not hugely fussed.
To use this version in the debugger, the following works for me:
- Open Visual Studio
- Open the ORTS project
- Open the TCS script (File > Open > File... or Control-O)
- Set any breakpoints
- Run with debugging (F5)