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

Auto-Detect Memory Issues in your App with Dynamic Program Analysis – Rider 2020.1

$
0
0

It seems that a common problem among profiling tools (including ours) is that they require too much effort from a developer. Profiling currently is seen as some kind of a last resort for when something has gone horribly wrong. The use of profilers is very episodic and chaotic, and it’s quite often ineffective because you simply can’t be an expert in a tool you use only once every six months. We find this kind of sad because we strongly believe that regular profiling is essential for product quality.

That being said, is there any solution? Well, our answer is “yes,” but with some caution. Since we can’t force people to use profilers all the time, the only possible solution is to make issue analysis automatic and move it as close to the user as possible. So, without further ado, we’re pleased to introduce Dynamic Program Analysis (DPA)!

What is Dynamic Program Analysis (DPA)?

DPA is a process that runs in the background of your IDE and checks your application for various memory allocation issues. It currently checks for closures and allocations to large and small object heaps (LOH and SOH).

If a method call allocates more than the specified threshold, DPA will mark it as an issue.

DPA. Issue highlighting

DPA starts automatically each time you run or debug your application in Rider. The allocation data is collected with almost zero overhead (slowdown is no more than 2% in large solutions with high memory traffic).

Note that DPA currently supports .NET Framework and .NET Core on Windows only.

Why trace memory allocation?

From our experience, a significant number of performance issues are related to excessive memory allocation. To be more precise, they are related to full garbage collection caused by allocations. Quite often, such allocation issues are the result of bad code design and can be easily fixed.

Here’s a simple example: using struct instead of class. If a type represents a single value and is immutable, it can be defined as a struct. Defining it as a class makes it a reference type. As a result, its instances are placed on the managed heap instead of the stack, which means the instances that are no longer needed must be garbage-collected. You can find more examples in this series of blog posts.

Of course, we don’t want to limit DPA to memory allocation analysis only. In the future, we plan to add more runtime inspections, such as HTTP and SQL request analysis.

How to enable DPA

Typically, enabling DPA doesn’t require any additional actions from your side. All you need to do is install the JetBrains ETW Host service (after the 2020.1 release, the service will be installed along with Rider). DPA will then be activated when Rider starts. That’s it!

How to work with DPA

The coolest thing about DPA is that your typical workflow is not affected in any way! If you feel like you have time to go through allocation issues in your application, simply check the DPA icon status.

Dynamic Program Analysis Workflow

In more detail:

  1. Every time you finish running or debugging your project, pay attention to the DPA icon in the status bar. If it’s red like this, DPA. Issues found , click it and choose View Issues.
  2. Go through the list of issues. At this step, you can:
    • Double-click the issue to view its stack trace.
    • Navigate from an issue to the corresponding code in the editor (with F4).
    • And navigate back (with Alt+Enter -> View related memory allocation issues).
  3. If you think that the issue can be fixed, try fixing it using our tips.
  4. After you fix the issue, run the project one more time and make sure it no longer appears on the DPA list.
  5. If you think that the issue cannot be fixed, suppress this issue. One more way to make the issue disappear from the list is to increase the memory allocation threshold. You can find more details about this in the next section.
  6. Ideally, you should get the green DPA icon, which looks like this: DPA. No issues icon.

Excluding False Positives

All programs require memory. A method may sometimes allocate a lot of memory – not because of code design, but just because this is required by the current use case.

If this is the case for just a few methods, the best solution is to suppress these issues. This is done by marking the corresponding method with the SuppressMessage attribute. To do his easily, use the quick-fix in the editor:

DPA. Suppress issues

If you’re getting a lot of false positives, then you can simply increase the memory allocation thresholds. To do this, navigate to the Thresholds tab of the Dynamic Program Analysis window and set new thresholds for each issue type.

DPA. Thresholds

Heap Allocations Viewer plugin

The Heap Allocations Viewer plugin highlights all the places in your code where memory is allocated. It’s a perfect match for DPA – together they make a perfect couple.

While the plugin shows allocations and describes why they happen, DPA shows whether a certain allocation is really an issue.

DPA and Heap Allocations Viewer plugin

Feel free to download the latest Rider EAP and give DPA a try. And of course, please leave your feedback for us in the comments below.

The post Auto-Detect Memory Issues in your App with Dynamic Program Analysis – Rider 2020.1 appeared first on .NET Tools Blog.


ReSharper Ultimate 2020.1: Improved Support for C# 8.0 and C++20, Dataflow Analysis of Integer Values, and Much More

$
0
0

Hello everyone,

ReSharper Ultimate 2020.1 is now available! We encourage you to try out the first major update this year. Read about the release highlights in this blog post, or visit our What’s New page to see a comprehensive list of improvements.

ReSharper Ultimate 2020.1 is released

This release has tons of changes to the architecture of ReSharper that bring us closer to our goal of running all the core ReSharper features out of the Visual Studio process. All these modifications took place under the hood, so you won’t notice any changes in the UI or the UX in the ReSharper 2020.1 release build. If you missed the news about our progress toward moving ReSharper out of process, this is a good opportunity to catch up and learn about where we are now.


Download ReSharper Ultimate 2020.1

Now let’s talk about the most exciting updates we have for you in the 2020.1 release.

ReSharper

Dataflow analysis of integer values in C#

Check out this new type of code analysis, which tracks how the values of all int local variables vary. It verifies the correctness of all common operations on such variables to detect useless or possibly erroneous pieces of code.

Dataflow analysis of integer values in C#

Nullable reference types

We’ve refactored a lot under the hood in C# language support to prepare code analysis and other features, such as refactorings and ReSharper Build, to support nullable reference types (NRT). In ReSharper 2020.1, code analysis reports compilation warnings related to nullable reference types and provides quick-fixes for most of them, along with a few other new inspections.

Nullable Reference Types

Other highlights

  • We’ve made a lot of improvements and fixes to XAML support that cover WPF, Xamarin.Forms, UWP, and Avalonia XAMLs.

