Unhandled exception. Amazon.JSII.Runtime.JsiiError: Child process exited unexpectedly
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 267
- Avg merge
- 1d 25m
- Merged PRs (30d)
- 14
Description
### Describe the bug
I'm trying to walk through the [CDK sample tutorial](https://cdkworkshop.com/40-dotnet.html) for the dotnet and getting an error when running `cdk synth`.
### Expected Behavior
The command runs successfully and produces CloudFormation template
### Current Behavior
`cdk synth` fails with an error
```
PS C:\Development\cdk-workshop> cdk synth
Unhandled exception. Amazon.JSII.Runtime.JsiiError: Child process exited unexpectedly!
at Amazon.JSII.Runtime.Services.Runtime.ReadResponse()
at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
at Amazon.JSII.Runtime.Services.Client.Hello()
at Amazon.JSII.Runtime.Services.ServiceContainer.BuildServiceProvider(ILoggerFactory loggerFactoryOverride)
at Amazon.JSII.Runtime.Services.ServiceContainer.<>c.<.cctor>b__8_0()
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at System.Lazy`1.get_Value()
at Amazon.JSII.Runtime.Services.ServiceContainer.get_ServiceProvider()
at Amazon.JSII.Runtime.Deputy.JsiiTypeAttributeBase.Load(Assembly assembly)
at Amazon.JSII.Runtime.Deputy.JsiiTypeAttributeBase.Load(Assembly assembly)
at Amazon.JSII.Runtime.Deputy.DeputyBase..ctor(DeputyProps props)
at Constructs.Construct..ctor(DeputyProps props)
at Amazon.CDK.Stage..ctor(DeputyProps props)
at Amazon.CDK.App..ctor(IAppProps props)
at CdkWorkshop.Program.Main(String[] args) in C:\Development\cdk-workshop\src\CdkWorkshop\Program.cs:line 12
C:\Users\Vitalii:1
[8094:A82C][2024-06-05T17:48:48]i001: Burn v3.10.4.4718, Windows v10.0 (Build 22621: Service Pack 0), path: C:\WINDOWS\Temp\{859CB0D2-AE7C-4ECE-AD90-7A83516D38BC}\.cr\VC_redist.x64.exe
^
SyntaxError: Unexpected token ':'
at wrapSafe (node:internal/modules/cjs/loader:1281:20)
at Module._compile (node:internal/modules/cjs/loader:1321:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49
Node.js v20.15.1
Subprocess exited with error 3762504530
```
after trying several times the error might be shorter like this
```
Unhandled exception. Amazon.JSII.Runtime.JsiiError: Child process exited unexpectedly!
at Amazon.JSII.Runtime.Services.Runtime.ReadResponse()
at Amazon.JSII.Runtime.Services.Client.ReceiveResponse[TResponse]()
at Amazon.JSII.Runtime.Services.Client.Hello()
at Amazon.JSII.Runtime.Services.ServiceContainer.BuildServiceProvider(ILoggerFactory loggerFactoryOverride)
at Amazon.JSII.Runtime.Services.ServiceContainer.<>c.<.cctor>b__8_0()
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at System.Lazy`1.get_Value()
at Amazon.JSII.Runtime.Services.ServiceContainer.get_ServiceProvider()
at Amazon.JSII.Runtime.Deputy.JsiiTypeAttributeBase.Load(Assembly assembly)
at Amazon.JSII.Runtime.Deputy.JsiiTypeAttributeBase.Load(Assembly assembly)
at Amazon.JSII.Runtime.Deputy.DeputyBase..ctor(DeputyProps props)
at Constructs.Construct..ctor(DeputyProps props)
at Amazon.CDK.Stage..ctor(DeputyProps props)
at Amazon.CDK.App..ctor(IAppProps props)
at CdkWorkshop.Program.Main(String[] args) in C:\Development\cdk-workshop\src\CdkWorkshop\Program.cs:line 12
Subprocess exited with error 3762504530
```
### Reproduction Steps
- `cdk init app --language csharp`
- `dotnet build src`
- `cdk synth` or `cdk list`
### Possible Solution
_No response_
### Additional Information/Context
My home folder is `C:\Users\Vitalii Ivanov`, I suspect the space in my username causes the issue, but only for `dotnet` project.
### CDK CLI Version
2.149.0 (build c8e5924)
### Framework Version
_No response_
### Node.js Version
20.15.1
### OS
windows 11 - 22H2 (22621.3880)
### Language
.NET
### Language Version
.net 6
### Other information
I wasn't able to reproduce the issue for the `typescript` project on the same machine.
`cdk init` generates .net 6 project, upgrading to .net 8 doesn't help.
I tried to change the temporary folder location as described [here](https://github.com/aws/jsii/issues/1296#issuecomment-591663558) and after that `cdk synth` produced CF template successfully for the dotnet project.
Contributor guide
Research direction
Reproduce the failure with `cdk init app --language csharp`, `dotnet build src`, then `cdk synth` or `cdk list`, using the stack trace through `Amazon.JSII.Runtime.Services.Runtime` and `CdkWorkshop\Program.cs` line 12 as entry points. Compare behavior with the documented temporary-folder change and the TypeScript project; done means the .NET project runs `cdk synth` or `cdk list` successfully and produces the expected CloudFormation template.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, node.js, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100