Quantcast
Channel: dotMemory : .NET Tools | The JetBrains Blog
Viewing all 306 articles
Browse latest View live

Special Thanks to All JetBrains .NET and VS Tools 2020.2 EAP Participants

$
0
0

As you may know, our .NET and Visual Studio tools got a massive 2020.2 update just a few weeks ago – the ReSharper .NET tools, ReSharper C++ and Rider blogs have more details. Now our sights are set on the 2020.3 release due out at the end of this year. But before we get back to work on that, we have one more important thing to say.

We are deeply grateful to all participants of our 2020.2 Early Access Program. You helped us identify countless issues, usability glitches, and missing features. Thank you so much!

We’d like to share our special thanks with these fine folks who have been the most active, and present them a complimentary 1-year dotUltimate subscription. (Your YouTrack username is listed if we do not know your full name):

  • ReSharper .NET Tools EAP:
    • Lucas Trzesniewski
    • NN __
    • R H (Robert Heuvel)
    • Kirill Rakhman
  • ReSharper C++ EAP:
    • 润聪 李
    • Ruslan Khamidullin
  • Rider EAP:
    • Christian Andersen
    • Marcel Wiessler
    • darth pixel
    • Oliver Ehrenmüller

We’ll email each of you in the next few days with a coupon code that can be redeemed to get a new subscription or extend your existing one. If you’d like to pass that code to a friend or colleague, that’s OK, too. Thanks again!

Your .NET team
JetBrains
The Drive to Develop


Improved Analysis and Hints for Nullable Reference Types

$
0
0

If you are already using nullable reference types, you might have noticed that they can help make your code safer. But not automagically… This feature relies heavily on everything called by your code being annotated.

Unannotated APIs are a big problem for nullable reference types, as they never produce warnings. Values from such calls show extremely optimistic non-null hints, even though there are no guarantees that these hints are correct. Here’s a compiler issue for this problem.

For example, if you are using LINQ’s FirstOrDefault() method from .NET Core 3.1, the compiler not only allows you to dereference its result without any warnings, it also tells you that it is not nullable – something we all know might not be true:

Incorrect nullability analysis for FirstOrDefault

The framework API is being annotated right now and the above won’t be a problem if you can use the .NET 5 preview, or migrate to it as soon as it reaches RTM.

However, there are lots of unannotated libraries and large projects that cannot be annotated in a timely manner. They represent a big problem for the nullable type system and the safety net it provides.

Some of these codebases might already have nullability information available in the form of JetBrains.Annotations, but these, unfortunately, cannot be utilized by the compiler.

Luckily, ReSharper (and Rider) warnings don’t have such limitations, so now both will take these into account as well when nullable reference types are enabled. Of course, it will also use external annotations to fix the FirstOrDefault example above even when it isn’t annotated, e.g. in .NET Core 3.1:

Fix incorrect nullability analysis for FirstOrDefault with JetBrains Annotations

You can also make use of ReSharper’s pessimistic analysis mode (Code Inspection | Settings | Value analysis mode in the ReSharper options) to tell it that you want a bit of extra safety with unannotated APIs, in which case it will tell you to check any value that wasn’t explicitly declared safe to use (i.e. any values that don’t have any annotation at all). Use this with caution, however, as it comes with lots of warnings!

Pessimistic code analysis

Showing these warnings has been made possible by extending the allowed states of variables in the analysis with new values representing a value without proper annotations, e.g. coming from a code without #nullable context. Such a value might be annotated with either [NotNull] or [CanBeNull] attributes, or its nullability might be completely unknown.

This implementation has some notable implications. First, since these additional states are part of the nullable analysis, they are tracked at no additional performance cost and do not require a separate analysis pass over the code.

Second, these states are fully integrated in the analysis and take full advantage of the language type system, for example they are utilized by type inference:

Nullability type inference

Finally, as unannotated and non-nullable states are now decoupled, we can tell you when some values are truly not nullable without the risk of misinforming you due to unannotated calls.

For example, code analysis can now tell you if a null check or conditional access is redundant:

Elvis operator (conditional null check) is not required

Or it can tell you that a method never returns null values and so its contract can be stricter. The same is true for local variables where ReSharper and Rider can tell you when a nullable variable is never used as such, and can be declared as non-nullable.

In the following example, ReSharper recognizes that the content variable will never hold a null value (even though it’s declared as nullable), and that the ReadAllText() method can not return null. As a result, nullable annotations can be safely removed for both the variable and the method’s return type:

Nullable annotation can be removed

This opens up an interesting opportunity to improve type hints. As you may already know, implicitly typed variables are now nullable by default, which means they can be reassigned with nullable values regardless of whether they were originally initialized with a nullable or non-nullable value. You can check the following language design notes explaining the motivation behind this change.

Calling attention to this fact via type hints turned out to be confusing for lots of people. They could initialize a variable with a non-nullable value and use it safely without ever reassigning it, yet as the variable was technically nullable and displayed a nullable type hint, it was perceived as not safe to use.

Now, ReSharper and Rider recognize variables that are always safe to use and don’t ever hold any nullable or even unknown values. Starting from 2020.2, ReSharper and Rider will work their magic and provide you with this information by identifying such variables as non-nullable through type hints:

Conclusion

In this post, we have seen that APIs that do not yet use nullable reference types may lead to incorrect code analysis, thus compromising null safety. ReSharper and Rider recognize such APIs and uses JetBrains.Annotations, if available, to ensure null safety.

ReSharper can also be switched to pessimistic analysis mode for extra safety when working with APIs that do not have JetBrains.Annotations. As misleading information from unannotated APIs is no longer a problem for ReSharper, it can now provide redundancy inspections for null checks and nullable annotations, making it possible to tighten nullability contracts. Type hints now indicate whether a variable ever contains a null value, making it clear whether you can always use it safely.

What do you think? Download ReSharper 2020.2 or Rider 2020.2, and give it a try!

REST – the ignored parts – Webinar Recording

$
0
0

The recording of our August 25 webinar, REST – the ignored parts, with Irina Scurtu, is now available. Subscribe to our community newsletter to receive notifications about future webinars.


In a world dominated by APIs, where everyone seems to implement microservices with so many paradigms and standards to choose from, REST seems to be the default option. Despite that, many of these so-called REST APIs don’t respect the guidelines and become brittle by overlooking some of the most powerful constraints.

