Skip to content
Merged

start #440

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
34 changes: 28 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# RSCG - 248 Examples of Roslyn Source Code Generators / 16 created by Microsoft /
# RSCG - 249 Examples of Roslyn Source Code Generators / 16 created by Microsoft /

The RSCG_Examples repository is a comprehensive documentation system that automatically processes and showcases 248 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 249 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 : 2025-12-15 => 15 December 2025
## Latest Update : 2025-12-16 => 16 December 2025

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

If you want just those from Microsoft, please click ***[Microsoft](https://ignatandrei.github.io/RSCG_Examples/v2/docs/Authors/Microsoft)***

If you want to see by category, please click ***[category](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples)***
or click any category below
[actor](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#actor) -[ai](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#ai) -[aop](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#aop) -[api](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#api) -[async](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#async) -[bitwise](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#bitwise) -[blazor](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#blazor) -[bool](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#bool) -[builder](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#builder) -[clone](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#clone) -[codetostring](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#codetostring) -[commandline](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#commandline) -[console](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#console) -[constructor](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#constructor) -[database](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#database) -[decorator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#decorator) -[dependencyinjection](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#dependencyinjection) -[disposer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#disposer) -[enhancementclass](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementclass) -[enhancementproject](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementproject) -[enum](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enum) -[equals](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#equals) -[filestocode](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#filestocode) -[functionalprogramming](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#functionalprogramming) -[hangfire](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#hangfire) -[interface](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#interface) -[linq](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#linq) -[mapper](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mapper) -[mcp](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mcp) -[mediator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mediator) -[mixin](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mixin) -[mvc](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mvc) -[mvvm](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mvvm) -[optimizer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#optimizer) -[primitiveobsession](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#primitiveobsession) -[rx](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#rx) -[serializer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#serializer) -[signalr](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#signalr) -[statemachine](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#statemachine) -[templating](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#templating) -[tests](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#tests) -[validator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#validator) -[winapi](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#winapi) -
[actor](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#actor) -[ai](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#ai) -[aop](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#aop) -[api](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#api) -[async](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#async) -[bitwise](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#bitwise) -[blazor](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#blazor) -[bool](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#bool) -[builder](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#builder) -[clone](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#clone) -[codetostring](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#codetostring) -[commandline](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#commandline) -[console](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#console) -[constructor](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#constructor) -[database](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#database) -[decorator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#decorator) -[dependencyinjection](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#dependencyinjection) -[disposer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#disposer) -[enhancementclass](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementclass) -[enhancementproject](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementproject) -[enum](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enum) -[equals](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#equals) -[filestocode](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#filestocode) -[functionalprogramming](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#functionalprogramming) -[hangfire](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#hangfire) -[interface](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#interface) -[linq](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#linq) -[mapper](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mapper) -[mcp](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mcp) -[mediator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mediator) -[mixin](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mixin) -[mvc](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mvc) -[mvvm](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#mvvm) -[optimizer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#optimizer) -[primitiveobsession](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#primitiveobsession) -[profiler](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#profiler) -[rx](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#rx) -[serializer](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#serializer) -[signalr](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#signalr) -[statemachine](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#statemachine) -[templating](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#templating) -[tests](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#tests) -[validator](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#validator) -[winapi](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#winapi) -


## If you have a Roslyn Source Code Generator, please create an issue.
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 248 Roslyn Source Code Generators that I have tested you can see and download source code example.
Those are the 249 Roslyn Source Code Generators that I have tested you can see and download source code example.
( including 16 from Microsoft )
### 249. [Silhouette](https://ignatandrei.github.io/RSCG_Examples/v2/docs/Silhouette) , in the [Profiler](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#profiler) category

Generated on : 2025-12-16 => 16 December 2025

<details>
<summary>Expand</summary>



Author: Kevin Gosse

A library to build .NET profilers in .NET. No need for C++ anymore, just C#.

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


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

Source: [https://github.com/kevingosse/Silhouette](https://github.com/kevingosse/Silhouette)

</details>

### 248. [docopt.net](https://ignatandrei.github.io/RSCG_Examples/v2/docs/docopt.net) , in the [CommandLine](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#commandline) category

Generated on : 2025-12-15 => 15 December 2025
Expand Down Expand Up @@ -2142,7 +2164,7 @@ Generated on : 2024-08-01 => 01 August 2024



Author: AndreiIgnat
Author: Ignat Andrei

Roslyn Diagram generator for external dependencies

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 : 2025-12-15 => 15 December 2025
## Latest Update : 2025-12-16 => 16 December 2025



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

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

,{
"file": "rscg_examples/Silhouette/src/ProfilerDemo/Program.cs",
"description": "File Program.cs \r\n>> dotnet run --project rscg_examples/Silhouette/src/ProfilerDemo/ProfilerDemo.csproj ",
"pattern": "this is the code"
}


,{
"file": "rscg_examples/Silhouette/src/ProfilerDemo/obj/GX/Silhouette.SourceGenerator/Silhouette.SourceGenerator.ProfilerAttributeSourceGenerator/silhouette.dllmain.g.cs",
"description": "Generated File 1 from 1 : silhouette.dllmain.g.cs ",
"line": 1
}

],

"ref": "main"

}
1 change: 1 addition & 0 deletions v2/Generator/all.csv
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,4 @@ Nr,Key,Source,Category
246,Imposter, https://github.com/themidnightgospel/Imposter,Tests
247,BlazorOcticons, https://github.com/BlazorOcticons/BlazorOcticons,Blazor
248,docopt.net, https://github.com/docopt/docopt.net,CommandLine
249,Silhouette, https://github.com/kevingosse/Silhouette,Profiler
3 changes: 2 additions & 1 deletion v2/GeneratorData/Category.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public enum Category
Validator=40,
Decorator= 41,
MCP= 42,
Bool=43
Bool=43,
Profiler=44,
}

6 changes: 6 additions & 0 deletions v2/RSCGExamplesData/GeneratorDataRec.json
Original file line number Diff line number Diff line change
Expand Up @@ -1503,5 +1503,11 @@
"Category": 32,
"dtStart": "2025-12-15T00:00:00",
"show": true
},
{
"ID":"Silhouette",
"Category": 44,
"dtStart": "2025-12-16T00:00:00",
"show": true
}
]
53 changes: 53 additions & 0 deletions v2/book/examples/Silhouette.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

