Benchmarkdotnet: Invalid runtimeconfig.json in .NET Benchmark

Created on 12 Dec 2019  路  14Comments  路  Source: dotnet/BenchmarkDotNet

I have simple benchmark project(using BenchmarkDotNet lib) on .net core 3.1 that print Hello message to console. When project on disk D root the benchmark runs successfully, but if my project deeper in file system it fails with invalid runtimeconfig.json. Please, help me.

question

Most helpful comment

@adamsitnik Thank you for helping. Enabling long path support resolved my problem.

All 14 comments

@VladimirFedorchenko7 could you please share the source code of your project and the full text of the error?

It is the code:

using System;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

namespace BenchmarkTest
{
    class Program
    {
        static void Main(string[] args)
        {
            BenchmarkRunner.Run<Test>();
        }
    }

    public class Test
    {
        [Benchmark]
        public void Run()
        {
            Console.WriteLine("Hello World!");
        }
    }
}

It is the error(sorry I can't show you name of my project):
image

@VladimirFedorchenko7 do you have spaces in the full path to your project?

@AndreyAkinshin No, I have no spaces in the full path to my project.

@VladimirFedorchenko7 could you please show the content of your *.runtimeconfig.dev.json file?

@AndreyAkinshin
{ "runtimeOptions": { "additionalProbingPaths": [ "C:\\Users\\user\\.dotnet\\store\\|arch|\\|tfm|", "C:\\Users\\user\\.nuget\\packages", "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" ] } }
It was generated automatically.

@VladimirFedorchenko7 ok, one more question: could you say the full path length of the *.runtimeconfig.dev.json file (including the file name)?

@AndreyAkinshin D:\Projects\MyProject\resources\Performance\Performance.Core\bin\Release\netcoreapp3.1\28fb67a8-6dfa-4475-bff6-ae9b4e31f3c6.runtimeconfig.dev.json

@AndreyAkinshin In .NET framework benchmark was a problem with too long name of class. I solved this problem just changed the name to short one.

@AndreyAkinshin But in Core project I can't solve this problem. Why did you close the question?

@AndreyAkinshin I have two benchmark projects: on .NET Framework and .NET Core. In .NET Framework was a trouble with name lenght, I solved it, but I think it is a bug and must be fixed. In .NET Core project I can't solve this problem. Please, help me.

@adamsitnik any ideas what can be wrong with runtimeconfig?

We have two different toolchains, one for .NET Core and one for Full .NET Framework.

The .NET Core toolchain creates files with longer paths. All the guids etc in the path of the auto-generated are to protect us from duplicates.

We don't generate runtimeconfig.json, it's generated by dotnet cli when we call dotnet restore|build from the toolchain.

I agree that the long path problem reported as "invalid runtimeconfig.json" is wrong, but it's an output from dotnet cli.

@VladimirFedorchenko7 could you please create a simple .NET Core app (dotnet new console should be enough) somewhere deep in the file hierarchy, try to build it and report a bug in https://github.com/dotnet/sdk ?

Once you do that, please enable long paths support on your system or move the project closer to the root.

@adamsitnik Thank you for helping. Enabling long path support resolved my problem.

Was this page helpful?
0 / 5 - 0 ratings