In this session, we will look over how we can design a REST API that is flexible and evolvable by being in sync with what HTTP has to offer.

We will look over OData as a way to filter data, versioning, hypermedia types specs, and status codes by fine-tuning .NET Core.


(more…)

Azurite Support, Timer Trigger Code Completion, and More Azure Toolkit for Rider 2020.2 Updates

$
0
0

We’ve just released the Azure Toolkit for Rider 2020.2, and want to share what’s new. On the feature side, you can now work with the Azurite storage emulator from within Rider. If you’re developing Azure Functions, we’ve added code completion for timer triggers, and now auto-detect the core tools if you already have them installed. Log streaming for web- and function apps has been added, so you can see what is going on in your application from within Rider. We have also been working on our plugin infrastructure, and fixed a number of bugs. Let’s have a look!

Azurite storage emulator

If you are developing applications that use Azure Storage, you can make use of the Azure Storage Emulator (Windows-only) and the Azurite storage emulator. The latter option, Azurite, is quickly becoming more popular. While it does not support table storage yet (vote here), it is cross-platform and it supports the latest versions of the storage API.

After you install Azurite using npm (npm install -g azurite), you can find an Azurite node in the Services tool window. From here, you can start, stop, and clear the storage emulator:

Azurite Storage Emulator in Rider Services Tool Window

By default, Rider will manage the workspace path where Azurite stores its data. This path can be set to a custom folder, and to a solution-specific folder. This is useful when you are working on different projects and solutions: you can have different blobs and queues stored for different projects.

Azurite Settings

Most of the Azurite command-line options can be configured in the settings, under Tools | Azure | Azurite.

Code completion for Azure Functions timer triggers

When you’re using timer triggers in Azure Functions, you have to enter a valid NCrontab expression that defines when the function will be executed. But what does such expression look like? The Azure Toolkit for Rider now helps you by providing code completion with several example expressions from which you can start working:

TimerTrigger NCrontab expression completion

Rider also validates whether an expression is valid or not and gives you extra information about what may be wrong:

Timer Trigger validation

Internally, we are using the NCrontab library to make code completion and validation work – just like the Azure Functions runtime does.

Azure Active Directory application registration

Before, when creating an ASP.NET Core web aplication that uses Azure Active Directory organizational authentication, you would have to launch your browser, navigate to the Azure portal, register your application manually, and then copy/paste a bunch of entries. No more!

The latest Azure Toolkit for Rider now shows a warning when it recognizes the default values for your "AzureAd" configuration, and offers to register the application for you. After you enter your application’s display name and other details, and click Register, the next launch of your application will have organizational authentication up and running.

Azure Active Directory Application registration in Rider

The Tools | Azure | Register Azure AD application menu lets you update your existing application registration.

Service Authentication and Managed Identity

The Azure Toolkit for Rider now supports authenticating using the Azure CLI. When you are logged in with Azure CLI, your apps can use your developer credentials to authenticate and access Azure resources when debugging.

In the settings, under Tools | Azure | Service Authentication, you can see whether this is active or not.

Managed Identity support in Rider

Note that service authentication with managed identity is not supported for connecting to Azure resources in the IDE (e.g. from the Database tool window). It only enables service authentication for the applications you are building and debugging.

Log streaming for web apps and functions

On Azure, there are various options to handle logging and diagnostics, such as Azure Monitor and Application Insights. These services, however, have a slight delay in presenting data. For good reason, as they collect much more than just log output.

Another diagnostics option is log streaming, which streams log output from your web apps and function apps in real-time. The Azure Toolkit for Rider now lets you attach to the log stream, so you can inspect your application’s diagnostics in real-time.

Azure Log Stream for eb Apps and Function Apps

Bugfixes and plugin infrastructure updates

We’ve improved the existing functionality of the Azure Toolkit for Rider. Several updates were made to publishing Web Apps and Function Apps, and we’ve been hard at work to fix some Azure Functions functionality.

For example, we now auto-detect the Azure Functions core tools if they are already installed on your system. If you’re using Chocolatey or Brew to install them, Rider will now pick them up. Rider can still download and update the core tools as well. We’ve also made the run markers that can run, debug, and trigger individual functions more reliably.

Less visible, but still important, is that we’ve introduced a R# backend to the toolkit (see Rider architecture). This makes analyzing C# and F# code in the toolkit more reliable and opens up new possibilities for the future. The IntelliJ Platform, on which Rider is built, is being localized. As part of that effort, we’ve extracted all UI text into resource files.

Download Rider 2020.2 now and give it a try! We’d love to hear your feedback on these improvements!

.NET Annotated Monthly | September 2020

$
0
0

This month in computing history: The first instance of a computer bug was found in September 1947. It’s called a bug because when this happened, it was a moth that wandered into the machine and caused the glitch. This is possibly now the world’s most famous insect. Check out the log report in the link with the moth taped to the paper. It was called a log report because they didn’t have bug reports yet. And it was on paper – they were made from actual logs at that time.

.NET Annotated Monthly newsletter by JetBrains!
(more…)

How to Debug Hangs Using the dotTrace Performance Profiler

$
0
0

Michael ShpiltThis is a guest blog post from Michael Shpilt. Michael has been developing software for over 20 years. He owns the popular blog michaelscodingspot.com and recently published the book Practical Debugging for .NET Developers. In his day job, he works at OzCode, a company dedicated to improving debugging in .NET.

Program hangs are some of the worst possible things you can have. They are terrible in both desktop and web applications. With desktop applications, your window freezes and the app becomes unresponsive and basically useless. This is unpleasant for technical users like us programmers, but I imagine it’s awful for regular users. In a web application, when a hang occurs, your request remains stuck without ever returning. When more similar requests get stuck, the application eventually slows down to a crawl. Requests might start to fail altogether until the web server restarts and this evil cycle starts all over again.

I hope you won’t ever have to experience hangs, especially in production, but chances are that you will. And in the event that you do, you’ll need to know how to deal with them. In this article, we’ll see one of the best methodologies for debugging hangs. We’ll see how to use a performance profiler like dotTrace to find the root cause of the hang and fix it. There are many advantages to this, but first, let’s talk about the traditional way to debug hangs.

(more…)

Dataflow Analysis of Integral Values

$
0
0

