-
-
Notifications
You must be signed in to change notification settings - Fork 6
Add DecoratorGenerator example with demo project #430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DecoratorGenerator example with demo project #430
Conversation
Introduced a new example for the DecoratorGenerator source generator, including metadata in GeneratorDataRec.json and a complete demo project. The demo demonstrates decorating an IPerson interface, logging property access and method calls using a LogPerson decorator.
Added DecoratorGenerator as the 241st Roslyn Source Code Generator example, including new documentation, category, and example files. Updated README, about, and index files to reflect the new total and category. Included new tour, video, and supporting files for DecoratorGenerator, and updated category and generator lists accordingly.
Added a new example for DecoratorGenerator (RSCG #241), including its HTML documentation, entry in the list of RSCG examples, YAML configuration for Pandoc, and the associated source ZIP file.
WalkthroughThis PR introduces DecoratorGenerator as the 241st RSCG example. Changes include adding a new Decorator category enum value, creating an example project with interface, implementation, and decorator classes, adding metadata and description files, and updating documentation and data files across the website to reflect the new total count and category. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Areas to verify:
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
🧹 Nitpick comments (10)
v2/book/examples/DecoratorGenerator.html (1)
1-71: DecoratorGenerator example page looks consistent; only minor wording nitsThe structure, links, and screenshots integrate cleanly with the rest of the book examples. If you want extra polish, consider small text tweaks like “Adding decorators for classes/interfaces” instead of “adding decorator for classes/ interfaces”, but this is non-blocking.
v2/rscg_examples_site/docs/indexRSCG.md (1)
23-23: Minor: Extra space in link text.The link contains an extra space before the closing bracket. This is flagged by markdownlint.
Apply this diff:
-|241| [DecoratorGenerator by Leopoldo Fu ](/docs/DecoratorGenerator)|2025-11-10 => 10 November 2025 | [Decorator](/docs/Categories/Decorator) | +|241| [DecoratorGenerator by Leopoldo Fu](/docs/DecoratorGenerator)|2025-11-10 => 10 November 2025 | [Decorator](/docs/Categories/Decorator) |v2/rscg_examples_site/docs/Categories/Decorator.md (1)
1-6: LGTM! (Minor: Consider adding trailing newline)The Decorator category page is properly structured with the correct reference to DecoratorGenerator.
Some projects enforce a trailing newline at the end of files via .editorconfig for consistency.
v2/rscg_examples/DecoratorGenerator/description.json (3)
15-16: Avoid empty-string array entries; use empty arrays or omit keys.Empty strings can leak into tooling. Prefer [] or remove the keys when not used.
- "excludeDirectoryGenerated":[""], - "includeAdditionalFiles":[""] + "excludeDirectoryGenerated": [], + "includeAdditionalFiles": []
12-12: Tighten “goodFor” phrasing.Small clarity tweak.
- "goodFor":["adding decorator for classes/ interfaces"], + "goodFor":["generating decorators for classes and interfaces"],
4-9: Link vs source: consider pointing “link” to the docs page.If “link” is intended for the example/docs page, set it to the site URL and keep “source” for GitHub.
- "link":"https://github.com/CodingFlow/decorator-generator", + "link":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/DecoratorGenerator", "author":"Leopoldo Fu", "source":"https://github.com/CodingFlow/decorator-generator"v2/rscg_examples/DecoratorGenerator/readme.txt (3)
88-88: Hyphenate “third-party”.Minor style fix. Based on static analysis hints.
- To generate decorator abstract classes for third party interfaces, + To generate decorator abstract classes for third-party interfaces,
23-26: Use a shell-appropriate code fence for Install-Package.Improves syntax highlighting.
-```c# +```powershell Install-Package DecoratorGenerator--- `43-61`: **Tiny wording tweak for flow.** Reads a bit smoother. ```diff -Since this library is an incremental source generator, the abstract class should be generated after saving the changes to interface's file. +Since this library is an incremental source generator, the abstract class is generated after saving changes to the interface file.v2/rscg_examples_site/docs/RSCG-Examples/DecoratorGenerator.md (1)
184-190: Consider replacing hard tabs with spaces.The PropertyGroup block uses hard tabs instead of spaces, which is inconsistent with typical markdown and XML formatting standards. While this doesn't break functionality, converting to spaces would improve consistency.
Apply this diff to replace tabs with spaces:
- <PropertyGroup> - <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> - <CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath> - </PropertyGroup> - <ItemGroup> - <PackageReference Include="DecoratorGenerator" Version="0.3.0" /> - </ItemGroup> + <PropertyGroup> + <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> + <CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath> + </PropertyGroup> + <ItemGroup> + <PackageReference Include="DecoratorGenerator" Version="0.3.0" /> + </ItemGroup>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
v2/Generator/all.csvis excluded by!**/*.csvv2/rscg_examples_site/static/sources/DecoratorGenerator.zipis excluded by!**/*.zip
📒 Files selected for processing (26)
README.md(2 hunks)later.md(1 hunks)v2/.tours/DecoratorGenerator.tour(1 hunks)v2/GeneratorData/Category.cs(1 hunks)v2/RSCGExamplesData/GeneratorDataRec.json(1 hunks)v2/book/examples/DecoratorGenerator.html(1 hunks)v2/book/list.html(2 hunks)v2/book/pandocHTML.yaml(1 hunks)v2/rscg_examples/DecoratorGenerator/description.json(1 hunks)v2/rscg_examples/DecoratorGenerator/nuget.txt(1 hunks)v2/rscg_examples/DecoratorGenerator/readme.txt(1 hunks)v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo.slnx(1 hunks)v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/DecoratorDemo.csproj(1 hunks)v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/IPerson.cs(1 hunks)v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/LogPerson.cs(1 hunks)v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/Person.cs(1 hunks)v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/Program.cs(1 hunks)v2/rscg_examples/DecoratorGenerator/video.json(1 hunks)v2/rscg_examples_site/docs/Categories/Decorator.md(1 hunks)v2/rscg_examples_site/docs/Categories/_PrimitiveDecorator.mdx(1 hunks)v2/rscg_examples_site/docs/RSCG-Examples/DecoratorGenerator.md(1 hunks)v2/rscg_examples_site/docs/RSCG-Examples/index.md(3 hunks)v2/rscg_examples_site/docs/about.md(1 hunks)v2/rscg_examples_site/docs/indexRSCG.md(2 hunks)v2/rscg_examples_site/src/components/HomepageFeatures/index.js(1 hunks)v2/rscg_examples_site/static/exports/RSCG.json(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/IPerson.cs (2)
v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/LogPerson.cs (2)
FullName(25-29)Task(30-34)v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/Person.cs (2)
FullName(11-14)Task(15-22)
v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/LogPerson.cs (2)
v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/IPerson.cs (2)
FullName(13-13)Task(15-15)v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/Person.cs (2)
FullName(11-14)Task(15-22)
v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/Program.cs (3)
v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/Person.cs (2)
Person(7-24)FullName(11-14)v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/LogPerson.cs (3)
LogPerson(7-35)LogPerson(9-11)FullName(25-29)v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/IPerson.cs (1)
FullName(13-13)
v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/Person.cs (2)
v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/IPerson.cs (2)
FullName(13-13)Task(15-15)v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/LogPerson.cs (2)
FullName(25-29)Task(30-34)
🪛 Biome (2.1.2)
v2/rscg_examples/DecoratorGenerator/video.json
[error] 35-36: Property key must be double quoted
(parse)
[error] 36-36: unexpected character =
(parse)
[error] 36-36: expected , but instead found " "
Remove " "
(parse)
[error] 36-36: expected : but instead found }
Remove }
(parse)
[error] 37-38: Expected an array, an object, or a literal but instead found ']'.
Expected an array, an object, or a literal here.
(parse)
🪛 LanguageTool
v2/rscg_examples/DecoratorGenerator/readme.txt
[grammar] ~88-~88: Use a hyphen to join words.
Context: ...ate decorator abstract classes for third party interfaces, Decorator Generator wi...
(QB_NEW_EN_HYPHEN)
v2/rscg_examples_site/docs/RSCG-Examples/DecoratorGenerator.md
[grammar] ~141-~141: Use a hyphen to join words.
Context: ...ate decorator abstract classes for third party interfaces, Decorator Generator wi...
(QB_NEW_EN_HYPHEN)
🪛 markdownlint-cli2 (0.18.1)
v2/rscg_examples_site/docs/RSCG-Examples/DecoratorGenerator.md
36-36: Bare URL used
(MD034, no-bare-urls)
39-39: Bare URL used
(MD034, no-bare-urls)
41-41: Bare URL used
(MD034, no-bare-urls)
184-184: Hard tabs
Column: 1
(MD010, no-hard-tabs)
185-185: Hard tabs
Column: 1
(MD010, no-hard-tabs)
186-186: Hard tabs
Column: 1
(MD010, no-hard-tabs)
187-187: Hard tabs
Column: 1
(MD010, no-hard-tabs)
188-188: Hard tabs
Column: 1
(MD010, no-hard-tabs)
189-189: Hard tabs
Column: 1
(MD010, no-hard-tabs)
190-190: Hard tabs
Column: 1
(MD010, no-hard-tabs)
336-336: Code block style
Expected: fenced; Actual: indented
(MD046, code-block-style)
353-353: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
v2/rscg_examples_site/docs/indexRSCG.md
23-23: Spaces inside link text
(MD039, no-space-in-links)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: CodeQL analysis (csharp)
- GitHub Check: Agent
- GitHub Check: CodeQL analysis (javascript-typescript)
- GitHub Check: call-workflow-passing-data / build (24.3.0)
🔇 Additional comments (22)
v2/GeneratorData/Category.cs (1)
45-46: Enum extension for Decorator category is consistent
Decorator = 41follows the existing sequential pattern and cleanly adds the new category without affecting prior values.v2/book/list.html (2)
20-20: Header count updated to 241 matches the expanded listThe header text now reflects the total including the new DecoratorGenerator entry; this keeps the page title consistent with the table.
989-992: DecoratorGenerator row correctly appended as item 241The new row is numbered 241 and links to
examples/DecoratorGenerator.html, matching the new example file and leaving existing entries untouched.v2/rscg_examples_site/docs/about.md (1)
8-10: About-page count synchronized to 241 examplesThe updated wording to “241 Roslyn Source Code Generator (RSCG)” is consistent with the new total.
v2/rscg_examples_site/src/components/HomepageFeatures/index.js (1)
5-13: Homepage feature title correctly updated to 241 examplesThe feature title now reflects the new total while keeping the MSFT count unchanged; no behavioral impact.
v2/book/pandocHTML.yaml (1)
257-257: Pandoc inputs updated to include DecoratorGenerator exampleAdding
examples/DecoratorGenerator.htmlensures the new example is rendered with the rest of the book content.v2/rscg_examples_site/docs/Categories/_PrimitiveDecorator.mdx (1)
1-7: Decorator category primitive doc aligns with new generator entryThis snippet correctly introduces the “Decorator” category, lists DecoratorGenerator with badges and date, and links to the category page.
v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo.slnx (1)
1-3: LGTM!The solution file structure is correct and properly references the DecoratorDemo project.
later.md (1)
3-3: LGTM!The date update aligns correctly with the new DecoratorGenerator entry dated 2025-11-10.
v2/rscg_examples_site/docs/indexRSCG.md (1)
10-12: LGTM!The count updates from 240 to 241 are consistent and correct.
v2/RSCGExamplesData/GeneratorDataRec.json (1)
1457-1462: LGTM!The DecoratorGenerator entry is properly structured with correct Category (41 for Decorator) and date (2025-11-10).
v2/rscg_examples/DecoratorGenerator/nuget.txt (1)
1-3: LGTM!The documentation clearly describes the DecoratorGenerator's purpose and functionality.
v2/.tours/DecoratorGenerator.tour (1)
1-48: LGTM!The CodeTour configuration properly references all relevant source files and the generated decorator. The pattern "this is the code" appears to be used as a marker for tour navigation.
v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/DecoratorDemo.csproj (1)
1-16: DecoratorGenerator package version 0.3.0 is publicly available and compatible with .NET 10.0.The package exists on NuGet and targets .NETStandard2.0, which is compatible with all .NET versions including .NET 10.0. No compatibility issues detected.
README.md (1)
1-1: All verification checks passed—DecoratorGenerator docs and exports are properly configured.The DecoratorGenerator entry is correctly:
- Documented at
v2/rscg_examples_site/docs/RSCG-Examples/DecoratorGenerator.md(381 lines)- Exported in
v2/rscg_examples_site/static/exports/RSCG.jsonwith proper metadata (Name, Link, NuGet, Source, Category)- Listed under the "Decorator" category anchor in the docs index at line 381–388
Links will resolve without 404 errors.
v2/rscg_examples/DecoratorGenerator/description.json (1)
13-15: File references in the review snippet are outdated and incorrect.The description.json for RSCG_Decorator (not DecoratorGenerator) actually contains:
csprojDemo:"RSCG_DecoratorTestConsole.csproj"(not"DecoratorDemo.csproj")csFiles:["Program.cs","PersonLogger.cs","Person.cs"](not["Program.cs","Person.cs","IPerson.cs","LogPerson.cs"])All referenced files do exist in the demo directory, but the review snippet shows stale or incorrect content that doesn't match the actual file.
Likely an incorrect or invalid review comment.
v2/rscg_examples_site/static/exports/RSCG.json (1)
1924-1932: LGTM!The DecoratorGenerator catalog entry is correctly formatted and includes all required fields (Name, Link, NuGet, Source, Category, AddedOn).
v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/IPerson.cs (1)
1-16: LGTM!The interface is well-designed for the decorator pattern demonstration. The
[Decorate]attribute will trigger the generator to create thePersonDecoratorbase class, and the interface includes a good mix of properties and methods (both sync and async) to showcase the decorator functionality.v2/rscg_examples_site/docs/RSCG-Examples/index.md (1)
3-4: LGTM!The documentation correctly reflects the addition of DecoratorGenerator as the 241st RSCG example and properly includes it in both the category listing and the mermaid diagram.
Also applies to: 381-391, 1618-1619
v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/Program.cs (1)
1-12: LGTM!The demonstration program effectively showcases the decorator pattern with DecoratorGenerator. It properly wraps the concrete
Personimplementation withLogPersondecorator and demonstrates both property access and method calls (including async methods).v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/LogPerson.cs (1)
7-35: LGTM!The
LogPersondecorator is correctly implemented, demonstrating how to add logging cross-cutting concerns while preserving the original behavior through base calls. The implementation shows override patterns for properties, sync methods, and async methods.v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/Person.cs (1)
7-24: LGTM!The
Personclass provides a clean, straightforward implementation ofIPerson. The age calculation logic correctly accounts for whether the birthday has occurred this year, and the async method properly simulates asynchronous work.
| ### 241. [DecoratorGenerator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/DecoratorGenerator) , in the [Decorator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#decorator) category | ||
|
|
||
| Generated on : 2025-11-10 => 10 November 2025 | ||
|
|
||
| <details> | ||
| <summary>Expand</summary> | ||
|
|
||
|
|
||
|
|
||
| Author: Leopoldo Fu | ||
|
|
||
| Source generator for decorator pattern boilerplate code in C#. | ||
|
|
||
| When implementing the decorator pattern in C#, it requires adding boilerplate code for every interface that needs to support decorators, namely the abstract class. Boilerplate is tedious to write and error-prone. This source generator solves this problem by automatically generating the abstract class. It only needs to be told which interfaces it should generate the abstract class for. | ||
|
|
||
| Nuget: [https://www.nuget.org/packages/DecoratorGenerator/](https://www.nuget.org/packages/DecoratorGenerator/) | ||
|
|
||
|
|
||
| Link: [https://ignatandrei.github.io/RSCG_Examples/v2/docs/DecoratorGenerator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/DecoratorGenerator) | ||
|
|
||
| Source: [https://github.com/CodingFlow/decorator-generator](https://github.com/CodingFlow/decorator-generator) | ||
|
|
||
| </details> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify the external links for DecoratorGenerator entry
echo "Checking NuGet package URL..."
curl -s -o /dev/null -w "NuGet Package: HTTP Status %{http_code}\n" "https://www.nuget.org/packages/DecoratorGenerator/"
echo "Checking GitHub repository URL..."
curl -s -o /dev/null -w "GitHub Repo: HTTP Status %{http_code}\n" "https://github.com/CodingFlow/decorator-generator"
echo "Checking documentation URL..."
curl -s -o /dev/null -w "Documentation: HTTP Status %{http_code}\n" "https://ignatandrei.github.io/RSCG_Examples/v2/docs/DecoratorGenerator"Repository: ignatandrei/RSCG_Examples
Length of output: 253
Documentation link is broken (404) — needs correction before merge.
Verification results:
- ✅ NuGet Package: HTTP 200 (valid)
- ✅ GitHub Repository: HTTP 200 (valid)
- ❌ Documentation: HTTP 404 (broken link)
The documentation URL https://ignatandrei.github.io/RSCG_Examples/v2/docs/DecoratorGenerator returns a 404 error. This link should be removed or corrected to point to a valid documentation page before merging.
🤖 Prompt for AI Agents
In README.md around lines 29 to 51 the documentation URL
https://ignatandrei.github.io/RSCG_Examples/v2/docs/DecoratorGenerator returns
404; fix by either removing the broken documentation link or replacing it with a
valid URL (for example the repository README:
https://github.com/CodingFlow/decorator-generator or the NuGet package page) and
update the "Link:" and the expanded details block so both point to the
corrected/working documentation URL; ensure no lingering references to the
broken ignatandrei.github.io URL remain.
| import Tabs from '@theme/Tabs'; | ||
| import TabItem from '@theme/TabItem'; | ||
| import TOCInline from '@theme/TOCInline'; | ||
| import SameCategory from '../Categories/_PrimitiveDecorator.mdx'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the category import.
The import references _PrimitiveDecorator.mdx but should reference _Decorator.mdx to match the actual category for DecoratorGenerator.
Apply this diff:
-import SameCategory from '../Categories/_PrimitiveDecorator.mdx';
+import SameCategory from '../Categories/_Decorator.mdx';📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import SameCategory from '../Categories/_PrimitiveDecorator.mdx'; | |
| import SameCategory from '../Categories/_Decorator.mdx'; |
🤖 Prompt for AI Agents
In v2/rscg_examples_site/docs/RSCG-Examples/DecoratorGenerator.md around line
10, the import is pointing to '../Categories/_PrimitiveDecorator.mdx' but the
correct category file is '../Categories/_Decorator.mdx'; update the import path
to reference '_Decorator.mdx' so the DecoratorGenerator page pulls in the
correct category file.
|
|
||
| internal class Person : IPerson | ||
| { | ||
| public string FirstName \{ get; set; \} = string.Empty; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove escaped braces in C# code samples.
The backslashes before braces in property declarations (e.g., \{ get; set; \}) are unnecessary and make the code samples syntactically incorrect. These should be plain braces for valid C# syntax.
Apply this diff to fix the escaped braces:
- public string FirstName \{ get; set; \} = string.Empty;
- public string LastName \{ get; set; \} = string.Empty;
+ public string FirstName { get; set; } = string.Empty;
+ public string LastName { get; set; } = string.Empty;Also fix Lines 264-265:
- public string FirstName \{ get; set; }
- public string LastName \{ get; set; }
+ public string FirstName { get; set; }
+ public string LastName { get; set; }And Lines 340, 342:
- public virtual string FirstName \{ get => person.FirstName; set => person.FirstName = value; }
- public virtual string LastName \{ get => person.LastName; set => person.LastName = value; }
+ public virtual string FirstName { get => person.FirstName; set => person.FirstName = value; }
+ public virtual string LastName { get => person.LastName; set => person.LastName = value; }Also applies to: 264-265, 340-340, 342-342
🤖 Prompt for AI Agents
In v2/rscg_examples_site/docs/RSCG-Examples/DecoratorGenerator.md around lines
230, 264-265, 340 and 342, the C# code samples contain escaped braces (e.g., "\{
get; set; \}") which are invalid; remove the backslashes so the property and
other brace usages use plain braces ("{ get; set; }", etc.) ensuring all
occurrences on those lines replace "\{" with "{" and "\}" with "}" to produce
valid C# syntax.
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>net10.0</TargetFramework> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# First, verify the file exists and check its content
if [ -f "v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/DecoratorDemo.csproj" ]; then
echo "=== File found. Checking line 5 ==="
sed -n '1,10p' "v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/DecoratorDemo.csproj"
else
echo "File not found at expected path. Searching for it..."
find . -name "DecoratorDemo.csproj" -type f
fiRepository: ignatandrei/RSCG_Examples
Length of output: 414
🏁 Script executed:
#!/bin/bash
# Check for other .csproj files with target frameworks to understand the pattern
echo "=== Checking all .csproj files for target frameworks ==="
rg -t xml '<TargetFramework>' -A 0 --no-heading 2>/dev/null | head -20Repository: ignatandrei/RSCG_Examples
Length of output: 125
🏁 Script executed:
#!/bin/bash
# Find all .csproj files and check their target frameworks
echo "=== All .csproj files with TargetFramework ==="
find . -name "*.csproj" -type f -exec grep -H "TargetFramework" {} \; | head -30Repository: ignatandrei/RSCG_Examples
Length of output: 14384
🏁 Script executed:
#!/bin/bash
# Check for net10.0 specifically in v2 examples
echo "=== .NET 10.0 targeting in v2 ==="
find v2 -name "*.csproj" -type f -exec grep -l "net10.0" {} \;
echo ""
echo "=== All v2 target frameworks ==="
find v2 -name "*.csproj" -type f -exec grep "TargetFramework" {} \; | sort | uniq -cRepository: ignatandrei/RSCG_Examples
Length of output: 1346
🏁 Script executed:
#!/bin/bash
# Get the exact list of net10.0 projects
echo "=== All projects targeting net10.0 ==="
find v2 -name "*.csproj" -type f | while read f; do
if grep -q "net10.0" "$f"; then
echo "$f"
fi
doneRepository: ignatandrei/RSCG_Examples
Length of output: 424
🏁 Script executed:
#!/bin/bash
# Let's also check if there's any documentation or comments about why net10.0 was chosen
echo "=== Checking for context in DecoratorGenerator files ==="
find v2/rscg_examples/DecoratorGenerator -type f -name "*.md" -o -name "*.txt" | head -5
echo ""
echo "=== Checking README or docs ==="
find v2/rscg_examples/DecoratorGenerator -type f \( -name "README*" -o -name "*.md" \) -exec head -20 {} \;Repository: ignatandrei/RSCG_Examples
Length of output: 251
🏁 Script executed:
#!/bin/bash
# Check the readme and nuget files
echo "=== Content of readme.txt ==="
cat v2/rscg_examples/DecoratorGenerator/readme.txt 2>/dev/null || echo "Not found"
echo ""
echo "=== Content of nuget.txt ==="
cat v2/rscg_examples/DecoratorGenerator/nuget.txt 2>/dev/null || echo "Not found"Repository: ignatandrei/RSCG_Examples
Length of output: 3893
🏁 Script executed:
#!/bin/bash
# Final check: List all net10.0 projects to understand scope
echo "=== Summary of net10.0 targeting projects ==="
find v2 -name "*.csproj" -type f | while read f; do
if grep -q "net10.0" "$f"; then
echo "- $f"
fi
done | sortRepository: ignatandrei/RSCG_Examples
Length of output: 441
Based on my comprehensive verification, I have confirmed all the facts in the review comment:
Verification Summary:
- ✓ File confirmed: DecoratorDemo.csproj targets
net10.0at line 5 - ✓ Timeline confirmed: As of November 2025, .NET 9 is the latest released version; .NET 10 is scheduled for November 2026
- ✓ Impact confirmed: This targeting will cause build failures on systems with only .NET 9 or earlier
- ✓ Scope identified: Five projects in v2 have this same issue (systemic problem)
- ✓ Suggested fixes are appropriate: net9.0 or net8.0 (LTS) are valid alternatives
The review comment is accurate and well-founded.
Critical: Invalid target framework net10.0.
The project targets net10.0, which does not exist as of November 2025. .NET follows an annual release cycle with major versions in November. .NET 9 is the latest available version in November 2025, and .NET 10 is scheduled for November 2026.
This will cause build failures.
Apply this diff to use .NET 9:
- <TargetFramework>net10.0</TargetFramework>
+ <TargetFramework>net9.0</TargetFramework>Alternatively, use .NET 8 (LTS) if long-term support is preferred:
- <TargetFramework>net10.0</TargetFramework>
+ <TargetFramework>net8.0</TargetFramework>Note: This issue also affects four other projects in v2 (Program, TUnit, TeCLI, XmlCommentGenerator).
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <TargetFramework>net10.0</TargetFramework> | |
| <TargetFramework>net9.0</TargetFramework> |
🤖 Prompt for AI Agents
v2/rscg_examples/DecoratorGenerator/src/DecoratorDemo/DecoratorDemo.csproj lines
5-5: the project targets non-existent framework "net10.0", causing build
failures; update the TargetFramework value to a valid released framework
(preferably "net9.0" or, for LTS, "net8.0") and apply the same fix to the other
affected projects (Program, TUnit, TeCLI, XmlCommentGenerator) to ensure
consistent, buildable targets.
| {"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/DecoratorGenerator#download-example-net--c-", | ||
| SpeakTest=" "}, | ||
| {"typeStep":"waitseconds","arg":"30"}, | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix invalid JSON syntax in final steps array entries
The SpeakTest=" " fragment is not valid JSON (missing quotes around the key, uses = instead of :, and breaks the object), and the last waitseconds entry ends with a trailing comma, making the whole file unparsable.
You can fix both issues like this:
-{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/DecoratorGenerator#download-example-net--c-",
-SpeakTest=" "},
-{"typeStep":"waitseconds","arg":"30"},
-]
+{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/DecoratorGenerator#download-example-net--c-","SpeakTest":""},
+{"typeStep":"waitseconds","arg":"30"}
+]If SpeakTest isn’t actually used by your tooling, you could alternatively drop that property entirely.
🧰 Tools
🪛 Biome (2.1.2)
[error] 35-36: Property key must be double quoted
(parse)
[error] 36-36: unexpected character =
(parse)
[error] 36-36: expected , but instead found " "
Remove " "
(parse)
[error] 36-36: expected : but instead found }
Remove }
(parse)
[error] 37-38: Expected an array, an object, or a literal but instead found ']'.
Expected an array, an object, or a literal here.
(parse)
🤖 Prompt for AI Agents
In v2/rscg_examples/DecoratorGenerator/video.json around lines 35 to 38, the
final steps array contains invalid JSON: the fragment SpeakTest=" " uses = and
an unquoted key and must be a proper JSON property (either remove it or change
to "SpeakTest": " "), and the last {"typeStep":"waitseconds","arg":"30"}, entry
has a trailing comma that must be removed so the array ends with a valid element
followed by the closing bracket. Ensure the steps array elements are
comma-separated JSON objects, no trailing comma after the final object, and run
a JSON linter to verify the file parses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds DecoratorGenerator as the 241st Roslyn Source Code Generator (RSCG) example to the repository. DecoratorGenerator is a source generator that automates the creation of decorator pattern boilerplate code in C#.
Key Changes:
- Added new RSCG example "DecoratorGenerator" with complete documentation and demo project
- Updated all count references from 240 to 241 RSCGs across documentation
- Added new "Decorator" category (enum value 41) to categorize this generator
Reviewed changes
Copilot reviewed 27 out of 28 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| v2/rscg_examples_site/static/sources/DecoratorGenerator.zip | Binary zip file containing the demo project source code |
| v2/rscg_examples_site/static/exports/RSCG.json | Added DecoratorGenerator entry to the RSCG catalog |
| v2/rscg_examples_site/src/components/HomepageFeatures/index.js | Updated example count from 240 to 241 |
| v2/rscg_examples_site/docs/indexRSCG.md | Added DecoratorGenerator to the chronological list and updated counts |
| v2/rscg_examples_site/docs/about.md | Updated RSCG count from 240 to 241 |
| v2/rscg_examples_site/docs/RSCG-Examples/index.md | Added new Decorator category section and flowchart node |
| v2/rscg_examples_site/docs/RSCG-Examples/DecoratorGenerator.md | Comprehensive documentation page for DecoratorGenerator |
| v2/rscg_examples_site/docs/Categories/_PrimitiveDecorator.mdx | New category component for Decorator generators |
| v2/rscg_examples_site/docs/Categories/Decorator.md | New category page listing Decorator generators |
| v2/rscg_examples/DecoratorGenerator/video.json | Video script configuration (contains JSON syntax errors) |
| v2/rscg_examples/DecoratorGenerator/src/* | Complete C# demo project files showcasing DecoratorGenerator usage |
| v2/book/* | Updated book HTML files with new generator entry |
| v2/RSCGExamplesData/GeneratorDataRec.json | Added DecoratorGenerator metadata record |
| v2/GeneratorData/Category.cs | Added Decorator enum value (41) |
| v2/Generator/all.csv | Added DecoratorGenerator to CSV catalog |
| v2/.tours/DecoratorGenerator.tour | CodeTour configuration for walking through the example |
| later.md | Updated latest update date to 2025-11-10 |
| README.md | Updated count and added DecoratorGenerator section |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| {"typeStep":"waitseconds","arg":"30"}, | ||
| {"typeStep":"text","arg": "Remember, you can download the code from here"}, | ||
| {"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/DecoratorGenerator#download-example-net--c-", | ||
| SpeakTest=" "}, |
Copilot
AI
Nov 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invalid JSON syntax: the SpeakTest property on line 36 should be a string value in quotes. Change SpeakTest=" " to "SpeakTest":" ".
| SpeakTest=" "}, | |
| "SpeakTest":" "}, |
| {"typeStep":"text","arg": "Remember, you can download the code from here"}, | ||
| {"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/DecoratorGenerator#download-example-net--c-", | ||
| SpeakTest=" "}, | ||
| {"typeStep":"waitseconds","arg":"30"}, |
Copilot
AI
Nov 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invalid JSON syntax: trailing comma after the last array element on line 37. Remove the comma after {"typeStep":"waitseconds","arg":"30"}, to make valid JSON.
| {"typeStep":"waitseconds","arg":"30"}, | |
| {"typeStep":"waitseconds","arg":"30"} |
| import TOCInline from '@theme/TOCInline'; | ||
| import SameCategory from '../Categories/_PrimitiveDecorator.mdx'; | ||
|
|
||
| # DecoratorGenerator by Leopoldo Fu |
Copilot
AI
Nov 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space in the heading. There are two spaces between "DecoratorGenerator" and "by". Should be single space: # DecoratorGenerator by Leopoldo Fu.
| # DecoratorGenerator by Leopoldo Fu | |
| # DecoratorGenerator by Leopoldo Fu |
Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.