Skip to content

Add support for top-level statements #3954

Description

@Dremor

Input code

Console.WriteLine("Hello, World!");

This is the default code outputted by dotnet new create console

Erroneous output

In app:

// Test.Decompile.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// Program
using System;
using System.Runtime.CompilerServices;

[CompilerGenerated]
internal class Program
{
	private static void <Main>$(string[] args)
	{
		Console.WriteLine("Hello, World!");
	}
}

Exported:

using System;
using System.Runtime.CompilerServices;

[CompilerGenerated]
internal class Program
{
	private static void _003CMain_003E_0024(string[] args)
	{
		Console.WriteLine("Hello, World!");
	}
}

The compiler fails to find any "Main" method, as the "Main" method is incorrectly named.

Details

  • Product in use: ILSpy
  • Version in use: 11.0.0.9223-preview1+7554c1b0042dddac2a7385cea5b64f12dd52281b

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions