Issue with Automatic Language Switching
I just started using LINQPad8 and encountered an issue, described as follows:
Currently, LINQPad's language is set to C# Expression(s). When I paste C# code that contains the Main function, the language automatically switches to C# Program, which is convenient.
However, at the same time, LINQPad adds an empty Main function at the top of the code, and I have to manually delete it each time, which is inconvenient.
I think that when pasting code into the editor, it should check whether a Main function already exists in the code. If it does, LINQPad should not add an empty Main function again.
To better illustrate the issue, I recorded a dynamic GIF demonstration.
https://i.ibb.co/B40nYbD/demo.gif
Empty Main function Code:
void Main() { }
Test Code:
using System; class Program { static void Main() { // Get the operating system version information var os = Environment.OSVersion; // Output the operating system platform and version number Console.WriteLine("Operating System Platform: " + os.Platform); Console.WriteLine("Operating System Version: " + os.Version); Console.WriteLine("Operating System Version String: " + os.VersionString); // Get the service pack information Console.WriteLine("Service Pack Version: " + os.ServicePack); } }
Comments
Thanks for reporting - this should now be fixed in the latest beta.
https://www.linqpad.net/linqpad8.aspx#beta