I'm using Roslyn
to dynamically compile arbitrary *.cs
files. I am able to generate the DLLs
and PDBs
and execute methods within the loaded assemblies via reflection, but when attaching the VS debugger from System.Diagnostics.Debugger.Launch()
, I'm getting 'source not available' errors. The 'Modules' windows in VS shows that the symbols have been loaded successfully. The source in question lives in a project under the same solution, but is not compiled until runtime.
Has anyone successfully gotten this working? Thanks!
reproduction: https://gist.github.com/toraora/a9d4eb8679383fe659da04d3be5c2d6e (I'll put up the actual solution when I finish setting up SSH keys on this machine)
Ah, so the solution was to have:
CSharpSyntaxTree.ParseText(File.ReadAllText(srcfile), path: srcfile, encoding: System.Text.Encoding.UTF8)
Thanks @hvd!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With