Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normal method is decompiled as lambda expression #3353

Open
CreateAndInject opened this issue Dec 22, 2024 · 3 comments
Open

Normal method is decompiled as lambda expression #3353

CreateAndInject opened this issue Dec 22, 2024 · 3 comments
Labels
Bug Decompiler The decompiler engine itself

Comments

@CreateAndInject
Copy link
Contributor

Language setting: C#1.0

public static MySettings Default
{
	get
	{
		if (!addedHandler)
		{
			object obj = addedHandlerLockObject;
			ObjectFlowControl.CheckForSyncLockOnValueType(obj);
			bool lockTaken = false;
			try
			{
				Monitor.Enter(obj, ref lockTaken);
				if (!addedHandler)
				{
					MyProject.Application.Shutdown += new ShutdownEventHandler(AutoSaveSettings);
					addedHandler = true;
				}
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(obj);
				}
			}
		}
		return defaultInstance;
	}
}

Language setting: >=C#2.0

public static MySettings Default
{
	get
	{
		if (!addedHandler)
		{
			object obj = addedHandlerLockObject;
			ObjectFlowControl.CheckForSyncLockOnValueType(obj);
			bool lockTaken = false;
			try
			{
				Monitor.Enter(obj, ref lockTaken);
				if (!addedHandler)
				{
					MyProject.Application.Shutdown += [DebuggerNonUserCode] [EditorBrowsable(EditorBrowsableState.Advanced)] (object sender, EventArgs e) =>
					{
						if (MyProject.Application.SaveMySettingsOnExit)
						{
							MySettingsProperty.Settings.Save();
						}
					};
					addedHandler = true;
				}
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(obj);
				}
			}
		}
		return defaultInstance;
	}
}
@CreateAndInject CreateAndInject added Bug Decompiler The decompiler engine itself labels Dec 22, 2024
@siegfriedpammer
Copy link
Member

Can you please provide the binary? This looks like the original code was VB.NET...

@CreateAndInject
Copy link
Contributor Author

Can you please provide the binary? This looks like the original code was VB.NET...

vb.zip
@siegfriedpammer Yes, it's VB.NET

@CreateAndInject
Copy link
Contributor Author

@siegfriedpammer A method with attributes should not be decompiled as lambda if current language setting doesn't support lambda with attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Decompiler The decompiler engine itself
Projects
None yet
Development

No branches or pull requests

2 participants