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

System.ArgumentNullException with published application #2552

Closed
nicolasr75 opened this issue Aug 24, 2015 · 6 comments
Closed

System.ArgumentNullException with published application #2552

nicolasr75 opened this issue Aug 24, 2015 · 6 comments
Assignees
Milestone

Comments

@nicolasr75
Copy link

I have published a web application developed with Visual Studio to local filesystem. As far as I understand, the published application should be self contained and be runnable with either the web or kestrel commands.
On my development machine (Win10 Pro) I can successfully run it with either web or kestrel.
I copied all files to another computer (also Win10 Pro) and tried to run it there which gives me:

C:\MyPath>kestrel
System.ArgumentNullException: Value cannot be null.
Parameter name: source
   at System.Linq.Enumerable.Select[TSource,TResult](IEnumerable`1 source, Func`2 selector)
   at Microsoft.Dnx.ApplicationHost.DefaultHost.GetEntryPoint(String application Name)
   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, FrameworkName targetFramework)
   at Microsoft.Dnx.Host.RuntimeBootstrapper.ExecuteAsync(String[] args, FrameworkName targetFramework)
   at Microsoft.Dnx.Host.RuntimeBootstrapper.Execute(String[] args, FrameworkName targetFramework)

I tried to target both .NET core and full .NET (both beta 8) with the same result.
Then I installed the beta 8 runtime with dnvm globally and tried to run the application with "dnx kestrel", again with the same result.

What could be the issue here? Why does Microsoft.Dnx.ApplicationHost fail on one computer but not on the other?

@ChengTian
Copy link
Contributor

I did some experiments and found that you always get this ArgumentNullException when there are unresolved dependencies.

This is a regression in DNX. /cc @muratg @davidfowl

@ChengTian
Copy link
Contributor

Hi @nicolasr75 , it is very likely that you have some dependencies missing on your second machine.

You are right, the published bundle is self-contained and it should contain all required dependencies. However, the bundle's local packages folder (<bundle_root>/approot/packages) can be overridden by some environment variables. Please check whether you have the env var NUGET_PACKAGES or DNX_PACKAGES set on your second machine. If you have both/one of them, please erase the env vars before you run the app.

@nicolasr75
Copy link
Author

Thanks for the quick help. I checked the environment variables but did not find the once you mention. Meanwhile I used the VS2015 Web Application template, updated it to beta 8 and tested that: it works, at least with 'web' on both computers. Kestrel gives me issues with libuv but that is a different topic...
I had created my own test application at around beta 2. I had tried to update everything according to the announcements but something must now be different in comparison to the VS template.
So, I started with a fresh VS template, updated to beta 8, included all my files and now it works.

@davidfowl
Copy link
Member

@ChengTian do we have a test for this scenario?

@ChengTian
Copy link
Contributor

No, we don't have any test covering the scenario where you run an app with missing dependencies.

@ChengTian
Copy link
Contributor

This will be fixed as part of @davidfowl 's dnx refactoring PR

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

No branches or pull requests

3 participants