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.

NODE.JS VS ASP.NET CORE: Which One to Choose?

No Comments »

The software industry offers multiple choices for developers and business owners. Some languages come and go forever, and some make a toll in the industry and immediately gain popularity, such as ASP.NET Core and Node.js. These are the two most popular software development environments with strong community support that help the skilled .NET Core developers in speeding up, fastening, and scaling up the entire development process. Before choosing any programming language let us know more about these two programming platforms and see what they have to offer.

The Basics

Node.js

As an alternative to Apache HTTP Server, Node.js was created for Apple’s, SmartOS, FreeBSD, AIX, Microsoft Windows, Android, and Linux operating systems. As the official site explains Node.js is a software platform built on the basis of V8, where V8, in turn, is the JavaScript engine developed by Google with open source code written in C++.

In this modern age, JavaScript has become the most interesting trend. Companies are migrating their sites to JavaScript-based technologies. Nodejs is a cross-platform runtime environment that connects libraries written in different programming languages and also enables interaction with I/O devices. Developers can use Node.js in web development by utilizing an agile software development approach. It offers both scalable and robust services to clients.

ASP .NET Core

ASP.NET Core is one of the most important open-source web application frameworks. It is developed and designed by Microsoft. It is a framework created on CLR (Common Language Runtime) that enables the developers to use any .NET dialect like C# (object-oriented), VB .NET (a bequest of Visual Essential), F# (utilitarian to begin with), C++, and more.

The .NET Core framework offers a wide range of web forms MVC and uses HTML5, JavaScript, CSS, and Templates which are used to create different types of services and applications for Windows. But ASP.NET Core is used to create dynamic web pages and it is a part of the .NET Core framework.

Performance

Node.js

When it comes to the performance of Node.js, many developers in the market believe that applications created using Node.js offer better performance. This technology is capable of handling multitasking with ease and this is because it works on JavaScript engine V8, the high-performing engine. Besides this, it can also tackle more traffic on the server.

.NET Core

In comparison to Node.js performance, ASP.NET Core only proves its robustness for a certain type of project. Node.js can manage tasks that require less computation. But with time .NET Core has become 15% faster and this has made it a good choice for developers.

Stability & Reliability

ASP.NET Core/.NET Core is a winner in this category. The security and reliability the platform provides make it a great option to create robust software with C# language. Node.js is more reliable for complex enterprise software developed with TypeScript than on its own.

Node.js is a technology that is known as a full-stack JavaScript framework that serves both the server-side and client-side of the applications. This technology can interpret the JavaScript code with the help of the JavaScript v8 engine by Google. And it complies with the JS code into the machine code directly without any issues. This approach enables faster and better implementation of code and also the code execution is also enhanced by the JavaScript runtime environment.

On the other hand, one of the most important advantages of the .NET Core is to offer high performance and optimize the code to offer better results. ASP.NET Core is a technology that demands less coding and this helps the developers to easily optimize the code. And because of this, the development team has to spend less time creating a solution and this helps in cutting down the budget.

Community Support

Both development environments can boast of having active and strong community support which ultimately means it won’t be burdensome to find a solution to the problem. However, keep in mind that .NET has more community support on Stack Overflow whereas Node.js is supported more via GitHub. The best example is the Stack Overflow question and answer website which has around 4 million registered users.

The community support for .NET Core appears to be rising as well. Every day, the official Dotnet YouTube channel posts useful videos that engage the community in a good way.

How to make the right decision?

Node.js is one of the most popular JavaScript-based platforms that is designed to increase the use of JS in creating efficient and scalable network applications, and the ASP.NET core is a platform that enables the use of different libraries, programming languages, and editors to create websites, web apps, and mobile apps. There are such sites as Microsoft, StackOverflow, and Dell that run on a .NET environment. Again developers can use Node.js for creating web applications and APIs for various operating systems like Windows, Linux, and OS X. Besides, using this technology you can create apps for big companies like Uber, PayPal, LinkedIn, Netflix, eBay, and more. If you know the type of app or software you want to develop it will be easier for you to choose the solution.

Conclusion

When it comes to choosing a technology out of these two modern platforms, ASP.NET Core is a web application development technology that can be more suitable for small and medium-size solutions. While on the other Node.js is used when the developers want to create a robust solution for the clients which is also lightweight. This proves that the selection depends on the project type, size, and the need for the functionalities in that project.

Some of The Best Tools You Can Use as A .NET Developer

No Comments »

The .NET framework is one of the most popular open-source frameworks that is used by millions of software developers. According to the latest estimates, there are over 6 million .NET engineers worldwide. This has spurred the growth of various third-party development tools. To get a first-hand opinion on the most valuable and useful developer tools out there. Today, we presented a compiled list of essential .NET developer tools. Let’s have a look at the 10+ most valuable tools every .NET developer should use.

Best Tools for .NET Developers

Visual Studio Gallery

This is an essential tool that offers quick access to Visual Studio extensions, controls, and templates. The marketplace integrates with the IDE, allowing you to access over 7,000 products currently available. The Visual Studio Gallery is critical in how you locate the right extension for your needs. Without the VS Gallery, clicking on Extensions in VS wouldn’t work.

GitHub Extension for Visual Studio

With version control being so popular, Microsoft couldn’t ignore GitHub by NOT including it within Visual Studio. For developers, GitHub is vital. This extension helps us to connect our IDE directly to our GitHub repositories. This means that one can create, clone, and publish your projects, and create or view pull requests right within Visual Studio.

ReSharper

A developer who wants to become more productive when writing C# code should run, not walk, to purchase this tool. This is a Visual Studio extension by JetBrains. ReSharper adds the power to analyze code quality, then to find and fix the errors quickly. It also has several shortcuts for quick and easy refactoring and navigation.

NDepend

NDepend is also a Visual Studio extension for static code analysis. For optimizing and refactoring code at a high level, NDepend is one of the best. It essentially allows developers to see the “wood for the trees”, giving a wide view of your application and how is your code organized. The tool helps us measure our code quality using various metrics, to visualize its design, and to accurately estimate your technical depth, right within the IDE.

NuGet

NuGet is a package manager for .NET that allows you to access various third-party libraries, or to create and share your tools. With over 98 thousand packages currently available, it is the largest database of third-party components for .NET. NuGet streamlines the delivery of third-party components directly into your Visual Studio project at design time and contains a command line for CI/CD automated deploys.

Web Essentials for Visual Studio

This Visual Studio extension augments the core VS functionality with more powerful and useful features, including task shortcuts and improved Intellisense for CSS/HTML/JavaScript, etc. This is a handy tool for web developers using Visual Studio that can be a real productivity booster. In this one extension, you receive custom editors, a Browser Link to immediately see changes in the browser, TypeScript, Less, Markdown, and CoffeeScript support.

Novi Builder

Novi Builder is a visual HTML editor that allows changing texts, images, links, backgrounds, and other elements effortlessly. There are 200+ useful elements that make it possible to create different pages. Novi also provides a code editor to work with HTML, CSS, and JS code for your online projects.

.NET Reflector

.NET Reflector is a decompiler and static analyzer for the .NET framework. It helps you understand and debug your .NET code, including third-party components, even if you don’t have any documentation or comments. It also gives us a solid insight into what an assembly contains and what code is actually doing when decompiled.

SQLComplete

SQLComplete is a productivity tool that augments the SQL Server Management Studio with several useful features, including tab coloring, script generation, navigation, and more. Full-stack developers always get their hands dirty with SQL. This freemium tool is the equivalent of Intellisense in C# and plugs into SQL Server Query Analyzer and Visual Studio. Along with its exceptional Intellisense capabilities, it also has a handful of features to assist with snippets, templating, and SQL formatting.

LINQPAD

This is a safe playground where you can test your LINQ queries or any C#/F#/Visual Basic program. The tool has a built-in debugger and autocomplete features, and is a perfect platform for prototyping with instant feedback. LIt is simply a Notepad for LINQ and also an essential tool for experimenting with LINQ and testing code snippets before they are introduced into code.

ELMAH

ELMAH stands for Error Logging Modules and Handlers. It is an open-source debugging and error logging tool for ASP.NET, and is provided by Google. It really stands in comparison to some other paid .NET logging solutions that you can find online.

Microsoft Web Platform Installer

This free package management software makes it easy to access the latest components of the Microsoft Web Platform, including IIS, SQL Server Express, .NET Framework, Visual Web Developer, and much more. The system keeps you up to date by automatically installing the latest versions of each component.

Conclusion

The choice of .Net tool varies greatly on the specific task or situation. Using additional instruments can free you from routine tasks and automate many processes, thus optimizing your performance and eliminating errors. Some of them have some similar as well as some unique features that can be very helpful on a specific situation.

MAUI Lets You Create a Cross-Platform Mobile App with .NET and C# From a Single Codebase

No Comments »

What if we could create native mobile apps and desktop apps using .NET C# and XAML from a single code base? How cool would that be? Yes, now we can create native Android, iOS, macOS, and Windows applications from a single code base. This is possible using .NET’s new feature called Multi-platform App UI (MAUI). .NET Multi-platform App UI (.NET MAUI) is a cross-platform framework for creating native mobile and desktop apps with C# and XAML. Microsoft Build 2020 announced that Microsoft has evolved Xamarin.Forms and taken the next step in the .NET unification to give us a cross-platform mobile-first framework for Android, iOS, macOS, and Windows. .NET MAUI will introduce new ways to build applications – available in .NET 6 and in preview now!