<h1>RSCG nr 249 : Silhouette</h1>

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

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

<p>Author :Kevin Gosse</p>

<p>Source: <a href="https://github.com/kevingosse/Silhouette" target="_blank">https://github.com/kevingosse/Silhouette</a> </p>

<h2>About</h2>

Profiling .net applicationsMeasuring performance improvements
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add spacing/punctuation between sentences.

The description text is missing proper spacing or punctuation between "applications" and "Measuring".

🔎 Proposed fix
-Profiling .net applicationsMeasuring performance improvements
+Profiling .NET applications. Measuring performance improvements.

Note: Also consider capitalizing ".NET" for consistency with official branding.

📝 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
Profiling .net applicationsMeasuring performance improvements
Profiling .NET applications. Measuring performance improvements.
🤖 Prompt for AI Agents
In v2/book/examples/Silhouette.html around line 15, the sentence "Profiling .net
applicationsMeasuring performance improvements" lacks spacing/punctuation and
uses incorrect casing; split into two sentences or add a separator and
capitalize ".NET" (e.g., "Profiling .NET applications. Measuring performance
improvements" or "Profiling .NET applications — measuring performance
improvements") to fix readability and branding.


<h2>
How to use
</h2>
<h3>
Add reference to the <a href="https://www.nuget.org/packages/Silhouette/" target="_blank">Silhouette</a> in the csproj
</h3>
<img src="images/Silhouette/ProfilerDemo.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/Silhouette/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 silhouette.dllmain.g.cs
<br />
<img src="images/Silhouette/generated/silhouette.dllmain.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/Silhouette'>
https://ignatandrei.github.io/RSCG_Examples/v2/docs/Silhouette
</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>

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 248 RSCG with examples =>
This is the list of 249 RSCG with examples =>
</h1>

<table >
Expand Down Expand Up @@ -1018,6 +1018,10 @@ <h1>
<td>248</td>
<td><a href="examples/docopt.net.html">docopt.net</a></td>
</tr>
<tr>
<td>249</td>
<td><a href="examples/Silhouette.html">Silhouette</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 @@ -262,6 +262,7 @@ input-files:
- examples/Imposter.html
- examples/BlazorOcticons.html
- examples/docopt.net.html
- examples/Silhouette.html

# or you may use input-file: with a single value
# defaults:
Expand Down
2 changes: 1 addition & 1 deletion v2/rscg_examples/RSCG_ExportDiagram/description.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"https://github.com/ignatandrei/RSCG_ExportDiagram"
],
"link":"RSCG_ExportDiagram",
"author":"AndreiIgnat",
"author":"Ignat Andrei",
"source":"https://github.com/ignatandrei/RSCG_ExportDiagram"
},
"data":{
Expand Down
22 changes: 22 additions & 0 deletions v2/rscg_examples/Silhouette/description.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"generator":{
"name":"Silhouette",
"nuget":[
"https://www.nuget.org/packages/Silhouette/"
],
"link":"https://github.com/kevingosse/Silhouette",
"author":"Kevin Gosse",
"source":"https://github.com/kevingosse/Silhouette"
},
"data":{
"goodFor":["Profiling .net applications","Measuring performance improvements"],
"csprojDemo":"ProfilerDemo.csproj",
"csFiles":["Program.cs"],
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add MyProfiler.cs to the csFiles array.

The csFiles array only includes "Program.cs", but MyProfiler.cs contains the core profiler implementation and should likely be documented as part of the example.

🔎 Proposed fix
-     "csFiles":["Program.cs"],
+     "csFiles":["Program.cs","MyProfiler.cs"],
📝 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
"csFiles":["Program.cs"],
"csFiles":["Program.cs","MyProfiler.cs"],
🤖 Prompt for AI Agents
In v2/rscg_examples/Silhouette/description.json around line 14, the csFiles
array currently lists only "Program.cs" but omits "MyProfiler.cs"; update the
csFiles array to include "MyProfiler.cs" (e.g., add "MyProfiler.cs" as an entry
alongside "Program.cs") so the profiler implementation file is documented and
packaged with the example.

"excludeDirectoryGenerated":["NativeObjects"],
"includeAdditionalFiles":[""]
},
"links":{
"blog":"",
"video":""
}
}
1 change: 1 addition & 0 deletions v2/rscg_examples/Silhouette/nuget.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A library to build .NET profilers in .NET. No need for C++ anymore, just C#.
86 changes: 86 additions & 0 deletions v2/rscg_examples/Silhouette/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
Silhouette - A library to build .NET profilers in .NET
=======================

