dotnet publish -p:PublishSingleFile fails with Unhandled exception on .net 7 it works on .net 6
See original GitHub issueDescribe the bug
When running dotnet publish with a msbuild property without an equal sign ‘=’ like this dotnet publish -c Release -p:PublishSingleFile
the command fails hard with an System.IndexOutOfRangeException: Index was outside the bounds of the array.
The same thing can be observed by running dotnet publish -c Release -p:WhatEver
The same command works without the unhandled exception in .net 6. (v6.0.406) - works as in, it does not fail hard 😄
To Reproduce
With .net 7 run the following command
dotnet publish -c Release -p:PublishSingleFile
Exceptions (if any)
Unhandled exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
Unhandled exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Microsoft.DotNet.Cli.ReleasePropertyProjectLocator.GetGlobalPropertiesFromUserArgs(ParseResult parseResult)
at Microsoft.DotNet.Cli.ReleasePropertyProjectLocator.GetCustomDefaultConfigurationValueIfSpecified(ParseResult parseResult, String defaultedConfigurationProperty, IEnumerable`1 slnOrProjectArgs, Option`1 configOption)+MoveNext()
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at Microsoft.DotNet.Tools.Publish.PublishCommand.FromParseResult(ParseResult parseResult, String msbuildPath)
at Microsoft.DotNet.Tools.Publish.PublishCommand.Run(ParseResult parseResult)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.DotNet.Cli.Parser.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__17_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass15_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass7_0.<<UseExceptionHandler>b__0>d.MoveNext()
Further technical details
.NET SDK: Version: 7.0.200 Commit: 534117727b
Runtime Environment: OS Name: Windows OS Version: 10.0.22621 OS Platform: Windows RID: win10-x64
Host: Version: 7.0.3 Architecture: x64 Commit: 0a2bda10e8
.NET SDKs installed: 6.0.406 [C:\Program Files\dotnet\sdk] 7.0.102 [C:\Program Files\dotnet\sdk] 7.0.103 [C:\Program Files\dotnet\sdk] 7.0.200 [C:\Program Files\dotnet\sdk]
Issue Analytics
- State:
- Created 7 months ago
- Comments:9 (6 by maintainers)
Top GitHub Comments
Thx @nagilson
Closed as this is going into servicing for 7.0.2xx, it will likely release with this fix in April.