icsharpcode / ILSpy

.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform!
21.53k stars 3.35k forks source link

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

Open Tearies opened 2 hours ago

Tearies commented 2 hours ago

Input code

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

Erroneous output

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

Details

Tearies commented 2 hours ago

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 commented 1 hour ago

switch DecompilerSettings.DecompileAutomaticEvents to off . is correct.