Home
Options

#line hangs a run with an exception

This occurs in v4 and v5, and with both #line in C# and #ExternalSource in VB.NET.

Simplest example, in a new C# Statement(s) query:
Interaction.Beep();
#line 2 "Query3"   
throw new Exception();
When you run this, the Beep() occurs (via Microsoft.VisualBasic), and then just waits on something. The UI is still interactive, and trying a debug run and breaking shows nothing useful in any of the tabs.

With a more complex query, where I create my own exception that explicitly includes Environment.StackTrace calls, the #ExternalSource lines themselves are working properly, but if one begins before the exception is thrown the query hangs on the exception.


There's also a syntax highlight failure within #ExternalSource in v5 VB.NET.

This is also a feature request that you add these to the backend code you're generating so our stack traces show valid line numbers and the filenames we're using :-)

Comments

  • Options
    edited August 2015
    LINQPad itself relies on correct PDB information for error reporting and debugging, so if you mess with it, the result will be unpredictable.

    LINQPad also inserts its own #line directives in certain situations, so inserting your own messes with this, too.

    Is there any specific reason you need to do this?
  • Options
    I think I originally noticed this pasting in an existing code sample unchanged.

    So, no explicit reason, except as I mentioned at the end: we can see SomeQuery.linq, rather than query_random.vb, in stacktraces.
Sign In or Register to comment.