Updates to ASP.NET Core in.NET 7 Release Candidate 2

No Comments »

On October 11th, 2022, Microsoft released.NET 7 Release Candidate 2. It is supported in production as the last release candidate (RC) for.NET 7.

Visual Studio 17.4 Preview 3 has been used to test.NET 7 Release Candidate 2. If you want to test out.NET 7 with products from the Visual Studio family, we advise using the preview channel builds. We advise using the most recent Visual Studio 2022 for Mac preview if you use macOS.

We want to highlight the key concepts of .NET 7 in this post and give you resources to delve further into the specifics. For a more thorough list of each enhancement and feature added to .NET 7 Release Candidate 2 you can check the previous posts from .NET’s official website.

C# 11

The most recent version of C#, C# 11, is now accessible in.NET 7.

They openly create and develop C#. To view the most recent C# feature requests and meeting notes, connect to them on the CSharpLang repository. As soon as work is scheduled, you can check the Feature Status page to see how things are going. Create a C# project and set the LangVersion property to Preview to experiment with the C# 11 preview features.

Libraries & SDK

The.NET libraries are always getting better. New APIs with completely new features are frequently added. Existing APIs are receiving performance upgrades, which will benefit you if you simply upgrade. New libraries are being created to help you with your daily tasks. Every new version of.NET brings a wealth of enhancements to the.NET SDK, which contains the essential tools for designing, developing, and maintaining.NET projects. Numerous improvements were already present in earlier preview. To read more about new SDK features, see the following:

Re-enable Reflection Fallback For System.Text.Json source generation

.NET 7 introduced an intentional breaking change which removes silent fallback to reflection-based serialization in System. generators for Text.Json sources. Early customer feedback indicates that a significant number of users have (mostly unintentionally) come to depend on the fallback behavior.

Despite the fact that a workaround for the breaking change has been documented, it still calls for a code change, which may not always be possible. Starting with.NET 7 RC 2, you can use the provided AppContext compatibility switch to globally re-enable reflection fallback. To enable reflection fallback once more for all source-generated contexts in your app, add the following entry to the project file for your application:

<ItemGroup>
  <RuntimeHostConfigurationOption Include="System.Text.Json.Serialization.EnableSourceGenReflectionFallback" Value="true" />
</ItemGroup>

See the post on .NET runtime configuration settings for more details on using AppContext switches.

Implementation of Generic Math interfaces correctly

The.NET runtime ensures that user code correctly implements the.NET Generic Math interfaces that use the Curiously Recurring Template Pattern (CRTP). It specifically issues a warning if a type that implements the CRTP pattern and the.NET Generic Math interfaces fails to fill the generic type parameter with the type itself.

For example:

public readonly struct DateOnly : IParsable<DateOnly> // correct implementation of IParsable<TSelf> interface
{ ... }
public readonly struct MyDate : IParsable<DateOnly> // Warns: "The 'IParsable<TSelf>' requires the 'TSelf' type parameter to be filled with the derived type 'MyDate' " the type parameter TSelf
{ ... }

Some built in operators added in .NET 7 for System. System and IntPtr. In.NET 6 and earlier, UIntPtr behave differently from user-defined operators. Some operators that used to throw when the context was unchecked while overflowing are now only allowed to do so when wrapped in checked context, and some operators that did not previously throw in checked context are now only allowed to throw when the context is unchecked. The analyzer alerts it when it finds the code that might be responsible for those behavioral changes.

For example:

checked
{
    intPtr2 = intPtr1 + 2; // Warns: "Starting with .NET 7 the operator '+' will throw when overflowing in a checked context. Wrap the expression with an 'unchecked' statement to restore the .NET 6 behavior."

    intPtr2 = intPtr1 - 2; // Warns: "Starting with .NET 7 the operator '-' will throw when overflowing in a checked context. Wrap the expression with an 'unchecked' statement to restore the .NET 6 behavior."

    void* ptr = (void*)intPtr1; // Warns: "Starting with .NET 7 the explicit conversion '(void*)IntPtr' will throw when overflowing in a checked context. Wrap the expression with an 'unchecked' statement to restore the .NET 6 behavior."

    intPtr2 = (IntPtr)ptr; // Warns: "Starting with .NET 7 the explicit conversion '(IntPtr)void*' will throw when overflowing in a checked context. Wrap the expression with an 'unchecked' statement to restore the .NET 6 behavior."
}

intPtr1 = (IntPtr)longValue; // Warns: "Starting with .NET 7 the explicit conversion '(IntPtr)Int64' will not throw when overflowing in an unchecked context. Wrap the expression with a 'checked' statement to restore the .NET 6 behavior."

int a = (int)intPtr1; // Warns: "Starting with .NET 7 the explicit conversion '(Int32)IntPtr' will not throw when overflowing in an unchecked context. Wrap the expression with a 'checked' statement to restore the .NET 6 behavior."

Support

The release of.NET 7 is covered by Standard Support. There is no change to the support duration despite the fact that this is the new name for what was previously known as Current. The Standard Support period for.NET releases with odd numbers is 18 months. The 36-month length of Long-Term Support (LTS), as well as its name, have not changed. For more information, see our.NET and.NET Core Support Lifecycle document.

Wrapping Up

.NET is loved for it’s simplicity of C# cause everything can be completed quickly and easily (in C#, everyone who can program can program). Similarly, the Jit itself is intuitive in the way it applies compiler techniques. Finally, a shoutout to SuperPMI.

Releases of .NET include products, libraries, runtime, and tooling, and represent a collaboration across multiple teams inside and outside Microsoft. Give .NET 7 Release Candidate 2 a try and tell us what you think!

Amazon RDS vs Azure SQL: Key Differences

No Comments »

The world of database management has undergone a significant change as a result of multinational corporations switching to cloud-managed databases. However, it can be difficult to meet the needs of the modern world, particularly for on-premise deployments. In contrast, managed cloud databases are relational database services that are scalable and created for the cloud.

Microsoft Azure and Amazon AWS are both great choices for deploying MS SQL Server databases. The dawn of a new era has indeed been heralded by these databases. Prior to selecting an Amazon AWS or Azure migration, it is crucial to compare features, benefits, and limitations. In this article, we’ll examine these well-known databases and offer advice on which one would be best for your company.

