Skip to content
Merged

demo #503

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# RSCG - 269 Examples of Roslyn Source Code Generators / 16 created by Microsoft /
# RSCG - 270 Examples of Roslyn Source Code Generators / 16 created by Microsoft /

The RSCG_Examples repository is a comprehensive documentation system that automatically processes and showcases 269 Roslyn Source Code Generator (RSCG) examples. The system transforms individual RSCG projects into structured documentation with code examples and cross-referenced content with a searchable website and code example exports.
The RSCG_Examples repository is a comprehensive documentation system that automatically processes and showcases 270 Roslyn Source Code Generator (RSCG) examples. The system transforms individual RSCG projects into structured documentation with code examples and cross-referenced content with a searchable website and code example exports.

This system serves as both a learning resource for .NET developers interested in source generators and an automated pipeline for maintaining up-to-date documentation about the RSCG ecosystem

## Latest Update : 2026-05-14 => 14 May 2026
## Latest Update : 2026-05-15 => 15 May 2026

If you want to see examples with code, please click ***[List V2](https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG)***

Expand All @@ -24,8 +24,30 @@ If you want to be notified each time I add a new RSCG example , please click htt

## Content

Those are the 269 Roslyn Source Code Generators that I have tested you can see and download source code example.
Those are the 270 Roslyn Source Code Generators that I have tested you can see and download source code example.
( including 16 from Microsoft )
### 270. [AssemblyMetadata.Generators](https://ignatandrei.github.io/RSCG_Examples/v2/docs/AssemblyMetadata.Generators) , in the [EnhancementProject](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementproject) category

Generated on : 2026-05-15 => 15 May 2026

<details>
<summary>Expand</summary>



Author: LoreSoft

Source generator to expose assembly attributes as string constants

Nuget: [https://www.nuget.org/packages/AssemblyMetadata.Generators/](https://www.nuget.org/packages/AssemblyMetadata.Generators/)


Link: [https://ignatandrei.github.io/RSCG_Examples/v2/docs/AssemblyMetadata.Generators](https://ignatandrei.github.io/RSCG_Examples/v2/docs/AssemblyMetadata.Generators)

Source: [https://github.com/loresoft/AssemblyMetadata.Generators](https://github.com/loresoft/AssemblyMetadata.Generators)

</details>

### 269. [LinkDotNet.Enumeration](https://ignatandrei.github.io/RSCG_Examples/v2/docs/LinkDotNet.Enumeration) , in the [Enum](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enum) category

Generated on : 2026-05-14 => 14 May 2026
Expand Down
2 changes: 1 addition & 1 deletion later.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Just later

## Latest Update : 2026-05-14 => 14 May 2026
## Latest Update : 2026-05-15 => 15 May 2026



Expand Down
30 changes: 30 additions & 0 deletions v2/.tours/AssemblyMetadata.Generators.tour
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

{
"$schema": "https://aka.ms/codetour-schema",
"title": "AssemblyMetadata.Generators",
"steps":
[
{
"file": "rscg_examples/AssemblyMetadata.Generators/src/DemoMeta/DemoMeta.csproj",
"description": "First, we add Nuget [AssemblyMetadata.Generators](https://www.nuget.org/packages/AssemblyMetadata.Generators/) in csproj ",
"pattern": "AssemblyMetadata.Generators"
}

,{
"file": "rscg_examples/AssemblyMetadata.Generators/src/DemoMeta/Program.cs",
"description": "File Program.cs \r\n>> dotnet run --project rscg_examples/AssemblyMetadata.Generators/src/DemoMeta/DemoMeta.csproj ",
"pattern": "this is the code"
}
Comment on lines +14 to +17

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the step pattern exists in Program.cs
rg -n --fixed-strings "this is the code" v2/rscg_examples/AssemblyMetadata.Generators/src/DemoMeta/Program.cs

Repository: ignatandrei/RSCG_Examples

Length of output: 51


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== tour snippet =="
# show the relevant lines from the tour file
sed -n '1,120p' v2/.tours/AssemblyMetadata.Generators.tour | nl -ba | sed -n '1,120p'

echo "== Program.cs summary =="
FILE="v2/rscg_examples/AssemblyMetadata.Generators/src/DemoMeta/Program.cs"
if [ -f "$FILE" ]; then
  wc -l "$FILE"
  echo "---- head (first 120 lines max) ----"
  sed -n '1,120p' "$FILE" | nl -ba
  echo "---- likely literals (Console.WriteLine etc.) ----"
  rg -n "Console\.WriteLine|Title|Target Framework|TargetFramework|AssemblyName|Metadata" "$FILE" || true
else
  echo "Missing: $FILE"
fi

echo "== exact pattern search =="
rg -n --fixed-strings "this is the code" "$FILE" || true

Repository: ignatandrei/RSCG_Examples

Length of output: 149


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== tour snippet =="
sed -n '1,120p' v2/.tours/AssemblyMetadata.Generators.tour | cat -n | sed -n '1,120p'

echo "== Program.cs check =="
FILE="v2/rscg_examples/AssemblyMetadata.Generators/src/DemoMeta/Program.cs"
if [ -f "$FILE" ]; then
  echo "File exists: $FILE"
  wc -l "$FILE"
  echo "---- head (first 160 lines max) ----"
  sed -n '1,160p' "$FILE" | cat -n
  echo "---- search likely stable strings ----"
  rg -n "Console\.WriteLine|Title|Target Framework|TargetFramework|AssemblyName|Metadata" "$FILE" || true
  echo "---- exact pattern search: this is the code ----"
  rg -n --fixed-strings "this is the code" "$FILE" || true
else
  echo "Missing: $FILE"
fi

Repository: ignatandrei/RSCG_Examples

Length of output: 1827


Fix tour step pattern mismatch for DemoMeta/Program.cs

rscg_examples/AssemblyMetadata.Generators/src/DemoMeta/Program.cs contains only Console.WriteLine(ThisAssembly.Title); and Console.WriteLine(ThisAssembly.TargetFramework);, so the step pattern "this is the code" can’t match and the tour stop won’t anchor correctly. Update the step’s "pattern" to a string that actually exists in Program.cs (e.g., ThisAssembly.Title / ThisAssembly.TargetFramework).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v2/.tours/AssemblyMetadata.Generators.tour` around lines 14 - 17, The tour
step's "pattern" value ("this is the code") doesn't match the actual contents of
the Program.cs referenced by the step; update the JSON "pattern" property for
the step that targets Program.cs (the tour entry referencing Program.cs /
DemoMeta) to a string that actually appears in that file such as
"ThisAssembly.Title" or "ThisAssembly.TargetFramework" so the tour stop will
anchor correctly.



,{
"file": "rscg_examples/AssemblyMetadata.Generators/src/DemoMeta/obj/GX/AssemblyMetadata.Generators/AssemblyMetadata.Generators.AssemblyMetadataGenerator/AssemblyMetadata.g.cs",
"description": "Generated File 1 from 1 : AssemblyMetadata.g.cs ",
"line": 1
}

],

"ref": "main"

}
2 changes: 2 additions & 0 deletions v2/Generator/all.csv
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,5 @@ Nr,Key,Source,Category
266,Aigamo.MatchGenerator, https://github.com/ycanardeau/MatchGenerator,Enum
267,Maestria.TypeProviders, https://github.com/MaestriaNet/TypeProviders,FilesToCode
268,GenerateDispose, https://github.com/ItaiTzur76/GenerateDispose,Disposer
269,LinkDotNet.Enumeration, https://github.com/linkdotnet/Enumeration,Enum
270,AssemblyMetadata.Generators, https://github.com/loresoft/AssemblyMetadata.Generators,EnhancementProject
8 changes: 7 additions & 1 deletion v2/RSCGExamplesData/GeneratorDataRec.json
Original file line number Diff line number Diff line change
Expand Up @@ -1630,5 +1630,11 @@
"Category": 19,
"dtStart": "2026-05-14T00:00:00",
"show": true
}
},
{
"ID":"AssemblyMetadata.Generators",
"Category": 1,
"dtStart": "2026-05-15T00:00:00",
"show": true
},
]
53 changes: 53 additions & 0 deletions v2/book/examples/AssemblyMetadata.Generators.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

<h1>RSCG nr 270 : AssemblyMetadata.Generators</h1>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add HTML doctype declaration at the top.

Line 2 starts with content before <!doctype html>, which triggers standards mode issues in some browsers and tooling. Add the doctype as the first line.

🧰 Tools
🪛 HTMLHint (1.9.2)

[error] 2-2: Doctype must be declared before any non-comment content.

(doctype-first)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v2/book/examples/AssemblyMetadata.Generators.html` at line 2, Add the HTML5
doctype as the very first line of the file so it precedes the page title "RSCG
nr 270 :  AssemblyMetadata.Generators" and any other content; open the file
containing the AssemblyMetadata.Generators example and insert <!doctype html> at
the top to ensure browsers and tooling render in standards mode.


<h2>Info</h2>
Nuget : <a href="https://www.nuget.org/packages/AssemblyMetadata.Generators/" target="_blank">https://www.nuget.org/packages/AssemblyMetadata.Generators/</a>

<p>You can find more details at : <a href="https://github.com/loresoft/AssemblyMetadata.Generators" target="_blank"> https://github.com/loresoft/AssemblyMetadata.Generators</a></p>

<p>Author :LoreSoft</p>

<p>Source: <a href="https://github.com/loresoft/AssemblyMetadata.Generators" target="_blank">https://github.com/loresoft/AssemblyMetadata.Generators</a> </p>

<h2>About</h2>

Generating assembly metadata attributes at compile time.

<h2>
How to use
</h2>
<h3>
Add reference to the <a href="https://www.nuget.org/packages/AssemblyMetadata.Generators/" target="_blank">AssemblyMetadata.Generators</a> in the csproj
</h3>
<img src="images/AssemblyMetadata.Generators/DemoMeta.csproj.png" width="580" height="580" />

<h3>This was for me the <b>starting</b> code</h3>

<br />
I have <b>coded</b> the file Program.cs
<br />
<img src="images/AssemblyMetadata.Generators/csFiles/Program.cs.png" width="580" height="580" />
<hr />
<h3>And here are the <i>generated</i> files</h3>

<br />
The file <i>generated</i> is AssemblyMetadata.g.cs
<br />
<img src="images/AssemblyMetadata.Generators/generated/AssemblyMetadata.g.cs.png" width="580" height="580" />

<p>
You can download the code and this page as pdf from
<a target="_blank" href='https://ignatandrei.github.io/RSCG_Examples/v2/docs/AssemblyMetadata.Generators'>
https://ignatandrei.github.io/RSCG_Examples/v2/docs/AssemblyMetadata.Generators
</a>
</p>


<p>
You can see the whole list at
<a target="_blank" href='https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG'>
https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG
</a>
</p>

2 changes: 1 addition & 1 deletion v2/book/examples/GenerateDispose.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h2>Info</h2>

<h2>About</h2>

Generating the Dispose method for a class that implements IDisposable.
GenerateDispose for boilerplate reduction for IDisposable pattern### PurposeA Roslyn source generator that replaces the 10+ lines of IDisposable boilerplate code with a single attribute.It also automatically adapts the generated pattern when the class modifiers change (e.g. sealed to non-sealed).### How to Define```csharp showLineNumbers[GenerateDispose.SourceGenerators.GenerateDispose(nameof(Drop))]partial class DALDB : IDisposable // : IDisposable is optional!{ private ConnectionDB cn; private ConnectionDB cn1; public DALDB() { cn = new ConnectionDB(); cn1 = new ConnectionDB(); } public void Drop() // Your custom disposal logic { cn.Dispose(); cn1.Dispose(); }}```- The class must be partial- Pass nameof(YourDisposeMethod) to the attribute - the method must be callable with no arguments### What Gets Generated- public void Dispose() (thread-safe, calls your method)- A private int _isDisposed field for double-dispose protection- Adapts to sealed vs non-sealed automatically (private vs protected virtual)### How to Use```csharp showLineNumbersusing (var db = new DALDB()){ // use db...} // Dispose() called automatically```### Key Benefits- 10+ lines of boilerplate replaced by 1 attribute- sealed changes auto-adapt the Dispose pattern- No manual IDisposable wiring needed

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Reformat collapsed markdown blob into valid HTML sections.

Line 15 packs headings, code fences, and bullets into one line, so the “About” content won’t render as intended and is hard to consume. Split this into proper <p>, <h3>, <ul>, and <pre><code> blocks.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v2/book/examples/GenerateDispose.html` at line 15, The HTML currently has the
entire README/description collapsed on one line; split it into semantic HTML
blocks so headings, paragraphs, code samples and lists render correctly: create
<h3>Purpose</h3> and a following <p> describing the generator, a <pre><code>
block for the C# example that preserves the showLineNumbers attribute and the
GenerateDispose.SourceGenerators.GenerateDispose attribute usage (and the
partial class DALDB and Drop method), a <h3>What Gets Generated</h3> section
with a <ul> listing the Dispose method, the private int _isDisposed field and
sealed vs non-sealed behavior, an example <h3>How to Use</h3> with a <pre><code>
using (var db = new DALDB()){...} </code></pre>, and a final <h3>Key
Benefits</h3> with bullet points; ensure code fences become proper <pre><code>
blocks and that symbols like GenerateDispose, DALDB, Dispose, Drop, and
_isDisposed remain unchanged.


<h2>
How to use
Expand Down
2 changes: 1 addition & 1 deletion v2/book/examples/LinkDotNet.Enumeration.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h2>Info</h2>

<h2>About</h2>

Generating enumeration from classes in C# with matching
Good for replacing enum + switch patterns with string-based enumerations with exhaustive pattern matching.### PurposeA source code generator that creates string-based enumerations (similar to Java enums / DDD value objects) with exhaustive pattern matching, replacing enum + switch patterns.### How to Define[Enumeration(Casing.Preserve, &quot;None&quot;, &quot;Dacia&quot;, &quot;Tesla&quot;, &quot;BMW&quot;, &quot;Mercedes&quot;)]public sealed partial record CarTypes;### How to UseCarTypes.TryParse(&quot;BMW&quot;, null, out var car);car.Match(onBMW: () =&gt; &quot;this is bmw&quot;, onDacia: () =&gt; &quot;this is dacia&quot;, ...);### Key Features- Exhaustive matching: Match() requires all values- Create / TryCreate: throws vs returns bool- IParsable: Minimal APIs &amp; Model Binding- Implicit string conversion- CarTypes.All returns FrozenSet of CarTypes- JSON: GenerateJsonConverter = true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Convert the one-line markdown block into structured HTML.

Line 15 combines headings, sample code, and bullet points into a single line, which breaks readability/rendering on this HTML page. Please expand it into semantic HTML elements.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v2/book/examples/LinkDotNet.Enumeration.html` at line 15, Split the
single-line markdown into semantic HTML: create a heading for the tool
description (e.g., "Purpose"), a paragraph explaining the generator, a code
block or <pre> for the sample declaration (the [Enumeration(...)]public sealed
partial record CarTypes; example) and another code block for usage examples
(CarTypes.TryParse(...) and car.Match(...)), and convert the feature list into a
proper unordered list with each bullet as its own <li> (include items like
Exhaustive matching / Create/TryCreate / IParsable / Implicit string conversion
/ CarTypes.All / GenerateJsonConverter). Ensure identifiers like CarTypes,
Match, TryParse, Create/TryCreate, IParsable, CarTypes.All and
GenerateJsonConverter are preserved verbatim.


<h2>
How to use
Expand Down
6 changes: 5 additions & 1 deletion v2/book/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</head>
<body>
<h1>
This is the list of 269 RSCG with examples =>
This is the list of 270 RSCG with examples =>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Escape special character in heading text.

Line 20 includes a raw > (=>), which violates HTML escaping rules and fails HTMLHint. Replace it with =&gt; (or remove the arrow).

Proposed fix
-This is the list of 270 RSCG with examples =>
+This is the list of 270 RSCG with examples =&gt;
📝 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.

Suggested change
This is the list of 270 RSCG with examples =>
This is the list of 270 RSCG with examples =&gt;
🧰 Tools
🪛 HTMLHint (1.9.2)

[error] 20-20: Special characters must be escaped : [ > ].

(spec-char-escape)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v2/book/list.html` at line 20, The heading text "This is the list of 270 RSCG
with examples =>" contains an unescaped ">" which breaks HTMLHint; update the
heading content (the visible heading string in v2/book/list.html) to escape the
greater-than sign (replace "=>" with "=&gt;" or remove the arrow) so the HTML is
valid and passes linting.

</h1>

<table >
Expand Down Expand Up @@ -1102,6 +1102,10 @@ <h1>
<td>269</td>
<td><a href="examples/LinkDotNet.Enumeration.html">LinkDotNet.Enumeration</a></td>
</tr>
<tr>
<td>270</td>
<td><a href="examples/AssemblyMetadata.Generators.html">AssemblyMetadata.Generators</a></td>
</tr>
</table>


Expand Down
1 change: 1 addition & 0 deletions v2/book/pandocHTML.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ input-files:
- examples/Maestria.TypeProviders.html
- examples/GenerateDispose.html
- examples/LinkDotNet.Enumeration.html
- examples/AssemblyMetadata.Generators.html

# or you may use input-file: with a single value
# defaults:
Expand Down
6 changes: 6 additions & 0 deletions v2/docFind.json
Original file line number Diff line number Diff line change
Expand Up @@ -1612,5 +1612,11 @@
"category": "Enum",
"href": "/RSCG_Examples/v2/docs/LinkDotNet.Enumeration/",
"body": "Source code generated enumeration with completeness!"
},
{
"title": "AssemblyMetadata.Generators",
"category": "EnhancementProject",
"href": "/RSCG_Examples/v2/docs/AssemblyMetadata.Generators/",
"body": "Source generator to expose assembly attributes as string constants"
}
]
22 changes: 22 additions & 0 deletions v2/rscg_examples/AssemblyMetadata.Generators/description.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"generator":{
"name":"AssemblyMetadata.Generators",
"nuget":[
"https://www.nuget.org/packages/AssemblyMetadata.Generators/"
],
"link":"https://github.com/loresoft/AssemblyMetadata.Generators",
"author":"LoreSoft",
"source":"https://github.com/loresoft/AssemblyMetadata.Generators"
},
"data":{
"goodFor":["Generating assembly metadata attributes at compile time."],
"csprojDemo":"DemoMeta.csproj",
"csFiles":["Program.cs"],
"excludeDirectoryGenerated":[""],
"includeAdditionalFiles":[""]
},
"links":{
"blog":"",
"video":""
}
}
1 change: 1 addition & 0 deletions v2/rscg_examples/AssemblyMetadata.Generators/nuget.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Source generator to expose assembly attributes as string constants
51 changes: 51 additions & 0 deletions v2/rscg_examples/AssemblyMetadata.Generators/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# AssemblyMetadata.Generators

Source generator to expose assembly attributes as string constants.

[![Build status](https://github.com/loresoft/AssemblyMetadata.Generators/actions/workflows/dotnet.yml/badge.svg)](https://github.com/loresoft/AssemblyMetadata.Generators/actions)

[![NuGet Version](https://img.shields.io/nuget/v/AssemblyMetadata.Generators.svg?style=flat-square)](https://www.nuget.org/packages/AssemblyMetadata.Generators/)

[![Coverage Status](https://coveralls.io/repos/github/loresoft/AssemblyMetadata.Generators/badge.svg?branch=main)](https://coveralls.io/github/loresoft/AssemblyMetadata.Generators?branch=main)

### Usage

#### Add package

Add the nuget package project to your projects.

`dotnet add package AssemblyMetadata.Generators`

### Generated

This source generator creates an internal partial class called `ThisAssembly` with all the assembly level attributes converted to string constants

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix hyphenation in documentation text.

Use “assembly-level” instead of “assembly level” for correctness and consistency in technical writing.

Suggested patch
-This source generator creates an internal partial class called `ThisAssembly` with all the assembly level attributes converted to string constants
+This source generator creates an internal partial class called `ThisAssembly` with all the assembly-level attributes converted to string constants
📝 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.

Suggested change
This source generator creates an internal partial class called `ThisAssembly` with all the assembly level attributes converted to string constants
This source generator creates an internal partial class called `ThisAssembly` with all the assembly-level attributes converted to string constants
🧰 Tools
🪛 LanguageTool

[grammar] ~21-~21: Use a hyphen to join words.
Context: ...led ThisAssembly with all the assembly level attributes converted to string con...

(QB_NEW_EN_HYPHEN)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v2/rscg_examples/AssemblyMetadata.Generators/readme.txt` at line 21, Update
the documentation sentence that describes the source generator to use the
hyphenated term "assembly-level" instead of "assembly level": locate the line
mentioning the internal partial class `ThisAssembly` and change "assembly level
attributes" to "assembly-level attributes" so the text reads that it converts
"assembly-level attributes" to string constants.


```c#
internal static partial class ThisAssembly
{
public const string TargetFramework = ".NETCoreApp,Version=v7.0";
public const string Company = "LoreSoft";
public const string Configuration = "Debug";
public const string Copyright = "Copyright © 2023 LoreSoft";
public const string Description = "Source generator to expose assembly attributes as string constants";
public const string FileVersion = "1.0.0.0";
public const string InformationalVersion = "1.0.0";
public const string Product = "AssemblyMetadata.Generators.Tests";
public const string Title = "AssemblyMetadata.Generators.Tests";
public const string Version = "1.0.0.0";
public const string RepositoryUrl = "https://github.com/loresoft/AssemblyMetadata.Generators";
public const string NeutralResourcesLanguage = "en-US";
}
```

### Namespace

Set the `ThisAssemblyNamespace` MSBuild property to set the namespace of the generated `ThisAssembly` class. Otherwise, it will be in the global namespace.

Put `ThisAssembly` in the projects root namespace.

```xml
<PropertyGroup>
<ThisAssemblyNamespace>$(RootNamespace)</ThisAssemblyNamespace>
</PropertyGroup>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="DemoMeta/DemoMeta.csproj" />
</Solution>
Comment on lines +1 to +3

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add a .sln file alongside .slnx to satisfy downstream discovery.

MultiGeneratorV2.GatherData currently resolves solutions with Directory.GetFiles(..., "*.sln") (see v2/Generator/MultiGeneratorV2.cs:466), so this .slnx-only setup can break tour/video/catalog generation paths that depend on output.fullPathToSln.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v2/rscg_examples/AssemblyMetadata.Generators/src/DemoMeta.slnx` around lines
1 - 3, Add a parallel .sln file next to the existing .slnx so downstream
resolution (MultiGeneratorV2.GatherData which searches Directory.GetFiles(...,
"*.sln")) can find a solution; create a minimal solution file containing the
same Project entry as the .slnx (pointing to DemoMeta/DemoMeta.csproj) so
output.fullPathToSln is populated for tour/video/catalog generation paths.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AssemblyMetadata.Generators" Version="2.2.0" OutputItemType="Analyzer"
ReferenceOutputAssembly="false" />
</ItemGroup>
<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Console.WriteLine(ThisAssembly.Title);

Console.WriteLine(ThisAssembly.TargetFramework);
39 changes: 39 additions & 0 deletions v2/rscg_examples/AssemblyMetadata.Generators/video.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"scriptName": "AssemblyMetadata.Generators",
"steps":
[
{"typeStep":"exec","arg":"clipchamp.exe launch"},
{"typeStep":"text","arg": "Welcome to Roslyn Examples"},
{"typeStep":"text","arg":"If you want to see more examples , see List Of RSCG"},
{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG"},
{"typeStep":"text","arg": "My name is Andrei Ignat and I am deeply fond of Roslyn Source Code Generator. "},

{"typeStep":"text","arg": "Today I will present AssemblyMetadata.Generators . Generating assembly metadata attributes at compile time. ."},
{"typeStep":"browser","arg":"https://www.nuget.org/packages/AssemblyMetadata.Generators/"},
{"typeStep":"text","arg": "The whole example is here"},
{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/AssemblyMetadata.Generators"},
{"typeStep":"text","arg": "You can download the code from here"},
{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/AssemblyMetadata.Generators#download-example-net--c-"},
{"typeStep":"text","arg":"Here is the code downloaded "},
{"typeStep":"exec","arg":"explorer.exe /select,D:\\gth\\RSCG_Examples\\v2\\Generator.sln"},
{"typeStep":"text","arg": "So , let's start the project with Visual Studio Code "},
{"typeStep":"stepvscode","arg": "-n D:\\gth\\RSCG_Examples\\v2"},

{"typeStep":"text","arg": "To use it ,you will put the Nuget AssemblyMetadata.Generators into the csproj "},

{"typeStep":"stepvscode","arg": "-r -g D:\\gth\\RSCG_Examples\\v2\\rscg_examples\\AssemblyMetadata.Generators\\src\\DemoMeta\\DemoMeta.csproj"},

{"typeStep":"text","arg": "And now I will show you an example of using AssemblyMetadata.Generators"},

{"typeStep":"hide","arg": "now execute the tour in VSCode"},
{"typeStep":"tour", "arg": "src/.tours/"},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Tour path appears inconsistent with the actual tour file location.

Line 29 points to src/.tours/, but this PR adds v2/.tours/AssemblyMetadata.Generators.tour. This likely breaks the scripted “tour” step.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v2/rscg_examples/AssemblyMetadata.Generators/video.json` at line 29, The tour
step entry with "typeStep":"tour" has an incorrect "arg" pointing to
"src/.tours/"; update the "arg" value to the actual tour file path added in this
PR (e.g. "v2/.tours/AssemblyMetadata.Generators.tour" or the relative path that
points to AssemblyMetadata.Generators.tour) so the tour step correctly
references the new tour file.

{"typeStep":"text","arg":" And I will execute the project"},
{"typeStep":"showproj", "arg":"DemoMeta.csproj"},
{"typeStep":"text","arg":" This concludes the project"},
{"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/AssemblyMetadata.Generators#download-example-net--c-",
SpeakTest=" "},
{"typeStep":"waitseconds","arg":"30"},
]
Comment on lines +35 to +38

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Validate JSON syntax after fix
jq . v2/rscg_examples/AssemblyMetadata.Generators/video.json >/dev/null

Repository: ignatandrei/RSCG_Examples

Length of output: 128


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="v2/rscg_examples/AssemblyMetadata.Generators/video.json"
echo "== File: $FILE =="
echo "-- Lines 20-45 --"
nl -ba "$FILE" | sed -n '20,45p'

echo
echo "-- Tour references (.tours) --"
rg -n "\.tours" "$FILE" || true

echo
echo "-- Check expected tour file path(s) --"
ls -la v2/.tours/AssemblyMetadata.Generators.tour 2>/dev/null || echo "MISSING: v2/.tours/AssemblyMetadata.Generators.tour"
ls -la src/.tours/AssemblyMetadata.Generators.tour 2>/dev/null || echo "MISSING: src/.tours/AssemblyMetadata.Generators.tour"

Repository: ignatandrei/RSCG_Examples

Length of output: 216


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="v2/rscg_examples/AssemblyMetadata.Generators/video.json"
echo "== File: $FILE =="
echo "-- Lines 20-45 --"
awk 'NR>=20 && NR<=45 {printf "%6d  %s\n", NR, $0}' "$FILE"

echo
echo "-- Tour references (.tours) --"
rg -n "\.tours" "$FILE" || true

echo
echo "-- Check expected tour file path(s) --"
ls -la v2/.tours/AssemblyMetadata.Generators.tour 2>/dev/null || echo "MISSING: v2/.tours/AssemblyMetadata.Generators.tour"
ls -la src/.tours/AssemblyMetadata.Generators.tour 2>/dev/null || echo "MISSING: src/.tours/AssemblyMetadata.Generators.tour"

Repository: ignatandrei/RSCG_Examples

Length of output: 1587


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="v2/rscg_examples/AssemblyMetadata.Generators/video.json"

python3 - <<'PY'
import json, re, pathlib

path = pathlib.Path("v2/rscg_examples/AssemblyMetadata.Generators/video.json")
s = path.read_text(encoding="utf-8")

# Simulate the intended fix: SpeakTest=" "},  ->  "SpeakTest":" "},
s2 = s.replace('SpeakTest=" "},', '"SpeakTest":" "},')

try:
    json.loads(s2)
    print("JSON parse after simulated fix: OK")
except Exception as e:
    print("JSON parse after simulated fix: FAIL")
    print(type(e).__name__ + ":", e)
PY

echo
echo "== Tour references (.tours) =="
rg -n "\.tours" "$FILE" || true

Repository: ignatandrei/RSCG_Examples

Length of output: 247


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
import json, pathlib, re

path = pathlib.Path("v2/rscg_examples/AssemblyMetadata.Generators/video.json")
s = path.read_text(encoding="utf-8")

# 1) Fix invalid property assignment syntax
s = s.replace('SpeakTest=" "},', '"SpeakTest":" "},')

# 2) Remove trailing comma immediately before the closing array bracket (if present)
#    Targets the specific pattern shown: the last object ends with "},\n  ]"
s = re.sub(r'("typeStep"\s*:\s*"waitseconds"\s*,\s*"arg"\s*:\s*"30")\s*,\s*\n(\s*\])', r'\1\n\2', s)

try:
    json.loads(s)
    print("JSON parse after simulated full fix: OK")
except Exception as e:
    print("JSON parse after simulated full fix: FAIL")
    print(type(e).__name__ + ":", e)
PY

Repository: ignatandrei/RSCG_Examples

Length of output: 174


🏁 Script executed:

#!/bin/bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
p = Path("v2/rscg_examples/AssemblyMetadata.Generators/video.json")
lines = p.read_text(encoding="utf-8").splitlines(True)  # keep newlines
for i in range(33, 40):  # 1-based
    line = lines[i-1]
    print(f"{i}: {line!r}")
PY

Repository: ignatandrei/RSCG_Examples

Length of output: 435


🏁 Script executed:

#!/bin/bash
python3 - <<'PY'
from pathlib import Path
import json, re

p = Path("v2/rscg_examples/AssemblyMetadata.Generators/video.json")
s = p.read_text(encoding="utf-8")

# Fix 1: SpeakTest=" "  ->  "SpeakTest":" "
s = s.replace('SpeakTest=" "}', '"SpeakTest":" "}')

# Fix 2: remove trailing comma before closing array bracket
s = re.sub(r'(\{\s*"typeStep"\s*:\s*"waitseconds"\s*,\s*"arg"\s*:\s*"30"\s*\})\s*,\s*(\n?\s*\])',
           r'\1\2',
           s)

try:
    json.loads(s)
    print("JSON parse after targeted fixes: OK")
except Exception as e:
    print("JSON parse after targeted fixes: FAIL")
    print(type(e).__name__ + ":", e)
PY

Repository: ignatandrei/RSCG_Examples

Length of output: 105


Fix invalid JSON + tour path in v2/rscg_examples/AssemblyMetadata.Generators/video.json

  • Lines 35-38: file is invalid JSON due to SpeakTest=" " (wrong JSON key syntax) and a trailing comma after the final array element ({"typeStep":"waitseconds","arg":"30"}, before ]).
  • Line 29: tour arg points to src/.tours/, but the tour file exists under v2/.tours/AssemblyMetadata.Generators.tour.
Suggested fix (JSON)
 {"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/AssemblyMetadata.Generators#download-example-net--c-",
-SpeakTest=" "},
+"SpeakTest":" "},
 {"typeStep":"waitseconds","arg":"30"},
-{"typeStep":"waitseconds","arg":"30"},
+{"typeStep":"waitseconds","arg":"30"}
 ]
 }
  • Suggested fix (tour path): change line 29 from src/.tours/ to the correct v2/.tours/ location.
📝 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.

Suggested change
{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/AssemblyMetadata.Generators#download-example-net--c-",
SpeakTest=" "},
{"typeStep":"waitseconds","arg":"30"},
]
{"typeStep":"browser","arg":"https://ignatandrei.github.io/RSCG_Examples/v2/docs/AssemblyMetadata.Generators#download-example-net--c-",
"SpeakTest":" "},
{"typeStep":"waitseconds","arg":"30"}
]
🧰 Tools
🪛 Biome (2.4.15)

[error] 36-36: Property key must be double quoted

(parse)


[error] 36-36: unexpected character =

(parse)


[error] 36-36: expected , but instead found " "

(parse)


[error] 36-36: expected : but instead found }

(parse)


[error] 38-38: Expected an array, an object, or a literal but instead found ']'.

(parse)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v2/rscg_examples/AssemblyMetadata.Generators/video.json` around lines 35 -
38, The JSON in v2/rscg_examples/AssemblyMetadata.Generators/video.json is
invalid: remove the malformed key syntax SpeakTest=" " (replace with a proper
JSON key/value or delete the entry) and remove the trailing comma after the last
array element (the object with "typeStep":"waitseconds","arg":"30"); also fix
the tour path argument that currently points to "src/.tours/" to the correct
"v2/.tours/AssemblyMetadata.Generators.tour" so the "arg" for the tour step
resolves correctly.

}
Comment on lines +37 to +39
4 changes: 3 additions & 1 deletion v2/rscg_examples_site/docs/Authors/LoreSoft.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Author : LoreSoft

Number RSCG: 1
Number RSCG: 2


1 [Injectio](/docs/Injectio) [![Nuget](https://img.shields.io/nuget/dt/Injectio?label=Injectio)](https://www.nuget.org/packages/Injectio/) ![GitHub Repo stars](https://img.shields.io/github/stars/loresoft/Injectio?style=social) 2023-08-17

2 [AssemblyMetadata.Generators](/docs/AssemblyMetadata.Generators) [![Nuget](https://img.shields.io/nuget/dt/AssemblyMetadata.Generators?label=AssemblyMetadata.Generators)](https://www.nuget.org/packages/AssemblyMetadata.Generators/) ![GitHub Repo stars](https://img.shields.io/github/stars/loresoft/AssemblyMetadata.Generators?style=social) 2026-05-15

Loading
Loading