-
Notifications
You must be signed in to change notification settings - Fork 54
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
[build] .NET 6 P7 Support (#869) #869
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jpobst
approved these changes
Aug 19, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's how I have it fixed locally, which is probably easier to read:
diff --git a/tools/generator/SourceWriters/Attributes/RegisterAttr.cs b/tools/generator/SourceWriters/Attributes/RegisterAttr.cs
index 81e89780..3ef65d3b 100644
--- a/tools/generator/SourceWriters/Attributes/RegisterAttr.cs
+++ b/tools/generator/SourceWriters/Attributes/RegisterAttr.cs
@@ -32,12 +32,12 @@ namespace generator.SourceWriters
var sb = new StringBuilder ();
if (UseGlobal)
- sb.Append ($"[global::Android.Runtime.Register (\"{Name}\"");
+ sb.Append ((string)$"[global::Android.Runtime.Register (\"{Name}\"");
else
- sb.Append ($"[Register (\"{Name}\"");
+ sb.Append ((string)$"[Register (\"{Name}\"");
if ((Signature.HasValue () || Connector.HasValue ()) && !UseShortForm)
- sb.Append ($", \"{Signature}\", \"{Connector}\"");
+ sb.Append ((string)$", \"{Signature}\", \"{Connector}\"");
if (DoNotGenerateAcw && !AcwLast)
sb.Append (", DoNotGenerateAcw=true");
952a6cd
to
e339373
Compare
@jpobst: thank you for the suggestion. PR updated to use casts. |
e339373
to
f3eb604
Compare
dellis1972
approved these changes
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
f3eb604
to
b2dc8e9
Compare
jonpryor
added a commit
that referenced
this pull request
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
that referenced
this pull request
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 with
StringBuilder.Append()
when$(LangVersion)
< 10.0 results in a CS8400 error:Because
azure-pipelines.yaml
specifiesDotNetCoreVersion: 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) was initially done on #865, by using:
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 existingstring interpolation use. This works around the CS8400 error.
Additionally, macOS+Mono builds would fail in
make all
when.NET 6 Preview 7 is present:
This was filed as dotnet/runtime#55992, and can be worked around by
setting
$(UseAppHost)
=False in the "offending" projects.