XAML support in ReSharper 2020.1

  • Several small but useful features to Navigation will benefit you whether you prefer to use the mouse or the keyboard to interact with ReSharper. You can middle-click to Go to Declaration, use a full path in Go To File / Go To Everything to find files, or press Ctrl+Enter in the result list of Go to File to highlight the file in the Solution Explorer window.
  • You can export and import any of your Unit Test Sessions. This allows you to share them with your team, between your computers, or between branches when you change something in the code and want to run/cover the same set of unit tests for both branches.

Unit Test Sessions

  • Localization Manager: you can now leave a comment (or edit an existing one) for any value that comes from resource files right inside the grid. Several performance fixes and UX improvements will help you make the grid faster to load and filter, use right-to-left languages, navigate more precisely to specific rows from the text editor and refactoring dialogs, and more.
  • Code formatting brings new settings for C# Code Styles that cover the trailing comma.

See the full list of fixes completed in the 2020.1 release cycle on YouTrack.

ReSharper C++

ReSharper C++ 2020.1 supports several new C++20 features, including constrained type placeholders, abbreviated function templates, and using enum declarations. New coding assistance features like Rearrange Code and Complete Statement help you write and change your code more efficiently. The Introduce Using Enum and Convert to Scoped Enum refactorings offer an easy way to modernize your enum usage. Other changes include new code inspections with accompanying quick-fixes, improved code completion, and new navigation features. For game developers, ReSharper C++ introduces initial support for HLSL (the High Level Shading Language) and offers better conformance to the Unreal Engine coding standard.

High Level Shading Language Support

dotTrace

  • You can profile .NET Core applications on macOS and Linux using the Tracing profiling mode. To do this, you should use either JetBrains Rider or dotTrace command-line profiler.
  • You can attach the profiler to running .NET Core processes on Linux.
  • You can navigate through the Call Tree using the Next Important Call action. Press Ctrl+Shift+Right and dotTrace will navigate you to a node that is most relevant for further analysis. The feature is available in dotTrace Standalone (both Performance Viewer and Timeline Viewer), in Visual Studio, and JetBrains Rider.

Next Important Call action in Call Tree

dotMemory

  • We’ve implemented some bug fixes and stability improvements.
  • We’ve also reworked the internal data format. This means that dotMemory 2020.1 snapshot format is incompatible with earlier versions. At the same time, this will let us introduce some new features in the future releases.

dotCover

  • Update for the users of JetBrains Rider IDE: you can apply both runtime and coverage results filters.

dotPeek

  • The Intermediate Language (IL) Viewer supports custom attributes for interface implementations and generic parameter constraints. For example, a compiler can apply a NullableAttribute and TupleElementNamesAttribute to these entities.
  • Support for nullable reference types has come to the decompiler. Please note that this only works in declarations, not in the bodies of methods.
  • We’ve added support for decompiling the default members of interfaces and Auto-Implemented Property Field-Targeted attributes.

Decompiling the default members of interfaces

  • We’ve improved support for decompiling tuple component names.

We hope you find this new functionality handy. Share your feedback with us here in the comments, in our issue tracker, or on Twitter.


Download ReSharper Ultimate 2020.1

You can use any of these alternative ways to get ReSharper Ultimate 2020.1:

  • Update right inside ReSharper: ReSharper | Help | Check for updates
  • Use our Toolbox App.

The post ReSharper Ultimate 2020.1: Improved Support for C# 8.0 and C++20, Dataflow Analysis of Integer Values, and Much More appeared first on .NET Tools Blog.

A Story About .csproj, Large Solutions and Memory Usage

$
0
0

We discussed the motivations and our push toward running Rider on .NET Core in our previous post. As part of that effort, we are looking into converting projects in the ReSharper and Rider solution to using the new, simpler, SDK-based projects introduced with .NET Core.

In this post, we will see why we want to do this migration. We’ll talk about how we ran into some development-time issues when using the newer project style with large solutions, and how that led into finding a similar issue with the “old .csproj” format. We’ll also share a workaround with you. Let’s dive in!

Moving ReSharper and Rider to SDK-Style Project Format

SDK-style projects are built on top of the Common Project System (CPS), and are a much simpler format than the “old .csproj” format. They typically have an Sdk="..." attribute defined, which specifies the tools and additional build targets that will be loaded for a project. For .NET Core projects, the SDK will often be Microsoft.NET.Sdk or Microsoft.NET.Sdk.Web.

Referencing these SDKs simplifies project files a lot. Many details about how our project should be built are abstracted away in the SDK. In “classic” projects, all files in a project would be listed separately. In an SDK-style project, files are included by convention, and only files that deviate from default rules have to be specified in full.

SDK-style projects also make multi-targeting easier. Adding a target framework to the TargetFrameworks property in a project file is sufficient for many projects to support multiple .NET targets.  Of course, there will still be conditional dependencies, and we’ll have to use preprocessor directives to conditionally include other portions of code in many places. But overall, the project structure will become simpler, even when multiple target frameworks are involved.

Right now, we have already converted several projects to the new SDK-style project format, but it takes time to validate and verify. So while we’re nowhere near completing this migration, we do expect it to simplify our build toolchain and development process when we finish.

Migrating to using SDK-style projects is technically not required, yet it will help us compile Rider against .NET Core, while we can keep ReSharper on .NET Framework. And thanks to less complex project files, we also expect to have fewer conflicts while merging branches in our codebase!

Memory Usage with Large Solutions

As you may know, Rider shares a lot of its codebase with ReSharper. This is great, as functionality can be shared easily! For example, when we write a new code inspection, it will be available in both Rider and ReSharper. Of course, changes in the project and build infrastructure in one product, also impact the other.

The ReSharper solution consists of close to 700 projects, with many code files in each of them. For cross-project refactorings and changes, we have to work with that 700-project solution.

Our developers don’t have to open all projects in our monorepo all of the time, though. We generate smaller solution files that contain just the necessary projects to work on one product. For example, the generated Rider backend solution contains 162 projects (250 if we add unit test projects). For ReSharper, the generated solution has 294 projects:

ReSharper solution has 294 projcts

Tip: This can generate a solution with 300 projects, each containing 200 classes, if you want something that compares in size.

Our ReSharper and Rider teams work in their IDE of choice. We ran into an issue with the ReSharper code base when opening it in Visual Studio, after converting some shared projects to using the SDK-style project format. Visual Studio would be unresponsive for longer periods of time, or crash completely. Memory usage with the newer project format was also consistently higher.

Investigating the issue further, we found that this was caused by excessive allocations in the Common Project System (CPS). After taking a closer look, we found the issue was also present with the “old .csproj”, albeit slightly better – which probably explains why we did not notice it before. We reported this to Microsoft, who are looking into this based on a repro we provided.

After opening the 162-project Rider solution in vanilla Visual Studio (without ReSharper installed), the process uses ~2 GB of memory, with 1.12 GB reserved for .NET. Much of the memory usage goes to string duplicates and C# syntax trees, as we can see in dotMemory:

String duplicates, shown in dotMemory

Tip: In dotMemory, either attach to the running “devenv.exe” process and capture a snapshot, or load a memory dump file (.dmp) for further analysis.

Keep in mind that this is an IDE, where we want coding assistance and all kinds of analyzers that help us write better code, faster. That means there is a solution model that keeps track of a project tree, and that for each project all of the source code (strings) has to be parsed into syntax trees to be able to do something useful. These objects will typically be long-lived, ending up on higher memory generations. As such, the memory usage is not entirely unexpected.

Things get more interesting when we realize all this is in a 32-bit process, where memory is not unlimited. There’s a lot of memory pressure, and a lot of garbage collection going on as a result.

Reducing Memory Usage with Large Solutions

We’re working on moving ReSharper out of process to overcome part of the memory pressure problem we saw above, to make sure we’re not adding extra memory pressure. But we’re not there yet.

Our own teams are using ReSharper (and Rider) to develop ReSharper (and Rider), which means that they don’t use some of the default features in Visual Studio at design-time. ReSharper overrides them anyway, so why load them in memory?

We found a solution, or rather a workaround, to reduce the overall memory footprint of Visual Studio, by disabling some defaults:

  • Code analysis, and related quick-fixes and refactorings
  • Code completion
  • Navigation

While this cannot be done directly, we can do this by overriding how design-time builds “see” our project. By removing all items that are marked as “compile”, and instead including them as embedded resources during a design-time build, we are essentially preventing these files being included in Visual Studio’s code analysis and IntelliSense.

In MSBuild format:

<!--
  Disables Roslyn language service in Visual Studio in favor of ReSharper one.

      IT’S PROBABLY NOT A GOOD IDEA TO COMMIT THIS SNIPPET TO SOURCE CONTROL,
      UNLESS IT IS INTENDED TO ENABLE THIS TECHNIQUE FOR EVERYONE ON THE TEAM.

  Keep in mind that using this technique, code completion, code analysis,
  quick-fixes and refactorings are provided only by ReSharper. Custom Roslyn code
  analyzers will also not be available, as this technique effectively hides code
  from Visual Studio. Another side effect is that Code Lens will not be
  available.

  This file is compatible with ReSharper 2020.1 and newer.
  If you are using ReSharper 2019.2 or 2019.3, you should modify this file:
  replace: '$(JetBrainsDesignTimeBuild)' != 'true'
       to: ('$(DevEnvDir)' != '*Undefined*' OR '$(DesignTimeSilentResolution)' != 'False')

  How to use:
  One way is to name this file Directory.Build.targets and put near solution (or in parent folder).
  Another is to put this file in %LOCALAPPDATA%\Microsoft\MSBuild\Current\Microsoft.Common.targets\ImportAfter
  https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build
-->
<Project>
  <PropertyGroup>
    <DisableRoslynDesignTime Condition="'$(JetBrainsDesignTimeBuild)' != 'true' AND '$(DesignTimeBuild)' == 'true' AND '$(IsCodeSharingProject)' != 'true'">true</DisableRoslynDesignTime>
  </PropertyGroup>
  <ItemGroup Condition="'$(DisableRoslynDesignTime)' == 'true'">
    <None Include="**/*$(DefaultLanguageSourceExtension)" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" Condition=" '$(EnableDefaultCompileItems)' == 'true' " />
    <None Include="**/*.cs;**/*.vb" Condition=" '$(EnableDefaultCompileItems)' != 'true' " />

    <!-- If you have custom exclude patterns in csproj or included files, then you have to include
      these patterns here as well (to hide files from solution explorer).
      For example:
      <None Remove="ASD\*" Condition=" '$(MSBuildProjectName)' == 'MyApplication' " />
      For a full list of well-known propertes, see
      https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-reserved-and-well-known-properties
    -->

    <UpToDateCheckInput Include="@(Compile)" />

    <!-- You can write just Remove="@(Compile)" here, but it gives huge
      performance penalty. This glob is used to avoid N^2 in RemoveOperation
      https://github.com/Microsoft/msbuild/issues/2314 -->
    <Compile Remove="**/*.cs;**/*.vb" />
    <Compile Remove="@(Compile)" />
  </ItemGroup>

  <Target Name="DisableRoslynTarget" BeforeTargets="CoreCompile" >
    <PropertyGroup>
      <DisableRoslynDesignTime Condition="'$(DisableRoslynDesignTime)' == 'true' OR ('$(JetBrainsDesignTimeBuild)' != 'true' AND '$(BuildingProject)' != 'true' AND '$(IsCodeSharingProject)' != 'true') ">true</DisableRoslynDesignTime>
    </PropertyGroup>
    <ItemGroup Condition="'$(DisableRoslynDesignTime)' == 'true'">
      <None Include="@(Compile)" />
      <Compile Remove="@(Compile)" />
    </ItemGroup>
    <Warning Condition="'$(DisableRoslynDesignTime)' == 'true'"
      Text="Roslyn language services are disabled. Remove or edit $(MSBuildThisFileFullPath) file to enable it back." />
  </Target>
</Project>

(The full and recent file can be downloaded here.)

