diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorTests.cs b/tests/generator-Tests/Unit-Tests/CodeGeneratorTests.cs
index 0f69e4b10..d2a335a4d 100644
--- a/tests/generator-Tests/Unit-Tests/CodeGeneratorTests.cs
+++ b/tests/generator-Tests/Unit-Tests/CodeGeneratorTests.cs
@@ -147,6 +147,56 @@ public void ManagedOverrideMethod_Override ()
Assert.True (writer.ToString ().Contains ("public override unsafe int DoStuff ()"), $"was: `{writer.ToString ()}`");
}
+ [Test]
+ public void ManagedOverrideMethod_None ()
+ {
+ var xml = @"
+
+
+
+
+
+
+
+
+ ";
+
+ var gens = ParseApiDefinition (xml);
+ var klass = gens.Single (g => g.Name == "MyClass");
+
+ generator.Context.ContextTypes.Push (klass);
+ generator.WriteType (klass, string.Empty, new GenerationInfo ("", "", "MyAssembly"));
+ generator.Context.ContextTypes.Pop ();
+
+ // This would contain 'virtual' if the 'managedOverride' was not working
+ Assert.True (writer.ToString ().Contains ("public unsafe int DoStuff ()"), $"was: `{writer}`");
+ }
+
+ [Test]
+ public void ManagedOverrideInterfaceMethod_Reabstract ()
+ {
+ var xml = @"
+
+
+
+
+
+
+
+
+ ";
+
+ var gens = ParseApiDefinition (xml);
+ var iface = gens.Single (g => g.Name == "IMyInterface");
+
+ generator.Context.ContextTypes.Push (iface);
+ generator.WriteType (iface, string.Empty, new GenerationInfo ("", "", "MyAssembly"));
+ generator.Context.ContextTypes.Pop ();
+
+ // This would not contain 'abstract' if the 'managedOverride' was not working
+ Assert.True (writer.ToString ().Contains ("abstract int DoStuff ()"), $"was: `{writer}`");
+ }
+
[Test]
public void ManagedOverrideProperty_Virtual ()
{
@@ -195,6 +245,56 @@ public void ManagedOverrideProperty_Override ()
Assert.True (writer.ToString ().Contains ("public override unsafe int Name {"), $"was: `{writer.ToString ()}`");
}
+ [Test]
+ public void ManagedOverrideProperty_None ()
+ {
+ var xml = @"
+
+
+
+
+
+
+
+
+ ";
+
+ var gens = ParseApiDefinition (xml);
+ var klass = gens.Single (g => g.Name == "MyClass");
+
+ generator.Context.ContextTypes.Push (klass);
+ generator.WriteType (klass, string.Empty, new GenerationInfo ("", "", "MyAssembly"));
+ generator.Context.ContextTypes.Pop ();
+
+ // This would contain 'virtual' if the 'managedOverride' was not working
+ Assert.True (writer.ToString ().Contains ("public unsafe int Name {"), $"was: `{writer}`");
+ }
+
+ [Test]
+ public void ManagedOverrideInterfaceProperty_Reabstract ()
+ {
+ var xml = @"
+
+
+
+
+
+
+
+
+ ";
+
+ var gens = ParseApiDefinition (xml);
+ var iface = gens.Single (g => g.Name == "IMyInterface");
+
+ generator.Context.ContextTypes.Push (iface);
+ generator.WriteType (iface, string.Empty, new GenerationInfo ("", "", "MyAssembly"));
+ generator.Context.ContextTypes.Pop ();
+
+ // This would not contain 'abstract' if the 'managedOverride' was not working
+ Assert.True (writer.ToString ().Contains ("abstract int Name {"), $"was: `{writer}`");
+ }
+
[Test]
public void WriteDuplicateInterfaceEventArgs ()
{
diff --git a/tools/generator/SourceWriters/BoundInterfaceMethodDeclaration.cs b/tools/generator/SourceWriters/BoundInterfaceMethodDeclaration.cs
index 27baf3899..02cdece3e 100644
--- a/tools/generator/SourceWriters/BoundInterfaceMethodDeclaration.cs
+++ b/tools/generator/SourceWriters/BoundInterfaceMethodDeclaration.cs
@@ -25,6 +25,10 @@ public BoundInterfaceMethodDeclaration (Method method, string adapter, CodeGener
ReturnType = new TypeReferenceWriter (opt.GetTypeReferenceName (method.RetVal));
IsDeclaration = true;
+ // Allow user to force adding the 'abstract' keyword for "reabstraction"
+ if (method.ManagedOverride?.ToLowerInvariant () == "reabstract")
+ IsAbstract = true;
+
if (method.DeclaringType.IsGeneratable)
Comments.Add ($"// Metadata.xml XPath method reference: path=\"{method.GetMetadataXPathReference (method.DeclaringType)}\"");
if (method.Deprecated != null)
diff --git a/tools/generator/SourceWriters/BoundInterfacePropertyDeclaration.cs b/tools/generator/SourceWriters/BoundInterfacePropertyDeclaration.cs
index 5b93fdb65..d80956f9b 100644
--- a/tools/generator/SourceWriters/BoundInterfacePropertyDeclaration.cs
+++ b/tools/generator/SourceWriters/BoundInterfacePropertyDeclaration.cs
@@ -20,6 +20,10 @@ public BoundInterfacePropertyDeclaration (GenBase gen, Property property, string
PropertyType = new TypeReferenceWriter (opt.GetTypeReferenceName (property));
IsAutoProperty = true;
+ // Allow user to force adding the 'abstract' keyword for "reabstraction"
+ if ((property.Getter ?? property.Setter).ManagedOverride?.ToLowerInvariant () == "reabstract")
+ IsAbstract = true;
+
if (property.Getter != null) {
HasGet = true;
diff --git a/tools/generator/SourceWriters/BoundMethod.cs b/tools/generator/SourceWriters/BoundMethod.cs
index ef81ed142..eb153b296 100644
--- a/tools/generator/SourceWriters/BoundMethod.cs
+++ b/tools/generator/SourceWriters/BoundMethod.cs
@@ -58,6 +58,9 @@ public BoundMethod (GenBase type, Method method, CodeGenerationOptions opt, bool
} else if (method.ManagedOverride?.ToLowerInvariant () == "override") {
IsVirtual = false;
IsOverride = true;
+ } else if (method.ManagedOverride?.ToLowerInvariant () == "none") {
+ IsVirtual = false;
+ IsOverride = false;
}
ReturnType = new TypeReferenceWriter (opt.GetTypeReferenceName (method.RetVal));
diff --git a/tools/generator/SourceWriters/BoundProperty.cs b/tools/generator/SourceWriters/BoundProperty.cs
index df2c87c09..0df7ca1b9 100644
--- a/tools/generator/SourceWriters/BoundProperty.cs
+++ b/tools/generator/SourceWriters/BoundProperty.cs
@@ -66,6 +66,9 @@ public BoundProperty (GenBase gen, Property property, CodeGenerationOptions opt,
} else if (!forceOverride && (property.Getter ?? property.Setter).ManagedOverride?.ToLowerInvariant () == "override") {
IsVirtual = false;
IsOverride = true;
+ } else if (!forceOverride && (property.Getter ?? property.Setter).ManagedOverride?.ToLowerInvariant () == "none") {
+ IsVirtual = false;
+ IsOverride = false;
}
// Unlike [Register], [Obsolete] cannot be put on property accessors, so we can apply them only under limited condition...