Which one is Better?

Cloud computing enables businesses to increase innovation, reduce capital expenditures, increase scalability, and improve teamwork. Naturally, businesses that are unprepared for these changes risk falling behind. The most reputable cloud competitors competing for a bigger share of the cloud pie are AWS and Azure.

Starting with how they present their SQL Server database services, the two cloud service goliaths have a glaringly different service philosophy. Microsoft makes use of the binaries from SQL Server 2019, the most recent iteration. It guarantees that your application always uses the most recent binaries. In contrast, Amazon provides a versioning model that is largely fixed and allows you to select the version you want to use. The following are the main distinctions between Azure SQL and Amazon RDS:

Platform

The cloud-based database products from Microsoft are created with the cloud in mind. For instance, Azure SQL is a service that runs natively on the Microsoft cloud infrastructure.

Although it does not run natively on the cloud platform, Amazon RDS is cloud-capable. Therefore, the majority of MySQL applications should function normally in Amazon RDS.

Performance

As Azure SQL is tier-based, each level is divided into performance tiers ranked by Microsoft’s Database Transaction Units and tailored to a variety of workloads. In order to ensure maximum utilization, Microsoft customers can address workload fluctuations through hosted databases.

Database instances are allotted in Amazon RDS to determine resource allocation. To easily distinguish costs, you must pay for computing and storage separately. Furthermore, Amazon RDS improves query performance.

Features

A versatile, reliable, user-friendly, and stable solution is Amazon RDS. Users can choose as many tools, zones, regions, and replicas as necessary. Users prefer Microsoft products’ enhanced GUI and better integration. However, they think Microsoft can make a lot of security features better.

Users of Microsoft Azure appreciate how easily the platform integrates with on-premises SQL Server, the darknet stack, and table groups. The solution provides simple firewall settings and a very user-friendly interface. Additionally, there are a lot of on-premises features that the cloud might not provide.

Target Market

Microsoft Azure primarily targets enterprise apps with databases that are 5 GB or smaller. Although Azure SQL appears to be limited, there are more details than just the targeted clients.

Amazon RDS, on the other hand, targets a wider user base and provides a high level of flexibility. Per database instance, up to 1 TB of storage is permitted.

Deployment

The biggest difference between Azure SQL and Amazon RDS occurs at this point. Database servers for Azure SQL are not virtual. Instead, they are logical containers that are tailored to the needs of the customer. Additionally, Azure SQL is multi-tenant and does not support specific server-level customization.

Azure focuses on cloud performance rather than hardware in order to fully utilize the intended benefits of cloud computing. Microsoft’s emphasis on only charging for what a customer needs is a good thing. Amazon RDS, on the other hand, offers relational database services using EC2 instances.

RDS is able to allocate resources to databases while provisioning storage space separately thanks to this design. RDS’s factor costs are different from Azure SQL’s because storage is charged separately from computing. The RDS standard level offers storage of up to 6 TB.

Cost

When compared to Amazon RDS, Azure SQL is much more affordable because its databases can be automatically replicated across a variety of systems, providing read scale-outs and a transparent fail-over mechanism in case of hardware failure. However, Amazon RDS has turned off replication on all of its MySQL instances.

As a result, SQL Azure doesn’t provide a substitute for Amazon RDS’s distinctive on-demand snapshot-based backup approach. Instead, when a disaster strikes, data in SQL Azure is automatically backed up and restored. Once more, the user is unaware of this, which contributes to the feature’s high availability.

Scaling

With a storage limit of just 10 GB per database, Microsoft Azure SQL is both highly scalable and cost-effective. As a result, it eliminates the chance that a single overburdened database server will cause performance problems. Additionally, Microsoft’s concept of the shared database has improved performance and scalability with the most recent addition of elastic pools.

Computing and storage fees are charged separately by Amazon RDS. As a result, expanding a database’s size on the Amazon platform is simple. Additionally, the growth of an RDS single database is made simple by Aurora’s ease of automatic scalability as a database product.

Additionally, Amazon RDS supports read-only horizontal scaling, which enables you to add replicas to improve query performance. The Elastic Database tools, on the other hand, are used by Azure SQL to orchestrate a sharding strategy.

Wrapping Up

Azure SQL and Amazon RDS are in fierce competition to provide the best customer experience. A more server-oriented model with robust backward compatibility for apps is offered by Amazon RDS. How you choose between Amazon RDS and Azure SQL largely depends on the kind of technology you already employ. On the other hand, Amazon RDS works best for you if you have a LAMP stack.

Consider the benefits of moving your database to the cloud if you’re still unsure which option to choose. But once more, it depends on your budget, flexibility, and tech preferences. So, when selecting a database system for your business, keep these things in mind.

ASP.NET Authentication: Overview

No Comments »

.NET is a developer platform made up of tools, programming languages, and libraries for building many different types of applications. The base platform provides components that apply to all different types of apps. Additional frameworks, such as ASP.NET, extend .NET with components for building specific types of apps.

ASP.NET is an open source web framework, created by Microsoft, for building modern web apps and services with .NET. ASP.NET is cross platform and runs on Windows, Linux, macOS, and Docker. The server-side web application framework ASP.NET, also known as Active Server Pages Network Enabled Technologies, is free to use. It is intended for use in web development to create interactive websites, programs, and services. Let’s take a closer look at ASP.Net Authentication.

What Is ASP.NET Authentication?

Microsoft’s ASP.NET is an open source framework for creating contemporary web sites, services, and applications. It is supported by Linux, macOS, Windows, and Docker. IAuthenticationService is the foundation of the ASP.NET authentication framework. The service can authenticate users in ASP.NET applications thanks to registered authentication handlers.

ASP.NET Authentication Concepts

Authentication Schemes

A scheme for authentication identifies the authentication handler in charge of generating the appropriate set of claims. The names of authentication handlers and the particular configuration settings for each handler’s instance are known as authentication schemes. Schemes can be used to discuss authentication and challenge or forbid associated handler behavior.

Authentication Handler

The actions of an authentication scheme are carried out by authentication handlers. From AuthenticationHandler <TOptions> or IAuthenticationHandler, handlers can be derived. Authenticating users is its main objective. The associated authentication scheme’s configuration and the context of incoming requests will influence how the authentication handler responds.