When this snippet is added into a Directory.Build.Targets file next to our solution file, this will apply to all project files in our solution. This works for SDK-style projects, and for “old .csproj” projects (MSBuild 15 or newer).

Note: It’s probably not a good idea to commit this snippet to source control, unless it is intended to enable this technique for everyone on the team.

We also recommend enabling Color Identifiers in the ReSharper options (under Code Inspection | Settings), as otherwise some highlighting may be missing.

The Results

In vanilla Visual Studio, this technique reduces memory usage by 169 MB on a 300-project sample solution we generated. The .NET memory footprint was reduced by 18%, from 909 MB to 740 MB. Using this technique in vanilla Visual Studio is obviously not the best idea, as many IDE features will stop working.

With ReSharper enabled, we’ll still have code completion, code analysis, quick-fixes, and refactorings. On a similar solution, Visual Studio with ReSharper was using 1293 MB of memory. Using this Directory.Build.Targets technique, we saw a reduction of 213 MB, or 16%, dropping memory usage to 1080 MB.

Memory usage - comparing before and after

Another solution we tried this with was the Roslyn compiler solution. It has 66 projects, but lots of code and references. Without using our Directory.Build.Targets file, managed memory usage is ~1.11 GB:

Roslyn solution - without Directory.Build.Targets file

Adding the Directory.Build.Targets file, we see a significant drop in managed memory usage! From ~1.11 GB, down to ~687 MB. That’s a 37% reduction!

Roslyn solution - with Directory.Build.Targets file

Conclusion

Keep in mind that when using this technique, code completion, code analysis, quick-fixes, and refactorings are provided only by ReSharper. Custom Roslyn code analyzers will also not be available, as this technique effectively hides code from Visual Studio. Another side effect is that Code Lens will not be available.

Should you be using this in your solutions? As always, it depends. If you are using Visual Studio and ReSharper for a solution with many projects, it never hurts to try, as long as you and your team are okay with the above constraints.

If you do use our Directory.Build.Targets file, keep us informed about how it goes! And if you encounter any issues with it, let us know here.

The post A Story About .csproj, Large Solutions and Memory Usage appeared first on .NET Tools Blog.

ReSharper Ultimate Starts Its Early Access Program for 2020.2!

$
0
0

Hello everyone,

We’re excited to introduce the first EAP build of ReSharper Ultimate 2020.2!

2020.2-Banner

Here’s what we have in store for you.

ReSharper 2020.2 EAP1

  • Nullability code analysis is learning about more cases – it can now trace the incorrect nullability through deconstruction and the foreach cycle, and it provides a quick-fix:

Nullability-fix

  • Context actions for converting foreach to LINQ and LINQ to code are available on IAsyncEnumerable<T> as well – just install the System.Linq.Async NuGet package for your project.

Foreach-to-LINQ-async

  • Support for default implementations in interfaces has gotten better: our indicators show that a method is implemented and overriden, and our refactorings and navigation are now smarter about this language feature.
  • Good news for UWP developers: support for compiled bindings with x:Bind is finally on its way! ReSharper resolves the x:Bind code correctly and offers inspections and quick-fixes – for example, for missing property setters or overload collisions. More improvements are coming, and we welcome your feedback in our public issue tracker.

x-Bind-support

  • In 2020.1, Rider migrated from Mono to .NET Core on macOS and Linux. One of the many advantages of this move is that you can now install ReSharper Command Line Tools as a .NET Core global tool. Run the following command to install them:
    dotnet tool install -g JetBrains.ReSharper.GlobalTools --version 2020.2.0-*

    And run the tool with jb tool_name [options], for example:
    jb inspectcode yourSolution.sln -o=&lt;pathToOutputFile&gt;

    Because Command Line Tools now run on .NET Core, they no longer come with Mono bundled. Please note that the tools for macOS and Linux now require .NET Core 3.1.
  • Navigating to usages of types from external assemblies in your code is now much easier. ReSharper can take you straight from Go to Type search results to Find Usages. Search for the type you’re interested in, highlight it in the list with keyboard or mouseover, and call Find Usages or Go to Usage by using their respective shortcuts. Here’s an example:

Actions from Go to Symbol

    Other actions, such as calling quick documentation, are also now available from Go to Symbol and Go to File Member using shortcuts.
  • Inlay hints are now available in XAML code too. We provide hints for markup property names and DataContext, as well as for margins and paddings, which can be handy if you don’t want to memorize their orders.

Inlays in XAML

  • For .editorconfig users, we’ve taught ReSharper to follow dotnet_diagnostic rules. Specify the severity of inspections in your .editorconfig file, i.e. dotnet_diagnostic.CS1058.severity = hint, and ReSharper will display those inspections accordingly.
  • Our Blazor support is getting better all the time – we’ve eliminated a lot of known erroneous red code and improved performance.
  • And we’ve implemented a variety of performance updates for code cleanup.

Interested in fixed issues more than new features? Visit this page to see all the closed requests.

ReSharper C++ 2020.2 EAP1

The main highlights of the ReSharper C++ 2020.2 EAP1 build are:

  • For Unreal Engine, ReSharper C++ introduces experimental support for the Unreal Engine project model, new inspections, and improvements for Find Usages and code generation. Also, it is now in better alignment with the UE code style:

unreal_override_virtual-updated2

  • C++/CLI support has new inspections for gcnew and final and searches for inheritors and usages in C# code too.
  • For code style and formatting, ReSharper C++ provides settings for multiline ternary operators and sorting of include directives.
  • Other improvements include a preview for small quick-fixes, better evaluation of constexpr functions, new file templates, and more.

Please refer to this separate blog post for an overview of all the C++ changes we’ve made in the first EAP.

dotPeek 2020.2 EAP1

As usual, dotPeek continues to improve its support for the most recent versions of C#. In dataPeek 2020.2 EAP1, the decompiler engine now supports:

  • Expression-bodied members.
  • Throw expressions.
  • Default parameters and named arguments.

Additionally, NuGet packages are finally sorted alphabetically in the Assembly Explorer.

