aspnet / DotNetTools

[Archived] Various .NET command line tools. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
439 stars 74 forks source link

dnx-watch throwing ArgumentException saying directory name project.json is invalid #79

Closed henningst closed 8 years ago

henningst commented 8 years ago

I'm submitting this issue on request from @victorhurdugaci after posting a question on Stackoverflow. http://stackoverflow.com/questions/36711354/dnx-watch-stopped-working-and-throwing-argumentexception-because-directory-was-n

I've now stripped down my solution as much as possible. The problem is that I'm getting an ArgumentException as shown below when running dnx-watch in a project using RC1-Final.

Henning@DESKTOP-CDKHH46 C:\temp\MySolution\Falcon\src\Web
> dnx-watch web
[DnxWatcher] info: Running dnx with the following arguments: --project C:\temp\MySolution\Falcon\src\Web\project.json web
[DnxWatcher] info: dnx process id: 3940
System.ArgumentException: The directory name C:\temp\MySolution\Shared\src\TenantService\project.json is invalid.
   at System.IO.FileSystemWatcher..ctor(String path, String filter)
   at System.IO.FileSystemWatcher..ctor(String path)
   at Microsoft.Dnx.Watcher.Core.FileWatcher.AddWatcher(String path)
   at Microsoft.Dnx.Watcher.Core.FileWatcher.WatchProject(String projectPath)
   at Microsoft.Dnx.Watcher.Core.DnxWatcher.AddProjectAndDependeciesToWatcher(IProject project, IFileWatcher fileWatcher)
   at Microsoft.Dnx.Watcher.Core.DnxWatcher.AddProjectAndDependeciesToWatcher(IProject project, IFileWatcher fileWatcher)
   at Microsoft.Dnx.Watcher.Core.DnxWatcher.<WaitForProjectFileToChangeAsync>d__7.MoveNext()

Here is the directory structure of my solution:

+---Falcon
|   |   Falcon.sln
|   |   global.json
|   |
|   +---src
|   |   \---Web
|   |       |   project.json
|   |       |   project.lock.json
|   |       |   Web.xproj
|   |       |   Web.xproj.user
|   |       |
|   |
|   \---test
|       \---WebTests
|           |   project.json
|           |   project.lock.json
|           |   WebTests.xproj
|           |   WebTests.xproj.user
|           |
|
\---Shared
    |   Shared.sln
    |
    +---src
    |   \---TenantService
    |       |   project.json
    |       |   project.lock.json
    |       |   TenantService.xproj
    |       |   TenantService.xproj.user
    \---test
        |
        |
        +---TenantServiceTests
                project.json
                project.lock.json
                TenantServiceTests.xproj
                TenantServiceTests.xproj.user

There are actually 2 different solutions. The main solution with the web project is in c:\temp\MySolution\Falcon and I have a solution with shared projects in c:\temp\MySolution\Shared. The shared project is added both in Shared.sln and Falcon.sln.

This is the contents of c:\temp\MySolution\Falcon\src\Web\project.json:

{
  "version": "1.0.0-*",

  "userSecretsId": "aspnet5-Web-894a8200-f6ea-4d07-8ce2-2763060181be",

  "compilationOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final",
    "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.AspNet.Identity": "3.0.0-rc1-final",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.Abstractions": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final",
    "Serilog": "2.0.0-beta-507",
    "Serilog.Extensions.Logging": "1.0.0-rc1-final-10092",
    "Serilog.Sinks.Literate": "2.0.0-beta-21",
    "Serilog.Sinks.Seq": "2.0.0-beta-42",
    "TenantService": "1.0.0-*"
  },

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel"
  },

  "frameworks": {
    "dnx451": { }
  },

  "exclude": [
    "wwwroot",
    "node_modules"
  ],
  "publishExclude": [
    "**.user",
    "**.vspscc"
  ]
}

And here is the contents of c:\temp\MySolution\Shared\src\TenantService\project.json

{
  "version": "1.0.0-*",
  "description": "TenantService Class Library",
  "authors": [ "Henning" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",

  "dependencies": {
    "Newtonsoft.Json": "8.0.2",
    "MongoDB.Driver": "2.2.3",
    "Microsoft.Extensions.OptionsModel": "1.0.0-rc1-final",
    "StackExchange.Redis": "1.1.572"
  },

  "frameworks": {
    "dnx451": { }
  }
}
> dnvm list

Active Version           Runtime Architecture OperatingSystem Alias
------ -------           ------- ------------ --------------- -----
       1.0.0-beta5       clr     x64          win
       1.0.0-beta5       clr     x86          win
       1.0.0-beta5       coreclr x64          win
       1.0.0-beta5       coreclr x86          win
       1.0.0-beta8       clr     x64          win
       1.0.0-beta8       clr     x86          win
       1.0.0-beta8       coreclr x64          win
       1.0.0-beta8       coreclr x86          win
       1.0.0-rc1-15838   clr     x86          win
       1.0.0-rc1-15996   clr     x64          win
       1.0.0-rc1-15996   clr     x86          win
       1.0.0-rc1-15996   coreclr x64          win
       1.0.0-rc1-15996   coreclr x86          win
       1.0.0-rc1-16030   clr     x64          win
       1.0.0-rc1-16030   clr     x86          win
       1.0.0-rc1-16030   coreclr x64          win
       1.0.0-rc1-16030   coreclr x86          win
       1.0.0-rc1-final   clr     x64          win
  *    1.0.0-rc1-final   clr     x86          win             default
       1.0.0-rc1-final   coreclr x64          win
       1.0.0-rc1-final   coreclr x86          win
       1.0.0-rc1-update1 clr     x64          win
       1.0.0-rc1-update1 clr     x86          win
       1.0.0-rc1-update1 coreclr x64          win
       1.0.0-rc1-update1 coreclr x86          win
victorhurdugaci commented 8 years ago

Thanks for submitting this.

What do you have in global.json?

henningst commented 8 years ago

c:\temp\MySolution\Falcon\global.json

{
  "projects": [ "../Shared/src", "src", "../Shared/test" ],
  "sdk": {
    "version": "1.0.0-rc1-final"
  }
}
muratg commented 8 years ago

@victorhurdugaci Do you know if this repros with dotnet apps?

victorhurdugaci commented 8 years ago

I am not able to reproduce this with dotnet watch. Using that project structure, the watcher works perfectly and it picks chances from all project.

Unfortunately, we're not going to create a fix for rc1 so I'll close this issue