The handler creates an AuthenticationTicket object, which represents a user’s identity, if the authentication is successful. A “failure” or “no result” is returned if the authentication fails. The handler offers ways to thwart or oppose actions taken by a user. Unauthorized users will be denied access, while unauthenticated users will be presented with a challenge.

Authentication Challenge

When unauthenticated users try to access a resource that needs authentication, the authorization system takes an additional precaution known as authentication challenges. For instance, if an anonymous user clicks on a login link or requests access to a restricted resource, the IAuthenticationService may issue a challenge. The challenge is issued by the authorization system using a default authentication scheme (or a specified scheme if one exists).

Forbid Action

If authenticated users attempt to access resources without the required permissions, the authorization system triggers the ‘forbid’ action for authentication schemes. Users are informed by forbidden actions when they have been authenticated but are denied access to a resource. The following situations, for instance, may result in the system forbidding authentication:

  • An access-restricted page is redirected to by a cookie authentication scheme.
  • A 403 (forbidden) error is returned by a JWT bearer scheme.
  • A page where users can request access to a protected resource is the destination of an authentication scheme.

ASP.NET Core Identity

An API that supports UI login features is called Core Identity. You can manage a variety of user data elements with it, such as user profiles, passwords, roles, tokens, and claims. Users can create accounts using the login information from ASP.NET Core Identity. A supported external login provider, such as Google, Facebook, Twitter, or Microsoft accounts, can also be used to create accounts.

The SQL Server database that houses usernames, profile information, and passwords is typically used to configure Identity. A different persistent store, like Azure Table Storage, is also an option.

Providers of authentication for each tenant

There is no integrated method for multi-tenant authentication in ASP.NET Core. We advise customers to think about Orchard Core or ABP Framework for multi-tenant authentication even though they are able to create one using the built-in features.

Orchard Core is an ASP.NET Core-based multi-tenant, open-source, and modular app framework and an app framework with a content management system (CMS) added on top. ABP Framework supports various architectural patterns including modularity, microservices, domain driven design, and multi-tenancy. See ABP Framework source on GitHub.

ASP.NET Multi-Factor Authentication

During a sign-in event, multi-factor authentication (MFA) asks the user for multiple forms of identification. Passwords are frequently used as the first identification factor, and a fingerprint scan, a FIDO2 key, or a verification code sent to the user’s phone can be used as the second factor. Adding MFA as a requirement for an application greatly increases the security of authentication.

Using ASP.NET Core Identity offers native support for 2FA (2-factor authentication). Set the IdentityUserTKey> to enable or disable 2FA for a specific user. Property TwoFactorEnabled. When utilizing ASP.NET Core Identity, cMFA with the Time-based One-Time Password (TOTP) algorithm is additionally natively supported. This approach is compatible with authenticator programs like the Google Authenticator and the Microsoft Authenticator.

Users accessing sensitive pages in an ASP.NET Core Identity application can be forced to use MFA. This is beneficial for programs with various levels of access for various identities. Users can log in using their password, for instance, to view profile information, but administrators need MFA to access admin pages.

Wrapping Up

Finding a user’s identity is the first step in user authentication. We take this action to make sure they are who they claim to be. Once we are confident in our ability to trust them, we can log them into our app and give them access to resources that are intended for logged-in users only. Now that you know how to authenticate and log in a user to an ASP.NET application, hopefully you are off to a good start.

Getting Started With .NET MAUI

No Comments »

MAUI has officially been released! With C# & XAML, we can now construct Native Mobile and Desktop applications. Yes, now we can create native Android, iOS, macOS, and Windows applications from a single code base. This is possible by using .NET’s new feature called Multi-platform App UI (MAUI). This is a cross-platform framework called .NET MAUI. MAUI, which stands for Multiple-Platform Application UI, allows us to create applications from a same code base for Android, iOS, Windows, and macOS. In addition, this implies that we can export apps to several platforms from a single project.

What is MAUI?

Multi-Platform App UI, or MAUI, is a free and open-source cross-platform framework. We can create native Android, iOS, macOS, Mac Catalyst, Tizen, and Windows applications using MAUI by using a single code base for all of these platforms.

The successor to Xamarin is the open-source .NET MAUI. Forms with UI controls rebuilt from the ground up for performance and extensibility, extending from mobile to desktop scenarios. You’ll see many similarities between .NET MAUI and Xamarin.Forms if you’ve previously used those tools to create cross-platform user interfaces. There are some differences, though. If necessary, you can add platform-specific source code and resources when developing multi-platform apps with.NET MAUI. The ability to implement as much of your app logic and UI layout in a single code base is one of the main goals of.NET MAUI.

The development of Xamarin.Forms from mobile to desktop applications led to MAUI. If you have experience with Xamarin.Forms, you will have no trouble understanding.NET MAUI.

The .NET MAUI is for such

  • Developers who want to create cross-platform applications using C# and XAML from a single code base.
  • Sharing the same UI layouts and designs across platforms, which reduces the time needed for design implementation.
  • To use the same business logic, code, and testing across all platforms.

Install Visual Studio 2022 Preview

Only the Visual Studio 2022 Preview offers .NET MAUI right now. Obtain the Visual Studio 2022 Preview by clicking here.

Select .NET Multi-platform App UI Development Workload from the list below once it has been downloaded and installed.

It’s best to restart the computer after a successful installation before starting Visual Studio 2022 Preview.

Making the first.NET MAUI application in the preview of Visual Studio 2022

At first, launch the Visual Studio 2022 Preview and Choose to create a new Project and search for MAUI.

.NET MAUI has three categories, .NET MAUI App, .NET MAUI Blazor App, .NET MAUI Class Library.

In upcoming articles, we’ll examine each category in greater detail. The.NET MAUI App currently allows us to create applications from a single code base for Windows, Android, iOS, Mac Catalyst, MAUI, and Tizen.

.NET MAUI Blazor App – These applications are created using Blazor and can run on iOS, Android, Mac Catalyst, Tizen, and WinUI from a single source of code.

