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.
Do not generate SupportedOSPlatformAttribute type on net6? #777
Commit da12df4 added support for using SupportedOSPlatformAttribute.
In XA it breaks CI builds as we are getting this warning in DotNetBuild test and the test fails when we get any warning:
/Users/runner/work/1/s/bin/TestRelease/temp/DotNetBuildandroid.21-armandroid.21-arm64android.21-x86android.21-x64False/obj/Debug/net6.0-android/UnnamedProject.AssemblyInfo.cs(21,38): warning CS0436: The type 'SupportedOSPlatformAttribute' in '/Users/runner/work/1/s/bin/TestRelease/temp/DotNetBuildandroid.21-armandroid.21-arm64android.21-x86android.21-x64False/obj/Debug/net6.0-android/generated/src/__NamespaceMapping__.cs' conflicts with the imported type 'SupportedOSPlatformAttribute' in 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Using the type defined in '/Users/runner/work/1/s/bin/TestRelease/temp/DotNetBuildandroid.21-armandroid.21-arm64android.21-x86android.21-x64False/obj/Debug/net6.0-android/generated/src/__NamespaceMapping__.cs'. [/Users/runner/work/1/s/bin/TestRelease/temp/DotNetBuildandroid.21-armandroid.21-arm64android.21-x86android.21-x64False/UnnamedProject.csproj]
@jpobst MSBuild in these tests run out of process. This test build the actual project with ~\android-toolchain\dotnet\dotnet.exe build, but the C# code in this test is netcoreapp3.1.
Activity
radekdoulik commentedon Jan 12, 2021
It is probably caused by this line? https://github.com/xamarin/java.interop/blob/da12df4535422f2aaf3a7570326336b30cd50b55/tools/generator/Java.Interop.Tools.Generator.ObjectModel/NamespaceMapping.cs#L38
We should probably use
#if !NETCOREAPPinstead? As we still build our libraries and tools withnetcoreapp3.1.jpobst commentedon Jan 12, 2021
We definitely need to have it for
netcoreapp3.1as the type does not exist untilnet5.0.I am trying to understand this test, is it building with
netcoreapp3.1but referencingnet5.0BCL? That would be a problem.https://github.com/xamarin/xamarin-android/blob/master/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/XASdkTests.cs#L338
cc: @jonathanpeppers
jonathanpeppers commentedon Jan 12, 2021
@jpobst MSBuild in these tests run out of process. This test build the actual project with
~\android-toolchain\dotnet\dotnet.exe build, but the C# code in this test isnetcoreapp3.1.We could change this now if we need to.
radekdoulik commentedon Jan 13, 2021
The test already uses
net6.0-androidTFM. So maybe there is an issue withNET5_0_OR_GREATERdefine missing.From the log I see these defines when compiling the test:
radekdoulik commentedon Jan 13, 2021
It looks like the define might still be only in design phase? https://github.com/dotnet/designs/blob/main/accepted/2020/or-greater-defines/or-greater-defines.md
I think we can use
NETinstead and change this and other places which useNETCOREAPPonce that the define is available.radekdoulik commentedon Jan 13, 2021
Ah, I missed the last line of the design:
Due to a lot of confusion and concern we ended up not shipping this design.
So that's why the define is missing.
Do not check for NET5_0_OR_GREATER
[generator] Wrap SupportedOSPlatformAttribute in NET (#779)
[generator] Wrap SupportedOSPlatformAttribute in NET (#779)