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
Blazor Wasm: debugging broken by attribute with type parameter #86765
Comments
|
Tagging subscribers to this area: @thaystg Issue DetailsIs there an existing issue for this?
Describe the bugWhen a generic attribute is applied in a hosted Blazor Web Assembly project, debugging is broken. Reproduction is here: https://github.com/zbecknell/UndebuggableV2 Notice Clues as to how to fix this would hopefully be found in this old previous issue dotnet/aspnetcore#25380 where the same thing would happen when an attribute had an Expected BehaviorDebugging the client web assembly application hits breakpoints as expected. Steps To ReproduceRun and attempt to debug the client side of this hosted web assembly app: https://github.com/zbecknell/UndebuggableV2 Exceptions (if any)The console outputs this when failure occurs: .NET Version7.0.302 Anything else?System info (though this is reproduced across OSs):
|
|
@lambdageek |
|
@lewing yea we had some issue with generic custom attributes. Don't recall if it was resolved. The debugger is an interesting twist - I didn't know it looks at custom attributes. |
It walks them for debugger hints. @ilonatommy it looks like there is at least one places in DebugStore where it makes assumptions about the attribute metadata and casts without a guard, can you take a look. |
|
@lewing @ilonatommy The runtime issue that I was thinking of was resolved already. This works with both Mono and CoreCLR: using System;
using System.Reflection;
[AttributeUsage(AttributeTargets.Method, AllowMultiple=true)]
public class BadAttribute<T> : Attribute
{
public BadAttribute() {}
}
public class P
{
[Bad<int>]
[Bad<double>]
public static void Main() {
var mi = typeof(P).GetMethod("Main", BindingFlags.Static | BindingFlags.Public);
var cattrs = mi.GetCustomAttributes (typeof(BadAttribute<>));
foreach (var ca in cattrs)
Console.WriteLine ($"generic: {ca}");
var cattr = mi.GetCustomAttribute(typeof(BadAttribute<int>));
Console.WriteLine ($"instance<int>: {cattr}");
cattr = mi.GetCustomAttribute(typeof(BadAttribute<double>));
Console.WriteLine ($"instance<double>: {cattr}");
cattr = mi.GetCustomAttribute(typeof(BadAttribute<string>));
Console.WriteLine ($"instance<string>: {cattr}");
}
}Output: |
Could you, please give the link to the issue? I cannot find it and I just checked the above code pasted into hosted WASM to the Client and result is as described: edit: actually not that important, found the problem. |
|
Thank you everyone for fixing this so quickly! |
Is there an existing issue for this?
Describe the bug
When a generic attribute is applied in a hosted Blazor Web Assembly project, debugging is broken.
Reproduction is here: https://github.com/zbecknell/UndebuggableV2
Notice
Index.razoris applying@attribute [Bad<App>]. Remove that line and debugging now works.Clues as to how to fix this would hopefully be found in this old previous issue dotnet/aspnetcore#25380 where the same thing would happen when an attribute had an
enumparameter.Expected Behavior
Debugging the client web assembly application hits breakpoints as expected.
Steps To Reproduce
Run and attempt to debug the client side of this hosted web assembly app: https://github.com/zbecknell/UndebuggableV2
Exceptions (if any)
The console outputs this when failure occurs:
.NET Version
7.0.302
Anything else?
System info (though this is reproduced across OSs):
The text was updated successfully, but these errors were encountered: