How to write better code in C# using Source Code Analyzers (Roslyn)

  Рет қаралды 43,358

Nick Chapsas

Nick Chapsas

Күн бұрын

Пікірлер: 55
@nickchapsas
@nickchapsas 3 жыл бұрын
I forgot to mention it in the video but you can find more Roslyn analyzers here: github.com/Cybermaxs/awesome-analyzers You can also search for "Roslyn analyzers GitHub" and you will find the most popular ones. People are creating some really good stuff. Don't forget to star their GitHub repos. - Keep Coding
@GregWilliamBryant
@GregWilliamBryant 3 жыл бұрын
Hello Nick, further video creating analyzers would be awesome. Also, Rider centric tutorial would be good, as the one's I have seen have been Visual Studio-based. Further, some areas I would personally find helpful are how to efficiently distribute them with your solution (I'm guessing Nuget is the way forward here) and the foibles of how Rider interacts with Analyzers and it's own built-in one, code cleaning rules etc. I've found that this is one area the Rider has a fairly messy implementation on this front. Also, that touches on my final interest, do you have any best practices for distributing common code inside your organisation. I've seen Nuget suggested and equally frowned upon for this.
@seroleyat
@seroleyat 2 ай бұрын
@@GregWilliamBryant well i guess he hast not made a video about that yet :/
@seroleyat
@seroleyat 2 ай бұрын
still no video i guess? :/
@JJayToKlamca
@JJayToKlamca 3 жыл бұрын
Just discovered your channel. Your every video is a top notch material. Amazing work!
@englishmasterycorner
@englishmasterycorner 3 жыл бұрын
Roslyn analyzers are like Grammarly for coders.
@janne_kekalainen
@janne_kekalainen 3 жыл бұрын
So true.
@awesomesauce804
@awesomesauce804 3 жыл бұрын
so I'll be even better at copy/paste? Perfect. I'm not looking to increase my fundamental knowledge but instead to skate by at my day job being overpaid the entire time. It sounds like this is great for me, thanks for the feedback. /s
@killpopers
@killpopers 3 жыл бұрын
I'd love to see how to write analyzers please do a video on this
@tofraley
@tofraley 3 жыл бұрын
Great video! Yes, I'd love to see one on how to write a source analyzer.
@thibaudgallanddemanneville174
@thibaudgallanddemanneville174 3 жыл бұрын
Great video as always! I finally understood exactly what the enclosure is !
@lior279
@lior279 3 жыл бұрын
Great work Nick, Lots of value in your videos. Yes I would like Roslyn analyzers videos. Also, can you elaborate about how and what for do you use reflection.
@sdasddsasadad2287
@sdasddsasadad2287 3 жыл бұрын
Thanks! it really helped me to get started programming!!
@nanvlad
@nanvlad 3 жыл бұрын
Hi Nick. Thanks for this video. Can you share a list of useful source analyzers, like you showed in the video? Are there many of them?
@nickchapsas
@nickchapsas 3 жыл бұрын
Ah damn I forgot to mention it on the video. There is a repo that contains a list of them here: github.com/Cybermaxs/awesome-analyzers but it's a bit outdated. It still contains many good ones.
@meirkr
@meirkr 3 жыл бұрын
I would also appreciate having.a video about writing analyzars. Tx.
@mystiqkc
@mystiqkc 3 жыл бұрын
Excellent video!!
@roro1826
@roro1826 3 жыл бұрын
I've been watching your vids for sometime now, I couldn't resist hitting the sub button for this vid
@irelandfpv
@irelandfpv 3 жыл бұрын
Interesting topic. Never used it in live development yet.
@carlosalarcon2737
@carlosalarcon2737 3 жыл бұрын
Finally I found the video I wanted!! Thanks a lot!! Btw my rider in Linux shows reference not found when I compile (as a warning) but the alert is shown.
@digitalphear1960
@digitalphear1960 9 ай бұрын
There was a guy i met telling me about how hw makes boxes within boxes in C#. Now that sounds nice for a guy like me who can make boolean chip sets to accomplish 'almost' any task.. most code seems to be the same set up overall true/fulse. Light-up/black-out cell groups. And.OR.XOR But all over the place wich compared to physical boards/chips that lead into one another.. you can see how it gets confusing for someone like me. The box within box sounds nice for keeping track of group and function with an intangible :D
@richardikin
@richardikin 3 жыл бұрын
Absolutely fascinating!
@PhilippeMatray
@PhilippeMatray 3 жыл бұрын
Hello Nick, In this video, you have shown 2 analyzers that are really interesting. Are there any others that you would recommend?
@khamid70
@khamid70 3 жыл бұрын
Bravo, keep on
@Pedro5antos_
@Pedro5antos_ 3 жыл бұрын
10:50 awesome content, mate!
@atikhasan7714
@atikhasan7714 3 жыл бұрын
Hello, Dear can you make a video tutorial about singleton, scope, and transient (which is better for.net core API)
@SimbaTheDogKing
@SimbaTheDogKing 3 жыл бұрын
Can .NET analyzer/Roslyn analyzer be added to CICD pipeline?
@nickchapsas
@nickchapsas 3 жыл бұрын
If it is installed as a Nuget package then yeah
@crazywill32
@crazywill32 3 жыл бұрын
I see Nick uses "!." As and operator a lot. As I am still learning C#, what does this mean?
@nickchapsas
@nickchapsas 3 жыл бұрын
It means that this value will definitely not be null. I’m using it to suppress the warning for the video. In a realistic scenario you might wanna handle null appropriately
@crazywill32
@crazywill32 3 жыл бұрын
@@nickchapsas Thanks Nick! I have found the videos super insightful and interesting. As a professional in another field that codes for a small team, they point out things I should look into to be better.
@MrGuardianX
@MrGuardianX 3 жыл бұрын
As of November 2021 your example with Reflections doesn't work. I mean the analyzer doesn't highlight this field anymore (v 0.3.0)
@petrzurek5713
@petrzurek5713 3 жыл бұрын
Nick, which language do you like to use more, Kotlin or C#?
@nickchapsas
@nickchapsas 3 жыл бұрын
I use C# waaaaay more. It's like a 95% C# 5% Kotlin. I only use Kotlin for personal random stuff and not for an actual professional purpose. I do enjoy it a lot though.
@petrzurek5713
@petrzurek5713 3 жыл бұрын
@@nickchapsas Nice, thanks. Do you mostly write cross-platform .net core code these days or do you write windows specific stuff still (wpf, iis web apps, ...)
@nickchapsas
@nickchapsas 3 жыл бұрын
@@petrzurek5713 crossplatform. I've only worked on windows specific stuff for 1 year right before .net core came out
@adityashinde1657
@adityashinde1657 3 жыл бұрын
Please adjust the font size/zoom levels, to comfortably watch the content on big screens.
@Albileon
@Albileon 3 жыл бұрын
Seems fine on my screen? Not having any issues.
@diegoronkkomaki6858
@diegoronkkomaki6858 3 жыл бұрын
Nah this is perfect zoom and font size when watching on a mobile device.
@nataliasikorka4825
@nataliasikorka4825 3 жыл бұрын
Hi Nick, I just watched your video about IHttpClientFactory and was wondering - should i dispose instance of HttpClient from factory like this: ``` using var httpClient = httpClientFactory.CreateClient("Test"); ``` or it does not matter cause of some handling in IHttpClientFactory or even we shouldn't? Sorry that this is not in subject of this video, but it's the newest and there is bigger chance for reply ^^
@GregWilliamBryant
@GregWilliamBryant 3 жыл бұрын
I would say yes :)
@zirexpl6395
@zirexpl6395 3 жыл бұрын
I don't understand how to get that and use it. It's something like external software which u run during programming, or nuget package... Or maybe i should write it by myself. If there is answear yes" for all question, i would prefer a complete package of this instead of writing it by myself
@ahmedkhudhair8035
@ahmedkhudhair8035 3 жыл бұрын
Can you write code that Cannot be decompile for security
@igorthelight
@igorthelight 3 жыл бұрын
That's impossible as far as I know. You could make it much less readable tho. Also, ANY scripting language (C#, VB, Java, Kotlin, JS, Python... ) is a bad idea if you are concerned about your code security.
@sohampatel1063
@sohampatel1063 3 жыл бұрын
As far i know only c++ makes it hard to reverse engineer the code.
@ahmedkhudhair8035
@ahmedkhudhair8035 3 жыл бұрын
@@igorthelight can you make video on reverse engineering in .net
@igorthelight
@igorthelight 3 жыл бұрын
@@sohampatel1063 Not only C++ but ALL programming languages that produce native binaries (C, C++, Rust, COBOL, Fortran, Pascal, Kotlin Native...)
@igorthelight
@igorthelight 3 жыл бұрын
@@ahmedkhudhair8035 Sadly, I can't say that I'm professional enough to make a video. But I may recommend to try "Telerik JustDecompile", "JetBrains dotPeek" and "ILSpy". Just play around with them and you will be able to decompile most .NET programs. To decompile more professional programs you will need more knowledge (Google Search is a good tool ;-) )
@sohampatel1063
@sohampatel1063 3 жыл бұрын
Pleas make video on how to mak custom analyzers and more and more❤️
@weluvmusicz
@weluvmusicz 3 жыл бұрын
Make an analyzer that prevents my colleagues from using foreign language words instead of english in source code.
@danielschulz7391
@danielschulz7391 3 жыл бұрын
Best is two languages mixed in one property or function^^
@carlosalarcon2737
@carlosalarcon2737 3 жыл бұрын
It's called pull request rejected :)
@clearlyunwell
@clearlyunwell 3 жыл бұрын
👍🏽
@pawetarsaa9904
@pawetarsaa9904 3 жыл бұрын
You missed the opportunity to type ANALyzer
@canabale
@canabale Жыл бұрын
I am honestly very disappointed in this Video... I was actually expecting to see some actual code of an individual analyzer... not just examples for given ones...
What is Span in C# and why you should be using it
15:15
Nick Chapsas
Рет қаралды 264 М.
Cleaner Code: 3 Ways You Can Write Cleaner Code
7:41
Coding with Lewis
Рет қаралды 100 М.
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
Writing C# without allocating ANY memory
19:36
Nick Chapsas
Рет қаралды 154 М.
Space Invaders Clone in C#  // Code Review
1:10:52
The Cherno
Рет қаралды 75 М.
How To Write Clean Code With The Help Of Static Code Analysis
9:50
Milan Jovanović
Рет қаралды 26 М.
Why You Shouldn't Nest Your Code
8:30
CodeAesthetic
Рет қаралды 2,8 МЛН
Are events in C# even relevant anymore?
16:19
Nick Chapsas
Рет қаралды 172 М.
Writing Code That Runs FAST on a GPU
15:32
Low Level
Рет қаралды 579 М.
Where are types allocated in .NET and why people get it so wrong
14:35
Don't throw exceptions in C#. Do this instead
18:13
Nick Chapsas
Рет қаралды 266 М.
C++ Super Optimization: 1000X Faster
15:33
Dave's Garage
Рет қаралды 334 М.
You are doing .NET logging wrong. Let's fix it
25:29
Nick Chapsas
Рет қаралды 176 М.
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН