On .NET Live: Lessons Learned Building Source Generators

  Рет қаралды 3,431

dotnet

dotnet

Күн бұрын

C# code generators are tools that automatically create source code based on predefined templates or rules. In this week's episode, community MVP Jason Bock returns to show us lessons he's learned about what works, what doesn't, and what developers should avoid!
⌚ Chapters:
00:00 Countdown begins
03:12 Welcome to On .NET Live
03:57 Jason Bock intro
06:48 Source Generators - overview
11:12 Demo - lessons learned
57:00 In summary
59:21 Wrap
Resources:
Blog:
devblogs.microsoft.com/dotnet...
Source Generators Docs:
learn.microsoft.com/en-us/dot...
Jason's Repo: github.com/JasonBock/Rocks
Benchmark Mock Net Repo:
github.com/ecoAPM/BenchmarkMo...
Incremental Generators Repo:
github.com/dotnet/roslyn/blob...
Null Safety Docs:
learn.microsoft.com/en-us/tra...
Featuring: Jason Bock, Frank Boucher, David Pine (@davidpine7), Cam Soper
#code-generators

Пікірлер: 7
@NotInventedHereShow
@NotInventedHereShow Ай бұрын
Excellent walkthrough. A few suggestions: You don't need to restart VS to observe changes to a source generator in another project. A `dotnet build-server shutdown` at the command line resets the build-server cache and forces the generators to re-run from scratch. Wrt. to nullable, I typically wrap generated code in `#nullable annotation`/`#nullable restore`. Then I do not have to use the damn-it operator in the generated code.
@daniloa.1455
@daniloa.1455 15 күн бұрын
20:28 Target .NET Standard 2.0 22:37 Use IIncrementalGenerator 23:44 ForAttributeWithMetadataName() 27:37 Use Immutable, Read-Only Models ???? Code Generation 32:14 Naming Collisions 37:25 Avoid Package References 39:18 Be Nullable, but Be Forgiving 42:16 Reloading Sucks 46:47 Roslyn APIs can be "Surprising"
@IgnatAndrei
@IgnatAndrei Ай бұрын
You can modify source code with Roslyn Code Generator that writes interceptors.
@JasonBock
@JasonBock Ай бұрын
....sort of. You can intercept method invocations, but you can't change method bodies. Also, AFAIK, interceptors are still an experimental feature, so I didn't want to get into that in the talk - I had to enough to cover as-is :)
@StephenJWalter
@StephenJWalter Ай бұрын
Starts at about 3:56
@VOXindie
@VOXindie Ай бұрын
Start at 5:30
@ilayarajag6064
@ilayarajag6064 Ай бұрын
hi
Meet .NET Aspire
2:13
dotnet
Рет қаралды 19 М.
The Basics of Strings! [Pt 5] | C# for Beginners
9:53
dotnet
Рет қаралды 22 М.
СҰЛТАН СҮЛЕЙМАНДАР | bayGUYS
24:46
bayGUYS
Рет қаралды 717 М.
Indian sharing by Secret Vlog #shorts
00:13
Secret Vlog
Рет қаралды 49 МЛН
"Stop Using Async Await in .NET to Save Threads" | Code Cop #018
14:05
How do computers read code?
12:01
Frame of Essence
Рет қаралды 3 МЛН
WebView2 Browser Tutorail  Part 1/2 - Tabs - Basics
7:38
J-Coding
Рет қаралды 4,3 М.
Rust's Witchcraft
9:18
No Boilerplate
Рет қаралды 170 М.
Separating AI Hype from AI Reality
19:49
IAmTimCorey
Рет қаралды 2,4 М.
What are .NET Aspire components?
4:50
dotnet
Рет қаралды 2,6 М.
15 crazy new JS framework features you don’t know yet
6:11
Fireship
Рет қаралды 377 М.
What is Dev Time Orchestration in .NET Aspire?
4:38
dotnet
Рет қаралды 3,2 М.
Nokia 3310 versus Red Hot Ball
0:37
PressTube
Рет қаралды 3,6 МЛН
ПК с Авито за 3000р
0:58
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 1,4 МЛН
IPad Pro fix screen
1:01
Tamar DB (mt)
Рет қаралды 11 МЛН
как спасти усилитель?
0:35
KS Customs
Рет қаралды 446 М.