Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

When the global.json file is out of position in source, published output breaks the runtime #3229

Closed
guardrex opened this issue Dec 3, 2015 · 5 comments
Assignees
Labels

Comments

@guardrex
Copy link

guardrex commented Dec 3, 2015

Starting with this layout (in source on the dev box) ...

.vs
src
    - artifacts
    - PlatformIssue
        - bin
        - Controllers
        - Models
        - Views
        - wwwroot
        - PlatformIssue.xproj
        - PlatformIssue.xproj.user
        - project.json
        - Startup.cs
PlatformIssue.sln
global.json

... and merely moving the global.json to this layout (manually moving the file on the dev box while VS is closed) ...

.vs
src
    - artifacts
    - PlatformIssue
        - bin
        - Controllers
        - Models
        - Views
        - wwwroot
        - PlatformIssue.xproj
        - PlatformIssue.xproj.user
        - project.json
        - Startup.cs
        - global.json
PlatformIssue.sln

... results in a project that will run locally in IIS Express but breaks on the server (i.e., after publishing to the filesystem and MSDeploy'ing to the server). The app is unresponsive. The log shows ...

System.IO.DirectoryNotFoundException: The system cannot find the path specified. (Exception from HRESULT: 0x80070003)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at Microsoft.Dnx.Runtime.Loader.PackageAssemblyLoader.Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
   at Microsoft.Dnx.Host.LoaderContainer.Load(AssemblyName assemblyName)
   at Microsoft.Dnx.Runtime.Loader.AssemblyLoaderCache.GetOrAdd(AssemblyName name, Func`2 factory)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
   at Microsoft.Dnx.ApplicationHost.DefaultHost.GetEntryPoint(String applicationName)
   at Microsoft.Dnx.ApplicationHost.Program.ExecuteMain(DefaultHost host, String applicationName, String[] args)
   at Microsoft.Dnx.ApplicationHost.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
   at Microsoft.Dnx.Host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment env, String appBase, FrameworkName targetFramework)
   at Microsoft.Dnx.Host.RuntimeBootstrapper.ExecuteAsync(String[] args, BootstrapperContext bootstrapperContext)
   at Microsoft.Dnx.Host.RuntimeBootstrapper.Execute(String[] args, BootstrapperContext bootstrapperContext)

The published output (VS Publish) results in a new global.json here (the correct spot) ...

capture

... with these contents ...

{
  "projects": [
    "src"
  ],
  "sdk": {
    "architecture": "x64",
    "runtime": "coreclr",
    "version": "1.0.0-rc1-update1"
  },
  "packages": "packages"
}

... but the file also ends up here ... the original one that was manually moved ...

capture2

... the contents of that one are as I have it in the project ...

{
  "projects": [
    "src"
  ],
  "sdk": {
    "architecture": "x64",
    "runtime": "coreclr",
    "version": "1.0.0-rc1-update1"
  }
}
@davidfowl
Copy link
Member

/cc @JunTaoLuo Didn't we fix this?

@davidfowl davidfowl added the bug label Dec 7, 2015
@JunTaoLuo
Copy link
Contributor

Should have been fixed in #2656 I'll take a look why this is happening.

@JunTaoLuo JunTaoLuo self-assigned this Dec 7, 2015
@guardrex
Copy link
Author

guardrex commented Dec 7, 2015

I haven't checked with RC2. If u want me to check with RC2, I'll be back in
the office in a few hours and will check.
On Dec 7, 2015 11:00 AM, "John Luo" notifications@github.com wrote:

Should have been fixed in #2656
#2656 I'll take a look why this is
happening.


Reply to this email directly or view it on GitHub
#3229 (comment).

@JunTaoLuo
Copy link
Contributor

@guardrex what is in your project.json?

We ignore global.json by default if it's in your project directory. However, if your project.json has a non-empty section for publishExclude it will overwrite our defaults and publish any existing global.json. If you don't have a section for publishExclude, please attach your project so I can debug further.

If you did have a non-empty section for publishExclude, either add global.json to it or remove it completely so the file is ignored by default.

@guardrex
Copy link
Author

guardrex commented Dec 8, 2015

Yes, all of my projects' project.json files have a non-empty publishExclude sections. I use them to keep stuff like node_modules, gulpfile.js, etc. out of my output folders.

I see, so this is "by design" in that you would want someone to add global.json to the publishExclude if they happen to have global.json at that folder level in their project. Cool. I get you on that.

The reason this happened to me was merely by mistake ... I was doing something ... copying something ... dragging something ... I made a mistake, and my global.json ended up in along with the project files (in src > PlatformIssue), and it broke after deployment. I just wanted to make sure this wasn't an issue.

I'm closing ... we're good here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants