-
-
Notifications
You must be signed in to change notification settings - Fork 984
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
Running benchmark fails when targeting netcoreapp2.2 #995
Comments
Hi @jasper-d Could you run following code and share the output? private static string GetBaseNetCoreVersion()
{
var assembly = typeof(GCSettings).GetTypeInfo().Assembly;
var assemblyPath = assembly.CodeBase.Split(new[] { '/', '\\' }, StringSplitOptions.RemoveEmptyEntries);
int netCoreAppIndex = Array.IndexOf(assemblyPath, "Microsoft.NETCore.App");
if (netCoreAppIndex > 0 && netCoreAppIndex < assemblyPath.Length - 2)
return assemblyPath[netCoreAppIndex + 1];
return null;
} (this is the code we use to detect .NET Core version) |
Hi @adamsitnik, that method returns |
Ok, some more information. When running the benchmark from the command line the assembly path in |
Is there a reason the corelib path is parsed instead of using |
@jasper-d I don't remember if we had any reason for that. Does |
@jasper-d would you like to send a PR? |
@adamsitnik Yes, will do so tonight. But could you elaborate on the scenarios you mentioned? |
@jasper-d please just make sure that it works on .NET Core 2.0, 2.1, 2.2 and 3.0 ;) |
@adamsitnik Fortunately it does (even with CoreRT). |
@jasper-d awesome! |
Also, I would think you would want the full runtime version (i.e. 2.2.1) since there can be important behavioral/performance differences between patch releases. |
@jasper-d @adamsitnik do you know any workaround for this? |
@sillyousu See the workaround section above (i.e. create a custom ManualConfig that specifies the runtime) and use it as documented. @mattzink Here the version is used during code generation to set the TFM in a generated .csproj. So yes, we wanna know what framework an application was build for. |
Running a benchmark fails when targeting netcoreapp2.2. That is because the *.Autogenerated.csproj. targets netcoreapp2.1 and references the original benchmark project that targets a higher netcoreapp version.
Repro:
dotnet build -f netcoreapp2.2 -c Release -r win-x64 --no-incremental --force
.\bin\Release\netcoreapp2.2\win-x64\Target22.exe
Expected:
The benchmark completes without errors.
Actual:
Running the benchmark (repro step 5) fails early when building the autogenerated code because the autogenerated csproj targets netcoreapp2.1 and references the original projects which targets 2.2.
Workaround:
Use an explicit configuration like so;
Let me know if you need a complete sample project to reproduce.
The text was updated successfully, but these errors were encountered: