Last active
August 30, 2023 21:34
-
-
Save TessenR/ab40df2d6e971a8d6e5c6c6295d85d11 to your computer and use it in GitHub Desktop.
Revisions
-
TessenR revised this gist
May 10, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -53,3 +53,4 @@ - Assembly-wide constants such as product version: https://github.com/kzu/ThisAssembly - Win32 P/Invoke methods and required types: https://github.com/microsoft/CsWin32 - Compile-time string literals to ReadOnlySpan<byte> conversion: https://github.com/ufcpp/StringLiteralGenerator - A good list of existing source generators: https://github.com/amis92/csharp-source-generators -
TessenR revised this gist
Feb 25, 2021 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,6 +28,9 @@ - How to utilize MSBuild properties from source generators - Documentation from Microsoft: https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.cookbook.md#consume-msbuild-properties-and-metadata - Blogpost with examples: https://jaylee.org/archive/2020/09/13/msbuild-items-and-properties-in-csharp9-sourcegenerators.html - My generator doesn't work with WPF. It's because of the intermediate projects used for building WPF that don't utilize generators. - Here's an issue for WPF: https://github.com/dotnet/wpf/issues/3404 - You can workaround the issue by adding `<IncludePackageReferencesDuringMarkupCompilation>true</IncludePackageReferencesDuringMarkupCompilation>` to your WPF project. This setting will be enabled by default soon. - Changes to partial methods in C# 9 - https://github.com/dotnet/csharplang/blob/master/proposals/csharp-9.0/extending-partial-methods.md -
TessenR revised this gist
Feb 24, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -48,4 +48,5 @@ - Github repository: https://github.com/trampster/JsonSrcGen - Blogpost introduction: https://trampster.blogspot.com/2020/09/jsonsrcgen-corert-pure-magic-in-my.html - Assembly-wide constants such as product version: https://github.com/kzu/ThisAssembly - Win32 P/Invoke methods and required types: https://github.com/microsoft/CsWin32 - Compile-time string literals to ReadOnlySpan<byte> conversion: https://github.com/ufcpp/StringLiteralGenerator -
TessenR revised this gist
Dec 2, 2020 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,8 @@ - Code used in the live coding demo at DotNext - https://github.com/TessenR/NotifyPropertyChangedDemo - A simple demo with NotifyPropertyChanged generator focused on being as simple as possible. It adds a property changed event to all types implementing INotifyPropertyChanged interface and adds properties raising this event for all fields with names ending with *BackingField suffix. It covers debugging, testing and simple generator code. - https://github.com/TessenR/BestPracticesSourceGeneratorsDemo - A demo focused on useful approaches to source generators' problems such as decresing their work time, producing diagnostics and configuration options. - Source generators introduction by Microsoft - Blog post: https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/ -
TessenR revised this gist
Nov 27, 2020 . 1 changed file with 19 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,16 @@ - Code used in the live coding demo at DotNext - https://github.com/TessenR/SourceGeneratorsDemo - Source generators introduction by Microsoft - Blog post: https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/ - Source generators cookbook: https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.cookbook.md - Online sandbox playground: https://sourcegen.dev - Source generator examples from Microsoft - INotifyPropertyChanged source generator implementation from Microsoft: https://github.com/dotnet/roslyn-sdk/blob/master/samples/CSharp/SourceGenerators/SourceGeneratorSamples/AutoNotifyGenerator.cs - Source code for all examples: https://github.com/dotnet/roslyn-sdk/tree/master/samples/CSharp/SourceGenerators - Blogpost with explanation and how-tos - https://devblogs.microsoft.com/dotnet/new-c-source-generator-samples/ - How to - Pack your generator in a nuget package: https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.cookbook.md#package-a-generator-as-a-nuget-package @@ -34,17 +26,23 @@ - Documentation from Microsoft: https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.cookbook.md#consume-msbuild-properties-and-metadata - Blogpost with examples: https://jaylee.org/archive/2020/09/13/msbuild-items-and-properties-in-csharp9-sourcegenerators.html - Changes to partial methods in C# 9 - https://github.com/dotnet/csharplang/blob/master/proposals/csharp-9.0/extending-partial-methods.md - IL weaving - Fody - Github repository with a list of add-ins: https://github.com/Fody/PropertyChanged - PostSharp: - Logging demo: - https://www.postsharp.net/logging - Code for logging examples - https://github.com/postsharp/PostSharp.Samples/tree/master/Diagnostics/PostSharp.Samples.Logging.NLog - Roslyn pull request replacing script-based code generation of C# syntax nodes from .xml file with source generator approach - https://github.com/dotnet/roslyn/pull/47252 - Examples of existing generators - Svg to SKPicture code: https://github.com/wieslawsoltes/SourceGenerators - Serialization to JSON withou reflection - Github repository: https://github.com/trampster/JsonSrcGen - Blogpost introduction: https://trampster.blogspot.com/2020/09/jsonsrcgen-corert-pure-magic-in-my.html - Assembly-wide constants such as product version: https://github.com/kzu/ThisAssembly - Compile-time string literals to ReadOnlySpan<byte> conversion: https://github.com/ufcpp/StringLiteralGenerator -
TessenR revised this gist
Nov 27, 2020 . 1 changed file with 39 additions and 47 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,52 +7,44 @@ - Source generators cookbook: https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.cookbook.md - IL weaving - Fody - Github repository with a list of add-ins: https://github.com/Fody/PropertyChanged - PostSharp: - Logging demo: - https://www.postsharp.net/logging - Code for logging examples - https://github.com/postsharp/PostSharp.Samples/tree/master/Diagnostics/PostSharp.Samples.Logging.NLog - JsonSrcGen - serialization to Json without reflection - Github repository: https://github.com/trampster/JsonSrcGen - Blogpost introduction: https://trampster.blogspot.com/2020/09/jsonsrcgen-corert-pure-magic-in-my.html - Roslyn pull request replacing script-based code generation of C# syntax nodes from .xml file with source generator approach - https://github.com/dotnet/roslyn/pull/47252 - How to - Pack your generator in a nuget package: https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.cookbook.md#package-a-generator-as-a-nuget-package - Declare and check dependencies of code produced by a source generator: https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.cookbook.md#use-functionality-from-nuget-packages - Use additional files from source generators - Declaration in .csproj: https://github.com/dotnet/roslyn/pull/47252/files#diff-5813a1e65423995c3e5401e8cf7f4fe29041c19767c9e10188e88b1cc39c3882R38 - Usage in a source generator: https://github.com/dotnet/roslyn/pull/47252/files#diff-bc078f8b0a1bfa7c287e5b0e5858682a10fb2753fc0afe582219c568a949be9bR54 - Provide additional properties to files available to source generators - How to declare a property for additional files: https://github.com/wieslawsoltes/SourceGenerators/blob/182b182fe2f2c1434aa98367edb30e944a9c7b3c/src/Svg.Skia.SourceGenerator/Svg.Skia.SourceGenerator.props#L4 - How to read the property in a source generator - https://github.com/wieslawsoltes/SourceGenerators/blob/182b182fe2f2c1434aa98367edb30e944a9c7b3c/src/Svg.Skia.SourceGenerator/SvgSourceGenerator.cs#L65 - How to provide the value of the property for a file - https://github.com/wieslawsoltes/SourceGenerators/blob/182b182fe2f2c1434aa98367edb30e944a9c7b3c/samples/Svg.Skia.SourceGenerator.Sample/Svg.Skia.SourceGenerator.Sample.csproj#L18 - How to utilize MSBuild properties from source generators - Documentation from Microsoft: https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.cookbook.md#consume-msbuild-properties-and-metadata - Blogpost with examples: https://jaylee.org/archive/2020/09/13/msbuild-items-and-properties-in-csharp9-sourcegenerators.html - Changes to partial methods in C# 9: https://github.com/dotnet/csharplang/blob/master/proposals/csharp-9.0/extending-partial-methods.md - Generator examples from Microsoft - INotifyPropertyChanged source generator implementation from Microsoft: https://github.com/dotnet/roslyn-sdk/blob/master/samples/CSharp/SourceGenerators/SourceGeneratorSamples/AutoNotifyGenerator.cs - Source code for all examples: https://github.com/dotnet/roslyn-sdk/tree/master/samples/CSharp/SourceGenerators - Blogpost with explanation and how-tos - https://devblogs.microsoft.com/dotnet/new-c-source-generator-samples/ - Online sandbox playground: https://sourcegen.dev - Examples of existing generators - Svg to SKPicture code: https://github.com/wieslawsoltes/SourceGenerators - Serialization to JSON withou reflection: https://github.com/trampster/JsonSrcGen - Assembly-wide constants such as product version: https://github.com/kzu/ThisAssembly - Compile-time string literals to ReadOnlySpan<byte> conversion: https://github.com/ufcpp/StringLiteralGenerator -
TessenR revised this gist
Nov 27, 2020 . 1 changed file with 8 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,15 @@ - Code used in the live coding demo at DotNext https://github.com/TessenR/SourceGeneratorsDemo - Source generators introduction by Microsoft - Blog post: https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/ - Source generators cookbook: https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.cookbook.md - IL weaving - Fody github repository: https://github.com/Fody/PropertyChanged - PostSharp: - Logging demo: - https://www.postsharp.net/logging Code for logging examples - https://github.com/postsharp/PostSharp.Samples/tree/master/Diagnostics/PostSharp.Samples.Logging.NLog JsonSrcGen - serialization to Json without reflection: -
TessenR revised this gist
Nov 27, 2020 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,4 @@ - Code used in the live coding demo at DotNext https://github.com/TessenR/SourceGeneratorsDemo Source generators introduction in a blog post from Microsoft: -
TessenR revised this gist
Nov 27, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ - Code used in the live coding demo at DotNext https://github.com/TessenR/SourceGeneratorsDemo Source generators introduction in a blog post from Microsoft: -
TessenR revised this gist
Nov 27, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ - Code used in the live coding demo at DotNext https://github.com/TessenR/SourceGeneratorsDemo Source generators introduction in a blog post from Microsoft: https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/ -
TessenR revised this gist
Nov 27, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ - Code used in the live coding demo at DotNext https://github.com/TessenR/SourceGeneratorsDemo Source generators introduction in a blog post from Microsoft: -
TessenR created this gist
Nov 25, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,60 @@ Code used in live coding demo https://github.com/TessenR/SourceGeneratorsDemo Source generators introduction in a blog post from Microsoft: https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/ Source generators cookbook from Microsoft: https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.cookbook.md Fody github repository: https://github.com/Fody/PropertyChanged PostSharp: Logging demo - https://www.postsharp.net/logging Code for logging examples - https://github.com/postsharp/PostSharp.Samples/tree/master/Diagnostics/PostSharp.Samples.Logging.NLog JsonSrcGen - serialization to Json without reflection: Github repository - https://github.com/trampster/JsonSrcGen Blogpost introduction - https://trampster.blogspot.com/2020/09/jsonsrcgen-corert-pure-magic-in-my.html Roslyn pull request replacing script-based code generation of C# syntax nodes from .xml file with source generator approach https://github.com/dotnet/roslyn/pull/47252 How to pack your generator in a nuget package https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.cookbook.md#package-a-generator-as-a-nuget-package - How to declare and check dependencies of code produced by a source generator https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.cookbook.md#use-functionality-from-nuget-packages How to use additional files from source generators Declaration in .csproj - https://github.com/dotnet/roslyn/pull/47252/files#diff-5813a1e65423995c3e5401e8cf7f4fe29041c19767c9e10188e88b1cc39c3882R38 Usage in a source generator - https://github.com/dotnet/roslyn/pull/47252/files#diff-bc078f8b0a1bfa7c287e5b0e5858682a10fb2753fc0afe582219c568a949be9bR54 How to add additional properties to files provided to source generators How to declare a property for additional files - https://github.com/wieslawsoltes/SourceGenerators/blob/182b182fe2f2c1434aa98367edb30e944a9c7b3c/src/Svg.Skia.SourceGenerator/Svg.Skia.SourceGenerator.props#L4 How to read the property in a source generator - https://github.com/wieslawsoltes/SourceGenerators/blob/182b182fe2f2c1434aa98367edb30e944a9c7b3c/src/Svg.Skia.SourceGenerator/SvgSourceGenerator.cs#L65 How to provide the value of the property for a file - https://github.com/wieslawsoltes/SourceGenerators/blob/182b182fe2f2c1434aa98367edb30e944a9c7b3c/samples/Svg.Skia.SourceGenerator.Sample/Svg.Skia.SourceGenerator.Sample.csproj#L18 How to utilize msbuild properties from source generators Documentation from Microsoft https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.cookbook.md#consume-msbuild-properties-and-metadata Blogpost with examples https://jaylee.org/archive/2020/09/13/msbuild-items-and-properties-in-csharp9-sourcegenerators.html INotifyPropertyChanged source generator implementation from Microsoft https://github.com/dotnet/roslyn-sdk/blob/master/samples/CSharp/SourceGenerators/SourceGeneratorSamples/AutoNotifyGenerator.cs Changes to partial methods in C# 9 https://github.com/dotnet/csharplang/blob/master/proposals/csharp-9.0/extending-partial-methods.md Generator examples from Microsoft Source code - https://github.com/dotnet/roslyn-sdk/tree/master/samples/CSharp/SourceGenerators Blogpost with explanation and how-tos - https://devblogs.microsoft.com/dotnet/new-c-source-generator-samples/ Online sandbox playground https://sourcegen.dev Examples Svg to SKPicture code - https://github.com/wieslawsoltes/SourceGenerators Serialization to JSON withou reflection - https://github.com/trampster/JsonSrcGen Assembly-wide constants such as product version - https://github.com/kzu/ThisAssembly Compile-time string literals to ReadOnlySpan<byte> conversion - https://github.com/ufcpp/StringLiteralGenerator