Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Exception thrown in non aspnet core example for NodeServices #1208

Closed
mcMickJuice opened this issue Aug 18, 2017 · 2 comments
Closed

Exception thrown in non aspnet core example for NodeServices #1208

mcMickJuice opened this issue Aug 18, 2017 · 2 comments

Comments

@mcMickJuice
Copy link

mcMickJuice commented Aug 18, 2017

I'm following the example for using node services in a non aspnet core app. I'm getting an exception when calling InvokeAsync, related to the ProjectPath:

System.AggregateException occurred
  HResult=0x80131500
  Message=One or more errors occurred.
  Source=<Cannot evaluate the exception source>
  StackTrace:
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at NodeServices.Program.Main(String[] args) in M:\Dev\examples\test-aspnet-core-spa-template\NodeServices\NodeServices\Program.cs:line 22

Inner Exception 1:
ArgumentNullException: Value cannot be null. Parameter Path1

stack trace:

"   at System.IO.Path.Combine(String path1, String path2)\r\n 
  at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.PrepareNodeProcessStartInfo(String entryPointFilename, String projectPath, String commandLineArguments, IDictionary`2 environmentVars, Boolean launchWithDebugging, Int32 debuggingPort)\r\n  
 at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance..ctor(String entryPointScript, String projectPath, String[] watchFileExtensions, String commandLineArguments, CancellationToken applicationStoppingToken, ILogger nodeOutputLogger, IDictionary`2 environmentVars, Int32 invocationTimeoutMilliseconds, Boolean launchWithDebugging, Int32 debuggingPort)\r\n  
at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance..ctor(NodeServicesOptions options, Int32 port)\r\n  
 at Microsoft.AspNetCore.NodeServices.HostingModels.NodeServicesOptionsExtensions.<>c__DisplayClass0_0.<UseHttpHosting>b__0()\r\n   
at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.CreateNewNodeInstance()\r\n
   at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.GetOrCreateCurrentNodeInstance()\r\n   
at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.<InvokeExportWithPossibleRetryAsync>d__10`1.MoveNext()"

I dont think that ProjectPath is being set to the Project root directory. When I set ProjectPath to './', everything works:

 services.AddNodeServices(options =>
            {
                options.ProjectPath = "./";
            });

If this is truly the case, I can update the README for nodeServices to be explicit in how to use NodeServices for non aspnet core projects. For the record, the instructions for aspnet core is correct (i.e. project path is set correctly).

@mcMickJuice mcMickJuice changed the title Process fails in non Asp.Net Exception thrown in non aspnet core example for NodeServices Aug 18, 2017
@SteveSandersonMS
Copy link
Member

Thanks for reporting this. I think it's a duplicate of #1100 so I'll close this one. I think we should change the default to use the process's current working directory if no other dir was specified.

@mcMickJuice
Copy link
Author

Sorry for the duplicate issue! Should've spent more time searching issues.

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

No branches or pull requests

2 participants