From d8140c907377431975866546bd5a070737c6fa0b Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Tue, 8 Jul 2025 22:47:14 +0200 Subject: [PATCH 1/2] Local and Copilot dev can generate public apis Currently, the only way is to use the IDE and the lightbulb - or manually. This is often not successful and AI still struggles as well. The new version of the Mono.ApiTools.MSBuildTasks package now has the ability to generate the files and they can be checked in during development to show the actual API changes. Local dev will start generating automatically. The rules would be if this is release of CI, then it is set to Validate only, and then only if it is debug AND not CI (ie: local) will it enable generation. --- eng/NuGetVersions.targets | 4 +++ eng/Versions.props | 1 + src/Controls/src/Core/Element/Element.cs | 2 -- src/Controls/src/Core/Layout/FlexLayout.cs | 2 -- .../net-android/PublicAPI.Unshipped.txt | 2 ++ .../PublicAPI/net-ios/PublicAPI.Unshipped.txt | 2 ++ .../net-maccatalyst/PublicAPI.Unshipped.txt | 2 ++ .../net-tizen/PublicAPI.Unshipped.txt | 2 ++ .../net-windows/PublicAPI.Unshipped.txt | 2 ++ .../PublicAPI/net/PublicAPI.Unshipped.txt | 2 ++ .../netstandard/PublicAPI.Unshipped.txt | 2 ++ src/PublicAPI.targets | 33 +++++++++++++++++-- .../Resizetizer/src/Resizetizer.csproj | 2 +- 13 files changed, 51 insertions(+), 7 deletions(-) diff --git a/eng/NuGetVersions.targets b/eng/NuGetVersions.targets index 7652b1296654..66e556575229 100644 --- a/eng/NuGetVersions.targets +++ b/eng/NuGetVersions.targets @@ -263,6 +263,10 @@ Update="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="$(MicrosoftCodeAnalysisPublicApiAnalyzersVersion)" /> + 6.0.0 17.9.5 17.9.5 + 0.4.0 <_XamarinAndroidGlideVersion>4.16.0.12 diff --git a/src/Controls/src/Core/Element/Element.cs b/src/Controls/src/Core/Element/Element.cs index 03bcc445406b..dbedf14391f4 100644 --- a/src/Controls/src/Core/Element/Element.cs +++ b/src/Controls/src/Core/Element/Element.cs @@ -504,9 +504,7 @@ public bool EffectIsAttached(string name) //this is only used by XAMLC, not added to public API [EditorBrowsable(EditorBrowsableState.Never)] -#pragma warning disable RS0016 // Add public types and members to the declared API public INameScope transientNamescope; -#pragma warning restore RS0016 // Add public types and members to the declared API /// Returns the element that has the specified name. /// The name of the element to be found. diff --git a/src/Controls/src/Core/Layout/FlexLayout.cs b/src/Controls/src/Core/Layout/FlexLayout.cs index acebf1f4b6bc..b32551ce2a1a 100644 --- a/src/Controls/src/Core/Layout/FlexLayout.cs +++ b/src/Controls/src/Core/Layout/FlexLayout.cs @@ -464,9 +464,7 @@ void InitItemProperties(IView view, Flex.Item item) // Until we can rewrite the FlexLayout engine to handle measurement properly (without the "in measure mode" hacks) // we need to replace the default implementation of CrossPlatformMeasure. // And we need to disable the public API analyzer briefly, because it doesn't understand hiding. -#pragma warning disable RS0016 // Add public types and members to the declared API new public Graphics.Size CrossPlatformMeasure(double widthConstraint, double heightConstraint) -#pragma warning restore RS0016 // Add public types and members to the declared API { var layoutManager = _layoutManager ??= CreateLayoutManager(); diff --git a/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt index 7a5d90a5f28f..bbf0f6542ffd 100644 --- a/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt @@ -1,4 +1,6 @@ #nullable enable +~Microsoft.Maui.Controls.Element.transientNamescope -> Microsoft.Maui.Controls.Internals.INameScope +Microsoft.Maui.Controls.FlexLayout.CrossPlatformMeasure(double widthConstraint, double heightConstraint) -> Microsoft.Maui.Graphics.Size override Microsoft.Maui.Controls.ContentPresenter.OnSizeAllocated(double width, double height) -> void override Microsoft.Maui.Controls.ScrollView.OnSizeAllocated(double width, double height) -> void override Microsoft.Maui.Controls.TemplatedView.OnSizeAllocated(double width, double height) -> void diff --git a/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt index 7a5d90a5f28f..bbf0f6542ffd 100644 --- a/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt @@ -1,4 +1,6 @@ #nullable enable +~Microsoft.Maui.Controls.Element.transientNamescope -> Microsoft.Maui.Controls.Internals.INameScope +Microsoft.Maui.Controls.FlexLayout.CrossPlatformMeasure(double widthConstraint, double heightConstraint) -> Microsoft.Maui.Graphics.Size override Microsoft.Maui.Controls.ContentPresenter.OnSizeAllocated(double width, double height) -> void override Microsoft.Maui.Controls.ScrollView.OnSizeAllocated(double width, double height) -> void override Microsoft.Maui.Controls.TemplatedView.OnSizeAllocated(double width, double height) -> void diff --git a/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt index 7a5d90a5f28f..bbf0f6542ffd 100644 --- a/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt @@ -1,4 +1,6 @@ #nullable enable +~Microsoft.Maui.Controls.Element.transientNamescope -> Microsoft.Maui.Controls.Internals.INameScope +Microsoft.Maui.Controls.FlexLayout.CrossPlatformMeasure(double widthConstraint, double heightConstraint) -> Microsoft.Maui.Graphics.Size override Microsoft.Maui.Controls.ContentPresenter.OnSizeAllocated(double width, double height) -> void override Microsoft.Maui.Controls.ScrollView.OnSizeAllocated(double width, double height) -> void override Microsoft.Maui.Controls.TemplatedView.OnSizeAllocated(double width, double height) -> void diff --git a/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt index 7a5d90a5f28f..bbf0f6542ffd 100644 --- a/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Unshipped.txt @@ -1,4 +1,6 @@ #nullable enable +~Microsoft.Maui.Controls.Element.transientNamescope -> Microsoft.Maui.Controls.Internals.INameScope +Microsoft.Maui.Controls.FlexLayout.CrossPlatformMeasure(double widthConstraint, double heightConstraint) -> Microsoft.Maui.Graphics.Size override Microsoft.Maui.Controls.ContentPresenter.OnSizeAllocated(double width, double height) -> void override Microsoft.Maui.Controls.ScrollView.OnSizeAllocated(double width, double height) -> void override Microsoft.Maui.Controls.TemplatedView.OnSizeAllocated(double width, double height) -> void diff --git a/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt index 7a5d90a5f28f..bbf0f6542ffd 100644 --- a/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt @@ -1,4 +1,6 @@ #nullable enable +~Microsoft.Maui.Controls.Element.transientNamescope -> Microsoft.Maui.Controls.Internals.INameScope +Microsoft.Maui.Controls.FlexLayout.CrossPlatformMeasure(double widthConstraint, double heightConstraint) -> Microsoft.Maui.Graphics.Size override Microsoft.Maui.Controls.ContentPresenter.OnSizeAllocated(double width, double height) -> void override Microsoft.Maui.Controls.ScrollView.OnSizeAllocated(double width, double height) -> void override Microsoft.Maui.Controls.TemplatedView.OnSizeAllocated(double width, double height) -> void diff --git a/src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt index 7a5d90a5f28f..bbf0f6542ffd 100644 --- a/src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt @@ -1,4 +1,6 @@ #nullable enable +~Microsoft.Maui.Controls.Element.transientNamescope -> Microsoft.Maui.Controls.Internals.INameScope +Microsoft.Maui.Controls.FlexLayout.CrossPlatformMeasure(double widthConstraint, double heightConstraint) -> Microsoft.Maui.Graphics.Size override Microsoft.Maui.Controls.ContentPresenter.OnSizeAllocated(double width, double height) -> void override Microsoft.Maui.Controls.ScrollView.OnSizeAllocated(double width, double height) -> void override Microsoft.Maui.Controls.TemplatedView.OnSizeAllocated(double width, double height) -> void diff --git a/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt index 7c63553c2d6c..eccb8e26edb0 100644 --- a/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Unshipped.txt @@ -1,4 +1,6 @@ #nullable enable +~Microsoft.Maui.Controls.Element.transientNamescope -> Microsoft.Maui.Controls.Internals.INameScope +Microsoft.Maui.Controls.FlexLayout.CrossPlatformMeasure(double widthConstraint, double heightConstraint) -> Microsoft.Maui.Graphics.Size override Microsoft.Maui.Controls.ScrollView.OnSizeAllocated(double width, double height) -> void override Microsoft.Maui.Controls.TemplatedView.OnSizeAllocated(double width, double height) -> void override Microsoft.Maui.Controls.ContentPresenter.OnSizeAllocated(double width, double height) -> void diff --git a/src/PublicAPI.targets b/src/PublicAPI.targets index 6383438b35cf..ada3fc19d068 100644 --- a/src/PublicAPI.targets +++ b/src/PublicAPI.targets @@ -1,8 +1,22 @@ + + + Generate + + Validate + + Validate + + Generate + + Validate + + - + + @@ -25,4 +39,19 @@ - \ No newline at end of file + + + + + + + + + diff --git a/src/SingleProject/Resizetizer/src/Resizetizer.csproj b/src/SingleProject/Resizetizer/src/Resizetizer.csproj index 7f672456ee02..54e1b0b79996 100644 --- a/src/SingleProject/Resizetizer/src/Resizetizer.csproj +++ b/src/SingleProject/Resizetizer/src/Resizetizer.csproj @@ -33,7 +33,7 @@ - + <_AdjustmentsAssembly>$(PkgSvg_Skia)\lib\netstandard2.0\Svg.Skia.dll From 5414c1bd2455bf9dcbcf1828357e7b1bea5044f6 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Wed, 16 Jul 2025 17:23:16 +0200 Subject: [PATCH 2/2] Update PublicAPI.targets --- src/PublicAPI.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PublicAPI.targets b/src/PublicAPI.targets index ada3fc19d068..b301a9e47837 100644 --- a/src/PublicAPI.targets +++ b/src/PublicAPI.targets @@ -8,7 +8,7 @@ Validate - Generate + Validate