Hosting icon indicating copy to clipboard operation
Hosting copied to clipboard

System.FormatException Unrecognized argument format: ' '. during Hosting.Program.Main call

Open swaggerloaf opened this issue 11 years ago • 4 comments

"Microsoft.AspNet.Hosting": "1.0.0-beta4-11365"

Running MVC app with latest nightly builds produces the error. Occurs on both x86 and x64 latest DNX.

c:\projects\2015\NeoSample-ASPNET5\src\NeoSample>k web
System.FormatException: Unrecognized argument format: '
'.
   at Microsoft.Framework.ConfigurationModel.CommandLineConfigurationSource.Load()
   at Microsoft.Framework.ConfigurationModel.Configuration.Add(IConfigurationSource configurationSource)
   at Microsoft.AspNet.Hosting.Program.Main(String[] args)
"DNX,Version=v4.5.1": {
          "dependencies": {
            "EntityFramework.Relational": "7.0.0-beta4-12599",
            "EntityFramework.Relational.Design": "7.0.0-beta4-12599",
            "EntityFramework.SqlServer.Design": "7.0.0-beta4-12599",
            "Microsoft.CodeAnalysis.CSharp": "1.0.0-rc2-20150316-05",
            "Microsoft.Framework.DependencyInjection": "1.0.0-beta4-11037",
            "Microsoft.AspNet.Hosting": "1.0.0-beta4-11365"
          },
Active Version           Runtime Architecture Location                     Alias
------ -------           ------- ------------ --------                     -----
       1.0.0-beta4-11268 clr     x64          C:\Users\Glenn\.dnx\runtimes
       1.0.0-beta4-11268 clr     x86          C:\Users\Glenn\.dnx\runtimes
       1.0.0-beta4-11268 coreclr x86          C:\Users\Glenn\.dnx\runtimes
       1.0.0-beta4-11271 clr     x86          C:\Users\Glenn\.dnx\runtimes
       1.0.0-beta4-11271 coreclr x86          C:\Users\Glenn\.dnx\runtimes
       1.0.0-beta4-11296 clr     x64          C:\Users\Glenn\.dnx\runtimes
  *    1.0.0-beta4-11296 clr     x86          C:\Users\Glenn\.dnx\runtimes default
       1.0.0-beta4-11296 coreclr x64          C:\Users\Glenn\.dnx\runtimes

swaggerloaf avatar Mar 17 '15 12:03 swaggerloaf

The app I'm using if you need: https://github.com/swaggerloaf/NeoSample-ASPNET5

swaggerloaf avatar Mar 17 '15 12:03 swaggerloaf

Looks like this is caused by the newlines in your web command. If you move it all back onto one line it should work again.

The exception is being thrown in the configuration stack as it tries to parse the web command. Could you move it to the configuration repo and give it an appropriate title? The problem is that the command line parser cannot handle newlines in the arguments. I don't know if it's valid JSON, but the configuration repo could handle it if we wanted to allow that way of laying out the file.

glennc avatar Mar 17 '15 18:03 glennc

On further investigation it looks like this isn't valid JSON. So while we could allow the configuraiton API to handle this, we probably shouldn't.

I think the only reason it makes it to the configuration API is because we are using JSON.NET to parse the project.json file and it handles this. However, we've talked a lot in the past about not using JSON.NET and instead using a smaller, and less feature complete, JSON parser so that the runtime doesn't lock applications to a given version of JSON.NET. Once we do that then parsing this would actually break much earlier where we parse the project.json file.

glennc avatar Mar 17 '15 18:03 glennc

Glenn, You are correct, I recently formatted to several lines after seeing it somewhere else. I should of tested thoroughly.

Thanks

swaggerloaf avatar Mar 17 '15 18:03 swaggerloaf