Applications can be run on Android, iOS, Mac Catalyst, macOS, Tizen, and Windows thanks to the .NET MAUI Class Library, which was used in their development.

Let’s create our first .NET MAUI App.

Choose to .NET MAUI App from the Project Template options and click Next.

.NET MAUI

Save it in the location by providing the project name.

.NET MAUI

.NET MAUI App uses XAML and is similar to WPF.

.NET MAUI

.NET MAUI Blazor

Now you may ask what is .NET Blazor?

It’s a feature of ASP.NET, the well-known web development framework, is called Blazor. It adds tools and libraries for creating web apps to the.NET developer platform.

Instead of using JavaScript, Blazor enables you to create interactive web user interfaces. Reusable web UI components are implemented in Blazor apps using C#, HTML, and CSS. Because C# is used for both client and server code, you can share code and libraries.

Using WebAssembly, Blazor can execute your client-side C# code right in the browser. You are able to reuse the code and libraries from the server-side components of your application because real.NET is running on WebAssembly.

You could also have Blazor execute your client logic on the server. Using SignalR, a real-time messaging framework, client UI events are returned to the server. The necessary UI changes are sent to the client and merged into the DOM once execution is finished.

In today’s discussion let’s use blazor to export multiple platforms

Using Blazor, we can easily export applications for Multiple Platforms.

Choose .NET MAUI Blazor from the Project Template while creating a new project and save it.

The default project folder structure is shown in the image below. It will be very simple for you to do this if you are already familiar with Blazor.

Similar options for exporting the application to various platforms are available for this project as they are for the.NET MAUI App. Let’s test the program on various platforms.

This project also has similar options to the .NET MAUI App to export the application to Mac, android or iOS platforms. But we will cover that in another article.

Conclusion

This article covered the creation of .NET MAUI applications and how to debug them across various platforms. The debugging for Windows devices, and procedure to create application in Mac, android and iOS devices have not been covered; they will be in subsequent articles later. But we hope that this article will help you to go through with everything related to MAUI if you are new here. Please feel free to share your feedback with us.

How to Use a Priority Queue in .NET version 6

No Comments »

A data structure that operates on a first in, first out (FIFO) principle is a queue. Items are added to the back of the line and taken out of the front. The actions of adding data to the queue are referred to as “enqueue,” while removing data from the queue is referred to as “dequeue.”

A priority queue is a queue type where the items are organized according to the priority values you give them. In.NET 6, support for a priority queue was first made available. The PriorityQueue class in.NET 6 and how to use it in our.NET 6 applications are covered in this article.

You need Visual Studio 2022 installed on your computer in order to work with the code examples provided in this tutorial. Download Visual Studio 2022 here if you don’t already have it.

Create a console application project in Visual Studio

Let’s start by opening Visual Studio and creating a.NET Core Console Application project. To build a new.NET Core Console Application project in Visual Studio, follow the instructions listed below, assuming Visual Studio 2022 is already installed on your computer.

  1. Launch the Visual Studio IDE.
  2. Click on “Create new project.”
  3. In the “Create new project” window, select “Console App (.NET Core)” from the list of templates displayed.
  4. Click Next.
  5. In the “Configure your new project” window shown next, specify the name and location for the new project.
  6. Click Create.

In the sections that follow, we’ll use this project to demonstrate how to work with a priority queue.

Create a priority queue in .NET 6

In.NET 6, a queue is typically a FIFO data structure, where items are added to the back and taken away from the front. In.NET 6, there is a special kind of queue called a priority queue that arranges the items according to the priority values you give them.

Using the constructor of the PriorityQueue class, as shown below, you can create an instance of the class.

The Enqueue() method can be used to add items to a PriorityQueue after it has already been created. Two parameters are accepted by the Enqueue method: the element to be added as a string and the element’s priority as an integer.

Keep in mind that items in a priority queue are arranged according to priority values, descending. As a result, the item with the highest priority (for example, 9) is placed at the back of the queue, and the item with the lowest priority (for example, 0) is placed at the front. The item with the lowest priority value is thus removed by a dequeue.

The Enqueue method is used to add items to a priority queue, as demonstrated by the following snippet of code.

PriorityQueue<string, int> priorityQueue = new PriorityQueue<string, int>();
priorityQueue.Enqueue("Item A", 4);
priorityQueue.Enqueue("Item B", 3);
priorityQueue.Enqueue("Item C", 2);
priorityQueue.Enqueue("Item D", 6);
priorityQueue.Enqueue("Item E", 7);
priorityQueue.Enqueue("Item F", 5);
priorityQueue.Enqueue("Item G", 0);
priorityQueue.Enqueue("Item H", 9);
priorityQueue.Enqueue("Item I", 1);
priorityQueue.Enqueue("Item J", 8);

Retrieve elements from a priority queue in .NET 6

There are two ways to get items out of a PriorityQueue. The Dequeue() method, which returns the queue item with the lowest priority value, is one choice. The Peek() method, which returns the item with the lowest priority value without removing it from the queue, is the alternate choice.

The TryDequeue and TryPeek methods, which handle exceptions internally, are improved versions of the Dequeue and Peek methods. If an item has been successfully removed from the queue, they return true; if not, they return false.

The next piece of code shows you how to display each item’s priority at the console window and remove items from the priority queue.

while (priorityQueue.TryDequeue(out string queueItem, out int priority))
{
 	Console.WriteLine($"Item : {queueItem}. Priority : {priority}");
}

Count the elements in a priority queue in .NET 6

To find out how many items are currently in the priority queue, use the following snippet of code.

int ctr = priorityQueue.Count;
Console.WriteLine($"No of items remaining in the priority queue : {ctr}");

The priority queue will have no available items if you add these lines of code as shown below after the while statement in our program. This is so because each time the TryDequeue method is called, a component of the priority queue is eliminated.

while (priorityQueue.TryDequeue(out string queueItem, out int priority))
{
	Console.WriteLine($"Item : {queueItem}. Priority : {priority}");
}
int ctr = priorityQueue.Count;
Console.WriteLine($"No of items remaining in the priority queue : {ctr}");

If you run our program with the code above, it will display the items of the priority queue and their priority values. Lastly, it will print a value 0, which denotes the total number of elements remaining in the priority queue at the end.