Today we are introducing a new type of dataflow code analysis in ReSharper and Rider. We’ve gathered some statistics (by exploring the IL metadata of a large number of NuGet.org packages with an OSS license) and noticed that int is one of the most commonly used types for local variables.

That’s why this new analysis tracks the usage of values of the int type in your programs. It tracks the flow of integer values through your programs to detect useless or possibly erroneous pieces of code. It warns you about the following issues:

  • Relational/equality operators that always evaluate to true or false.
  • Unreachable switch cases checking int values.
  • Meaningless arithmetic operations, such as multiplication by 1, addition of 0, etc.
  • Possible int overflows.
  • Possible division by 0.
  • Possible errors in invocations of System.Math methods.

How it works

There are several different approaches to detecting issues associated with integer values. The method we’ve chosen is called abstract interpretation. In short, we interpret all statements and expressions in the program which can produce or affect integer values as part of static code analysis. We do not know the exact value of each variable, since most of them can be known only at runtime. However, we can collect some information about these values thanks to the int type constants used, literals, and arithmetic operations, and we can try to make use of this information.

For example, analyzing the piece of code below, we know nothing about the value of parameter x, but we can be certain y is nonnegative since it equals the absolute value of x:

The information on how every integer value can vary is represented as a set of ranges of possible values (which, of course, can be just one range or even just one value).

In the previous example, ReSharper deduced that x lies in the range [int.MinValue, int.MaxValue] and y lies in the range [0, int.MaxValue]. The condition y < 0 is true for all y in the range [int.MinValue, -1], but this range doesn’t overlap with the range of possible values for y, which we deduced earlier. Hence the condition is always false.

Sometimes the analysis can prove that one of the operands in a binary expression is exactly 0 or 1, which opens up new possibilities for reporting warnings. For example, adding a variable with a 0 value is a suspicious operation and can indicate potential errors in the algorithm. This doesn’t apply to addition of literals or constants that equal 0 – if you write x + 0, we assume you know what you are doing.

Looking at the next piece of code, the problem might be that scale has the wrong value, which later results in the meaningless addition of 0:

Our integer analysis knows a few things about System.Math methods and shows specific warnings if it detects suspicious usage of these methods:

By the way, Math.Clamp is an awesome method that is available in .NET Core and will be available in .NET 5.0. It clamps its first argument value to the inclusive range of min (second argument) and max (third argument). This method has an undocumented exception – it throws a System.ArgumentException when min is greater than max. Our analysis is aware of the checks made by this argument, and it statically checks Clamp invocations for correctness:

OK, now let’s look at a more interesting example. It is very unlikely that a value equal to the smallest allowed integer (–2,147,483,648) will appear in your program. That you will divide that value by –1 is even less likely. Still, ReSharper will go out on a limb here and warn you about the imminent overflow, because the smallest integer, when negated, doesn’t fall within the range of the int type.

The fun part here is that this operation overflows even in the unchecked context. It happens because on x86 processors, an overflow in a division operation results in a hardware exception (the same exception that you get when dividing by zero). This can seem a bit counterintuitive, because when adding, subtracting, or multiplying, an overflow does not lead to such an exception. If you replace division by multiplication in this example, you’ll notice how it silently overflows – and the ReSharper warning disappears.

In the last example, we also used the [NonNegativeValue] attribute which we will cover in the following section.

New attributes to use with integer type entities

To improve the precision of our dataflow analysis, we’ve added two new JetBrains.Annotations attributes to use with type members, return values, and int parameters: [NonNegativeValue] and [ValueRange(from, to)], to specify how values of particular int members may vary during runtime.

One of the possible applications for these attributes is in methods that can work correctly only with a subset of possible input values. With annotation attributes used for any int parameters of a method, you can get better static checking of arguments at method calls, as well as better code analysis of the method body. This means you will now be able to check the correctness of input values without even running the code 🙂

In the following method, the [NonNegativeValue] attribute ensures that the first check of the input parameter becomes redundant, and ReSharper highlights the relational expression accordingly:

What’s more, new attributes can help you avoid checking the return value of the method. All you have to do is annotate the method:

Of course, these attributes can also be used on properties, fields, and indexers.

Looking forward

Integral values analysis was introduced in ReSharper 2020.1 and Rider 2020.1, and our users are already getting some nice warnings thanks to it:

This is just the beginning of our integral values analysis journey. We will continue working on the analysis for the next releases, and this is what we plan to include next:

  • Support for other integral types: byte, sbyte, short, ushort, uint, long, and ulong
  • Validation of the use of code annotation attributes
  • Tracking of array and string lengths

Stay tuned!

The ReSharper 2020.2.2 and Rider 2020.2.2 Bug-fix Updates Are Here!

$
0
0

New bug-fix updates are available for both ReSharper and Rider. Here’s an overview of the most important changes that have been made.

ReSharper 2020.2.2

  • Fixed a couple of false positives in nullable analysis.
  • Fixed the default implementation of an interface from a referenced package. It is now recognized correctly (RSRP-480835).
  • Fixed the ‘Current directory’ for unit tests. It is now set to the test project’s ‘bin’ directory.
  • Other unit testing issues that have been fixed are described below in the Rider section.

    The rest of the issues and details are available in ReSharper’s bug tracker.

Rider 2020.2.2

  • Fixed cases of slowdown in building the project due to NuGet package restore (RIDER-49125).
  • Fixed an unmanaged memory leak that led to the growth of the committed memory of dotnet.exe (RIDER-49370).
  • Fixed the missing NUnit tests (RIDER-49695).
  • Fixed the debugger so that it can now be attached to remote processes (RIDER-49838).
  • Fixed the compound build/debug configuration with ‘.NET Launch Settings Profile (ASP.NET Core)’ (RIDER-49285).
  • Fixed the growing memory and freezes when working with Unreal Engine (RIDER-45872).
  • Fixed the ‘Del’ button. It now works as Delete and not as Backspace (RIDER-46520).
  • Updated a message to terminate the hanging test runner process: you now have an option to always terminate the behavior the first time you’re notified (RIDER-49584).
  • A list of Unity fixes is available on GitHub.

    The whole list of fixes is available in Rider’s bug tracker.

You’ll find ReSharper 2020.2.2 and Rider 2020.2.2 on our website, or you can update using the Toolbox.


Unit Testing in TypeScript Code

$
0
0

We all need to unit test our code to verify that it works the way it’s supposed to. Fortunately, Rider has the tools to enable you to test code more efficiently and quickly. In this post, we’ll look at using Mocha and Chai to write unit tests in TypeScript.

