From 705517b169d32c501885690ab1e2202ec46a52e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Wed, 9 Jul 2025 15:07:46 +0200 Subject: [PATCH 01/21] style: remove blank lines --- src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs index 7110b4f3a7..eca9d80328 100644 --- a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs +++ b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs @@ -4,7 +4,6 @@ namespace Sentry.SourceGenerators; - /// /// Generates the necessary msbuild variables /// @@ -93,6 +92,5 @@ public static void Initialize() context.AddSource("__BuildProperties.g.cs", sb.ToString()); } - private static string EscapeString(string value) => value.Replace("\\", "\\\\"); } From 1bdd47c897a5cf0e7663403e002829c605fbc309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Wed, 9 Jul 2025 15:54:45 +0200 Subject: [PATCH 02/21] fix: Generator emitting source when Application --- .../BuildPropertySourceGenerator.cs | 7 +- .../OutputKindExtensions.cs | 20 +++++ ...torTests.RunResult_BadStrings.verified.txt | 73 ++++++++----------- ...sts.RunResult_Publish_AotTrue.verified.txt | 73 ++++++++----------- ...eratorTests.RunResult_Success.verified.txt | 73 ++++++++----------- .../BuildPropertySourceGeneratorTests.cs | 49 ++++++++++--- 6 files changed, 145 insertions(+), 150 deletions(-) create mode 100644 src/Sentry.SourceGenerators/OutputKindExtensions.cs diff --git a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs index eca9d80328..63623231c0 100644 --- a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs +++ b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs @@ -36,12 +36,7 @@ public void Execute(GeneratorExecutionContext context) } // we only want to generate code where host setup takes place - if (!opts.TryGetValue("build_property.outputtype", out var outputType)) - { - return; - } - - if (!outputType.Equals("exe", StringComparison.InvariantCultureIgnoreCase)) + if (!context.Compilation.Options.OutputKind.IsExe()) { return; } diff --git a/src/Sentry.SourceGenerators/OutputKindExtensions.cs b/src/Sentry.SourceGenerators/OutputKindExtensions.cs new file mode 100644 index 0000000000..a96d233107 --- /dev/null +++ b/src/Sentry.SourceGenerators/OutputKindExtensions.cs @@ -0,0 +1,20 @@ +using Microsoft.CodeAnalysis; + +namespace Sentry.SourceGenerators; + +internal static class OutputKindExtensions +{ + internal static bool IsExe(this OutputKind outputKind) + { + return outputKind switch + { + OutputKind.ConsoleApplication => true, + OutputKind.WindowsApplication => true, + OutputKind.DynamicallyLinkedLibrary => false, + OutputKind.NetModule => false, + OutputKind.WindowsRuntimeMetadata => false, + OutputKind.WindowsRuntimeApplication => true, + _ => false, + }; + } +} diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt index 94298c45c3..f300fc1d49 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/__BuildProperties.g.cs, Encoding: utf-8, - Length: 639, + Length: 613, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -34,13 +34,12 @@ public static class BuildVariableInitializer { global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary { {"My\\Key", "test\\test"}, - {"OutputType", "exe"}, }); } } #endif , - Length: 639, + Length: 613, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -280,83 +279,69 @@ public static class BuildVariableInitializer { LineNumber: 17, Start: 595, - End: 620, - EndIncludingLineBreak: 621, + End: 600, + EndIncludingLineBreak: 601, Span: { Start: 595, - Length: 25 - }, - SpanIncludingLineBreak: { - Start: 595, - Length: 26 - } - }, - { - LineNumber: 18, - Start: 621, - End: 626, - EndIncludingLineBreak: 627, - Span: { - Start: 621, Length: 5 }, SpanIncludingLineBreak: { - Start: 621, + Start: 595, Length: 6 } }, { - LineNumber: 19, - Start: 627, - End: 629, - EndIncludingLineBreak: 630, + LineNumber: 18, + Start: 601, + End: 603, + EndIncludingLineBreak: 604, Span: { - Start: 627, + Start: 601, Length: 2 }, SpanIncludingLineBreak: { - Start: 627, + Start: 601, Length: 3 } }, { - LineNumber: 20, - Start: 630, - End: 631, - EndIncludingLineBreak: 632, + LineNumber: 19, + Start: 604, + End: 605, + EndIncludingLineBreak: 606, Span: { - Start: 630, + Start: 604, Length: 1 }, SpanIncludingLineBreak: { - Start: 630, + Start: 604, Length: 2 } }, { - LineNumber: 21, - Start: 632, - End: 638, - EndIncludingLineBreak: 639, + LineNumber: 20, + Start: 606, + End: 612, + EndIncludingLineBreak: 613, Span: { - Start: 632, + Start: 606, Length: 6 }, SpanIncludingLineBreak: { - Start: 632, + Start: 606, Length: 7 } }, { - LineNumber: 22, - Start: 639, - End: 639, - EndIncludingLineBreak: 639, + LineNumber: 21, + Start: 613, + End: 613, + EndIncludingLineBreak: 613, Span: { - Start: 639 + Start: 613 }, SpanIncludingLineBreak: { - Start: 639 + Start: 613 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt index 37b44b9ecd..0d594925f7 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/__BuildProperties.g.cs, Encoding: utf-8, - Length: 636, + Length: 610, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -34,13 +34,12 @@ public static class BuildVariableInitializer { global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary { {"PublishAot", "true"}, - {"OutputType", "exe"}, }); } } #endif , - Length: 636, + Length: 610, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -280,83 +279,69 @@ public static class BuildVariableInitializer { LineNumber: 17, Start: 592, - End: 617, - EndIncludingLineBreak: 618, + End: 597, + EndIncludingLineBreak: 598, Span: { Start: 592, - Length: 25 - }, - SpanIncludingLineBreak: { - Start: 592, - Length: 26 - } - }, - { - LineNumber: 18, - Start: 618, - End: 623, - EndIncludingLineBreak: 624, - Span: { - Start: 618, Length: 5 }, SpanIncludingLineBreak: { - Start: 618, + Start: 592, Length: 6 } }, { - LineNumber: 19, - Start: 624, - End: 626, - EndIncludingLineBreak: 627, + LineNumber: 18, + Start: 598, + End: 600, + EndIncludingLineBreak: 601, Span: { - Start: 624, + Start: 598, Length: 2 }, SpanIncludingLineBreak: { - Start: 624, + Start: 598, Length: 3 } }, { - LineNumber: 20, - Start: 627, - End: 628, - EndIncludingLineBreak: 629, + LineNumber: 19, + Start: 601, + End: 602, + EndIncludingLineBreak: 603, Span: { - Start: 627, + Start: 601, Length: 1 }, SpanIncludingLineBreak: { - Start: 627, + Start: 601, Length: 2 } }, { - LineNumber: 21, - Start: 629, - End: 635, - EndIncludingLineBreak: 636, + LineNumber: 20, + Start: 603, + End: 609, + EndIncludingLineBreak: 610, Span: { - Start: 629, + Start: 603, Length: 6 }, SpanIncludingLineBreak: { - Start: 629, + Start: 603, Length: 7 } }, { - LineNumber: 22, - Start: 636, - End: 636, - EndIncludingLineBreak: 636, + LineNumber: 21, + Start: 610, + End: 610, + EndIncludingLineBreak: 610, Span: { - Start: 636 + Start: 610 }, SpanIncludingLineBreak: { - Start: 636 + Start: 610 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt index ff9d84c52d..e0c523e78a 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/__BuildProperties.g.cs, Encoding: utf-8, - Length: 637, + Length: 611, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -34,13 +34,12 @@ public static class BuildVariableInitializer { global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary { {"PublishAot", "false"}, - {"OutputType", "exe"}, }); } } #endif , - Length: 637, + Length: 611, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -280,83 +279,69 @@ public static class BuildVariableInitializer { LineNumber: 17, Start: 593, - End: 618, - EndIncludingLineBreak: 619, + End: 598, + EndIncludingLineBreak: 599, Span: { Start: 593, - Length: 25 - }, - SpanIncludingLineBreak: { - Start: 593, - Length: 26 - } - }, - { - LineNumber: 18, - Start: 619, - End: 624, - EndIncludingLineBreak: 625, - Span: { - Start: 619, Length: 5 }, SpanIncludingLineBreak: { - Start: 619, + Start: 593, Length: 6 } }, { - LineNumber: 19, - Start: 625, - End: 627, - EndIncludingLineBreak: 628, + LineNumber: 18, + Start: 599, + End: 601, + EndIncludingLineBreak: 602, Span: { - Start: 625, + Start: 599, Length: 2 }, SpanIncludingLineBreak: { - Start: 625, + Start: 599, Length: 3 } }, { - LineNumber: 20, - Start: 628, - End: 629, - EndIncludingLineBreak: 630, + LineNumber: 19, + Start: 602, + End: 603, + EndIncludingLineBreak: 604, Span: { - Start: 628, + Start: 602, Length: 1 }, SpanIncludingLineBreak: { - Start: 628, + Start: 602, Length: 2 } }, { - LineNumber: 21, - Start: 630, - End: 636, - EndIncludingLineBreak: 637, + LineNumber: 20, + Start: 604, + End: 610, + EndIncludingLineBreak: 611, Span: { - Start: 630, + Start: 604, Length: 6 }, SpanIncludingLineBreak: { - Start: 630, + Start: 604, Length: 7 } }, { - LineNumber: 22, - Start: 637, - End: 637, - EndIncludingLineBreak: 637, + LineNumber: 21, + Start: 611, + End: 611, + EndIncludingLineBreak: 611, Span: { - Start: 637 + Start: 611 }, SpanIncludingLineBreak: { - Start: 637 + Start: 611 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.cs b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.cs index b952748dd5..127effd98b 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.cs +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.cs @@ -5,7 +5,6 @@ namespace Sentry.SourceGenerators.Tests; - public class BuildPropertySourceGeneratorTests { [SkippableFact] @@ -13,7 +12,7 @@ public Task RunResult_Success() { Skip.If(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)); - var driver = BuildDriver(typeof(Program).Assembly, ("PublishAot", "false"), ("OutputType", "exe")); + var driver = BuildDriver(OutputKind.ConsoleApplication, typeof(Program).Assembly, ("PublishAot", "false")); var result = driver.GetRunResult().Results.FirstOrDefault(); result.Exception.Should().BeNull(); result.GeneratedSources.Length.Should().Be(1); @@ -21,14 +20,13 @@ public Task RunResult_Success() return Verify(result); } - [SkippableFact] public Task RunResult_BadStrings() { Skip.If(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)); // we're hijacking PublishAot to make life easy - var driver = BuildDriver(typeof(Program).Assembly, ("My\\Key", "test\\test"), ("OutputType", "exe")); + var driver = BuildDriver(OutputKind.ConsoleApplication, typeof(Program).Assembly, ("My\\Key", "test\\test")); var result = driver.GetRunResult().Results.FirstOrDefault(); result.Exception.Should().BeNull(); result.GeneratedSources.Length.Should().Be(1); @@ -36,13 +34,12 @@ public Task RunResult_BadStrings() return Verify(result); } - [SkippableFact] public Task RunResult_Publish_AotTrue() { Skip.If(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)); - var driver = BuildDriver(typeof(Program).Assembly, ("PublishAot", "true"), ("OutputType", "exe")); + var driver = BuildDriver(OutputKind.ConsoleApplication, typeof(Program).Assembly, ("PublishAot", "true")); var result = driver.GetRunResult().Results.FirstOrDefault(); result.Exception.Should().BeNull(); result.GeneratedSources.Length.Should().Be(1); @@ -50,6 +47,36 @@ public Task RunResult_Publish_AotTrue() return Verify(result); } + [SkippableFact] + public void RunResult_NoProperties_NoGeneratedSources() + { + Skip.If(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)); + + var driver = BuildDriver(OutputKind.ConsoleApplication, typeof(Program).Assembly); + var result = driver.GetRunResult().Results.FirstOrDefault(); + result.Exception.Should().BeNull(); + + result.GeneratedSources.Should().BeEmpty(); + } + + [SkippableTheory] + [InlineData(OutputKind.ConsoleApplication, true)] + [InlineData(OutputKind.WindowsApplication, true)] + [InlineData(OutputKind.WindowsRuntimeApplication, true)] + [InlineData(OutputKind.DynamicallyLinkedLibrary, false)] + [InlineData(OutputKind.NetModule, false)] + [InlineData(OutputKind.WindowsRuntimeMetadata, false)] + public void RunResult_OutputType_Values(OutputKind outputKind, bool sourceGenExpected) + { + Skip.If(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)); + + var driver = BuildDriver(outputKind, typeof(Program).Assembly, ("PublishTrimmed", "true")); + var result = driver.GetRunResult().Results.FirstOrDefault(); + result.Exception.Should().BeNull(); + + var generated = result.GeneratedSources.Any(x => x.HintName.Equals("__BuildProperties.g.cs")); + generated.Should().Be(sourceGenExpected); + } [SkippableTheory] [InlineData("no", true)] @@ -59,7 +86,7 @@ public void RunResult_SentryDisableSourceGenerator_Values(string value, bool sou { Skip.If(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)); - var driver = BuildDriver(typeof(Program).Assembly, ("SentryDisableSourceGenerator", value), ("OutputType", "exe")); + var driver = BuildDriver(OutputKind.ConsoleApplication, typeof(Program).Assembly, ("SentryDisableSourceGenerator", value)); var result = driver.GetRunResult().Results.FirstOrDefault(); result.Exception.Should().BeNull(); @@ -67,13 +94,12 @@ public void RunResult_SentryDisableSourceGenerator_Values(string value, bool sou generated.Should().Be(sourceGenExpected); } - [SkippableFact] public Task RunResult_Expect_None() { Skip.If(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)); - var driver = BuildDriver(typeof(Program).Assembly, ("PublishAot", "false")); + var driver = BuildDriver(OutputKind.DynamicallyLinkedLibrary, typeof(Program).Assembly, ("PublishAot", "false")); var result = driver.GetRunResult().Results.FirstOrDefault(); result.Exception.Should().BeNull(); result.GeneratedSources.Length.Should().Be(0); @@ -81,11 +107,10 @@ public Task RunResult_Expect_None() return Verify(result); } - - private static GeneratorDriver BuildDriver(Assembly metadataAssembly, params IEnumerable<(string Key, string Value)> buildProperties) + private static GeneratorDriver BuildDriver(OutputKind outputKind, Assembly metadataAssembly, params IEnumerable<(string Key, string Value)> buildProperties) { var metadataReference = MetadataReference.CreateFromFile(metadataAssembly.Location); - var options = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary); + var options = new CSharpCompilationOptions(outputKind); var compilation = CSharpCompilation.Create("TestAssembly", [], [metadataReference], options); var generator = new BuildPropertySourceGenerator(); From c3d8dd7fad2f0d23a700afea4c0f64a0a2bf969d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Wed, 9 Jul 2025 15:55:02 +0200 Subject: [PATCH 03/21] ref: make Generator sealed --- src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs index 63623231c0..89e0103fd0 100644 --- a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs +++ b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs @@ -8,7 +8,7 @@ namespace Sentry.SourceGenerators; /// Generates the necessary msbuild variables /// [Generator(LanguageNames.CSharp)] -public class BuildPropertySourceGenerator : ISourceGenerator +public sealed class BuildPropertySourceGenerator : ISourceGenerator { /// /// Initialize the source gen From 11c91edacd0714e82ef0ba237c85d119a2415f89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Wed, 9 Jul 2025 16:05:37 +0200 Subject: [PATCH 04/21] fix: emitted Dictionary uses StringComparer.OrdinalIgnoreCase --- .../BuildPropertySourceGenerator.cs | 3 +- ...torTests.RunResult_BadStrings.verified.txt | 99 +++++++++++-------- ...sts.RunResult_Publish_AotTrue.verified.txt | 99 +++++++++++-------- ...eratorTests.RunResult_Success.verified.txt | 99 +++++++++++-------- 4 files changed, 173 insertions(+), 127 deletions(-) diff --git a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs index 89e0103fd0..23b5c10e92 100644 --- a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs +++ b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs @@ -60,7 +60,8 @@ public static class BuildVariableInitializer [global::System.Runtime.CompilerServices.ModuleInitializer] public static void Initialize() { - global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary { + global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) + { """ ); diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt index f300fc1d49..e8ab836e55 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/__BuildProperties.g.cs, Encoding: utf-8, - Length: 613, + Length: 670, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -32,14 +32,15 @@ public static class BuildVariableInitializer [global::System.Runtime.CompilerServices.ModuleInitializer] public static void Initialize() { - global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary { + global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) + { {"My\\Key", "test\\test"}, }); } } #endif , - Length: 613, + Length: 670, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -251,97 +252,111 @@ public static class BuildVariableInitializer { LineNumber: 15, Start: 430, - End: 564, - EndIncludingLineBreak: 565, + End: 611, + EndIncludingLineBreak: 612, Span: { Start: 430, - Length: 134 + Length: 181 }, SpanIncludingLineBreak: { Start: 430, - Length: 135 + Length: 182 } }, { LineNumber: 16, - Start: 565, - End: 594, - EndIncludingLineBreak: 595, + Start: 612, + End: 621, + EndIncludingLineBreak: 622, Span: { - Start: 565, + Start: 612, + Length: 9 + }, + SpanIncludingLineBreak: { + Start: 612, + Length: 10 + } + }, + { + LineNumber: 17, + Start: 622, + End: 651, + EndIncludingLineBreak: 652, + Span: { + Start: 622, Length: 29 }, SpanIncludingLineBreak: { - Start: 565, + Start: 622, Length: 30 } }, { - LineNumber: 17, - Start: 595, - End: 600, - EndIncludingLineBreak: 601, + LineNumber: 18, + Start: 652, + End: 657, + EndIncludingLineBreak: 658, Span: { - Start: 595, + Start: 652, Length: 5 }, SpanIncludingLineBreak: { - Start: 595, + Start: 652, Length: 6 } }, { - LineNumber: 18, - Start: 601, - End: 603, - EndIncludingLineBreak: 604, + LineNumber: 19, + Start: 658, + End: 660, + EndIncludingLineBreak: 661, Span: { - Start: 601, + Start: 658, Length: 2 }, SpanIncludingLineBreak: { - Start: 601, + Start: 658, Length: 3 } }, { - LineNumber: 19, - Start: 604, - End: 605, - EndIncludingLineBreak: 606, + LineNumber: 20, + Start: 661, + End: 662, + EndIncludingLineBreak: 663, Span: { - Start: 604, + Start: 661, Length: 1 }, SpanIncludingLineBreak: { - Start: 604, + Start: 661, Length: 2 } }, { - LineNumber: 20, - Start: 606, - End: 612, - EndIncludingLineBreak: 613, + LineNumber: 21, + Start: 663, + End: 669, + EndIncludingLineBreak: 670, Span: { - Start: 606, + Start: 663, Length: 6 }, SpanIncludingLineBreak: { - Start: 606, + Start: 663, Length: 7 } }, { - LineNumber: 21, - Start: 613, - End: 613, - EndIncludingLineBreak: 613, + LineNumber: 22, + Start: 670, + End: 670, + EndIncludingLineBreak: 670, Span: { - Start: 613 + Start: 670 }, SpanIncludingLineBreak: { - Start: 613 + Start: 670 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt index 0d594925f7..12ea5dc5a4 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/__BuildProperties.g.cs, Encoding: utf-8, - Length: 610, + Length: 667, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -32,14 +32,15 @@ public static class BuildVariableInitializer [global::System.Runtime.CompilerServices.ModuleInitializer] public static void Initialize() { - global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary { + global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) + { {"PublishAot", "true"}, }); } } #endif , - Length: 610, + Length: 667, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -251,97 +252,111 @@ public static class BuildVariableInitializer { LineNumber: 15, Start: 430, - End: 564, - EndIncludingLineBreak: 565, + End: 611, + EndIncludingLineBreak: 612, Span: { Start: 430, - Length: 134 + Length: 181 }, SpanIncludingLineBreak: { Start: 430, - Length: 135 + Length: 182 } }, { LineNumber: 16, - Start: 565, - End: 591, - EndIncludingLineBreak: 592, + Start: 612, + End: 621, + EndIncludingLineBreak: 622, Span: { - Start: 565, + Start: 612, + Length: 9 + }, + SpanIncludingLineBreak: { + Start: 612, + Length: 10 + } + }, + { + LineNumber: 17, + Start: 622, + End: 648, + EndIncludingLineBreak: 649, + Span: { + Start: 622, Length: 26 }, SpanIncludingLineBreak: { - Start: 565, + Start: 622, Length: 27 } }, { - LineNumber: 17, - Start: 592, - End: 597, - EndIncludingLineBreak: 598, + LineNumber: 18, + Start: 649, + End: 654, + EndIncludingLineBreak: 655, Span: { - Start: 592, + Start: 649, Length: 5 }, SpanIncludingLineBreak: { - Start: 592, + Start: 649, Length: 6 } }, { - LineNumber: 18, - Start: 598, - End: 600, - EndIncludingLineBreak: 601, + LineNumber: 19, + Start: 655, + End: 657, + EndIncludingLineBreak: 658, Span: { - Start: 598, + Start: 655, Length: 2 }, SpanIncludingLineBreak: { - Start: 598, + Start: 655, Length: 3 } }, { - LineNumber: 19, - Start: 601, - End: 602, - EndIncludingLineBreak: 603, + LineNumber: 20, + Start: 658, + End: 659, + EndIncludingLineBreak: 660, Span: { - Start: 601, + Start: 658, Length: 1 }, SpanIncludingLineBreak: { - Start: 601, + Start: 658, Length: 2 } }, { - LineNumber: 20, - Start: 603, - End: 609, - EndIncludingLineBreak: 610, + LineNumber: 21, + Start: 660, + End: 666, + EndIncludingLineBreak: 667, Span: { - Start: 603, + Start: 660, Length: 6 }, SpanIncludingLineBreak: { - Start: 603, + Start: 660, Length: 7 } }, { - LineNumber: 21, - Start: 610, - End: 610, - EndIncludingLineBreak: 610, + LineNumber: 22, + Start: 667, + End: 667, + EndIncludingLineBreak: 667, Span: { - Start: 610 + Start: 667 }, SpanIncludingLineBreak: { - Start: 610 + Start: 667 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt index e0c523e78a..8b7753d7ce 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/__BuildProperties.g.cs, Encoding: utf-8, - Length: 611, + Length: 668, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -32,14 +32,15 @@ public static class BuildVariableInitializer [global::System.Runtime.CompilerServices.ModuleInitializer] public static void Initialize() { - global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary { + global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) + { {"PublishAot", "false"}, }); } } #endif , - Length: 611, + Length: 668, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -251,97 +252,111 @@ public static class BuildVariableInitializer { LineNumber: 15, Start: 430, - End: 564, - EndIncludingLineBreak: 565, + End: 611, + EndIncludingLineBreak: 612, Span: { Start: 430, - Length: 134 + Length: 181 }, SpanIncludingLineBreak: { Start: 430, - Length: 135 + Length: 182 } }, { LineNumber: 16, - Start: 565, - End: 592, - EndIncludingLineBreak: 593, + Start: 612, + End: 621, + EndIncludingLineBreak: 622, Span: { - Start: 565, + Start: 612, + Length: 9 + }, + SpanIncludingLineBreak: { + Start: 612, + Length: 10 + } + }, + { + LineNumber: 17, + Start: 622, + End: 649, + EndIncludingLineBreak: 650, + Span: { + Start: 622, Length: 27 }, SpanIncludingLineBreak: { - Start: 565, + Start: 622, Length: 28 } }, { - LineNumber: 17, - Start: 593, - End: 598, - EndIncludingLineBreak: 599, + LineNumber: 18, + Start: 650, + End: 655, + EndIncludingLineBreak: 656, Span: { - Start: 593, + Start: 650, Length: 5 }, SpanIncludingLineBreak: { - Start: 593, + Start: 650, Length: 6 } }, { - LineNumber: 18, - Start: 599, - End: 601, - EndIncludingLineBreak: 602, + LineNumber: 19, + Start: 656, + End: 658, + EndIncludingLineBreak: 659, Span: { - Start: 599, + Start: 656, Length: 2 }, SpanIncludingLineBreak: { - Start: 599, + Start: 656, Length: 3 } }, { - LineNumber: 19, - Start: 602, - End: 603, - EndIncludingLineBreak: 604, + LineNumber: 20, + Start: 659, + End: 660, + EndIncludingLineBreak: 661, Span: { - Start: 602, + Start: 659, Length: 1 }, SpanIncludingLineBreak: { - Start: 602, + Start: 659, Length: 2 } }, { - LineNumber: 20, - Start: 604, - End: 610, - EndIncludingLineBreak: 611, + LineNumber: 21, + Start: 661, + End: 667, + EndIncludingLineBreak: 668, Span: { - Start: 604, + Start: 661, Length: 6 }, SpanIncludingLineBreak: { - Start: 604, + Start: 661, Length: 7 } }, { - LineNumber: 21, - Start: 611, - End: 611, - EndIncludingLineBreak: 611, + LineNumber: 22, + Start: 668, + End: 668, + EndIncludingLineBreak: 668, Span: { - Start: 611 + Start: 668 }, SpanIncludingLineBreak: { - Start: 611 + Start: 668 } } ] From 936f1c0ffdc101a509610619a3c48afbf78ff743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Wed, 9 Jul 2025 16:08:44 +0200 Subject: [PATCH 05/21] ref: change generated namespace --- .../BuildPropertySourceGenerator.cs | 2 +- ...torTests.RunResult_BadStrings.verified.txt | 164 +++++++++--------- ...sts.RunResult_Publish_AotTrue.verified.txt | 164 +++++++++--------- ...eratorTests.RunResult_Success.verified.txt | 164 +++++++++--------- 4 files changed, 247 insertions(+), 247 deletions(-) diff --git a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs index 23b5c10e92..9fab0a0db5 100644 --- a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs +++ b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs @@ -52,7 +52,7 @@ public void Execute(GeneratorExecutionContext context) // #if NET8_0_OR_GREATER -namespace Sentry; +namespace Sentry.Generated; [global::System.Runtime.CompilerServices.CompilerGenerated] public static class BuildVariableInitializer diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt index e8ab836e55..10d407d10b 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/__BuildProperties.g.cs, Encoding: utf-8, - Length: 670, + Length: 680, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -24,7 +24,7 @@ // #if NET8_0_OR_GREATER -namespace Sentry; +namespace Sentry.Generated; [global::System.Runtime.CompilerServices.CompilerGenerated] public static class BuildVariableInitializer @@ -40,7 +40,7 @@ public static class BuildVariableInitializer } #endif , - Length: 670, + Length: 680, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -141,222 +141,222 @@ public static class BuildVariableInitializer { LineNumber: 7, Start: 198, - End: 215, - EndIncludingLineBreak: 216, + End: 225, + EndIncludingLineBreak: 226, Span: { Start: 198, - Length: 17 + Length: 27 }, SpanIncludingLineBreak: { Start: 198, - Length: 18 + Length: 28 } }, { LineNumber: 8, - Start: 216, - End: 216, - EndIncludingLineBreak: 217, + Start: 226, + End: 226, + EndIncludingLineBreak: 227, Span: { - Start: 216 + Start: 226 }, SpanIncludingLineBreak: { - Start: 216, + Start: 226, Length: 1 } }, { LineNumber: 9, - Start: 217, - End: 276, - EndIncludingLineBreak: 277, + Start: 227, + End: 286, + EndIncludingLineBreak: 287, Span: { - Start: 217, + Start: 227, Length: 59 }, SpanIncludingLineBreak: { - Start: 217, + Start: 227, Length: 60 } }, { LineNumber: 10, - Start: 277, - End: 321, - EndIncludingLineBreak: 322, + Start: 287, + End: 331, + EndIncludingLineBreak: 332, Span: { - Start: 277, + Start: 287, Length: 44 }, SpanIncludingLineBreak: { - Start: 277, + Start: 287, Length: 45 } }, { LineNumber: 11, - Start: 322, - End: 323, - EndIncludingLineBreak: 324, + Start: 332, + End: 333, + EndIncludingLineBreak: 334, Span: { - Start: 322, + Start: 332, Length: 1 }, SpanIncludingLineBreak: { - Start: 322, + Start: 332, Length: 2 } }, { LineNumber: 12, - Start: 324, - End: 387, - EndIncludingLineBreak: 388, + Start: 334, + End: 397, + EndIncludingLineBreak: 398, Span: { - Start: 324, + Start: 334, Length: 63 }, SpanIncludingLineBreak: { - Start: 324, + Start: 334, Length: 64 } }, { LineNumber: 13, - Start: 388, - End: 423, - EndIncludingLineBreak: 424, + Start: 398, + End: 433, + EndIncludingLineBreak: 434, Span: { - Start: 388, + Start: 398, Length: 35 }, SpanIncludingLineBreak: { - Start: 388, + Start: 398, Length: 36 } }, { LineNumber: 14, - Start: 424, - End: 429, - EndIncludingLineBreak: 430, + Start: 434, + End: 439, + EndIncludingLineBreak: 440, Span: { - Start: 424, + Start: 434, Length: 5 }, SpanIncludingLineBreak: { - Start: 424, + Start: 434, Length: 6 } }, { LineNumber: 15, - Start: 430, - End: 611, - EndIncludingLineBreak: 612, + Start: 440, + End: 621, + EndIncludingLineBreak: 622, Span: { - Start: 430, + Start: 440, Length: 181 }, SpanIncludingLineBreak: { - Start: 430, + Start: 440, Length: 182 } }, { LineNumber: 16, - Start: 612, - End: 621, - EndIncludingLineBreak: 622, + Start: 622, + End: 631, + EndIncludingLineBreak: 632, Span: { - Start: 612, + Start: 622, Length: 9 }, SpanIncludingLineBreak: { - Start: 612, + Start: 622, Length: 10 } }, { LineNumber: 17, - Start: 622, - End: 651, - EndIncludingLineBreak: 652, + Start: 632, + End: 661, + EndIncludingLineBreak: 662, Span: { - Start: 622, + Start: 632, Length: 29 }, SpanIncludingLineBreak: { - Start: 622, + Start: 632, Length: 30 } }, { LineNumber: 18, - Start: 652, - End: 657, - EndIncludingLineBreak: 658, + Start: 662, + End: 667, + EndIncludingLineBreak: 668, Span: { - Start: 652, + Start: 662, Length: 5 }, SpanIncludingLineBreak: { - Start: 652, + Start: 662, Length: 6 } }, { LineNumber: 19, - Start: 658, - End: 660, - EndIncludingLineBreak: 661, + Start: 668, + End: 670, + EndIncludingLineBreak: 671, Span: { - Start: 658, + Start: 668, Length: 2 }, SpanIncludingLineBreak: { - Start: 658, + Start: 668, Length: 3 } }, { LineNumber: 20, - Start: 661, - End: 662, - EndIncludingLineBreak: 663, + Start: 671, + End: 672, + EndIncludingLineBreak: 673, Span: { - Start: 661, + Start: 671, Length: 1 }, SpanIncludingLineBreak: { - Start: 661, + Start: 671, Length: 2 } }, { LineNumber: 21, - Start: 663, - End: 669, - EndIncludingLineBreak: 670, + Start: 673, + End: 679, + EndIncludingLineBreak: 680, Span: { - Start: 663, + Start: 673, Length: 6 }, SpanIncludingLineBreak: { - Start: 663, + Start: 673, Length: 7 } }, { LineNumber: 22, - Start: 670, - End: 670, - EndIncludingLineBreak: 670, + Start: 680, + End: 680, + EndIncludingLineBreak: 680, Span: { - Start: 670 + Start: 680 }, SpanIncludingLineBreak: { - Start: 670 + Start: 680 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt index 12ea5dc5a4..bd0bdc71ae 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/__BuildProperties.g.cs, Encoding: utf-8, - Length: 667, + Length: 677, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -24,7 +24,7 @@ // #if NET8_0_OR_GREATER -namespace Sentry; +namespace Sentry.Generated; [global::System.Runtime.CompilerServices.CompilerGenerated] public static class BuildVariableInitializer @@ -40,7 +40,7 @@ public static class BuildVariableInitializer } #endif , - Length: 667, + Length: 677, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -141,222 +141,222 @@ public static class BuildVariableInitializer { LineNumber: 7, Start: 198, - End: 215, - EndIncludingLineBreak: 216, + End: 225, + EndIncludingLineBreak: 226, Span: { Start: 198, - Length: 17 + Length: 27 }, SpanIncludingLineBreak: { Start: 198, - Length: 18 + Length: 28 } }, { LineNumber: 8, - Start: 216, - End: 216, - EndIncludingLineBreak: 217, + Start: 226, + End: 226, + EndIncludingLineBreak: 227, Span: { - Start: 216 + Start: 226 }, SpanIncludingLineBreak: { - Start: 216, + Start: 226, Length: 1 } }, { LineNumber: 9, - Start: 217, - End: 276, - EndIncludingLineBreak: 277, + Start: 227, + End: 286, + EndIncludingLineBreak: 287, Span: { - Start: 217, + Start: 227, Length: 59 }, SpanIncludingLineBreak: { - Start: 217, + Start: 227, Length: 60 } }, { LineNumber: 10, - Start: 277, - End: 321, - EndIncludingLineBreak: 322, + Start: 287, + End: 331, + EndIncludingLineBreak: 332, Span: { - Start: 277, + Start: 287, Length: 44 }, SpanIncludingLineBreak: { - Start: 277, + Start: 287, Length: 45 } }, { LineNumber: 11, - Start: 322, - End: 323, - EndIncludingLineBreak: 324, + Start: 332, + End: 333, + EndIncludingLineBreak: 334, Span: { - Start: 322, + Start: 332, Length: 1 }, SpanIncludingLineBreak: { - Start: 322, + Start: 332, Length: 2 } }, { LineNumber: 12, - Start: 324, - End: 387, - EndIncludingLineBreak: 388, + Start: 334, + End: 397, + EndIncludingLineBreak: 398, Span: { - Start: 324, + Start: 334, Length: 63 }, SpanIncludingLineBreak: { - Start: 324, + Start: 334, Length: 64 } }, { LineNumber: 13, - Start: 388, - End: 423, - EndIncludingLineBreak: 424, + Start: 398, + End: 433, + EndIncludingLineBreak: 434, Span: { - Start: 388, + Start: 398, Length: 35 }, SpanIncludingLineBreak: { - Start: 388, + Start: 398, Length: 36 } }, { LineNumber: 14, - Start: 424, - End: 429, - EndIncludingLineBreak: 430, + Start: 434, + End: 439, + EndIncludingLineBreak: 440, Span: { - Start: 424, + Start: 434, Length: 5 }, SpanIncludingLineBreak: { - Start: 424, + Start: 434, Length: 6 } }, { LineNumber: 15, - Start: 430, - End: 611, - EndIncludingLineBreak: 612, + Start: 440, + End: 621, + EndIncludingLineBreak: 622, Span: { - Start: 430, + Start: 440, Length: 181 }, SpanIncludingLineBreak: { - Start: 430, + Start: 440, Length: 182 } }, { LineNumber: 16, - Start: 612, - End: 621, - EndIncludingLineBreak: 622, + Start: 622, + End: 631, + EndIncludingLineBreak: 632, Span: { - Start: 612, + Start: 622, Length: 9 }, SpanIncludingLineBreak: { - Start: 612, + Start: 622, Length: 10 } }, { LineNumber: 17, - Start: 622, - End: 648, - EndIncludingLineBreak: 649, + Start: 632, + End: 658, + EndIncludingLineBreak: 659, Span: { - Start: 622, + Start: 632, Length: 26 }, SpanIncludingLineBreak: { - Start: 622, + Start: 632, Length: 27 } }, { LineNumber: 18, - Start: 649, - End: 654, - EndIncludingLineBreak: 655, + Start: 659, + End: 664, + EndIncludingLineBreak: 665, Span: { - Start: 649, + Start: 659, Length: 5 }, SpanIncludingLineBreak: { - Start: 649, + Start: 659, Length: 6 } }, { LineNumber: 19, - Start: 655, - End: 657, - EndIncludingLineBreak: 658, + Start: 665, + End: 667, + EndIncludingLineBreak: 668, Span: { - Start: 655, + Start: 665, Length: 2 }, SpanIncludingLineBreak: { - Start: 655, + Start: 665, Length: 3 } }, { LineNumber: 20, - Start: 658, - End: 659, - EndIncludingLineBreak: 660, + Start: 668, + End: 669, + EndIncludingLineBreak: 670, Span: { - Start: 658, + Start: 668, Length: 1 }, SpanIncludingLineBreak: { - Start: 658, + Start: 668, Length: 2 } }, { LineNumber: 21, - Start: 660, - End: 666, - EndIncludingLineBreak: 667, + Start: 670, + End: 676, + EndIncludingLineBreak: 677, Span: { - Start: 660, + Start: 670, Length: 6 }, SpanIncludingLineBreak: { - Start: 660, + Start: 670, Length: 7 } }, { LineNumber: 22, - Start: 667, - End: 667, - EndIncludingLineBreak: 667, + Start: 677, + End: 677, + EndIncludingLineBreak: 677, Span: { - Start: 667 + Start: 677 }, SpanIncludingLineBreak: { - Start: 667 + Start: 677 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt index 8b7753d7ce..fd22f5e889 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/__BuildProperties.g.cs, Encoding: utf-8, - Length: 668, + Length: 678, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -24,7 +24,7 @@ // #if NET8_0_OR_GREATER -namespace Sentry; +namespace Sentry.Generated; [global::System.Runtime.CompilerServices.CompilerGenerated] public static class BuildVariableInitializer @@ -40,7 +40,7 @@ public static class BuildVariableInitializer } #endif , - Length: 668, + Length: 678, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -141,222 +141,222 @@ public static class BuildVariableInitializer { LineNumber: 7, Start: 198, - End: 215, - EndIncludingLineBreak: 216, + End: 225, + EndIncludingLineBreak: 226, Span: { Start: 198, - Length: 17 + Length: 27 }, SpanIncludingLineBreak: { Start: 198, - Length: 18 + Length: 28 } }, { LineNumber: 8, - Start: 216, - End: 216, - EndIncludingLineBreak: 217, + Start: 226, + End: 226, + EndIncludingLineBreak: 227, Span: { - Start: 216 + Start: 226 }, SpanIncludingLineBreak: { - Start: 216, + Start: 226, Length: 1 } }, { LineNumber: 9, - Start: 217, - End: 276, - EndIncludingLineBreak: 277, + Start: 227, + End: 286, + EndIncludingLineBreak: 287, Span: { - Start: 217, + Start: 227, Length: 59 }, SpanIncludingLineBreak: { - Start: 217, + Start: 227, Length: 60 } }, { LineNumber: 10, - Start: 277, - End: 321, - EndIncludingLineBreak: 322, + Start: 287, + End: 331, + EndIncludingLineBreak: 332, Span: { - Start: 277, + Start: 287, Length: 44 }, SpanIncludingLineBreak: { - Start: 277, + Start: 287, Length: 45 } }, { LineNumber: 11, - Start: 322, - End: 323, - EndIncludingLineBreak: 324, + Start: 332, + End: 333, + EndIncludingLineBreak: 334, Span: { - Start: 322, + Start: 332, Length: 1 }, SpanIncludingLineBreak: { - Start: 322, + Start: 332, Length: 2 } }, { LineNumber: 12, - Start: 324, - End: 387, - EndIncludingLineBreak: 388, + Start: 334, + End: 397, + EndIncludingLineBreak: 398, Span: { - Start: 324, + Start: 334, Length: 63 }, SpanIncludingLineBreak: { - Start: 324, + Start: 334, Length: 64 } }, { LineNumber: 13, - Start: 388, - End: 423, - EndIncludingLineBreak: 424, + Start: 398, + End: 433, + EndIncludingLineBreak: 434, Span: { - Start: 388, + Start: 398, Length: 35 }, SpanIncludingLineBreak: { - Start: 388, + Start: 398, Length: 36 } }, { LineNumber: 14, - Start: 424, - End: 429, - EndIncludingLineBreak: 430, + Start: 434, + End: 439, + EndIncludingLineBreak: 440, Span: { - Start: 424, + Start: 434, Length: 5 }, SpanIncludingLineBreak: { - Start: 424, + Start: 434, Length: 6 } }, { LineNumber: 15, - Start: 430, - End: 611, - EndIncludingLineBreak: 612, + Start: 440, + End: 621, + EndIncludingLineBreak: 622, Span: { - Start: 430, + Start: 440, Length: 181 }, SpanIncludingLineBreak: { - Start: 430, + Start: 440, Length: 182 } }, { LineNumber: 16, - Start: 612, - End: 621, - EndIncludingLineBreak: 622, + Start: 622, + End: 631, + EndIncludingLineBreak: 632, Span: { - Start: 612, + Start: 622, Length: 9 }, SpanIncludingLineBreak: { - Start: 612, + Start: 622, Length: 10 } }, { LineNumber: 17, - Start: 622, - End: 649, - EndIncludingLineBreak: 650, + Start: 632, + End: 659, + EndIncludingLineBreak: 660, Span: { - Start: 622, + Start: 632, Length: 27 }, SpanIncludingLineBreak: { - Start: 622, + Start: 632, Length: 28 } }, { LineNumber: 18, - Start: 650, - End: 655, - EndIncludingLineBreak: 656, + Start: 660, + End: 665, + EndIncludingLineBreak: 666, Span: { - Start: 650, + Start: 660, Length: 5 }, SpanIncludingLineBreak: { - Start: 650, + Start: 660, Length: 6 } }, { LineNumber: 19, - Start: 656, - End: 658, - EndIncludingLineBreak: 659, + Start: 666, + End: 668, + EndIncludingLineBreak: 669, Span: { - Start: 656, + Start: 666, Length: 2 }, SpanIncludingLineBreak: { - Start: 656, + Start: 666, Length: 3 } }, { LineNumber: 20, - Start: 659, - End: 660, - EndIncludingLineBreak: 661, + Start: 669, + End: 670, + EndIncludingLineBreak: 671, Span: { - Start: 659, + Start: 669, Length: 1 }, SpanIncludingLineBreak: { - Start: 659, + Start: 669, Length: 2 } }, { LineNumber: 21, - Start: 661, - End: 667, - EndIncludingLineBreak: 668, + Start: 671, + End: 677, + EndIncludingLineBreak: 678, Span: { - Start: 661, + Start: 671, Length: 6 }, SpanIncludingLineBreak: { - Start: 661, + Start: 671, Length: 7 } }, { LineNumber: 22, - Start: 668, - End: 668, - EndIncludingLineBreak: 668, + Start: 678, + End: 678, + EndIncludingLineBreak: 678, Span: { - Start: 668 + Start: 678 }, SpanIncludingLineBreak: { - Start: 668 + Start: 678 } } ] From 9a900704347cc11eb576d2440f01388fb7db9fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Wed, 9 Jul 2025 16:12:22 +0200 Subject: [PATCH 06/21] ref: rename generated type --- src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs | 2 +- ...opertySourceGeneratorTests.RunResult_BadStrings.verified.txt | 2 +- ...ySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt | 2 +- ...dPropertySourceGeneratorTests.RunResult_Success.verified.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs index 9fab0a0db5..cd49fe3391 100644 --- a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs +++ b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs @@ -55,7 +55,7 @@ public void Execute(GeneratorExecutionContext context) namespace Sentry.Generated; [global::System.Runtime.CompilerServices.CompilerGenerated] -public static class BuildVariableInitializer +public static class BuildPropertyInitializer { [global::System.Runtime.CompilerServices.ModuleInitializer] public static void Initialize() diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt index 10d407d10b..b278ff9019 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt @@ -27,7 +27,7 @@ namespace Sentry.Generated; [global::System.Runtime.CompilerServices.CompilerGenerated] -public static class BuildVariableInitializer +public static class BuildPropertyInitializer { [global::System.Runtime.CompilerServices.ModuleInitializer] public static void Initialize() diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt index bd0bdc71ae..a16cb36d9a 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt @@ -27,7 +27,7 @@ namespace Sentry.Generated; [global::System.Runtime.CompilerServices.CompilerGenerated] -public static class BuildVariableInitializer +public static class BuildPropertyInitializer { [global::System.Runtime.CompilerServices.ModuleInitializer] public static void Initialize() diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt index fd22f5e889..475f243b7f 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt @@ -27,7 +27,7 @@ namespace Sentry.Generated; [global::System.Runtime.CompilerServices.CompilerGenerated] -public static class BuildVariableInitializer +public static class BuildPropertyInitializer { [global::System.Runtime.CompilerServices.ModuleInitializer] public static void Initialize() From 72b4c1caa2e03ead2a24badc3861cc3ff77cf821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Wed, 9 Jul 2025 16:17:58 +0200 Subject: [PATCH 07/21] ref: rename HintName --- .../BuildPropertySourceGenerator.cs | 2 +- ...eGeneratorTests.RunResult_BadStrings.verified.txt | 4 ++-- ...ratorTests.RunResult_Publish_AotTrue.verified.txt | 4 ++-- ...urceGeneratorTests.RunResult_Success.verified.txt | 4 ++-- .../BuildPropertySourceGeneratorTests.cs | 12 +++++++----- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs index cd49fe3391..fc7d8601f6 100644 --- a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs +++ b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs @@ -85,7 +85,7 @@ public static void Initialize() .AppendLine("}") .AppendLine("#endif"); - context.AddSource("__BuildProperties.g.cs", sb.ToString()); + context.AddSource("Sentry.Generated.BuildPropertyInitializer.g.cs", sb.ToString()); } private static string EscapeString(string value) => value.Replace("\\", "\\\\"); diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt index b278ff9019..8c6668beea 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt @@ -3,7 +3,7 @@ GeneratedSources: [ { SyntaxTree: { - FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/__BuildProperties.g.cs, + FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, Length: 680, HasCompilationUnitRoot: true, @@ -361,7 +361,7 @@ public static class BuildPropertyInitializer } ] }, - HintName: __BuildProperties.g.cs + HintName: Sentry.Generated.BuildPropertyInitializer.g.cs } ], Diagnostics: null diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt index a16cb36d9a..efa6104578 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt @@ -3,7 +3,7 @@ GeneratedSources: [ { SyntaxTree: { - FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/__BuildProperties.g.cs, + FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, Length: 677, HasCompilationUnitRoot: true, @@ -361,7 +361,7 @@ public static class BuildPropertyInitializer } ] }, - HintName: __BuildProperties.g.cs + HintName: Sentry.Generated.BuildPropertyInitializer.g.cs } ], Diagnostics: null diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt index 475f243b7f..225f86725d 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt @@ -3,7 +3,7 @@ GeneratedSources: [ { SyntaxTree: { - FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/__BuildProperties.g.cs, + FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, Length: 678, HasCompilationUnitRoot: true, @@ -361,7 +361,7 @@ public static class BuildPropertyInitializer } ] }, - HintName: __BuildProperties.g.cs + HintName: Sentry.Generated.BuildPropertyInitializer.g.cs } ], Diagnostics: null diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.cs b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.cs index 127effd98b..89775ffc5c 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.cs +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.cs @@ -7,6 +7,8 @@ namespace Sentry.SourceGenerators.Tests; public class BuildPropertySourceGeneratorTests { + private static readonly string s_hintName = "Sentry.Generated.BuildPropertyInitializer.g.cs"; + [SkippableFact] public Task RunResult_Success() { @@ -16,7 +18,7 @@ public Task RunResult_Success() var result = driver.GetRunResult().Results.FirstOrDefault(); result.Exception.Should().BeNull(); result.GeneratedSources.Length.Should().Be(1); - result.GeneratedSources.First().HintName.Should().Be("__BuildProperties.g.cs"); + result.GeneratedSources.First().HintName.Should().Be(s_hintName); return Verify(result); } @@ -30,7 +32,7 @@ public Task RunResult_BadStrings() var result = driver.GetRunResult().Results.FirstOrDefault(); result.Exception.Should().BeNull(); result.GeneratedSources.Length.Should().Be(1); - result.GeneratedSources.First().HintName.Should().Be("__BuildProperties.g.cs"); + result.GeneratedSources.First().HintName.Should().Be(s_hintName); return Verify(result); } @@ -43,7 +45,7 @@ public Task RunResult_Publish_AotTrue() var result = driver.GetRunResult().Results.FirstOrDefault(); result.Exception.Should().BeNull(); result.GeneratedSources.Length.Should().Be(1); - result.GeneratedSources.First().HintName.Should().Be("__BuildProperties.g.cs"); + result.GeneratedSources.First().HintName.Should().Be(s_hintName); return Verify(result); } @@ -74,7 +76,7 @@ public void RunResult_OutputType_Values(OutputKind outputKind, bool sourceGenExp var result = driver.GetRunResult().Results.FirstOrDefault(); result.Exception.Should().BeNull(); - var generated = result.GeneratedSources.Any(x => x.HintName.Equals("__BuildProperties.g.cs")); + var generated = result.GeneratedSources.Any(x => x.HintName.Equals(s_hintName)); generated.Should().Be(sourceGenExpected); } @@ -90,7 +92,7 @@ public void RunResult_SentryDisableSourceGenerator_Values(string value, bool sou var result = driver.GetRunResult().Results.FirstOrDefault(); result.Exception.Should().BeNull(); - var generated = result.GeneratedSources.Any(x => x.HintName.Equals("__BuildProperties.g.cs")); + var generated = result.GeneratedSources.Any(x => x.HintName.Equals(s_hintName)); generated.Should().Be(sourceGenExpected); } From ab6fa45ef71f463e8224f1aa187a1f60d2cd00f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Wed, 9 Jul 2025 16:29:50 +0200 Subject: [PATCH 08/21] fix: inconsistent tabs vs spaces --- .../BuildPropertySourceGenerator.cs | 8 +- ...torTests.RunResult_BadStrings.verified.txt | 76 +++++++++---------- ...sts.RunResult_Publish_AotTrue.verified.txt | 76 +++++++++---------- ...eratorTests.RunResult_Success.verified.txt | 76 +++++++++---------- 4 files changed, 119 insertions(+), 117 deletions(-) diff --git a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs index fc7d8601f6..459141215c 100644 --- a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs +++ b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs @@ -22,6 +22,8 @@ public void Initialize(GeneratorInitializationContext context) /// public void Execute(GeneratorExecutionContext context) { + const string tabString = " "; + var opts = context.AnalyzerConfigOptions.GlobalOptions; var properties = opts.Keys.Where(x => x.StartsWith("build_property.")).ToList(); if (properties.Count == 0) @@ -73,15 +75,15 @@ public static void Initialize() var pn = EscapeString(property.Replace("build_property.", "")); var ev = EscapeString(value); sb - .Append("\t\t\t{") + .Append($"{tabString}{tabString}{tabString}{{") .Append($"\"{pn}\", \"{ev}\"") .AppendLine("},"); } } sb - .AppendLine("\t\t});") // close dictionary - .AppendLine("\t}") + .AppendLine($"{tabString}{tabString}}});") // close dictionary + .AppendLine($"{tabString}}}") .AppendLine("}") .AppendLine("#endif"); diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt index 8c6668beea..29c8283953 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, - Length: 680, + Length: 698, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -34,13 +34,13 @@ public static class BuildPropertyInitializer { global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) { - {"My\\Key", "test\\test"}, - }); - } + {"My\\Key", "test\\test"}, + }); + } } #endif , - Length: 680, + Length: 698, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -280,83 +280,83 @@ public static class BuildPropertyInitializer { LineNumber: 17, Start: 632, - End: 661, - EndIncludingLineBreak: 662, + End: 670, + EndIncludingLineBreak: 671, Span: { Start: 632, - Length: 29 + Length: 38 }, SpanIncludingLineBreak: { Start: 632, - Length: 30 + Length: 39 } }, { LineNumber: 18, - Start: 662, - End: 667, - EndIncludingLineBreak: 668, + Start: 671, + End: 682, + EndIncludingLineBreak: 683, Span: { - Start: 662, - Length: 5 + Start: 671, + Length: 11 }, SpanIncludingLineBreak: { - Start: 662, - Length: 6 + Start: 671, + Length: 12 } }, { LineNumber: 19, - Start: 668, - End: 670, - EndIncludingLineBreak: 671, + Start: 683, + End: 688, + EndIncludingLineBreak: 689, Span: { - Start: 668, - Length: 2 + Start: 683, + Length: 5 }, SpanIncludingLineBreak: { - Start: 668, - Length: 3 + Start: 683, + Length: 6 } }, { LineNumber: 20, - Start: 671, - End: 672, - EndIncludingLineBreak: 673, + Start: 689, + End: 690, + EndIncludingLineBreak: 691, Span: { - Start: 671, + Start: 689, Length: 1 }, SpanIncludingLineBreak: { - Start: 671, + Start: 689, Length: 2 } }, { LineNumber: 21, - Start: 673, - End: 679, - EndIncludingLineBreak: 680, + Start: 691, + End: 697, + EndIncludingLineBreak: 698, Span: { - Start: 673, + Start: 691, Length: 6 }, SpanIncludingLineBreak: { - Start: 673, + Start: 691, Length: 7 } }, { LineNumber: 22, - Start: 680, - End: 680, - EndIncludingLineBreak: 680, + Start: 698, + End: 698, + EndIncludingLineBreak: 698, Span: { - Start: 680 + Start: 698 }, SpanIncludingLineBreak: { - Start: 680 + Start: 698 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt index efa6104578..4809a8d1a6 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, - Length: 677, + Length: 695, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -34,13 +34,13 @@ public static class BuildPropertyInitializer { global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) { - {"PublishAot", "true"}, - }); - } + {"PublishAot", "true"}, + }); + } } #endif , - Length: 677, + Length: 695, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -280,83 +280,83 @@ public static class BuildPropertyInitializer { LineNumber: 17, Start: 632, - End: 658, - EndIncludingLineBreak: 659, + End: 667, + EndIncludingLineBreak: 668, Span: { Start: 632, - Length: 26 + Length: 35 }, SpanIncludingLineBreak: { Start: 632, - Length: 27 + Length: 36 } }, { LineNumber: 18, - Start: 659, - End: 664, - EndIncludingLineBreak: 665, + Start: 668, + End: 679, + EndIncludingLineBreak: 680, Span: { - Start: 659, - Length: 5 + Start: 668, + Length: 11 }, SpanIncludingLineBreak: { - Start: 659, - Length: 6 + Start: 668, + Length: 12 } }, { LineNumber: 19, - Start: 665, - End: 667, - EndIncludingLineBreak: 668, + Start: 680, + End: 685, + EndIncludingLineBreak: 686, Span: { - Start: 665, - Length: 2 + Start: 680, + Length: 5 }, SpanIncludingLineBreak: { - Start: 665, - Length: 3 + Start: 680, + Length: 6 } }, { LineNumber: 20, - Start: 668, - End: 669, - EndIncludingLineBreak: 670, + Start: 686, + End: 687, + EndIncludingLineBreak: 688, Span: { - Start: 668, + Start: 686, Length: 1 }, SpanIncludingLineBreak: { - Start: 668, + Start: 686, Length: 2 } }, { LineNumber: 21, - Start: 670, - End: 676, - EndIncludingLineBreak: 677, + Start: 688, + End: 694, + EndIncludingLineBreak: 695, Span: { - Start: 670, + Start: 688, Length: 6 }, SpanIncludingLineBreak: { - Start: 670, + Start: 688, Length: 7 } }, { LineNumber: 22, - Start: 677, - End: 677, - EndIncludingLineBreak: 677, + Start: 695, + End: 695, + EndIncludingLineBreak: 695, Span: { - Start: 677 + Start: 695 }, SpanIncludingLineBreak: { - Start: 677 + Start: 695 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt index 225f86725d..56e34659bd 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, - Length: 678, + Length: 696, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -34,13 +34,13 @@ public static class BuildPropertyInitializer { global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) { - {"PublishAot", "false"}, - }); - } + {"PublishAot", "false"}, + }); + } } #endif , - Length: 678, + Length: 696, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -280,83 +280,83 @@ public static class BuildPropertyInitializer { LineNumber: 17, Start: 632, - End: 659, - EndIncludingLineBreak: 660, + End: 668, + EndIncludingLineBreak: 669, Span: { Start: 632, - Length: 27 + Length: 36 }, SpanIncludingLineBreak: { Start: 632, - Length: 28 + Length: 37 } }, { LineNumber: 18, - Start: 660, - End: 665, - EndIncludingLineBreak: 666, + Start: 669, + End: 680, + EndIncludingLineBreak: 681, Span: { - Start: 660, - Length: 5 + Start: 669, + Length: 11 }, SpanIncludingLineBreak: { - Start: 660, - Length: 6 + Start: 669, + Length: 12 } }, { LineNumber: 19, - Start: 666, - End: 668, - EndIncludingLineBreak: 669, + Start: 681, + End: 686, + EndIncludingLineBreak: 687, Span: { - Start: 666, - Length: 2 + Start: 681, + Length: 5 }, SpanIncludingLineBreak: { - Start: 666, - Length: 3 + Start: 681, + Length: 6 } }, { LineNumber: 20, - Start: 669, - End: 670, - EndIncludingLineBreak: 671, + Start: 687, + End: 688, + EndIncludingLineBreak: 689, Span: { - Start: 669, + Start: 687, Length: 1 }, SpanIncludingLineBreak: { - Start: 669, + Start: 687, Length: 2 } }, { LineNumber: 21, - Start: 671, - End: 677, - EndIncludingLineBreak: 678, + Start: 689, + End: 695, + EndIncludingLineBreak: 696, Span: { - Start: 671, + Start: 689, Length: 6 }, SpanIncludingLineBreak: { - Start: 671, + Start: 689, Length: 7 } }, { LineNumber: 22, - Start: 678, - End: 678, - EndIncludingLineBreak: 678, + Start: 696, + End: 696, + EndIncludingLineBreak: 696, Span: { - Start: 678 + Start: 696 }, SpanIncludingLineBreak: { - Start: 678 + Start: 696 } } ] From 8b4ccf803f55d74e4d7dbaa06f058fa04c5db9c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Wed, 9 Jul 2025 16:31:16 +0200 Subject: [PATCH 09/21] ref: remove file-scoped namespace declaration --- .../BuildPropertySourceGenerator.cs | 19 +- ...torTests.RunResult_BadStrings.verified.txt | 234 ++++++++++-------- ...sts.RunResult_Publish_AotTrue.verified.txt | 234 ++++++++++-------- ...eratorTests.RunResult_Success.verified.txt | 234 ++++++++++-------- 4 files changed, 385 insertions(+), 336 deletions(-) diff --git a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs index 459141215c..b82542489f 100644 --- a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs +++ b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs @@ -54,16 +54,16 @@ public void Execute(GeneratorExecutionContext context) // #if NET8_0_OR_GREATER -namespace Sentry.Generated; - -[global::System.Runtime.CompilerServices.CompilerGenerated] -public static class BuildPropertyInitializer +namespace Sentry.Generated { - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + [global::System.Runtime.CompilerServices.CompilerGenerated] + public static class BuildPropertyInitializer { - global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialize() { + global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) + { """ ); @@ -75,14 +75,15 @@ public static void Initialize() var pn = EscapeString(property.Replace("build_property.", "")); var ev = EscapeString(value); sb - .Append($"{tabString}{tabString}{tabString}{{") + .Append($"{tabString}{tabString}{tabString}{tabString}{{") .Append($"\"{pn}\", \"{ev}\"") .AppendLine("},"); } } sb - .AppendLine($"{tabString}{tabString}}});") // close dictionary + .AppendLine($"{tabString}{tabString}{tabString}}});") // close dictionary + .AppendLine($"{tabString}{tabString}}}") .AppendLine($"{tabString}}}") .AppendLine("}") .AppendLine("#endif"); diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt index 29c8283953..25052e7098 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, - Length: 698, + Length: 748, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -24,23 +24,24 @@ // #if NET8_0_OR_GREATER -namespace Sentry.Generated; - -[global::System.Runtime.CompilerServices.CompilerGenerated] -public static class BuildPropertyInitializer +namespace Sentry.Generated { - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + [global::System.Runtime.CompilerServices.CompilerGenerated] + public static class BuildPropertyInitializer { - global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialize() { - {"My\\Key", "test\\test"}, - }); + global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) + { + {"My\\Key", "test\\test"}, + }); + } } } #endif , - Length: 698, + Length: 748, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -141,222 +142,237 @@ public static class BuildPropertyInitializer { LineNumber: 7, Start: 198, - End: 225, - EndIncludingLineBreak: 226, + End: 224, + EndIncludingLineBreak: 225, Span: { Start: 198, - Length: 27 + Length: 26 }, SpanIncludingLineBreak: { Start: 198, - Length: 28 + Length: 27 } }, { LineNumber: 8, - Start: 226, + Start: 225, End: 226, EndIncludingLineBreak: 227, Span: { - Start: 226 + Start: 225, + Length: 1 }, SpanIncludingLineBreak: { - Start: 226, - Length: 1 + Start: 225, + Length: 2 } }, { LineNumber: 9, Start: 227, - End: 286, - EndIncludingLineBreak: 287, + End: 290, + EndIncludingLineBreak: 291, Span: { Start: 227, - Length: 59 + Length: 63 }, SpanIncludingLineBreak: { Start: 227, - Length: 60 + Length: 64 } }, { LineNumber: 10, - Start: 287, - End: 331, - EndIncludingLineBreak: 332, + Start: 291, + End: 339, + EndIncludingLineBreak: 340, Span: { - Start: 287, - Length: 44 + Start: 291, + Length: 48 }, SpanIncludingLineBreak: { - Start: 287, - Length: 45 + Start: 291, + Length: 49 } }, { LineNumber: 11, - Start: 332, - End: 333, - EndIncludingLineBreak: 334, + Start: 340, + End: 345, + EndIncludingLineBreak: 346, Span: { - Start: 332, - Length: 1 + Start: 340, + Length: 5 }, SpanIncludingLineBreak: { - Start: 332, - Length: 2 + Start: 340, + Length: 6 } }, { LineNumber: 12, - Start: 334, - End: 397, - EndIncludingLineBreak: 398, + Start: 346, + End: 413, + EndIncludingLineBreak: 414, Span: { - Start: 334, - Length: 63 + Start: 346, + Length: 67 }, SpanIncludingLineBreak: { - Start: 334, - Length: 64 + Start: 346, + Length: 68 } }, { LineNumber: 13, - Start: 398, - End: 433, - EndIncludingLineBreak: 434, + Start: 414, + End: 453, + EndIncludingLineBreak: 454, Span: { - Start: 398, - Length: 35 + Start: 414, + Length: 39 }, SpanIncludingLineBreak: { - Start: 398, - Length: 36 + Start: 414, + Length: 40 } }, { LineNumber: 14, - Start: 434, - End: 439, - EndIncludingLineBreak: 440, + Start: 454, + End: 463, + EndIncludingLineBreak: 464, Span: { - Start: 434, - Length: 5 + Start: 454, + Length: 9 }, SpanIncludingLineBreak: { - Start: 434, - Length: 6 + Start: 454, + Length: 10 } }, { LineNumber: 15, - Start: 440, - End: 621, - EndIncludingLineBreak: 622, + Start: 464, + End: 649, + EndIncludingLineBreak: 650, Span: { - Start: 440, - Length: 181 + Start: 464, + Length: 185 }, SpanIncludingLineBreak: { - Start: 440, - Length: 182 + Start: 464, + Length: 186 } }, { LineNumber: 16, - Start: 622, - End: 631, - EndIncludingLineBreak: 632, + Start: 650, + End: 663, + EndIncludingLineBreak: 664, Span: { - Start: 622, - Length: 9 + Start: 650, + Length: 13 }, SpanIncludingLineBreak: { - Start: 622, - Length: 10 + Start: 650, + Length: 14 } }, { LineNumber: 17, - Start: 632, - End: 670, - EndIncludingLineBreak: 671, + Start: 664, + End: 706, + EndIncludingLineBreak: 707, Span: { - Start: 632, - Length: 38 + Start: 664, + Length: 42 }, SpanIncludingLineBreak: { - Start: 632, - Length: 39 + Start: 664, + Length: 43 } }, { LineNumber: 18, - Start: 671, - End: 682, - EndIncludingLineBreak: 683, + Start: 707, + End: 722, + EndIncludingLineBreak: 723, Span: { - Start: 671, - Length: 11 + Start: 707, + Length: 15 }, SpanIncludingLineBreak: { - Start: 671, - Length: 12 + Start: 707, + Length: 16 } }, { LineNumber: 19, - Start: 683, - End: 688, - EndIncludingLineBreak: 689, + Start: 723, + End: 732, + EndIncludingLineBreak: 733, + Span: { + Start: 723, + Length: 9 + }, + SpanIncludingLineBreak: { + Start: 723, + Length: 10 + } + }, + { + LineNumber: 20, + Start: 733, + End: 738, + EndIncludingLineBreak: 739, Span: { - Start: 683, + Start: 733, Length: 5 }, SpanIncludingLineBreak: { - Start: 683, + Start: 733, Length: 6 } }, { - LineNumber: 20, - Start: 689, - End: 690, - EndIncludingLineBreak: 691, + LineNumber: 21, + Start: 739, + End: 740, + EndIncludingLineBreak: 741, Span: { - Start: 689, + Start: 739, Length: 1 }, SpanIncludingLineBreak: { - Start: 689, + Start: 739, Length: 2 } }, { - LineNumber: 21, - Start: 691, - End: 697, - EndIncludingLineBreak: 698, + LineNumber: 22, + Start: 741, + End: 747, + EndIncludingLineBreak: 748, Span: { - Start: 691, + Start: 741, Length: 6 }, SpanIncludingLineBreak: { - Start: 691, + Start: 741, Length: 7 } }, { - LineNumber: 22, - Start: 698, - End: 698, - EndIncludingLineBreak: 698, + LineNumber: 23, + Start: 748, + End: 748, + EndIncludingLineBreak: 748, Span: { - Start: 698 + Start: 748 }, SpanIncludingLineBreak: { - Start: 698 + Start: 748 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt index 4809a8d1a6..656c8fcd0a 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, - Length: 695, + Length: 745, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -24,23 +24,24 @@ // #if NET8_0_OR_GREATER -namespace Sentry.Generated; - -[global::System.Runtime.CompilerServices.CompilerGenerated] -public static class BuildPropertyInitializer +namespace Sentry.Generated { - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + [global::System.Runtime.CompilerServices.CompilerGenerated] + public static class BuildPropertyInitializer { - global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialize() { - {"PublishAot", "true"}, - }); + global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) + { + {"PublishAot", "true"}, + }); + } } } #endif , - Length: 695, + Length: 745, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -141,222 +142,237 @@ public static class BuildPropertyInitializer { LineNumber: 7, Start: 198, - End: 225, - EndIncludingLineBreak: 226, + End: 224, + EndIncludingLineBreak: 225, Span: { Start: 198, - Length: 27 + Length: 26 }, SpanIncludingLineBreak: { Start: 198, - Length: 28 + Length: 27 } }, { LineNumber: 8, - Start: 226, + Start: 225, End: 226, EndIncludingLineBreak: 227, Span: { - Start: 226 + Start: 225, + Length: 1 }, SpanIncludingLineBreak: { - Start: 226, - Length: 1 + Start: 225, + Length: 2 } }, { LineNumber: 9, Start: 227, - End: 286, - EndIncludingLineBreak: 287, + End: 290, + EndIncludingLineBreak: 291, Span: { Start: 227, - Length: 59 + Length: 63 }, SpanIncludingLineBreak: { Start: 227, - Length: 60 + Length: 64 } }, { LineNumber: 10, - Start: 287, - End: 331, - EndIncludingLineBreak: 332, + Start: 291, + End: 339, + EndIncludingLineBreak: 340, Span: { - Start: 287, - Length: 44 + Start: 291, + Length: 48 }, SpanIncludingLineBreak: { - Start: 287, - Length: 45 + Start: 291, + Length: 49 } }, { LineNumber: 11, - Start: 332, - End: 333, - EndIncludingLineBreak: 334, + Start: 340, + End: 345, + EndIncludingLineBreak: 346, Span: { - Start: 332, - Length: 1 + Start: 340, + Length: 5 }, SpanIncludingLineBreak: { - Start: 332, - Length: 2 + Start: 340, + Length: 6 } }, { LineNumber: 12, - Start: 334, - End: 397, - EndIncludingLineBreak: 398, + Start: 346, + End: 413, + EndIncludingLineBreak: 414, Span: { - Start: 334, - Length: 63 + Start: 346, + Length: 67 }, SpanIncludingLineBreak: { - Start: 334, - Length: 64 + Start: 346, + Length: 68 } }, { LineNumber: 13, - Start: 398, - End: 433, - EndIncludingLineBreak: 434, + Start: 414, + End: 453, + EndIncludingLineBreak: 454, Span: { - Start: 398, - Length: 35 + Start: 414, + Length: 39 }, SpanIncludingLineBreak: { - Start: 398, - Length: 36 + Start: 414, + Length: 40 } }, { LineNumber: 14, - Start: 434, - End: 439, - EndIncludingLineBreak: 440, + Start: 454, + End: 463, + EndIncludingLineBreak: 464, Span: { - Start: 434, - Length: 5 + Start: 454, + Length: 9 }, SpanIncludingLineBreak: { - Start: 434, - Length: 6 + Start: 454, + Length: 10 } }, { LineNumber: 15, - Start: 440, - End: 621, - EndIncludingLineBreak: 622, + Start: 464, + End: 649, + EndIncludingLineBreak: 650, Span: { - Start: 440, - Length: 181 + Start: 464, + Length: 185 }, SpanIncludingLineBreak: { - Start: 440, - Length: 182 + Start: 464, + Length: 186 } }, { LineNumber: 16, - Start: 622, - End: 631, - EndIncludingLineBreak: 632, + Start: 650, + End: 663, + EndIncludingLineBreak: 664, Span: { - Start: 622, - Length: 9 + Start: 650, + Length: 13 }, SpanIncludingLineBreak: { - Start: 622, - Length: 10 + Start: 650, + Length: 14 } }, { LineNumber: 17, - Start: 632, - End: 667, - EndIncludingLineBreak: 668, + Start: 664, + End: 703, + EndIncludingLineBreak: 704, Span: { - Start: 632, - Length: 35 + Start: 664, + Length: 39 }, SpanIncludingLineBreak: { - Start: 632, - Length: 36 + Start: 664, + Length: 40 } }, { LineNumber: 18, - Start: 668, - End: 679, - EndIncludingLineBreak: 680, + Start: 704, + End: 719, + EndIncludingLineBreak: 720, Span: { - Start: 668, - Length: 11 + Start: 704, + Length: 15 }, SpanIncludingLineBreak: { - Start: 668, - Length: 12 + Start: 704, + Length: 16 } }, { LineNumber: 19, - Start: 680, - End: 685, - EndIncludingLineBreak: 686, + Start: 720, + End: 729, + EndIncludingLineBreak: 730, Span: { - Start: 680, + Start: 720, + Length: 9 + }, + SpanIncludingLineBreak: { + Start: 720, + Length: 10 + } + }, + { + LineNumber: 20, + Start: 730, + End: 735, + EndIncludingLineBreak: 736, + Span: { + Start: 730, Length: 5 }, SpanIncludingLineBreak: { - Start: 680, + Start: 730, Length: 6 } }, { - LineNumber: 20, - Start: 686, - End: 687, - EndIncludingLineBreak: 688, + LineNumber: 21, + Start: 736, + End: 737, + EndIncludingLineBreak: 738, Span: { - Start: 686, + Start: 736, Length: 1 }, SpanIncludingLineBreak: { - Start: 686, + Start: 736, Length: 2 } }, { - LineNumber: 21, - Start: 688, - End: 694, - EndIncludingLineBreak: 695, + LineNumber: 22, + Start: 738, + End: 744, + EndIncludingLineBreak: 745, Span: { - Start: 688, + Start: 738, Length: 6 }, SpanIncludingLineBreak: { - Start: 688, + Start: 738, Length: 7 } }, { - LineNumber: 22, - Start: 695, - End: 695, - EndIncludingLineBreak: 695, + LineNumber: 23, + Start: 745, + End: 745, + EndIncludingLineBreak: 745, Span: { - Start: 695 + Start: 745 }, SpanIncludingLineBreak: { - Start: 695 + Start: 745 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt index 56e34659bd..68b3646a04 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, - Length: 696, + Length: 746, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -24,23 +24,24 @@ // #if NET8_0_OR_GREATER -namespace Sentry.Generated; - -[global::System.Runtime.CompilerServices.CompilerGenerated] -public static class BuildPropertyInitializer +namespace Sentry.Generated { - [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + [global::System.Runtime.CompilerServices.CompilerGenerated] + public static class BuildPropertyInitializer { - global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) + [global::System.Runtime.CompilerServices.ModuleInitializer] + public static void Initialize() { - {"PublishAot", "false"}, - }); + global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) + { + {"PublishAot", "false"}, + }); + } } } #endif , - Length: 696, + Length: 746, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -141,222 +142,237 @@ public static class BuildPropertyInitializer { LineNumber: 7, Start: 198, - End: 225, - EndIncludingLineBreak: 226, + End: 224, + EndIncludingLineBreak: 225, Span: { Start: 198, - Length: 27 + Length: 26 }, SpanIncludingLineBreak: { Start: 198, - Length: 28 + Length: 27 } }, { LineNumber: 8, - Start: 226, + Start: 225, End: 226, EndIncludingLineBreak: 227, Span: { - Start: 226 + Start: 225, + Length: 1 }, SpanIncludingLineBreak: { - Start: 226, - Length: 1 + Start: 225, + Length: 2 } }, { LineNumber: 9, Start: 227, - End: 286, - EndIncludingLineBreak: 287, + End: 290, + EndIncludingLineBreak: 291, Span: { Start: 227, - Length: 59 + Length: 63 }, SpanIncludingLineBreak: { Start: 227, - Length: 60 + Length: 64 } }, { LineNumber: 10, - Start: 287, - End: 331, - EndIncludingLineBreak: 332, + Start: 291, + End: 339, + EndIncludingLineBreak: 340, Span: { - Start: 287, - Length: 44 + Start: 291, + Length: 48 }, SpanIncludingLineBreak: { - Start: 287, - Length: 45 + Start: 291, + Length: 49 } }, { LineNumber: 11, - Start: 332, - End: 333, - EndIncludingLineBreak: 334, + Start: 340, + End: 345, + EndIncludingLineBreak: 346, Span: { - Start: 332, - Length: 1 + Start: 340, + Length: 5 }, SpanIncludingLineBreak: { - Start: 332, - Length: 2 + Start: 340, + Length: 6 } }, { LineNumber: 12, - Start: 334, - End: 397, - EndIncludingLineBreak: 398, + Start: 346, + End: 413, + EndIncludingLineBreak: 414, Span: { - Start: 334, - Length: 63 + Start: 346, + Length: 67 }, SpanIncludingLineBreak: { - Start: 334, - Length: 64 + Start: 346, + Length: 68 } }, { LineNumber: 13, - Start: 398, - End: 433, - EndIncludingLineBreak: 434, + Start: 414, + End: 453, + EndIncludingLineBreak: 454, Span: { - Start: 398, - Length: 35 + Start: 414, + Length: 39 }, SpanIncludingLineBreak: { - Start: 398, - Length: 36 + Start: 414, + Length: 40 } }, { LineNumber: 14, - Start: 434, - End: 439, - EndIncludingLineBreak: 440, + Start: 454, + End: 463, + EndIncludingLineBreak: 464, Span: { - Start: 434, - Length: 5 + Start: 454, + Length: 9 }, SpanIncludingLineBreak: { - Start: 434, - Length: 6 + Start: 454, + Length: 10 } }, { LineNumber: 15, - Start: 440, - End: 621, - EndIncludingLineBreak: 622, + Start: 464, + End: 649, + EndIncludingLineBreak: 650, Span: { - Start: 440, - Length: 181 + Start: 464, + Length: 185 }, SpanIncludingLineBreak: { - Start: 440, - Length: 182 + Start: 464, + Length: 186 } }, { LineNumber: 16, - Start: 622, - End: 631, - EndIncludingLineBreak: 632, + Start: 650, + End: 663, + EndIncludingLineBreak: 664, Span: { - Start: 622, - Length: 9 + Start: 650, + Length: 13 }, SpanIncludingLineBreak: { - Start: 622, - Length: 10 + Start: 650, + Length: 14 } }, { LineNumber: 17, - Start: 632, - End: 668, - EndIncludingLineBreak: 669, + Start: 664, + End: 704, + EndIncludingLineBreak: 705, Span: { - Start: 632, - Length: 36 + Start: 664, + Length: 40 }, SpanIncludingLineBreak: { - Start: 632, - Length: 37 + Start: 664, + Length: 41 } }, { LineNumber: 18, - Start: 669, - End: 680, - EndIncludingLineBreak: 681, + Start: 705, + End: 720, + EndIncludingLineBreak: 721, Span: { - Start: 669, - Length: 11 + Start: 705, + Length: 15 }, SpanIncludingLineBreak: { - Start: 669, - Length: 12 + Start: 705, + Length: 16 } }, { LineNumber: 19, - Start: 681, - End: 686, - EndIncludingLineBreak: 687, + Start: 721, + End: 730, + EndIncludingLineBreak: 731, Span: { - Start: 681, + Start: 721, + Length: 9 + }, + SpanIncludingLineBreak: { + Start: 721, + Length: 10 + } + }, + { + LineNumber: 20, + Start: 731, + End: 736, + EndIncludingLineBreak: 737, + Span: { + Start: 731, Length: 5 }, SpanIncludingLineBreak: { - Start: 681, + Start: 731, Length: 6 } }, { - LineNumber: 20, - Start: 687, - End: 688, - EndIncludingLineBreak: 689, + LineNumber: 21, + Start: 737, + End: 738, + EndIncludingLineBreak: 739, Span: { - Start: 687, + Start: 737, Length: 1 }, SpanIncludingLineBreak: { - Start: 687, + Start: 737, Length: 2 } }, { - LineNumber: 21, - Start: 689, - End: 695, - EndIncludingLineBreak: 696, + LineNumber: 22, + Start: 739, + End: 745, + EndIncludingLineBreak: 746, Span: { - Start: 689, + Start: 739, Length: 6 }, SpanIncludingLineBreak: { - Start: 689, + Start: 739, Length: 7 } }, { - LineNumber: 22, - Start: 696, - End: 696, - EndIncludingLineBreak: 696, + LineNumber: 23, + Start: 746, + End: 746, + EndIncludingLineBreak: 746, Span: { - Start: 696 + Start: 746 }, SpanIncludingLineBreak: { - Start: 696 + Start: 746 } } ] From c00e25ed081e5620d0afd7f7e07ce630f1b36b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Wed, 9 Jul 2025 16:35:08 +0200 Subject: [PATCH 10/21] ref: ModuleInitializer requires .NET 5.0 --- src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs | 2 +- ...opertySourceGeneratorTests.RunResult_BadStrings.verified.txt | 2 +- ...ySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt | 2 +- ...dPropertySourceGeneratorTests.RunResult_Success.verified.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs index b82542489f..c6cc4ca56c 100644 --- a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs +++ b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs @@ -53,7 +53,7 @@ public void Execute(GeneratorExecutionContext context) // regenerated. // -#if NET8_0_OR_GREATER +#if NET5_0_OR_GREATER namespace Sentry.Generated { [global::System.Runtime.CompilerServices.CompilerGenerated] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt index 25052e7098..6fc30dac92 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt @@ -23,7 +23,7 @@ // regenerated. // -#if NET8_0_OR_GREATER +#if NET5_0_OR_GREATER namespace Sentry.Generated { [global::System.Runtime.CompilerServices.CompilerGenerated] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt index 656c8fcd0a..e0c976673f 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt @@ -23,7 +23,7 @@ // regenerated. // -#if NET8_0_OR_GREATER +#if NET5_0_OR_GREATER namespace Sentry.Generated { [global::System.Runtime.CompilerServices.CompilerGenerated] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt index 68b3646a04..87dbc74c1d 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt @@ -23,7 +23,7 @@ // regenerated. // -#if NET8_0_OR_GREATER +#if NET5_0_OR_GREATER namespace Sentry.Generated { [global::System.Runtime.CompilerServices.CompilerGenerated] From 19284af2ecb3f693b6ae9d157fd726a49ecd87b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Wed, 9 Jul 2025 17:01:10 +0200 Subject: [PATCH 11/21] fix: generated attribute --- .../BuildPropertySourceGenerator.cs | 9 +- .../GeneratedCodeText.cs | 7 + ...torTests.RunResult_BadStrings.verified.txt | 289 +++++++++--------- ...sts.RunResult_Publish_AotTrue.verified.txt | 289 +++++++++--------- ...eratorTests.RunResult_Success.verified.txt | 289 +++++++++--------- .../VerifySettingsInitializer.cs | 23 ++ 6 files changed, 445 insertions(+), 461 deletions(-) create mode 100644 src/Sentry.SourceGenerators/GeneratedCodeText.cs create mode 100644 test/Sentry.SourceGenerators.Tests/VerifySettingsInitializer.cs diff --git a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs index c6cc4ca56c..d5b6fcd50f 100644 --- a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs +++ b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs @@ -46,17 +46,16 @@ public void Execute(GeneratorExecutionContext context) var sb = new StringBuilder(); sb .Append( -""" +$$""" // -// Code generated by Sentry Source Generators -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. +// This code was generated by Sentry.SourceGenerators. +// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. // #if NET5_0_OR_GREATER namespace Sentry.Generated { - [global::System.Runtime.CompilerServices.CompilerGenerated] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("{{GeneratedCodeText.Tool}}", "{{GeneratedCodeText.Version}}")] public static class BuildPropertyInitializer { [global::System.Runtime.CompilerServices.ModuleInitializer] diff --git a/src/Sentry.SourceGenerators/GeneratedCodeText.cs b/src/Sentry.SourceGenerators/GeneratedCodeText.cs new file mode 100644 index 0000000000..a0144b1e15 --- /dev/null +++ b/src/Sentry.SourceGenerators/GeneratedCodeText.cs @@ -0,0 +1,7 @@ +namespace Sentry.SourceGenerators; + +internal static class GeneratedCodeText +{ + public static string? Tool { get; } = typeof(BuildPropertySourceGenerator).Assembly.GetName().Name; + public static string? Version { get; } = typeof(BuildPropertySourceGenerator).Assembly.GetName().Version?.ToString(); +} diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt index 6fc30dac92..b4b1d7551f 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, - Length: 748, + Length: 803, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -18,15 +18,14 @@ Encoding: utf-8, Source: // -// Code generated by Sentry Source Generators -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. +// This code was generated by Sentry.SourceGenerators. +// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. // #if NET5_0_OR_GREATER namespace Sentry.Generated { - [global::System.Runtime.CompilerServices.CompilerGenerated] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Sentry.SourceGenerators", "Version")] public static class BuildPropertyInitializer { [global::System.Runtime.CompilerServices.ModuleInitializer] @@ -41,7 +40,7 @@ namespace Sentry.Generated } #endif , - Length: 748, + Length: 803, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -59,320 +58,306 @@ namespace Sentry.Generated { LineNumber: 1, Start: 20, - End: 65, - EndIncludingLineBreak: 66, + End: 74, + EndIncludingLineBreak: 75, Span: { Start: 20, - Length: 45 + Length: 54 }, SpanIncludingLineBreak: { Start: 20, - Length: 46 + Length: 55 } }, { LineNumber: 2, - Start: 66, - End: 137, - EndIncludingLineBreak: 138, + Start: 75, + End: 172, + EndIncludingLineBreak: 173, Span: { - Start: 66, - Length: 71 + Start: 75, + Length: 97 }, SpanIncludingLineBreak: { - Start: 66, - Length: 72 + Start: 75, + Length: 98 } }, { LineNumber: 3, - Start: 138, - End: 153, - EndIncludingLineBreak: 154, + Start: 173, + End: 193, + EndIncludingLineBreak: 194, Span: { - Start: 138, - Length: 15 - }, - SpanIncludingLineBreak: { - Start: 138, - Length: 16 - } - }, - { - LineNumber: 4, - Start: 154, - End: 174, - EndIncludingLineBreak: 175, - Span: { - Start: 154, + Start: 173, Length: 20 }, SpanIncludingLineBreak: { - Start: 154, + Start: 173, Length: 21 } }, { - LineNumber: 5, - Start: 175, - End: 175, - EndIncludingLineBreak: 176, + LineNumber: 4, + Start: 194, + End: 194, + EndIncludingLineBreak: 195, Span: { - Start: 175 + Start: 194 }, SpanIncludingLineBreak: { - Start: 175, + Start: 194, Length: 1 } }, { - LineNumber: 6, - Start: 176, - End: 197, - EndIncludingLineBreak: 198, + LineNumber: 5, + Start: 195, + End: 216, + EndIncludingLineBreak: 217, Span: { - Start: 176, + Start: 195, Length: 21 }, SpanIncludingLineBreak: { - Start: 176, + Start: 195, Length: 22 } }, { - LineNumber: 7, - Start: 198, - End: 224, - EndIncludingLineBreak: 225, + LineNumber: 6, + Start: 217, + End: 243, + EndIncludingLineBreak: 244, Span: { - Start: 198, + Start: 217, Length: 26 }, SpanIncludingLineBreak: { - Start: 198, + Start: 217, Length: 27 } }, { - LineNumber: 8, - Start: 225, - End: 226, - EndIncludingLineBreak: 227, + LineNumber: 7, + Start: 244, + End: 245, + EndIncludingLineBreak: 246, Span: { - Start: 225, + Start: 244, Length: 1 }, SpanIncludingLineBreak: { - Start: 225, + Start: 244, Length: 2 } }, { - LineNumber: 9, - Start: 227, - End: 290, - EndIncludingLineBreak: 291, + LineNumber: 8, + Start: 246, + End: 345, + EndIncludingLineBreak: 346, Span: { - Start: 227, - Length: 63 + Start: 246, + Length: 99 }, SpanIncludingLineBreak: { - Start: 227, - Length: 64 + Start: 246, + Length: 100 } }, { - LineNumber: 10, - Start: 291, - End: 339, - EndIncludingLineBreak: 340, + LineNumber: 9, + Start: 346, + End: 394, + EndIncludingLineBreak: 395, Span: { - Start: 291, + Start: 346, Length: 48 }, SpanIncludingLineBreak: { - Start: 291, + Start: 346, Length: 49 } }, { - LineNumber: 11, - Start: 340, - End: 345, - EndIncludingLineBreak: 346, + LineNumber: 10, + Start: 395, + End: 400, + EndIncludingLineBreak: 401, Span: { - Start: 340, + Start: 395, Length: 5 }, SpanIncludingLineBreak: { - Start: 340, + Start: 395, Length: 6 } }, { - LineNumber: 12, - Start: 346, - End: 413, - EndIncludingLineBreak: 414, + LineNumber: 11, + Start: 401, + End: 468, + EndIncludingLineBreak: 469, Span: { - Start: 346, + Start: 401, Length: 67 }, SpanIncludingLineBreak: { - Start: 346, + Start: 401, Length: 68 } }, { - LineNumber: 13, - Start: 414, - End: 453, - EndIncludingLineBreak: 454, + LineNumber: 12, + Start: 469, + End: 508, + EndIncludingLineBreak: 509, Span: { - Start: 414, + Start: 469, Length: 39 }, SpanIncludingLineBreak: { - Start: 414, + Start: 469, Length: 40 } }, { - LineNumber: 14, - Start: 454, - End: 463, - EndIncludingLineBreak: 464, + LineNumber: 13, + Start: 509, + End: 518, + EndIncludingLineBreak: 519, Span: { - Start: 454, + Start: 509, Length: 9 }, SpanIncludingLineBreak: { - Start: 454, + Start: 509, Length: 10 } }, { - LineNumber: 15, - Start: 464, - End: 649, - EndIncludingLineBreak: 650, + LineNumber: 14, + Start: 519, + End: 704, + EndIncludingLineBreak: 705, Span: { - Start: 464, + Start: 519, Length: 185 }, SpanIncludingLineBreak: { - Start: 464, + Start: 519, Length: 186 } }, { - LineNumber: 16, - Start: 650, - End: 663, - EndIncludingLineBreak: 664, + LineNumber: 15, + Start: 705, + End: 718, + EndIncludingLineBreak: 719, Span: { - Start: 650, + Start: 705, Length: 13 }, SpanIncludingLineBreak: { - Start: 650, + Start: 705, Length: 14 } }, { - LineNumber: 17, - Start: 664, - End: 706, - EndIncludingLineBreak: 707, + LineNumber: 16, + Start: 719, + End: 761, + EndIncludingLineBreak: 762, Span: { - Start: 664, + Start: 719, Length: 42 }, SpanIncludingLineBreak: { - Start: 664, + Start: 719, Length: 43 } }, { - LineNumber: 18, - Start: 707, - End: 722, - EndIncludingLineBreak: 723, + LineNumber: 17, + Start: 762, + End: 777, + EndIncludingLineBreak: 778, Span: { - Start: 707, + Start: 762, Length: 15 }, SpanIncludingLineBreak: { - Start: 707, + Start: 762, Length: 16 } }, { - LineNumber: 19, - Start: 723, - End: 732, - EndIncludingLineBreak: 733, + LineNumber: 18, + Start: 778, + End: 787, + EndIncludingLineBreak: 788, Span: { - Start: 723, + Start: 778, Length: 9 }, SpanIncludingLineBreak: { - Start: 723, + Start: 778, Length: 10 } }, { - LineNumber: 20, - Start: 733, - End: 738, - EndIncludingLineBreak: 739, + LineNumber: 19, + Start: 788, + End: 793, + EndIncludingLineBreak: 794, Span: { - Start: 733, + Start: 788, Length: 5 }, SpanIncludingLineBreak: { - Start: 733, + Start: 788, Length: 6 } }, { - LineNumber: 21, - Start: 739, - End: 740, - EndIncludingLineBreak: 741, + LineNumber: 20, + Start: 794, + End: 795, + EndIncludingLineBreak: 796, Span: { - Start: 739, + Start: 794, Length: 1 }, SpanIncludingLineBreak: { - Start: 739, + Start: 794, Length: 2 } }, { - LineNumber: 22, - Start: 741, - End: 747, - EndIncludingLineBreak: 748, + LineNumber: 21, + Start: 796, + End: 802, + EndIncludingLineBreak: 803, Span: { - Start: 741, + Start: 796, Length: 6 }, SpanIncludingLineBreak: { - Start: 741, + Start: 796, Length: 7 } }, { - LineNumber: 23, - Start: 748, - End: 748, - EndIncludingLineBreak: 748, + LineNumber: 22, + Start: 803, + End: 803, + EndIncludingLineBreak: 803, Span: { - Start: 748 + Start: 803 }, SpanIncludingLineBreak: { - Start: 748 + Start: 803 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt index e0c976673f..e0eadffd34 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, - Length: 745, + Length: 800, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -18,15 +18,14 @@ Encoding: utf-8, Source: // -// Code generated by Sentry Source Generators -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. +// This code was generated by Sentry.SourceGenerators. +// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. // #if NET5_0_OR_GREATER namespace Sentry.Generated { - [global::System.Runtime.CompilerServices.CompilerGenerated] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Sentry.SourceGenerators", "Version")] public static class BuildPropertyInitializer { [global::System.Runtime.CompilerServices.ModuleInitializer] @@ -41,7 +40,7 @@ namespace Sentry.Generated } #endif , - Length: 745, + Length: 800, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -59,320 +58,306 @@ namespace Sentry.Generated { LineNumber: 1, Start: 20, - End: 65, - EndIncludingLineBreak: 66, + End: 74, + EndIncludingLineBreak: 75, Span: { Start: 20, - Length: 45 + Length: 54 }, SpanIncludingLineBreak: { Start: 20, - Length: 46 + Length: 55 } }, { LineNumber: 2, - Start: 66, - End: 137, - EndIncludingLineBreak: 138, + Start: 75, + End: 172, + EndIncludingLineBreak: 173, Span: { - Start: 66, - Length: 71 + Start: 75, + Length: 97 }, SpanIncludingLineBreak: { - Start: 66, - Length: 72 + Start: 75, + Length: 98 } }, { LineNumber: 3, - Start: 138, - End: 153, - EndIncludingLineBreak: 154, + Start: 173, + End: 193, + EndIncludingLineBreak: 194, Span: { - Start: 138, - Length: 15 - }, - SpanIncludingLineBreak: { - Start: 138, - Length: 16 - } - }, - { - LineNumber: 4, - Start: 154, - End: 174, - EndIncludingLineBreak: 175, - Span: { - Start: 154, + Start: 173, Length: 20 }, SpanIncludingLineBreak: { - Start: 154, + Start: 173, Length: 21 } }, { - LineNumber: 5, - Start: 175, - End: 175, - EndIncludingLineBreak: 176, + LineNumber: 4, + Start: 194, + End: 194, + EndIncludingLineBreak: 195, Span: { - Start: 175 + Start: 194 }, SpanIncludingLineBreak: { - Start: 175, + Start: 194, Length: 1 } }, { - LineNumber: 6, - Start: 176, - End: 197, - EndIncludingLineBreak: 198, + LineNumber: 5, + Start: 195, + End: 216, + EndIncludingLineBreak: 217, Span: { - Start: 176, + Start: 195, Length: 21 }, SpanIncludingLineBreak: { - Start: 176, + Start: 195, Length: 22 } }, { - LineNumber: 7, - Start: 198, - End: 224, - EndIncludingLineBreak: 225, + LineNumber: 6, + Start: 217, + End: 243, + EndIncludingLineBreak: 244, Span: { - Start: 198, + Start: 217, Length: 26 }, SpanIncludingLineBreak: { - Start: 198, + Start: 217, Length: 27 } }, { - LineNumber: 8, - Start: 225, - End: 226, - EndIncludingLineBreak: 227, + LineNumber: 7, + Start: 244, + End: 245, + EndIncludingLineBreak: 246, Span: { - Start: 225, + Start: 244, Length: 1 }, SpanIncludingLineBreak: { - Start: 225, + Start: 244, Length: 2 } }, { - LineNumber: 9, - Start: 227, - End: 290, - EndIncludingLineBreak: 291, + LineNumber: 8, + Start: 246, + End: 345, + EndIncludingLineBreak: 346, Span: { - Start: 227, - Length: 63 + Start: 246, + Length: 99 }, SpanIncludingLineBreak: { - Start: 227, - Length: 64 + Start: 246, + Length: 100 } }, { - LineNumber: 10, - Start: 291, - End: 339, - EndIncludingLineBreak: 340, + LineNumber: 9, + Start: 346, + End: 394, + EndIncludingLineBreak: 395, Span: { - Start: 291, + Start: 346, Length: 48 }, SpanIncludingLineBreak: { - Start: 291, + Start: 346, Length: 49 } }, { - LineNumber: 11, - Start: 340, - End: 345, - EndIncludingLineBreak: 346, + LineNumber: 10, + Start: 395, + End: 400, + EndIncludingLineBreak: 401, Span: { - Start: 340, + Start: 395, Length: 5 }, SpanIncludingLineBreak: { - Start: 340, + Start: 395, Length: 6 } }, { - LineNumber: 12, - Start: 346, - End: 413, - EndIncludingLineBreak: 414, + LineNumber: 11, + Start: 401, + End: 468, + EndIncludingLineBreak: 469, Span: { - Start: 346, + Start: 401, Length: 67 }, SpanIncludingLineBreak: { - Start: 346, + Start: 401, Length: 68 } }, { - LineNumber: 13, - Start: 414, - End: 453, - EndIncludingLineBreak: 454, + LineNumber: 12, + Start: 469, + End: 508, + EndIncludingLineBreak: 509, Span: { - Start: 414, + Start: 469, Length: 39 }, SpanIncludingLineBreak: { - Start: 414, + Start: 469, Length: 40 } }, { - LineNumber: 14, - Start: 454, - End: 463, - EndIncludingLineBreak: 464, + LineNumber: 13, + Start: 509, + End: 518, + EndIncludingLineBreak: 519, Span: { - Start: 454, + Start: 509, Length: 9 }, SpanIncludingLineBreak: { - Start: 454, + Start: 509, Length: 10 } }, { - LineNumber: 15, - Start: 464, - End: 649, - EndIncludingLineBreak: 650, + LineNumber: 14, + Start: 519, + End: 704, + EndIncludingLineBreak: 705, Span: { - Start: 464, + Start: 519, Length: 185 }, SpanIncludingLineBreak: { - Start: 464, + Start: 519, Length: 186 } }, { - LineNumber: 16, - Start: 650, - End: 663, - EndIncludingLineBreak: 664, + LineNumber: 15, + Start: 705, + End: 718, + EndIncludingLineBreak: 719, Span: { - Start: 650, + Start: 705, Length: 13 }, SpanIncludingLineBreak: { - Start: 650, + Start: 705, Length: 14 } }, { - LineNumber: 17, - Start: 664, - End: 703, - EndIncludingLineBreak: 704, + LineNumber: 16, + Start: 719, + End: 758, + EndIncludingLineBreak: 759, Span: { - Start: 664, + Start: 719, Length: 39 }, SpanIncludingLineBreak: { - Start: 664, + Start: 719, Length: 40 } }, { - LineNumber: 18, - Start: 704, - End: 719, - EndIncludingLineBreak: 720, + LineNumber: 17, + Start: 759, + End: 774, + EndIncludingLineBreak: 775, Span: { - Start: 704, + Start: 759, Length: 15 }, SpanIncludingLineBreak: { - Start: 704, + Start: 759, Length: 16 } }, { - LineNumber: 19, - Start: 720, - End: 729, - EndIncludingLineBreak: 730, + LineNumber: 18, + Start: 775, + End: 784, + EndIncludingLineBreak: 785, Span: { - Start: 720, + Start: 775, Length: 9 }, SpanIncludingLineBreak: { - Start: 720, + Start: 775, Length: 10 } }, { - LineNumber: 20, - Start: 730, - End: 735, - EndIncludingLineBreak: 736, + LineNumber: 19, + Start: 785, + End: 790, + EndIncludingLineBreak: 791, Span: { - Start: 730, + Start: 785, Length: 5 }, SpanIncludingLineBreak: { - Start: 730, + Start: 785, Length: 6 } }, { - LineNumber: 21, - Start: 736, - End: 737, - EndIncludingLineBreak: 738, + LineNumber: 20, + Start: 791, + End: 792, + EndIncludingLineBreak: 793, Span: { - Start: 736, + Start: 791, Length: 1 }, SpanIncludingLineBreak: { - Start: 736, + Start: 791, Length: 2 } }, { - LineNumber: 22, - Start: 738, - End: 744, - EndIncludingLineBreak: 745, + LineNumber: 21, + Start: 793, + End: 799, + EndIncludingLineBreak: 800, Span: { - Start: 738, + Start: 793, Length: 6 }, SpanIncludingLineBreak: { - Start: 738, + Start: 793, Length: 7 } }, { - LineNumber: 23, - Start: 745, - End: 745, - EndIncludingLineBreak: 745, + LineNumber: 22, + Start: 800, + End: 800, + EndIncludingLineBreak: 800, Span: { - Start: 745 + Start: 800 }, SpanIncludingLineBreak: { - Start: 745 + Start: 800 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt index 87dbc74c1d..58e7227be3 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, - Length: 746, + Length: 801, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -18,15 +18,14 @@ Encoding: utf-8, Source: // -// Code generated by Sentry Source Generators -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. +// This code was generated by Sentry.SourceGenerators. +// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. // #if NET5_0_OR_GREATER namespace Sentry.Generated { - [global::System.Runtime.CompilerServices.CompilerGenerated] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Sentry.SourceGenerators", "Version")] public static class BuildPropertyInitializer { [global::System.Runtime.CompilerServices.ModuleInitializer] @@ -41,7 +40,7 @@ namespace Sentry.Generated } #endif , - Length: 746, + Length: 801, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -59,320 +58,306 @@ namespace Sentry.Generated { LineNumber: 1, Start: 20, - End: 65, - EndIncludingLineBreak: 66, + End: 74, + EndIncludingLineBreak: 75, Span: { Start: 20, - Length: 45 + Length: 54 }, SpanIncludingLineBreak: { Start: 20, - Length: 46 + Length: 55 } }, { LineNumber: 2, - Start: 66, - End: 137, - EndIncludingLineBreak: 138, + Start: 75, + End: 172, + EndIncludingLineBreak: 173, Span: { - Start: 66, - Length: 71 + Start: 75, + Length: 97 }, SpanIncludingLineBreak: { - Start: 66, - Length: 72 + Start: 75, + Length: 98 } }, { LineNumber: 3, - Start: 138, - End: 153, - EndIncludingLineBreak: 154, + Start: 173, + End: 193, + EndIncludingLineBreak: 194, Span: { - Start: 138, - Length: 15 - }, - SpanIncludingLineBreak: { - Start: 138, - Length: 16 - } - }, - { - LineNumber: 4, - Start: 154, - End: 174, - EndIncludingLineBreak: 175, - Span: { - Start: 154, + Start: 173, Length: 20 }, SpanIncludingLineBreak: { - Start: 154, + Start: 173, Length: 21 } }, { - LineNumber: 5, - Start: 175, - End: 175, - EndIncludingLineBreak: 176, + LineNumber: 4, + Start: 194, + End: 194, + EndIncludingLineBreak: 195, Span: { - Start: 175 + Start: 194 }, SpanIncludingLineBreak: { - Start: 175, + Start: 194, Length: 1 } }, { - LineNumber: 6, - Start: 176, - End: 197, - EndIncludingLineBreak: 198, + LineNumber: 5, + Start: 195, + End: 216, + EndIncludingLineBreak: 217, Span: { - Start: 176, + Start: 195, Length: 21 }, SpanIncludingLineBreak: { - Start: 176, + Start: 195, Length: 22 } }, { - LineNumber: 7, - Start: 198, - End: 224, - EndIncludingLineBreak: 225, + LineNumber: 6, + Start: 217, + End: 243, + EndIncludingLineBreak: 244, Span: { - Start: 198, + Start: 217, Length: 26 }, SpanIncludingLineBreak: { - Start: 198, + Start: 217, Length: 27 } }, { - LineNumber: 8, - Start: 225, - End: 226, - EndIncludingLineBreak: 227, + LineNumber: 7, + Start: 244, + End: 245, + EndIncludingLineBreak: 246, Span: { - Start: 225, + Start: 244, Length: 1 }, SpanIncludingLineBreak: { - Start: 225, + Start: 244, Length: 2 } }, { - LineNumber: 9, - Start: 227, - End: 290, - EndIncludingLineBreak: 291, + LineNumber: 8, + Start: 246, + End: 345, + EndIncludingLineBreak: 346, Span: { - Start: 227, - Length: 63 + Start: 246, + Length: 99 }, SpanIncludingLineBreak: { - Start: 227, - Length: 64 + Start: 246, + Length: 100 } }, { - LineNumber: 10, - Start: 291, - End: 339, - EndIncludingLineBreak: 340, + LineNumber: 9, + Start: 346, + End: 394, + EndIncludingLineBreak: 395, Span: { - Start: 291, + Start: 346, Length: 48 }, SpanIncludingLineBreak: { - Start: 291, + Start: 346, Length: 49 } }, { - LineNumber: 11, - Start: 340, - End: 345, - EndIncludingLineBreak: 346, + LineNumber: 10, + Start: 395, + End: 400, + EndIncludingLineBreak: 401, Span: { - Start: 340, + Start: 395, Length: 5 }, SpanIncludingLineBreak: { - Start: 340, + Start: 395, Length: 6 } }, { - LineNumber: 12, - Start: 346, - End: 413, - EndIncludingLineBreak: 414, + LineNumber: 11, + Start: 401, + End: 468, + EndIncludingLineBreak: 469, Span: { - Start: 346, + Start: 401, Length: 67 }, SpanIncludingLineBreak: { - Start: 346, + Start: 401, Length: 68 } }, { - LineNumber: 13, - Start: 414, - End: 453, - EndIncludingLineBreak: 454, + LineNumber: 12, + Start: 469, + End: 508, + EndIncludingLineBreak: 509, Span: { - Start: 414, + Start: 469, Length: 39 }, SpanIncludingLineBreak: { - Start: 414, + Start: 469, Length: 40 } }, { - LineNumber: 14, - Start: 454, - End: 463, - EndIncludingLineBreak: 464, + LineNumber: 13, + Start: 509, + End: 518, + EndIncludingLineBreak: 519, Span: { - Start: 454, + Start: 509, Length: 9 }, SpanIncludingLineBreak: { - Start: 454, + Start: 509, Length: 10 } }, { - LineNumber: 15, - Start: 464, - End: 649, - EndIncludingLineBreak: 650, + LineNumber: 14, + Start: 519, + End: 704, + EndIncludingLineBreak: 705, Span: { - Start: 464, + Start: 519, Length: 185 }, SpanIncludingLineBreak: { - Start: 464, + Start: 519, Length: 186 } }, { - LineNumber: 16, - Start: 650, - End: 663, - EndIncludingLineBreak: 664, + LineNumber: 15, + Start: 705, + End: 718, + EndIncludingLineBreak: 719, Span: { - Start: 650, + Start: 705, Length: 13 }, SpanIncludingLineBreak: { - Start: 650, + Start: 705, Length: 14 } }, { - LineNumber: 17, - Start: 664, - End: 704, - EndIncludingLineBreak: 705, + LineNumber: 16, + Start: 719, + End: 759, + EndIncludingLineBreak: 760, Span: { - Start: 664, + Start: 719, Length: 40 }, SpanIncludingLineBreak: { - Start: 664, + Start: 719, Length: 41 } }, { - LineNumber: 18, - Start: 705, - End: 720, - EndIncludingLineBreak: 721, + LineNumber: 17, + Start: 760, + End: 775, + EndIncludingLineBreak: 776, Span: { - Start: 705, + Start: 760, Length: 15 }, SpanIncludingLineBreak: { - Start: 705, + Start: 760, Length: 16 } }, { - LineNumber: 19, - Start: 721, - End: 730, - EndIncludingLineBreak: 731, + LineNumber: 18, + Start: 776, + End: 785, + EndIncludingLineBreak: 786, Span: { - Start: 721, + Start: 776, Length: 9 }, SpanIncludingLineBreak: { - Start: 721, + Start: 776, Length: 10 } }, { - LineNumber: 20, - Start: 731, - End: 736, - EndIncludingLineBreak: 737, + LineNumber: 19, + Start: 786, + End: 791, + EndIncludingLineBreak: 792, Span: { - Start: 731, + Start: 786, Length: 5 }, SpanIncludingLineBreak: { - Start: 731, + Start: 786, Length: 6 } }, { - LineNumber: 21, - Start: 737, - End: 738, - EndIncludingLineBreak: 739, + LineNumber: 20, + Start: 792, + End: 793, + EndIncludingLineBreak: 794, Span: { - Start: 737, + Start: 792, Length: 1 }, SpanIncludingLineBreak: { - Start: 737, + Start: 792, Length: 2 } }, { - LineNumber: 22, - Start: 739, - End: 745, - EndIncludingLineBreak: 746, + LineNumber: 21, + Start: 794, + End: 800, + EndIncludingLineBreak: 801, Span: { - Start: 739, + Start: 794, Length: 6 }, SpanIncludingLineBreak: { - Start: 739, + Start: 794, Length: 7 } }, { - LineNumber: 23, - Start: 746, - End: 746, - EndIncludingLineBreak: 746, + LineNumber: 22, + Start: 801, + End: 801, + EndIncludingLineBreak: 801, Span: { - Start: 746 + Start: 801 }, SpanIncludingLineBreak: { - Start: 746 + Start: 801 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/VerifySettingsInitializer.cs b/test/Sentry.SourceGenerators.Tests/VerifySettingsInitializer.cs new file mode 100644 index 0000000000..cd627a7ac9 --- /dev/null +++ b/test/Sentry.SourceGenerators.Tests/VerifySettingsInitializer.cs @@ -0,0 +1,23 @@ +using System.CodeDom.Compiler; + +namespace Sentry.SourceGenerators.Tests; + +internal static class VerifySettingsInitializer +{ + private static readonly AssemblyName s_assemblyName = typeof(BuildPropertySourceGenerator).Assembly.GetName(); + + [ModuleInitializer] + internal static void Initialize() + { + VerifierSettings.AddScrubber(VersionScrubber); + } + + [GeneratedCode("", "")] + private static void VersionScrubber(StringBuilder text) + { + if (s_assemblyName.Version is not null) + { + text.Replace(s_assemblyName.Version.ToString(), nameof(Version)); + } + } +} From 20ac32364d482ef0915e6035441716f72a4e92d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Wed, 9 Jul 2025 17:03:19 +0200 Subject: [PATCH 12/21] ref: enable nullable reference types --- .../BuildPropertySourceGenerator.cs | 3 + ...torTests.RunResult_BadStrings.verified.txt | 245 ++++++++++-------- ...sts.RunResult_Publish_AotTrue.verified.txt | 245 ++++++++++-------- ...eratorTests.RunResult_Success.verified.txt | 245 ++++++++++-------- 4 files changed, 435 insertions(+), 303 deletions(-) diff --git a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs index d5b6fcd50f..3626eb31b8 100644 --- a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs +++ b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs @@ -53,6 +53,9 @@ public void Execute(GeneratorExecutionContext context) // #if NET5_0_OR_GREATER + +#nullable enable + namespace Sentry.Generated { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("{{GeneratedCodeText.Tool}}", "{{GeneratedCodeText.Version}}")] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt index b4b1d7551f..bc81f01bf8 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, - Length: 803, + Length: 822, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -23,6 +23,9 @@ // #if NET5_0_OR_GREATER + +#nullable enable + namespace Sentry.Generated { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Sentry.SourceGenerators", "Version")] @@ -40,7 +43,7 @@ namespace Sentry.Generated } #endif , - Length: 803, + Length: 822, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -127,237 +130,277 @@ namespace Sentry.Generated { LineNumber: 6, Start: 217, - End: 243, - EndIncludingLineBreak: 244, + End: 217, + EndIncludingLineBreak: 218, Span: { + Start: 217 + }, + SpanIncludingLineBreak: { Start: 217, + Length: 1 + } + }, + { + LineNumber: 7, + Start: 218, + End: 234, + EndIncludingLineBreak: 235, + Span: { + Start: 218, + Length: 16 + }, + SpanIncludingLineBreak: { + Start: 218, + Length: 17 + } + }, + { + LineNumber: 8, + Start: 235, + End: 235, + EndIncludingLineBreak: 236, + Span: { + Start: 235 + }, + SpanIncludingLineBreak: { + Start: 235, + Length: 1 + } + }, + { + LineNumber: 9, + Start: 236, + End: 262, + EndIncludingLineBreak: 263, + Span: { + Start: 236, Length: 26 }, SpanIncludingLineBreak: { - Start: 217, + Start: 236, Length: 27 } }, { - LineNumber: 7, - Start: 244, - End: 245, - EndIncludingLineBreak: 246, + LineNumber: 10, + Start: 263, + End: 264, + EndIncludingLineBreak: 265, Span: { - Start: 244, + Start: 263, Length: 1 }, SpanIncludingLineBreak: { - Start: 244, + Start: 263, Length: 2 } }, { - LineNumber: 8, - Start: 246, - End: 345, - EndIncludingLineBreak: 346, + LineNumber: 11, + Start: 265, + End: 364, + EndIncludingLineBreak: 365, Span: { - Start: 246, + Start: 265, Length: 99 }, SpanIncludingLineBreak: { - Start: 246, + Start: 265, Length: 100 } }, { - LineNumber: 9, - Start: 346, - End: 394, - EndIncludingLineBreak: 395, + LineNumber: 12, + Start: 365, + End: 413, + EndIncludingLineBreak: 414, Span: { - Start: 346, + Start: 365, Length: 48 }, SpanIncludingLineBreak: { - Start: 346, + Start: 365, Length: 49 } }, { - LineNumber: 10, - Start: 395, - End: 400, - EndIncludingLineBreak: 401, + LineNumber: 13, + Start: 414, + End: 419, + EndIncludingLineBreak: 420, Span: { - Start: 395, + Start: 414, Length: 5 }, SpanIncludingLineBreak: { - Start: 395, + Start: 414, Length: 6 } }, { - LineNumber: 11, - Start: 401, - End: 468, - EndIncludingLineBreak: 469, + LineNumber: 14, + Start: 420, + End: 487, + EndIncludingLineBreak: 488, Span: { - Start: 401, + Start: 420, Length: 67 }, SpanIncludingLineBreak: { - Start: 401, + Start: 420, Length: 68 } }, { - LineNumber: 12, - Start: 469, - End: 508, - EndIncludingLineBreak: 509, + LineNumber: 15, + Start: 488, + End: 527, + EndIncludingLineBreak: 528, Span: { - Start: 469, + Start: 488, Length: 39 }, SpanIncludingLineBreak: { - Start: 469, + Start: 488, Length: 40 } }, { - LineNumber: 13, - Start: 509, - End: 518, - EndIncludingLineBreak: 519, + LineNumber: 16, + Start: 528, + End: 537, + EndIncludingLineBreak: 538, Span: { - Start: 509, + Start: 528, Length: 9 }, SpanIncludingLineBreak: { - Start: 509, + Start: 528, Length: 10 } }, { - LineNumber: 14, - Start: 519, - End: 704, - EndIncludingLineBreak: 705, + LineNumber: 17, + Start: 538, + End: 723, + EndIncludingLineBreak: 724, Span: { - Start: 519, + Start: 538, Length: 185 }, SpanIncludingLineBreak: { - Start: 519, + Start: 538, Length: 186 } }, { - LineNumber: 15, - Start: 705, - End: 718, - EndIncludingLineBreak: 719, + LineNumber: 18, + Start: 724, + End: 737, + EndIncludingLineBreak: 738, Span: { - Start: 705, + Start: 724, Length: 13 }, SpanIncludingLineBreak: { - Start: 705, + Start: 724, Length: 14 } }, { - LineNumber: 16, - Start: 719, - End: 761, - EndIncludingLineBreak: 762, + LineNumber: 19, + Start: 738, + End: 780, + EndIncludingLineBreak: 781, Span: { - Start: 719, + Start: 738, Length: 42 }, SpanIncludingLineBreak: { - Start: 719, + Start: 738, Length: 43 } }, { - LineNumber: 17, - Start: 762, - End: 777, - EndIncludingLineBreak: 778, + LineNumber: 20, + Start: 781, + End: 796, + EndIncludingLineBreak: 797, Span: { - Start: 762, + Start: 781, Length: 15 }, SpanIncludingLineBreak: { - Start: 762, + Start: 781, Length: 16 } }, { - LineNumber: 18, - Start: 778, - End: 787, - EndIncludingLineBreak: 788, + LineNumber: 21, + Start: 797, + End: 806, + EndIncludingLineBreak: 807, Span: { - Start: 778, + Start: 797, Length: 9 }, SpanIncludingLineBreak: { - Start: 778, + Start: 797, Length: 10 } }, { - LineNumber: 19, - Start: 788, - End: 793, - EndIncludingLineBreak: 794, + LineNumber: 22, + Start: 807, + End: 812, + EndIncludingLineBreak: 813, Span: { - Start: 788, + Start: 807, Length: 5 }, SpanIncludingLineBreak: { - Start: 788, + Start: 807, Length: 6 } }, { - LineNumber: 20, - Start: 794, - End: 795, - EndIncludingLineBreak: 796, + LineNumber: 23, + Start: 813, + End: 814, + EndIncludingLineBreak: 815, Span: { - Start: 794, + Start: 813, Length: 1 }, SpanIncludingLineBreak: { - Start: 794, + Start: 813, Length: 2 } }, { - LineNumber: 21, - Start: 796, - End: 802, - EndIncludingLineBreak: 803, + LineNumber: 24, + Start: 815, + End: 821, + EndIncludingLineBreak: 822, Span: { - Start: 796, + Start: 815, Length: 6 }, SpanIncludingLineBreak: { - Start: 796, + Start: 815, Length: 7 } }, { - LineNumber: 22, - Start: 803, - End: 803, - EndIncludingLineBreak: 803, + LineNumber: 25, + Start: 822, + End: 822, + EndIncludingLineBreak: 822, Span: { - Start: 803 + Start: 822 }, SpanIncludingLineBreak: { - Start: 803 + Start: 822 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt index e0eadffd34..6b8caef849 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, - Length: 800, + Length: 819, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -23,6 +23,9 @@ // #if NET5_0_OR_GREATER + +#nullable enable + namespace Sentry.Generated { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Sentry.SourceGenerators", "Version")] @@ -40,7 +43,7 @@ namespace Sentry.Generated } #endif , - Length: 800, + Length: 819, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -127,237 +130,277 @@ namespace Sentry.Generated { LineNumber: 6, Start: 217, - End: 243, - EndIncludingLineBreak: 244, + End: 217, + EndIncludingLineBreak: 218, Span: { + Start: 217 + }, + SpanIncludingLineBreak: { Start: 217, + Length: 1 + } + }, + { + LineNumber: 7, + Start: 218, + End: 234, + EndIncludingLineBreak: 235, + Span: { + Start: 218, + Length: 16 + }, + SpanIncludingLineBreak: { + Start: 218, + Length: 17 + } + }, + { + LineNumber: 8, + Start: 235, + End: 235, + EndIncludingLineBreak: 236, + Span: { + Start: 235 + }, + SpanIncludingLineBreak: { + Start: 235, + Length: 1 + } + }, + { + LineNumber: 9, + Start: 236, + End: 262, + EndIncludingLineBreak: 263, + Span: { + Start: 236, Length: 26 }, SpanIncludingLineBreak: { - Start: 217, + Start: 236, Length: 27 } }, { - LineNumber: 7, - Start: 244, - End: 245, - EndIncludingLineBreak: 246, + LineNumber: 10, + Start: 263, + End: 264, + EndIncludingLineBreak: 265, Span: { - Start: 244, + Start: 263, Length: 1 }, SpanIncludingLineBreak: { - Start: 244, + Start: 263, Length: 2 } }, { - LineNumber: 8, - Start: 246, - End: 345, - EndIncludingLineBreak: 346, + LineNumber: 11, + Start: 265, + End: 364, + EndIncludingLineBreak: 365, Span: { - Start: 246, + Start: 265, Length: 99 }, SpanIncludingLineBreak: { - Start: 246, + Start: 265, Length: 100 } }, { - LineNumber: 9, - Start: 346, - End: 394, - EndIncludingLineBreak: 395, + LineNumber: 12, + Start: 365, + End: 413, + EndIncludingLineBreak: 414, Span: { - Start: 346, + Start: 365, Length: 48 }, SpanIncludingLineBreak: { - Start: 346, + Start: 365, Length: 49 } }, { - LineNumber: 10, - Start: 395, - End: 400, - EndIncludingLineBreak: 401, + LineNumber: 13, + Start: 414, + End: 419, + EndIncludingLineBreak: 420, Span: { - Start: 395, + Start: 414, Length: 5 }, SpanIncludingLineBreak: { - Start: 395, + Start: 414, Length: 6 } }, { - LineNumber: 11, - Start: 401, - End: 468, - EndIncludingLineBreak: 469, + LineNumber: 14, + Start: 420, + End: 487, + EndIncludingLineBreak: 488, Span: { - Start: 401, + Start: 420, Length: 67 }, SpanIncludingLineBreak: { - Start: 401, + Start: 420, Length: 68 } }, { - LineNumber: 12, - Start: 469, - End: 508, - EndIncludingLineBreak: 509, + LineNumber: 15, + Start: 488, + End: 527, + EndIncludingLineBreak: 528, Span: { - Start: 469, + Start: 488, Length: 39 }, SpanIncludingLineBreak: { - Start: 469, + Start: 488, Length: 40 } }, { - LineNumber: 13, - Start: 509, - End: 518, - EndIncludingLineBreak: 519, + LineNumber: 16, + Start: 528, + End: 537, + EndIncludingLineBreak: 538, Span: { - Start: 509, + Start: 528, Length: 9 }, SpanIncludingLineBreak: { - Start: 509, + Start: 528, Length: 10 } }, { - LineNumber: 14, - Start: 519, - End: 704, - EndIncludingLineBreak: 705, + LineNumber: 17, + Start: 538, + End: 723, + EndIncludingLineBreak: 724, Span: { - Start: 519, + Start: 538, Length: 185 }, SpanIncludingLineBreak: { - Start: 519, + Start: 538, Length: 186 } }, { - LineNumber: 15, - Start: 705, - End: 718, - EndIncludingLineBreak: 719, + LineNumber: 18, + Start: 724, + End: 737, + EndIncludingLineBreak: 738, Span: { - Start: 705, + Start: 724, Length: 13 }, SpanIncludingLineBreak: { - Start: 705, + Start: 724, Length: 14 } }, { - LineNumber: 16, - Start: 719, - End: 758, - EndIncludingLineBreak: 759, + LineNumber: 19, + Start: 738, + End: 777, + EndIncludingLineBreak: 778, Span: { - Start: 719, + Start: 738, Length: 39 }, SpanIncludingLineBreak: { - Start: 719, + Start: 738, Length: 40 } }, { - LineNumber: 17, - Start: 759, - End: 774, - EndIncludingLineBreak: 775, + LineNumber: 20, + Start: 778, + End: 793, + EndIncludingLineBreak: 794, Span: { - Start: 759, + Start: 778, Length: 15 }, SpanIncludingLineBreak: { - Start: 759, + Start: 778, Length: 16 } }, { - LineNumber: 18, - Start: 775, - End: 784, - EndIncludingLineBreak: 785, + LineNumber: 21, + Start: 794, + End: 803, + EndIncludingLineBreak: 804, Span: { - Start: 775, + Start: 794, Length: 9 }, SpanIncludingLineBreak: { - Start: 775, + Start: 794, Length: 10 } }, { - LineNumber: 19, - Start: 785, - End: 790, - EndIncludingLineBreak: 791, + LineNumber: 22, + Start: 804, + End: 809, + EndIncludingLineBreak: 810, Span: { - Start: 785, + Start: 804, Length: 5 }, SpanIncludingLineBreak: { - Start: 785, + Start: 804, Length: 6 } }, { - LineNumber: 20, - Start: 791, - End: 792, - EndIncludingLineBreak: 793, + LineNumber: 23, + Start: 810, + End: 811, + EndIncludingLineBreak: 812, Span: { - Start: 791, + Start: 810, Length: 1 }, SpanIncludingLineBreak: { - Start: 791, + Start: 810, Length: 2 } }, { - LineNumber: 21, - Start: 793, - End: 799, - EndIncludingLineBreak: 800, + LineNumber: 24, + Start: 812, + End: 818, + EndIncludingLineBreak: 819, Span: { - Start: 793, + Start: 812, Length: 6 }, SpanIncludingLineBreak: { - Start: 793, + Start: 812, Length: 7 } }, { - LineNumber: 22, - Start: 800, - End: 800, - EndIncludingLineBreak: 800, + LineNumber: 25, + Start: 819, + End: 819, + EndIncludingLineBreak: 819, Span: { - Start: 800 + Start: 819 }, SpanIncludingLineBreak: { - Start: 800 + Start: 819 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt index 58e7227be3..bb829d808c 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, - Length: 801, + Length: 820, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -23,6 +23,9 @@ // #if NET5_0_OR_GREATER + +#nullable enable + namespace Sentry.Generated { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Sentry.SourceGenerators", "Version")] @@ -40,7 +43,7 @@ namespace Sentry.Generated } #endif , - Length: 801, + Length: 820, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -127,237 +130,277 @@ namespace Sentry.Generated { LineNumber: 6, Start: 217, - End: 243, - EndIncludingLineBreak: 244, + End: 217, + EndIncludingLineBreak: 218, Span: { + Start: 217 + }, + SpanIncludingLineBreak: { Start: 217, + Length: 1 + } + }, + { + LineNumber: 7, + Start: 218, + End: 234, + EndIncludingLineBreak: 235, + Span: { + Start: 218, + Length: 16 + }, + SpanIncludingLineBreak: { + Start: 218, + Length: 17 + } + }, + { + LineNumber: 8, + Start: 235, + End: 235, + EndIncludingLineBreak: 236, + Span: { + Start: 235 + }, + SpanIncludingLineBreak: { + Start: 235, + Length: 1 + } + }, + { + LineNumber: 9, + Start: 236, + End: 262, + EndIncludingLineBreak: 263, + Span: { + Start: 236, Length: 26 }, SpanIncludingLineBreak: { - Start: 217, + Start: 236, Length: 27 } }, { - LineNumber: 7, - Start: 244, - End: 245, - EndIncludingLineBreak: 246, + LineNumber: 10, + Start: 263, + End: 264, + EndIncludingLineBreak: 265, Span: { - Start: 244, + Start: 263, Length: 1 }, SpanIncludingLineBreak: { - Start: 244, + Start: 263, Length: 2 } }, { - LineNumber: 8, - Start: 246, - End: 345, - EndIncludingLineBreak: 346, + LineNumber: 11, + Start: 265, + End: 364, + EndIncludingLineBreak: 365, Span: { - Start: 246, + Start: 265, Length: 99 }, SpanIncludingLineBreak: { - Start: 246, + Start: 265, Length: 100 } }, { - LineNumber: 9, - Start: 346, - End: 394, - EndIncludingLineBreak: 395, + LineNumber: 12, + Start: 365, + End: 413, + EndIncludingLineBreak: 414, Span: { - Start: 346, + Start: 365, Length: 48 }, SpanIncludingLineBreak: { - Start: 346, + Start: 365, Length: 49 } }, { - LineNumber: 10, - Start: 395, - End: 400, - EndIncludingLineBreak: 401, + LineNumber: 13, + Start: 414, + End: 419, + EndIncludingLineBreak: 420, Span: { - Start: 395, + Start: 414, Length: 5 }, SpanIncludingLineBreak: { - Start: 395, + Start: 414, Length: 6 } }, { - LineNumber: 11, - Start: 401, - End: 468, - EndIncludingLineBreak: 469, + LineNumber: 14, + Start: 420, + End: 487, + EndIncludingLineBreak: 488, Span: { - Start: 401, + Start: 420, Length: 67 }, SpanIncludingLineBreak: { - Start: 401, + Start: 420, Length: 68 } }, { - LineNumber: 12, - Start: 469, - End: 508, - EndIncludingLineBreak: 509, + LineNumber: 15, + Start: 488, + End: 527, + EndIncludingLineBreak: 528, Span: { - Start: 469, + Start: 488, Length: 39 }, SpanIncludingLineBreak: { - Start: 469, + Start: 488, Length: 40 } }, { - LineNumber: 13, - Start: 509, - End: 518, - EndIncludingLineBreak: 519, + LineNumber: 16, + Start: 528, + End: 537, + EndIncludingLineBreak: 538, Span: { - Start: 509, + Start: 528, Length: 9 }, SpanIncludingLineBreak: { - Start: 509, + Start: 528, Length: 10 } }, { - LineNumber: 14, - Start: 519, - End: 704, - EndIncludingLineBreak: 705, + LineNumber: 17, + Start: 538, + End: 723, + EndIncludingLineBreak: 724, Span: { - Start: 519, + Start: 538, Length: 185 }, SpanIncludingLineBreak: { - Start: 519, + Start: 538, Length: 186 } }, { - LineNumber: 15, - Start: 705, - End: 718, - EndIncludingLineBreak: 719, + LineNumber: 18, + Start: 724, + End: 737, + EndIncludingLineBreak: 738, Span: { - Start: 705, + Start: 724, Length: 13 }, SpanIncludingLineBreak: { - Start: 705, + Start: 724, Length: 14 } }, { - LineNumber: 16, - Start: 719, - End: 759, - EndIncludingLineBreak: 760, + LineNumber: 19, + Start: 738, + End: 778, + EndIncludingLineBreak: 779, Span: { - Start: 719, + Start: 738, Length: 40 }, SpanIncludingLineBreak: { - Start: 719, + Start: 738, Length: 41 } }, { - LineNumber: 17, - Start: 760, - End: 775, - EndIncludingLineBreak: 776, + LineNumber: 20, + Start: 779, + End: 794, + EndIncludingLineBreak: 795, Span: { - Start: 760, + Start: 779, Length: 15 }, SpanIncludingLineBreak: { - Start: 760, + Start: 779, Length: 16 } }, { - LineNumber: 18, - Start: 776, - End: 785, - EndIncludingLineBreak: 786, + LineNumber: 21, + Start: 795, + End: 804, + EndIncludingLineBreak: 805, Span: { - Start: 776, + Start: 795, Length: 9 }, SpanIncludingLineBreak: { - Start: 776, + Start: 795, Length: 10 } }, { - LineNumber: 19, - Start: 786, - End: 791, - EndIncludingLineBreak: 792, + LineNumber: 22, + Start: 805, + End: 810, + EndIncludingLineBreak: 811, Span: { - Start: 786, + Start: 805, Length: 5 }, SpanIncludingLineBreak: { - Start: 786, + Start: 805, Length: 6 } }, { - LineNumber: 20, - Start: 792, - End: 793, - EndIncludingLineBreak: 794, + LineNumber: 23, + Start: 811, + End: 812, + EndIncludingLineBreak: 813, Span: { - Start: 792, + Start: 811, Length: 1 }, SpanIncludingLineBreak: { - Start: 792, + Start: 811, Length: 2 } }, { - LineNumber: 21, - Start: 794, - End: 800, - EndIncludingLineBreak: 801, + LineNumber: 24, + Start: 813, + End: 819, + EndIncludingLineBreak: 820, Span: { - Start: 794, + Start: 813, Length: 6 }, SpanIncludingLineBreak: { - Start: 794, + Start: 813, Length: 7 } }, { - LineNumber: 22, - Start: 801, - End: 801, - EndIncludingLineBreak: 801, + LineNumber: 25, + Start: 820, + End: 820, + EndIncludingLineBreak: 820, Span: { - Start: 801 + Start: 820 }, SpanIncludingLineBreak: { - Start: 801 + Start: 820 } } ] From a6860a95ada2aba403c7de576b777c7dcc8ed2b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Wed, 9 Jul 2025 17:07:36 +0200 Subject: [PATCH 13/21] ref: make generated type and member internal --- .../BuildPropertySourceGenerator.cs | 4 +- ...torTests.RunResult_BadStrings.verified.txt | 150 +++++++++--------- ...sts.RunResult_Publish_AotTrue.verified.txt | 150 +++++++++--------- ...eratorTests.RunResult_Success.verified.txt | 150 +++++++++--------- 4 files changed, 227 insertions(+), 227 deletions(-) diff --git a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs index 3626eb31b8..e175fdcb50 100644 --- a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs +++ b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs @@ -59,10 +59,10 @@ public void Execute(GeneratorExecutionContext context) namespace Sentry.Generated { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("{{GeneratedCodeText.Tool}}", "{{GeneratedCodeText.Version}}")] - public static class BuildPropertyInitializer + internal static class BuildPropertyInitializer { [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) { diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt index bc81f01bf8..606a094ab9 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, - Length: 822, + Length: 826, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -29,10 +29,10 @@ namespace Sentry.Generated { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Sentry.SourceGenerators", "Version")] - public static class BuildPropertyInitializer + internal static class BuildPropertyInitializer { [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) { @@ -43,7 +43,7 @@ namespace Sentry.Generated } #endif , - Length: 822, + Length: 826, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -212,195 +212,195 @@ namespace Sentry.Generated { LineNumber: 12, Start: 365, - End: 413, - EndIncludingLineBreak: 414, + End: 415, + EndIncludingLineBreak: 416, Span: { Start: 365, - Length: 48 + Length: 50 }, SpanIncludingLineBreak: { Start: 365, - Length: 49 + Length: 51 } }, { LineNumber: 13, - Start: 414, - End: 419, - EndIncludingLineBreak: 420, + Start: 416, + End: 421, + EndIncludingLineBreak: 422, Span: { - Start: 414, + Start: 416, Length: 5 }, SpanIncludingLineBreak: { - Start: 414, + Start: 416, Length: 6 } }, { LineNumber: 14, - Start: 420, - End: 487, - EndIncludingLineBreak: 488, + Start: 422, + End: 489, + EndIncludingLineBreak: 490, Span: { - Start: 420, + Start: 422, Length: 67 }, SpanIncludingLineBreak: { - Start: 420, + Start: 422, Length: 68 } }, { LineNumber: 15, - Start: 488, - End: 527, - EndIncludingLineBreak: 528, + Start: 490, + End: 531, + EndIncludingLineBreak: 532, Span: { - Start: 488, - Length: 39 + Start: 490, + Length: 41 }, SpanIncludingLineBreak: { - Start: 488, - Length: 40 + Start: 490, + Length: 42 } }, { LineNumber: 16, - Start: 528, - End: 537, - EndIncludingLineBreak: 538, + Start: 532, + End: 541, + EndIncludingLineBreak: 542, Span: { - Start: 528, + Start: 532, Length: 9 }, SpanIncludingLineBreak: { - Start: 528, + Start: 532, Length: 10 } }, { LineNumber: 17, - Start: 538, - End: 723, - EndIncludingLineBreak: 724, + Start: 542, + End: 727, + EndIncludingLineBreak: 728, Span: { - Start: 538, + Start: 542, Length: 185 }, SpanIncludingLineBreak: { - Start: 538, + Start: 542, Length: 186 } }, { LineNumber: 18, - Start: 724, - End: 737, - EndIncludingLineBreak: 738, + Start: 728, + End: 741, + EndIncludingLineBreak: 742, Span: { - Start: 724, + Start: 728, Length: 13 }, SpanIncludingLineBreak: { - Start: 724, + Start: 728, Length: 14 } }, { LineNumber: 19, - Start: 738, - End: 780, - EndIncludingLineBreak: 781, + Start: 742, + End: 784, + EndIncludingLineBreak: 785, Span: { - Start: 738, + Start: 742, Length: 42 }, SpanIncludingLineBreak: { - Start: 738, + Start: 742, Length: 43 } }, { LineNumber: 20, - Start: 781, - End: 796, - EndIncludingLineBreak: 797, + Start: 785, + End: 800, + EndIncludingLineBreak: 801, Span: { - Start: 781, + Start: 785, Length: 15 }, SpanIncludingLineBreak: { - Start: 781, + Start: 785, Length: 16 } }, { LineNumber: 21, - Start: 797, - End: 806, - EndIncludingLineBreak: 807, + Start: 801, + End: 810, + EndIncludingLineBreak: 811, Span: { - Start: 797, + Start: 801, Length: 9 }, SpanIncludingLineBreak: { - Start: 797, + Start: 801, Length: 10 } }, { LineNumber: 22, - Start: 807, - End: 812, - EndIncludingLineBreak: 813, + Start: 811, + End: 816, + EndIncludingLineBreak: 817, Span: { - Start: 807, + Start: 811, Length: 5 }, SpanIncludingLineBreak: { - Start: 807, + Start: 811, Length: 6 } }, { LineNumber: 23, - Start: 813, - End: 814, - EndIncludingLineBreak: 815, + Start: 817, + End: 818, + EndIncludingLineBreak: 819, Span: { - Start: 813, + Start: 817, Length: 1 }, SpanIncludingLineBreak: { - Start: 813, + Start: 817, Length: 2 } }, { LineNumber: 24, - Start: 815, - End: 821, - EndIncludingLineBreak: 822, + Start: 819, + End: 825, + EndIncludingLineBreak: 826, Span: { - Start: 815, + Start: 819, Length: 6 }, SpanIncludingLineBreak: { - Start: 815, + Start: 819, Length: 7 } }, { LineNumber: 25, - Start: 822, - End: 822, - EndIncludingLineBreak: 822, + Start: 826, + End: 826, + EndIncludingLineBreak: 826, Span: { - Start: 822 + Start: 826 }, SpanIncludingLineBreak: { - Start: 822 + Start: 826 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt index 6b8caef849..1dda7b32a3 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, - Length: 819, + Length: 823, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -29,10 +29,10 @@ namespace Sentry.Generated { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Sentry.SourceGenerators", "Version")] - public static class BuildPropertyInitializer + internal static class BuildPropertyInitializer { [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) { @@ -43,7 +43,7 @@ namespace Sentry.Generated } #endif , - Length: 819, + Length: 823, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -212,195 +212,195 @@ namespace Sentry.Generated { LineNumber: 12, Start: 365, - End: 413, - EndIncludingLineBreak: 414, + End: 415, + EndIncludingLineBreak: 416, Span: { Start: 365, - Length: 48 + Length: 50 }, SpanIncludingLineBreak: { Start: 365, - Length: 49 + Length: 51 } }, { LineNumber: 13, - Start: 414, - End: 419, - EndIncludingLineBreak: 420, + Start: 416, + End: 421, + EndIncludingLineBreak: 422, Span: { - Start: 414, + Start: 416, Length: 5 }, SpanIncludingLineBreak: { - Start: 414, + Start: 416, Length: 6 } }, { LineNumber: 14, - Start: 420, - End: 487, - EndIncludingLineBreak: 488, + Start: 422, + End: 489, + EndIncludingLineBreak: 490, Span: { - Start: 420, + Start: 422, Length: 67 }, SpanIncludingLineBreak: { - Start: 420, + Start: 422, Length: 68 } }, { LineNumber: 15, - Start: 488, - End: 527, - EndIncludingLineBreak: 528, + Start: 490, + End: 531, + EndIncludingLineBreak: 532, Span: { - Start: 488, - Length: 39 + Start: 490, + Length: 41 }, SpanIncludingLineBreak: { - Start: 488, - Length: 40 + Start: 490, + Length: 42 } }, { LineNumber: 16, - Start: 528, - End: 537, - EndIncludingLineBreak: 538, + Start: 532, + End: 541, + EndIncludingLineBreak: 542, Span: { - Start: 528, + Start: 532, Length: 9 }, SpanIncludingLineBreak: { - Start: 528, + Start: 532, Length: 10 } }, { LineNumber: 17, - Start: 538, - End: 723, - EndIncludingLineBreak: 724, + Start: 542, + End: 727, + EndIncludingLineBreak: 728, Span: { - Start: 538, + Start: 542, Length: 185 }, SpanIncludingLineBreak: { - Start: 538, + Start: 542, Length: 186 } }, { LineNumber: 18, - Start: 724, - End: 737, - EndIncludingLineBreak: 738, + Start: 728, + End: 741, + EndIncludingLineBreak: 742, Span: { - Start: 724, + Start: 728, Length: 13 }, SpanIncludingLineBreak: { - Start: 724, + Start: 728, Length: 14 } }, { LineNumber: 19, - Start: 738, - End: 777, - EndIncludingLineBreak: 778, + Start: 742, + End: 781, + EndIncludingLineBreak: 782, Span: { - Start: 738, + Start: 742, Length: 39 }, SpanIncludingLineBreak: { - Start: 738, + Start: 742, Length: 40 } }, { LineNumber: 20, - Start: 778, - End: 793, - EndIncludingLineBreak: 794, + Start: 782, + End: 797, + EndIncludingLineBreak: 798, Span: { - Start: 778, + Start: 782, Length: 15 }, SpanIncludingLineBreak: { - Start: 778, + Start: 782, Length: 16 } }, { LineNumber: 21, - Start: 794, - End: 803, - EndIncludingLineBreak: 804, + Start: 798, + End: 807, + EndIncludingLineBreak: 808, Span: { - Start: 794, + Start: 798, Length: 9 }, SpanIncludingLineBreak: { - Start: 794, + Start: 798, Length: 10 } }, { LineNumber: 22, - Start: 804, - End: 809, - EndIncludingLineBreak: 810, + Start: 808, + End: 813, + EndIncludingLineBreak: 814, Span: { - Start: 804, + Start: 808, Length: 5 }, SpanIncludingLineBreak: { - Start: 804, + Start: 808, Length: 6 } }, { LineNumber: 23, - Start: 810, - End: 811, - EndIncludingLineBreak: 812, + Start: 814, + End: 815, + EndIncludingLineBreak: 816, Span: { - Start: 810, + Start: 814, Length: 1 }, SpanIncludingLineBreak: { - Start: 810, + Start: 814, Length: 2 } }, { LineNumber: 24, - Start: 812, - End: 818, - EndIncludingLineBreak: 819, + Start: 816, + End: 822, + EndIncludingLineBreak: 823, Span: { - Start: 812, + Start: 816, Length: 6 }, SpanIncludingLineBreak: { - Start: 812, + Start: 816, Length: 7 } }, { LineNumber: 25, - Start: 819, - End: 819, - EndIncludingLineBreak: 819, + Start: 823, + End: 823, + EndIncludingLineBreak: 823, Span: { - Start: 819 + Start: 823 }, SpanIncludingLineBreak: { - Start: 819 + Start: 823 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt index bb829d808c..5383fb74f8 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, - Length: 820, + Length: 824, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -29,10 +29,10 @@ namespace Sentry.Generated { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Sentry.SourceGenerators", "Version")] - public static class BuildPropertyInitializer + internal static class BuildPropertyInitializer { [global::System.Runtime.CompilerServices.ModuleInitializer] - public static void Initialize() + internal static void Initialize() { global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) { @@ -43,7 +43,7 @@ namespace Sentry.Generated } #endif , - Length: 820, + Length: 824, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -212,195 +212,195 @@ namespace Sentry.Generated { LineNumber: 12, Start: 365, - End: 413, - EndIncludingLineBreak: 414, + End: 415, + EndIncludingLineBreak: 416, Span: { Start: 365, - Length: 48 + Length: 50 }, SpanIncludingLineBreak: { Start: 365, - Length: 49 + Length: 51 } }, { LineNumber: 13, - Start: 414, - End: 419, - EndIncludingLineBreak: 420, + Start: 416, + End: 421, + EndIncludingLineBreak: 422, Span: { - Start: 414, + Start: 416, Length: 5 }, SpanIncludingLineBreak: { - Start: 414, + Start: 416, Length: 6 } }, { LineNumber: 14, - Start: 420, - End: 487, - EndIncludingLineBreak: 488, + Start: 422, + End: 489, + EndIncludingLineBreak: 490, Span: { - Start: 420, + Start: 422, Length: 67 }, SpanIncludingLineBreak: { - Start: 420, + Start: 422, Length: 68 } }, { LineNumber: 15, - Start: 488, - End: 527, - EndIncludingLineBreak: 528, + Start: 490, + End: 531, + EndIncludingLineBreak: 532, Span: { - Start: 488, - Length: 39 + Start: 490, + Length: 41 }, SpanIncludingLineBreak: { - Start: 488, - Length: 40 + Start: 490, + Length: 42 } }, { LineNumber: 16, - Start: 528, - End: 537, - EndIncludingLineBreak: 538, + Start: 532, + End: 541, + EndIncludingLineBreak: 542, Span: { - Start: 528, + Start: 532, Length: 9 }, SpanIncludingLineBreak: { - Start: 528, + Start: 532, Length: 10 } }, { LineNumber: 17, - Start: 538, - End: 723, - EndIncludingLineBreak: 724, + Start: 542, + End: 727, + EndIncludingLineBreak: 728, Span: { - Start: 538, + Start: 542, Length: 185 }, SpanIncludingLineBreak: { - Start: 538, + Start: 542, Length: 186 } }, { LineNumber: 18, - Start: 724, - End: 737, - EndIncludingLineBreak: 738, + Start: 728, + End: 741, + EndIncludingLineBreak: 742, Span: { - Start: 724, + Start: 728, Length: 13 }, SpanIncludingLineBreak: { - Start: 724, + Start: 728, Length: 14 } }, { LineNumber: 19, - Start: 738, - End: 778, - EndIncludingLineBreak: 779, + Start: 742, + End: 782, + EndIncludingLineBreak: 783, Span: { - Start: 738, + Start: 742, Length: 40 }, SpanIncludingLineBreak: { - Start: 738, + Start: 742, Length: 41 } }, { LineNumber: 20, - Start: 779, - End: 794, - EndIncludingLineBreak: 795, + Start: 783, + End: 798, + EndIncludingLineBreak: 799, Span: { - Start: 779, + Start: 783, Length: 15 }, SpanIncludingLineBreak: { - Start: 779, + Start: 783, Length: 16 } }, { LineNumber: 21, - Start: 795, - End: 804, - EndIncludingLineBreak: 805, + Start: 799, + End: 808, + EndIncludingLineBreak: 809, Span: { - Start: 795, + Start: 799, Length: 9 }, SpanIncludingLineBreak: { - Start: 795, + Start: 799, Length: 10 } }, { LineNumber: 22, - Start: 805, - End: 810, - EndIncludingLineBreak: 811, + Start: 809, + End: 814, + EndIncludingLineBreak: 815, Span: { - Start: 805, + Start: 809, Length: 5 }, SpanIncludingLineBreak: { - Start: 805, + Start: 809, Length: 6 } }, { LineNumber: 23, - Start: 811, - End: 812, - EndIncludingLineBreak: 813, + Start: 815, + End: 816, + EndIncludingLineBreak: 817, Span: { - Start: 811, + Start: 815, Length: 1 }, SpanIncludingLineBreak: { - Start: 811, + Start: 815, Length: 2 } }, { LineNumber: 24, - Start: 813, - End: 819, - EndIncludingLineBreak: 820, + Start: 817, + End: 823, + EndIncludingLineBreak: 824, Span: { - Start: 813, + Start: 817, Length: 6 }, SpanIncludingLineBreak: { - Start: 813, + Start: 817, Length: 7 } }, { LineNumber: 25, - Start: 820, - End: 820, - EndIncludingLineBreak: 820, + Start: 824, + End: 824, + EndIncludingLineBreak: 824, Span: { - Start: 820 + Start: 824 }, SpanIncludingLineBreak: { - Start: 820 + Start: 824 } } ] From 6b8e22eb139518e00b7c374fe685e0e064fd71c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Wed, 9 Jul 2025 17:16:51 +0200 Subject: [PATCH 14/21] docs: add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 746dce81fb..a272be456b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Sentry now decompresses Request bodies in ASP.NET Core when RequestDecompression middleware is enabled ([#4315](https://github.com/getsentry/sentry-dotnet/pull/4315)) - Custom ISentryEventProcessors are now run for native iOS events ([#4318](https://github.com/getsentry/sentry-dotnet/pull/4318)) - Crontab validation when capturing checkins ([#4314](https://github.com/getsentry/sentry-dotnet/pull/4314)) +- BuildProperty-Generator emits sources when consuming project is an Application ([#4333](https://github.com/getsentry/sentry-dotnet/pull/4333)) - Native AOT: link to static `lzma` on Linux/MUSL ([#4326](https://github.com/getsentry/sentry-dotnet/pull/4326)) ### Dependencies From 9d644c4a1b58f41f4bef191d1c7589dc2b8ecace Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Thu, 10 Jul 2025 16:40:39 +1200 Subject: [PATCH 15/21] Implemented missing logic for AotHelper + some diagnostics --- src/Sentry/Internal/AotHelper.cs | 31 +++++++++++++------ src/Sentry/SentrySdk.cs | 1 + .../Sentry.SourceGenerators.targets | 4 ++- src/Sentry/buildTransitive/Sentry.targets | 4 ++- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/Sentry/Internal/AotHelper.cs b/src/Sentry/Internal/AotHelper.cs index a10449e6fe..09e54a0153 100644 --- a/src/Sentry/Internal/AotHelper.cs +++ b/src/Sentry/Internal/AotHelper.cs @@ -1,4 +1,6 @@ +using System; using Sentry.CompilerServices; +using Sentry.Extensibility; namespace Sentry.Internal; @@ -15,19 +17,30 @@ static AotHelper() [UnconditionalSuppressMessage("Trimming", "IL2026: RequiresUnreferencedCode", Justification = AvoidAtRuntime)] - private static bool CheckIsTrimmed() + internal static bool CheckIsTrimmed(IDiagnosticLogger? logger = null) { - if (TryGetBoolean("publishtrimmed", out var trimmed)) + if (TryGetBoolean("_IsPublishing", out var isPublishing) && isPublishing) { - return trimmed; - } + logger?.LogDebug("Detected _IsPublishing"); + if (TryGetBoolean("PublishSelfContained", out var selfContained) && selfContained) + { + logger?.LogDebug("Detected PublishSelfContained"); + if (TryGetBoolean("PublishTrimmed", out var trimmed)) + { + logger?.LogDebug("Detected PublishTrimmed"); + return trimmed; + } + } - if (TryGetBoolean("publishaot", out var aot)) - { - return aot; + if (TryGetBoolean("PublishAot", out var aot)) + { + logger?.LogDebug($"Detected PublishAot: {aot}"); + return aot; + } } // fallback check + logger?.LogDebug($"Stacktrace fallback"); var stackTrace = new StackTrace(false); return stackTrace.GetFrame(0)?.GetMethod() is null; } @@ -35,9 +48,9 @@ private static bool CheckIsTrimmed() private static bool TryGetBoolean(string key, out bool value) { value = false; - if (BuildProperties.Values?.TryGetValue(key, out var aotValue) ?? false) + if (BuildProperties.Values?.TryGetValue(key, out string? stringValue) ?? false) { - if (bool.TryParse(aotValue, out var result)) + if (bool.TryParse(stringValue, out var result)) { value = result; return true; diff --git a/src/Sentry/SentrySdk.cs b/src/Sentry/SentrySdk.cs index 4317314014..726fbb4d6e 100644 --- a/src/Sentry/SentrySdk.cs +++ b/src/Sentry/SentrySdk.cs @@ -51,6 +51,7 @@ internal static IHub InitHub(SentryOptions options) #pragma warning disable CS0162 // Unreachable code detected #pragma warning disable 0162 // Unreachable code on old .NET frameworks + AotHelper.CheckIsTrimmed(options.DiagnosticLogger); options.LogDebug(AotHelper.IsTrimmed ? "This looks like a Native AOT application build." : "This doesn't look like a Native AOT application build." diff --git a/src/Sentry/buildTransitive/Sentry.SourceGenerators.targets b/src/Sentry/buildTransitive/Sentry.SourceGenerators.targets index 292d49e34b..a5fa10712e 100644 --- a/src/Sentry/buildTransitive/Sentry.SourceGenerators.targets +++ b/src/Sentry/buildTransitive/Sentry.SourceGenerators.targets @@ -1,8 +1,10 @@ + - + + diff --git a/src/Sentry/buildTransitive/Sentry.targets b/src/Sentry/buildTransitive/Sentry.targets index c2f12b2763..3cbdd2340f 100644 --- a/src/Sentry/buildTransitive/Sentry.targets +++ b/src/Sentry/buildTransitive/Sentry.targets @@ -6,9 +6,11 @@ + - + + From 8fbade972cf23795ade86dca05a4c7686ae0f4ef Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Thu, 10 Jul 2025 19:57:04 +1200 Subject: [PATCH 16/21] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a272be456b..ed60859921 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ - Sentry now decompresses Request bodies in ASP.NET Core when RequestDecompression middleware is enabled ([#4315](https://github.com/getsentry/sentry-dotnet/pull/4315)) - Custom ISentryEventProcessors are now run for native iOS events ([#4318](https://github.com/getsentry/sentry-dotnet/pull/4318)) - Crontab validation when capturing checkins ([#4314](https://github.com/getsentry/sentry-dotnet/pull/4314)) -- BuildProperty-Generator emits sources when consuming project is an Application ([#4333](https://github.com/getsentry/sentry-dotnet/pull/4333)) +- Fixed an issue with the way Sentry detects build settings. This was causing Sentry to produce code that would could fail at runtime in AOT compiled applications. ([#4333](https://github.com/getsentry/sentry-dotnet/pull/4333)) - Native AOT: link to static `lzma` on Linux/MUSL ([#4326](https://github.com/getsentry/sentry-dotnet/pull/4326)) ### Dependencies From 521035330523b13503f890496bb984e3c274e0a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Thu, 10 Jul 2025 10:36:05 +0200 Subject: [PATCH 17/21] ref: append Attribute-suffix for consistency --- .../BuildPropertySourceGenerator.cs | 2 +- ...torTests.RunResult_BadStrings.verified.txt | 124 +++++++++--------- ...sts.RunResult_Publish_AotTrue.verified.txt | 124 +++++++++--------- ...eratorTests.RunResult_Success.verified.txt | 124 +++++++++--------- 4 files changed, 187 insertions(+), 187 deletions(-) diff --git a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs index e175fdcb50..2bd300cad0 100644 --- a/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs +++ b/src/Sentry.SourceGenerators/BuildPropertySourceGenerator.cs @@ -61,7 +61,7 @@ namespace Sentry.Generated [global::System.CodeDom.Compiler.GeneratedCodeAttribute("{{GeneratedCodeText.Tool}}", "{{GeneratedCodeText.Version}}")] internal static class BuildPropertyInitializer { - [global::System.Runtime.CompilerServices.ModuleInitializer] + [global::System.Runtime.CompilerServices.ModuleInitializerAttribute] internal static void Initialize() { global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt index 606a094ab9..de008ecfea 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_BadStrings.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, - Length: 826, + Length: 835, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -31,7 +31,7 @@ namespace Sentry.Generated [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Sentry.SourceGenerators", "Version")] internal static class BuildPropertyInitializer { - [global::System.Runtime.CompilerServices.ModuleInitializer] + [global::System.Runtime.CompilerServices.ModuleInitializerAttribute] internal static void Initialize() { global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) @@ -43,7 +43,7 @@ namespace Sentry.Generated } #endif , - Length: 826, + Length: 835, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -240,167 +240,167 @@ namespace Sentry.Generated { LineNumber: 14, Start: 422, - End: 489, - EndIncludingLineBreak: 490, + End: 498, + EndIncludingLineBreak: 499, Span: { Start: 422, - Length: 67 + Length: 76 }, SpanIncludingLineBreak: { Start: 422, - Length: 68 + Length: 77 } }, { LineNumber: 15, - Start: 490, - End: 531, - EndIncludingLineBreak: 532, + Start: 499, + End: 540, + EndIncludingLineBreak: 541, Span: { - Start: 490, + Start: 499, Length: 41 }, SpanIncludingLineBreak: { - Start: 490, + Start: 499, Length: 42 } }, { LineNumber: 16, - Start: 532, - End: 541, - EndIncludingLineBreak: 542, + Start: 541, + End: 550, + EndIncludingLineBreak: 551, Span: { - Start: 532, + Start: 541, Length: 9 }, SpanIncludingLineBreak: { - Start: 532, + Start: 541, Length: 10 } }, { LineNumber: 17, - Start: 542, - End: 727, - EndIncludingLineBreak: 728, + Start: 551, + End: 736, + EndIncludingLineBreak: 737, Span: { - Start: 542, + Start: 551, Length: 185 }, SpanIncludingLineBreak: { - Start: 542, + Start: 551, Length: 186 } }, { LineNumber: 18, - Start: 728, - End: 741, - EndIncludingLineBreak: 742, + Start: 737, + End: 750, + EndIncludingLineBreak: 751, Span: { - Start: 728, + Start: 737, Length: 13 }, SpanIncludingLineBreak: { - Start: 728, + Start: 737, Length: 14 } }, { LineNumber: 19, - Start: 742, - End: 784, - EndIncludingLineBreak: 785, + Start: 751, + End: 793, + EndIncludingLineBreak: 794, Span: { - Start: 742, + Start: 751, Length: 42 }, SpanIncludingLineBreak: { - Start: 742, + Start: 751, Length: 43 } }, { LineNumber: 20, - Start: 785, - End: 800, - EndIncludingLineBreak: 801, + Start: 794, + End: 809, + EndIncludingLineBreak: 810, Span: { - Start: 785, + Start: 794, Length: 15 }, SpanIncludingLineBreak: { - Start: 785, + Start: 794, Length: 16 } }, { LineNumber: 21, - Start: 801, - End: 810, - EndIncludingLineBreak: 811, + Start: 810, + End: 819, + EndIncludingLineBreak: 820, Span: { - Start: 801, + Start: 810, Length: 9 }, SpanIncludingLineBreak: { - Start: 801, + Start: 810, Length: 10 } }, { LineNumber: 22, - Start: 811, - End: 816, - EndIncludingLineBreak: 817, + Start: 820, + End: 825, + EndIncludingLineBreak: 826, Span: { - Start: 811, + Start: 820, Length: 5 }, SpanIncludingLineBreak: { - Start: 811, + Start: 820, Length: 6 } }, { LineNumber: 23, - Start: 817, - End: 818, - EndIncludingLineBreak: 819, + Start: 826, + End: 827, + EndIncludingLineBreak: 828, Span: { - Start: 817, + Start: 826, Length: 1 }, SpanIncludingLineBreak: { - Start: 817, + Start: 826, Length: 2 } }, { LineNumber: 24, - Start: 819, - End: 825, - EndIncludingLineBreak: 826, + Start: 828, + End: 834, + EndIncludingLineBreak: 835, Span: { - Start: 819, + Start: 828, Length: 6 }, SpanIncludingLineBreak: { - Start: 819, + Start: 828, Length: 7 } }, { LineNumber: 25, - Start: 826, - End: 826, - EndIncludingLineBreak: 826, + Start: 835, + End: 835, + EndIncludingLineBreak: 835, Span: { - Start: 826 + Start: 835 }, SpanIncludingLineBreak: { - Start: 826 + Start: 835 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt index 1dda7b32a3..1fc38316d4 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Publish_AotTrue.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, - Length: 823, + Length: 832, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -31,7 +31,7 @@ namespace Sentry.Generated [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Sentry.SourceGenerators", "Version")] internal static class BuildPropertyInitializer { - [global::System.Runtime.CompilerServices.ModuleInitializer] + [global::System.Runtime.CompilerServices.ModuleInitializerAttribute] internal static void Initialize() { global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) @@ -43,7 +43,7 @@ namespace Sentry.Generated } #endif , - Length: 823, + Length: 832, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -240,167 +240,167 @@ namespace Sentry.Generated { LineNumber: 14, Start: 422, - End: 489, - EndIncludingLineBreak: 490, + End: 498, + EndIncludingLineBreak: 499, Span: { Start: 422, - Length: 67 + Length: 76 }, SpanIncludingLineBreak: { Start: 422, - Length: 68 + Length: 77 } }, { LineNumber: 15, - Start: 490, - End: 531, - EndIncludingLineBreak: 532, + Start: 499, + End: 540, + EndIncludingLineBreak: 541, Span: { - Start: 490, + Start: 499, Length: 41 }, SpanIncludingLineBreak: { - Start: 490, + Start: 499, Length: 42 } }, { LineNumber: 16, - Start: 532, - End: 541, - EndIncludingLineBreak: 542, + Start: 541, + End: 550, + EndIncludingLineBreak: 551, Span: { - Start: 532, + Start: 541, Length: 9 }, SpanIncludingLineBreak: { - Start: 532, + Start: 541, Length: 10 } }, { LineNumber: 17, - Start: 542, - End: 727, - EndIncludingLineBreak: 728, + Start: 551, + End: 736, + EndIncludingLineBreak: 737, Span: { - Start: 542, + Start: 551, Length: 185 }, SpanIncludingLineBreak: { - Start: 542, + Start: 551, Length: 186 } }, { LineNumber: 18, - Start: 728, - End: 741, - EndIncludingLineBreak: 742, + Start: 737, + End: 750, + EndIncludingLineBreak: 751, Span: { - Start: 728, + Start: 737, Length: 13 }, SpanIncludingLineBreak: { - Start: 728, + Start: 737, Length: 14 } }, { LineNumber: 19, - Start: 742, - End: 781, - EndIncludingLineBreak: 782, + Start: 751, + End: 790, + EndIncludingLineBreak: 791, Span: { - Start: 742, + Start: 751, Length: 39 }, SpanIncludingLineBreak: { - Start: 742, + Start: 751, Length: 40 } }, { LineNumber: 20, - Start: 782, - End: 797, - EndIncludingLineBreak: 798, + Start: 791, + End: 806, + EndIncludingLineBreak: 807, Span: { - Start: 782, + Start: 791, Length: 15 }, SpanIncludingLineBreak: { - Start: 782, + Start: 791, Length: 16 } }, { LineNumber: 21, - Start: 798, - End: 807, - EndIncludingLineBreak: 808, + Start: 807, + End: 816, + EndIncludingLineBreak: 817, Span: { - Start: 798, + Start: 807, Length: 9 }, SpanIncludingLineBreak: { - Start: 798, + Start: 807, Length: 10 } }, { LineNumber: 22, - Start: 808, - End: 813, - EndIncludingLineBreak: 814, + Start: 817, + End: 822, + EndIncludingLineBreak: 823, Span: { - Start: 808, + Start: 817, Length: 5 }, SpanIncludingLineBreak: { - Start: 808, + Start: 817, Length: 6 } }, { LineNumber: 23, - Start: 814, - End: 815, - EndIncludingLineBreak: 816, + Start: 823, + End: 824, + EndIncludingLineBreak: 825, Span: { - Start: 814, + Start: 823, Length: 1 }, SpanIncludingLineBreak: { - Start: 814, + Start: 823, Length: 2 } }, { LineNumber: 24, - Start: 816, - End: 822, - EndIncludingLineBreak: 823, + Start: 825, + End: 831, + EndIncludingLineBreak: 832, Span: { - Start: 816, + Start: 825, Length: 6 }, SpanIncludingLineBreak: { - Start: 816, + Start: 825, Length: 7 } }, { LineNumber: 25, - Start: 823, - End: 823, - EndIncludingLineBreak: 823, + Start: 832, + End: 832, + EndIncludingLineBreak: 832, Span: { - Start: 823 + Start: 832 }, SpanIncludingLineBreak: { - Start: 823 + Start: 832 } } ] diff --git a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt index 5383fb74f8..d94a9ca576 100644 --- a/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt +++ b/test/Sentry.SourceGenerators.Tests/BuildPropertySourceGeneratorTests.RunResult_Success.verified.txt @@ -5,7 +5,7 @@ SyntaxTree: { FilePath: Sentry.SourceGenerators/Sentry.SourceGenerators.BuildPropertySourceGenerator/Sentry.Generated.BuildPropertyInitializer.g.cs, Encoding: utf-8, - Length: 824, + Length: 833, HasCompilationUnitRoot: true, Options: { LanguageVersion: CSharp12, @@ -31,7 +31,7 @@ namespace Sentry.Generated [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Sentry.SourceGenerators", "Version")] internal static class BuildPropertyInitializer { - [global::System.Runtime.CompilerServices.ModuleInitializer] + [global::System.Runtime.CompilerServices.ModuleInitializerAttribute] internal static void Initialize() { global::Sentry.CompilerServices.BuildProperties.Initialize(new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase) @@ -43,7 +43,7 @@ namespace Sentry.Generated } #endif , - Length: 824, + Length: 833, ChecksumAlgorithm: Sha1, CanBeEmbedded: true, Container: {}, @@ -240,167 +240,167 @@ namespace Sentry.Generated { LineNumber: 14, Start: 422, - End: 489, - EndIncludingLineBreak: 490, + End: 498, + EndIncludingLineBreak: 499, Span: { Start: 422, - Length: 67 + Length: 76 }, SpanIncludingLineBreak: { Start: 422, - Length: 68 + Length: 77 } }, { LineNumber: 15, - Start: 490, - End: 531, - EndIncludingLineBreak: 532, + Start: 499, + End: 540, + EndIncludingLineBreak: 541, Span: { - Start: 490, + Start: 499, Length: 41 }, SpanIncludingLineBreak: { - Start: 490, + Start: 499, Length: 42 } }, { LineNumber: 16, - Start: 532, - End: 541, - EndIncludingLineBreak: 542, + Start: 541, + End: 550, + EndIncludingLineBreak: 551, Span: { - Start: 532, + Start: 541, Length: 9 }, SpanIncludingLineBreak: { - Start: 532, + Start: 541, Length: 10 } }, { LineNumber: 17, - Start: 542, - End: 727, - EndIncludingLineBreak: 728, + Start: 551, + End: 736, + EndIncludingLineBreak: 737, Span: { - Start: 542, + Start: 551, Length: 185 }, SpanIncludingLineBreak: { - Start: 542, + Start: 551, Length: 186 } }, { LineNumber: 18, - Start: 728, - End: 741, - EndIncludingLineBreak: 742, + Start: 737, + End: 750, + EndIncludingLineBreak: 751, Span: { - Start: 728, + Start: 737, Length: 13 }, SpanIncludingLineBreak: { - Start: 728, + Start: 737, Length: 14 } }, { LineNumber: 19, - Start: 742, - End: 782, - EndIncludingLineBreak: 783, + Start: 751, + End: 791, + EndIncludingLineBreak: 792, Span: { - Start: 742, + Start: 751, Length: 40 }, SpanIncludingLineBreak: { - Start: 742, + Start: 751, Length: 41 } }, { LineNumber: 20, - Start: 783, - End: 798, - EndIncludingLineBreak: 799, + Start: 792, + End: 807, + EndIncludingLineBreak: 808, Span: { - Start: 783, + Start: 792, Length: 15 }, SpanIncludingLineBreak: { - Start: 783, + Start: 792, Length: 16 } }, { LineNumber: 21, - Start: 799, - End: 808, - EndIncludingLineBreak: 809, + Start: 808, + End: 817, + EndIncludingLineBreak: 818, Span: { - Start: 799, + Start: 808, Length: 9 }, SpanIncludingLineBreak: { - Start: 799, + Start: 808, Length: 10 } }, { LineNumber: 22, - Start: 809, - End: 814, - EndIncludingLineBreak: 815, + Start: 818, + End: 823, + EndIncludingLineBreak: 824, Span: { - Start: 809, + Start: 818, Length: 5 }, SpanIncludingLineBreak: { - Start: 809, + Start: 818, Length: 6 } }, { LineNumber: 23, - Start: 815, - End: 816, - EndIncludingLineBreak: 817, + Start: 824, + End: 825, + EndIncludingLineBreak: 826, Span: { - Start: 815, + Start: 824, Length: 1 }, SpanIncludingLineBreak: { - Start: 815, + Start: 824, Length: 2 } }, { LineNumber: 24, - Start: 817, - End: 823, - EndIncludingLineBreak: 824, + Start: 826, + End: 832, + EndIncludingLineBreak: 833, Span: { - Start: 817, + Start: 826, Length: 6 }, SpanIncludingLineBreak: { - Start: 817, + Start: 826, Length: 7 } }, { LineNumber: 25, - Start: 824, - End: 824, - EndIncludingLineBreak: 824, + Start: 833, + End: 833, + EndIncludingLineBreak: 833, Span: { - Start: 824 + Start: 833 }, SpanIncludingLineBreak: { - Start: 824 + Start: 833 } } ] From 3f6a86f1b767df35acad2e8f51c9313549689fe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Thu, 10 Jul 2025 10:45:19 +0200 Subject: [PATCH 18/21] ref: remove redundant attribute --- src/Sentry/Internal/AotHelper.cs | 1 - .../Sentry.SourceGenerators.Tests/VerifySettingsInitializer.cs | 3 --- 2 files changed, 4 deletions(-) diff --git a/src/Sentry/Internal/AotHelper.cs b/src/Sentry/Internal/AotHelper.cs index 09e54a0153..191b7d00ad 100644 --- a/src/Sentry/Internal/AotHelper.cs +++ b/src/Sentry/Internal/AotHelper.cs @@ -15,7 +15,6 @@ static AotHelper() IsTrimmed = CheckIsTrimmed(); } - [UnconditionalSuppressMessage("Trimming", "IL2026: RequiresUnreferencedCode", Justification = AvoidAtRuntime)] internal static bool CheckIsTrimmed(IDiagnosticLogger? logger = null) { diff --git a/test/Sentry.SourceGenerators.Tests/VerifySettingsInitializer.cs b/test/Sentry.SourceGenerators.Tests/VerifySettingsInitializer.cs index cd627a7ac9..8142f145c6 100644 --- a/test/Sentry.SourceGenerators.Tests/VerifySettingsInitializer.cs +++ b/test/Sentry.SourceGenerators.Tests/VerifySettingsInitializer.cs @@ -1,5 +1,3 @@ -using System.CodeDom.Compiler; - namespace Sentry.SourceGenerators.Tests; internal static class VerifySettingsInitializer @@ -12,7 +10,6 @@ internal static void Initialize() VerifierSettings.AddScrubber(VersionScrubber); } - [GeneratedCode("", "")] private static void VersionScrubber(StringBuilder text) { if (s_assemblyName.Version is not null) From 0344f178cedd25325152be4bc0e0234b5ce7e542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Thu, 10 Jul 2025 10:55:20 +0200 Subject: [PATCH 19/21] build: delete Sentry.SourceGenerators.targets only "Sentry.targets" is picked up by a "PackageReference" and this file was never imported either --- .../Sentry.Samples.Android.csproj | 2 -- samples/Sentry.Samples.Ios/Sentry.Samples.Ios.csproj | 2 -- .../Sentry.Samples.MacCatalyst.csproj | 2 -- .../Sentry.Samples.Maui/Sentry.Samples.Maui.csproj | 2 -- src/Sentry/Sentry.csproj | 3 +-- .../buildTransitive/Sentry.SourceGenerators.targets | 11 ----------- src/Sentry/buildTransitive/Sentry.targets | 1 + 7 files changed, 2 insertions(+), 21 deletions(-) delete mode 100644 src/Sentry/buildTransitive/Sentry.SourceGenerators.targets diff --git a/samples/Sentry.Samples.Android/Sentry.Samples.Android.csproj b/samples/Sentry.Samples.Android/Sentry.Samples.Android.csproj index 61fcb9bc31..fdce591643 100644 --- a/samples/Sentry.Samples.Android/Sentry.Samples.Android.csproj +++ b/samples/Sentry.Samples.Android/Sentry.Samples.Android.csproj @@ -43,6 +43,4 @@ full - - diff --git a/samples/Sentry.Samples.Ios/Sentry.Samples.Ios.csproj b/samples/Sentry.Samples.Ios/Sentry.Samples.Ios.csproj index 25f4b66c46..c3eaafab7c 100644 --- a/samples/Sentry.Samples.Ios/Sentry.Samples.Ios.csproj +++ b/samples/Sentry.Samples.Ios/Sentry.Samples.Ios.csproj @@ -49,6 +49,4 @@ ReferenceOutputAssembly="false"/> - - diff --git a/samples/Sentry.Samples.MacCatalyst/Sentry.Samples.MacCatalyst.csproj b/samples/Sentry.Samples.MacCatalyst/Sentry.Samples.MacCatalyst.csproj index e48c894e34..50b58f7aed 100644 --- a/samples/Sentry.Samples.MacCatalyst/Sentry.Samples.MacCatalyst.csproj +++ b/samples/Sentry.Samples.MacCatalyst/Sentry.Samples.MacCatalyst.csproj @@ -49,6 +49,4 @@ ReferenceOutputAssembly="false"/> - - diff --git a/samples/Sentry.Samples.Maui/Sentry.Samples.Maui.csproj b/samples/Sentry.Samples.Maui/Sentry.Samples.Maui.csproj index f924e8f7c0..9f87848b21 100644 --- a/samples/Sentry.Samples.Maui/Sentry.Samples.Maui.csproj +++ b/samples/Sentry.Samples.Maui/Sentry.Samples.Maui.csproj @@ -115,6 +115,4 @@ - - diff --git a/src/Sentry/Sentry.csproj b/src/Sentry/Sentry.csproj index af70eed6de..b5b573852a 100644 --- a/src/Sentry/Sentry.csproj +++ b/src/Sentry/Sentry.csproj @@ -198,8 +198,6 @@ - - @@ -208,4 +206,5 @@ PackagePath="analyzers/dotnet/cs" Visible="false" /> + diff --git a/src/Sentry/buildTransitive/Sentry.SourceGenerators.targets b/src/Sentry/buildTransitive/Sentry.SourceGenerators.targets deleted file mode 100644 index a5fa10712e..0000000000 --- a/src/Sentry/buildTransitive/Sentry.SourceGenerators.targets +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/src/Sentry/buildTransitive/Sentry.targets b/src/Sentry/buildTransitive/Sentry.targets index 3cbdd2340f..f280eb4f1f 100644 --- a/src/Sentry/buildTransitive/Sentry.targets +++ b/src/Sentry/buildTransitive/Sentry.targets @@ -5,6 +5,7 @@ + From 560823f6b5de90ed9068d8df8bde408fdcf69646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Thu, 10 Jul 2025 10:57:21 +0200 Subject: [PATCH 20/21] ref: delete redundant string interpolation --- src/Sentry/Internal/AotHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sentry/Internal/AotHelper.cs b/src/Sentry/Internal/AotHelper.cs index 191b7d00ad..fe5156ab8f 100644 --- a/src/Sentry/Internal/AotHelper.cs +++ b/src/Sentry/Internal/AotHelper.cs @@ -39,7 +39,7 @@ internal static bool CheckIsTrimmed(IDiagnosticLogger? logger = null) } // fallback check - logger?.LogDebug($"Stacktrace fallback"); + logger?.LogDebug("Stacktrace fallback"); var stackTrace = new StackTrace(false); return stackTrace.GetFrame(0)?.GetMethod() is null; } From 9c8451d7efdd2db2e0d76a0d942244deed839475 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Sat, 12 Jul 2025 15:19:48 +1200 Subject: [PATCH 21/21] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7e2978001..72e2c924f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ - Sentry now decompresses Request bodies in ASP.NET Core when RequestDecompression middleware is enabled ([#4315](https://github.com/getsentry/sentry-dotnet/pull/4315)) - Custom ISentryEventProcessors are now run for native iOS events ([#4318](https://github.com/getsentry/sentry-dotnet/pull/4318)) - Crontab validation when capturing checkins ([#4314](https://github.com/getsentry/sentry-dotnet/pull/4314)) -- Fixed an issue with the way Sentry detects build settings. This was causing Sentry to produce code that would could fail at runtime in AOT compiled applications. ([#4333](https://github.com/getsentry/sentry-dotnet/pull/4333)) +- Fixed an issue with the way Sentry detects build settings. This was causing Sentry to produce code that could fail at runtime in AOT compiled applications. ([#4333](https://github.com/getsentry/sentry-dotnet/pull/4333)) - Native AOT: link to static `lzma` on Linux/MUSL ([#4326](https://github.com/getsentry/sentry-dotnet/pull/4326)) - AppDomain.CurrentDomain.ProcessExit hook is now removed on shutdown ([#4323](https://github.com/getsentry/sentry-dotnet/pull/4323))