The IComparer interface is used by a priority queue in.NET 6 to determine the priority of the elements stored there. To determine the priorities of elements in a priority queue, you can create your own implementation of the IComparer interface. In a later post here, I’ll go into more detail about this.

A PriorityQueue instance is not thread-safe, it should be noted. To prevent race conditions, you should write your own custom code to handle thread safety. Operating systems frequently use priority queues for load balancing, thread scheduling, and interrupt management. An operating system will keep track of threads in a priority queue and schedule or preempt them as necessary.

Dev Box, A Cloud-Based IDE Service for Developers

No Comments »

Microsoft announced the Microsoft Dev Box during their recent conference. Over the last Construct convention, Microsoft introduced the Microsoft Dev Field. This new cloud service offers builders with safe, coding-ready developer workstations for hybrid groups of all sizes. With the brand new service, the corporate goals to make it simple for builders to shortly entry a pre-configured setting with all of the instruments and assets to jot down code.

Growth organizations can create and maintain Dev Field photographs themselves, with all the developers’ devices and dependencies to assemble and run their functions via way of means of making use of Microsoft Dev Field. As properly as, growth agencies can encompass software deliver codes and binaries which can be generated nightly, allowing developers to run and understand the code right away without being equipped for extended rebuilds. Development teams can consist of their utility supply code and nightly constructed binaries, permitting builders to at once to begin running and expertise the code without looking forward to lengthy re-builds.

It’s no secret that it can often be quite a bit of a process for developers to set up a new physical machine according to their needs. Microsoft argues that with the new Dev Box, IT teams can give newly onboarded developers easy access to a standard development environment without having to configure their own machine. Meanwhile, more senior developers who may be working on different projects — all with their own configurations and conflicting dependencies — can use multiple Dev Boxes to get their work done. And at the same time, IT regains control since the Dev Boxes are integrated with Windows 365 and management tools like Intune and the Microsoft Endpoint Manager.

This is not the first time Microsoft has made virtual development environments available to developers. Earlier this year, the company also launched its Azure Game Development Virtual Machine into preview. The use case here is obviously a bit different, but the idea is pretty much the same. Developers can set up their boxes as needed, with any IDE, SDK or internal tools they need (as long as it runs on Windows) and target any platform their tools support.

The developer workstation is being modified

The dev workstations include an excess of challenges. New developers can spend days putting in a working surroundings and weeks earlier than they make their first commit. Senior developers regularly work throughout a couple of initiatives that may deliver conflicting dependencies and hamper their dev workstation. And we’ve all made an alternate that unexpectedly left us with damaged surroundings. With Microsoft Dev Box, dev groups create and maintain Dev Box pictures with all of the tools and dependencies their devs want to construct and run their applications. Teams can consist of their application source code and nightly constructed binaries, permitting devs to right now begin strolling and expertise the code while not having to watch for lengthy re-builds.

“Developers stay in control of their Dev Boxes with a developer portal that enables them to create and delete their Dev Boxes for any of their projects. Developers can create Dev Boxes to experiment on a proof-of-concept, keep their projects separate, or even parallelize tasks across multiple Dev Boxes to avoid bogging down their primary environment,” Microsoft explains in today’s announcement. “For devs working on legacy apps, they can maintain Dev Boxes for older versions of an application to quickly create an environment that can reproduce and diagnose critical customer issues as they emerge.”

Microsoft Dev Box supports any developer IDE, SDK, or internal tool that runs on Windows. Dev Boxes can target any development workload you can build from a Windows desktop and are particularly well-suited for desktop, mobile, IoT, and gaming. You can even build cross-platform apps using Windows Subsystem for Linux.

Developing Dev Teams

The Dev Box, according to Microsoft, guarantees that developers have the necessary tools and resources at all times, based on project, work, and even role. Dev teams choose from a variety of SKUs when designing Dev Boxes to define the proper level of computation for each project and immediately scale up aging physical hardware. Thanks to Azure Active Directory integration, teams can quickly onboard new team members by assigning them to Azure Active Directory groups that provide them access to the Dev Boxes they require for their projects.

Dev teams ensure remote team members enjoy a high-fidelity experience and gigabit connection speeds wherever they are in the world by putting Dev Boxes in the developer’s local region and connecting over the Azure Global Network. Dev teams can tighten network security while outsourcing to external teams by defining role-based permissions that provide internal developers with more flexibility while limiting access for external contractors.

Security & Management

IT administrators can use Azure Active Directory to put up sophisticated access controls for Dev Box security. For Dev Boxes that access sensitive source code and client data, IT admins can set up conditional access policies that require users to connect through a compliant device, demand multifactor authentication (MFA), or implement risk-based sign-in policies.

Importantly, Microsoft Dev Box isn’t just for developers; because it’s integrated with Windows 365, IT managers can easily manage Dev Boxes alongside Cloud PCs in Microsoft Intune and Microsoft Endpoint Manager. IT admins may send zero-day patches to all devices throughout their enterprise using Intune’s expedited quality updates. If a developer’s Dev Box is hacked, IT administrators can isolate it while assisting the developer in reinstalling the software on a fresh Dev Box.

Conclusion

To keep costs down, developers can obviously spin their machines down at night and start them up in the morning. And to manage those costs across teams, Microsoft will also offer a single view to see all of a team’s boxes.

Microsoft Dev Box is now in private beta and will be released to the general public in the coming months. Visit here to learn more about Microsoft Dev Box and see demos.

Reasons To Choose Azure Over AWS

No Comments »

It’s not too long ago that the conversation around cloud services was, “they’re coming, so get ready.”

Today, clouds are normal, and we use it in our personal lives and in business. In fact, it’s predicted that spending on cloud services will more than double from $229 billion in 2019 to around $500 billion by 2023. Well, there are three major players in the cloud services world: AWS (Amazon Web Services), Google Cloud Platform (Google’s offering) and Microsoft Azure. We will be talking about AWS and Azure only. Although AWS is the public cloud market share leader, Azure is making gains and is the perfect choice for larger organisations already using Microsoft products.

Let’s take a look at some of the reasons why Microsoft Azure is better than AWS. But first let’s see…

What is AZURE?

