-
Notifications
You must be signed in to change notification settings - Fork 758
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
Changes in TFM hierarchy for .NET 6 on Android/iOS/etc #2314
Comments
So, I don't think it gonna be a problem in v3, because unit test projects will now be stand-alone executables, and you'll be able to mark your unit test project as That said, it's very unlikely that we'll have any runner support in the initial alpha of v3 other than .NET Framework and .NET Core, so I'm not sure whether the .NET Core console app default will actually work in this scenario. We'll have to visit this once the first alphas are available, and see what's involved in getting the "entry point" stub for Android projects to work. |
I wanted to use
But now I'm very confused because I don't know answers to the following questions:
Given that you guys work on MAUI and xUnit, any answer from your side would be greatly appreciated. |
@MartyIX wrote:
This is not an explicitly tested scenario. I have zero experience with MAUI and no idea what
I have no context in which to give advice here. One thing I can say for certain: we have no intention of supporting new platforms for the v2 codebase. If this is broken with v2 and not fixable without adding a new platform, then this will be a "won't fix" for v2, and re-evaluated in the context of v3. You could in theory test this with v3 today, though we don't yet have VSTest support, because compiling a v3 test project generates an executable that can be run directly (for .NET Core, via |
Thank you for your reply.
I see. Well, https://github.com/terrajobst/designs/blob/main/accepted/2021/net6.0-tfms/net6.0-tfms.md explains the new TFMs but I miss some details like testing. Hence my question. AFAIK, for example, But now I wonder whom to ask whether |
At the moment, the best you can expect is that we'll just treat it like |
The Issue
I just noticed that I got exceptions when all I did was switching the TFM of my app from monoandroid to net6.0-android.
The Reason
This is a result of a new hierarchy with .NET 6.
Previously, we had
This meant the packages that contained NetCoreApp and NetStandard could be used to have the NetCoreApp work for .NET Core and all those, and then the NetStandard could effectively be used on .NET Framework or Xamarin.
Since .NET 6 came about, the new hierarchy is this:
As a result of this changed where a "Xamarin" app is now a NetCoreApp, the restore of all the xUnit packages now use the NetCoreApp .dlls, which seem to assume a .NET Core on a desktop environment.
The one example of this is that the implementation of
Guard.FileExists
in thexunit.runner.utility
package does different things depending on the .dll. For NetCoreApp, it check for the existence of the file. In NetStandard, it just checked the path was not null. This worked with MonoAndroid because the .dll did not actually exist on disk since it came from the .apk. Now, with .NET 6, it is using the wrong .dll.The Fix Attempts
I tried to manually swap out the dlls at compile time, but the issue is that they are named differently.
The Extra Infos
This problem will not be unique to xUnit as this is a core change in the way .NET works. This means that it will affect all packages that use the difference of NetStandard and NetCoreApp to partition functionality for desktop/mobile.
Possible Solutions
It will be possible to compile an additional library for all the new TFMs, but this might get out of hand.
Another solution is for runtime checks to see if this is Android, then don't. For example, using https://docs.microsoft.com/dotnet/api/system.operatingsystem.isandroid
Questions
Is there a way to distinguish between the restricted world of a mobile app and then all the features of the desktop? If everything is a NetCoreApp, then what is one that is not a total NetCoreApp?
The text was updated successfully, but these errors were encountered: