Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateAppHost failed Unexpectedly - The process must have the UseShellExecute property set to false in order to redirect IO streams #19653

Closed
Webreaper opened this issue Aug 11, 2021 · 2 comments
Labels
Area-External untriaged Request triage from a team member

Comments

@Webreaper
Copy link

Issue Description:

Compiling a Blazor Server application using .Net 6 preview 7 results in the following error:

/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(5,5): Error MSB4018: The "CreateAppHost" task failed unexpectedly.
System.InvalidOperationException: The Process object must have the UseShellExecute property set to false in order to redirect IO streams.
  at System.Diagnostics.Process.StartWithShellExecuteEx (System.Diagnostics.ProcessStartInfo startInfo) [0x00121] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/System/System.Diagnostics/Process.cs:622 
  at System.Diagnostics.Process.Start () [0x00032] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/Process.cs:2001 
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
  at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo) [0x0001b] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/Process.cs:2490 
  at Microsoft.NET.HostModel.AppHost.HostWriter.CodeSign (System.String appHostPath) [0x0003b] in <78897ac455df4139ac4b39ad370e5af6>:0 
  at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost (System.String appHostSourceFilePath, System.String appHostDestinationFilePath, System.String appBinaryFilePath, System.Boolean windowsGraphicalUserInterface, System.String assemblyToCopyResorcesFrom, System.Boolean enableMacOSCodeSign) [0x0010d] in <78897ac455df4139ac4b39ad370e5af6>:0 
  at Microsoft.NET.Build.Tasks.CreateAppHost.ExecuteCore () [0x0004e] in <4fff4a87d21946bfabeb7e26e299df67>:0 
  at Microsoft.NET.Build.Tasks.TaskBase.Execute () [0x0002e] in <4fff4a87d21946bfabeb7e26e299df67>:0 
  at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono-pullrequest/pr/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:578 
  at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002b9] in /Users/builder/jenkins/workspace/build-package-osx-mono-pullrequest/pr/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:807  (MSB4018) (Dotnet6Sqlite)

The problem appears to happen for any Blazor Server project built with .Net 6 preview 7 (I first saw it in my project and then reproduced it in a simpler, sample project. I attempted to try it with a clean, brand new Blazor Server project created using the .Net 6 preview 7 templates, but was unable to get it to compile due to #19652 (raised separately).

Development Environment

  • M1 MacBook Pro running Big Sur 11.5 beta
  • Visual Studio for Mac v8.10.6 (build 10)
  • .Net SDK 6.0.100-preview.7.21379.14 (x64)
@KalleOlaviNiemitalo
Copy link

This seems a duplicate of dotnet/runtime#55992, which was fixed in dotnet/runtime#56010.

@Webreaper
Copy link
Author

Webreaper commented Aug 11, 2021

Ah, yes, so it is - I searched before raising and saw another issue about CreateAppHost failures, but it was something different; I didn't see the issue you linked. Reading the comments it looks like it was too late to get into P7, but there's a workaround (use <UseAppHost>false</>) so I'll give that a try. Thanks!

jonpryor added a commit to jonpryor/java.interop that referenced this issue Aug 19, 2021
Context: dotnet/roslyn#55564
Context: https://discord.com/channels/732297728826277939/732297837953679412/874959446747533323
Context: dotnet/runtime#55992
Context: dotnet/sdk#19653 (comment)

Fix the Java.Interop build when .NET 6 Preview 7 is installed.

.NET 6 Preview 7 introduced a C# compiler regression: use of
[C#6 string interpolation][0] with `StringBuilder.Append()` when
`$(LangVersion)` < 10.0 results in a CS8400 error:

	error CS8400: Feature 'interpolated string handlers' is not available in C# 8.0. Please use language version 10.0 or greater.

Because `azure-pipelines.yaml` specifies `DotNetCoreVersion: 6.0.x`,
our CI machines get auto-bumped to .NET 6 Preview 7, causing *all*
PR builds to now fail with this CS8400 failure.

There are two possible solutions:

 1. *Avoid* .NET 6 Preview 7.
 2. Remove select use of string interpolation.

(1) was initially done on dotnet#865, by using:

	DotNetCoreVersion: 6.0.100-preview.6.21355.2

However, it's not *all* use of string interpolation which triggers
the CS8400 error.  It's just use of string interpolation within
`StringBuilder.Append()` calls, in 3 locations.

Update `RegisterAttr.cs` to use a `(string)` cast with the existing
string interpolation use.  This works around the CS8400 error.

*Additionally*, macOS+Mono builds would fail in `make all` when
.NET 6 Preview 7 is present:

	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018: The "CreateAppHost" task failed unexpectedly.
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018: System.InvalidOperationException: The Process object must have the UseShellExecute property set to false in order to redirect IO streams.
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at System.Diagnostics.Process.StartWithShellExecuteEx (System.Diagnostics.ProcessStartInfo startInfo)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at System.Diagnostics.Process.Start ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.HostModel.AppHost.HostWriter.CodeSign (System.String appHostPath)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost (System.String appHostSourceFilePath, System.String appHostDestinationFilePath, System.String appBinaryFilePath, System.Boolean windowsGraphicalUserInterface, System.String assemblyToCopyResorcesFrom, System.Boolean enableMacOSCodeSign)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.Build.Tasks.CreateAppHost.ExecuteCore ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.Build.Tasks.TaskBase.Execute ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask)

This was filed as dotnet/runtime#55992, and can be worked around by
setting `$(UseAppHost)`=False in the "offending" projects.

[0]: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated
jonpryor added a commit to jonpryor/java.interop that referenced this issue Aug 19, 2021
Context: dotnet/roslyn#55564
Context: https://discord.com/channels/732297728826277939/732297837953679412/874959446747533323
Context: dotnet/runtime#55992
Context: dotnet/sdk#19653 (comment)

Fix the Java.Interop build when .NET 6 Preview 7 is installed.

.NET 6 Preview 7 introduced a C# compiler regression: use of
[C#6 string interpolation][0] with `StringBuilder.Append()` when
`$(LangVersion)` < 10.0 results in a CS8400 error:

	error CS8400: Feature 'interpolated string handlers' is not available in C# 8.0. Please use language version 10.0 or greater.

Because `azure-pipelines.yaml` specifies `DotNetCoreVersion: 6.0.x`,
our CI machines get auto-bumped to .NET 6 Preview 7, causing *all*
PR builds to now fail with this CS8400 failure.

There are two possible solutions:

 1. *Avoid* .NET 6 Preview 7.
 2. Remove select use of string interpolation.

(1) was initially done on dotnet#865, by using:

	DotNetCoreVersion: 6.0.100-preview.6.21355.2

However, it's not *all* use of string interpolation which triggers
the CS8400 error.  It's just use of string interpolation within
`StringBuilder.Append()` calls, in 3 locations.

Update `RegisterAttr.cs` to use a `(string)` cast with the existing
string interpolation use.  This works around the CS8400 error.

*Additionally*, macOS+Mono builds would fail in `make all` when
.NET 6 Preview 7 is present:

	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018: The "CreateAppHost" task failed unexpectedly.
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018: System.InvalidOperationException: The Process object must have the UseShellExecute property set to false in order to redirect IO streams.
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at System.Diagnostics.Process.StartWithShellExecuteEx (System.Diagnostics.ProcessStartInfo startInfo)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at System.Diagnostics.Process.Start ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.HostModel.AppHost.HostWriter.CodeSign (System.String appHostPath)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost (System.String appHostSourceFilePath, System.String appHostDestinationFilePath, System.String appBinaryFilePath, System.Boolean windowsGraphicalUserInterface, System.String assemblyToCopyResorcesFrom, System.Boolean enableMacOSCodeSign)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.Build.Tasks.CreateAppHost.ExecuteCore ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.Build.Tasks.TaskBase.Execute ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask)

This was filed as dotnet/runtime#55992, and can be worked around by
setting `$(UseAppHost)`=False.

[0]: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated
jonpryor added a commit to dotnet/java-interop that referenced this issue Aug 19, 2021
Context: dotnet/roslyn#55564
Context: https://discord.com/channels/732297728826277939/732297837953679412/874959446747533323
Context: dotnet/runtime#55992
Context: dotnet/sdk#19653 (comment)

Fix the Java.Interop build when .NET 6 Preview 7 is installed.

.NET 6 Preview 7 introduced a C# compiler regression: use of
[C#6 string interpolation][0] with `StringBuilder.Append()` when
`$(LangVersion)` < 10.0 results in a CS8400 error:

	error CS8400: Feature 'interpolated string handlers' is not available in C# 8.0. Please use language version 10.0 or greater.

Because `azure-pipelines.yaml` specifies `DotNetCoreVersion: 6.0.x`,
our CI machines get auto-bumped to .NET 6 Preview 7, causing *all*
PR builds to now fail with this CS8400 failure.

There are two possible solutions:

 1. *Avoid* .NET 6 Preview 7.
 2. Remove select use of string interpolation.

(1) was initially done on #865, by using:

	DotNetCoreVersion: 6.0.100-preview.6.21355.2

However, it's not *all* use of string interpolation which triggers
the CS8400 error.  It's just use of string interpolation within
`StringBuilder.Append()` calls, in 3 locations.

Update `RegisterAttr.cs` to use a `(string)` cast with the existing
string interpolation use.  This works around the CS8400 error.

*Additionally*, macOS+Mono builds would fail in `make all` when
.NET 6 Preview 7 is present:

	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018: The "CreateAppHost" task failed unexpectedly.
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018: System.InvalidOperationException: The Process object must have the UseShellExecute property set to false in order to redirect IO streams.
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at System.Diagnostics.Process.StartWithShellExecuteEx (System.Diagnostics.ProcessStartInfo startInfo)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at System.Diagnostics.Process.Start ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.HostModel.AppHost.HostWriter.CodeSign (System.String appHostPath)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost (System.String appHostSourceFilePath, System.String appHostDestinationFilePath, System.String appBinaryFilePath, System.Boolean windowsGraphicalUserInterface, System.String assemblyToCopyResorcesFrom, System.Boolean enableMacOSCodeSign)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.Build.Tasks.CreateAppHost.ExecuteCore ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.Build.Tasks.TaskBase.Execute ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask)

This was filed as dotnet/runtime#55992, and can be worked around by
setting `$(UseAppHost)`=False.

[0]: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated
jonpryor added a commit to dotnet/java-interop that referenced this issue Aug 25, 2021
Context: dotnet/roslyn#55564
Context: https://discord.com/channels/732297728826277939/732297837953679412/874959446747533323
Context: dotnet/runtime#55992
Context: dotnet/sdk#19653 (comment)

Fix the Java.Interop build when .NET 6 Preview 7 is installed.

.NET 6 Preview 7 introduced a C# compiler regression: use of
[C#6 string interpolation][0] with `StringBuilder.Append()` when
`$(LangVersion)` < 10.0 results in a CS8400 error:

	error CS8400: Feature 'interpolated string handlers' is not available in C# 8.0. Please use language version 10.0 or greater.

Because `azure-pipelines.yaml` specifies `DotNetCoreVersion: 6.0.x`,
our CI machines get auto-bumped to .NET 6 Preview 7, causing *all*
PR builds to now fail with this CS8400 failure.

There are two possible solutions:

 1. *Avoid* .NET 6 Preview 7.
 2. Remove select use of string interpolation.

(1) was initially done on #865, by using:

	DotNetCoreVersion: 6.0.100-preview.6.21355.2

However, it's not *all* use of string interpolation which triggers
the CS8400 error.  It's just use of string interpolation within
`StringBuilder.Append()` calls, in 3 locations.

Update `RegisterAttr.cs` to use a `(string)` cast with the existing
string interpolation use.  This works around the CS8400 error.

*Additionally*, macOS+Mono builds would fail in `make all` when
.NET 6 Preview 7 is present:

	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018: The "CreateAppHost" task failed unexpectedly.
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018: System.InvalidOperationException: The Process object must have the UseShellExecute property set to false in order to redirect IO streams.
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at System.Diagnostics.Process.StartWithShellExecuteEx (System.Diagnostics.ProcessStartInfo startInfo)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at System.Diagnostics.Process.Start ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.HostModel.AppHost.HostWriter.CodeSign (System.String appHostPath)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost (System.String appHostSourceFilePath, System.String appHostDestinationFilePath, System.String appBinaryFilePath, System.Boolean windowsGraphicalUserInterface, System.String assemblyToCopyResorcesFrom, System.Boolean enableMacOSCodeSign)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.Build.Tasks.CreateAppHost.ExecuteCore ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.Build.Tasks.TaskBase.Execute ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask)

This was filed as dotnet/runtime#55992, and can be worked around by
setting `$(UseAppHost)`=False.

[0]: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated
jpobst pushed a commit to dotnet/java-interop that referenced this issue Sep 30, 2021
Context: dotnet/roslyn#55564
Context: https://discord.com/channels/732297728826277939/732297837953679412/874959446747533323
Context: dotnet/runtime#55992
Context: dotnet/sdk#19653 (comment)

Fix the Java.Interop build when .NET 6 Preview 7 is installed.

.NET 6 Preview 7 introduced a C# compiler regression: use of
[C#6 string interpolation][0] with `StringBuilder.Append()` when
`$(LangVersion)` < 10.0 results in a CS8400 error:

	error CS8400: Feature 'interpolated string handlers' is not available in C# 8.0. Please use language version 10.0 or greater.

Because `azure-pipelines.yaml` specifies `DotNetCoreVersion: 6.0.x`,
our CI machines get auto-bumped to .NET 6 Preview 7, causing *all*
PR builds to now fail with this CS8400 failure.

There are two possible solutions:

 1. *Avoid* .NET 6 Preview 7.
 2. Remove select use of string interpolation.

(1) was initially done on #865, by using:

	DotNetCoreVersion: 6.0.100-preview.6.21355.2

However, it's not *all* use of string interpolation which triggers
the CS8400 error.  It's just use of string interpolation within
`StringBuilder.Append()` calls, in 3 locations.

Update `RegisterAttr.cs` to use a `(string)` cast with the existing
string interpolation use.  This works around the CS8400 error.

*Additionally*, macOS+Mono builds would fail in `make all` when
.NET 6 Preview 7 is present:

	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018: The "CreateAppHost" task failed unexpectedly.
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018: System.InvalidOperationException: The Process object must have the UseShellExecute property set to false in order to redirect IO streams.
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at System.Diagnostics.Process.StartWithShellExecuteEx (System.Diagnostics.ProcessStartInfo startInfo)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at System.Diagnostics.Process.Start ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.HostModel.AppHost.HostWriter.CodeSign (System.String appHostPath)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost (System.String appHostSourceFilePath, System.String appHostDestinationFilePath, System.String appBinaryFilePath, System.Boolean windowsGraphicalUserInterface, System.String assemblyToCopyResorcesFrom, System.Boolean enableMacOSCodeSign)
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.Build.Tasks.CreateAppHost.ExecuteCore ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.NET.Build.Tasks.TaskBase.Execute ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute ()
	/usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(536,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask)

This was filed as dotnet/runtime#55992, and can be worked around by
setting `$(UseAppHost)`=False.

[0]: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-External untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

2 participants