Lanyon A Simple Blogger template

Free tutorials, courses, generative tools, and projects built with Javascript, PHP, Python, ML, AI,.Net, C#, Microsoft, Youtube, Github Code Download and more.

June 2021

Archive for June 2021

React Router Crash Course


Curriculum for the course React Router Crash Course

React Router is commonly used to make different routes for pages in React Applications. This crash course will teach you how to create routes in your React applications. This course covers BrowserRouter, Switch, Nesting Routes, Redirecting Routes, match and history props, including useHistory, useParams, useLocation, and useRouteMatch Hooks. ✏️ Course created by Piyush Agarwal. Check out his channel: https://www.youtube.com/c/RoadsideCoder 🔗 8 clean code practices: https://www.youtube.com/watch?v=dZXpgP9ibf8 ⭐️ Course Contents ⭐️ ⌨️ (00:00) Intro ⌨️ (00:51) Initialize new React App ⌨️ (03:16) Header Component ⌨️ (04:42) React Router Installation ⌨️ (05:15) BrowserRouter ⌨️ (05:57) Creating Routes ⌨️ (08:21) Testing Routes ⌨️ (08:39) 'exact' prop ⌨️ (09:25) Switch Tag ⌨️ (10:17) Link Tag ⌨️ (13:32) basename prop ⌨️ (14:06) forceRefresh Prop ⌨️ (14:37) getUserConfirmation ⌨️ (15:54) scroll to top on route change ⌨️ (16:46) 404 Not Found Page ⌨️ (18:21) Access URL Params ⌨️ (20:33) useParams Hook ⌨️ (21:50) useLocation Hook ⌨️ (24:49) Redirecting in React Router ⌨️ (28:05) useHistory Hook ⌨️ (30:55) Nested Routing ⌨️ (38:27) Outro 🎉 Thanks to our Champion and Sponsor supporters: 👾 Wong Voon jinq 👾 hexploitation 👾 Katia Moran 👾 BlckPhantom 👾 Nick Raker 👾 Otis Morgan 👾 DeezMaster 👾 Treehouse -- Learn to code for free and get a developer job: https://www.freecodecamp.org Read hundreds of articles on programming: https://freecodecamp.org/news And subscribe for new videos on technology every day: https://youtube.com/subscription_center?add_user=freecodecamp

Watch Online Full Course: React Router Crash Course


Click Here to watch on Youtube: React Router Crash Course


This video is first published on youtube via freecodecamp. If Video does not appear here, you can watch this on Youtube always.


Udemy React Router Crash Course courses free download, Plurasight React Router Crash Course courses free download, Linda React Router Crash Course courses free download, Coursera React Router Crash Course course download free, Brad Hussey udemy course free, free programming full course download, full course with project files, Download full project free, College major project download, CS major project idea, EC major project idea, clone projects download free

Create a Design System with Figma - Full Course


Curriculum for the course Create a Design System with Figma - Full Course

Learn how to build a design system in Figma. By the end of this course you will become a master of building design systems in Figma and understanding master components. ✏️ Course developed by Tim Sullivan. Check out his channel: https://www.youtube.com/channel/UCTGmiyXawbVmFJjpiYSw0Gw ⭐️ Course Contents ⭐️ ⌨️ (0:00:00) Introduction ⌨️ (0:03:03) Creating a Color System ⌨️ (0:22:23) Building a Type System in Figma ⌨️ (0:35:16) Elevation ⌨️ (0:57:33) Product & System Icons ⌨️ (1:11:26) Text Legibility ⌨️ (1:30:58) States ⌨️ (1:50:53) Selection (Interaction) ⌨️ (1:55:02) Understanding Layout ⌨️ (2:04:15) Pixel Density ⌨️ (2:12:05) Spacing Methods ⌨️ (2:24:19) Responsive Grid Layout ⌨️ (2:48:59) App Bar - Bottom ⌨️ (3:07:55) App Bar - Top ⌨️ (3:22:37) Backdrop ⌨️ (3:41:58) Banners ⌨️ (4:06:45) Bottom Navigation ⌨️ (4:19:15) Buttons - Floating Action Button ⌨️ (4:38:54) Buttons ⌨️ (5:06:04) Cards ⌨️ (5:41:10) Chips ⌨️ (5:58:15) Dialogs ⌨️ (6:28:56) Date Pickers ⌨️ (7:32:22) Dividers 🎉 Thanks to our Champion and Sponsor supporters: 👾 Wong Voon jinq 👾 hexploitation 👾 Katia Moran 👾 BlckPhantom 👾 Nick Raker 👾 Otis Morgan 👾 DeezMaster 👾 Treehouse -- Learn to code for free and get a developer job: https://www.freecodecamp.org Read hundreds of articles on programming: https://freecodecamp.org/news And subscribe for new videos on technology every day: https://youtube.com/subscription_center?add_user=freecodecamp

Watch Online Full Course: Create a Design System with Figma - Full Course


Click Here to watch on Youtube: Create a Design System with Figma - Full Course


This video is first published on youtube via freecodecamp. If Video does not appear here, you can watch this on Youtube always.


Udemy Create a Design System with Figma - Full Course courses free download, Plurasight Create a Design System with Figma - Full Course courses free download, Linda Create a Design System with Figma - Full Course courses free download, Coursera Create a Design System with Figma - Full Course course download free, Brad Hussey udemy course free, free programming full course download, full course with project files, Download full project free, College major project download, CS major project idea, EC major project idea, clone projects download free

DDV Generator Slovenia

Fake DDV Generator Slovenia

What Is Slovenian DDV VAT

DDV definition and abbreviation. What does DDV stand for Slovenia? ... The meaning of DDV is Davek Na Dodano Vrednost (DDV) is the VAT number provided by state with information on all Slovenian companies.
The equivalent of Value added tax (VAT) in Slovenia is DDV. There are two taxation rates, 22% and 9.5%. A person becomes liable for VAT when annual turnover exceeds EUR 50,000.
When this happens, an application for the issue of a VAT identification number must be registered in the month when turnover is likely to exceed the annual threshold of EUR 50,000.
An individual or business can apply to become VAT registered even if your turnover does not reach the threshold. An application can be submitted when the company is being set up on condition that the applicant remains a taxable person for at least 60 months thereafter.

Generate Slovenian DDV Number - VAT


Click the button below to generate the valid DDV number for Slovenia. You can click multiple times to generate several numbers. These numbers can be used to Test your sofware application that uses DDV or VAT for slovenia, or Testing DDV APIs that Slovenian Govt provide.


DDV Number#

The ARM processor (Thumb-2), part 20: Code walkthrough

As is traditional, I wrap up the processor overview series with an annotated walkthrough of a simple function. Here’s the function again:
extern FILE _iob[];

