steffbeckers / code-generator

.NET based code generator. Configure projects and generate boilerplate code with T4 templates, based on a simple JSON representation of domain models.
https://steffbeckers.eu/projects/code-generator
2 stars 1 forks source link

Error While Running a Fresh Clone #4

Open juicebyjustin opened 3 years ago

juicebyjustin commented 3 years ago

I am trying to run this project from a fresh clone, and I get an error message running dotnet watch run or docker-compose -up. There are no log messages after the message below.

How to replicate:

  1. Clone repo.
  2. Open root directory in terminal.
  3. Run dotnet build
  4. CD to CodeGen
  5. Run dotnet watch run

Complete Log Output: https://gist.github.com/juicebyjustin/d5d61c7b50550d19ab65ffd06cb12875

Error Message:

fail: CodeGen.Worker[0]
      No such file or directory
      System.ComponentModel.Win32Exception (2): No such file or directory
         at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
         at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
         at System.Diagnostics.Process.Start()
         at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
         at CodeGen.Runners.DotNETProjectRunner.Run() in /Users/justin/Documents/GitHub/code-generator/CodeGen/Runners/DotNETProjectRunner.cs:line 50
         at CodeGen.Worker.ExecuteAsync(CancellationToken cancellationToken) in /Users/justin/Documents/GitHub/code-generator/CodeGen/Worker.cs:line 47

CodeGen/Runners/DotNETProjectRunner.cs:line 50:

await Process.Start(openSwagger).WaitForExitAsync();
steffbeckers commented 3 years ago

The error you get might be related to a cross-platform issue, since you get a Win32Exception. Currently I'm using windows explorer to open a browser and navigate to the running API's swagger page.

// Open swagger
_logger.LogInformation("Opening Swagger docs: " + _outputProjectPath);

ProcessStartInfo openSwagger = new ProcessStartInfo("explorer");
openSwagger.Arguments = _projectTemplateSettings.DotNET.StartupProjectURL;
await Process.Start(openSwagger).WaitForExitAsync();

I think this functionality needs to be changed or removed.

juicebyjustin commented 3 years ago

I switched from VS Code to Visual Studio and actually debugged the project. I see that it's trying to start the web browser at https://localhost:44370. I'm running on a Mac so of course explorer is not available. However, Swagger is not running on port 44370.

steffbeckers commented 3 years ago

Can you try to run the generated project from in the _Output folder?