And last but not least, the “Generate PDB” engine now infers and stores the tuple component names for local variables.

dotMemory 2020.2 EAP1

The dotMemory Command-Line Profiler has come to macOS and Linux to help you analyze memory usage in your .NET Core applications. We are going to publish a related blog post soon that will provide more detailed information about it. For now, you can run ./dotMemory.sh help for a list of available commands and arguments.

As for standalone dotMemory, you can now open all pinned objects as a separate object set.

We’d love to hear your feedback!

Download ReSharper Ultimate 2020.2 EAP

Note: In 2020.2, we change the way third-party tools should be integrated with JetBrains .NET tools: dotTrace, dotMemory, and dotCover. If you are a developer of such a tool, please update the integration according to the following articles: dotTracedotMemorydotCover.

The post ReSharper Ultimate Starts Its Early Access Program for 2020.2! appeared first on .NET Tools Blog.

Memory profiling on Linux and macOS with dotMemory 2020.2

$
0
0

Version 2020.2 EAP01 finally brings dotMemory to Linux and macOS! For these systems, dotMemory is currently available only as a command-line tool. The tool is free and lets you take and save memory snapshots. To analyze the snapshots, you still need the standalone version of dotMemory, which is only available on Windows.

What you can profile

Here’s the dotMemory compatibility list for Linux and macOS:

dotMemory compatibility on macOS and Linux

How it is distributed

The command-line tool is distributed in two forms:

  • A .tar.gz archive (macOS | Linux): Download it from the JetBrains website, unpack, and run dotMemory.sh with the required arguments.
  • A NuGet package at nuget.org (macOS | Linux): Using this could be more convenient in automation scenarios (e.g. on a CI/CD server): reference the package in your project, and run nuget restore to get the tool on your server.

How to use it

If you have already used the dotMemory command-line profiler on Windows, you will find almost no differences (the only difference is the reduced set of commands, as some types of apps like IIS are not available on Linux and macOS). For those who haven’t, let’s go through the basics.

Get a snapshot of a running .NET Core app

The fastest way to get a snapshot of a running process is to use the get-snapshot command. For example, this command takes gets a snapshot of the process with ID 5589:
./dotMemory.sh get-snapshot 5589

Run a .NET Core app under profiling

Note that to perform get-snapshot, dotMemory has to attach to the process, and therefore it has the same limitations as the attach command: it’s applicable only to processes that use .NET Core version 3.0 or later on Linux or .NET 5 on macOS. So, to profile an app that uses .NET Core 2.2 or earlier, you should run this application under profiling with the start-net-core command. For example:
./dotMemory.sh start-net-core MyKestrelAspApp.dll

But how can you get snapshots? One of the ways is to send commands to dotMemory’s stdin. For example, to get a snapshot, send:
##dotMemory["get-snapshot"]

Running dotMemory on macOS

Another way to get a snapshot is to set a condition for taking the snapshot. This can be great for monitoring applications. For example:

  • ./dotMemory.sh start-net-core --trigger-timer=10h MyKestrelAspApp.dll
    This will start MyKestrelAspApp.dll and take snapshots every 10 hours.
  • ./dotMemory.sh start-net-core --trigger-mem-inc=50% --trigger-delay=5s MyKestrelAspApp.dll
    This will start MyKestrelAspApp.dll and take snapshots when memory consumption increases by 50% compared to when the profiling session started. The 5-second delay is used to ignore the application’s startup activities.

We invite you to download the tool and try it on Linux and macOS for yourself. As always, your comments are greatly appreciated.

P.S. If you are looking at other possibilities for profiling your code, take a look at dotMemory self-profiling API. It lets you profile your application right from the source code, is distributed as a NuGet package, and works on all platforms.

The post Memory profiling on Linux and macOS with dotMemory 2020.2 appeared first on .NET Tools Blog.

The Developer Ecosystem in 2020: Key Trends for C#

$
0
0

At JetBrains, we make tools for developers, so we keep up with the latest trends and changes in the software development industry. We build many IDEs based on multi-platform software product lines for various programming languages.

Our Developer Ecosystem Survey, which JetBrains runs yearly, aims to reveal the current ambience of the developer world. Today we are happy to share with you the results of the 2020 edition of this survey, focusing on C#.

VIEW THE STATE OF DEVELOPER ECOSYSTEM 2020 REPORT

Top C# Discoveries


C# developers largely keep up to date
, with roughly half of all C# developers working in version 8. While many still support legacy C# codebases, the results show that all previous versions of C# have fewer developers this year than they did last year. C# 7 is down to 48% from 63%, and C# 6 is down to 27% from 39%, both showing significant drops in usage.

C# versions

The most popular C# runtime is .NET Framework! While C# developers keep their language skills up to date, many haven’t migrated to .NET Core, yet. However, .NET Core is gaining popularity as 57% of C# developers use it regularly. We suspect that .NET Core will become more popular next year than .NET.

Runtimes used

Web developers who create ASP.NET web apps have been the largest group of developers in the .NET development world for some time now. So it’s no surprise that ASP.NET Core is the most popular framework (55%), and ASP.NET MVC is still quite popular (42%). However, ASP.NET MVC has become less popular over time. On the desktop side, the majority of developers use Windows Forms (31%), followed closely by WPF (26%). Framework usage is rather similar to that of last year’s survey, with nearly identical percentages of usage for each framework.

Frameworks used

There’s no surprise in the answers to this question! Overwhelmingly, C# developers run Windows – 92% to be exact. Sure, Microsoft has gone cross-platform in recent years, however, enterprise development hasn’t necessarily followed suit, so Windows remains the platform of choice in this realm.

Windows OS is popular

Visual Studio is still the IDE used by most people, but we can see it’s being challenged by Rider and VS Code. Visual Studio for Mac is at 2%, and with 14% of people using macOS, it seems that Visual Studio is not the default choice for Mac developers.

IDEs and editors

As far as unit testing goes, MS Test took a fairly large drop since last year, from 36% to 20%. NUnit and XUnit are similar in popularity this year, with 37% of developers using NUnit and 32% using XUnit. Both frameworks have gained a following in the past year of a few percentage points each. This year, 16% of developers didn’t respond to the question, implying that they don’t test at all.

