Cover....1
Title Page....2
Copyright Page....3
Contributors....4
Table of Contents....8
Preface....14
Free Benefits with Your Book....20
Chapter 1: Introducing Tools and Skills for .NET....22
Introducing this book and its contents....23
Setting up your development environment....27
Setting up a database and projects for this book....36
Making good use of the GitHub repository for this book....73
Where to go for help....74
Using future versions of .NET with this book....80
Practicing and exploring....82
Summary....83
Chapter 2: Making the Most of the Tools in Your Code Editor....86
Introducing common tools and features....87
Tools in Visual Studio....90
Tools in VS Code....114
Decompiling .NET assemblies....118
Custom project and item templates....132
Practicing and exploring....139
Summary....141
Chapter 3: Source Code Management Using Git....144
Introducing source code management....145
Introducing Git....147
Working with Git....154
Reviewing Git repositories....170
Managing remote repositories....177
Branching and merging....180
Practicing and exploring....187
Summary....189
Chapter 4: Debugging and Memory Troubleshooting....190
Debugging strategies....190
Interactive debugging with Visual Studio....194
Understanding stack and heap memory....207
Tools and skills for memory troubleshooting....218
Practicing and exploring....223
Summary....224
Chapter 5: Logging, Tracing, and Metrics for Observability....226
Logging and tracing in .NET....227
Building a web service for logging....232
Monitoring with metrics in .NET....237
Introducing OpenTelemetry....245
Practicing and exploring....254
Summary....255
Chapter 6: Documenting Your Code, APIs, and Services....256
Introducing documentation....256
Documenting your source code....259
Documenting public APIs in class libraries....261
Documenting services....282
Documenting visually with Mermaid diagrams....288
Practicing and exploring....295
Summary....298
Chapter 7: Observing and Modifying Code Execution Dynamically....300
Working with reflection and attributes....301
Working with expression trees....318
Creating source generators....322
Practicing and exploring....327
Summary....328
Chapter 8: Protecting Data and Apps Using Cryptography....330
Understanding the vocabulary of protection....331
Encrypting and decrypting data....334
Hashing data....342
Signing data....347
Generating random numbers for cryptography....350
Authenticating and authorizing users....352
Practicing and exploring....360
Summary....361
Chapter 9: Multitasking and Concurrency....364
Understanding processes, threads, and tasks....364
Running tasks asynchronously....368
Synchronizing access to shared resources....384
Understanding async and await....393
Practicing and exploring....402
Summary....403
Chapter 10: Dependency Injection, Containers, and Service Lifetime....406
Introducing dependency injection....406
Implementing .NET Generic Host....415
Special cases of DI with ASP.NET Core....427
Practicing and exploring....431
Summary....432
Chapter 11: Unit Testing and Mocking....434
Introducing all types of testing....435
Pros and cons of test-driven development....440
Unit testing using xUnit....442
Mocking in tests....463
Making fluent assertions in unit testing....468
Generating fake data with Bogus....472
Practicing and exploring....478
Summary....480
Chapter 12: Integration and Security Testing....482
Basics of integration testing....483
Integration testing with data stores....487
Testing services using dev tunnels....491
Introducing security testing....498
Practicing and exploring....505
Summary....506
Chapter 13: Benchmarking Performance, Load, and Stress Testing....508
Benchmarking performance....509
Using BenchmarkDotNet for benchmarking performance....513
Load and stress testing....524
Bombardier – a fast cross-platform HTTP benchmarking tool....527
NBomber – a load testing framework....537
Practicing and exploring....542
Summary....544
Chapter 14: Functional and End-to-End Testing of Websites and Services....546
Understanding functional and end-to-end testing....546
Testing web user interfaces using Playwright....548
Interacting with a web user interface....561
Generating tests with the Playwright Inspector....566
Testing web services using xUnit....570
Practicing and exploring....574
Summary....575
Chapter 15: Containerization Using Docker....576
Introducing containerization....576
Understanding Docker concepts....582
Managing containers with Docker....591
Working with Testcontainers....609
Practicing and exploring....611
Summary....612
Chapter 16: Cloud-Native Development Using Aspire....614
Introducing Aspire....615
Exploring the Aspire starter template....624
Diving deeper into Aspire....630
Aspire for new and existing solutions....643
Practicing and exploring....660
Summary....662
Chapter 17: Design Patterns and Principles....664
SOLID principles....665
Design patterns....681
Design principles....692
Algorithms and data structures....700
Practicing and exploring....703
Summary....704
Chapter 18: Software and Solution Architecture Foundations....706
Introducing software and solution architecture....707
Uncle Bobs Clean Architecture....717
Diagramming design using Mermaid....721
Practicing and exploring....731
Summary....733
Chapter 19: Your Career, Teamwork, and Interviews....734
Working on a development team....734
Applying for a job....744
Sample interview questions....764
Practicing and exploring....777
Summary....778
Epilogue....780
Next steps on your .NET learning journey....780
Companion books to continue your learning journey....780
Other Packt .NET books to take your learning further....781
Good luck!....782
Appendix A: Answers to the Test Your Knowledge Questions....784
Chapter 1 – Introducing Tools and Skills with .NET....784
Chapter 2 – Making the Most of the Tools in Your Code Editor....786
Chapter 3 – Source Code Management Using Git....788
Chapter 4 – Debugging and Memory Troubleshooting....791
Chapter 5 – Logging, Tracing, and Metrics for Observability....792
Chapter 6 – Documenting Code, APIs, and Services....794
Chapter 7 – Observing and Modifying Code Execution Dynamically....795
Chapter 8 – Protecting Data Using Cryptography....797
Chapter 9 – Multitasking and Concurrency....798
Chapter 10 – Dependency Injection, Containers, and Service Lifetime....799
Chapter 11 – Unit Testing and Mocking....800
Chapter 12 – Integration and Security Testing....802
Chapter 13 – Benchmarking Performance, Load, and Stress Testing....803
Chapter 14 – Functional and End-to-End Testing of Websites and Services....805
Chapter 15 – Containerization Using Docker....806
Chapter 16 – Cloud-Native Development Using Aspire....808
Chapter 17 – Design Patterns and Principles....809
Chapter 18 – Software and Solution Architecture Foundations....810
Chapter 19 – Your Career, Teamwork, and Interviews....812
Appendix B: Setting Up Your Development Environment....816
Installing Visual Studio, VS Code, or Rider....816
Installing Docker and an SQL Server container image....824
Installing and setting up SQL Server locally....838
Setting up Azure SQL Database....842
Rider tool window for working with SQL Server....846
Appendix C: Looking For Help....848
Unlock Your Exclusive Benefits....868
Index....870
Advance your career by mastering key .NET tools and skills, including debugging, source code management, testing, cloud native development, multitasking, and more
.NET is more powerful—and more complex—than ever. As the ecosystem evolves, so do the expectations from developers. Mastering the tools and patterns of professional .NET development can be the difference between simply shipping code and delivering resilient, scalable software. Tools and Skills for .NET 10 is a practical guide to leveling up in today’s .NET world, offering both hard technical skills and career strategies to help you thrive.
Inside, you’ll learn how to manage codebases with Git and implement debugging and memory analysis techniques that save hours of guesswork. The book also covers best practices for writing and maintaining documentation for your code, services, and APIs, which is crucial for team collaboration. You’ll explore cryptography for securing data and concurrency for building responsive apps. Further chapters explore dependency injection, testing for performance and reliability, and packaging your apps in Docker containers.
By the end of this book, you’ll be equipped not only with technical skills but also with the confidence to apply them in real environments. Whether you're aiming for a promotion, switching jobs, or preparing for technical interviews, you'll have the skills and the language to present yourself as a capable, well-rounded .NET developer ready for anything the industry throws at you.
This book is for .NET professionals seeking to enhance their expertise, as well as aspiring developers aiming to advance their careers in the field. This book caters to individuals eager to master essential .NET tools, refine their development practices, explore advanced techniques and cutting-edge tools, and prepare themselves for job opportunities and interviews in the competitive landscape of .NET development.