diff --git a/nukebuild/RefAssemblyGenerator.cs b/nukebuild/RefAssemblyGenerator.cs
index 5c5324ac8f..61cb04c438 100644
--- a/nukebuild/RefAssemblyGenerator.cs
+++ b/nukebuild/RefAssemblyGenerator.cs
@@ -39,10 +39,13 @@ public class RefAssemblyGenerator
ProcessType(nested, obsoleteCtor);
if (type.IsInterface)
{
- var hideMethods = type.Name.EndsWith("Impl");
+ var hideMethods = type.Name.EndsWith("Impl")
+ || (type.HasCustomAttributes && type.CustomAttributes.Any(a =>
+ a.AttributeType.FullName == "Avalonia.Metadata.PrivateApiAttribute"));
+
var injectMethod = hideMethods
|| type.CustomAttributes.Any(a =>
- a.AttributeType.FullName.EndsWith("NotClientImplementableAttribute"));
+ a.AttributeType.FullName == "Avalonia.Metadata.NotClientImplementableAttribute");
if (hideMethods)
{
@@ -65,7 +68,7 @@ public class RefAssemblyGenerator
}
var forceUnstable = type.CustomAttributes.Any(a =>
- a.AttributeType.FullName.EndsWith("UnstableAttribute"));
+ a.AttributeType.FullName == "Avalonia.Metadata.UnstableAttribute");
foreach (var m in type.Methods)
MarkAsUnstable(m, obsoleteCtor, forceUnstable);
@@ -81,11 +84,10 @@ public class RefAssemblyGenerator
{
if (!force
|| def.HasCustomAttributes == false
- || !def.CustomAttributes.Any(a =>
- a.AttributeType.FullName.EndsWith("UnstableAttribute")))
+ || def.CustomAttributes.All(a => a.AttributeType.FullName != "Avalonia.Metadata.UnstableAttribute"))
return;
-
- if (def.CustomAttributes.Any(a => a.TypeFullName.EndsWith("ObsoleteAttribute")))
+
+ if (def.CustomAttributes.Any(a => a.TypeFullName == "System.ObsoleteAttribute"))
return;
def.CustomAttributes.Add(new CustomAttribute(obsoleteCtor, new CAArgument[]
diff --git a/src/Avalonia.Base/Metadata/PrivateApiAttribute.cs b/src/Avalonia.Base/Metadata/PrivateApiAttribute.cs
new file mode 100644
index 0000000000..3f60940c5e
--- /dev/null
+++ b/src/Avalonia.Base/Metadata/PrivateApiAttribute.cs
@@ -0,0 +1,9 @@
+using System;
+
+namespace Avalonia.Metadata;
+
+[AttributeUsage(AttributeTargets.Interface)]
+public sealed class PrivateApiAttribute : Attribute
+{
+
+}
\ No newline at end of file
diff --git a/src/Avalonia.Base/Platform/ICursorFactory.cs b/src/Avalonia.Base/Platform/ICursorFactory.cs
index fff1f92d53..99a9a9d7fa 100644
--- a/src/Avalonia.Base/Platform/ICursorFactory.cs
+++ b/src/Avalonia.Base/Platform/ICursorFactory.cs
@@ -1,9 +1,11 @@
using Avalonia.Input;
+using Avalonia.Metadata;
#nullable enable
namespace Avalonia.Platform
{
+ [PrivateApi]
public interface ICursorFactory
{
ICursorImpl GetCursor(StandardCursorType cursorType);
diff --git a/src/Avalonia.Base/Platform/IPlatformRenderInterface.cs b/src/Avalonia.Base/Platform/IPlatformRenderInterface.cs
index 81fe2c046f..6f62c3be1d 100644
--- a/src/Avalonia.Base/Platform/IPlatformRenderInterface.cs
+++ b/src/Avalonia.Base/Platform/IPlatformRenderInterface.cs
@@ -11,7 +11,7 @@ namespace Avalonia.Platform
///
/// Defines the main platform-specific interface for the rendering subsystem.
///
- [Unstable]
+ [Unstable, PrivateApi]
public interface IPlatformRenderInterface
{
///
@@ -201,7 +201,7 @@ namespace Avalonia.Platform
bool IsSupportedBitmapPixelFormat(PixelFormat format);
}
- [Unstable]
+ [Unstable, PrivateApi]
public interface IPlatformRenderInterfaceContext : IOptionalFeatureProvider, IDisposable
{
///
diff --git a/src/Avalonia.Controls/Platform/IPlatformIconLoader.cs b/src/Avalonia.Controls/Platform/IPlatformIconLoader.cs
index 4c844ce30f..2ff74cc582 100644
--- a/src/Avalonia.Controls/Platform/IPlatformIconLoader.cs
+++ b/src/Avalonia.Controls/Platform/IPlatformIconLoader.cs
@@ -3,7 +3,7 @@ using Avalonia.Metadata;
namespace Avalonia.Platform
{
- [Unstable]
+ [Unstable, PrivateApi]
public interface IPlatformIconLoader
{
IWindowIconImpl LoadIcon(string fileName);
diff --git a/src/Avalonia.Controls/Platform/IWindowingPlatform.cs b/src/Avalonia.Controls/Platform/IWindowingPlatform.cs
index 5acc5adccd..f6cf8c604e 100644
--- a/src/Avalonia.Controls/Platform/IWindowingPlatform.cs
+++ b/src/Avalonia.Controls/Platform/IWindowingPlatform.cs
@@ -2,7 +2,7 @@ using Avalonia.Metadata;
namespace Avalonia.Platform
{
- [Unstable]
+ [Unstable, PrivateApi]
public interface IWindowingPlatform
{
IWindowImpl CreateWindow();