int fclose(FILE *stream)
{
int result = EOF;

if (stream->_flag & _IOSTRG) {
stream->_flag = 0;

The post The ARM processor (Thumb-2), part 20: Code walkthrough appeared first on The Old New Thing.

2021-06-25 14:00:00Z 0001-01-01 00:00:00Z https://devblogs.microsoft.com/oldnewthing/20210625-00/?p=105369

The ARM processor (Thumb-2), part 19: Common patterns

We saw some time ago how to recognize dense switch statements that use the TBB and TBH instructions. Here are some other common sequences in compiler-generated code. Note that instructions are likely to be reordered by the compiler to avoid stalls.

The post The ARM processor (Thumb-2), part 19: Common patterns appeared first on The Old New Thing.

2021-06-24 15:51:46Z 0001-01-01 00:00:00Z https://devblogs.microsoft.com/oldnewthing/20210624-46/?p=105355

OpenTelemetry Course - Understand Software Performance


Curriculum for the course OpenTelemetry Course - Understand Software Performance

Learn how to use OpenTelemetry to get full stack observability on the performance and behavior of your software projects. ✏️ Couse developed by Ania Kubów. Check out her channel: https://www.youtube.com/channel/UC5DNytAJ6_FISueUfzZCVsw 💻 Repositories: 🔗 Tracing Project: https://github.com/kubowania/opentelemetry-tracing 🔗 Distributed Tracing: https://github.com/kubowania/opentelemetry-movies-microservices 🔗 New Relic OpenTelemetry Examples: https://github.com/newrelic/newrelic-opentelemetry-examples 🔗 New Relic OpenTelemetry Exporter: https://github.com/newrelic/newrelic-opentelemetry-examples/tree/main/collector/nr-exporter-docker ⭐️ Course Contents ⭐️ ⌨️ (0:00:00) What is OpenTelemetry ⌨️ (0:03:04) Course Outline ⌨️ (0:03:40) Let’s go! ⌨️ (0:04:49) What are Microservices? ⌨️ (0:07:11) What is Observability? ⌨️ (0:07:55) M.E.L.T ⌨️ (0:09:57) History ⌨️ (0:11:22) Setting up our Project ⌨️ (0:21:43) What is Tracing? ⌨️ (0:25:33) Context and Propagation ⌨️ (0:27:33) Setting up our Tracing ⌨️ (0:33:26) What are Metrics? ⌨️ (0:43:37) Use cases for OpenTelemetry ⌨️ (0:45:29) Setting up Distributed Tracing ⌨️ (1:01:04) Using other Analysis Tools - New Relic ⌨️ (1:07:44) Where to go next 🎉 This course was made possible by a grant from New Relic. 🎉 Students can get even more out of their free New Relic account through the GitHub Student Developer Pack. Get full access to New Relic one for three full users; 500 GB/month of data ingest; and free-tier AI to instantly detect and resolve issues. Learn more at https://developer.newrelic.com/students/ -- Learn to code for free and get a developer job: https://www.freecodecamp.org Read hundreds of articles on programming: https://freecodecamp.org/news And subscribe for new videos on technology every day: https://youtube.com/subscription_center?add_user=freecodecamp

Watch Online Full Course: OpenTelemetry Course - Understand Software Performance


Click Here to watch on Youtube: OpenTelemetry Course - Understand Software Performance


This video is first published on youtube via freecodecamp. If Video does not appear here, you can watch this on Youtube always.


Udemy OpenTelemetry Course - Understand Software Performance courses free download, Plurasight OpenTelemetry Course - Understand Software Performance courses free download, Linda OpenTelemetry Course - Understand Software Performance courses free download, Coursera OpenTelemetry Course - Understand Software Performance course download free, Brad Hussey udemy course free, free programming full course download, full course with project files, Download full project free, College major project download, CS major project idea, EC major project idea, clone projects download free

What’s new in Windows Forms in .NET 6.0 Preview 5

In this post we are going to talk about what’s new in Windows Forms runtime in .NET 6.0 Preview 5.

Application-wide default font

.NET Framework and Windows Forms were designed and built in a completely different world from today – back when CRT monitors still largely maxed out at 1024×768, and “Microsoft Sans Serif” was the default font on Windows.

However, nothing is ever set in stone, and even fundamental properties like default font change once in a while. Windows Vista received a fair share of UI updates, including the default font, which was changed to Segoe UI. But this wasn’t something that could be changed in .NET Framework, and it continued using Microsoft Sans Serif as the default font.

Fast forward to 2018 and .NET Core 3.0, where we were finally able to start modernizing Windows Forms. We changed the font to Segoe UI in dotnet/winforms#656, and quickly learned that a great number of things depended on this default font metrics. For example, the designer was no longer a true WYSIWYG, because Visual Studio process is run under .NET Framework 4.7.2 and uses the old default font, whereas a .NET application at runtime uses the new font. (Before you ask, we are working on a feature that will address this discrepancy.)

We also learned that the change of font made it harder for some customers to migrate their large applications with pixel-perfect layouts. Whilst we had provided migration strategies, applying those across hundreds of forms and controls could be a significant undertaking.

To make it easier to migrate those pixel-perfect apps in dotnet/winforms#4911 we added a new API to our toolkit:

void Application.SetDefaultFont(Font font)

Like many other Application API, this API can only be used before the first window is created, which generally is in the Main() method of the application.

class Program
{
    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetHighDpiMode(HighDpiMode.PerMonitorV2);

        Application.SetDefaultFont(new Font(new FontFamily("Microsoft Sans Serif"), 8f));

        Application.Run(new Form1());
    }
}

An attempt to set the default font after the first window is created will result in an InvalidOperationException.

As a side note, it is easy to go wild with this API, and set the application default font to ‘Chiller, 20pt, style=bold,italic,underline‘, but please be mindful of your end-user experience.

More runtime designers

The Windows Forms SDK consist of two distinct parts:

  1. the runtime, i.e. the code that executes, open sourced at dotnet/winforms, and
  2. the designer, which consists of “general designer” (i.e. a designer that developers can embed in their application) and “Visual Studio specific” components, close sourced.

In .NET Framework these two parts lived closely together, and that allowed developers to invoke and use VS-specific functionality in their apps. In .NET Core these two components were split, and now for the most part they evolve independently of each other. With this split, the Visual Studio Designer specific functionality will not be made publicly available because it makes no sense outside Visual Studio. On the other hand, the general designer functionality can be used and useful outside Visual Studio, and in response to our customers’ requests in Preview 5 we have ported a number of API that should enable building a general purpose designer (e.g. a report designer).

With dotnet/winforms#4860 the following designers are now available:

  • System.ComponentModel.Design.ComponentDesigner
  • System.Windows.Forms.Design.ButtonBaseDesigner
  • System.Windows.Forms.Design.ComboBoxDesigner
  • System.Windows.Forms.Design.ControlDesigner
  • System.Windows.Forms.Design.DocumentDesigner
  • System.Windows.Forms.Design.DocumentDesigner
  • System.Windows.Forms.Design.FormDocumentDesigner
  • System.Windows.Forms.Design.GroupBoxDesigner
  • System.Windows.Forms.Design.LabelDesigner
  • System.Windows.Forms.Design.ListBoxDesigner
  • System.Windows.Forms.Design.ListViewDesigner
  • System.Windows.Forms.Design.MaskedTextBoxDesigner
  • System.Windows.Forms.Design.PanelDesigner
  • System.Windows.Forms.Design.ParentControlDesigner
  • System.Windows.Forms.Design.ParentControlDesigner
  • System.Windows.Forms.Design.PictureBoxDesigner
  • System.Windows.Forms.Design.RadioButtonDesigner
  • System.Windows.Forms.Design.RichTextBoxDesigner
  • System.Windows.Forms.Design.ScrollableControlDesigner
  • System.Windows.Forms.Design.ScrollableControlDesigner
  • System.Windows.Forms.Design.TextBoxBaseDesigner
  • System.Windows.Forms.Design.TextBoxDesigner
  • System.Windows.Forms.Design.ToolStripDesigner
  • System.Windows.Forms.Design.ToolStripDropDownDesigner
  • System.Windows.Forms.Design.ToolStripItemDesigner
  • System.Windows.Forms.Design.ToolStripMenuItemDesigner
  • System.Windows.Forms.Design.TreeViewDesigner
  • System.Windows.Forms.Design.UpDownBaseDesigner
  • System.Windows.Forms.Design.UserControlDocumentDesigner

If you think we missed a designer that your application depends on please let us know at our GitHub repository.

Tiny Designer by Paolo Foti

As our test bed we’ve used an awesome sample authored by Paolo Foti.

Why these API weren’t ported initially?

When we were opening sourcing the Windows Forms SDK we needed to prioritize our work based on usage per our telemetry. Now we are porting designer-related API based on customer feedback, and each API request requires a use case that will warrant the work.

Reporting bugs and suggesting features

If you have any comments, suggestions or faced some issues, please let us know! Submit Visual Studio and Designer related issues via Visual Studio Feedback (look for a button in the top right corner in Visual Studio), and Windows Forms runtime related issues at our GitHub repository.

Happy coding!

The post What’s new in Windows Forms in .NET 6.0 Preview 5 appeared first on .NET Blog.



source https://devblogs.microsoft.com/dotnet/whats-new-in-windows-forms-in-net-6-0-preview-5/

.NET 5 REST API Tutorial - Build From Scratch With C#


Curriculum for the course .NET 5 REST API Tutorial - Build From Scratch With C#

Learn how to create a REST API end-to-end from scratch using the latest .NET 5 innovations and Visual Studio Code. The API will be written in C#. 💻 Get the code: https://youtube.dotnetmicroservices.com/net5restapi-10 ✏️ Course developed by Julio Casal. Check out his channel: https://www.youtube.com/c/jcasalt 🔗 Julio's website: https://dotnetmicroservices.com ⭐️ Course Contents ⭐️ Getting Started 0:00:00 Introduction 0:03:02 Creating the project 0:04:01 Exploring the generated project files 0:10:03 Trusting the self-signed certificate 0:11:36 Exploring the default Swagger UI page 0:12:30 Configuring Visual Studio Code settings Entity, Repository, Controller GET 0:14:33 Introduction 0:15:45 Adding an entity 0:20:39 Ading an in-memory repository 0:26:40 Creating the controller 0:30:42 Implemeting GET all items 0:33:37 Implemeting GET single item 0:37:47 Returning a 404 NotFound status code Dependency Injection, DTOSs 0:39:57 Introduction 0:41:23 What is dependency injection? 0:46:14 Extracting the repository interface 0:47:44 Injecting the repository into the controller 0:48:53 Registering the repository as a singleton 0:52:32 Adding a Data Transfer Object DTO 0:55:46 Creating the AsDto extension method POST, PUT, DELETE 0:58:59 Introduction 0:59:45 Implementing POST 1:07:39 Adding validations via data annotations 1:10:00 Implemeting PUT 1:17:33 Implementing DELETE Persisting Entities with MongoDB 1:20:46 Introduction 1:24:44 Using Postman 1:27:53 Creating a MongoDB repository 1:29:42 Using the MongoDB.Driver NuGet package 1:33:28 Implementing MongoDB Create 1:33:57 Running the MongoDB Docker container 1:38:47 Configuring MongoDB connection settings 1:42:38 Registering the MongoClient singleton 1:48:02 Testing the MongoDB integration 1:50:04 Exploring the created database in VS Code 1:52:45 Implemeting MongoDB Get, Update and Delete Tasks, Async and Await 2:02:27 Introduction 2:06:46 Using the Async suffix 2:09:04 Using tasks in the repository 2:11:50 Using async and await 2:14:28 Returning completed tasks 2:18:16 Using tasks in the controller 2:21:23 Testing async methods in Postman Secrets and Health Checks 2:27:02 Introduction 2:30:06 Enabling authentication in MongoDB 2:33:36 Using the .NET Secret Manager 2:36:40 Using the MongoDB credentials in the service 2:40:00 Introduction to Health Checks 2:42:28 Adding an endpoint for health checks 2:44:46 Adding a MongoDB health check 2:48:41 Adding checks for readiness and liveness 2:53:51 Customizing the health check response 2:58:59 Exploring other health check NuGet packages Docker 3:00:44 Introduction 3:08:28 What is Docker? 3:17:54 Removing https redirection 3:20:39 Generating a Dockerfile in VS Code 3:30:40 Building the Docker image 3:33:00 Adding a Docker network 3:34:07 Running the containers in the Docker network 3:40:36 Running the REST API in Docker 3:42:02 Pushing the container image to Docker Hub 3:46:02 Exploring the image in Docker Hub 3:46:32 Pulling the image back to the local box Kubernetes 3:49:20 Introduction 3:54:05 What is Kubernetes? 4:04:06 Enabling a Kubernetes cluster in Docker Desktop 4:06:12 Installing the Kubernetes extension for VS Code 4:06:58 Declaring the REST API Kuberentes deployment 4:14:35 Creating a secret in Kubernetes 4:17:28 Declaring health probes 4:19:14 Declaring the REST API Kubernetes service 4:22:56 Creating the REST API resources in Kubernetes 4:26:15 Declaring the MongoDB Kubernetes StatefulSet 4:36:09 Declaring the MongoDB Kubernetes service 4:38:27 Creating the MongoDB resources in Kubernetes 4:40:42 Testing the REST API hosted in Kubernetes 4:42:08 Exploring the Kubernetes self-healing capability 4:46:04 Scaling Kubernetes pods 4:47:38 Adding logs via ILogger 4:52:04 Getting a new image version into Kubernetes 4:53:23 Load balancing requests across pods Unit Testing and TDD 4:56:23 Introduction 4:57:04 What is unit testing? 5:01:19 What is test driven development? 5:04:25 Restructuring files and directories 5:08:25 Creating the xUnit test project 5:09:15 Building multiple projects in VS Code 5:13:10 Adding NuGet packages for unit testing 5:14:35 Testing GetItemAsync unexisting item 5:18:35 Using the AAA pattern 5:19:31 Stubbing dependencies via Moq 5:26:52 Running tests in VS Code 5:28:05 Using the .NET Core Test Explorer extension 5:30:55 Testing GetItemAsync existing item 5:38:01 Using FluentAssertions 5:41:46 Testing GetItemsAsync 5:45:41 Testing CreateItemAsync 5:53:13 Testing UpdateItemAsync 5:57:51 Testing DeleteItemAsync 5:59:40 Refactoring and catching regressions 6:10:50 Using TDD to test a yet to be created method 6:19:07 Going back to green by fixing the failing test 6:21:19 Testing the new controller method in Postman

Watch Online Full Course: .NET 5 REST API Tutorial - Build From Scratch With C#


Click Here to watch on Youtube: .NET 5 REST API Tutorial - Build From Scratch With C#


This video is first published on youtube via freecodecamp. If Video does not appear here, you can watch this on Youtube always.


Udemy .NET 5 REST API Tutorial - Build From Scratch With C# courses free download, Plurasight .NET 5 REST API Tutorial - Build From Scratch With C# courses free download, Linda .NET 5 REST API Tutorial - Build From Scratch With C# courses free download, Coursera .NET 5 REST API Tutorial - Build From Scratch With C# course download free, Brad Hussey udemy course free, free programming full course download, full course with project files, Download full project free, College major project download, CS major project idea, EC major project idea, clone projects download free

The ARM processor (Thumb-2), part 18: Other kinds of prologues and epilogues

Last time, we looked at the standard function prologue and epilogue. There are some variations to the standard that you may encounter from time to time.
Lightweight leaf functions are functions which meet all of the following criteria:

Modify only the non-preserved registers: r0 through r3 and r12,

The post The ARM processor (Thumb-2), part 18: Other kinds of prologues and epilogues appeared first on The Old New Thing.

2021-06-23 14:00:00Z 0001-01-01 00:00:00Z https://devblogs.microsoft.com/oldnewthing/20210623-00/?p=105351

Package Validation

In this blog post, I’m going to show the new package validation tooling that will become available with .NET 6. It ensures that your package consumers have a great experience across all .NET platforms and versions and that you didn’t accidentally make any breaking changes with the previous version of your package. If that is of interest to you, keep reading!

Why validation is important

With .NET Core & Xamarin we have made cross-platform a mainstream requirement for library authors. However, we lack validation tooling for cross targeting packages, which can result in packages that don’t work well, which in turn hurts our ecosystem. This is especially problematic for emerging platforms where adoption isn’t high enough to warrant special attention by library authors.

The tooling we provide as part of the SDK has close to zero validation that multi-targeted packages are well-formed. For example, a package that multi-targets for .NET 6.0 and .NET Standard 2.0 needs to ensure that code compiled against the .NET Standard 2.0 binary can run against the .NET 6.0 binary. We have seen this issue in the wild, even with 1st parties, for example, the Azure AD libraries.

It’s easy to think that a change is safe and compatible if source consuming that change continues to compile without changes. However, certain changes may work fine in C# but can cause problems at runtime if the consumer wasn’t recompiled, for example, adding a defaulted parameter or changing the value of a constant.

Package Validation tooling will allow library developers to validate that their packages are consistent and well-formed. It involves validating that there are no breaking changes across versions. It will validate that the package have the same set of publics APIs for all the different runtime-specific implementations. It will also help developers to catch any applicability holes.

How To Add Package Validation To Your Projects

Package Validation is currently being shipped as an MSBuild SDK package which can be consumed by a project. It is a set of tasks and targets that run after generating the package when calling dotnet pack (or after dotnet build in case you set GeneratePackageOnBuild to true).

To reference it, you need to use the new <Sdk> syntax:

<Project Sdk="Microsoft.NET.Sdk">

  <Sdk Name="Microsoft.DotNet.PackageValidation" Version="1.0.0-preview.5.21302.8" />

  <PropertyGroup>
    <TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
  </PropertyGroup>

</Project>

In the next sections, I’ll walk you through a set of scenarios that show how you can validate your own packages.

Validating Compatible Frameworks

Packages containing compatible frameworks need to ensure that code compiled against one can run against another. Examples of compatible framework pairs are:

  • .NET Standard 2.0 and .NET 6.0
  • .NET 5.0 and .NET 6.0

In both of these cases, your consumers can build against .NET Standard 2.0 or NET 5.0 and run on .NET 6.0. In case your binaries are not compatible between these frameworks, consumers could end up with compile and/or runtime errors.

Package Validation will catch these errors at pack time. Here is an example scenario:

Suppose you’re writing a game which does a lot of string manipulation. You need to support both .NET Framework and .NET Core consumers. You started with just targeting .NET Standard 2.0 but now you realize you want to take advantage of spans in .NET 6.0 to avoid unnecessary string allocations. In order to do that, you now want to multi-target for .NET Standard 2.0 and .NET 6.0.

You have written the following code:

#if NET6_0_OR_GREATER
    public void DoStringManipulation(ReadOnlySpan<char> input)
    {
        // use spans to do string operations.
    }
#else
    public void DoStringManipulation(string input)
    {
        // Do some string operations.
    }
#endif

You then try to pack the project (using dotnet pack cmd or using VS) it fails with the following error:

CompatibleFrameworks, Package Validation

You understand that you shouldn’t exclude DoStringManipulation(string) but instead just provide an additional DoStringManipulation(ReadOnlySpan<char>) method for .NET 6.0 and changes the code accordingly:

#if NET6_0_OR_GREATER
    public void DoStringManipulation(ReadOnlySpan<char> input)
    {
        // use spans to do string operations.
    }
#endif
    public void DoStringManipulation(string input)
    {
        // Do some string operations.
    }

You try to pack the project again.

CompatibleFrameworksSuccessful, Package Validation

Validation Against Baseline Package Version

Package Validation can also help you validate your library project against a previous released stable version of your package. In order to use this feature, you will need to add the PackageValidationBaselineVersion or PackageValidationBaselinePath to your project.

Package validation will detect any breaking changes on any of the shipped target frameworks and will also detect if any target framework support has been dropped.

For example consider the following scenario: you are working on the AdventureWorks.Client NuGet package. You want to make sure that you don’t accidentally make breaking changes so you configure your project to instruct package validation tooling to run API compatibility against the previous version of the package.

<Project Sdk="Microsoft.NET.Sdk">

  <Sdk Name="Microsoft.DotNet.PackageValidation" Version="1.0.0-preview.5.21302.8" />

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <PackageVersion>2.0.0</PackageVersion>
    <PackageValidationBaselineVersion>1.0.0</PackageValidationBaselineVersion>
  </PropertyGroup>

</Project>

A few weeks later, you are tasked with adding support for a connection timeout to your library. The Connect method currently looks like this:

public static HttpClient Connect(string url)
{
    // ...
}

Since a connection timeout is an advanced configuration setting, you reckon that you can just add an optional parameter:

public static HttpClient Connect(string url, TimeSpan timeout = default)
{
    // ...
}

However, when you try to pack, it throws an error.

BaselineVersion

You realize that while this is not a source breaking change, it’s a binary breaking change. You solve this problem by adding an overload instead:

public static HttpClient Connect(string url)
{
    return Connect(url, Timeout.InfiniteTimeSpan);
}

public static HttpClient Connect(string url, TimeSpan timeout)
{
    // ...
}

You try to pack the project again.

BaselineVersionSuccessful

Validation Against Different Runtimes

You may choose to have different implementation assemblies for different runtimes in your nuget package. In that case, you will need to make sure that these assemblies are compatible with the compile-time assemblies.

For example, consider the following scenario: you are working on a library involving some interop calls to Unix and Windows APIs respectively. You have written the following code:

#if Unix
    public static void Open(string path, bool securityDescriptor)
    {
        // call unix specific stuff
    }
#else
    public static void Open(string path)
    {
        // call windows specific stuff
    }
#endif

The resulting package structure looks like

lib/net6.0/A.dll 
runtimes/unix/lib/net6.0/A.dll

libnet6.0A.dll will always be used at compile time regardless of the underlying operating system. libnet6.0A.dll will also be used at runtime for non-Unix systems, but runtimesunixlibnet6.0A.dll will be used at runtime for Unix systems.

When you try to pack this project, you get an error:

MultipleRuntimes, Package Validation

you quickly realize your mistake and adds A.B.Open(string) to the unix runtime as well.

#if Unix
    public static void Open(string path, bool securityDescriptor)
    {
        // call unix specific stuff
    }

    public static void Open(string path)
    {
        // throw not supported exception
    }
#else
    public static void Open(string path)
    {
        // call windows specific stuff
    }
#endif

You try to pack the project again.

MultipleRuntimesSuccessful, Package Validation

Roadmap

We will continue to add more and more capabilities with monthly updates until we’ll release a stable version later this year. Some of the features which are already in pipeline are error suppressions and nullability annotations compatibility rules.

Share Your Feedback

We are excited for this release, and look forward to your feedback. Let us know what you think of the product.

Let us know what you think!.

The post Package Validation appeared first on .NET Blog.



source https://devblogs.microsoft.com/dotnet/package-validation/

ML.NET June Updates

ML.NET is an open-source, cross-platform machine learning framework for .NET developers that enables integration of custom machine learning into .NET apps.

We are excited to announce new versions of ML.NET and Model Builder which bring a ton of awesome updates!

In this post, we’ll cover the following items:

  1. ML.NET Release
  2. Model Builder Updates
  3. ML.NET Survey Results
  4. Get started and resources

ML.NET Release

This release of ML.NET brings a long-awaited capability to the framework: ARM support!

ML.NET on ARM

You can now perform training and inferencing with ML.NET on ARM64 and Apple M1 (in addition to Linux and macOS) devices which enables platform support for mobile and embedded devices as well as ARM-based servers.

The following video shows training and inferencing on a Pinebook Pro laptop running Manjaro ARM Linux distribution:

There are still a few limitations when training and inferencing with ML.NET on ARM:

  • Symbolic SGD, TensorFlow, OLS, TimeSeries SSA, TimeSeries SrCNN, and ONNX are not currently supported for training or inferencing.
  • LightGBM is currently supported for inferencing, but not training.
  • You can add LightGBM and ONNX support by compiling them for ARM, but they don’t provide pre-compiled binaries for ARM/ARM64.

These will all throw a DLL not found exception. If you are blocked by any of these limitations or would like to see different behavior when hitting these, please let us know by filing an issue in our GitHub repo.

ML.NET on Blazor Web Assembly

With .NET 6, you can also now perform some training and inference on Blazor Web Assembly (WASM). It has the same limitations as ARM with the following additions:

  • You must currently set the EnableMLUnsupportedPlatformTargetCheck flag to false to install in Blazor.
  • LDA and Matrix Factorization are not supported.

Check out the Machine Learning Baseball Prediction repo (and the related Community Standup video) which has examples of using ML.NET in Blazor Web Assembly.

See the release notes for more details on this release of ML.NET.

Model Builder Updates

We recently announced several big changes to Model Builder as part of a preview release, including:

  • Config-based training with generated code-behind files
  • Restructured Advanced Data Options
  • Redesigned Consume step

Solution Explorer with ML.NET mbconfig, ML.NET June Updates

These features and enhancements, which you can learn more about from our previous blog post, are now available in the public feed. Update your version of Model Builder to access the newest features.

Project templates

There is a new Project templates section in Model Builder’s Consume step which allows you to generate projects that consume your model. These projects are starting points for model deployment and consumption.

Project templates in Model Builder, ML.NET June Updates

With this release, you can now add a console app or a minimal Web API (as described in this blog post) to your solution.

We plan to add support for more project / app types, such as Azure Functions, as we get more feedback (which you can leave in the Model Builder GitHub repo).

New and improved AutoML

We have also started collaborating with Microsoft Research teams NNI (Neural Network Intelligence) and FLAML (Fast and Lightweight AutoML) to update ML.NET’s AutoML implementation.

The partnership with these teams is important in the short- and long-term, and some of the benefits to ML.NET include:

  • Enabling AutoML support for all ML.NET scenarios
  • Allowing more precise control over the hyperparameter search space
  • Enabling more training environments, including local, Azure, and on-prem distributed training
  • Opening up future collaborations on advanced ML tech, like Network Architecture Search (NAS)

In the first implementation iteration, which is a part of this Model Builder release, our teams worked on decreasing the training failure rate, increasing the number of models explored in the given time and CPU resources, and improving overall training performance.

Benchmark testing

The team performed benchmark testing to ensure the changes to AutoML are improving the experience. Please note that this is an analysis of short runtimes; for most datasets that will be used to train production-level models, we recommend longer runtimes to allow AutoML to converge on the best model.

These benchmarks run on a standard D32s_v4 machine, and the training constraints are 1m1c, 10m1c and 30m1c (m for minutes and c for cores). There was no restriction on memory usage limit for each trial, and the maximum parallel experiments allowed was 30.

While 51 datasets were evaluated for each AutoML version, the evaluation metrics (AUC, Log loss, and R-Squared) are calculated based only on the datasets which shared success among the two versions.

Below is a summary of the benchmark testing so far:

Number of models explored

The new implementation of AutoML greatly increases the number of models that are explored for 1-minute train time, 10-minute train time, and 30-minute train time.

Number of models explored comparison, ML.NET June Updates

Note: More models explored is better.

Average timeout error rate

The new implementation of AutoML improves the timeout error rate for 1-minute train time, 10-minute train time, and 30-minute train time.

Number of models explored comparison

Note: Error is defined as when AutoML training times out in the given amount of train time without any model explored; error rate, or failure ratio, is defined as the percentage of datasets that finish AutoML training without any models found. A smaller error rate is better.

The team used several approaches for finding the first model faster during AutoML training, including:

  • Starting with a smaller model
  • Starting with more cost-efficient parameters
  • Sub-sampling (for large datasets)
Binary classification model performance (Area Under the Curve, or AUC)

The new implementation of AutoML decreases the AUC for 1-minute train time but improves the AUC for 10-minute train time and 30-minute train time.

Number of models explored comparison, ML.NET June Updates

Note: AUC closer to 1 is better.

Multiclass classification model performance (Accuracy)

The new implementation of AutoML decreases the accuracy for 1-minute train time but improves the accuracy for 10-minute train time and 30-minute train time.

Number of models explored comparison, ML.NET June Updates

Note: Accuracy closer to 1 is better.

Regression model performance (R-Squared)

The new implementation of AutoML improves R-Squared for 1-minute train time, 10-minute train time, and 30-minute train time.

Number of models explored comparison, ML.NET June Updates

Note: R-Squared closer to 1 is better.

Bug fixes

Thank you to everyone who tried out the Preview and left feedback! Based on feedback and bugs filed from this Preview, we were able to make a ton of fixes and improvements, some of which include:

  • Cancelling training does not discard current results (Issue 697)
  • GPU extension failing (Issue 1268)
  • Detect CUDA and cuDNN versions for GPU training (Issue 1152)
  • Advanced data options dark theme fix (Issue 1264)
  • Unintended page navigation (Issue 1276)

What’s next in Model Builder

We are working on a lot of awesome features and improvements for Model Builder, a few of which we’ve outlined below:

Easier collaboration and Git

This release of Model Builder only supports absolute paths for training datasets. This means that there is limited support for Git functionality, and sharing an mbconfig file between computers or accounts will require re-setting the local dataset location. We are tracking this fix in Issue 1456, which will add better support for sharing and checking in/out mbconfig files.

Performance improvements

The team is working on several performance improvements in the UI, particularly around interactions with large datasets.

Further AutoML improvements

The team will continue making improvements to AutoML including improving the current tuning algorithm so that it can search faster on a larger search space, more advanced training (e.g. via advanced featurizers and more trainers), and adding more scenarios to AutoML, including time series forecasting and anomaly detection.

Continue training

When you start training in Model Builder, you have to wait out the entire training time in order to get a model. This means that during training if you get, for example, a model with 95% accuracy that you’d like to use but have 10 minutes left of training, you must wait for the rest of the 10 minutes in order to get and use that model. If you “Cancel Training” at any point, you lose all progress.

Additionally, if you spend 10 minutes training and don’t get any models, or only get a few models with poor accuracy, you must start training over again with a larger train time in hopes that the next round will give you better models.

The team is working on adding support for being able to “continue” training which means the ability to start training again after stopping (or in this case pausing) training. With this feature, the training progress is not reset after you pause training, and instead training will recover from the point that you stopped training. Model Builder can then use the training history to potentially select better algorithm hyperparameters and to pick a pipeline with better performance, resulting in a better model. This also enables the scenarios of being able to pause training early and get the best model without having to re-start training again.

Azure ML Datasets

Currently when you train in Model Builder with the Azure ML training environment, your data gets uploaded to an Azure Blob storage associated with an Azure ML workspace. This means that you can only choose local data for training.

The ML.NET team is working with the Azure ML team to add Azure ML Datasets support so that you can choose to train on a dataset already in Azure. Alternatively, you will be able to create new Azure ML Datasets from local data within Model Builder.

ML.NET Survey Results

In a previous post, we asked for your feedback on Machine Learning in .NET.

We received ~900 responses (THANK YOU!) and went over some of the results in the Machine Learning .NET Community Standup.

The key insights from this round of surveys include:

  • Compared to surveys from the past 2 years,
    • More respondents have tried or are currently using ML.NET
    • More respondents from large companies are using ML.NET (vs. small companies)
    • More respondents are using ML in production already (vs. in the learning phases)
    • ML.NET users are getting more advanced and want advanced features (e.g. model explainability, data prep, deep learning)
  • The biggest blockers / pain points / challenges all up among respondents are:
    • Small ML.NET community
    • Docs and samples (quantity, quality, real world)
    • Insufficient deep learning support
    • Specific ML scenario or algorithm not supported by ML.NET
    • Afraid Microsoft will abandon it

The overall top pain points from the survey, as well as how we plan to address each one, are listed in the table below:

Pain point / blocker Action items / next steps
Small ML.NET community
  • Continue community efforts (e.g., Virtual ML.NET Community Conference, Machine Learning .NET Community Standup, ML.NET Discord channel)
  • Share more stories of ML.NET use cases / case studies
  • Be active on Stack Overflow, GitHub, etc. and encourage community contributions
Insufficient deep learning support
  • Torch support (consume PyTorch models in ML.NET)
  • Add Keras-like feature to build neural networks from scratch
  • Add scenarios as needed (e.g., NLP and object detection local and Azure training)
Lack of / quality of docs and samples
  • Updated Docs plan with more dedicated resources
  • Keep Docs and samples repo up to date
  • Add more practical use cases and more complicated E2E samples and tutorials
Specific ML scenario or algorithm not supported by ML.NET
  • Add NLP and local object detection training
  • Continue working with users and analyzing market to understand which scenarios and algorithms need to be supported in ML.NET
Afraid Microsoft will abandon it
  • Get on the .NET release schedule
  • Actively work on APIs + tooling / develop features / keep up to date with ML trends
  • Public strategy and roadmap
  • ML.NET announcements and demos in big .NET conference keynotes

If you have feedback, ideas, or other things you’d like to see from the ML.NET team, please let us know!

Get started and resources

Learn more about ML.NET and Model Builder in Microsoft Docs.

If you run into any issues, feature requests, or feedback, please file an issue in the ML.NET APIs repo or the ML.NET Tooling (Model Builder & ML.NET CLI) repo on GitHub.

Missed The Virtual ML.NET Community Conference? All the sessions were recorded, so you can watch all of the amazing talks from Day 1 and Day 2.

Tune in to the Machine Learning .NET Community Standup every other Wednesday at 10am Pacific Time.

The post ML.NET June Updates appeared first on .NET Blog.



source https://devblogs.microsoft.com/dotnet/ml-net-june-updates-model-builder/

Asynchronous JavaScript Course (Async/Await, Promises, Callbacks)


Curriculum for the course Asynchronous JavaScript Course (Async/Await, Promises, Callbacks)

Learn how to use Async/Await, Promises, and Callbacks in JavaScript. ✏️ Course from Joy Shaheb. Check out his channel: https://www.youtube.com/channel/UCHG7IJuST_BXJkne-0u0Xtw 📄 Article version: https://www.freecodecamp.org/news/javascript-async-await-tutorial-learn-callbacks-promises-async-await-by-making-icecream/ ⌨️ (0:00:00) Intro ⌨️ (0:00:37) Asynchronous JS ⌨️ (0:01:48) Sync vs Async ⌨️ (0:04:55) Examples ☝️ ⌨️ (0:08:40) setTimeout function ⌨️ (0:13:21) callbacks w/examples ⌨️ (0:18:09) ice cream w/ callbacks ⌨️ (0:42:02) Callback hell ⌨️ (0:43:32) Promises & promise cycle ⌨️ (0:54:22) Promise Chaining ⌨️ (1:03:27) error handling ⌨️ (1:05:37) finally handler ⌨️ (1:07:26) Async/ Await ⌨️ (1:09:42) try catch finally ⌨️ (1:15:46) Await keyword w/ example ⌨️ (1:25:22) ice cream w/ async/await -- Learn to code for free and get a developer job: https://www.freecodecamp.org Read hundreds of articles on programming: https://freecodecamp.org/news And subscribe for new videos on technology every day: https://youtube.com/subscription_center?add_user=freecodecamp

Watch Online Full Course: Asynchronous JavaScript Course (Async/Await, Promises, Callbacks)


Click Here to watch on Youtube: Asynchronous JavaScript Course (Async/Await, Promises, Callbacks)


This video is first published on youtube via freecodecamp. If Video does not appear here, you can watch this on Youtube always.


Udemy Asynchronous JavaScript Course (Async/Await, Promises, Callbacks) courses free download, Plurasight Asynchronous JavaScript Course (Async/Await, Promises, Callbacks) courses free download, Linda Asynchronous JavaScript Course (Async/Await, Promises, Callbacks) courses free download, Coursera Asynchronous JavaScript Course (Async/Await, Promises, Callbacks) course download free, Brad Hussey udemy course free, free programming full course download, full course with project files, Download full project free, College major project download, CS major project idea, EC major project idea, clone projects download free

The ARM processor (Thumb-2), part 17: Prologues and epilogues

The calling convention and ABI for ARM on Windows dictates a lot of the structure of function prologues and epilogues.
Here’s a typical function prologue:
push {r4-r7,r11,lr} ; save a bunch of registers
add r11, sp, #0x10 ; link into frame pointer chain
sub sp,

The post The ARM processor (Thumb-2), part 17: Prologues and epilogues appeared first on The Old New Thing.

2021-06-22 14:00:00Z 0001-01-01 00:00:00Z https://devblogs.microsoft.com/oldnewthing/20210622-00/?p=105332

JavaScript Programming - Full Course


Curriculum for the course JavaScript Programming - Full Course

Learn JavaScript from scratch by solving over a hundred different coding challenges. Go here for the interactive browser version: https://scrimba.com/learn/learnjavascript ⭐️ Code ⭐️ Two versions: 🔗 Interactive version: https://scrimba.com/learn/learnjavascript 🔗 GitHub repo: https://github.com/scrimba/learn-javascript ✏️ Created by Per Harald Borgen. Per on Twitter: https://twitter.com/perborgen 00:00 Intro 03:41 Passenger counter app 04:39 Setting up file 07:42 Create variable 12:27 Mathematical operations 16:16 Reassigning & incrementing 19:23 Adding button 21:41 onclick event listener 25:10 Using functions to write less code 28:48 First function 29:34 Function that logs sum 32:25 Function that increments 34:23 Increment on clicks 36:35 Display count 41:53 Document Object Model 43:47 Display count w/ innerText 44:30 Create save button 46:40 What is string? 48:16 First string variable 52:00 Log greeting to console 53:18 Strings vs. Numbers 56:07 Render welcome message 58:10 Improve message w/ string concatenation 1:00:28 Use plus equal for count 1:00:57 Create save feature 1:05:38 Debugging online 1:09:31 Set count to 0 1:12:28 Recap 1:15:47 Variables practice 1:17:42 Concatenate strings 1:18:43 Incrementing & decrementing 1:20:56 Strings & numbers 1:22:35 Rendering error message 1:25:52 Calculator challenge ​ Build Blackjack Game 1:31:27 Build Blackjack game 1:32:27 Add firstCard, secondCard, & sum 1:33:23 If...else conditionals 1:39:08 if...else statement 1:42:05 if/else...if/else statement 1:45:28 if...else statement for our game 1:47:32 hasBlackJack variable 1:49:38 isAlive variable 1:51:27 Practice boolean conditions 1:54:55 Add message variable 1:58:20 Link stylesheet 2:00:56 Add basic styling 2:05:19 Make start button work 2:11:13 Display message 2:13:48 Display sum 2:19:36 Display cards 2:21:34 New card button 2:25:16 Add to sum when newCard is clicked 2:28:36 Rename startGame function 2:30:52 Solving our cards problem w/ array 2:34:12 Arrays intro 2:39:30 Array indexes 2:43:50 Arrays w/ multiple data types 2:46:12 Adding & removing items from arrays 2:50:35 Creating cards array 2:51:43 Push new card to array 2:53:05 Counting 2:57:10 Loops 3:00:37 For loops & arrays 3:04:23 First array-based for loop 3:05:55 For loops, arrays, & DOM 3:08:55 Use loop to render cards 3:11:16 Avoid hard-coding values 3:12:51 Returning values 3:17:54 Use function to set card values 3:21:05 Generating random numbers w/ Math.random() 3:25:24 Math.random() * 6 3:27:11 Flooring number w/ Math.floor() 3:28:40 Create dice 3:30:23 Completing dice function 3:33:04 Make getRandomCard() work 3:36:00 getRandomNumber function 3:39:06 Assign values in startGame function 3:41:52 Card feature is broken 3:42:54 Logical AND operator 3:46:39 Logical operators 3:48:47 logical OR operator 3:51:52 Only trigger newCard() if you're allowed to 3:53:23 Object sneak peek 3:58:02 Objects 4:02:47 Create first object 4:06:08 Store player data 4:08:48 Methods on object 4:10:50 Recap 4:15:17 Objects & functions 4:17:21 if else 4:20:13 Loops & arrays 4:22:21 push, pop, unshift, shift challenge 4:25:50 Logical operators 4:27:50 Rock papers scissors 4:30:52 Sorting fruits Build Chrome Extension 4:33:54 Build Chrome Extension 4:38:30 Add button & input tag 4:40:06 Style button & input tag 4:47:28 Make input button work w/ onclick 4:48:49 Refactor to addEventListener 4:51:11 addEventListener() 4:52:58 Refactoring 4:54:25 Create myLeads array & inputEl 4:56:49 Using let & const 5:00:11 Push to myLeads array 5:01:24 Push value from input field 5:03:56 Use for loop to log out leads 5:05:38 Create unordered list 5:07:39 Render leads in unordered list 5:11:22 How to render li elements w/ innerHTML 5:13:01 innerHTML 5:14:34 More innerHTML practice 5:16:26 Render li elements w/ innerHTML 5:17:37 Use createElement() & append() instead of innerHTML 5:21:16 Improving performance of our app 5:24:37 Create render function 5:26:40 Clear input field 5:28:47 Add a tag 5:35:53 Template strings 5:35:54 Write template string 5:36:28 Make template string more dynamic 5:37:12 Template strings on multiple lines 5:41:03 Refactor app to use template string 5:42:19 Style list 5:46:13 Preparing deployment 5:51:08 Deploying Chrome Extension 5:53:40 What is localStorage? 5:56:45 First localStorage 6:00:38 Storing arrays in localStorage 6:07:05 Save leads 6:09:36 Get leads 6:13:31 Truthy & falsy values 6:21:28 Guess expression: truthy or falsy? 6:23:52 Checking localStorage before rendering 6:27:33 Style delete button 6:30:52 Make delete button work 6:35:12 How function parameters can improve our code 6:41:09 Write function parameter 6:44:40 Functions w/ multiple params 6:47:54 Numbers as function params 6:49:40 Arguments vs Params 6:53:06 Arrays as params 6:55:02 Refactor renderLeads() to use parameter 6:56:46 Create tabBtn 7:00:07 Save tab url 7:02:46 Get current tab 7:07:09 Use Chrome API to get tab 7:13:32 Deploy final version 7:15:48 Recap 7:21:34 Practice 7:41:55 Outro

Watch Online Full Course: JavaScript Programming - Full Course


Click Here to watch on Youtube: JavaScript Programming - Full Course


This video is first published on youtube via freecodecamp. If Video does not appear here, you can watch this on Youtube always.


Udemy JavaScript Programming - Full Course courses free download, Plurasight JavaScript Programming - Full Course courses free download, Linda JavaScript Programming - Full Course courses free download, Coursera JavaScript Programming - Full Course course download free, Brad Hussey udemy course free, free programming full course download, full course with project files, Download full project free, College major project download, CS major project idea, EC major project idea, clone projects download free

The ARM processor (Thumb-2), part 16: The calling convention

For non-variadic functions, the Windows calling convention for ARM matches the Procedure Call Standard for the Arm Architecture, so this will largely match what you see on most other operating systems.
The fine points of the calling convention are spelled out in the standard document,

The post The ARM processor (Thumb-2), part 16: The calling convention appeared first on The Old New Thing.

2021-06-21 14:00:00Z 0001-01-01 00:00:00Z https://devblogs.microsoft.com/oldnewthing/20210621-00/?p=105327

ASP.NET Core updates in .NET 6 Preview 5

.NET 6 Preview 5 is now available and includes many great new improvements to ASP.NET Core.

Here’s what’s new in this preview release:

  • .NET Hot Reload updates for dotnet watch
  • ASP.NET Core SPA templates updated to Angular 11 and React 17
  • Use Razor syntax in SVG foreignObject elements
  • Specify null for Action and RenderFragment component parameters
  • Reduced Blazor WebAssembly download size with runtime relinking
  • Configurable buffer threshold before writing to disk in Json.NET output formatter
  • Subcategories for better filtering of Kestrel logs
  • Faster get and set for HTTP headers
  • Configurable unconsumed incoming buffer size for IIS

Get started

To get started with ASP.NET Core in .NET 6 Preview 5, install the .NET 6 SDK.

If you’re on Windows using Visual Studio, we recommend installing the latest preview of Visual Studio 2019 16.11. Visual Studio 2022 Preview 1 is also releasing today and .NET 6 Preview 5 is included in that release. If you’re on macOS, we recommend installing the latest preview of Visual Studio 2019 for Mac 8.10.

To get setup with .NET MAUI & Blazor for cross-platform native apps, see the latest instructions in the .NET MAUI getting started guide. Be sure to also check out the Announcing .NET MAUI Preview 5 blog post for all the details on what’s new in .NET MAUI in this release.

Note: .NET MAUI is not yet supported in Visual Studio 2022 Preview 1. For .NET MAUI development, please use the latest preview of Visual Studio 2019 16.11 instead.

To install the latest .NET WebAssembly tools for ahead-of-time (AOT) compilation and runtime relinking, run the following command from an elevated command prompt:

dotnet workload install microsoft-net-sdk-blazorwebassembly-aot

If you’ve installed the .NET WebAssembly workload previously, you can update it to .NET 6 Preview 5 by running the following command from an elevated command prompt:

dotnet workload update

Note: There is a known issue with installing optional SDK workloads using the .NET 6 Preview 5 SDK included with Visual Studio 2022 Preview 1. To workaround this issue, install the .NET 6 Preview 5 SDK from https://dot.net/get-dotnet6 after installing Visual Studio 2022 Preview 1.

Upgrade an existing project

To upgrade an existing ASP.NET Core app from .NET 6 Preview 4 to .NET 6 Preview 5:

  • Update all Microsoft.AspNetCore.* package references to 6.0.0-preview.5.*.
  • Update all Microsoft.Extensions.* package references to 6.0.0-preview.5.*.

To upgrade a .NET MAUI Blazor app from .NET 6 Preview 4 to .NET 6 Preview 5 we recommend starting from a new .NET MAUI Blazor project created with the .NET 6 Preview 5 SDK and then copying code over from your original project.

See the full list of breaking changes in ASP.NET Core for .NET 6.

.NET Hot Reload updates for dotnet watch

We’ve been working on various improvements to .NET Hot Reload for .NET 6. Some of these improvements are available in .NET 6 Preview 5, while others are still a work in progress and will be refined in future preview updates.

You no longer need to specify hotReloadProfile in launchSettings.json to use .NET Hot Reload with dotnet watch. .NET Hot Reload with project appropriate behavior is now enabled by default.

When a code edit is made that cannot be hot reloaded (a “rude” edit), dotnet watch will now ask if you want to restart the app to apply the change:

watch : Unable to apply hot reload because of a rude edit. Rebuilding the app...
watch : Unable to handle changes to C:\Users\daroth\Desktop\BlazorApp\Pages\Index.razor.
watch : Do you want to restart your app - Yes (y) / No (n) / Always (a) / Never (v)?

These options have the following behaviors:

  • Choosing Yes will restart the app.
  • Choosing No won’t restart the app and will leave the app running without the changes applied.
  • Choosing Always will restart the app as needed when changes cannot be hot reloaded.
  • Choosing Never won’t restart the app and avoids future prompts.

You can always manually restart the app using Ctrl+R.

Note: There is a known issue in this release that selecting Always still continues to prompt for future rude edits. This will get addressed in a future preview release.

To disable support for .NET Hot Reload when using dotnet watch, use the --no-hot-reload command-line option.

.NET Hot Reload with dotnet watch will also now correctly detect rude edits Blazor WebAssembly apps. Changes applied to Blazor WebAssembly apps will get reapplied to the app when the browser is refreshed or the app is loaded in a separate browser tab or browser instance.

ASP.NET Core SPA templates updated to Angular 11 and React 17

The ASP.NET Core single-page app (SPA) templates for Angular and React have been updated to Angular 11 and React 17. We also expect to further update the Angular template to Angular 12 in a future .NET 6 preview release now that it’s been released.

Support Razor syntax in SVG foreignObject elements

You can now use Razor syntax, including the use of Blazor components, in SVG foreignObject elements:

<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
    <rect x="0" y="0" rx="10" ry="10" width="200" height="200" stroke="black" fill="none" />
    <foreignObject x="20" y="20" width="160" height="160">
        <p>@message</p>
    </foreignObject>
</svg>

@code {
    string message = "Wow, it's so nice that this text wraps like it's HTML...because that's what it is!";
}

We also did a bunch of verification and testing to make sure that Blazor has good support for SVG scenarios. We think Blazor’s SVG support is now in good shape. If you hit any issues using SVG in Blazor with this release, please let us know by creating issues on GitHub.

Specify null for Action and RenderFragment component parameters

You can now specify null for the value of Blazor component parameters of type Action and RenderFragment, which simplifies the authoring of components that take optional callback parameters or template parameters.

Reduced Blazor WebAssembly download size with runtime relinking

One of the largest parts of a default Blazor WebAssembly app is the WebAssembly based .NET runtime (dotnet.wasm) that the app carries with it. Blazor WebAssembly already has support for trimming unused code from the .NET core framework libraries. However, the download size of the runtime has been constant.

Not all of the runtime logic is needed by every app. For example, a large part of the runtime logic and related data files are for globalization scenarios. This globalization support enables Blazor WebAssembly apps to handle strings, numbers, dates, etc. based on the current culture. But for apps that don’t need this functionality, all that data and logic is just extra bits.

.NET apps that don’t need globalization functionality can opt out of it and use invariant globalization instead by setting the InvariantGlobalization property to true in their project files. In .NET 5, this would allow a Blazor WebAssembly app to avoid downloading globalization data, but the related logic in the .NET runtime would still be included.

In .NET 6 Preview 5, you can now use the .NET WebAssembly tools (the same tools used for .NET WebAssembly AOT compilation) to relink the runtime to remove unneeded logic and dramatically reduce the size of the runtime. If you have the .NET WebAssembly workload installed, runtime relinking is done automatically when you publish the app. The size reduction is particularly dramatic when using invariant globalization mode.

If you haven’t already, you can install the .NET WebAssembly tools by running the following command from an elevated command prompt:

dotnet workload install microsoft-net-sdk-blazorwebassembly-aot

The following table shows the transfer size of dotnet.wasm for a default Blazor WebAssembly project with .NET 5 and .NET 6:

dotnet.wasm Transfer size (kB)
.NET 5 default 884
.NET 6 default 780
.NET 6 relinked 756
.NET 6 invariant mode 393

Configurable buffer threshold before writing to disk in Json.NET output formatter

The Newtonsoft.Json output formatter by default buffers responses up to 32 KiB in memory before buffering to disk. This is to avoid performing synchronous IO, which can result in other side-effects such as thread starvation and application deadlocks. However, if your response if was larger than 32 KiB this resulted in a lot of avoidable disk I/O. You can now configure the memory threshold before buffering to disk.

public void ConfigureServices(IServiceCollection services)
{
    services.AddRazorPages()
            .AddNewtonsoftJson(options =>
            {
                options.OutputFormatterMemoryBufferThreshold = 48 * 1024;
            });
}

Note: We still recommend using the System.Text.Json output formatter unless you require the Newtonsoft.Json serializer for compatibility reasons. The System.Text.Json serializer is fully async and will work efficiently for any size payload.

Subcategories for better filtering of Kestrel logs

Prior to this change, enabling verbose logging for Kestrel was prohibitively expensive as all of Kestrel shared the same logging category name (Microsoft.AspNetCore.Server.Kestrel). We’ve now split up that category into multiple new subcategories:

  • Microsoft.AspNetCore.Server.Kestrel (current category): ApplicationError, ConnectionHeadResponseBodyWrite, ApplicationNeverCompleted, RequestBodyStart, RequestBodyDone, RequestBodyNotEntirelyRead, RequestBodyDrainTimedOut, ResponseMinimumDataRateNotSatisfied, InvalidResponseHeaderRemoved, HeartbeatSlow.
  • Microsoft.AspNetCore.Server.Kestrel.BadRequests: ConnectionBadRequest, RequestProcessingError, RequestBodyMinimumDataRateNotSatisfied.
  • Microsoft.AspNetCore.Server.Kestrel.Connections: ConnectionAccepted, ConnectionStart, ConnectionStop, ConnectionPause, ConnectionResume, ConnectionKeepAlive, ConnectionRejected, ConnectionDisconnect, NotAllConnectionsClosedGracefully, NotAllConnectionsAborted, ApplicationAbortedConnection.
  • Microsoft.AspNetCore.Server.Kestrel.Http2: Http2ConnectionError, Http2ConnectionClosing, Http2ConnectionClosed, Http2StreamError, Http2StreamResetAbort, HPackDecodingError, HPackEncodingError, Http2FrameReceived, Http2FrameSending, Http2MaxConcurrentStreamsReached.
  • Microsoft.AspNetCore.Server.Kestrel.Http3: Http3ConnectionError, Http3ConnectionClosing, Http3ConnectionClosed, Http3StreamAbort, Http3FrameReceived, Http3FrameSending.

While your existing rules will continue to work (log filtering applies rules with the longest matching category prefix), you can now be more selective on which rules you enable. For example, the observability overhead of enabling Debug logging for just bad requests is greatly reduced and can be achieved with the following configuration:

{
  "Logging": {
    "LogLevel": {
      "Microsoft.AspNetCore.Kestrel.BadRequests": "Debug"
    }
  }
}

Faster get and set for HTTP headers

We added new API to expose all common headers available on System.Net.Http.HeaderNames as properties on the Microsoft.AspNetCore.Http.IHeaderDictionary resulting in an easier to use API. For example, the in-line middleware below gets/sets both request and response headers using the new APIs:

app.Use(async (context, next) =>
{
    var hostHeader = context.Request.Headers.Host;
    app.Logger.LogInformation("Host header: {host}", hostHeader);
    context.Response.Headers.XPoweredBy = "ASP.NET Core 6.0-preview5";
    await next.Invoke(context);
    var dateHeader = context.Response.Headers.Date;
    app.Logger.LogInformation("Response date: {date}", dateHeader);
});

For implemented headers the get/set accessors are implemented by going directly to the field and bypassing the lookup. For non-implemented headers, the accessors can bypass the initial lookup against implemented headers and directly perform the Dictionary<string, StringValues> lookup. This results in faster access for both scenarios.

Method Branch Type Mean Op/s Delta
GetHeaders preview4 Plaintext 25.793 ns 38,770,569.6
GetHeaders preview5 Plaintext 12.775 ns 78,279,480.0 +101.9%
GetHeaders preview4 Common 121.355 ns 8,240,299.3
GetHeaders preview5 Common 37.598 ns 26,597,474.6 +222.8%
GetHeaders preview4 Unknown 366.456 ns 2,728,840.7
GetHeaders preview5 Unknown 223.472 ns 4,474,824.0 +64.0%
SetHeaders preview4 Plaintext 49.324 ns 20,273,931.8
SetHeaders preview5 Plaintext 34.996 ns 28,574,778.8 +40.9%
SetHeaders preview4 Common 635.060 ns 1,574,654.3
SetHeaders preview5 Common 108.041 ns 9,255,723.7 +487.7%
SetHeaders preview4 Unknown 1,439.945 ns 694,470.8
SetHeaders preview5 Unknown 517.067 ns 1,933,985.7 +178.4%

Configurable unconsumed incoming buffer size for IIS

Prior to this change, the IIS server only buffered 64 KiB of unconsumed request bodies. This resulted in reads being constrained to that maximum size, which impacts the performance when large incoming bodies such as large uploads. In .NET 6 Preview 5, we’ve changed the default buffer size from 64 KiB to 1 MiB which should result in improved throughput for large uploads. In our tests, a 700 MiB upload that used to take 9 seconds now only takes 2.5 seconds.

The downside of a larger buffer size is an increased per-request memory consumption when the app isn’t quickly reading from the request body. So, in addition to changing the default buffer size, we’ve also made the buffer size configurable, allowing you to tune it based on your workload.

public void ConfigureServices(IServiceCollection services)
{
    services.Configure<IISServerOptions>(
        options =>
        {
            options.MaxRequestBodySize = 64 * 1024;
        }
    );
}

Give feedback

We hope you enjoy this preview release of ASP.NET Core in .NET 6. We’re eager to hear about your experiences with this release. Let us know what you think by filing issues on GitHub.

Thanks for trying out ASP.NET Core!

The post ASP.NET Core updates in .NET 6 Preview 5 appeared first on ASP.NET Blog.



Announcing .NET MAUI Preview 5

While we are still recovering from Microsoft Build and .NET 6 Preview 4, we are here to share our continued progress with .NET Multi-platform App UI (.NET MAUI) with .NET 6 Preview 5. In this release we have enabled animations and view transformations, completed the porting of several UI components, and introduced improvements to the single project templates.

We have also published our first batch of preview documentation covering introductory and foundational aspects of .NET MAUI: https://docs.microsoft.com/dotnet/maui/.

Image mauiFadeTo

Animations

There are a few ways to perform animation in .NET MAUI, the easiest of which is using view extension methods such as FadeTo, RotateTo, ScaleTo, TranslateTo, and more. In the following example I grab a reference to each view bound to the layout (see bindable layouts) using the new HandlerAttached event:

<DataTemplate x:Key="FavouriteTemplate">
    <Frame
        AttachedHandler="OnAttached"
        Opacity="0">
        ...
    </Frame>
</DataTemplate>
<FlexLayout
    BindableLayout.ItemTemplate="{StaticResource FavouriteTemplate}"
    BindableLayout.ItemsSource="{Binding Favorites}"
    >
    ...
</FlexLayout>

When the page appears I then animate the views in with a slight stagger to create the beautiful cascade effect.

public partial class FavoritesPage : ContentPage
{
    List<Frame> tiles = new List<Frame>();

    void OnAttached(object sender, EventArgs e)
    {

        Frame f = (Frame)sender;
        tiles.Add(f);
    }

    protected override async void OnAppearing()
    {
        base.OnAppearing();

        await Task.Delay(300);
        TransitionIn();
    }

    async void TransitionIn()
    {
        foreach (var item in tiles)
        {
            item.FadeTo(1, 800);
            await Task.Delay(50);
        }
    }    
}

For more complete orchestration of view animations, check out the Custom Animation documentation which demonstrates adding multiple child animations that can run parallel.

You can view and run the source for this example from the WeatherTwentyOne project on GitHub.

UI Components

In this release several controls now have all properties and events ported to handlers from the renderer architecture of Xamarin.Forms, including ActivityIndicator, CheckBox, Image, and Stepper. In previous previews you would need to check if a control was ported and register renderers from the compatibility package for those unavailable. In .NET MAUI Preview 5 we have made this much easier by updating the UseMauiApp extension (see the Startup wiki) to wire up all the controls for you, whether they are based on handlers or renderers.

Image maui pre5 controls

Also new in preview 5 is the first introduction of Shell, an application container that provides URI navigation and a quick way to implement flyout menus and tabs. To get started add Shell as the root element to your window in the App.xaml.cs. The typical pattern I follow is naming it “AppShell”, though you can name it as you wish.

protected override IWindow CreateWindow(IActivationState activationState)
{
    return new Microsoft.Maui.Controls.Window(
        new AppShell()
    );
}

Now in your AppShell class start populating the menu with content using the type that represents the navigation you wish to display, either FlyoutItem or Tab. These are not UI controls, but rather represent the types that will create those UI controls. You can later style the controls with content templates which we’ll introduce in preview 6.

<Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui" 
       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
       xmlns:pages="clr-namespace:ControlGallery.Pages"
       Title="ControlGallery"
       x:Class="ControlGallery.AppShell">

    <FlyoutItem Title="Margin and Padding">
        <ShellContent Route="marginpadding" 
                      ContentTemplate="{DataTemplate pages:ControlsPage}" />
    </FlyoutItem>

    <FlyoutItem Title="ActivityIndicator">
        <ShellContent Route="activityindicator" 
                      ContentTemplate="{DataTemplate pages:ActivityIndicatorPage}" />
    </FlyoutItem>

    ...

</Shell>

Image maui shell catalyst

Get the very latest information about controls, layouts, and features on our .NET MAUI status page.

Single Project Templates Updates

We have made progress in this release consolidating the multiple WinUI projects into one. Now when you dotnet new maui a project you’ll see two projects: the multi-targeted .NET MAUI project, and the WinUI project.

visual studio showing two projects

Now to run the WinUI project you’ll have no confusion about which project to choose. This is one step closer to the final vision of having just one project that can build and deploy to all supported platforms. In order to support this, you’ll need to install these Project Reunion 0.8 (Preview) extensions for Visual Studio 16.11 Preview 2.

Getting Started with .NET MAUI Preview 5

In this release we’ve enabled restoring your project without adding a custom NuGet source. Just create a new project and run it! To get all the latest pieces, we continue to recommend running the maui-check dotnet tool.

To install:

$ dotnet tool install -g redth.net.maui.check

Now run and follow the updates to get .NET 6 Preview 5, platform SDKs, .NET MAUI, project templates, and even check your environment for 3rd party dependencies.

$ maui-check

If you wish to go step-by-step yourself, you can install everything individually with these instructions.

Once installed, you’re ready to create a new app based on the preview 5 template.

$ dotnet new maui -n MauiFive

Open your new MauiFive.sln in Visual Studio 16.11 Preview 1 and run the platform of your choice!

Eager to try Visual Studio 2022 Preview 1? Start exploring with the mobile platforms using the Android emulator and iOS with a remote iOS device, or connected Mac host. Be sure to disable XAML Hot Reload to avoid a type error, or stick with Visual Studio 2019 version 16.11 Preview 2.

In the future, Project Reunion extensions will support Visual Studio 2022 and you’ll be able to use all the platforms on Windows.

If you have existing .NET MAUI projects you wish to migrate to Preview 5, I recommend creating a new project like above and copying your files over to the multi-targeted project so you can avoid the trouble of reconciling the WinUI projects.

For additional information about getting started with .NET MAUI, refer to our new documentation website.

Feedback Welcome

Please let us know about your experiences using .NET MAUI Preview 5 to create new applications by engaging with us on GitHub at dotnet/maui.

For a look at what is coming in future releases, visit our product roadmap.

The post Announcing .NET MAUI Preview 5 appeared first on .NET Blog.



source https://devblogs.microsoft.com/dotnet/announcing-net-maui-preview-5/

Announcing Entity Framework Core 6.0 Preview 5: Compiled Models

Today, the Entity Framework Core team announces the fifth preview release of EF Core 6.0. This release includes the first iteration of compiled models. If startup time for your application is important and your EF Core model contains hundreds or thousands of entities, properties, and relationships, this is one release you don’t want to ignore.

TL;DR;

  • Compiled models dramatically reduce startup time for your application.
  • The models are generated (similar to how migrations are) so they should be refreshed whenever your model changes.
  • Some features are not currently supported by compiled models, so be aware of the limitations when you try them out.

Background

How does 10x performance sound to you? Our team created a sample project with a DbContext that contains 449 entity types, 6,390 properties and 720 relationships. I wrote a console app that loops several times, creates a new instance of a DbContext and loads a set of entities with no filters or ordering. The start-up time for the first run consistently takes around two seconds on my laptop, with subsequent cached instances weighing in at about 1.5 seconds. Here’s the output from a run:

$ dotnet run -c Release
Model has:
  449 entity types
  6390 properties
  720 relationships
Instantiating context...
It took 00:00:02.1603163.
Instantiating context...
It took 00:00:01.6268628.
Instantiating context...
It took 00:00:01.7144346.
Instantiating context...
It took 00:00:01.6090380.
Instantiating context...
It took 00:00:01.7049987.

After testing the baseline application, I used the new EF Core tools Command Line Interface (CLI) feature to optimize the DbContext:

dotnet ef dbcontext optimize -output-dir MyCompiledModels --namespace MyCompiledModels

The tool gave me instructions to add a single line of code to my DbContext configuration:

options.UseModel(MyCompiledModels.BlogsContextModel.Instance);

I made the update and re-ran the code to receive a 10x performance gain with the initial model taking 257ms to complete. The cached model reduced additional calls to just 10ms.

$ dotnet run -c Release
Model has:
  449 entity types
  6390 properties
  720 relationships
Instantiating context...
It took 00:00:00.2573627.
Instantiating context...
It took 00:00:00.0132345.
Instantiating context...
It took 00:00:00.0119556.
Instantiating context...
It took 00:00:00.0101717.
Instantiating context...
It took 00:00:00.0139057.

A peek at the query pipeline

EF Core performs quite a bit of work to get from your application to returning the first result of the first query your application processes. Let’s break down the following two statements and go “behind the scenes” to see what happens.

using var myContext = new MyContext();
var results = myContext.MyWidgets.ToList();

DbContext instantiation

The first step is creating an instance of the context. The first time a DbContext is created, EF Core will create and compile delegates to set the table properties you expose by using DbSet<Entity>. This simply creates the delegates to set the properties so you can query them right away.

Performance tip: you can avoid the overhead of DbSet initialization by using an alternate approach such as the context.Set<Entity>() API call.

DbContext (lazy) initialization

After the DbContext is created, EF Core “goes to sleep” until you use it. The first time you use a context by accessing one of its APIs (such as navigating an entity and returning results), the context is initialized. This will run the OnConfiguring method to establish the proper provider and database connections as well as other settings. For example, this is the perfect place to use the simple logging feature by calling the new LogTo extension on the options builder.

Service provider

EF Core uses a service-based architecture and has an internal dependency injection framework. This provider is built internally but is designed to work with external DI solutions such as the service provider in ASP.NET Core.

Performance tip: much of the overhead described so far can be mitigated by using context pooling. This enables a pool of reusable context instances that are already initialized.

Model building

To understand how a domain object (C# class) relates to the tables and relationships in the database, EF Core builds an internal model that represents all the types, properties, constraints, and relationships that it finds in your DbContext. This is a metadata model and includes the call to OnModelCreating that can be overridden to provide fluent configuration of the model.

Query compilation

A major reason why developers use EF Core is its ability to parse Language Integrated Queries (LINQ) into the database dialect. This is an advanced stage because it involves traversing a potentially complex expression tree and translating it into SQL. Something trivial like a projection:

var projection = myQuery.Select(obj => new { id = obj.EntityId, name = obj.Identifier });

Seems easy enough to translate:

SELECT EntityId, Identifier FROM ...

But what about something more complicated, like this?

var pairs = (from a1 in context.Attendees
                from a2 in context.Attendees
                where a1.Id != a2.Id
                select new
                {
                    a1 = a1.Id,
                    a1LastName = a1.LastName,
                    a1FirstName = a2.FirstName,
                    a2 = a2.Id,
                    a2LastName = a2.LastName,
                    a2FirstName = a2.FirstName,
                    sessionCount = 
                    a1.Sessions.Select(s => s.Id)
                    .Intersect(a2.Sessions.Select(s => s.Id)).Count()
                }).OrderByDescending(shared => shared.sessionCount)
            .Take(5);

This is ultimately parsed into native SQL, intersection and all. The first time that EF Core encounters a query, it parses the query to determine which parts are dynamic. It then compiles the static parts of the query and parameterizes the dynamic aspects to expedite translation into SQL by using a SQL template.

Run the query

Finally! The query is now run. To avoid the overhead of performing these steps every time, EF Core caches the delegates for DbSet properties, the internal service provider, the constructed model, and the compiled query. This results in much faster performance after the queries are successfully run the first time.

You can visualize these steps using the following diagram (note the cache boxes have strike-through to show they are disabled for our benchmark tests):

EF Core initialization steps, Announcing Entity Framework Core 6.0 Preview 5

Although most of the pipeline is already streamlined, model compilation was an area we knew could improve.

A note on source generators. The approach the team chose is to provide a command that generates the source code files that you can then incorporate into your project to build the compiled model. We are often asked why we didn’t choose source generators. The answer is that source generators run as user code inside the Visual Studio process. EF Core must build and run the context to obtain information about the model. If an exception is thrown as part of the process, this could potentially force Visual Studio to hang or crash.

As with most technology, compiled models do have trade-offs. Let’s look at the pros and cons.

Pros and cons

The pros should be clear. As your model grows larger, your startup time remains fast. Here is a comparison of startup time between compiled and non-compiled models based on the size of the model.

Startup time by model size, Announcing Entity Framework Core 6.0 Preview 5

Here are some cons to consider:

Tip: if supporting any of these features is critical to your success, please find the issue and upvote it or add your comments and thoughts, or file a new issue to let us know.

Now you’ve learned the background. How do you get started?

In conclusion

To start using compiled models today, reap the performance benefits and have the opportunity to provide us with feedback before we release the final EF Core 6.0 version, start by grabbing the latest preview (instructions are below) and installing the latest EF Core CLI. The new tool command looks like this (all parameters are optional):

dotnet ef dbcontext optimize -c MyContext -o MyFolder -n My.Namespace 

Inside the NuGet package manager console you can use this:

Optimize-DbContext -Context MyContext -OutputDir MyFolder -Namespace My.Namespace

The tool will instruct you to add a line like this to your options configuration:

opts.UseModel(My.Namespace.MyContextModel.Instance);

We hope you benefit from this new feature and can provide us with early feedback. Check out the EF Core 6.0 plan. In addition to other work, the team has prioritized a number of Azure Cosmos DB provider features. Please upvote the features that are important to you and share any feedback you may have! Other features in the preview 5 release will be posted in EF Core 6.0 What’s New.

How to get EF Core 6.0 previews

EF Core is distributed exclusively as a set of NuGet packages. For example, to add the SQL Server provider to your project, you can use the following command using the dotnet tool:

dotnet add package Microsoft.EntityFrameworkCore.SqlServer --version 6.0.0-preview.5.21301.9

This following table links to the preview 5 versions of the EF Core packages and describes what they are used for.

Package Purpose
Microsoft.EntityFrameworkCore The main EF Core package that is independent of specific database providers
Microsoft.EntityFrameworkCore.SqlServer Database provider for Microsoft SQL Server and SQL Azure
Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite SQL Server support for spatial types
Microsoft.EntityFrameworkCore.Sqlite Database provider for SQLite that includes the native binary for the database engine
Microsoft.EntityFrameworkCore.Sqlite.Core Database provider for SQLite without a packaged native binary
Microsoft.EntityFrameworkCore.Sqlite.NetTopologySuite SQLite support for spatial types
Microsoft.EntityFrameworkCore.Cosmos Database provider for Azure Cosmos DB
Microsoft.EntityFrameworkCore.InMemory The in-memory database provider
Microsoft.EntityFrameworkCore.Tools EF Core PowerShell commands for the Visual Studio Package Manager Console; use this to integrate tools like scaffolding and migrations with Visual Studio
Microsoft.EntityFrameworkCore.Design Shared design-time components for EF Core tools
Microsoft.EntityFrameworkCore.Proxies Lazy-loading and change-tracking proxies
Microsoft.EntityFrameworkCore.Abstractions Decoupled EF Core abstractions; use this for features like extended data annotations defined by EF Core
Microsoft.EntityFrameworkCore.Relational Shared EF Core components for relational database providers
Microsoft.EntityFrameworkCore.Analyzers C# analyzers for EF Core

We also published the 6.0 preview 5 release of the Microsoft.Data.Sqlite.Core provider for ADO.NET.

Thank you from the team

A big thank you from the EF team to everyone who has used EF over the years!

ajcvickers Arthur Vickers AndriySvyryd Andriy Svyryd Brice Lambson JeremyLikness Jeremy Likness
maumar Maurycy Markowski roji Shay Rojansky smitpatel Smit Patel

Thank you to our contributors!

We are grateful to our amazing community of contributors. Our success is founded upon the shoulders of your efforts and feedback. If you are interested in contributing but not sure how or would like help, please reach out to us! We want to help you succeed. We would like to publicly acknowledge and thank these contributors for investing in the success of EF Core 6.0.

AkinSabriCam alexernest alexpotter10 Ali-YousefiTelori
#1 #1 #1 #1, #2
alireza-rezaee andrejs86 AndrewKitu ardalis
#1 #1 #1 #1
CaringDev carlreid carlreinke cgrevil
#1, #2 #1, #2 #1, #2 #1
cgrimes01 cincuranet dan-giddins dannyjacosta
#1 #1, #2, #3, #4 #1 #1, #2
dennisseders DickBaker ErikEJ fagnercarvalho
#1, #2, #3, #4, #5, #6 #1 #1, #2, #3, #4, #5, #6, #7, #8, #9, #10, #11, #12 #1, #2
FarshanAhamed filipnavara garyng Geoff1900
#1 #1, #2 #1, #2, #3 #1
gfoidl Giorgi GitHubPang gurustron
#1, #2 #1, #2, #3, #4 #1 #1
hez2010 HSchwichtenberg jaliyaudagedara jantlee
#1, #2 #1 #1, #2 #1
jeremycook jing8956 joakimriedel joaopgrassi
#1 #1 #1, #2 #1, #2
josemiltonsampaio KaloyanIT khalidabuhakmeh khellang
#1 #1, #2, #3, #4 #1, #2 #1
koenbeuk kotpal larsholm lauxjpn
#1 #1 #1, #2 #1, #2
leonardoporro lexkazakov mariuz marodev
#1 #1 #1 #1, #2
MartinWestminster Marusyk MattKomorcec MaxG117
#1 #1, #2, #3, #4, #5, #6, #7, #8, #9, #10, #11, #12, #13, #14, #15, #16 #1, #2 #1
mefateah meggima mguinness michalczerwinski
#1 #1, #2 #1 #1, #2, #3, #4, #5, #6
mrlife msawczyn MSDN-WhiteKnight natashanikolic
#1, #2, #3, #4 #1 #1 #1
nmichels nschonni OKTAYKIR OOberoi
#1, #2 #1, #2, #3, #4 #1 #1
Oxyrus pkellner ptupitsyn ralmsdeveloper
#1 #1 #1 #1, #2
RaymondHuy riscie SergerGood Shirasho
#1, #2, #3, #4, #5, #6, #7, #8 #1, #2 #1, #2, #3, #4, #5, #6, #7, #8, #9, #10 #1
SimonCropp stevendarby Strepto teo-tsirpanis
#1, #2 #1, #2 #1, #2 #1
the-wazz tkp1n Tomkaa umitkavala
#1, #2 #1, #2 #1, #2 #1, #2, #3, #4
uncheckederror Varorbc vincent1405 vonzshik
#1 #1 #1, #2 #1, #2, #3, #4
vytotas wdesgardin wmeints yesmey
#1 #1, #2 #1, #2 #1, #2, #3, #4, #5, #6

The post Announcing Entity Framework Core 6.0 Preview 5: Compiled Models appeared first on .NET Blog.



source https://devblogs.microsoft.com/dotnet/announcing-entity-framework-core-6-0-preview-5-compiled-models/

Share this post

Search This Blog

What's New

The "AI is going to replace devs" hype is over – 22-year dev veteran Jason Lengstorf [Podcast #201]

Image
Curriculum for the course The "AI is going to replace devs" hype is over – 22-year dev veteran Jason Lengstorf [Podcast #201] Today Quincy Larson interviews Jason Lengstorf. He's a college dropout who taught himself programming while building websites for his emo band. 22 years later he's worked as a developer at IBM, Netlify, run his own dev consultancy, and he now runs CodeTV making reality TV shows for developers. We talk about: - How many CEOs over-estimated the impact of AI coding tools and laid off too many devs, whom they're now trying to rehire - Why the developer job market has already rebounded a bit, but will never be the same - Tips for how to land roles in the post-LLM résumé spam job search era - How devs are working to rebuild the fabric of the community through in-person community events Support for this podcast is provided by a grant from AlgoMonster. AlgoMonster is a platform that teaches data structure and algorithm patterns in a structure...

Labels

Programming Video Tutorials Coursera Video Tutorials Plurasight Programming Tutorials Udemy Tutorial C# Microsoft .Net Dot Net Udemy Tutorial, Plurasight Programming Tutorials, Coursera Video Tutorials, Programming Video Tutorials Asp.Net Core Asp.Net Programming AWS Azure GCP How To WordPress Migration C sharp AWS Project Git Commands FREE AWS Tutorial OldNewThings Git Tutorial Azure vs AWS vs GCP New in .Net javascript AI Google I/O 2025 Wordpress jquery Generative Video Git Git Squash Google Flow AI PHP SQL Veo 3 squash commit CSS Cloud Services React Tutorial With Live Project Source Code git rebase CPR Nummer Dropdown Reset Javascript Figma Figma Beginner Tutorial Geolocation Non-Programmer Content Python Free Course Think Simply Awesome Tutorial UI UX Live Project UI/UX Full Course Wireframing dotnet core runtime error html API Gateway AWS EKS vs Azure AKS All in one WP stuck C++ C++ Coroutines CPR Denmark ChatGPT Cloud Database Cloud DevOps Cloud Security Cloud Storage Contact Form 7 Dropdown Unselect Javascript E commerce Free AWS Terraform Project Training Git Commit Google Drive Files Google Drive Tips Http Error 500.30 Http Error 500.31 Interview Questions Learn Courutines C++ Microservices for Live Streaming PII Denmark Pub Sub SQL Server SSIS Terraform Course Free Terraform Tutorial Free USA E commerce strategies UpdraftPlus UpdraftPlus Manual Restore Website Optimization Strategies dropdown javascript select drop down javascript smarttube apk error 403 smarttube next 403 Error 413 Error 503 504 524 AI & ML AI Assistants AI Course CS50 AI in daily life AWS API Gateway AWS EBS AWS EC2 vs Azure VMs vs GCP Compute Engine AWS EFS AWS IAM AWS Lamda AWS RDS vs Azure SQL AWS Redshift AWS S3 AZ-104 AZ-104 Free Course AZ-104 Full Course AZ-104 Pass the exam Abstract Class C# Abstract Method Ajax Calender Control Ajax Control Toolkit All In One Extension Compatibility All In One WP Freeze All In One WP Migration All in one WP All-in-One WP Migration Android 15 Android TV Applying Theme html Asp.net core runtime Error Audio Auto Complete Azure AD Azure APIM Azure Administrator Certification Azure Blob Storage Azure Data Lake Azure Files Azure Function Azure Managed Disk Azure Synapse Base Class Child Class Best Grocery Price Big Data BigBasket vs Grofers Bing Homepage Quiz Blogger Import Blogger Post Import Blogger XML Import Bluetooth Connectivity Browser Detail Building Real-Time Web Applications Bulk Insert CI/CD CPR Address Update CPR Generator CPR Generator Denmark CS50 AI Course CS50 AI Python Course CS50 Artificial Intelligence Full Course CVR Centrale Virksomhedsregister Change Workspace TFS ChatGPT Essay Guide ChatGPT Usage ChatGPT vs Humans Cloud API Management Cloud CDN Cloud Computing Cloud Data Warehouse Cloud Event Streaming Cloud IAM Cloud Messaging Queue Cloud Monitoring and Logging Cloud Networking CloudFront Cloudflare Cloudwatch Compute Services Connect a Bluetooth Device to my PC site:microsoft.com Containers ControlService FAILED 1062 Corona Lockdown MP CosmosDB Covid19 Covid19 Bhopal Covid19 Home Delivery MP Covid19 Indore Covid19 Susner Covid19 Ujjain Cypress Javascript Cypress Javascript framework Cypress Javascript testing Cypress Javascript tutorial Cypress Javascript vs typescript DNS Danish CVR Data Analytics Data Analytics Course Free Data Engineering Data Structure Full Course Data Visualization Database Database Diagram Visualizer Davek Na Dodano Vrednost Dbdiagram export seeder Deep Learning Course Denmark Numbers Det Centrale Personregister Det Centrale Virksomhedsregister DevOps Device Compatibility Dictionary Dictionary in C# Digital Economy Disaster Recovery for Web Applications Disaster-Proof Infrastructure Dmart Frenchise Dmart Home Delibery Dmart Mumbai Address Dmart Pickup Points Doodle Jump Drive Images On Blog Drive Images On Website Driver Problems DropDown Dropbox Dropdown jquery DynamoDB ETL ETL Package Ecommerce Store using AWS & React Embed Drive Images Escape Sequences in c#.Net Event Hub Explicit Join Extract Facebook App Fake CVR Denmark Fake DDV Slovenia Fake VAT Number Fake Virk Number Faker Feature Toggle Find CPR Information Find a Word on Website Firestore Flappy Bird Game Form Selectors using jQuery Free React Portfolio Template FreeCodeCamp Frontend Best Practices for Millions of Users Full Text Index View G Drive Hosting GAN certification course GCP Cloud Data Lake GCP Filestore GCP Functions GCP IAM GCP Persistent Disk Gemini Git Checkout Google Adsense Setting Google Beam Google BigQuery Google Conversion Tracking Google Docs Advanced Tutorial Google Drive Clone Google Drive Clone Bot Google Drive Clone HTML CSS Google Drive Clone PHP Google Drive Clone React Google Drive Clone Tutorial Google Drive Clone VueJS Google Drive File Sharing Google Drive Images Google Drive Sharing Permissions Grocery Price Compare Online Grocery in Corona Grocery in Covid19 Grofers vs DMart vs Big basket HAXM installation HTML Storage HTML to PDF Javascript HTML2Canvas HTML5 HTML5 Append Data HTML5 Audio HTML5 Data Storage HTML5 Storage HTML5 Video Harvard University AI Course Header Sent Height Jquery High Availability in Live Streaming Platforms High-Concurrency Frontend Design High-Concurrency Web Applications How to Search for a Word on Mac Html2Canvas Black Background issue Http Error 413 Http Error 500.35 IIS INNER Join Image Gallery Blogger Image Gallery Blogger Picasa Image Gallery Blogger Template Image Gallery Blogger Template Free Implicit Join Indexing in SQL Instagram Clone React Instagram Clone Script Install NodeJS Ubuntu Internet Infrastructure Interview IoT IoT Core IoT Hub JS Game Tutorial Java Feature Toggle Javascript game tutorial JioCinema Case Study Keep Me Login Key Management Kinesis Learn Scrappy with a live project List Live Streaming Data Delivery Live Streaming Performance Optimization Load Load Balancer Looping Dictionary MTech First Semester Syllabus MTech Syllabus MVC Mac Mac Finder Shortcut Media Controller Media Group Attribute Microservices Architecture for Scalability Missing MySQL Extension Mobile Optimization Multiple Audio Sync Multiple Video Sync Mumbai Dmart List MySQL MySQL ERD Generator Next.js Beginner Tutorial Ngnix NodeJS NodeJS Ubuntu Commands Numpy OOPS Concepts OOPS in C# Object Oriented Programming Object Storage Outer Join PHP Installation Error PHP WordPress Installation Error Pandas Personligt identifikations nummer Pipedrive Pipedrive Quickbooks Integration Portfolio Website using React Project Astra PyTorch Quickbooks Quote Generator RGPV Syllabus Download Random SSN Generator ReCaptcha Dumbass React Feature Toggle Real-Time Video Processing Architecture Real-Time Video Processing Backend RegExp Regular Expression Reinstall Bluetooth Drivers Remember Me Remove NodeJS Ubuntu Renew DHCP Lease Reset IP Address Linux Reset IP Address Mac Reset IP Address Windows Reset Remote Connection Reset Remote Connection Failure Resize Textarea Restore Errors Restore Failed UpdraftPlus Route 53 SOS Phone SQL Indexed Tables SQL Joins SQL Seed generator SQS SSIS Package SSIS Tutorial SSN Generator for Paypal SSN Number SSN Number Generator SSN Validator Safari 8 Safari Video Delay SageMaker Scalable Backend for High Concurrency Scalable Cloud Infrastructure for Live Streaming Scalable Frontend Architectures Scalable Live Streaming Architecture Scrapy course for beginners Search A word Search for a Word in Google Docs Secret Management Serverless Service Bus Slovenian VAT Generator SmartTube Software Architect Interview Questions Software Architect Mock Interview Sparse Checkout Spotlight Mac Shortcut Stored Procedure Subtree Merge T-Mobile IMEI Check TFS TMobile IMEI check unlock Team Foundation Server Terraform Associate Certification Training Free Text Search Text color Textarea Resize Jquery Theme Top WordPress Plugins Transform Trim javascript Troubleshooting TypeScript Beginner Tutorial Ubuntu Unleash Feature Toggle Update Computer Name UpdraftPlus 500 UpdraftPlus Backup Restore UpdraftPlus Error 500 UpdraftPlus Error 504 UpdraftPlus Error 524 UpdraftPlus HTTP Error UpdraftPlus New Domain UpdraftPlus Restore Not Working UpdraftPlus Troubleshooting Upstream Reset Error Use Google Drive Images VAT Number Generator Verizon imei check Verizon imei check paid off Verizon imei check unlock Verizon imei check\ Version Control Vertex AI Video View Indexing SQL Views in SQL Virksomhedsregister Virtual friends Visual Studio 2013 WHERE Clause WHPX expo Web Security Web scraping full course with project Web3 What is Feature Toggle WordPress Backup Troubleshooting WordPress Backup UpdraftPlus WordPress Database Backup WordPress Error 503 WordPress Installation Error WordPress Migration UpdraftPlus Wordpress Restore Workspaces Commands Your ip has been banned Zero Click angle between two points bing homepage quiz answers bing homepage quiz answers today bing homepage quiz not working bing homepage quiz reddit bing homepage quiz today byod Verizon imei check chatgpt essay example chatgpt essay writer chatgpt essay writing check tmobile imei contact form 7 captcha contact form 7 captcha plugin contact form 7 recaptcha v3 cpr-nummer engelsk cpr-nummer liste cpr-nummer register cpr-nummer tjek dbdiagram dom load in javascript dotnet core hosting bundle dotnet failed to load dotnet runtime error get url in php how to search for a word on a page how to search for a word on a page windows ipconfig release is cypress javascript istio transport failure jQuery AutoComplete jQuery Input Selector jQuery Menu jQuery Options joins in mySql jquery selector jquery selectors jsPDF jsPDF images missing key key-value keypress event in jQuery kubernetes upstream error localStorage metro by t-mobile imei check nemid cpr-nummer react native expo setup react native on Windows react native setup recaptcha v3 contact form 7 recaptcha wordpress contact form 7 reset connection failure resize control jQuery response code 403 smarttube round number in javascript select sessionStorage smarttube 403 エラー smarttube apk smarttube beta smarttube download smarttube reddit smarttube unknown source error 403 smartube sos iphone top right sos on iphone 13 sos only iphone substr substr in javascript tmobile imei tmobile imei check paid off tmobile imei number total by Verizon imei check trim trim jquery turn off sos iphone turn off sos on iphone 11 unknown source error 403 unknown source error response code 403 smarttube upstream connect error url in php view hidden files mac finder zuegQmMdy8M ошибка 403 smarttube
  • ()
  • ()
Show more
an "open and free" initiative. Powered by Blogger.