Path cannot be null on init #311

Closed
opened 2026-01-29 16:36:13 +00:00 by claunia · 9 comments
Owner

Originally created by @sporeservant on GitHub (May 11, 2019).

Using VS 2019, .net core 2.1, Windows 10 Surface Pro on an ASP.NET Core app, when I run electronize init (via command prompt) I receive the following error:

C:\source\repos\TranslationMessageManager>electronize init
Adding our config file to your project...
Search your .csproj to add the needed electron.manifest.json...
Found your .csproj:  - check for existing config or update it.

Unhandled Exception: System.AggregateException: One or more errors occurred. (Path cannot be null.
Parameter name: path) ---> System.ArgumentNullException: Path cannot be null.
Parameter name: path
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at ElectronNET.CLI.Commands.InitCommand.EditCsProj(String projectFile) in D:\Code\GitHub\Electron.NET\ElectronNET.CLI\Commands\InitCommand.cs:line 126
   at ElectronNET.CLI.Commands.InitCommand.<ExecuteAsync>b__10_0() in D:\Code\GitHub\Electron.NET\ElectronNET.CLI\Commands\InitCommand.cs:line 74
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at ElectronNET.CLI.Program.Main(String[] args) in D:\Code\GitHub\Electron.NET\ElectronNET.CLI\Program.cs:line 54

There isn't anything in that message that makes it clear to me what might be going on here - just figured I would report it in here in case it makes sense to someone on the team :)

Thanks!

Originally created by @sporeservant on GitHub (May 11, 2019). Using VS 2019, .net core 2.1, Windows 10 Surface Pro on an ASP.NET Core app, when I run `electronize init` (via command prompt) I receive the following error: ``` C:\source\repos\TranslationMessageManager>electronize init Adding our config file to your project... Search your .csproj to add the needed electron.manifest.json... Found your .csproj: - check for existing config or update it. Unhandled Exception: System.AggregateException: One or more errors occurred. (Path cannot be null. Parameter name: path) ---> System.ArgumentNullException: Path cannot be null. Parameter name: path at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at ElectronNET.CLI.Commands.InitCommand.EditCsProj(String projectFile) in D:\Code\GitHub\Electron.NET\ElectronNET.CLI\Commands\InitCommand.cs:line 126 at ElectronNET.CLI.Commands.InitCommand.<ExecuteAsync>b__10_0() in D:\Code\GitHub\Electron.NET\ElectronNET.CLI\Commands\InitCommand.cs:line 74 at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot) --- End of inner exception stack trace --- at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) at ElectronNET.CLI.Program.Main(String[] args) in D:\Code\GitHub\Electron.NET\ElectronNET.CLI\Program.cs:line 54 ``` There isn't anything in that message that makes it clear to me what might be going on here - just figured I would report it in here in case it makes sense to someone on the team :) Thanks!
Author
Owner

@sporeservant commented on GitHub (May 14, 2019):

I am closing this ticket as I am pretty certain the issue was that I was using Pages template rather than MVC template, although it could have been numerous other things. I was combining out-of-date usage instructions with up-to-date instructions.

@sporeservant commented on GitHub (May 14, 2019): I am closing this ticket as I am pretty certain the issue was that I was using Pages template rather than MVC template, although it could have been numerous other things. I was combining out-of-date usage instructions with up-to-date instructions.
Author
Owner

@pgrudzien12 commented on GitHub (Jul 19, 2020):

I'm experiencing same issue. For me this is happening every time.
I'm creating new .net server-side blazor project on VS 2019. Then I added added ElectronizeNET.API nuget version 9.31.2 and entries to startup.cs and program.cs. The I run electronize init and get the error.
I'm using .net core version 3.1.

@pgrudzien12 commented on GitHub (Jul 19, 2020): I'm experiencing same issue. For me this is happening every time. I'm creating new .net server-side blazor project on VS 2019. Then I added added ElectronizeNET.API nuget version 9.31.2 and entries to startup.cs and program.cs. The I run electronize init and get the error. I'm using .net core version 3.1.
Author
Owner

@mcmah309 commented on GitHub (Jul 20, 2020):

I am also experiencing this same issue

@mcmah309 commented on GitHub (Jul 20, 2020): I am also experiencing this same issue
Author
Owner

@weebs commented on GitHub (Aug 11, 2020):

Experiencing the same issue here on a WebAPI project

@weebs commented on GitHub (Aug 11, 2020): Experiencing the same issue here on a WebAPI project
Author
Owner

@goonzaah commented on GitHub (Sep 1, 2020):

I have te same issue Net Core 3.1 and ElectronizeNET.API nuget version 9.31.2

@goonzaah commented on GitHub (Sep 1, 2020): I have te same issue Net Core 3.1 and ElectronizeNET.API nuget version 9.31.2
Author
Owner

@goonzaah commented on GitHub (Sep 1, 2020):

I could resolve a problem. I m should be in the folder where are the Startup.cs and Program.cs when I execute this commands.
I expect that this resolve yours problems too.

@goonzaah commented on GitHub (Sep 1, 2020): I could resolve a problem. I m should be in the folder where are the Startup.cs and Program.cs when I execute this commands. I expect that this resolve yours problems too.
Author
Owner

@netpoetica commented on GitHub (Sep 17, 2020):

I recommend you guys open a new issue and provide as much detail as possible. It has been a long time since I personally saw this issue, and I don't recall specifically what the issue was or how I solved it.

@netpoetica commented on GitHub (Sep 17, 2020): I recommend you guys open a new issue and provide as much detail as possible. It has been a long time since I personally saw this issue, and I don't recall specifically what the issue was or how I solved it.
Author
Owner

@aliyss commented on GitHub (Oct 10, 2020):

So here's the thing:

At the following step:

At the first time, you need an Electron.NET project initialization. Type the following command in your ASP.NET Core folder:

$ electronize init

Be sure you cd to the correct folder in advance:

So if your folder structure is:

├── project
│   └── Startup.cs
└── project.sln

Then in the Terminal do this:

$ cd project
$ electronize init
$ cd ..
$ electronize start
@aliyss commented on GitHub (Oct 10, 2020): So here's the thing: **At the following step:** At the first time, you need an Electron.NET project initialization. Type the following command in your ASP.NET Core folder: ``` $ electronize init ``` **Be sure you cd to the correct folder in advance:** So if your folder structure is: ``` ├── project │ └── Startup.cs └── project.sln ``` Then in the Terminal do this: ``` $ cd project $ electronize init $ cd .. $ electronize start ```
Author
Owner

@QuinnSapp26 commented on GitHub (May 12, 2021):

@goonzaah That solution worked for me! (I have an ASP.NET Web Application MVC).
Just to reiterate the answer:
cd into the directory containing Program.cs and Startup.cs and run electronize init in there.

@QuinnSapp26 commented on GitHub (May 12, 2021): @goonzaah That solution worked for me! (I have an ASP.NET Web Application MVC). Just to reiterate the answer: cd into the directory containing Program.cs and Startup.cs and run `electronize init` in there.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#311