Microsoft Azure, often referred to as Azure, is a cloud computing service operated by Microsoft for application management via Microsoft-managed data centers. Azure was launched in 2010 and it emerges as one of the biggest commercial cloud service providers. It offers a wide range of integrated cloud services and functionalities such as analytics, computing, networking, database, storage, mobile and web applications that seamlessly integrate with your environment in order to achieve efficiency and scalability.

What is AWS?

Amazon Web Services, Inc. is a subsidiary of Amazon that provides on-demand cloud computing platforms and APIs to individuals, companies, and governments, on a metered pay-as-you-go basis. AWS services are designed in such a way that they work with each other and produce a scalable and efficient outcome. AWS offering services are categorized into 3 types such as Infrastructure as a service (IaaS), software as a service (SaaS) and platform as a service (PaaS). AWS was launched in 2006 and became the best cloud platform among currently available cloud platforms. Cloud platforms offer various advantages such as management overhead reduction, cost minimization, etc.

Key Differences

Value and Cost-effectiveness

Azure is a natural choice for thousands of organisations that are already Microsoft houses. Most enterprise-level companies already use and are familiar with the Microsoft suite, and generally have an Enterprise Agreement in place. When this is the case, Azure offers cost-savings compared to AWS through discounts on licensing for Azure. You can also use your existing Windows Server and SQL Server licences with Software Assurance to pay a reduced rate when moving to Azure. It also allows companies to get more value from their existing Microsoft investment through full integration with Office 365 and Active Directory. For companies moving their Windows Server to the cloud, Microsoft has offers such as extended security updates included in the cost.

AWS follows pay as you go and they charge per hour whereas Azure also follows pay as you go model and they charge per minute which provides more exact pricing model than AWS.

PaaS Capabilities

Both Azure and AWS offer similar IaaS capabilities for virtual machines, networking, and storage. However, Azure provides stronger PaaS capabilities which is an important piece of Cloud infrastructure today.

Microsoft Azure PaaS provides application developers with the environment, tools, and building blocks that they need to rapidly build and deploy new cloud services. It also provides the vital ‘dev-ops’ connections which are important for monitoring, managing, and continually fine tuning those apps. With Azure PaaS, much of the infrastructure management is taken care of behind the scenes by Microsoft. Thus, Azure development allows for a 100% focus on innovation.

Security

From a security perspective, Microsoft is for industry-leading security than the Amazon. They were recognised as a Leader in security. Microsoft’s security is so robust it’s trusted by government bodies as well as enterprises; 95% of fortune 500 companies use Azure. 8 trillion threat signals are analysed by Microsoft every day, with more than $1 billion dollars spent each year on security research and development. Azure also provides more than 90 compliance offerings and is the most trusted cloud by US government agencies.

.Net Compatibility

Azure’s compatibility with the .Net programming language is one of the most useful benefits of Azure, which gives Microsoft a clear upper hand over AWS and the rest of the competitors. Azure has been built and optimized to work consistently with both old and new applications developed using the .Net programming framework. It is much easier and straightforward for enterprises to move their Windows apps to Azure Cloud as opposed to AWS or others. Thus for the several organizations that use .Net based enterprise apps, Azure is the obvious choice.

Cloud Connectivity & Performance

While Amazon is still testing the hybrid waters, Azure already has its hybrid capabilities in place. It seamlessly connects datacenters to the Cloud. Azure provides a consistent platform which facilities easy mobility between on-premises and the public Cloud.

Unlike AWS, hybrid apps can be developed on Azure which can take advantage of the resources available within datacenters, at the service provider’s end, or within Azure itself. Azure also provides a broader range of hybrid connections including virtual private networks (VPNs), caches, content delivery networks (CDNs), and ExpressRoute connections to improve usability and performance.

Conclusion

After this overview of the Differences Between AWS vs AZURE cloud providers, hope you will have a better understanding of the services offered by these AWS vs AZURE providers and choose a cloud provider based on your requirements. If you are looking for Infrastructure as a service or wide range of service and tools then you can choose AWS. If you are looking for windows integration or a good platform as a service (PaaS) cloud provider then you can choose Azure. The choise is always your to make.

Improve Your Model’s Performance and Accuracy with ML.NET’s New Update

No Comments »

Automated Machine Learning (AutoML) is one of the fascinating subfields of Data Science right now. It sounds fantastic for those who are unfamiliar with machine learning, but it concerns present Data Scientists a lot. The media presentation of AutoML suggests that the technology has the potential to drastically transform the way we produce models by removing the need for Data Scientists. In principle, utilizing AutoML to automate the process entirely is a brilliant idea, but it introduces several opportunities for bias and misunderstanding in practice. Machine learning model training can be a time-consuming process. Automated Machine Learning (AutoML) makes identifying the best strategy for your circumstance and dataset easier.

ML.NET is an open-source, cross-platform machine learning framework for .NET developers that allows custom machine learning to be integrated into .NET applications. Microsoft changed the AutoML implementation in its Model Builder and ML.NET CLI tools based on Microsoft Research’s Neural Network Intelligence (NNI) and Fast and Lightweight AutoML (FLAML) technology last year.

New AutoML Updates

Training machine learning models is a time-consuming and iterative task. Automated Machine Learning (AutoML) automates that process by making it easier to find the best algorithm for your scenario and dataset. AutoML is the backend that powers the training experiences in Model Builder and the ML.NET CLI. Last year we announced updates to the AutoML implementation in our Model Builder and ML.NET CLI tools based Neural Network Intelligence (NNI) and Fast and Lightweight AutoML (FLAML) technologies from Microsoft Research. These updates provided a few benefits and improvements over the previous solution which include:

  • Increase in the number of models explored.
  • Improved time-out error rate.
  • Improved performance metrics (for example, accuracy and R-squared).

The Experiment API

An experiment is a collection of training runs or trials. Each trial produces information about itself such as:

Evaluation metrics: The metrics used to assess the predictive capabilities of a model.

Pipeline: The algorithm and hyperparameters used to train a model.The experiment API includes a set of AutoML defaults, making it easier to add to a training pipeline. The dataPrepPipeline in this code snippet is a sequence of transforms to get the data into the proper format for training. The AutoML components required to train a regression model are added to that pipeline.

The same idea holds for other supported cases, such as categorization. When building an experiment using the training pipeline, one may choose the length of the training, the training and validation sets, and the evaluation measure they are optimizing. After setting up the pipeline and experiment, call the Run function to begin training.

// Configure AutoML pipeline
var experimentPipeline =    
    dataPrepPipeline
        .Append(mlContext.Auto().Regression(labelColumnName: "fare_amount"));

// Configure experiment
var experiment = mlContext.Auto().CreateExperiment()
                   .SetPipeline(experimentPipeline)
                   .SetTrainingTimeInSeconds(50)
                   .SetDataset(trainTestSplit.TrainSet, validateTestSplit.TrainSet)
                   .SetEvaluateMetric(RegressionMetric.RSquared, "fare_amount", "Score");

// Run experiment
var result = await experiment.Run();

In this code snippet, the dataPrepPipeline is the series of transforms to get the data into the right format for training. The AutoML components to train a regression model are appended onto that pipeline. The same concept applies for other supported scenarios like classification.

What’s next for ML.NET?

We’re actively working towards the areas outlined in our roadmap.

Deep Learning

A few months ago we shared our plan for deep learning. A significant portion of that plan revolves around improving ONNX experiences for consumption and enabling new scenarios through TorchSharp, A .NET library that provides access to the library that powers PyTorch. Some of the progress we’ve made towards this plan includes:

Enabled global GPU flags for ONNX inferencing. Prior to this update, when you wanted to use the GPU for inferencing with ONNX models, the FallbackToCpu and GpuDeviceId flags in the ApplyOnnxModel transform were not saved as part of the pipeline. As a result, you had to fit the pipeline every time. We’ve made these flags accessible as part of the MLContext so you can save them as part of your model.

TorchSharp targets .NET Standard. TorchSharp originally targeted .NET 5. As part of our work in enabling TorchSharp integrations into ML.NET, we’ve updated TorchSharp to target .NET Standard.

We’re excited to share with you the progress we’ve made integrating TorchSharp with ML.NET in the coming weeks. Stay tuned for the blog post.

.NET DataFrame

Clean and representative data improves the performance of the model. As a result, data analysis, cleansing, and preparation for training is a crucial stage in the machine learning workflow. A few years back, we introduced the DataFrame type to.NET as a preview in Microsoft.Data.Analysis NuGet package. The DataFrame is still in preview. as it is very important for someone to have the tools to perform data cleaning and processing tasks and have started to organize and prioritize feedback, they address existing stability and developer experience pain points. The feedback is being organized as part of a GitHub issue.

MLOps

Machine Learning Operations (MLOps) is like DevOps for the machine learning lifecycle. This includes things like model deployment & management and data tracking, which help with productionizing machine learning models. We’re constantly evaluating ways to improve this experience with ML.NET.

Recently we published a blog post that guides you through the process of setting up Azure Machine Learning Datasets, training an ML.NET model using the ML.NET CLI and configuring a retraining pipeline with Azure Devops. For more details, check out the post Train an ML.NET model in Azure ML.

Conclusion

Machine Learning Operations (MLOps) is a machine learning lifecycle equivalent to DevOps. It comprises features such as model deployment and administration and data tracking, which aids in producing machine learning models. Microsoft continually strives for ways to improve the ML .NET experience. These are some updates brought in by Microsoft ib their ML .NET framework, which will help developers better their workflow.

Visual Studio Code With Rapidly Rising Rust – With a Simple Guide

No Comments »

Rust is a blazingly fast and memory-efficient programming language with no runtime or garbage collector. It is also one of the fastest-growing programming languages, is the subject of a new Visual Studio Code topic. Announced in the latest update to VS Code (the April 2022 update bringing it to v1.67), the new Rust in Visual Studio Code topic describes Rust programming language support in VS Code with the rust-analyzer. Rust has been gaining popularity and is seeing tremendous adoption amongst developers. This post will assist anyone wanting to develop Rust applications using Visual Studio Code (VS Code).

According to VS Code, “Rust is a powerful programming language, often used for systems programming where performance and correctness are high priorities,” reads the new topic. “If you are new to Rust and want to learn more, The Rust Programming Language online book is a great place to start. This topic goes into detail about setting up and using Rust within Visual Studio Code, with the rust-analyzer extension.”

The new topic comes amid a years-long rise in Rust popularity. For example, Rust made a big splash in the .NET-centric developer community several years ago when we reported “C++ Memory Bugs Prompt Microsoft to Eye Rust Instead.” That article referenced posts from the Microsoft Security Response Center (MSRC) titled “A proactive approach to more secure code” along with “We need a safer systems programming language” and “Why Rust for safe systems programming.”

There doesn’t seem to have been much progress since then on adopting Rust as a C++ replacement for systems programming, but Microsoft, which joined the Rust Foundation last year, posted documentation in February titled “Overview of developing on Windows with Rust.” Microsoft has also spearheaded Project Verona on GitHub, described as “a research project being run by Microsoft Research with academic collaborators at Imperial College London. We are exploring research around language and runtime design for safe scalable memory management and compartmentalization. The prototype here only covers the memory management aspects of the research.” Also, one of those MSRC 2019 posts noted that Rust topped Stack Overflow’s list of most loved languages for four years running, and its ascent continues today.

As far as the rust-analyzer extension for VS Code, its features include:

  • Codecompletion with imports insertion
  • Go to definition, implementation, type definition
  • Find all references, workspace symbol search, symbol renaming
  • Types and documentation on hover
  • Inlay hints for types and parameter names
  • Semantic syntax highlighting
  • A lot of assists (code actions)
  • Apply suggestions from errors

It has been installed more than 587,000 times, earning an average 4.9 rating (scale 0-5) from 157 developers who reviewed it.

Installation Process

Install Rust

First, you will need to have the Rust toolset installed on your machine. Rust is installed via the rustup installer, which supports installation on Windows, macOS, and Linux. Follow the rustup installation guidance for your platform, taking care to install any extra tools required to build and run Rust programs.

As with installing any new toolset on your machine, you’ll want to make sure to restart your terminal/Command Prompt and VS Code instances to use the updated toolset location in your platform’s PATH variable.

Install the rust-analyzer extension

