Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[generator] Add additional AttributeTargets to our dummy SupportedOSPlatformAttribute. #1054

Merged
merged 1 commit into from
Oct 24, 2022

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented Oct 20, 2022

Context: #1052
Context: https://github.com/buyaa-n/runtime/blob/7a62a22db186fda42dad6cbd681cf056fcf6aee6/src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/PlatformAttributes.cs#L52-L62

In order to compile classic MonoAndroid bindings that contain the new .NET [SupportedOSPlatform] attributes, we have a dummy copy that we can compile against. However this copy does not allow AttributeTargets.Field, so compiling with #1052 causes:

/Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-33
/mcw/Dalvik.Bytecode.IOpcodes.cs(646,4): error CS0592: Attribute 
 global::System.Runtime.Versioning.SupportedOSPlatformAttribute' 
is not valid on this declaration type. It is only valid on 'assembly, module, 
class, struct, constructor, method, property, indexer, event' declarations. 

Update our copy to have the same AttributeTargets as the .NET version so we can compile on classic.

@jpobst jpobst marked this pull request as ready for review October 20, 2022 22:19
@jonpryor jonpryor merged commit 2d8b6d2 into main Oct 24, 2022
@jonpryor jonpryor deleted the supported-platform-fix branch October 24, 2022 19:07
jonpryor pushed a commit to dotnet/android that referenced this pull request Nov 1, 2022
Fixes: dotnet/java-interop#1034
Fixes: dotnet/java-interop#1051

Context: 938b2cb

Changes: dotnet/java-interop@e1ee4b1...5318261

  * dotnet/java-interop@53182615: [build] Update Microsoft.* NuGet package versions (dotnet/java-interop#1055)
  * dotnet/java-interop@8e18c909: [generator] Avoid C#11 delegate cache overhead. (dotnet/java-interop#1053)
  * dotnet/java-interop@2d8b6d24: [generator] More AttributeTargets on SupportedOSPlatformAttribute (dotnet/java-interop#1054)
  * dotnet/java-interop@7dfbab67: [generator] Add [SupportedOSPlatform] to bound constant fields (dotnet/java-interop#1038)
  * dotnet/java-interop@1720628a: [generator] Mark generated .cs files as generated (dotnet/java-interop#1052)
  * dotnet/java-interop@f498fcf5: [Java.Interop] Avoid some method group conversions (dotnet/java-interop#1050)
  * dotnet/java-interop@16e1ecd4: [build] Use $(VSINSTALLDIR), not $(VSINSTALLROOT) (dotnet/java-interop#1048)
  * dotnet/java-interop@8e4c7d20: [Hello-Core] Add "low level" sample. (dotnet/java-interop#1047)

Additionally, remove `$(LangVersion)`=10 from `Mono.Android.csproj`,
which was a hack to work around a size regression due to delegate
caching in C# 11; see also 938b2cb, dotnet/java-interop@8e18c909.

Co-authored-by: Jonathan Pobst <jonathan.pobst@microsoft.com>
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants