On .NET Live: Lessons Learned Building Source Generators

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

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
@daniloa.1455
@daniloa.1455 2 ай бұрын
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"
@NotInventedHereShow
@NotInventedHereShow 3 ай бұрын
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.
@VOXindie
@VOXindie 3 ай бұрын
Start at 5:30
@IgnatAndrei
@IgnatAndrei 3 ай бұрын
You can modify source code with Roslyn Code Generator that writes interceptors.
@JasonBock
@JasonBock 3 ай бұрын
....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 3 ай бұрын
Starts at about 3:56
@ilayarajag6064
@ilayarajag6064 3 ай бұрын
hi
All About C# Source Generators | .NET Conf 2023
27:59
dotnet
Рет қаралды 23 М.
КАК ДУМАЕТЕ КТО ВЫЙГРАЕТ😂
00:29
МЯТНАЯ ФАНТА
Рет қаралды 4,4 МЛН
Best father #shorts by Secret Vlog
00:18
Secret Vlog
Рет қаралды 22 МЛН
Waterfall Over Agile In 2023???
9:00
Continuous Delivery
Рет қаралды 57 М.
A Complete .NET Developer's Guide to Span with Stephen Toub
1:02:48
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 87 М.
Writing async/await from scratch in C# with Stephen Toub
1:06:02
Why I Quit the Scrum Alliance
7:58
The Passionate Programmer
Рет қаралды 12 М.
ASP.NET Community Standup: Smart Components
1:26:59
dotnet
Рет қаралды 11 М.
"I Hate Agile!" | Allen Holub On Why He Thinks Agile And Scrum Are Broken
8:33
What's New in C# 12 | .NET Conf 2023
35:28
dotnet
Рет қаралды 55 М.
Samsung Galaxy 🔥 #shorts  #trending #youtubeshorts  #shortvideo ujjawal4u
0:10
Ujjawal4u. 120k Views . 4 hours ago
Рет қаралды 7 МЛН
😱Хакер взломал зашифрованный ноутбук.
0:54
Последний Оплот Безопасности
Рет қаралды 729 М.
Хотела заскамить на Айфон!😱📱(@gertieinar)
0:21
Взрывная История
Рет қаралды 6 МЛН
НЕ ПОКУПАЙ СМАРТФОН, ПОКА НЕ УЗНАЕШЬ ЭТО! Не ошибись с выбором…
15:23