# Quick start

Create a new C# NativeAOT project. Reference the Silhouette nuget package and add a class inheriting from `Silhouette.CorProfilerCallback11Base` (you can use a different version of `CorProfilerCallbackBase` depending on the version of .NET you're targeting). Override the `Initialize` method. It will be called with the highest version number of `ICorProfilerInfo` supported by the target runtime.

```csharp

using Silhouette;

[Profiler("0A96F866-D763-4099-8E4E-ED1801BE9FBC")] // Use your own profiler GUID here
internal partial class CorProfilerCallback : CorProfilerCallback11Base
{
protected override HResult Initialize(int iCorProfilerInfoVersion)
{
if (iCorProfilerInfoVersion < 11)
{
return HResult.E_FAIL;
}

var result = ICorProfilerInfo11.SetEventMask(COR_PRF_MONITOR.COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_MONITOR.COR_PRF_MONITOR_THREADS);

return result;
}
}
```

The `Profiler` attribute triggers a source-generator that emits the proper `DllGetClassObject` function and validates that the user is using the matching guid for the profiler. Alternatively, you can manually implement a `DllGetClassObject` method that will be called by the .NET runtime when initializing the profiler. Use the built-in `ClassFactory` implementation and give it an instance of your `CorProfiler` class.

```csharp
using Silhouette;
using System.Runtime.InteropServices;

internal class DllMain
{
// This code is automatically generated when using the `[Profiler]` attribute on `CorProfilerCallback`
[UnmanagedCallersOnly(EntryPoint = "DllGetClassObject")]
public static unsafe HResult DllGetClassObject(Guid* rclsid, Guid* riid, nint* ppv)
{
// Use your own profiler GUID here
if (*rclsid != new Guid("0A96F866-D763-4099-8E4E-ED1801BE9FBC"))
{
return HResult.CORPROF_E_PROFILER_CANCEL_ACTIVATION;
}

*ppv = ClassFactory.For(new CorProfilerBase());

return HResult.S_OK;
}
}
```

`CorProfilerXxBase` offers base virtual methods for all `ICorProfilerCallback` methods, so override the ones you're interested in:

```csharp
protected override HResult ThreadCreated(ThreadId threadId)
{
Console.WriteLine($"Thread created: {threadId.Value}");
return HResult.S_OK;
}
```

Use the `ICorProfilerInfoXx` fields to access the `ICorProfilerInfo` APIs:

```csharp
private unsafe string ResolveMethodName(nint ip)
{
try
{
var functionId = ICorProfilerInfo11.GetFunctionFromIP(ip).ThrowIfFailed();
var functionInfo = ICorProfilerInfo2.GetFunctionInfo(functionId).ThrowIfFailed();
using var metaDataImport = ICorProfilerInfo2.GetModuleMetaDataImport(functionInfo.ModuleId, CorOpenFlags.ofRead).ThrowIfFailed().Wrap();
var methodProperties = metaDataImport.Value.GetMethodProps(new MdMethodDef(functionInfo.Token)).ThrowIfFailed();
var typeDefProps = metaDataImport.Value.GetTypeDefProps(methodProperties.Class).ThrowIfFailed();

return $"{typeDefProps.TypeName}.{methodProperties.Name}";
}
catch (Win32Exception)
{
return "<unknown>";
}
}
```

Most methods return an instance of `HResult<T>`. You can deconstruct it into a `(HResult error, T result)` and manually check the error code. You can also use the `ThrowIfFailed()` method that will return only the result and throw a `Win32Exception` if the error code is not `S_OK`.
3 changes: 3 additions & 0 deletions v2/rscg_examples/Silhouette/src/ProfilerDemo.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="ProfilerDemo/ProfilerDemo.csproj" />
</Solution>
Loading