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

Using RoutedEvent<T> with custom event args type results in two global:: declarations #70

Open
otomad opened this issue Oct 4, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@otomad
Copy link

otomad commented Oct 4, 2024

Describe the bug

Using RoutedEvent<T> with custom routed event args type results in two global:: declarations, this will cause a compilation error.

Steps to reproduce the bug

Declare a RoutedEvent<T> with custom event args type like this:

[RoutedEvent<RoutedEventArgs>("Click", RoutedEventStrategy.Bubble)]

This will generate code like this:

[global::System.CodeDom.Compiler.GeneratedCode("DependencyPropertyGenerator", "1.4.0.0")]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public event global::global::System.Windows.RoutedEventArgs Click
{
    add => AddHandler(ClickEvent, value);
    remove => RemoveHandler(ClickEvent, value);
}

As you can see, the type name of the generated event contains two global:: declarations, which will cause a compilation error.
global::global::System.Windows.RoutedEventArgs

Expected behavior

Just need one "global::" declaration, get rid of the redundant, like this:

global::System.Windows.RoutedEventArgs

[global::System.CodeDom.Compiler.GeneratedCode("DependencyPropertyGenerator", "1.4.0.0")]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public event global::System.Windows.RoutedEventArgs Click
{
    add => AddHandler(ClickEvent, value);
    remove => RemoveHandler(ClickEvent, value);
}

Screenshots

image

NuGet package version

1.4.0

IDE

Visual Studio 2022

Additional context

No response

@otomad otomad added the bug Something isn't working label Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant