Categories: .NET (412 posts)
2024
- Understanding OverloadResolutionPriority attribute in C# 13
- Using Mutex<T> to synchronize access to a shared resource
- Waiting for a ManualResetEventSlim to be set asynchronously
- Automated tests
- Useful resources to write Roslyn Analyzers
- Enable NuGet auditing for your .NET projects
- Activator.CreateInstance(Type) may return null
- How to output a SARIF file from a .NET project
- Create a multi-arch Docker image for a .NET application
- How to test a Roslyn analyzer
- Roslyn analyzers: How to
- How to avoid conflicts when testing your dotnet templates locally
- How to check if a DLL and an exe is a .NET assembly
- How to use the latest target framework available for a .NET SDK
- Using type aliases to make code clearer with generics
- Computing code coverage for a .NET project
- Creating ico files from multiple images in .NET
- Json schema validation in .NET
- Convert DateTime to user's time zone with Blazor in .NET 8
- Generate OpenAPI specification at build time from the code in ASP.NET Core
- Optional parameters may appear in the middle of the parameter list
- Enable AutoLogin in Windows using .NET
- Getting all exceptions thrown from Parallel.ForEachAsync
- Creating an HttpClient that uses DNS over Https
- Enable the new TerminalLogger in .NET 8 SDK automatically
- Checking if a collection is empty in C#
- How to get assembly code generated by the JIT for a C# method
- Difference between CultureInfo.Get and new CultureInfo
- Making primary constructor parameters read-only
- Getting a handle for a directory in .NET
2023
- Weak events in C#
- Resilient HttpClient with or without Polly
- Inline Snapshot testing in .NET
- Embedding additional files in an MSBuild binary log file
- Removing allocations by reducing closure scopes using local variables
- Reading a stream of JsonDocuments separated by new lines (ndjson)
- File paths in a Roslyn analyzer or source generator
- Customizing the behavior of record copy constructors
- Customizing the name of embedded resources in .NET
- Get the default value of a type at runtime
- How to test the logs from ILogger in .NET
- How to write logs from ILogger to xUnit.net ITestOutputHelper
- Accessing private members without reflection in C#
- Listing Windows virtual desktops using .NET
- How to stay up to date with .NET
- Supporting custom protocols in WebView2
- Sharing object between .NET host and WebView2
- Polyfills in .NET to ease multi-targeting
- Analyzer to validate the parameters of structured log messages
- Micro-optimization: Concatenating a string with a char using string.Concat
- How to access the Roslyn compilation from a VS extension
- How to use RuntimeHelpers.IsReferenceOrContainsReferences to micro-optimize collections
- Debug ASP.NET Core application configuration
- How to detect Globalization-Invariant mode in .NET
- How to Control Visual Studio from an external application
- Reading Windows Application Manifest of an exe in .NET
- Detecting Dark and Light themes in a WPF application
- Investigating a crash in Enumerable.LastOrDefault with a custom collection
- Listing all available ETW events in a .NET application
- Handling CancelKeyPress using a CancellationToken
- Too many timers in .NET?
- Measuring performance of Roslyn Source Generators
- Testing Roslyn Incremental Source Generators
- Extending the System Menu to add advanced commands in .NET
- Creating a custom Main method in a WPF application
- Prevent accidental disclosure of configuration secrets
- Using source-generated regex in ASP.NET Core route constraints
- Mocking an HttpClient using ASP.NET Core TestServer
- Using .NET code from JavaScript using WebAssembly
- Reducing Blazor WASM size by providing custom ICU data
- Detecting breaking changes between two versions of a NuGet package at packaging time
- C# 11 List Patterns - Create compatible types
2022
- Generating a dump file when tests hang on a CI machine
- Prevent http requests to external services in unit tests
- Starting a process as normal user from a process running as Administrator
- Killing all child processes when the parent exits (Job Object)
- Debugging tips and tools
- New rules for Blazor in Meziantou.Analyzer
- Configuring Visual Studio to manage using directives automatically
- Publishing a NuGet package using GitHub and GitHub Actions
- Ensuring best practices for NuGet packages
- How to generate a dump file of a .NET application
- Writing unsafe .NET code without the unsafe keyword
- Detecting Double-Writes in MSBuild using the binlog
- Getting user consent before executing sensitive code
- Performance: string.Create vs FormattableString
- Regex with IgnoreCase option may match more characters than expected
- Generating PInvoke code for Win32 apis using a Source Generator
- Faster and Safer NuGet restore using Source Mapping and Lock files
- Using IAsyncEnumerable in a Razor component
- Replace characters in a string using Vectorization
- Finding the maximum value in an array using vectorization
- Faster Guid comparisons using Vectors (SIMD) in .NET
- Observing all http requests in a .NET application
- Round-robin DNS support in .NET HttpClient
- Performance: Lambda Expressions, Method Groups, and delegate caching
- Copying a collection: ToList vs ToArray
- Getting telemetry data from inside or outside a .NET application
- Sharing coding style and Roslyn analyzers across projects
- How to list all routes in an ASP.NET Core application
- Uploading multiple files using InputFile in Blazor
- Forcing HttpClient to use IPv4 or IPv6 addresses
- Converting code to the new Regex Source Generator
- Performance benefits of sealed class in .NET
- Validating a Blazor Form on the first render
- Executing code before Main in .NET
- Debugging a WebView2 component using Playwright in .NET
- Avoid DNS issues with HttpClient in .NET
- Parallelize test cases execution in xUnit
- Awaiting an async void method in .NET
- Deleting GitHub Actions artifacts using the GitHub REST API
- Using HTTP/3 (QUIC) in .NET
2021
- Getting Roslyn (C# compiler) and Language versions
- Remove those useless File.Exists calls
- Fastest way to enumerate a List<T>
- Distributing applications that depend on Microsoft.Playwright
- Updating your project to use File Scoped Namespaces
- Monitoring a .NET application using OpenTelemetry
- File upload with progress bar in Blazor
- Creating a search engine for websites using Elasticsearch and Playwright
- Downloading a SSL/TLS certificate in .NET
- I fixed a bug. What should I do now?
- Generate PDF files using an html template and Playwright
- Investigating an infinite loop in Release configuration
- How not to read a string from an UTF-8 stream
- Exploring the NuGet client libraries
- Enabling Reproducible builds when building NuGet packages
- Prevent refreshing the UI after an event in Blazor
- Reducing the length of GUIDs in URLs or Json payloads
- Configuring JSON options in ASP.NET Core
- Upload files with drag & drop or paste from clipboard in Blazor
- Removing elements after an animation in Blazor
- How to measure elapsed time without allocating a Stopwatch
- Supporting Hot Reload in your .NET application
- Infinite scrolling in Blazor
- Exploring Fluent Assertions
- Caching Enum.ToString to improve performance
- Different ways to check if a value is null in C#
- The Roslyn analyzers I use in my projects
- Finding concurrency bugs in a .NET application using Coyote
- Debugging a .NET assembly without the source code with Visual Studio
- Understanding the impact of Roslyn Analyzers on build time
- Debouncing / Throttling JavaScript events in a Blazor application
- Convert SVG files to PNG or JPEG using .NET
- Building .NET projects using the Microsoft.Build.Traversal SDK
- Using raw html with isolated CSS in Blazor
- Be careful when mixing ValueTask and Task.Run
- Rewriting git history using C# (git filter-branch alternative)
- Binding decimal numbers using the oninput event in Blazor
- Running npm tasks when building a .NET project
- Strongly-typed Ids using C# Source Generators
- Multi-targeting a Roslyn analyzer
- Packaging a Roslyn Analyzer with NuGet package references
- Correctly converting a character to lower/upper case
- Automatically generate a form from an object in Blazor
- Simplifying paths handling in .NET code with the FullPath type
- Canceling background tasks when a user navigates away from a Blazor component
- Defining NuGet restore sources in the csproj
2020
- Caching an IEnumerable<T> instance
- Never forget a #if when multi-targeting .NET libraries or applications
- Using .NET and PowerPoint to generate cover images
- Investigating a performance issue with a regex
- C# 9 - Improving performance using the SkipLocalsInit attribute
- Process.WaitForExitAsync is not the async equivalent of Process.WaitForExit in .NET 5
- Rendering raw/unescaped HTML in Blazor
- C#9 - init-only properties are not read-only at runtime
- How to get ASP.NET Core logs in the output of xUnit tests
- Optimizing Blazor performance using the @key directive
- Enumerating files using Globbing and System.IO.Enumeration
- Publishing a self-contained Blazor component (Razor + CSS + JS) as a NuGet package
- Capturing unmatched attributes and attribute splatting in Blazor
- Testing Blazor components using bUnit
- Creating a reusable loading indicator in Blazor
- Writing automated UI tests for ASP.NET Core applications using Playwright and xUnit
- Validating an input on keypress instead of on change in Blazor
- Streaming an HTTP response in Blazor WebAssembly
- Deploying a .NET desktop application using MSIX
- JavaScript Isolation in Blazor Components
- Calling public methods on Blazor component from another component
- CSS isolation in Blazor
- Lazy load assemblies in a Blazor WebAssembly application
- Using foreach with IEnumerator<T> / IAsyncEnumerator<T> in C# 9
- Copying text to the clipboard in a Blazor application
- Anchor navigation in a Blazor application
- How to use event.PreventDefault in Blazor
- Splitting code and markup into different files when creating a Blazor component
- Running and debugging a .NET Core application in WSL 2 from Visual Studio
- Optimizing a Blazor WebAssembly application size
- Using SQL Server HierarchyId with Entity Framework Core
- Showing a confirm dialog before doing an action in Blazor
- How to prevent the UI from freezing while executing CPU intensive work in Blazor WebAssembly
- Dynamically setting the page title in a Blazor application
- Avoid performance issues with JsonSerializer by reusing the same JsonSerializerOptions instance
- Checking if a property is an auto-implemented property in Roslyn
- Bypass HTTP browser cache when using HttpClient in Blazor WebAssembly
- Preventing double form submission in a Blazor application
- Auto focus an input element in a Blazor form on page load
- Binding parameters from the query string in a Blazor component
- Enforcing asynchronous code good practices using a Roslyn analyzer
- Generating and efficiently exporting a file in a Blazor WebAssembly application
- Optimizing JS Interop in a Blazor WebAssembly application
- Storing user settings in a Blazor WebAssembly application
- Detecting missing CancellationToken using a Roslyn Analyzer
- Creating a DataGrid component in Blazor
- ASP.NET Core Blazor components lifecycle
- Creating a Modal component in Blazor
- Exploring two-way binding in Blazor
- Creating a InputSelect component for enumerations in Blazor
- Showing a loading screen while initializing a Blazor application
- Customizing the Blazor WebAssembly loading screen
- Convert DateTime to user's time zone with server-side Blazor
- Creating a Repeater component with Blazor
- Publishing a Blazor WebAssembly application to GitHub pages
- Integrating Blazor components into Razor Pages and MVC apps
- Versioning an ASP.NET Core API
- Security headers in ASP.NET Core
- Per virtual desktop single-instance application
- Handling aborted requests in ASP.NET Core
- Don't use methods with side-effects in LINQ
- Get the result of multiple tasks in a ValueTuple and WhenAll
- Referencing an analyzer from a project
- Quick introduction to xUnit.net
- Split a string into lines without any allocation
- Show unnecessary imports in the Visual Studio's error window
- Sanitize HTML snippets with AngleSharp
- Using Windows Antimalware Scan Interface in .NET
- ASP.NET Core - JSON logger
- Optimize struct performances using StructLayout
- Struct equality performance in .NET
- How to correctly count the number of characters of a string
- How to protect against XML vulnerabilities in .NET
- Enforce .NET code style in CI with dotnet format
- Check if the current user is an administrator
- Prevent Zip Slip in .NET
- Deserialization can be dangerous
2019
- Thread-safe observable collection in .NET
- Declaring InternalsVisibleTo in the csproj
- Fire and forget a Task in .NET
- How to use C# 8 Indices and Ranges in .NET Standard 2.0 and .NET Framework
- How to use Nullable Reference Types in .NET Standard 2.0 and .NET Framework
- C# 8: Nullable Reference Types
- Regex - Deny of Service (ReDoS)
- Nullable<T>: Value vs GetValueOrDefault() in term of performance
- Custom certificate validation in .NET
- StringBuilder performance best practices
- How to avoid storing secrets in the source code?
- Implementing Two-factor authentication in an ASP.NET Core application
- Automatically log in a user on a website using the Credential Management API?
- Helping users to create good passwords
- How to prompt for a password on Windows?
- How to store a password on Windows?
- How to store a password in a web application?
- Cryptography in .NET
- CI/CD pipeline for a Visual Studio extension (VSIX) using Azure DevOps
- Stop using IntPtr for dealing with system handles
- .NET Regex: \d is different from [0-9]
- Creating a FontAwesome bundle with only the icons you use
- ConcurrentDictionary + closure = 💔
- String comparisons are harder than it seems
- Some performance tricks with .NET strings
- Computing code coverage for a .NET Core project with Azure DevOps and Coverlet
- Working with types in a Roslyn analyzer
- Writing language-agnostic Roslyn Analyzers using IOperation
- Loading stylesheets asynchronously using a TagHelper in ASP.NET Core
2018
- Writing a Roslyn analyzer
- Inlining a Stylesheet, a JavaScript, or an image file using a TagHelper in ASP.NET Core
- Inlining a stylesheet using a TagHelper in ASP.NET Core
- Integrating Google Analytics using dependency injection in ASP.NET Core
- Smart enums / Type-safe enums in .NET
- Use structures to improve the readability of your code
- Integration testing using a docker container
- Getting the date of build of a .NET assembly at runtime
- Exploring a MSBuild binary log using the binary log viewer
- Merging assemblies using ILRepack
- A tool to help you identify unused CSS rules
- C# compiler strict mode
- How to debug NuGet packages using SourceLink
- How to enforce a consistent coding style in your projects
- How to publish a dotnet global tool with .NET Core 2.1
- JWT authentication with ASP.NET Core
- Cancelling Console.Read
- Detecting console closing in .NET
- Load native libraries from a dynamic location
- MSTest v2: Testing against multiple frameworks
- MSTest v2: Execute tests in parallel
- MSTest v2: Customize test execution
- MSTest v2: Create new asserts
- MSTest v2: Test lifecycle attributes
- MSTest v2: Data tests
- MSTest v2: Exploring asserts
- MSTest v2: Setup a test project and run tests
- Live unit testing in Visual Studio 2017 Enterprise
- Filter Application Insights events in ASP.NET Core
2017
- Performance: string concatenation vs String.Format vs interpolated string
- Interpolated strings: advanced usages
- Comparing implementations with BenchmarkDotnet
- Mocking an HttpClient using an HttpClientHandler
- Display toast notifications in a WPF application
- Testing EF Core in Memory using SQLite
- Starting a http file server from the file explorer using .NET Core 2.0 and Kestrel
- Debugging your .NET application more easily
- 4 ways to enable the latest C# features
- Testing an ASP.NET Core application using TestServer
- Entity Framework Core: History / Audit table
- Application Insights - Track HTTP Referer
- Suppress "Use 'throw' expression" suggestion
- Entity Framework Core: Specifying data type length and precision
- Entity Framework Core: View the model as text
- Validating user with cookie authentication in ASP.NET Core 2
- Use brotli compression with ASP.NET Core
- Analyse your code with NDepend
- Entity Framework Core: Soft Delete using Query Filters
- InternalsVisibleTo with strong-named assemblies
- Entity Framework Core: Generate tracking columns
- Using the Google Translate API in .NET or .NET Core
- Entity Framework Core: Naming Convention
- Cookie authentication in ASP.NET Core 2 without ASP.NET Identity
- Minimal ASP.NET Core Web API project
- Continuously publishing Nuget package to MyGet using VSTS
- Post-Redirect-Get and TempData with ASP.NET Core
- ASP.NET Core - Precompiling razor views
- FileSystemWatcher intermittently throws an exception on Linux
- Creating a chat bot from a FAQ with Azure Q&A Maker
- Mixed producer-consumer scenario in .NET
- Starting a http file server from the file explorer using .NET Core
- Publishing an ASP.NET Core website to a Linux host
- Registering an Application to a URI Scheme using .NET (custom protocol)
- Use Application Insights in a desktop application
- Generate a changelog from VSTS work items
- Improve the security of your website using SSL and HSTS with ASP.NET Core
- Get the localization and time zone of your visitors
- Quickly insert millions of rows in SQL Server in .NET
- Advanced email address validation in .NET
- Minify CSS and JavaScript files with Visual Studio and ASP.NET Core
- Enabling gzip compression with ASP.NET Core
- Caching static resources forever with ASP.NET Core
- Easily manage command-line arguments
2016
- Page redirection and URL Rewriting with ASP.NET Core
- Using Web Sockets with ASP.NET Core
- Using Let's encrypt with ASP.NET Core
- Give focus to a ComboBox editable in WPF
- IIS Express & SSL
2015
- To CDN or not to CDN? Why do you need to choose?
- ASP.NET 5 & Static Files
- SQL Geography, Google Maps & Geolocalisation
- Debugging a .NET assembly without the original source code using DotPeek
- Scan a document with Windows Image Acquisition
- SQL Server - Discovering the HierarchyId data type
- Utiliser l'API de OneDrive depuis une application Windows
- Using FontAwesome in a WPF application
- ASP.NET WebForms Validators & Bootstrap
- Application Recovery and Restart
2014
- Prevent Windows shutdown or session ending in .NET
- SignalR and Fiddler
- Detect the opening of a new window in C#
- Introduction to GoldParser
- Run a SQL batch containing "GO" in C#
- Export a list of .NET objects to Excel
- Easy reflection using a DynamicObject
- Test the connection to a SQL Server database
- How to bind an enum to a ComboBox in WPF
- Single instance of an application in C#
- Write more generic WPF Converters
- Creating a Parser for Boolean Expressions
- OWIN and Katana - Creating an authentication middleware
- Web API & HTTP Basic Authentication
- Sauvegarder un mot de passe dans une Windows Store App
- How to run a scheduled task
- Windows Credential Manager
- Access the WinRT API from a desktop application
- Combine multiple .NET assemblies
- Presentation of ExportSrc
- View and edit the Tab Order of Windows Forms Controls
2013
2012
- HotKey – Global shortcuts
- Impersonation and security
- Computing the size of a folder
- Binding the VisualStateManager to a property
- Choosing the right data structure
- Install Windows Phone 7 Developer Tools on Windows Server 2008R2
2011
- Performance test on empty string
- Using Bing Translation in .NET
- Unit tests with a WPF window
- Is the code coverage a sufficient metric
- ExcludeFromCodeCoverage Attribute
- Merge code coverage results
- Enable code coverage in Visual Studio 2010
- Validation with PostSharp
- Cloning an object in .NET
- IEnumerable.Any() or IEnumerable.Count() != 0
- List all files in a folder and its subfolders with linq
- Using SecureString
- Easily use the Entity Framework cache
- Universal value converter
- The var keyword
- Access private members of a class using reflection
- Singleton and Lazy<T>
- Pluralize or singularize names
- How to retrieve SQL generated from a LINQ to Entities query
- Generic WeakReference
- Refresh a WPF control
- What's the usage of AsEnumerable
- Accessing a nested type from xaml
- Serialize DependencyObjects
- Freezable objects
- Subscribe to routed events even if they are handled
- UI and threads with WPF
- Do not show the designer when opening a xaml file
- Subscribe to events launched by children of an ItemsControl
- MVVM – Model-View-ViewModel
- String.IsNullOrWhiteSpace