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

class file AddHandle(KeyDouwnEvent) out put AddHandle(KeyDouwnEvent) #3319

Closed
Tearies opened this issue Nov 1, 2024 · 2 comments
Closed
Labels
Bug Decompiler The decompiler engine itself

Comments

@Tearies
Copy link

Tearies commented Nov 1, 2024

Input code

 public AttachControl()
 {
     this.AddHandler(UIElement.KeyDownEvent, new KeyEventHandler(OnGotMouseCaptureEventDirect),true);
 }

Erroneous output

 public AttachControl()
 {
     this.AddHandler(UIElement.KeyDown, new KeyEventHandler(OnGotMouseCaptureEventDirect),true);
 }

Decompile:
image
Source:
image

Details

  • Product in use: e.g. ILSpy
  • Version in use: e.g. 9.0 preview 3
  • Any other relevant information to the issue, or your interest in contributing a fix.
@Tearies Tearies added Bug Decompiler The decompiler engine itself labels Nov 1, 2024
@Tearies
Copy link
Author

Tearies commented Nov 1, 2024

seems

internal static bool IsEventBackingFieldName(string fieldName, string eventName, out int suffixLength)
{
	suffixLength = 0;
	if (fieldName == eventName)
		return true;
	var vbSuffixLength = "Event".Length;
	if (fieldName.Length == eventName.Length + vbSuffixLength && fieldName.StartsWith(eventName, StringComparison.Ordinal) && fieldName.EndsWith("Event", StringComparison.Ordinal))
	{
		suffixLength = vbSuffixLength;
		return true;
	}
	return false;
}

caused this error

@Tearies
Copy link
Author

Tearies commented Nov 1, 2024

switch DecompilerSettings.DecompileAutomaticEvents to off . is correct.

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

1 participant