diff --git a/build/Directory.Build.props b/build/Directory.Build.props
index efc7a33d..d0778fe0 100644
--- a/build/Directory.Build.props
+++ b/build/Directory.Build.props
@@ -9,10 +9,10 @@
Enable the latest warning wave, which shows additional warnings for invalid language features that are disabled by default.
For additional info, see https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/warning-waves.
-->
- 7
+ latest
- 7-all
+ latest-all
true
diff --git a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.ResourceTextureDescriptions.cs b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.ResourceTextureDescriptions.cs
index 51618a43..f975e2ee 100644
--- a/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.ResourceTextureDescriptions.cs
+++ b/src/ComputeSharp.D2D1.SourceGenerators/D2DPixelShaderDescriptorGenerator.ResourceTextureDescriptions.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Immutable;
+using System.Globalization;
using ComputeSharp.D2D1.SourceGenerators.Models;
using ComputeSharp.SourceGeneration.Extensions;
using ComputeSharp.SourceGeneration.Helpers;
@@ -48,7 +49,7 @@ partial class D2DPixelShaderDescriptorGenerator
if (HlslKnownTypes.IsResourceTextureType(metadataName))
{
// The type name will be ComputeSharp.D2D1.D2D1ResourceTexture1D`1 or the 2D/3D versions
- int rank = int.Parse(metadataName.Substring(metadataName.Length - 4, 1));
+ int rank = int.Parse(metadataName.Substring(metadataName.Length - 4, 1), CultureInfo.InvariantCulture);
int? index = null;
// Get the index from the [D2DResourceTextureIndex] attribute over the field
diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownMethods.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownMethods.cs
index 8ea3c68d..38ff6e74 100644
--- a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownMethods.cs
+++ b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownMethods.cs
@@ -76,8 +76,6 @@ internal static partial class HlslKnownMethods
["System.MathF.Exp"] = "exp",
["System.MathF.Log"] = "log",
["System.MathF.Log10"] = "log10",
- ["System.MathF.Max"] = "max",
- ["System.MathF.Min"] = "min",
["System.MathF.Round"] = "round",
["System.MathF.Sqrt"] = "sqrt",
["System.MathF.Sign"] = "sign",
diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownOperators.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownOperators.cs
index 885c06e9..826fd3c2 100644
--- a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownOperators.cs
+++ b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownOperators.cs
@@ -27,7 +27,7 @@ internal static partial class HlslKnownOperators
foreach ((Type Type, MethodInfo Operator, string IntrinsicName, bool RequiresParametersMatching) item in
from type in HlslKnownTypes.KnownVectorTypes.Concat(HlslKnownTypes.KnownMatrixTypes)
from method in type.GetMethods(BindingFlags.Static | BindingFlags.Public)
- where method.IsSpecialName && method.Name.StartsWith("op_")
+ where method.IsSpecialName && method.Name.StartsWith("op_", StringComparison.InvariantCulture)
let attribute = method.GetCustomAttribute()
where attribute is not null
select (Type: type, Operator: method, IntrinsicName: attribute.Name, attribute.RequiresParametersMatching))
diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs
index 280c4196..1fad2424 100644
--- a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs
+++ b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.Linq;
using System.Numerics;
using System.Text.RegularExpressions;
@@ -140,8 +141,8 @@ internal static partial class HlslKnownTypes
if (match.Success)
{
elementName = match.Groups[1].Value;
- rows = int.Parse(match.Groups[2].Value);
- columns = int.Parse(match.Groups[3].Value);
+ rows = int.Parse(match.Groups[2].Value, CultureInfo.InvariantCulture);
+ columns = int.Parse(match.Groups[3].Value, CultureInfo.InvariantCulture);
return true;
}
@@ -247,7 +248,7 @@ internal static partial class HlslKnownTypes
type.TypeKind is TypeKind.Enum ||
type.IsGenericType ||
type.IsRefLikeType ||
- type.GetFullyQualifiedName().StartsWith("System."))
+ type.GetFullyQualifiedName().StartsWith("System.", StringComparison.InvariantCulture))
{
_ = invalidTypes.Add(type);
diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs
index 100ea479..3e41bb7f 100644
--- a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs
+++ b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/ShaderSourceRewriter.cs
@@ -491,7 +491,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
ArgumentSyntax coordinateSyntax = mapping switch
{
not null => Argument(InvocationExpression(IdentifierName(mapping!), ArgumentList(updatedNode.ArgumentList.Arguments))),
- null => updatedNode.ArgumentList.Arguments[0]
+ _ => updatedNode.ArgumentList.Arguments[0]
};
// Rewrite texture resource sampled accesses, if needed
diff --git a/src/ComputeSharp.SourceGeneration/Extensions/IndentedTextWriterExtensions.cs b/src/ComputeSharp.SourceGeneration/Extensions/IndentedTextWriterExtensions.cs
index 88dd0208..59765261 100644
--- a/src/ComputeSharp.SourceGeneration/Extensions/IndentedTextWriterExtensions.cs
+++ b/src/ComputeSharp.SourceGeneration/Extensions/IndentedTextWriterExtensions.cs
@@ -50,13 +50,13 @@ internal static class IndentedTextWriterExtensions
public static void WriteSortedUsingDirectives(this IndentedTextWriter writer, IEnumerable usingDirectives)
{
// Add the System directives first, in the correct order
- foreach (string usingDirective in usingDirectives.Where(static name => name.StartsWith("global::System")).OrderBy(static name => name))
+ foreach (string usingDirective in usingDirectives.Where(static name => name.StartsWith("global::System", StringComparison.InvariantCulture)).OrderBy(static name => name))
{
writer.WriteLine($"using {usingDirective};");
}
// Add the other directives, also sorted in the correct order
- foreach (string usingDirective in usingDirectives.Where(static name => !name.StartsWith("global::System")).OrderBy(static name => name))
+ foreach (string usingDirective in usingDirectives.Where(static name => !name.StartsWith("global::System", StringComparison.InvariantCulture)).OrderBy(static name => name))
{
writer.WriteLine($"using {usingDirective};");
}
diff --git a/src/ComputeSharp.SourceGeneration/Helpers/DynamicCache{TKey,TValue}.cs b/src/ComputeSharp.SourceGeneration/Helpers/DynamicCache{TKey,TValue}.cs
index 8303c8a7..11d2f932 100644
--- a/src/ComputeSharp.SourceGeneration/Helpers/DynamicCache{TKey,TValue}.cs
+++ b/src/ComputeSharp.SourceGeneration/Helpers/DynamicCache{TKey,TValue}.cs
@@ -14,7 +14,7 @@ namespace ComputeSharp.SourceGeneration.Helpers;
///
/// The type of keys to use for the cache.
/// The type of values to store in the cache.
-public sealed class DynamicCache
+internal sealed class DynamicCache
where TKey : class
{
///
diff --git a/src/ComputeSharp.SourceGenerators/Dxc/DxcCompilationException.cs b/src/ComputeSharp.SourceGenerators/Dxc/DxcCompilationException.cs
index 7b690b9e..446a975f 100644
--- a/src/ComputeSharp.SourceGenerators/Dxc/DxcCompilationException.cs
+++ b/src/ComputeSharp.SourceGenerators/Dxc/DxcCompilationException.cs
@@ -11,7 +11,7 @@ internal sealed class DxcCompilationException : Exception
/// Creates a new instance.
///
/// The error message produced by the DXC compiler.
- internal DxcCompilationException(string error)
+ public DxcCompilationException(string error)
: base(GetExceptionMessage(error))
{
}