(more…)

ReSharper 2020.3 Roadmap

$
0
0

In this post, we’d like to share our plans for ReSharper 2020.3 and find out what we can do next to improve your development experience. Your feedback is always welcome!

The following is a list of our priorities for the next release cycle of 2020.3. Note that these are features we’re working on – as opposed to features scheduled for delivery. Some of these might come with later versions.

  • .NET and C# – Support for new platform and language features, like top-level statements or target-typed new expressions. We will extend our support for nullable reference types (NRT), for instance with a dedicated action to transform JetBrains annotations to NRTs and Roslyn annotations.
  • Command-Line Tools – We’re going to revive our CI/CD tools like InspectCode to allow for easy inclusion of third-party plugins from the command-line. Another interesting feature is to allow CleanupCode.exe to reformat code without loading the full solution, thus saving overall execution time.
  • Out-Of-Process – The architecture refactoring, which is the most difficult and fragile part, is now completed. Our next move will be to upgrade individual features to work on the new async API, like tool windows, popups, parameter info, and error stripes. Compared to the architecture refactoring these tasks are much smaller and also much easier to do in parallel.
  • Fuzzy Search – Most searches currently uses either exact terms or regular expressions. While exact terms are often too constraining, the effort to write a regular expression can be astronomical. Why not create a fuzzy search that is more natural to use? This search could ignore minor typos, look further ahead, or ignore a term in a longer search string that is preventing any results from being found…
  • Inlay Hints – It’s time to re-think! Hints, and especially type hints, can be disruptive when you’re reading familiar code. To this end, we’ll introduce a push-to-hint functionality that gives you information only when you need it. We are also considering implicit conversions as another use-case for inlay hints.
  • Predictive Debugger – During debug sessions it can be helpful to know which path our program will take without actually executing it. This helps us identify problems as soon as they materialize, instead of backtracking bugs. Just like our recently presented data flow analysis, this also takes JetBrains annotations into account to show possible halts.
  • Decompiler – Support for new language features and better IL Viewer synchronization, especially for declarations of local functions with parameters and attributes.
  • Avalonia – This is one of the most popular frameworks for UI development. We will add support for their binding syntax and CSS-like style syntax.
  • Endpoint Viewer – A number of IntelliJ-based IDEs recently introduced an endpoint viewer for microservices. We want to bring that joy to ReSharper users as well. It will give them more insights into Swagger and OpenAPI specifications, and greatly simplify request troubleshooting. We’ll start our journey by analyzing ASP.NET route attributes.
  • Code Inspections – Everyone working with EntityFramework has probably heard about the N+1 problem. We’re going to add a couple of analyzers to warn you if this problem appears in your code. We’ll also extend our collection of inspections for test frameworks, like NUnit, xUnit.net, and AutoFixture.

There will probably be plenty of other, smaller features implemented along the way. And of course, we also have a number of bugfixes planned for the upcoming release.

What do you think about these plans? Feel free to comment below, or to submit a new feature request in our issue tracker if we’ve missed something, or upvote any existing requests to let us know they are important to you. We’re looking forward to your feedback!

Rider 2020.3 Roadmap

$
0
0

Hello folks! With the Rider 2020.2 release out of the door, we’re looking toward the future. After sharing our ReSharper 2020.3 plans earlier this week, we’ll now look at our plans for Rider 2020.3. Your feedback is welcome and encouraged.

The following is a set of highlighted features our team is currently working on. Let’s get started.

  • .NET 5 – Our plan is to put significant time and effort to support the upcoming release of .NET 5. While development is possible in Rider today with .NET 5, it is incomplete. .NET 5 is the future of .NET, and we want to help developers get there.
  • More Performance – One of our biggest missions is to give you a fast and snappy development experience. In our efforts to do so, we are optimizing in the areas of cross-gen, frontend/backend startup, and solution-wide analysis.
  • Enterprise Features – In our effort to support enterprise developers, we are bringing more support for tools like Internet Information Services (IIS), Entity Framework, and more. In a specific feature, we plan on delivering one-click attach to a process for IIS users.
  • Immediate Window – Rider’s debugger has had the Evaluate Expression dialog for quite some time, but we’ve been asked for a more robust debugging interaction with variables, instances, and methods. We have begun work introducing an immediate window into the Rider debugging suite of tools, and we hope you’re as excited as we are.
  • New Toolbar Design – Integrating with distributed version control systems and sharing features, bug fixes, and enhancements are essential to the modern development story. In a redesign of the Rider toolbar, we are bringing version control access closer to a developer’s fingertips, while reducing unnecessary clutter.
  • Project Structure DiagramsReSharper users have benefited from project diagrams and the ability to visually understand their solution architecture. The team continues work to bring the feature to Rider customers.
  • Redesigned Welcome Screen – Our Welcome screen redesign will help all developers get started quickly. The redesign will include quick actions with starting a new solution, opening existing solutions, and retrieving a solution from source control.
  • macOS Plist Editor – For folks building apps targeting Apple’s operating systems, we will be bringing a plist editor into Rider. Xamarin.Forms users will have an easier time adjusting entitlements and completing an app’s info.plist.
  • Migrating Settings From Other IDEs – We want to make the transition to Rider as enjoyable as possible for developers. Our goals are to import settings like keymaps, tool window layouts, general settings, and even match any plugins you have installed. It’s an ambitious goal that will make the onboarding experience that much more pleasant.

As always, plans can change, so these features are not promised to arrive in the next version. There will be many more enhancements, features, and bug-fixes along the road to Rider 2020.3.

Now is an excellent opportunity to engage with our team, and give us the feedback we need to make the best IDE for .NET developers!

Let us know in the comments below, or submit a new feature request in our issue tracker. We look forward to your feedback.

Xamarin, MAUI and the reactive MVVM between them – Webinar Recording

$
0
0

The recording of our webinar, Xamarin, MAUI and the reactive MVVM between them, with Rodney Littles, II, is now available. Subscribe to our community newsletter to receive notifications about future webinars.


Xamarin Forms is the .NET cross platform technology that allows you to write an application in C# and target various operating systems, primarily mobile. The recommended architectural approach for .NET applications adhering to SOLID principles is Model-View-ViewModel (MVVM). ReactiveUI is a MVVM framework based on Reactive Extensions, which are a cross language approach to functional programming. During this talk we will take a trip through Xamarin, MVVM, ReactiveUI and show the future state of Xamarin, MAUI.


