You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
A C# method modifier are the keywords which can be applied to a method, such as visibility (public, private, …).
Some of these modifiers can be overridden via metadata, e.g. setting //method/@visibility will be inserted as-is into the C# binding.
What is desired is a way to override the default logic for emitting virtual & override.
Sometimes when binding a library, the default logic causes virtual to be emitted when override is needed for the code to compile. (TODO: Insert concrete example here.)
The current workaround is to use metadata to rename the "offending" method and then use a partial class to properly override the method.
What we would like is e.g. a managedOverride attribute in metadata/on //method.
Question: what should the semantics be? Would a "boolean" attribute be desirable, or a string?
A common "source" of the problem tends to be Java generics, in which e.g. FileDownloadTask.doInBackground() has java.lang.String parameter types, which doesn't match the base class. Metadata could be used to "fix" the parameter types to be java.lang.Object, allowing the parameter types to match the base class, but generator wouldn't realize this.
Activity
jonpryor commentedon Jul 22, 2020
Example of what we want to improve
https://github.com/xamarin/FacebookComponents/blob/70e0b91a24a247f4fe0d317d371441a3278a3623/Facebook.Android/source/facebook-core/transforms/Metadata.xml#L32
https://github.com/xamarin/FacebookComponents/blob/70e0b91a24a247f4fe0d317d371441a3278a3623/Facebook.Android/source/facebook-core/additions/additions.cs#L15
A common "source" of the problem tends to be Java generics, in which e.g.
FileDownloadTask.doInBackground()hasjava.lang.Stringparameter types, which doesn't match the base class. Metadata could be used to "fix" the parameter types to bejava.lang.Object, allowing the parameter types to match the base class, butgeneratorwouldn't realize this.This is the same scenario as: https://github.com/xamarin/java.interop/issues/586
jpobst commentedon Jul 22, 2020
It feels like this maybe needs to go both ways: changing
virtualtooverride, oroverridetovirtual. Given that, astringwould work better:[generator] Support 'managedOverride' metadata (#701)
[generator] Support 'managedOverride' metadata (#701)