What is .NET MAUI?

.NET Multi-platform App UI (MAUI) is the evolution of Xamarin. Forms extended from mobile to desktop scenarios with UI controls rebuilt from the ground up for performance and extensibility. – Maddy Leger, Program Manager Xamarin/.NET MAUI Team. is an open-source cross-platform framework which can be used to develop and build native Android, iOS, macOS, and Windows applications from a single code base.

What are Xamarin and Xamarin.Forms?

Xamarin is an open-source .NET platform for building iOS, Andriod, macOS, and Windows applications. It was introduced in 2011. It allows us to share business logic across platforms, using .NET, while creating a native UI for each. Xamarin allows developers to share an average of 90% of their application across platforms. To help with the overhead of creating native UI’s for each platform, we have Xamarin.Forms.

Xamarin.Forms is an open-source UI framework that allows us to combine the code for Xamarin.Android, Xamarin.iOS, Xamarin.Mac, and Windows applications into a single shared codebase.

Microsoft is now thinking about creating a unified .NET platform that can replace .NET Framework, .NET Core, and Xamarin. .NET MAUI is the next step in unifying .NET by replacing Xamarin.Forms. It addresses some of the issues and downsides of Xamarin.Forms, while providing an updated architecture on top of the new generation of .NET and project system.

Difference between MAUI and Xamarin.Forms

Microsoft is rebuilding the core of Xamarin.Forms, bringing us performance improvements, consistent design systems, and an extension from mobile to desktop. Now you may ask if we use Xamarin.Forms then why should we move to MAUI? Why is so special about MAUI?

.NET MAUI provides cross-platform APIs for native device features. It has some major Improvements like a Single project experience across platforms and .NET hot reload. .NET MAUI allows us to have a single project experience instead of one project for each target platform. We can use one language across our application to target all the supported platforms and easily share resources across them while maintaining an option for platform-specific code. Also the Model-View-ViewModel (MVVM) and XAML pattern used in existing Xamarin.Forms applications will continue to be supported and improved with the evolution. .NET MAUI will introduce further support for the Model-View-Update (MVU) development pattern, popular in C#, enabling developers to write fluent C# UI and create a code-first development experience.

How .NET MAUI works?

.NET MAUI unifies Android, iOS, macOS, and Windows APIs into a single API that allows a write-once run-anywhere developer experience, while additionally providing deep access to every aspect of each native platform.

.NET 6 provides a series of platform-specific frameworks for creating apps: .NET for Android, .NET for iOS, .NET for macOS, and Windows UI 3 (WinUI 3) library. These frameworks all have access to the same .NET 6 Base Class Library (BCL). This library abstracts the details of the underlying platform away from your code. The BCL depends on the .NET runtime to provide the execution environment for your code. For Android, iOS, and macOS, the environment is implemented by Mono, an implementation of the .NET runtime. On Windows, Win32 provides the execution environment.

.NET MAUI provides a single framework for building the UIs for mobile and desktop apps. The following diagram shows a high-level view of the architecture of a .NET MAUI app:

.NET MAUI architecture diagram.

In a .NET MAUI app, you write code that primarily interacts with the .NET MAUI API (1). .NET MAUI then directly consumes the native platform APIs (3). In addition, app code may directly exercise platform APIs (2), if required.

About .NET hot reload

.NET MAUI includes support for .NET hot reload, which enables you to modify your managed source code while the app is running, without the need to manually pause or hit a breakpoint. Hot reload increases productivity for .NET developers, allowing instant updates to running applications with new code changes. .NET MAUI includes support for XAML hot reload, which enables you to save your XAML files and see the changes reflected in your running app without recompilation. In addition, your navigation state and data will be maintained, enabling you to quickly iterate on your UI without losing your place in the app.

During Microsoft Build 2021, Microsoft announced the availability of .NET MAUI Preview 4. Each preview provides us with more features and tools with general availability scheduled for November 2021 at .NET Conf. With the release of Preview 4, we can now create functional applications across all supported platforms using .NET MAUI. In addition, they have added new capabilities to support running Blazor on desktop using .NET MAUI, allowing the reuse of Blazor UI components across native desktop and web applications. Alongside Preview 4 is the release of Visual Studio 2019 version 16.11 Preview. The Visual Studio 2019 16.11 Preview enables .NET Hot Reload for MAUI and provides productivity features for developing .NET MAUI projects. To see what is coming in future releases, visit the MAUI product roadmap.

« go backkeep looking »