(more…)

ReSharper 2020.2.3 and Rider 2020.2.3 Are Available!

$
0
0

Dear everyone,

Today is bug-fix day! We’ve addressed several issues in both ReSharper and Rider and published the ReSharper 2020.2.3 and Rider 2020.2.3 builds.

ReSharper 2020.2.3 
  • ReSharper no longer freezes Visual Studio when the Favorite Documents extension is installed (RSRP-481224).
  • Now you have more precise control over which Visual Studio actions can be overridden by ReSharper on the ReSharper | Options | Environment | Keyboard | Visual Studio Commands page.
Rider 2020.2.3 
  • Breakpoint icons no longer disappear from the code editor (RIDER-48535).
  • There are a few fixes in F# support related to Import missing references and the presentation of F# Unions in the debugger (RIDER-50807, RIDER-50693, RIDER-49900).
  • We’ve fixed the authentication issue when invoking remote operations in GitHub (IDEA-248658).

You can download Rider 2020.2.3 and ReSharper Ultimate 2020.2.3 from our website or update either of them by using the Toolbox App. You can also update Rider as a snap.

Webinar – Service Creation via .NET Core Templates

$
0
0

Join us Wednesday, October 14, 2020, 16:00 – 17:00 CEST (10:00 AM – 11:00 AM EDT or check other timezones) for our free live webinar, Service Creation via .NET Core Templates, with Olga Nelioubov.

Register now and get a reminder, or join on YouTube

Custom .NET templates are a fantastic way to bootstrap your .NET services, however they’re not only limited to the .NET world – their usefulness could extend to templating out pipelines, applications in other languages, configuration files, or anything else that can be opened with a text editor. Furthermore, they are extremely simple to set up and can be easily packaged and distributed to others for re-use.

In this session, I’d like to go over what these .NET templates are and what makes them so useful and versatile. I’d also like to demo creating an API template, complete with an optional build and release pipeline, and then demonstrate using that template to create an out-of-the-box deployable solution.

(more…)

Webinar – Blazor – C# in the Browser

$
0
0

Join us Thursday, October 22, 2020, 16:00 – 17:00 CEST (10:00 AM – 11:00 AM EDT or check other timezones) for our free live webinar, Blazor – C# in the Browser, with Brian Jablonsky.

Register now and get a reminder, or join on YouTube

Ever dream about being able to write your web frontend code in C#? Blazor might be your answer! It lets you write your frontend code using C# and Razor.

In this session, we’ll take a look at what Blazor is, how Blazor works, the difference between Blazor hosting models and how it relates to WebAssembly, and build a Blazor web app using Rider.

(more…)


Rider Starts Its Early Access Program for 2020.3

$
0
0

Hello everyone,
Welcome to the early access program of our third release of the year, Rider 2020.3.

The highlights of the first EAP build include more advanced C# 9 support, new debugger features, and UX improvements. Let’s look into the details.

UX improvements

  • The most obvious update is the redesigned Welcome screen. More is less: we’ve tried to make the first window you see in Rider as neat and uncluttered as possible. It offers only the most common operations.


  • A long-awaited improvement has made it into the code editor: now you can split the editor by dragging and dropping a tab to the side of the main editor window. Pinned tabs are now always displayed on the left-hand side of the tab bar.


  • A nice UI improvement in tooltips: we’ve implemented syntax highlighting to make it easier to read and understand the tooltip.


C# 9 Support

  • For top-level statements, Rider not only provides some basics, like code completion and code analysis, but also offers a couple of handy quick-fixes and refactorings.
    When copy-pasting pieces of code, we often don’t care about placement. However, C# 9 requires top-level statements to precede any type or namespace declarations. Fortunately, Rider can help you correct the placement with the Move top-level statements before types and namespaces quick-fix.



    Because top-level statements implicitly declare the entry-point of a program, only a single file in the project can contain top-level code. If this requirement is not met, Rider allows you to move top-level statements to another file.



    Finally, the Extract local variable and Extract method refactorings are available in the top-level context.


  • Native integer types, nint and nunit, are supported in our code analysis, completion, and code editor features.


  • C# 9.0 makes conditional expressions target-typed. With this change, the two expressions need not have an implicit conversion from one to the other, as long as they are both implicitly convertible to a target type. Notice how Rider doesn’t highlight the following code with error squiggles.


  • Finally, we’ve supported the [DynamicallyAccessedMembersAttribute], so that Rider does not highlight any entities mentioned in the attribute as unused.

Debugger

  • Now, you don’t have to start debugging and navigate through several steps to the method or a place in code you’re interested in. Use our new debugging actions – Start Debugging and Step Over, Start Debugging and Step Into, Start Debugging and Run to Cursor, or Start Debugging and Run to Cursor Non-Stop. Rider will take you there, skipping external method calls or breakpoints if the appropriate action was used. You can find these actions under Run / Debugging Actions in the main menu or on the Debug tool window’s toolbar; alternatively, you can use the hotkeys. Please note that in web applications, this feature is available for a .NET Project configuration / .NET Static Method only.


Plugins

  • We also have several improvements for Unity developers. The [Explicit] attribute for tests is now handled correctly: the tests aren’t run unless you specifically launch them. Parameterized TestFixtures with parameterized tests are also handled. In other areas, Refresh Assets isn’t started if there’s no connection to Unity, so you won’t get an infinite ‘Refreshing solution in Unity Editor’ message anymore. Finally, we’ve improved the UI of the Unity Log Viewer.
  • With the Azure DevOps plugin, you can now create a new server workspace or import an existing one. We’ve also optimized the performance of the Add and Rename operations.
  • The Dynamic Program Analysis (DPA) plugin collects memory allocation data not only when you launch Run or Debug, but also when you attach the debugger to a process. This can be useful, especially for attaching to IIS processes.
  • For the F# plugin, we’re glad to introduce some long-awaited improvements in debugging async workflows. The debugger now keeps track of the local variables properly.

  • Code coverage highlighting provided by the dotCover plugin can be turned on and off from the plugin settings or from the “Configure highlighting level” popup (look for the Pencils icon) – enable it easily when you need it.

