Skip to content

New MC3080 error when building existing .NET 8-targetting WPF code with .NET 10 SDK rc.2 #11235

@cyanite

Description

@cyanite

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.

Metadata

Metadata

Assignees

Labels

InvestigateRequires further investigation by the WPF team.area-NetSDK

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions