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

ConvertConstructorCallIntoInitializer needs dedicated pretty test #1381

Open
siegfriedpammer opened this issue Jan 7, 2019 · 1 comment
Open
Labels
C# Decompiler The decompiler engine itself

Comments

@siegfriedpammer
Copy link
Member

While working on #1378, I discovered that there are some special cases with .cctor and beforefieldinit. We currently do not have dedicated tests that enumerate all possible ways of initializing fields.

@siegfriedpammer
Copy link
Member Author

siegfriedpammer commented Jan 7, 2019

One problem:

public class Test
{
	public static int a = 4;
	static Test()
	{
	}
}

gets decompiled as:

public class Test
{
	public static int a;
	static Test()
	{
		a = 4;
	}
}

The problem is, as soon as there is a static ctor defined in a type, the beforefieldinit flag no longer is emitted. The current transform does not transform type initializers that do not have the flag set on their type.

@siegfriedpammer siegfriedpammer added C# Decompiler The decompiler engine itself labels Jul 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C# Decompiler The decompiler engine itself
Projects
None yet
Development

No branches or pull requests

1 participant