Other updates

  • We’ve added a rich editor for Info.plist files in Xamarin.iOS projects. It is available on all supported platforms.


  • We had an issue with publishing .NET Core projects that reference .NET Standard projects; it has been fixed, and the projects can now be successfully published to folder.
  • Unit tests can now be launched in your preferred target framework directly from the editor. This can save time and clicks!


There are several ways you can take part in the 2020.3 EAP:

  • Download and install the EAP build from www.jetbrains.com.
  • Use our Toolbox App.
  • Use this snap package from the SnapCraft store (if you are using a compatible Linux distro).

We’re eager to hear your feedback. Please add your comments below or file an issue in our public bug tracker.

ReSharper 2020.3 Early Access Program Begins

$
0
0

Hello everyone,

Please welcome ReSharper 2020.3 EAP1. It’s only the beginning of the release cycle, but we’ve already got something to show you!

ReSharper

With C# 9 on the way, we’re doing a lot to support the latest language standard.

  • For top-level statements, ReSharper not only provides some basics, like code completion and code analysis, but also offers a couple of handy quick-fixes and refactorings.
    When copy-pasting pieces of code, we often don’t care about placement. However, C# 9 requires top-level statements to precede any type or namespace declarations. Fortunately, ReSharper can help correct the placement with the Move top-level statements before types and namespaces quick-fix.



    Because top-level statements implicitly declare the entry-point of a program, only a single file in the project can contain top-level code. If this requirement is not met, ReSharper allows you to move top-level statements to another file.



    Finally, the Extract local variable and Extract method refactorings are available in the top-level context.


  • Native integer types, nint and nunit, are supported in our code analysis, completion, and code editor features.


  • C# 9.0 makes conditional expressions target-typed. With this change, the two expressions need not have an implicit conversion from one to the other, as long as they are both implicitly convertible to a target type. Notice how ReSharper doesn’t highlight the following code with error squiggles.


  • Finally, we’ve added support for the [DynamicallyAccessedMembersAttribute], so that ReSharper does not highlight any entities mentioned in the attribute as unused.

In addition to our efforts to keep up with the new language features, we have a couple of improvements in the feature set.

  • The results of Find Text now have a new section called Fuzzy. In addition to the traditional substring search that you are probably already familiar with, ReSharper now also performs a broader search that takes possible typos and missing words into account. It displays the results below the standard results, in the Fuzzy section. In addition to helping you deal with typos, this can also be useful if you want to find where a certain formatted string is built in your code.


  • Unit tests can be now launched in your preferred target framework directly from the editor. This saves time and clicks!


ReSharper C++

Here are some of the highlights of the first EAP build.

  • Live tracking for Unreal Engine properties: as soon as you save changes in .Build.cs, .Target.cs, .uproject, or .uplugin files, ReSharper C++ will regenerate the project model for the affected files.
  • For casting a reference to an rvalue reference in Unreal Engine project, completion and quick-fix now suggest you use MoveTemp.
  • Two new inspections with quick-fixes for working with C++20 ranges library.
  • Updates for Coding assistance and completion.
  • Faster operations on private class members.

For more details and other changes, please refer to this blog post.

We would appreciate your feedback very much. Please add your comments below or file an issue in our public bug tracker.

Download ReSharper EAP

Building a Xamarin.Forms Moon Phase App

$
0
0

One of the wonderful things about .NET is the vast array of platforms .NET developers can target. My personal experience has been developing ASP.NET applications and HTTP APIs, but recently I’ve been dabbling with mobile applications built using Rider and Xamarin.Forms.

For those curious, or maybe even a little scared, about working with Xamarin.Forms, well, don’t be. I’ve found the Xamarin.Forms community to be welcoming and very helpful to a mobile newbie like me. I’ve also found the platform itself to be straightforward to get started and iterate on as I’ve learned new approaches to solving the same problems.

Before continuing, I recommend reading Maarten’s post, Developing Xamarin applications in Rider, which will help in setting up your Xamarin.Forms development environment. We’ll also need .NET Core 3.1 SDK or higher installed. An important note is that while it’s possible to develop iOS applications on Windows, I recommend doing so on macOS. Since this is a Xamarin.Forms application, readers are welcome to create the app for Android, iOS, or both.

In this post, we’ll be creating a Moon Phase app. The app allows the user to determine the moon’s phase and its appearance by entering a date/time and the user’s current hemisphere. To get in the space mindset, be sure to set your theme to dark mode, like I did.

For those interested in the final results, you can head over to the GitHub repository.

(more…)

Create well-formed XML and schema efficiently

$
0
0

Most companies, both large and small still use XML, even if JSON has overtaken it in popularity. However, many are using it, for example to exchange data, or have configuration files that can contain comments (unlike JSON). Whatever your reason for using XML, Rider contains many great XML features that enable you to work with it more efficiently. In this blog post, we’ll look at using Rider to create and maintain perfectly well-formed XML, schemas, and more. Fortunately for us, Rider contains many great XML features that enable you to work with it more efficiently. In this blog post, we’ll look at using Rider to create and maintain perfectly well-formed XML, schemas, and more.

XML Overview

XML is a markup language that describes data, and is meant to be both human and machine readable. It allows developers to structure text-based schema, usually to share with a vendor, partner, other system, etc… XML has enjoyed longevity as a markup language for many years now, and although JSON has overtaken it in popularity, XML is still used every day.

Work with XML elements and data

You might be crafting XML to match an existing database schema, or the schematic requirements of a customer, vendor, or partner. Alternatively, you might be creating XML from scratch. Either way, Rider has you covered, with dozens of intentions, autocompletions, and other features to make XML element creation go smoothly. A bonus for web developers: Because HTML has a tag-based syntax, many of the intention actions and refactorings in this blog post work for HTML too!

Renaming code, XML, or other objects is a daily task of any programmer, regardless of language or technology. Rider contains rename refactorings for just about everything, including XML elements and attributes. For example, if you’re working on a restaurant’s online menu, you might have some renaming to do as the menu evolves. Rider enables you to rename a single element or attribute, or each instance of an element or attribute. To rename each instance of an attribute, for example, use Rename Element. If you choose only the Rename option, it will only rename the individual attribute at the cursor position.

Rename attribute

Often, creating XML elements means moving tags and attributes around, so they make better sense. Converting tags to attributes or attributes to tags is often necessary. Using our menu as an example, it seems better to convert the name element to an attribute of a menu item. To convert a tag to an attribute, or vice versa, use Alt+Enter.

