Closed Junjun-zhao closed 3 weeks ago
@marcpopMSFT This issue was found during our source compat testing for the 3rd party application. Could you please help check and triage it? In the meantime, could you confirm if this is a blocker for .NET 9 Preview 7?
Please help transfer to the correct team if this is not correct. Thanks very much.
@chsienki @jaredpar this seems to be Razor compiler related. Can you take a look?
Looking.
Interesting, this is related to the FUSE work. Where before we we're just emitting strings, we're now using nameof()
so have a real reference to the backing property, leading to the C# compiler (correctly) issuing a diagnostic about it being obsolete.
What's more interesting is that the design time code was correctly issuing the diagnostics
But you were still able to build due to the difference in runtime and design time code generation strategies.
My opinion on this is that this is not a bug, in fact it's the correct / desired behavior. So the expectations from the customers should be adjusted accordingly. So perhaps the compatibility testing app validation scenarios should be adjusted to account for this change.
Is the change introduced as part of the FUSE work considered as a breaking change or is it considered to be fixing a bug that was previously either being ignored or handled differently? Compat lab did not create this app. So we will need to notify the app owner and let them know that they need to make changes in their app to unblock adoption of .NET 9. The question is how common such usage could be in the real world and how many apps in the real world could be impacted similarly. Would you have documentation to make them aware of this change and what they need to do or reset customer expectations? cc @marklio
Another question... Are these our APIs that are obsoleted? Or are these obsoletions in the MudBlazor library? If they are ours, were they obsoleted following the appropriate deprecation policy? (it seems odd that they are "throw error" deprecated. I don't see warnings as errors in this app)
These are obsoletions in MudBlazor itself. The tested app is using properties that have been deprecated, and previously on the command line we wern't correctly surfacing the message (note that we were in the IDE).
I would argue that this is a case of fixing a bug, not introducing a breaking change: the library was correctly telling the application not to use these properties and we were incorrectly not informing the user.
Further, at the top the issue it's mentioned that these go away if you upgrade to MudBlazor 7.5.0. Looking at the source for MudBlazor these properties have been removed (hence the deprecation notice presumably). With the backing properties removed, the attributes just become HTML attributes which means the app is now broken at runtime, with no explanation to the user why.
So, we are now properly surfacing errors as the library has already declared. That makes sense. I assume that these "worked" at runtime?
With the backing properties removed, the attributes just become HTML attributes which means the app is now broken at runtime, with no explanation to the user why.
I realize it is orthogonal, but that seems like unfortunate behavior, particularly since we've been hiding the opportunity for obsoletion. Again, I don't think this really matters if adding "plan ol HTML attributes" to things is common. Might be nice to have an analyzer type thing that let you know the attribute isn't bound to anything. Again, I have no idea how useful/common that is.
I realize it is orthogonal, but that seems like unfortunate behavior, particularly since we've been hiding the opportunity for obsoletion. Again, I don't think this really matters if adding "plan ol HTML attributes" to things is common. Might be nice to have an analyzer type thing that let you know the attribute isn't bound to anything. Again, I have no idea how useful/common that is.
Yeah, this is interesting. I actually misspoke about these ending up as HTML attributes, it's up to the component in question what it does with them, but it's still valid to add arbitrary attributes to the component: https://learn.microsoft.com/en-us/aspnet/core/blazor/components/splat-attributes-and-arbitrary-parameters?view=aspnetcore-8.0#arbitrary-attributes
We might consider a warning when the component in question doesn't implement that feature, but that would definitely have to be behind a warning wave, which we haven't done yet. I'll make sure to open an issue to track that so we don't forget it.
Closing this issue as it is by design according to comment https://github.com/dotnet/sdk/issues/42509#issuecomment-2265937684 and a new complier warning filed in warning wave https://github.com/dotnet/sdk/issues/42509#issuecomment-2266049204
Application Name: CleanArchitecture2 OS: Windows 10 21H2 CPU: X64 .NET Build Number: dotnet-sdk-9.0.100-preview.7.24379.15 App Source checking at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2183568 Github Link: https://github.com/blazorhero/CleanArchitecture
Verify Scenarios: 1). Windows 10 21H2 AMD64 + dotnet-sdk-6.0.424:Pass 2). Windows 10 21H2 AMD64 +dotnet-sdk-9.0.100-preview.6.24328.19: Pass 3). Windows 10 21H2 AMD64 +dotnet-sdk-9.0.100-preview.7.24379.15: Fail
Description : When build the 3rd party application with the latest .NET 9 build "dotnet-sdk-9.0.100-preview.7.24379.15", it throws obsolete exception such as "
error CS0619: 'MudMenu.OffsetX' is obsolete: 'Use AnchorOrigin or TransformOrigin instead
". After investigation, we found it is related to the MudBlazor Nuget package(Version : 6.0.2).This does not reproduce on dotnet-sdk-9.0.100-preview.6.24328.19. Could you help confirm whether this is expected? If Yes, is this a breaking change?
Findings: The CS0619 error will be gone after upgrade the MudBlazor nuget package from V6.0.2 to the latest V7.5.0.
Minimal Repro Steps: The machine has dotnet-sdk-9.0.100-preview.7.24379.15 installed
@using MudBlazor
@inherits LayoutComponentBase
D:\ReproBugDeMO\BlazorAppDemo\BlazorAppDemo\obj\Debug\net6.0\Microsoft.CodeAnalysis.Razor.Compiler\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Shared_MainLayout_razor.g.cs(114,51): error CS0619: 'MudMenu.Direction' is obsolete: 'Use AnchorOrigin or TransformOrigin instead.' D:\ReproBugDeMO\BlazorAppDemo\BlazorAppDemo\obj\Debug\net6.0\Microsoft.CodeAnalysis.Razor.Compiler\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Shared_MainLayout_razor.g.cs(131,51): error CS0619: 'MudMenu.OffsetX' is obsolete: 'Use AnchorOrigin or TransformOrigin instead.' D:\ReproBugDeMO\BlazorAppDemo\BlazorAppDemo\obj\Debug\net6.0\Microsoft.CodeAnalysis.Razor.Compiler\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Shared_MainLayout_razor.g.cs(148,52): error CS0619: 'MudMenu.OffsetY' is obsolete: 'Use AnchorOrigin or TransformOrigin instead.'
Dotnet Info:
@dotnet-actwx-bot @dotnet/compat