Open aaubry opened 4 years ago
Hi @aaubry
Thank you for the detailed bug report.
Would you be interested in sending a PR with a fix?
It should be a matter of fixing the Escape
method which is called from here:
I'll try. Thanks for indicating the location where the arguments are escaped.
The above PR fixes the backslash issue. Please review and lemme know if it has to be modified. @aaubry @adamsitnik
Any update on this ??
Any update on this ??
@postmeback It's still up for grabs. You can fork the repo, create a branch, work on a fix and send a PR. If you don't there is no update.
Is this still happening? I admit I'm pretty new to the codebase, but I tried to run a simple test and it did not throw FormatException
.
public class Issues
{
[Fact]
public void Issue_1536()
{
var summary = BenchmarkRunner.Run<MyBenchmark>(DefaultConfig.Instance.AddJob(Job.Default.WithArguments(new[] { new MsBuildArgument(@"/p:a=b\"), })));
}
}
BenchmarkDotNet=v0.13.5.20230613-develop, OS=Windows 11 (10.0.22621.1702/22H2/2022Update/SunValley2)
11th Gen Intel Core i7-1185G7 3.00GHz, 1 CPU, 8 logical and 4 physical cores
[Host] : .NET Framework 4.8.1 (4.8.9139.0), X64 RyuJIT VectorSize=256 [AttachedDebugger]
Job-EWOGGX : .NET Framework 4.8.1 (4.8.9139.0), X64 RyuJIT VectorSize=256
Arguments=/p:a=b\
Method | Mean | Error | StdDev |
---|---|---|---|
Foo | 100.0 μs | 0.02 μs | 0.02 μs |
I'm also not able to repro, even on 0.12.1 (the latest version at the time of posting). @aaubry Is it still an issue?
When I have a
MsBuildArgument
whose value ends in a backslash, there is an error somewhere along the intermediate code generation that causes the generated program to receive malformed arguments, resulting in a parsing exception. Here's an example of such:Attemptig to run this benchmark causes the following error:
I was able to pause the porgram before it compiled the
.notcs
file and add the following line before it parses the arguments:This outputs the following,
which confirms that the arguments are not being passed correctly. There's probably some escaping needed somewhere along the toolchain.
A workaround is to add a summy parameter that does not end with a backslash.