-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,37 @@ | ||
> **Warning** | This is not a practical project. If you find yourself ever needing this, consider rethinking everything. | ||
# cle-elum | ||
|
||
Experimental Roslyn activities and other fun stuff. | ||
> compiler hacking!!!!!1!! but for c# | ||
--- | ||
|
||
Experimental, questionable Roslyn activities. | ||
|
||
## Things | ||
|
||
### Roslyn Modding | ||
|
||
Modify Roslyn in-memory with [MonoMod](https://github.com/MonoMod/MonoMod) (RuntimeDetour) and a somewhat convenient little bit of API boilerplate: | ||
|
||
```cs | ||
[DiagnosticAnalyzer(LanguageNames.CSharp)] | ||
public sealed class MyAnalyzer : DiagnosticAnalyzer { | ||
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => | ||
ImmutableArray<DiagnosticDescriptor>.Empty; | ||
|
||
public MyAnalyzer() { | ||
// Your entrypoint lies within this class' constructor. | ||
BootstrapAnalyzer.EnsureInitialized(); | ||
Patch(); | ||
} | ||
|
||
public override void Initialize(AnalysisContext context) { } | ||
|
||
private static void Patch() { | ||
// use monomod here | ||
} | ||
} | ||
``` | ||
|
||
General changes that make normally-invalid stuff valid will be reflected properly in Visual Studio, but not anything that doesn't use Roslyn (such as Rider). |