Unit testing

The raw data (obviously, anonymized) will be published later, so you can investigate and analyze it deeper on your own. If you have any comments or thoughts on the C# or .NET facts presented here, share them in the comments below!

Your .NET Team
JetBrains
The Drive to Develop

The post The Developer Ecosystem in 2020: Key Trends for C# appeared first on .NET Tools Blog.

Webinar – Advocates on Rider – Uncovering the IDE That Gets You Places

$
0
0

Join us Tuesday, June 25, 2020, 16:00 – 17:30 CEST (10:00 AM – 11:30 AM EDT or check other timezones) for our free live webinar, Advocates on Rider – Uncovering the IDE That Gets You Places, with our developer advocates Rachel, Matthias, Matt, Khalid and Maarten.

Register now!

In this webinar, join JetBrains .NET developer advocates Rachel, Khalid, Matthias, Matt and Maarten, who will be demoing Rider. They will show you their favourite tips and tricks, uncovering how they work with Rider. Expect smooth navigating through a code base, writing and editing code, inspections, a look at debugging, ASP.NET Core, database functionality, and much more.

We also want to hear from you! During registration, or using the comments on this blog post, ask us your “how to” questions, and we will try to include them in this webinar!

(more…)

ReSharper 2020.2 Roadmap

$
0
0

We recently published the Rider 2020.2 roadmap, as well as the ReSharper C++ 2020.2 roadmap, and we’d now like to bring you up to speed with what we’ve got planned for ReSharper 2020.2 in .NET.

As ever, please be aware that this list is preliminary. These are the broad areas we’re working on, and a list of our priorities, but things can change before release. With that disclaimer out of the way, let’s take a look at what’s coming!

(more…)


.NET Annotated Monthly | June 2020

$
0
0

This month in computing history: In 1977, Apple shipped the Apple II. In 1995 Spyglass went public! Ahhh, the good old days. If you’ve been around for far too many decades in this field (like me), raise your hand if you remember Spyglass Mosaic! It’s not a thing anymore but it Mosaic was a key player in the evolution of browsers on the world wide web.

.NET Annotated Monthly newsletter by JetBrains!

(more…)

ReSharper Ultimate Starts Its Early Access Program for 2020.2!

Rider 2020.2 Early Access Program Begins!

$
0
0

Today we’re starting the Rider 2020.2 release cycle. Already in this first EAP build, Rider’s got several new goodies to help you in your daily coding routine.

blog-RD20202-EAP

Let’s dive in!

GitHub Pull Requests support

Support for Full GitHub Pull Requests is finally here! You’ll be able to browse, assign, manage, and even merge pull requests, view the timeline and in-line comments, submit comments and reviews, and accept changes.
(more…)

Memory profiling on Linux and macOS with dotMemory 2020.2

$
0
0

Version 2020.2 EAP01 finally brings dotMemory to Linux and macOS! For these systems, dotMemory is currently available only as a command-line tool. The tool is free and lets you take and save memory snapshots. To analyze the snapshots, you still need the standalone version of dotMemory, which is only available on Windows.

What you can profile

Here’s the dotMemory compatibility list for Linux and macOS:

dotMemory compatibility on macOS and Linux
(more…)

Introducing Pausepoints for Unity in Rider 2020.2

$
0
0

We’ve only just started the EAP for Rider 2020.2, but it’s already got plenty of goodies for Unity development. For example, we’ve done a huge amount of work to reduce memory overhead when parsing your assets, and Rider will now find usages and show Inspector values of more types, methods and fields, even inside prefab modifications!

But today I’d like to introduce a new feature that we’re really excited about, a feature that you never knew you needed, but we think you’re going to love!

We’re calling it a “pausepoint” and it’s a special kind of breakpoint that doesn’t stop the debugger in Rider. Instead, when it’s hit, it will switch the Unity Editor into pause mode, allowing you to inspect your game, make modifications and resume when ready.

(more…)

Webinar – How to stop worrying and adopt nullable reference types

$
0
0

Join us Thursday, July 9, 2020, 16:00 – 17:00 CEST (10:00 AM – 11:00 AM EDT or check other timezones) for our free live webinar, How to stop worrying and adopt nullable reference types, with Andrey Dyatlov.

Register now!

Nullable reference types is a deceptively simple feature. While starting with it is as easy as adding a single ? mark to your source code, migrating large code bases has been proven to be a tedious and sometimes quite tricky task especially when complex code contracts and generics are involved.

The presentation will quickly cover what benefits this feature brings to the table, how it differs from JetBrans.Annotations attributes and how it evolved since its original release almost a year ago.

I will show a couple of ways to ease migration of large code bases to nullable reference types and how you can start to benefit from the feature immediately without putting any effort into annotating your code base just yet. I will also outline the most common pitfalls and explain how to deal with generics and potential analysis shortcomings as well as how to guide the compiler through complex code contracts to get the most out of this feature.

(more…)

The Developer Ecosystem in 2020: Key Trends for C#

$
0
0

At JetBrains, we make tools for developers, so we keep up with the latest trends and changes in the software development industry. We build many IDEs based on multi-platform software product lines for various programming languages.

Our Developer Ecosystem Survey, which JetBrains runs yearly, aims to reveal the current ambience of the developer world. Today we are happy to share with you the results of the 2020 edition of this survey, focusing on C#.

VIEW THE STATE OF DEVELOPER ECOSYSTEM 2020 REPORT

(more…)


A Guide To Migrating From ASP.NET MVC to Razor Pages

$
0
0

The Model-View-Controller (MVC) pattern is inarguably a successful approach to building web applications. The design gained popularity in many tech communities, implemented in frameworks like Ruby on Rails, Django, and Spring. Since April 2, 2009, Microsoft has offered developers the ability to create MVC pattern web applications with the release of ASP.NET MVC. The approach leans heavily on the ideas of convention over configuration, and with conventions come ceremony. The ceremony can come with an overhead not necessary for less complicated apps.

