-
Notifications
You must be signed in to change notification settings - Fork 47
TerminateWithSuccess should be updated for .NET Standard 2.0 #116
Comments
There's a minor followup question to this as well--if I'm not mistaken, TerminateWithSuccess() is the only reason that ios/android couldn't use .NET Standard. Would it be simpler to have the caller pass a delegate to specify an action to perform once testing is finished, with null indicating no action? The caller could then pass a delegate terminating the app in a manner specific to the platform. This would also solve an earlier question I had about executing a custom action when the tests were finished running. Thanks again so much! |
Hi @cclauson, Nothing clever going on - it's just that changes have happened in this repository since the last NuGet release. The project was converted to .NET Standard 2.0 earlier this year, whereas the last formal release was last April. If you have a look at the NuGet package from the latest build of master, you'll see that: I'm going to close this issue as a question, but feel free to comment further if there's more to talk about. 🙂 |
Thanks for the response. I guess my question would then be, is the ultimate goal for things to be .NET Standard, or for it to be multitargeted? In other words, the state now seems to be contradictory, you can build for .NET Standard, but functionality (specifically terminate after tests are finished) will be broken if you do. |
Ahh - sorry, now I understand. I think that must have been missed. 😞 I wonder if it's possible to support that functionality directly in .NET Standard... We'd welcome a PR to fix this, if you're interested. (Edit: I've retitled and re-opened this issue if that's ok, to make the problem clear! Marking high priority, as it would be a regression since the last release.) |
As stated above, to me the most logical solution to supporting similar functionality but staying .NET Standard would be to change things so instead passing a boolean to indicate whether the app should exit after tests are run, pass a delegate to run at the end of tests. This has the additional advantage of making it simple to perform some other custom action between tests ending and shutdown (which I actually have to do for my use case on iOS, it's possible but slightly awkward). The downside of this is that it changes the interface and would break anything that currently relies on this. But if this hasn't been released yet, maybe it's possible? If this sounds like a good solution I could make a PR, but want to know if this is acceptable first--thanks so much! |
I see Xamarin forms supplies a My thoughts would be that the best case scenario would be to fix the correct functionality as is, and handle end-of-tests delegate as a separate feature enhancement. (Although features should probably have the ok from @rprouse first - I don't personally have a lot to do with this project anymore!) If fixing the current functionality in .NET Standard 2.0 isn't possible technically, then yes, what you suggest would be a nice solution. But I think we should try and fix as-is, first! |
I gave Application.Quit() a quick try on iOS, didn't seem to do it. I might be able to look into this further if I have time at some point. |
Hi,
Wanted to ask about something I'm a little confused about. I see that nunit.xamarin.csproj states that it targets netstandard2.0, but the nuget package currently up does not have a netstandard dll, but dlls for uap/android/ios. Also noticed that the method TerminateWithSuccess() uses conditional compilation to have a different implementation for each TFM, but wouldn't work if compiled for .NET Standard. Is it the case that this is supposed to be targeted to these different frameworks and is normally built this way, but this just isn't reflected in the project file?
Thanks so much
The text was updated successfully, but these errors were encountered: