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

Add support for running on .NET 9 with Roslyn #467

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/Compiler/TransformFramework/CodeTransformer.cs
Original file line number Diff line number Diff line change
@@ -98,11 +98,8 @@ public class CodeCompiler
/// The language that we'll compile
/// </summary>
protected string language = "C#";
protected bool runningOnNetCore = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase)
|| System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith(".NET 5", StringComparison.OrdinalIgnoreCase)
|| System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith(".NET 6", StringComparison.OrdinalIgnoreCase)
|| System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith(".NET 7", StringComparison.OrdinalIgnoreCase)
|| System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith(".NET 8", StringComparison.OrdinalIgnoreCase);
protected bool runningOnNetCore = !System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.OrdinalIgnoreCase)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be more readable to make a variable runningOnNetFramework and then runningOnNetCore = !runningOnNetFramework && !runningOnMono

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. But that way it breaks public contract if the library. I don’t know if that’s acceptable.

Copy link
Contributor

@tminka tminka Mar 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wouldn't break anything if you put the code in the constructor.

&& Type.GetType("Mono.Runtime") == null;
protected bool runningOnMono = Type.GetType("Mono.Runtime") != null;

/// <summary>
@@ -591,4 +588,4 @@ public CompilerResults(Assembly compiledAssembly, bool success, List<string> err
#if SUPPRESS_XMLDOC_WARNINGS
#pragma warning restore 1591
#endif
}
}