With the release of .NET Core 2.0, ASP.NET developers were introduced to Razor Pages, a new approach to building web applications. While it can be reminiscent of WebForms, the framework learns from the decade of experience building web frameworks. The thoughtfulness put into Razor Pages shows with its ability to leverage many of the same features found in ASP.NET MVC.

In this post, we’ll explore an existing ASP.NET MVC application, begin to migrate it to Razor Pages, and see where Razor Pages may not be a good fit. (more…)

Advocates on Rider – Uncovering the IDE That Gets You Places – Webinar Recording

$
0
0

The recording of our June 25 webinar, Advocates on Rider – Uncovering the IDE That Gets You Places, with our developer advocates Rachel, Matthias, Matt, Khalid and Maarten, is now available. Subscribe to our community newsletter to receive notifications about future webinars.


In this webinar, join JetBrains .NET developer advocates Rachel, Khalid, Matthias, Matt and Maarten, who will be demoing Rider. They will show you their favourite tips and tricks, uncovering how they work with Rider. Expect smooth navigating through a code base, writing and editing code, inspections, a look at debugging, ASP.NET Core, database functionality, and much more.

(more…)

.NET Annotated Monthly | July 2020

$
0
0

July brought some special events to computing history. IBM announced the Model 650 Computer in 1953. In 1968 Intel was officially founded – and since, IBM has been using Intel chips in their personal computers. Computing history would be much different, and probably a lot less useful without chips from Intel or influence from IBM. Fun fact: Gordon Moore, one of the founders of Intel is responsible for Moore’s Law.

.NET Annotated Monthly newsletter by JetBrains!

.NET news

.NET tutorials and tips

What is Entity Framework in ASP.NET MVC – Asma Khalid demonstrates the what and how of ASP.NET MVC.

Visualizing ASP.NET Core endpoints using GraphvizOnline and the DOT language – This is an excellent and quite useful post by Andrew Lock showing how to visualize ASP.NET Core endpoints.

Learn how you manage routing in Blazor for .NET Core and VS Code – Check out this nice post by Chris Noring, showing you how to manage routing in Blazor.

Remote debugging Windows containers with Rider – Joost Meijles dives into debugging Windows containers, with Rider!

Dynamically Build LINQ Expressions – Jeremy Likness’ post on dynamically building LINQ Expressions will prove to be quite useful. It’s the kind of thing that many developers need to do, but have difficulty implementing.

Run Azurite in Docker with Rider and keep Azure Storage data local to a solution – Have you seen Azurite yet? How about running it in Docker? Let Maarten Balliauw show you!

Parse Markdown Front Matter With C# – Markdown! It’s a favorite way to whip up docs quickly. So this post by Khalid Abuhakmeh details how to parse it in C#.

Elastic Jobs in Azure SQL Database (2 Part series) – SQL is an important part of .NET development. Start with Part 1 by Anna Hoffman & Marisa Brasile and learn everything you need to know about Elastic Jobs in Azure SQL Databases.

On simplifying null validation with C# 9 – Everyone wants to make things like null check simpler. This post by Dave Brock shows you how.

5 useful Xamarin Forms Snippets – They are useful! Check out these Xamarin Forms snippets by Damien Doumer.

ASP.NET Core MVC API: How to Perform a Partial Update using HTTP PATCH Verb – This is valuable information for those times when you need to do something different, such as a partial update in a CRUD app. David Grace gives us the knowledge to get that done in this post.

Deploying ASP.NET Core Web Applications to Docker – Shipping is a feature! Bjoern Meyer writes about how to do it with Docker.

It’s all in the Host Class: Dependency Injection with .NET (Part 1) and Configuration (Part 2) – Christian Nagel reveals everything you need to know in this 2 Part series about the Host Class in .NET.

3+1 ways to manage state in your Blazor application – We strive for stateless apps but we also need to store data for each session. John Hilton shows us how to manage it in Blazor.

XML + JSON Output for Web APIs in ASP .NET Core 3.1 – Shahed Chowdhuri strikes again, with this excellent post on XML + JSON output for Web APIs.

Unraveling the Azure Maya Mystery and building a world – Ok, it’s not .NET per se, but Jen Looper has created this fun Azure Maya Mystery using Azure and Vue.JS. It’s great so check it out!

Integration of Azure Data Explorer with Cosmos DB for near real-time analytics – Azure Data Explorer and CosmosDB are now important facets if .NET development in the cloud. Let Minni Walia show you how to run near real-time analytics for it.

Events, community and culture

Struggling To Focus? How To Be Accountable While Working Remotely – Emily Whitten demonstrates how to do remote work well.

Dismantling barriers to participation in programming communities with Dr. Denae Ford – The software development industry has long been plagued by gatekeeping and unwelcoming communities. In this podcast, Scott Hanselman talks to Dr. Denae Ford about how to involve more folks by dismantling the barriers.

Does A 4-Day Workweek Actually Increase Productivity? – Well, does it? Microsoft Japan and other companies are trying it. In this blog post, Suzanne Zuppello has some thoughts about it. What do you think?

Random interesting and cool stuff

Contribute To The Top 10 Impactful .NET OSS Projects 2020 – Folks are always looking for OSS projects. Whether you’re new to OSS or an OSS pro, here are the top 10 impactful projects you might consider contributing to.

The ASP.NET Monsters [Dave Paquette, Simon Timms, James Chambers] .NET podcast. – These guys are fun and knowledgeable, and it’s definitely worth it to listen to their podcast.

And finally…

Here’s a chance to catch up on JetBrains news that you might have missed:

Check out this fantastic offer! CODE Magazine is offering a free subscription to JetBrains customers!

If you have any interesting or useful .NET or general programming news to share via .NET Annotated Monthly, leave a comment here, email me at rachel.appel@jetbrains.com, or drop me a message via Twitter.

Subscribe to .NET Annotated!

Getting Started with Rider for Unreal Engine

$
0
0

