-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add timeout exception for .NET 5 or greater targets. #50
Conversation
I noticed there is a slight mismatch between the |
Thanks! Hmm, yea, the issue is indeed that .NET 5 and .NET Core 3.1 test runs resolve the NET Standard 2.x assemblies. I removed .NET 5 from the runtime code as it was EOL as I'm sure you are aware, but IIRC I still had to use .NET 5 in the test project as a bit of a hack to run tests against the .NET Standard 2.1 build, which has some minor nuances (https://github.com/skwasjer/MockHttp/search?q=netstandard2_1). To be honest, I dont think there's not a good way to fix it except for doing a runtime check (if .NET Standard 2.x). Because fundamentally So, with that said, here's some example macros to test a specific .NET (Core) version, that could be used in context of using System.Runtime.InteropServices;
private static bool IsNetCore => RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase);
private static bool IsNetCore31 => RuntimeInformation.FrameworkDescription.StartsWith(".NET Core 3.1", StringComparison.OrdinalIgnoreCase);
private static bool IsNet5 => RuntimeInformation.FrameworkDescription.StartsWith(".NET 5", StringComparison.OrdinalIgnoreCase); You can still skip this for .NET 6 and up ofc and use the preprocessor directive for it instead. wdyt or other ideas? |
Thanks for the detailed response! The only other option that comes to mind besides something runtime would be adding back assembly building for .Net 5.0 since it has nuances specific to (starting at) that runtime. I understand it’s EOL but I also have plenty of legacy code that I’m walking forward, too, and such things aren’t always so easy to drop. 😅 LMK how you’d like to proceed! |
Bringing back .NET 5 introduces another issue. Test coverage is currently automatically picking the appropriate target framework version as follows:
So bringing .NET 5 back would now favor the .NET 5 version over .NET Standard 2.1 in the tests. To fill that hole, it also means adding .NET Core 2.1 back (ugh!!) to run tests against .NET Standard 2.0 so that .NET Core 3.1 can keep testing against .NET Standard 2.1. It is a little more involved to maintain all these targets 😄 I am not completely against it, but the next question becomes, for how long do I have to maintain it? As such, to make life easier, that's why I typically follow the EOL roadmap. A runtime check is simpler, but also won't win beauty contest though. But I would accept it if you need a quick fix. If you really want/need a .NET 5 target, I would prefer that to be done in a separate change/PR. [edit] what I can do is accept this PR if you change it to work from .NET 6 onwards. Then can have a look again at bringing .NET 5 back and readdress this issue for it specifically. |
Following the EOL schedule makes sense to me - I don’t expect you to back-cap if it’s a mess! I’m down to either runtime check which, like you said, isn’t pretty, or change the pre processor to .net 6. If I had to pick, I’d probably choose the runtime check for the short term as the other doesn’t feel “complete” to me. If you decide later to republish the .NET 5 assembly, it would then be functionally the same and you could just cleanup the runtime check. What do you think? |
Agreed 👍 |
Codecov Report
|
Thanks a lot, don't mind the failed build, there's a flaky test of something unrelated, which I will address separately. |
Closes #49 .