You can find and install the rust-analyzer extension from within VS Code via the Extensions view (Ctrl+Shift+X) and searching for ‘rust-analyzer’. You should install the Release Version.

rust-analyzer extension in the Extensions view

To discuss more of rust-analyzer features or to learn more about this topic you can refer to the extension’s documentation at https://rust-analyzer.github.io.

Check your installation

If you complete the above instruction you will be good to go and start coding in Rust, but after installing Rust, you can also check whether everything is installed correctly or not by opening a new terminal/Command Prompt, and typing:

rustc –version

Which will output the version of the Rust compiler. If you run into problems, you can consult the Rust installation guide. You can keep your Rust installation up to date with the latest version by running:

rustup update

There are new stable versions of Rust published very 6 weeks so this is a good habit. When you install Rust with rustup, the toolset includes the rustc compiler, the rustfmt source code formatter, and the clippy Rust linter. You also get Cargo, the Rust package manager, to help download Rust dependencies and build and run Rust programs. You’ll find that you end up using cargo for just about everything when working with Rust

Local Rust documentation

When you install Rust, you also get the full Rust documentation set locally installed on your machine, which you can review by typing rustup doc. The Rust documentation, including The Rust Programming Language and The Cargo Book, will open in your local browser so you can continue your Rust journey while offline.

Next steps & Summary

This has been a brief overview showing the rust-analyzer extension features within VS Code and the installation process for Rust in VS Code. For more information, see the details provided in the Rust Analyzer extension User Manual, including how to tune specific VS Code editor configurations.

To stay up to date on the latest features/bug fixes for the rust-analyzer extension, see the CHANGELOG. You can also try out new features and fixes by installing the rust-analyzer Pre-Release Version available in the Extensions view Install dropdown.

If you have any issues or feature requests, feel free to log them in the rust-analyzer extension GitHub repo.

If you’d like to learn more about VS Code, try these topics:

Intro to C# Game Development

No Comments »

.NET is a cross-platform and open-sourced developer platform for building different types of applications. The tech-giant Microsoft developed it. It’s also designed for new developers trying to learn how to use .NET by making games. Here we will discuss why and what are the benefits of using .NET in game development. We will also talk about the different game engines in .NET and its tools, which make .NET a perfect choice for developing games. .NET is also part of Microsoft Game Stack, a comprehensive suite of tools and services just for game development.

Why use .NET in game development?

The major plus for .NET is that it is a cross-platform, a single code base can be used on different operating systems, be it Windows, MAC, or Linux. So developing a game in .NET means it is compatible with all these platforms.

.NET works seamlessly with game engines like Monogame and Unity, and many more. You can create incredible 2D and 3D games using these. Game engines and framework developers are using .NET to ensure secure cross-platform scripting for multiple gaming platforms. Another significant advantage is developing your game and its mobile application, website, and other online services using the same platform. So why not use .NET in game development.

What is a Game Engine?

Not so long ago, developers used to make their games from scratch, but now they have made a lot of reusable code in their games and have made APIs and tools they can reuse for each game. So whenever a developer is developing a new game, they can make use of all these.

A game engine is a software development environment designed to build video games. They contain abstraction of graphics, input, and media API. And also, asset managers and design tools for audio and visuals.

With the increasing popularity of C#, more engines are now being used .NET. The mono runtime compatible with .NET 5 can run C# code on many platforms like Android, iOS, Mac, etc. It is one of the main reasons for using .NET in game development.

Available game engines

The first step to developing games in .NET is to choose a game engine. You can think of engines as the frameworks and tools you use for developing your game. There are many game engines that use .NET and they differ widely.

Stride

It was developed by Silicon Studios, an utterly integrated engine with a graphic editor. It is a complete C# and .NET engine which is open-source and royalty-free. Another advantage is you can use parts of these engines independently

Mono Game

Mono Game is a very flexible engine; other game engines even use this as their base. FlatRedBall is an example of this. It can be used as a framework to build other game engines. Many game developers use it for their cross-platform game development.

Wave Engine

Another game engine that is fully developed in .NET is WaveEngine. It has a lot of reality features like spatial audio and ready to use out of the box. It has many of its components open-sourced and free.

NeoAxis

NeoAxis is yet another game engine written purely in .NET. It is also free and open-sourced. It supports a whole lot of features like the latest Android release

Online services for your game

If you’re building your game with .NET, then you have many choices on how to build your online game services. You can use ready-to-use services like Microsoft Azure PlayFab. You can also build from scratch on Microsoft Azure. .NET also runs on multiple operating systems, clouds, and services, it doesn’t limit you to use Microsoft’s platforms.

The ecosystem

The .NET game development ecosystem is rich. Some of the .NET game engines depend on foundational work done by the open-source community to create managed graphics APIs like SharpDX, SharpVulkan, Vulkan.NET, and Veldrid. Xamarin also enables using platform native features on iOS and Android. Beyond the .NET community, each game engine also has their own community and user groups you can join and interact with. .NET is an open-source platform with over 60,000+ contributors. It’s free and a solid stable base for all your current and future game development needs.

Rich set of .NET tools

.NET is vibrant in terms of game development tools. As it is an open-source platform with a rich community of developers and users. Most of the .NET engines also depend on the base of other open-source work. In addition to the community of .NET developers, each of these game engines also has a different user base. They need different kinds of tools according to their needs and .Net has a variety of tools to help them. .NET tools you are used to are also used for making games. Visual Studio is a great IDE that works with all .NET game engines on Windows and macOS. It provides word-class debugging, AI-assisted code completion, code refactoring, and cleanup. It works seamlessly with all of the game engines. In addition, it provides real-time collaboration and productivity tools for remote work. Another feature is assisted in code completion and cleanup. Also, it includes code refactoring. This perfect environment is the reason for the growing demand for .NET in game development. GitHub also provides all your DevOps needs. Host and review code, manage projects, and build software alongside 50 million developers with GitHub.

Conclusion

Indeed, the future of .NET in game development is bright. Game Engines use the latest versions of .NET, and it even gets upgraded as the new version releases. With strong game engines, a rich set of tools, and C# .NET’s growing popularity is gamers’ favorite. That’s why it has become one of the best choices for game developers.

keep looking »