Getting started with Rider for Unreal Engine is quick and easy. This video will take you through the initial steps, getting the app installed once you’ve registered and installed, and setting Rider as the default source code editor for Unreal. You’ll be introduced to the two main keyboard shortcuts that are the entry points to Rider’s advanced feature set, and see what Unreal plugins are required to get the most out of Rider, such as integrating Rider with Unreal Blueprints. Register to download your copy at jb.gg/unreal.

JOIN THE EARLY PREVIEW

Your Rider team
JetBrains
The Drive to Develop

Case Study – How MRstudios Uses Rider

$
0
0

MRstudios - Industrial VR/AR solutions - Uses JetBrains RiderToday, we would like to share with you how MRstudios is using JetBrains Rider. They have a team of software developers, visual effects artists and 3D artists, working together to develop real-time 3D applications for the manufacturing industry.

We spoke with Thomas Weiss, Technical Director and Co-Founder of MRstudios.

Hi Thomas! Can you tell us a little more about yourself and MRstudios?

I am the Technical Director and Co-Founder of MRstudios, a company I established with my friend Morten in Berlin in March 2016. In 2017, we incorporated the company in Prague. I have a Master’s degree in Computational Visualistics and 10+ years of experience in the fields of offline and real-time rendering.

MRstudios specializes in the development of real-time 3D applications for the manufacturing industry. We are proud to be considered one of the market leaders in Industrial Virtual and Augmented Reality solutions in German-speaking and Nordic markets.

What size is your team at MRstudios, and how large is the company?

Today, our team consists of more than 10 people, including software developers, programmers, visual effects artists, 3D artists, and a strong business development and operations team.

What is your current technology stack, and what types of projects do you work on?

We mainly work with game development tools such as 3ds Max, Blender, Photoshop, Quixel, Substance Painter, Git, and Unity. We use these tools to create interactive 3D experiences such as Virtual, Augmented, and Mixed Reality software applications – engineered from concept to completion, as we like to say.

This means that we cover the entire value chain, supporting clients all the way from the very early brainstorming stages through to rolling out a VR/AR strategy in corporations with thousands of staff members globally.

Our projects are usually targeted at technical training, sales and marketing, and product development. We are also increasingly supporting clients with highly complex systems, such as linking Unity-based software with enterprise cloud systems. The goal is always the same: speaking the language of our clients and making their life as easy as possible by adding to their existing channels and software architecture.

MRstudios - HVAC products

Are all your developers on the same operating system?

No, our developers are completely free to use whatever operating system they like the most. We don’t force them to use a strict framework. If someone doesn’t like Windows, which can happen, why can’t they use Linux? The same applies to Android or Apple devices.

Independent of the system applied, we have ISO27001 security protocols in place, which is highly valued by our industrial clients.

Why did you switch to Rider for your Unity development? How has it helped your team?

Using Visual Studio as an IDE in combination with Unity is better than using MonoDevelop, but a proper connection between the tools was still missing. The first time I heard of Rider was at Unite 2018 in Berlin. Back then I was very curious about it, but I wasn’t ready to switch from my existing development environment to something that I barely knew.

In the beginning of 2020, we had a lot of internal discussions on how to optimize and streamline our existing workflows as everyone was using different development tools such as Visual Studio, Visual Studio Code, Xcode, Sourcetree, and the like. This was the moment Rider was reintroduced.

Thanks to Rider, we now have a common tool that runs on all three major platforms, has a beautiful Git integration, and comes with perfect support for Unity. Since the introduction of Rider, the code quality and readability has significantly increased. Coding has never been this fast and easy as it is with Rider.

Did you face any issues switching from Visual Studio to Rider? What kind of experience did you have using a different tool?

Switching to Rider was flawless. Even commonly used shortcuts could be easily transferred. Switching your IDE is usually a very difficult process as it means you must adapt to a new user interface and a different environment.

You never know how Unity is going to react to a new IDE or whether you will encounter complications due to incompatibilities. We have discovered more and more tools within Rider that have helped us develop applications faster and in a more structured manner.

What does your typical development flow look like? How much time do you spend in Unity, and how much in Rider?

Given that we already have a 3D model that we can interact with, we start with the implementation of basic interactions like camera movements, animations of the model itself, and the like.

The user interface is developed during the 3D modeling phase, so optimally we can already start implementing it and making it interactable next to the implementation of the basic interactions. At this stage, client reviews are usually coming in and need to be implemented, so it is a back-and-forth between Unity and Rider depending on whether the changes affect the model or the interactions.

Toward the end, the development shifts to Rider, since the model and the visuals are already final. Implementing localization and backend connections is one of the last steps and Rider-only.

What do you think of the link between Rider and Unity?

My colleagues and I had never seen an IDE that could communicate with Unity in such a flawless and intuitive way. Code compilation in the background is a massive game changer. The usage information of methods and variables is very helpful. Code completion and automatic implementation of UnityEvents speeds up the whole workflow when working with the Unity EventSystem.

On top of all these features is the visually appealing integration of Git. Ultimately, well-developed code should be a feast for the eyes, too, shouldn’t it?

Has your coding style or architecture changed with better tooling support?

Definitely! Everyone comes from a different development background and has different methods for writing readable code. Rider tries to smooth out such differences by basically enforcing certain standards like naming conventions. Aside from this, it is the simple refactoring of if-statements, highlighting unused variables or methods, and the easy definition of namespaces.

We are to some extent a German company as both founders are from there, so we appreciate very well-structured coding environments. Rider supports this approach directly and indirectly, even if you have team members who tend to be, let’s say, a bit more liberal with their coding.

What are your favorite Rider features that help you on a daily basis?

In a nutshell:

Are you aware of our Early Access Preview versions, and do you use them?

No, but I would like to try them out.

Note from JetBrains: you can download and install the Early Access Previews of Rider, or use the Toolbox App and install stable Rider and EAP versions side by side.


We’d like to thank Thomas and MRstudios for taking part in this Q&A.

If you use JetBrains IDEs and would like to share your experience with us, please let us know by leaving a comment below or contacting us.

Viewing all 307 articles
Browse latest View live