Home

How to see "warnings" message in LINQPad?

edited March 7

In my query execution result, I see a status message below:

Query completed successfully with warnings ( 1.081 seconds)

Is there any way I can see the warnings message content?

Comments

  • I couldn't see any warnings sign on my query. There is no Output window to see warnings. Is there any trick to see that?

  • The warnings don't appear in the results/output tab, just in the editor window.

    Does the warning sign appear when you add an explicit warning eg #warning 'Test'

    What happens if you change and save your query and then create a new query that compiles it using Util.Compile ? This should show you all warnings, including some that are ignored by Linqpad, but it might help pinpoint the issue.

    Note that the warnings are only generated and hence only appear when the query is compiled and queries are only compiled when they have been changed. And Util.Compile seems to be behave the same way.

    Not sure how Linqpad handles warnings in MyExtensions , but if you get the Query completed successfully with warnings message on a completely blank query, the problem could be there.

  • If it was not for this thread, then I probably would not have paid attention to the warnings message that I got today, but I did not see the little yellow triangle anywhere, so I went investigating using Util.Compile. (As an aside I discovered a parameter which allows you to force a rebuild).

    I'm not sure whether your scenario is the same.

    This is a minimum repo

    Module1.linq

    void Main()
    {
        Util.Compile(Util.CurrentQueryPath, forceRebuild: true).Warnings.Where(a => !a.StartsWith("CS1701")).Dump();
    }
    
    public static void Test(Type? type)
    {
    
    }
    

    The nullable parameter does not generate a warning because I have #nullable enabled by default.

    However the script

    #load "module1"
    
    void Main()
    {
        Util.Compile(Util.CurrentQueryPath, forceRebuild:true).Warnings.Where(a=>!a.StartsWith("CS1701")).Dump();
    }
    

    produces

    It is almost as if #nullable is only applied after the #loaded script.
    Also not sure why it says line 5 when it looks like line 6.

Sign In or Register to comment.