Convert tag to attribute

Conversely, converting attributes to tags and making them a child element is also a frequent but necessary activity when structuring XML.

Convert attribute to child element

It’s easy to miss something while combing through miles of XML! When you need to insert a tag around all instances of another tag, use Ctrl+Shift+R and choose the Wrap Tag refactoring. The example menu is missing some nutrition information, so wrap the calories tag with it.

Wrap tag

Continuing with the example, allergy information should be added inside all nutrition-information elements. Use Ctrl+Shift+R again, but this time, to invoke the Add Subtag refactoring.

Add subtag

Rider has so many more ways to work with XML data. Open any XML document and use Ctrl+Shift+R (or Refactor | Refactor This) to see a list of all the helpful XML refactoring features available. If you don’t see a refactoring, place your cursor on an element and use Alt+Enter for contextual suggestions.

Validate XML Documents

Rider performs automatic validation for well-formedness of XML while you type XML entries. However, you may want to do your own manual validation to double check things, since Rider doesn’t validate every detail such as structure, until the XML file is linked to an XSD or DTD. Therefore, Rider presents several options for validating XML and creating DTD (Document Type Definitions) and schema files, located in the Tools | XML Actions menu, or by right clicking in any editor window containing an open .xml file. Being able to generate schema means you can form and use your XML to dictate how the structure looks.

Generate DTD

Alternatively, you may want to start by creating a schema file then generating template XML from it.

Creating valid XML means that you may have to create portions of the file that are designated as simple character data, rather than a defined type of data. That’s where CDATA comes into play. CDATA is defined as blocks of text that are not parsed by the parser, but are otherwise recognized as markup. Some examples for using CDATA are when XML documents have text that contain characters such as < and >, or &. Use Alt+Enter to switch between CDATA and text.

Convert CDATA to text

As an alternative to CDATA, Rider can convert special characters into their HTML character reference codes &. <, > Using Alt+Enter, you can switch between character codes and the characters.

Convert special characters to numeric

To properly validate documents, you must work with namespaces in XML. There are many public namespaces that define generic schema. For example, http://www.w3.org/2001/XMLSchema is the namespace that defines basic types. You’ll also use your own namespaces, whether publicly or privately hosted. Your namespaces map to one of your schema or DTD files, and you must link your XML documents to those namespaces for proper validation.

Namespaces are important concepts in XML, as they denote virtual locations that often map to physical locations that contain definitions of data types for XML documents. If you use a namespace identifier in elements without a namespace declaration, Rider recognizes that and marks the namespace as unidentified. Use Alt+Enter to add the namespace.

Add a namespace

XPath and XSLT

XPath (XML Path Language) and XSLT (Extensible Stylesheet Language Transformations) are two complimentary languages that work with XML. XPath is a query language used to select nodes in an XML document. XSLT is a way to format XML for presentation. These are often used together along with XML and its schema. Rider contains features to help you make the most of XPath and XSLT as well as all the great features for XML.

XPath uses a pattern matching syntax, to match nodes or node values in an XML or XSLT document. To easily find a path that might be queried often, Rider has a View Unique XPath option. Use View | Unique XPath from the menu or Ctrl+Alt+X,P.

Find the unique Xpath path

Similarly, you can easily search through mountains of XML by using an XPath expression. Go with Ctrl+Alt+X,E or use the Edit menu, then Find | Find by XPath.

Find a node using XPath

Summary

Rider contains everything you need to craft high quality, well formed, XML documents, schemas, and DTDs. Even working with XPath and XSLT is more simple with Rider. So download Rider and let us know how you use it to manage all things XML.

Hacktoberfest 2020 and .NET OSS

$
0
0

Get out your dirndl and lederhosen – it’s that time of year again! We’re excited to be sponsoring Hacktoberfest 2020. Hacktoberfest is an opportunity for contributors worldwide to give back to their favorite projects in the form of pull-requests.

In this blog post, you will find out what Hacktoberfest is, as well as a nice surprise by JetBrains. But there’s more! We’ll share types of activities you can contribute, and a list of .NET projects that need your help.

Let’s start at the beginning…

📯 Hacktoberfest

For those unfamiliar with Hacktoberfest, here are the basic rules of participation.

  1. Contributors must sign up at the official Hacktoberfest site.
  2. Contributors can submit pull-requests to any GitHub-hosted repository.
  3. Contributors must have at least 4 contributions between October 1 and October 31 to complete the event.

Folks who complete the event will earn a Hacktoberfest T-shirt or tree reward, and of course, the satisfaction of knowing they helped their favorite projects.

We at JetBrains have long been champions of open-source (OSS), from contributing to hundreds of OSS projects, releasing our products as OSS, and supporting thousands of individual contributors on their OSS journeys with complimentary licenses.

This year, we’re doing something special. We’re giving participants access to our All Products Pack subscription for a whole month. Regardless of your preferred programming language, you’ll find a tool to make contributions more fun and efficient. Specifically for .NET developers, you’ll have access to ReSharper, Rider, dotCover, dotMemory, and dotPeek.

Sign up here to receive your JetBrains Hacktoberfest perks and complete the form at the bottom.

Also, join us on the official Hacktoberfest Discord channel, where we’ll be hanging out and helping folks make their first contributions.

🤷‍♀️ What do I contribute?

Uncertainty of the kinds of contribution is a strong reason folks may not feel comfortable participating in OSS. Don’t worry, many types of contributions are welcome. Here are some of our favorite ways of contributing.

✅ Create or update the readme.md

Readme.md files are the gateway to most OSS projects. Create a readme file for a project that helps individuals understand the project’s requirements, get started guide, and other vital elements. It’s surprising how many great projects miss this essential part.

✅ Documentation

Documentation is essential and can come in many forms. If the project already has a documentation system, add new content, walkthroughs, and context. If the project has no documentation, consider building a docs site using GitHub pages.

✅ Bug fixes

Many projects have a backlog of issues waiting for contributors to fix them. First, communicate with the repository owners that you’d be interested in attempting a fix. After some discussion, submit a pull request for review. It’s important always to ask first not to waste your time or the repository owner’s time.

✅ Media

You don’t have to be a coder to contribute something of immense value. Artists and designers can contribute amazing value to any project. Many of these projects could use a logo, website redesign, or even a dazzling motion graphic.

