Home

lprun.exe runtime error, doesn't hapen when script is run from LINQPad IDE.

Hello,

Some environment details:
LINQPad v4.47.02(AnyCPU)
OS Name Microsoft Windows Server 2012 Standard
Version 6.2.9200 Build 9200
System Type x64-based PC


I am trying to figure out how I might diagnose an issue I am encountering when launching a script via the lprun.exe command line utility. When I run the script from the IDE interactively it runs and completes without any exceptions.

When the same script is run under the same user from the command line using: lprun.exe

I get this output.

c:\SQLTasks\Linqpad\Demographics\Demo_GenerateDemographicsSubset.linq(880,20) :
error CS0029: Cannot implicitly convert type 'string' to 'char?'

Due to how LINQPad compiles the script I cant easily locate the area in my script that might be causing this and I'd really like to know if possible what mechanisms might allow it to work interactively and fail from the command line.

I have been able to get more detailed output but it referenced a runtime compiled DLL in a temp directory and the source file was not available along side it (or I just couldn't locate it.)

Comments

  • The error is happening in line 880, column 20 of the source file. Open the .linq file with a text editor such as notepad and jump to that spot.
  • Thank you, that is what I needed.

    Still not sure why the error is happening but the line reference is exactly in a spot that would generate the error. In the IDE the code completion type inference shows an assignment from a variable from the data context member that is of the same type as the destination (a class member defined in the linq script. (char?) ).

    Is there reason to think that the lprun.exe would generate a context where the member becomes a string while the IDE context expresses it as a (char?). The underlying SQL type is (char(1), null) for this scenario.

    In any case I can move forward from here.
  • Also LINQPad is awesome, I have saved a great deal of time developing queries for SSRS and other quick proof-of-concept demonstrations.
  • Is there reason to think that the lprun.exe would generate a context where the member becomes a string while the IDE context expresses it as a (char?). The underlying SQL type is (char(1), null) for this scenario.
    Ah, that's the clue I need! Under Edit | Preferences | Query, there's a checkbox "Disable enhanced support for 1:1 relationships and single-character columns". I bet what's happening is that LINQPad is always reading that setting as positive in command-line mode.

    I'll check this out in more detail and post a new beta build within a day or two.

    Thanks

    Joe
Sign In or Register to comment.