1 |
Meziantou's blogBlog about Microsoft technologies (.NET, .NET Core, ASP.NET Core, WPF, UWP, TypeScript, etc.) |
text |
2 |
Home |
text |
3 |
Projects |
text |
4 |
Archives |
text |
5 |
Contact |
text |
6 |
Versioning an ASP.NET Core API |
text |
7 |
API versioning is a way to conform with the Postel's law. Jon Postel wrote this law in an early specification of TCP: Be conservative in what you do, be liberal in what you accept from others Jon Postel This means that you must be conservative in what you send, be liberal in what you accept. Once you have published a version of your API, you cannot change the format of the data it sends to the clients.…[readmore] |
text |
8 |
Opening Windows Terminal from the explorer |
text |
9 |
In a previous post about Windows Console (cmd) Tips, I explained how to open the cmd from the explorer, so you can execute command in the current directory. However, this open the old terminal which is not cool. Windows Terminal is much better than the old one, so this is the one I want to open from the explorer! You can use wt or wt.exe to start the Windows Terminal from the explorer or the start menu.…[readmore] |
text |
10 |
How to change the default sh**** in Windows Terminal |
text |
11 |
After installing Windows Terminal, it uses PowerSh**** (the legacy one) by default. Instead I prefer using PowerSh**** 7 by default to take advantage of the new features. The new terminal is configurable using a json file, so it's possible to change the default sh****! You can open the configuration file by using the menu: Then you can change the default profile. Find the profile you want to be the default…[readmore] |
text |
12 |
Security headers in ASP.NET Core |
text |
13 |
Security Headers Strict-Transport-Security HTTP Strict Transport Security (HSTS) protect websites against man-in-the-middle attacks by indicating the browser to access the website using HTTPS instead of using HTTP. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security X-Frame-Options The X-Frame-Options HTTP response header can be used to indicate whether or not a browser…[readmore] |
text |
14 |
Per virtual desktop single-instance application |
text |
15 |
Windows 10 introduces Virtual Desktops. This new feature comes with a few recommendations. From the doc***entation: Applications should avoid automatically switching the user from one virtual desktop to another. Only the user should instigate that change. In order to support this, newly created windows should appear on the currently active virtual desktop. In addition, if an application can reuse…[readmore] |
text |
16 |
Handling aborted requests in ASP.NET Core |
text |
17 |
When a user make a request to an ASP.NET Core application, the server pa****s the request, generates a response, and sends the result to the client. The user can abort the request while the server is processing it. For instance the user can navigate to another page or close the page. In this case, you may want to stop all the work in progress to avoid consuming resources. For instance, you may want to…[readmore] |
text |
18 |
Don't use method with side-effect in LINQ |
text |
19 |
The author of this GitHub issue is complaining about the behavior or FirstOrDefault when it's following an OrderBy. Indeed, the predicate is called on each element which is not what he expected. In his example the predicate has a side-effect so he really doesn't want the method to be called for each element. var account = accounts.OrderBy(x => x.UsageCount).FirstOrDefault(x => x.TryReserve(token)); //…[readmore] |
text |
20 |
Convert cmd scripts to PowerSh**** |
text |
21 |
I recently moved many scripts from cmd (.bat or .cmd) to PowerSh**** (.ps1). In this post, I'll show all the differences I've seen during the migration. This is list is not exhaustive as it only contains the cases I had encountered in the migrated scripts. Why using PowerSh**** instead of cmd? PowerSh**** has many advantages compare to cmd: Discoverability: PowerSh**** makes it easy to discover its features…[readmore] |
text |
22 |
Get the result of multiple tasks in a ValueTuple and WhenAll |
text |
23 |
In .NET, you can use Task.WhenAll to wait for multiple tasks. Once the tasks are completed, you can get the results using .Result or by awaiting them. Task<int> task1 = Task.Run(() => 1); Task<string> task2 = Task.Run(() => "meziantou"); await Task.WhenAll(task1, task2); var task1Result = task1.Result; // or await task1 var task2Result = task2.Result; // or await task2 I don't really want write this…[readmore] |
text |
24 |
Referencing an analyzer from a project |
text |
25 |
Once you have created a Roslyn Analyzer, you have multiple ways to consume it in your project: Using a Visual Studio extension Using a NuGet package Using a Project Reference when the Roslyn Analyzer is in the same solution The first 2 solutions are the most common ones, and are described in the first post of the series: Writing a Roslyn Analyzer. For instance, here's an example of referencing an…[readmore] |
text |
26 |
Checkout out my complete list of blog entries! |
text |
27 |
- |
empty |
28 |
- |
empty |
29 |
Versioning an ASP.NET Core API |
text |
30 |
Opening Windows Terminal from the explorer |
text |
31 |
How to change the default sh**** in Windows Terminal |
text |
32 |
Security headers in ASP.NET Core |
text |
33 |
Per virtual desktop single-instance application |
text |
34 |
Setting up my development machine |
text |
35 |
Async/await resources |
text |
36 |
Terms of use |
text |
37 |
Privacy policy |
text |