New MC3080 error when building existing .NET 8-targetting WPF code with .NET 10 SDK rc.2
This is difficult to describe in details, because it's in a rather large code base, and has not been reduced, but it happens when building existing code using the .NET 10 SDK (-rc2), but without any changes to the actual code, so still targeting .NET 8.
The error is:
...\StyleDictionary.xaml(306,180): error MC3080: The attached property 'VersatileListView.IsGroupButton' cannot be set because it does not have an accessible Set method accessor. [...Core.Windows.Controls.csproj]
This property is defined in xaml like this:
<ToggleButton x:Name="toggleButton" Grid.Column="1" IsTabStop="False" FocusVisualStyle="{StaticResource MiniToggleButtonFocus}" Template="{StaticResource MiniToggleButton}" local:VersatileListView.IsGroupButton="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=GridViewColumnHeader}, Path=Column}" Margin="0,0,5,0">
Where I assume (I am nowhere near an WPF expert) that the binding is "local:VersatileListView.IsGroupButton".
In the code, there is a getter and setter method like this:
internal static void SetIsGroupButton(DependencyObject obj, bool value)
{
obj.SetValue(IsGroupButtonProperty, value);
}
internal static bool GetIsGroupButton(DependencyObject obj)
{
return (bool)obj.GetValue(IsGroupButtonProperty);
}
Note that both are internal. If both, or even just the Set-method, are changed to public, the bug disappears, and of course we can, and will, do that in the code base. The problem is that we have a large code base with many branches and many supported releases, so this will be somewhat complicated. And I have not experienced similar regressions when building in the past, with newer SDKs.
The error happens in the MarkupCompilePass2 target, in the identically named MarkupCompilePass2 task from C:\Program Files\dotnet\sdk\10.0.100-rc.2.25502.107\Sdks\Microsoft.NET.Sdk.WindowsDesktop\tools\net10.0\PresentationBuildTasks.dll
Are regressions like this known or generally accepted, perhaps in some exotic cases, or how does it work?
Also: I can try to reduce this, if need be.
Same here in WPF UI repo:
https://github.com/lepoco/wpfui
Error: D:\a\wpfui\wpfui\src\Wpf.Ui\Controls\ProgressRing\ProgressRing.xaml(21,17): error MC3080: The Property Setter 'CoverRingStroke' cannot be set because it does not have an accessible set accessor. Line 21 Position 17. [D:\a\wpfui\wpfui\src\Wpf.Ui\Wpf.Ui.csproj::TargetFramework=net10.0-windows]
39 Warning(s)
1 Error(s)
Time Elapsed 00:00:22.45
Error: Process completed with exit code 1.
https://github.com/lepoco/wpfui/actions/runs/19300101170/job/55191974233?pr=1575
Also experiencing this on the Material Design in XAML project. As this is a library not an app, changing these to public is not really an option.
https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/actions/runs/19356978583/job/55380048679
I have a similar issue.
: Error MC3082: 'InnerVisualMode' cannot be set as the value of a Trigger's Property attribute because it does not have a public or internal get accessor
InnerVisualMode is internal, if I change to public, it's ok.
I also get the MC3082 issue after bumping global.json to .NET 10 SDK. This is building a .NET Framework WPF app with dotnet build. The error does not occur with msbuild.
EDIT: The error says the get accessor needs to be public or internal, but since the .NET 10 bump, it seems like it actually needs it to be public. Strange!