-
Notifications
You must be signed in to change notification settings - Fork 291
Report target framework rather than runtime framework #7081
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned about this change. The actual TFM is usually present in the path of the assembly. Reporting the actual running runtime here is an additional piece of info we don't want to lose.
This also just caught a bug in .NET 11 insertion today. #7154 (comment)
That bug would have been masked if we report the target framework.
|
The original issue was a nitpick for me, so I don't have a feeling either way. That said, I have two thoughts:
The .NET case is interesting. I wasn't aware that you could run something with Either way, this is just me collecting information, and it doesn't change my mind that since this is a nitpick, taking away valuable information (like discovering your .NET 10 tests were mysteriously running on .NET 11) seems more valuable than my nitpick. |
|
Interesting, for 4.8.1 we should display the full thing: Can you double check what For what happened in .NET 11, it's because .NET 11 SDK used was in an intermediate state and wasn't fully correct. Putting aside that bug, it's still possible that you can run with a newer runtime if you specify |
|
Based on the linked code, I'm not surprised by Also, I tried using target frameworks |
|
Another option would be to change the format of the display when TFM != actual runtime. Here are some first ideas:
|
|
To me one of the problems is that users state their desired target framework in the project and use that as identifier for that dll when multitargeting. So showing the runtime version makes it harder to know which dll was executed. (On the other hand we on purpose 'lie' about the architecture where it would most often show AnyCPU because that is what we detect from the dll.) I think a good compromise is to show the build time and run time information once in the console, and then use the mix of real architecture + desired tfm as the identifiers in the rest of the places in the console. This gives the ability to see both information if you look for it a little, without being overly in your face with the info that you are not normally used to seeing. This is because: The full runtime version will almost always be different from the TFM, we could show only when the major and minor versions differ, but then we are doing additional assumptions on the (currently) default Minor roll forward policy. It will also always show for users who use less strict roll forward policy. It will show almost always for .NET Framework, unless you target the latest. And the versions will not look familiar, like like net489 (4.8.9323.0). It also helps with being consistent with architecture, where the build time architecture is often AnyCPU, but we don't show that because that information is not useful to identify which dll is which, or how it ran, so we show the effective dll determined by the apphost, or dotnet muxer. With architecture the issue is of course much smaller, because if the dll targets specific architecture, it will fail to run with the incorrect executable. |
We show a mix of these in the header, but all with a focus for value on understanding the runtime environment: Inside the parenthesis, we show the runtime (and bitness) for the .NET Framework build, but no runtime information for Native AOT builds (since there isn't one, at least as far as the user is concerned; it can only run out-of-process v3 projects). Inside the square brackets we show what we built for, which is important information for .NET Framework when running v1/v2 tests, since those test projects load in-process. They inherit attributes of that; if we built for .NET 4.7.2, even if you're running with 4.8 or 4.8.1, you're getting 4.7.2 behaviors/features, since the runner's .config file is the one that matters. This is also why we ship versions for 4.7.2, 4.8, and 4.8.1, matrixed with AnyCPU and x86. It's definitely helped in the past diagnose issues. It was quite the distribution bloat, though, shipping two versions for every .NET Framework from 4.5.2 to 4.8.1 with v2. 😂 |
|
It never occurred to me to wonder whether there was .NET Framework on WOA (and whether that "64-bit" should become something more like "x64" vs. "arm64"). I don't think I've ever had a WOA machine in my possession. 😄 |
I had forgotten all about the brief period of seeing |

Fix #7066