Additionally, a video walkthrough of the project makes for an outstanding contribution, especially one that repositories can link to in the readme.

🤔 Which projects should I pick?

The .NET community is in an exciting place right now, with .NET 5 right around the corner. Most first-time contributors might consider creating pull requests to the .NET Runtime or the Microsoft Documentation site, and those would be significant contributions. Those kinds of contributions can reach the most considerable amount of folks using .NET. Any contribution that helps our community is a great contribution!

We want folks to think smaller this year. While it’s tempting to get your code shipped as part of the platform we all build on top of, there are many smaller projects out there who need your help!

These smaller projects, sometimes even individually run projects, significantly impact the .NET OSS ecosystem’s health. As a community, we all benefit from the thankless days and nights spent on some of our favorite projects. These projects solve problems and gaps in our tech stack, and add to the diversity of thought in our community.

The authors of these projects have put .NET on a positive trajectory of openness and inclusion. They help vet new ideas, push us to build better software, and solve challenging problems. In support of this spirit, we recommend you contribute to community-backed projects this Hacktoberfest.

Not sure what projects are welcoming contributions? Well, we’ve compiled some of our favorites right here.

⭐️ FluentValidation

Need to validate user input? FluentValidation is a library that makes it fun and easy to check data. With an armory of prebuilt validation rules, developers can get started quickly. The library easily integrates into your favorite programming models, like ASP.NET, WinForms, and Xamarin.Forms. One of the longest-running OSS .NET projects at 11 years and used by over 5,000+ projects on GitHub.

Check it out at FluentValidation.net.

⭐️ Spectre.Console

One of the newest OSS projects on this list, Spectre.Console, brings life to an otherwise dull terminal experience. Inspired by the Rich library for Python, developers can create tables, grids, panels, and other visual elements in their console output. This library is sure to be a hit with many folks building .NET global tools.

Check it out at the GitHub Repository.

⭐️ Carter

The spiritual successor to NancyFx, this web library is a thin layer of extension methods and functionality over ASP.NET Core. Carter allows developers to write more explicit and enjoyable web applications. The library also makes an appearance on the TechEmpower Web Framework Benchamarks with an impressive performance score. Folks who may be curious about other ways to build HTTP APIs should consider contributing to this project.

Check it out at the GitHub Repository.

⭐️ Fable and the SAFE stack

Speaking about web frameworks, Fable is a solution that lets you write JavaScript applications with F#. It can target different JavaScript runtimes, like Node.js and the browser. Fable is also the front-end choice for folks building apps using the SAFE stack, which is a full-stack framework for building rich web apps using F#. Both Fable and SAFE welcome contributions, and are worth looking into if you are doing F# or are interested in it.

Check it out at their GitHub Repository (Fable).
Check it out at their GitHub Repository (SAFE stack).

⭐️ Aaru

For hardware geeks and historical preservationists, the Aaru project is a fully-featured media dump management solution.

With Aaru, you can analyze a media dump, extract files from it (for supported filesystems), compare two of them, create them from real media using the appropriate drive, create sidecar metadata with information about the media dump, and a lot of other features that commonly would require you to use separate applications.

This project has a wide array of support for many formats. Looking through the list gives us a serious case of nostalgia.

Check it out at the GitHub Repository.

⭐️ Statiq

Static site generators (SSG) are a great way to create and deliver content to the web. Some of our favorite SSG tools come from other technical communities until now. With Statiq, developers can have a powerful SSG at their fingertips powered by .NET. Content creators can use robust pipelines to process database results, API results, and flat files into a static site. Statiq is a fantastic tool for OSS developers to build their documentation site.

Check out Statiq at their official site.

⭐️ NUKE

NUKE is an open-source build automation system for C#/.NET. It runs cross-platform on .NET Core, .NET Framework, and Mono. Builds are bootstrapped with Bash or PowerShell scripts, while their actual implementation resides in simple C# console applications. Using the C# project- and type system for writing builds provides IDE features like code-completion, refactorings, and debugging. NUKE has a custom global tool, several IDE extensions, and a code-generation approach to integrate third-party tools like MSBuild or dotnet CLI.

Check it out their GitHub page. NUKE also has a first-timers tag for first-time contributors.

⭐️ ReactiveUI

ReactiveUI gives developers the power to build reactive, testable, and composable UIs using the MVVM pattern. Leveraging Observable interfaces, developers can subscribe to streams of data and react appropriately. With a healthy and welcoming community, ReactiveUI already has many places folks could contribute: documentation, samples, and issues.

Check it out at ReactiveUI.net.

⭐️ Marten

The Marten library provides .NET developers with the ability to use the proven PostgreSQL database engine and its fantastic JSON support as a fully-fledged document database. The Marten team believes that a document database has far-reaching benefits for developer productivity over relational databases with or without an ORM tool.

Marten also provides .NET developers with an ACID-compliant event store with user-defined projections against event streams.

This library is a great way to dip our toes into NoSQL and learn concepts like document modeling and CQRS.

Check it out at their Github Repository.

⭐️ Farmer

Have you been frustrated writing Azure Resource Manager (ARM) templates in JSON? Don’t be. Farmer makes repeatable Azure deployments easy by providing an F#-based DSL that is strongly typed, supports references, variables, functions, and all that. They have a TODO list, which gives some ideas on what the project would like to see as contributions. There’s also a good first issues list for those who want to help out.

Check it out at their Github Repository.

⭐️ Many others!

We have been asking folks on Twitter, and got quite a few responses from OSS projects and authors who could use a helping hand.

In no particular order:

The .NET ecosystem wants and needs your contributions! If you are a project owner or know of other .NET projects looking for contributors, please leave a link to any GitHub repository in the comments below and state the kind of assistance that may be needed.

🍻 Start Your Contributions

Remember, October 1 is the official start of Hacktoberfest, so be sure to register with the official Hacktoberfest site and remember to get your JetBrains perks.

As the authors of this blog post, both myself (@buhakmeh / khalidabuhakmeh) and Maarten (@maartenballiauw / maartenba) will be making contributions to various projects.

For those who may not have the time to contribute and participate in Hacktoberfest, please consider sponsoring these authors and their projects using their chosen sponsorship mechanisms. At a bare minimum, give these projects a star on GitHub.

Good luck, everyone, and have a happy Hacktoberfest! Prost!

Viewing all 306 articles
Browse latest View live