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

ReSharper Ultimate 2018.2 Release Candidate

$
0
0

ReSharper Ultimate 2018.2 RTM is just around the corner, which is why we’ve just published the ReSharper Ultimate 2018.2 Release Candidate.

If you’ve opted in for our Early Access Program, you’re already aware of the coming updates. If not, let me highlight the most important ones:

  • ReSharper 2018.2 speeds up EditorConfig support and decreases solution loading times, gets an integrated spell checker, fully supports C# 7.3, and lints your JS/TS code using JSLint, ESLint, and TSLint. We’ve also introduced initial Blazor support, added a colored Parameter Info popup, improved the UI for navigation and refactorings, and enhanced the formatter engine.
  • ReSharper C++ 2018.2 adds highly requested support for C++/CLI and deepens its understanding of many new features from C++17 and the upcoming C++20.
  • dotCover 2018.2 gets an updated console runner which can now be used as an extension to .NET command-line tools (dotnet.exe).
  • dotTrace 2018.2 gets an include filter for configuring the profiling of an arbitrary .NET process.
  • dotMemory 2018.2 can profile ReSharper run configurations, and the timeline graph shows instant memory allocation to the Large Object Heap.
  • dotPeek 2018.2 improves navigation to interfaces, enums, and any types that have no method implementations.

Wait no more as this is the last chance to check out all the new features and improvements before they hit RTM.

We’d love to hear your feedback on the ReSharper Ultimate 2018.2 Release Candidate.

The post ReSharper Ultimate 2018.2 Release Candidate appeared first on .NET Tools Blog.


ReSharper Ultimate 2018.2 hits RTM

$
0
0

ReSharper and our other .NET tools have just become even more Ultimate. Please welcome ReSharper Ultimate 2018.2!

ReSharper Ultimate 2018.2 hits RTM

Let’s have a look at the key changes this release brings to the table:

  • Performance improvements: We’ve made about 30 performance fixes in different parts of ReSharper, from speeding up EditorConfig support to decreasing solution loading times. Please see this blog post series dedicated to ReSharper 2018.2 for more details.
  • C# 7.3 support: ReSharper finally supports all features from the latest C# 7.3. New inspections and appropriate quick-fixes are here to make your code C# 7.3 compatible.
  • JSLint, ESLint, and TSLint support: These three great static analysis tools have been integrated into JavaScript/TypeScript code analysis to provide additional inspections and corresponding quick-fixes.
  • Integrated spell checking with ReSpeller: 2018.2 comes with spell-checking functionality out of the box, enabled for most of the supported languages.
  • Initial Blazor support: Even though Blazor is declared experimental for now, we’ve added initial support for this promising framework in ReSharper. For instance, code completion includes all the possible directives, e.g. page (routing), inject (service injection), and function (component members).
  • The Parameter Info popup and the Summary tooltip for IntelliSense: When using code completion in C# or VB.NET, ReSharper displays parameter types and method return types in a different color, making it easier to visually identify method overloads.
  • Navigation improvements: Now you can exclude files by mask from all Search & Navigation features, and find function signatures copied from dotTrace’s or Visual Studio’s call stack view in Search Everywhere. File Structure, Containing Declaration, and Next/Previous Members now take local functions into account.
  • The formatter engine update: Comments in a code file that override formatter settings can be generated automatically. The presentation for formatting rules which come from a StyleCop configuration file has been improved.
  • Refactorings UI update: Several ReSharper refactorings have been moved to the new presentation framework, which will yield many benefits in the coming future thanks to a unified control behavior for ReSharper and Rider. As for visible UI changes, most noticeable ones are code completion available in Change Signature and a better presentation for Extract Method.
  • Other features: Fix-in-scope quick-fixes now have more granular fixing scopes; the code style for Built-in Type has been improved; there’s a new option to execute BeforeBuild and AfterBuild targets for skipped projects in ReSharper Build; and a new inspection was added to highlight misplaced text in XAML.

For more details, please refer to the What’s New in ReSharper page. In addition to enhancing performance and adding new features, we’ve fixed more than 350 requests in YouTrack.

Other tools from ReSharper Ultimate family also get an update:

  • ReSharper C++ 2018.2 adds highly requested support for C++/CLI and deepens its understanding of many new features from C++17 and the upcoming C++20, including class template argument deduction, fold expressions, coroutines, and more. Code analysis is augmented with spell-checking inspections powered by the bundled ReSpeller plugin, as well as formatting inspections that help you maintain a consistent code style.
  • dotCover 2018.2: in addition to Visual Studio, dotCover is now part of the JetBrains Rider IDE on Windows. Currently, there are two main features supported: code coverage analysis of unit tests and continuous testing. dotCover console runner also got an update: now, it can be used as an extension to .NET command-line tools (dotnet.exe). For example, you can run coverage analysis of unit tests by running: dotnet dotcover test
  • dotTrace 2018.2 is mainly about performance improvements with one more feature that made it into the release. When configuring the profiling of an arbitrary .NET process, you can now set an include filter and have dotTrace attach itself only to the process that matches the filter.
  • dotMemory 2018.2 finally gets the ability to profile ReSharper run configurations, which makes it possible to profile not only your startup project, but any arbitrary executable, or even any static method. The timeline graph (the one you see during profiling) is also improved: not only is it available for all types of apps including .NET Core and ASP .NET Core, but it also contains a new Allocated in LOH since GC chart. The chart shows instant memory allocation to the Large Object Heap and can be very helpful in detecting excessive allocations of large objects.
  • dotPeek 2018.2 improves navigation to interfaces, enums, and any types that have no method implementations.

Download ReSharper Ultimate

We’d love to learn more about your experiences with ReSharper Ultimate 2018.2 and hear your feedback!

The post ReSharper Ultimate 2018.2 hits RTM appeared first on .NET Tools Blog.

Webinar – Advanced .NET Debugging Techniques from a Real-World Investigation

$
0
0

You know how it feels. After releasing a new version, a service starts behaving in an unexpected way, and it’s up to you to save the day. But where to start?

Join us Tuesday, September 25th, 16:00 – 17:00 CEST (10:00 AM – 11:00 AM EDT or check other timezones) for our free live webinar, Advanced .NET Debugging Techniques from a Real-World Investigation, with Christophe Nasarre and Kevin Gosse.

Advanced .NET Debugging Techniques from a Real-World Investigation

Criteo processes 150 billion requests per day, across more than 4,000 front-end servers. As part of the Criteo Performance team, our job is to investigate critical issues in this kind of environment.

In this talk, you will follow our insights, mistakes and false leads during a real world case. We will cover all the phases of the investigation, from the early detection to the actual fix, and we will detail our tricks and tools along the way. Including – but not limited to:

  • Using metrics to detect and assess the issue;
  • What you can get… or not from a profiler to make a good assumption;
  • Digging into the CLR data structures with a decompiler, WinDBG and SOS to assert your assumption;
  • Automating memory dump analysis with ClrMD to build your own tools when WinDBG falls short.

To attend this webinar, register here.

About the presenters:

Christophe Nasarre
In addition to developing and shipping software on Microsoft stacks for 25+ years, Christophe Nasarre has been working as a technical reviewer for MSPress, Addison-Wesley and other publishing companies since 1996 on books such as “CLR via C#” and the last editions of Windows Internals.

He is providing tools and insights on .NET and Windows development via his blog. Christophe also presented technical sessions on stage both internally at Microsoft or for ISVs and customers at public events such as Microsoft TechDays Paris.

Kevin Gosse
Kevin Gosse has been using Microsoft .NET technologies for 10 years, across client, server, and mobile applications. He is currently employed at Criteo, where he works on scalability, debugging, and optimization issues.

The post Webinar – Advanced .NET Debugging Techniques from a Real-World Investigation appeared first on .NET Tools Blog.

ReSharper Ultimate 2018.2.2 is released!

$
0
0

Today, we’ve published one more bug-fix update to v2018.2 – ReSharper Ultimate 2018.2.2 is here!

Let me highlight the most notable changes in ReSharper 2018.2.2:

  • More than 20 bugs were eliminated across various Refactorings.
  • Fixes in XAML support include RSRP-471234, RSRP-471373, and RSRP-471345.
  • A dozen or so bug-fixes affecting Unit Testing were implemented.
  • We fixed a load of issues in Code Analysis.

To read more about all the changes in this build, please refer to our issue tracker.

ReSharper C++ 2018.2.2 updates the spell-checking inspection to skip commands in documentation comments. It also fixes two important issues where ReSharper C++ could sometimes fail to parse files with complicated macro expansions, and where it missed some usages when performing usage search. Check out this page for the full list of fixes.

Other ReSharper Ultimate tools have addressed some bugs as well: see fixes for dotCover 2018.2.2, dotMemory 2018.2.2, dotTrace 2018.2.2, and dotPeek 2018.2.2.

Come and grab the ReSharper Ultimate 2018.2.2 build to enjoy all the latest fixes!

The post ReSharper Ultimate 2018.2.2 is released! appeared first on .NET Tools Blog.

Advanced .NET Debugging Techniques from a Real-World Investigation – Webinar Recording

$
0
0

The recording of our September 25th webinar featuring Christophe Nasarre and Kevin Gosse is now available.

You know how it feels. After releasing a new version, a service starts behaving in an unexpected way, and it’s up to you to save the day. But where to start? Criteo processes 150 billion requests per day, across more than 4,000 front-end servers. As part of the Criteo Performance team, our job is to investigate critical issues in this kind of environment.

In this talk, you will follow our insights, mistakes and false leads during a real world case. We will cover all the phases of the investigation, from the early detection to the actual fix, and we will detail our tricks and tools along the way.

Resources shared by Christophe and Kevin:

Subscribe to our community newsletter to receive notifications about future webinars.

The post Advanced .NET Debugging Techniques from a Real-World Investigation – Webinar Recording appeared first on .NET Tools Blog.

Analyzing a memory leak discovered by our build server

$
0
0

A few weeks ago, I was working on a feature in Rider when I received a build failure e-mail from TeamCity, our continuous integration service. I was not allowed to merge my feature into the main product as it was causing a memory leak. Good thing: the build artifacts contained a dotMemory snapshot file, so I could start analyzing the issue right away.

Detecting this memory leak (and capturing a snapshot) was done automatically as part of a unit test we have, which uses the dotMemory Unit framework.

In this mini series:

Here we go!

Analyzing the memory leak

Our continuous integration service (TeamCity) runs many tests for Rider as part of the build process. For example, we have a few tests that launch Rider, create a new .NET project, write some code, invoke code completion and things like that. These are automated UI tests that validate the experience our users will have on their machine.

One of the integration tests opens a “large solution” (which has 60+ projects), waits for it to load, then closes it. This unit test also attaches a memory profiler to Rider’s back-end process (an out-of-process version of ReSharper that provides C# features), and checks for memory leaks.

It was this specific test that notified me something was wrong! The build overview displayed a failing unit test, and the failure reason stated ZombieSolutionCount = 1. Translated: while the test expects the entire object graph for an open solution to be disposed after the solution is closed, something was keeping that large solution in memory

On our TeamCity server, a memory snapshot is saved automatically when a memory unit test fails. After downloading and opening the snapshot on my machine, I searched for the Solution type. Indeed, one instance was left in memory, and retained 178 MB of memory!

On Solution instance left in memory

A very nice feature in dotMemory is the key retention paths view. It displays a chart of objects that are keeping our object in memory. Drilling down into the leftover Solution instance revealed a good view of the object tree that was holding a reference to our object.

Key retention path helps analyze why an object is in memory

If we look at the bottom of the diagram, we will see that an HttpSourceAuthenticationHandler was keeping my RiderNuGetCredentialService in memory, which in turn has references to many other objects (via different paths), and ultimately, our Solution.

Before we dive into that, we will need a bit of background knowledge about how the Rider (and ReSharper) codebase work in terms of managing objects…

Object lifetimes in Rider

An IDE is, in essence, a big object tree: there is a solution, projects, code files, etc. Functionality becomes available when certain objects are available. Some features will be available when the solution is loaded, while others like code completion only make sense when a file is opened. Now, which objects should be disposed when just one file is closed? What when the entire solution is closed?

Rider manages memory using Lifetime objects. There’s a parent lifetime at the solution level, and various child lifetimes at other levels. Objects register themselves with a lifetime. When a lifetime is disposed, its child objects are, too. So when opening the NuGet tool window, we register it with the solution lifetime. When the solution is closed, the NuGet tool window’s object tree will be disposed as well. There is no need for the solution to track its child objects – instead child objects register themselves with the appropriate lifetime.

Now, back to our memory leak…

HttpSourceAuthenticationHandler was not being disposed

The feature I was working on hooks into NuGet’s HttpSourceAuthenticationHandler (which is also visible in the key retention paths chart earlier in this post). This is a class that lives in NuGet’s codebase and keeps track of authentication against a given NuGet feed. It also provides support to plug in a credential service, which will be invoked when a feed requires authentication and no credentials are known. Exactly the feature I was building into Rider!

Now, when a solution is loaded I was registering Rider’s credential provider with NuGet, but I forgot to tie that registration into a lifetime. In other words: there was no code unregistering the credential provider, which was thus being held in memory. And since my credential provider needed access to data from the solution, it kept a reference to Solution, causing the memory leak.

The fix was fairly simple: in the spot where I was registering Rider’s credential provider with NuGet, I would also have to hook into the solution’s lifetime to ensure it could also be unregistered:

var credentialService = new RiderNuGetCredentialService(
    lifetime, rdSolutionModel.GetNuGetHost(), rdNuGetManager, nuGetHost);

// Register credential service
nuGetHost.RegisterNuGetCredentialService(lifetime, credentialService);

// Dispose credential service when lifetime is disposed
lifetime.AddDispose(credentialService);

One commit and test run later, tests were green again – and if you now use Rider’s NuGet credential providers, the solution is properly removed from memory.

Now how do we write a test that checks for an object being disposed? That seems like the perfect topic for our next post. Stay tuned!

Give dotMemory Unit a try! It’s a powerful (and free) tool that helps make sure code is behaving the way it should be in terms of memory usage.

The post Analyzing a memory leak discovered by our build server appeared first on .NET Tools Blog.

Unit testing memory leaks using dotMemory Unit

$
0
0

In our previous post, we looked at how I caused a memory leak when working on a feature in Rider, and how I could not merge that feature into the product because the test that checks for a particular memory leak was failing. Today, let’s shift gears and look at how to write a similar type of test using the (free!) dotMemory Unit framework.

In this mini series:

Let’s write a test that verifies a certain object was properly removed from memory!

Testing for memory leaks using dotMemory Unit

There are good reasons to not only run unit tests and integration tests, but also to monitor their behavior in terms of memory usage. This is exactly where dotMemory Unit comes in: it is a unit testing framework which allows us to write tests that check our code for memory issues.

dotMemory Unit (dMU) integrates with other test frameworks such as NUnit, MSTest and xUnit, and captures memory snapshots that can be analyzed using dotMemory – our memory profiler. And best of all: dotMemory Unit itself is completely free.

But enough with the marketing: let’s get to work.

Adding dotMemory Unit to our test project

In order to be able to run unit tests with dotMemory Unit, we’ll have to install it. Note that currently, dotMemory Unit only works on Windows.

There are a few options to get started – the easiest being the Reference dotMemory Unit Framework action which is available when you are using ReSharper, Rider or dotCover.

Reference dotMemory Unit

Another option is to add a NuGet package reference to JetBrains.DotMemoryUnit.

Writing tests with dotMemory Unit

Once we have referenced dotMemory Unit, we can start writing tests with it. The dotMemory.Check method is the heart of the framework: it provides access to all information made available by the memory profiler:

  • We can use it to check general memory usage and heap sizes;
  • We can search for objects of a specific type and check the number of objects, calculate their size, and more;
  • We can analyze memory traffic (e.g. how many objects were allocated / collected);
  • We can compare snapshots (e.g. which objects were added to memory since the previous time we called into dotMemory.Check).

I created a simple piece of code that generates a memory leak – I will explain why later on. For now, suffice to say that we will be instantiating a Clock that runs some code based on a timer, and then is disposed. Our test will check whether our Clock was correctly disposed and removed from memory. In code:

[Fact]
public void ClockDisposesCorrectly()
{
    // Arrange
    Timer timer;
    using (Clock clock = new Clock())
    {
        // Act
        timer = new Timer(1000);
        timer.Elapsed += clock.OnTick;
        timer.Start();

        Thread.Sleep(5 * 1000); // Run clock for 5 seconds
    }

    // Run explicit GC
    GC.Collect();

    // Assert Clock is removed from memory
    dotMemory.Check(memory => 
        Assert.Equal(0, memory.GetObjects(where =>
            where.Type.Is<Clock>()).ObjectsCount));
}

That should be it. Now let’s see if we can run this test!

Running dotMemory Unit tests

With ReSharper, as well as with Rider or dotCover, we can easily run our dotMemory Unit tests from the gutter or using the Alt+Enter menu:

Run dotMemory Unit tests

When not using ReSharper, Rider or dotCover, or when on a continuous integration server, a standalone console launcher can be used. This standalone launcher will wrap the unit test process in a dotMemory profiling session and provides the memory snapshot information our tests are interested in.

Our test will run like any other test, except that it will be profiled by dotMemory and have access to the current memory snapshot. And when a test fails, we can see the failure reason just like with any other unit test – only this time it will contain a link to the dotMemory snapshot as well:

Viewing dotMemory Unit test results

Note: when using xUnit, dotMemory Unit’s output will not be visible by default. In order to make it visible, we’ll have to instruct it to use xUnit’s output helper:

public ClockFacts(ITestOutputHelper outputHelper)
{
    DotMemoryUnitTestOutput.SetOutputMethod(
        message => outputHelper.WriteLine(message));
}

Now, since our test failed, let’s click the link to the snapshot that was captured and dive in.

Analyzing dotMemory Unit snapshots

Snapshots captured by dotMemory Unit can be opened using dotMemory. Since our test checks the number of instances of Clock is zero, we can immediately search for the Clock type. From there, we can look at the key retention paths at once.

Looking at the key retention path reveals a memory leak

The key retention paths view shows us the objects that are holding a reference to our object. In this case, we can see that a TimerCallback (and its parents) are holding a reference to our Clock, immediately providing us with information about why it is still in memory!

In our test, we are creating a Timer instance which calls the Clock‘s OnTick method every second. We expected the using statement to dispose all of these objects, but alas! The Timer stays around, and it’s Tick event is still wired to our Clock. This means Clock will be kept in memory until we break that reference – either by unsubscribing the event handler or destroying the timer itself. 

Note that with this particular example, dotMemory’s automatic inspections would also detect an event handler leak is present:

Automatic inspections discover event handler leak

Let’s see if we can resolve the issue by unsubscribing the event handler:

[Fact]
public void ClockDisposesCorrectlyFixed()
{
    // Arrange
    using (Clock clock = new Clock())
    using (Timer timer = new Timer(1000))
    {
        // Act
        timer.Elapsed += clock.OnTick;
        timer.Start();

        Thread.Sleep(5 * 1000); // Run clock for 5 seconds

        timer.Stop();
        timer.Elapsed -= clock.OnTick; // <-- remove the reference
    }

    // Run explicit GC
    GC.Collect();

    // Assert Clock is removed from memory
    dotMemory.Check(memory => 
        Assert.Equal(0, memory.GetObjects(where =>
            where.Type.Is<Clock>()).ObjectsCount));
}

Alternatively, we could write the check for our event handler leak using the LeakedOnEventHandler() query, which is similar to the automatic inspection found in dotMemory::

// Assert Clock is removed from memory
dotMemory.Check(memory => 
    Assert.Equal(0, memory.GetObjects(where =>
        where.LeakedOnEventHandler()).ObjectsCount));

When we now run our test under dotMemory Unit, it will pass. The event handler callback was removed, and thus, the reference keeping our object in memory, broken. This will properly remove the Clock instance from memory.

That’s a lie! The test still fails!

Indeed, even after our fix, the test still fails as there is a Clock still in memory. I am happy to hear you tried running it :-) Reality is, the example used in this blog post is too simple.

Since all of our logic is being run in one method (our test method), the garbage collector will not clean up local variables that are still available in the context of our function. As it turns out, the CLR keeps the event handler delegate around (and thus, the reference to our Clock):

Clock is kept around as a local variable

We will have to re-write our test a little bit, so that the local variables used are considered out of scope when validating memory usage. This can be done by creating a separate method to run the code being tested, or inline using a local function or an Action.

[Fact]
public void ClockDisposesCorrectlyFixed()
{
    var isolator = new Action(() =>
    {
        // Arrange
        using (Clock clock = new Clock())
        using (Timer timer = new Timer(1000))
        {
            // Act
            timer.Elapsed += clock.OnTick;
            timer.Start();

            Thread.Sleep(5 * 1000); // Run clock for 5 seconds

            timer.Stop();
            timer.Elapsed -= clock.OnTick;
        }
    });

    isolator();

    // Run explicit GC
    GC.Collect();

    // Assert
    dotMemory.Check(memory =>
        Assert.Equal(0, memory.GetObjects(where =>
            where.Type.Is<Clock>()).ObjectsCount));
}

When running the above, our Clock will be removed from memory – finally!

Conclusion

Using dotMemory Unit, we can automate memory profiling and write logic against a memory snapshot to verify our code is cleaning up memory properly. We have looked at how we can write tests with dotMemory Unit to check whether an object was indeed removed from memory.

There are many more features in dotMemory that we did not cover in this post. Head over to our dotMemory Unit landing page to learn more about comparing snapshots as part of a test, analyzing memory traffic, and more.

With the standalone console launcher, dotMemory Unit can also be run as part of a continuous integration process. A dotMemory Unit plugin for TeamCity exists as well, making it even easier to integrate memory unit tests into your workflow.

Give dotMemory Unit a try! It’s a powerful (and free) tool that helps make sure code is behaving the way it should be in terms of memory usage.

The post Unit testing memory leaks using dotMemory Unit appeared first on .NET Tools Blog.

ReSharper Ultimate 2018.3 starts Early Access Program

$
0
0

We’ve started a new Early Access Program cycle for ReSharper Ultimate – please welcome ReSharper Ultimate 2018.3 EAP.

ReSharper Ultimate 2018.3 EAP

Let me highlight the big changes in the ReSharper 2018.3 EAP1 build:

  • We’ve implemented the Introduce parameter refactoring for local functions.
  • Lots of new inspections, quick-fixes, and context actions have been added to C# code analysis for different cases:
    • Add an explicit tuple component name.
    • Split ||-expressions in switch case guard clauses into separate switch cases.
    • Detect format strings that were incorrectly used as interpolated strings.
    • Use string interpolation, convert LINQ to XML/JSON, and format items highlighting for the string.Concat method.
    • Detect format strings which were incorrectly used as interpolated strings.
    • Initialize members to create and fill the object initializer.
  • An improved context action “Deconstruct variable” is available on usages and on parameters, and supports deep nested deconstructions.
  • Show Inspection Help is now available for inspections in the Inspection Results and Error in Solution windows if the inspection has a corresponding WebHelp article.
  • The Go To Action popup allows looking for Options pages.
  • You can select which font style ReSharper Editor Adornments should inherit: Visual Studio IntelliSense or Text Editor.
  • We’ve made ReSharper more FIPS-compliant by stopping the use of the md5 hash algorithm and eliminating all its previous uses in the codebase.
  • The whole list of fixes is available here.

Other tools from ReSharper Ultimate 2018.3 family have received an update as well:

  • ReSharper C++ 2018.3 EAP introduces predefined naming schemes for common C++ code standards. It also makes several usability improvements to Parameter Info, and adds the Specify template arguments explicitly context action for use with C++17 class template argument deduction. Finally, it includes several fixes that improve performance during solution opening (in particular for projects that use Unreal Engine).
  • dotTrace 2018.3 EAP gets a new subfilter in the Timeline Viewer, which allows you to analyze how the allocated memory is distributed between the objects of a certain type.
  • dotMemory 2018.3 EAP gets a new condition on the profiling controller for taking a snapshot: Get a snapshot if total memory usage exceeds X MB. Also, the view showing objects queued for finalization (the result of the Finalizable objects inspection) allows opening these objects and analyzing them in other dotMemory views.
  • dotPeek 2018.3 EAP supports decompiling local functions and pattern matching and makes it possible to copy the fully qualified name (FQN) of a symbol to the clipboard.

Download ReSharper EAP

The post ReSharper Ultimate 2018.3 starts Early Access Program appeared first on .NET Tools Blog.


ReSharper Ultimate 2018.3 Is Within Spitting Distance!

$
0
0

Hello there,
Coming into the homestretch of this release cycle, we’ve just published the new EAP8 build for ReSharper Ultimate 2018.3. If you’ve been wanting to try all the new features before this major release goes public, now is the time to download this EAP build and give it a go!

The latest ReSharper 2018.3 EAP includes:

  • Parameter name hints right in the code editor to make C# and VB.NET code more readable.
  • Auto-detection of formatter settings and C# naming styles.
  • Initial support for Visual Studio 2019 Preview.
  • Initial support for the new localization procedure in the latest ASP.NET Core projects.
  • Improved C# 7 deconstruction support.
  • VB.NET 15.3 and 15.5 language support.
  • Lots of new inspections, quick-fixes, and context actions for C# code.
  • Performance optimizations.
  • TypeScript 3.0 support.

Other ReSharper Ultimate tools have received solid updates too:

  • ReSharper C++ 2018.3: Find dozens of improvements made to code refactoring, code analysis, and navigation. Read code easier with the improved error diagnostics in templated code, C++ name hints, and the improved parameter info popup. Let ReSharper C++ auto-detect the code formatting settings for you or start to make use of the predefined C++ naming schemes which are now available. Besides, the support for C++/CLI was improved. And if you are working with the Unreal Engine, you’ll appreciate the enhanced performance and parsing improvements for the reflection macros.
  • dotCover 2018.3: Now, there are two groups of filters in the dotCover options: runtime filters and results filters. The latter is extended with a filter by file name. Use it to exclude unnecessary (e.g., auto-generated) files from the results and reduce “noise” in the coverage tree.
  • The biggest thing about dotTrace 2018.3 is that it’s now integrated into JetBrains Rider on Windows. You can configure and run profiling sessions, get snapshots, and analyze them in the built-in viewer.
  • dotMemory 2018.3 gets a new condition for taking a snapshot on the profiling controller: Get a snapshot if total memory usage exceeds X MB. Also, you can click on a timeline graph to get the exact memory data at a specific time point.
  • dotPeek 2018.3 supports decompiling more C# 7.x features and makes it possible to copy the fully qualified name (FQN) of a symbol to the clipboard.

You are welcome to download ReSharper Ultimate 2018.3 EAP and give it a try! Your feedback is highly appreciated.

The post ReSharper Ultimate 2018.3 Is Within Spitting Distance! appeared first on .NET Tools Blog.

ReSharper Ultimate 2018.3 is released!

$
0
0

I’m here today to present to you this year’s last major release of ReSharper Ultimate. Don’t feel like reading? Then come and grab ReSharper Ultimate 2018.3!

ReSharper Ultimate 2018.3 released

Let me show you what the ReSharper team has accomplished in this release:

  • We’ve added parameter name hints right to the code editor. This helps make C# and VB.NET code more readable.
  • Early support for Visual Studio 2019 Preview 1.
  • The code formatter can now detect the code formatting style right from your code and adjust the formatter settings accordingly (ReSharper | Edit | Detect formatting settings). No more looking through ReSharper formatter settings and configuring them manually.
  • ReSharper can autodetect the naming style you use in your code. No manual configuring of naming styles anymore to match the naming convention you use.
  • Improved C# 7 deconstruction support includes new/updated inspections and quick-fixes.
  • VB.NET 15.3 and 15.5 language support.
  • TypeScript 3.0 support.
  • Initial support is available for the new localization procedure in the latest ASP.NET Core projects. Most of the localization inspections, refactorings, and quick-fixes that you are familiar with from the old localization procedure are available.
  • Lots of new inspections, quick-fixes, and context actions have been added to C# code analysis for different cases.
  • A few performance optimizations have been made.
  • We’ve implemented the Introduce parameter refactoring for local functions.
  • A couple of new keys to run ReSharper Command Line Tools.
  • We’ve made ReSharper more FIPS-compliant by stopping the use of the md5 hash algorithm and eliminating all its previous uses in the codebase.
  • The Go To Action popup allows looking for Options pages.

You are welcome to check the What’s new in ReSharper page to learn more about the features and improvements in ReSharper 2018.3. See also the full list of requests we’ve addressed this release cycle.

As usual, all other ReSharper Ultimate tools get an update in this release as well:

  • ReSharper C++ 2018.3 – every bit better! Cleverer refactorings, new context actions, an even smarter Go to Declaration and Search Everywhere, auto-detection of code formatting settings and C++ naming schemes, and better error diagnostics on templated code. Besides all this, the release has improved C++/CLI support. If you are working with the Unreal Engine, you can find enhanced performance and parsing improvements made to the reflection macros.
  • dotCover 2018.3: In addition to multiple bug fixes, we’ve reworked the way coverage filters are organized. Now, there are two groups of filters in the dotCover options: runtime filters (those applied during a coverage session) and results filters (those applied to coverage results). The latter is extended with a filename filter. Use it to exclude unnecessary files from the results (such as auto-generated ones) and reduce “noise” in the coverage tree.
  • The biggest thing about dotTrace 2018.3 is the integration into JetBrains Rider. You can configure and run profiling sessions, get snapshots, and analyze them in the built-in viewer. Note that currently, the viewer cannot show a distribution of events on a timeline. That’s why timeline snapshots are opened as simple sampling snapshots.
  • dotMemory 2018.3 gets a new condition for taking a snapshot on the profiling controller: Get a snapshot if total memory usage exceeds X MB. You can also click on a timeline graph to get the exact memory data at a specific time point.
  • dotPeek 2018.3 supports decompiling more C# 7.x features and makes it possible to copy the fully qualified name (FQN) of a symbol to the clipboard.

Download ReSharper Ultimate

We’d love to hear your feedback on the ReSharper Ultimate 2018.3 release.

The post ReSharper Ultimate 2018.3 is released! appeared first on .NET Tools Blog.

What Do These …+c… Classes Do in my Memory Snapshots?

$
0
0

There’s nothing we love as much as user feedback. It is a priceless source of insights into how people use tools like dotMemory, what gets them excited – and what gets them confused.

Over the last year we’ve received multiple questions from users seeing classes with ...+<>c... in their names. They said:

  • “…in the object browser we have some instances of an object that ends with +<>c. I can’t find any information what kind of objects this is and I hope that you can help me?”
  • “What does +<>c mean? I am new to dotMemory.”
  • “I am looking at some “Survived Objects” and I see a lot of “MyClass+<>c“.”
  • “dotMemory lists a lot of objects that look like “ClassName+<>c...” with no explanation.”

Let’s look at what these are!


In dotMemory, we may see the following:

How lambda looks like in a memory snapshot

So, what is the mysterious ...+<>c... class? The answer is quite simple. It’s a helper class the compiler creates to execute a lambda. Actually, we’ve already written about this here in a series of posts on how to fight performance issues in .NET. Let me try to sort out the details one more time, especially considering that there were some changes in the compiler since then.

In this example, we have some StringUtils class that has a Filter method used to apply filters on a list of strings:

public static class StringUtils
{
   public static List<string> Filter(List<string> source, Func<string, bool> condition)
   {
       var result = new List<string>();
      
       foreach (var item in source)
       {
           if (condition(item))
               result.Add(item);
       }

       return result;
   }
}

We want to use this method to filter out strings that are longer than 3 symbols. We will pass this filter to the condition argument using a lambda. Note that the resulting code (after compilation) will depend on whether the lambda contains a closure (a context that is passed to a lambda, e.g. a local variable declared in a method that calls the lambda).

Let’s take a look at the possible ways to call the Filter method: via a lambda without closure, via a lambda with closure, and via a method group.

A lambda with no closure

Example

First, let’s use a lambda without a closure. Here we pass the maximum string length (3) as a number, so no additional context is passed to the lambda:

public static class FilterTestNoClosure
{
   public static void FilterLongString()
   {
       var list = new List<string> {"abc", "abcd", "abcde"};
       var result = StringUtils.Filter(list, s => s.Length > 3);
       Console.WriteLine(result.Count);
   }
}

Decompiled code

If we decompile this code in dotPeek (our free decompiler), we’ll get the following:

public class FilterTestNoClosure
{
   public void FilterLongString()
   {
       List source = new List<string>();
       source.Add("abc");
       source.Add("abcd");
       source.Add("abcde");
       // ISSUE: method pointer
       Console.WriteLine(StringUtils.Filter(
          source, FilterTestNoClosure.<>c.<>9__0_0 ?? (
          FilterTestNoClosure.<>c.<>9__0_0 = new Func<string, bool>(
          (object) FilterTestNoClosure.<>c.<>9, __methodptr(b__0_0)))).Count);
   }

   [CompilerGenerated]
   [Serializable]
   private sealed class <>c
   {
       public static readonly FilterTestNoClosure.<>c <>9;
       public static Func<string, bool> <>9__0_0;

       static <>c()
       {
           FilterTestNoClosure.<>c.<>9 = new FilterTestNoClosure.<>c();
       }

       public <>c()
       {
           base..ctor();
       }

       internal bool b__0_0(string s)
       {
           return s.Length > 3;
       }
   }
}

As you can see, the compiler has created a separate <>c class with a static constructor, making the lambda a method in this class (b__0_0). The method is called via the <>9__0_0 static field. Note that this field is checked against null and created only once during the first call.

Console.WriteLine(StringUtils.Filter(source, FilterTestNoClosure.<>c.<>9__0_0 ?? (FilterTestNoClosure.<>c.<>9__0_0 = new Func<string, bool>((object) FilterTestNoClosure.<>c.<>9, __methodptr(b__0_0)))).Count);

You may wonder what advantages this approach may have. The answer is that it won’t generate any memory traffic. Even if you call FilterLongString ten thousand times, the lambda will be created just once.

What about dotMemory?

To ensure, let’s see how the following code looks in dotMemory:

public static void Main(string[] args)
{
   var filterTest = new FilterTestNoClosure();
   for (int i = 0; i < 10000; i++)
   {
      filterTest.FilterLongString();
   }

   Console.ReadLine(); // the snapshot is taken here
}

The Memory Traffic view in dotMemory will look as follows:

Memory traffic from a lambda without closure

As you can see, only one object FilterTestNoClosure+<>c is created. If we examine this instance using the Key Retention Paths view, we’ll see that it is retained via its static fields. Note that as any static members, these fields will remain in memory for the entire lifetime of the application. But typically, this is not a big deal as such static objects are quite small.

Key retention paths of a lambda with no closure

Worth knowing

In the pre-Roslyn-compiler era (Visual Studio 2013 and earlier), a lambda without a closure would compile into a static method inside the same class that calls the lambda. For the sake of performance, a separate class is now created. You can find more details in this Stack Overflow discussion.

The main takeaway

If you’re curious what a ...+<>c... object makes in your snapshot, check the memory traffic. If the object is created only once and is retained via static references, then it’s definitely a lambda without a closure. Should you worry? Absolutely not. This is normal compiler behavior.

A lambda with a closure

Example

Of course, a more universal approach would be to make the maximum string length a variable:

public class FilterTestClosureInArg
{
   public void FilterLongString(int length)
   {
       var list = new List<string> {"abc", "abcd", "abcde"};
       var result = StringUtils.Filter(list, s => s.Length > length);
       Console.WriteLine(result.Count);
   }
}

Decompiled code

But how will this be compiled?

public static class FilterTestClosureInArg
{
   public static void FilterLongString(int length)
   {
       FilterTestClosureInArg.<>c__DisplayClass0_0 cDisplayClass00 = 
          new FilterTestClosureInArg.<>c__DisplayClass0_0();
       cDisplayClass00.length = length;
       List source = new List<string>();
       source.Add("abc");
       source.Add("abcd");
       source.Add("abcde");
       // ISSUE: method pointer
       Console.WriteLine(StringUtils.Filter(
         source, new Func<string, bool>((object) cDisplayClass00, __methodptr(b__0))).Count);
   }

   [CompilerGenerated]
   private sealed class <>c__DisplayClass0_0
   {
       public int length;

       public <>c__DisplayClass0_0()
       {
           base..ctor();
       }

       internal bool b__0(string s)
       {
           return s.Length > this.length;
       }
   }
}

Here the compiler acted differently. It still created a separate class <>c__DisplayClass0__0, but the class no longer contains static fields. The length argument passed to a lambda is made a public field of the <>c__DisplayClass0__0 class. And what is most important, an instance of <>c__DisplayClass0__0 is created each time the FilterLongString() is called:

FilterTestClosureInArg.<>c__DisplayClass0_0 cDisplayClass00 = new FilterTestClosureInArg.<>c__DisplayClass0_0();

This results in huge memory traffic if the FilterLongString() method stays on a hot path (is called frequently). Let’s check this out in dotMemory.

What about dotMemory?

public static void Main(string[] args)
{
   var filterTest = new FilterTestClosureInArg();
   for (int i = 0; i < 10000; i++)
   {
      filterTest.FilterLongString(3);
   }

   Console.ReadLine(); // the snapshot is taken here
}

If we look at the Memory Traffic view, we’ll see that there were 10,000 instances of the <>c__DisplayClass0__0 class created and collected.

Memory traffic of a lambda with closure

This is not good from the performance point of view. While object allocation costs almost nothing, object collection is a much more “heavyweight” operation. The only way to avoid this is to rewrite the code so that it doesn’t contain closures. If you want more examples on the topic, take a look at our previous post, Unusual Ways of Boosting Up App Performance. Lambdas and LINQs.

Note that a closure is created in all cases where you pass local context. For example, a local variable passed to a lambda leads to a closure as well:

public class FilterTestClosureInLocalVar
{
   public void FilterLongString()
   {
       var length = 3;
       var list = new List<string> {"abc", "abcd", "abcde"};
       var result = StringUtils.Filter(list, s => s.Length > length);
       Console.WriteLine(result.Count);
   }
}

Worth knowing

LINQ queries have the same implementation under the hood, so the ...+<>c__DisplayClass... classes may indicate not only lambdas with closures but LINQs as well.

The main takeaway

When inspecting a snapshot, it always worth it to take a look at memory traffic. If you see a lot of allocated/collected objects with ...<>c__DisplayClass... in their names, you’ll know these are lambdas with closures. When examining these objects, ask yourself two questions:

  1. Do they really impact performance?
  2. If yes, can you rewrite the code without a closure?

A method group instead of a lambda

Example

Back in 2006, C# 2.0 introduced the ‘method group conversion’ feature, which simplifies the syntax used to assign a method to a delegate. In our case, this means that we can replace the lambda with a method and then pass this method as an argument.

public class FilterTestMethodGroup
{
   public void FilterLongString()
   {
       var list = new List<string> {"abc", "abcd", "abcde"};
       var result = StringUtils.Filter(list, Compare);
       Console.WriteLine(result.Count);
   }

   private bool Compare(string s)
   {
       return s.Length > 3;
   }
}

Decompiled code

We want to know if this approach will generate memory traffic. A quick look at the decompiled code says that yes, unfortunately, it will.

public class FilterTestMethodGroup
{
   public void FilterLongString()
   {
       List source = new List<string>();
       source.Add("abc");
       source.Add("abcd");
       source.Add("abcde");
       // ISSUE: method pointer
       Console.WriteLine(StringUtils.Filter(
         source, new Func<string, bool>((object) this, __methodptr(Compare))).Count);
   }

   private bool Compare(string s)
   {
       return s.Length > 3;
   }

   public FilterTestMethodGroup()
   {
       base..ctor();
   }
}

The compiler doesn’t create an additional class. Instead, it simply creates a new instance of Func<string, bool> each time FilterLongString() is called. Called 10,000 times, it will spawn 10,000 instances.

Memory traffic from a method group

The main takeaway

When using method groups, exercise the same caution as when you use lambdas with closures. They may generate significant memory traffic if on a hot path.

We hope this post has made things a little clearer. Now, if you encounter classes with ...+<>c... in their names, first of all, know that these are either lambdas or LINQs and the potential problem here is related to memory traffic because of closures.

Still don’t have dotMemory, but want to check your application for memory traffic? You’re welcome to download and try dotMemory free for 5 days of actual use.

(Note that the easiest way to install dotMemory is to use our Toolbox App. All you need to do is click Install next to dotMemory Portable.)

The post What Do These …<>+c… Classes Do in my Memory Snapshots? appeared first on .NET Tools Blog.

ReSharper Ultimate Starts its Early Access Program for 2019.1!

$
0
0

Hi there,

It’s that time of the year when we usually start the Early Access Program for our inaugural major release of the year. Please give a warm welcome to the first ReSharper Ultimate 2019.1 EAP build!

ReSharper Ultimate Starts its Early Access Program for 2019.1!

ReSharper 2019.1 EAP comes with the following notable enhancements:

  • Initial C# 8 support: Ranges and index from end expressions, null-coalescing assignment, switch expressions, tuple expression in a switch statement, static local functions, and nullable reference types are supported.
  • Parameter name hints work for attribute usages and for StringFormatMethod calls.
  • Enhanced typing assists for nullability annotations.
  • Improved support for Visual Studio 2019 RC.
  • Code formatting: detecting formatting settings works in the background; “export settings to .editorconfig” is possible; and formatting inspections for indenting around child statements are ON by default.
  • Optimize references works on SDK projects.
  • Go to Text searches inside all text files in a solution.
  • The Extract Method refactoring can now rename introduced parameters.

ReSharper C++ 2019.1 EAP – The ReSharper C++ team has started this year putting the pedal to the metal on performance optimizations in Unreal Engine 4 codebases. The changes include initial indexing that runs several times faster, much better memory utilization, and new settings to tweak ReSharper’s indexing behavior. ReSharper is also aware of UE4 RPC functions, which means that you can now jump between related function declarations and definitions, generate required definitions, and so on.

Apart from all the UE4 improvements, ReSharper C++ delivers the following:

  • Lots of general performance improvements to reduce indexing time and improve memory usage.
  • C++ language support: C++20 familiar template syntax for generic lambdas, C++17’s hexadecimal floating-point literals, and alternative operator representations.
  • Navigation improvements: Include base members option in Go to file member is supported; and Go to file member, Go to base class, and Go to derived class searches are now available during indexing.
  • Unit testing: support for TEMPLATE_PRODUCT_TEST_CASE test declarations from Catch 2.7 and GTEST_SKIP() macro in Google Test.
  • Documentation comments: parameter names get renamed in XML documentation comments, and a typing assist automatically inserts ‘///’ on a new line.
  • Clang-Tidy: separate Clang-Tidy options page, and a new setting to use a custom clang-tidy binary instead of the built-in one.

dotPeek 2019.1 EAP adds navigation to source from a document token node, and navigation to the XML view of the PDB content in the metadata tree. The Assembly Explorer adds the Dependencies node for NuGet packages and allows navigating to nuspec file by double-clicking the NuGet node.

dotMemory 2019.1 EAP provides initial .NET Core 3.0 support and can instantly navigate from dotMemory to the object’s type declaration in JetBrains Rider.

Download ReSharper EAP

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

Welcome ReSharper Ultimate 2019.1!

$
0
0

This year’s first major release of ReSharper Ultimate is here. Download ReSharper Ultimate 2019.1 today!

ReSharper Ultimate 2019.1 is Released

In addition to 400+ fixes and improvements, ReSharper 2019.1 comes with:

  • Initial C# 8 support. ReSharper supports new language features, such as ranges and index from end expressions, null-coalescing assignment, switch expressions, tuple expression in a switch statement, static local functions, async streams, nullable reference types, recursive patterns, and using declarations.
  • Support for the recently released Visual Studio 2019 RTM, including but not limited to supporting the “async packages auto-load” API in Visual Studio 2019.
  • A way to completely disable web languages support (if you don’t need it) to improve the overall performance.
  • Parameter name hints work for attribute usages and for StringFormatMethod calls.
    Parameter name hint
  • Enhanced typing assists for nullability annotations.
  • Code formatting updates that include an option to export code formatting and code styles setting to an .editorconfig file; detection of formatting settings in the background; a new built-in Code Cleanup profile, and more. For details please see this blog post.
  • A new typing assist to unindent the code when you press Backspace.
    Unindent code typing assist
  • Optimize References” which analyzes unused package references in SDK projects.
  • Go to Text which searches inside all the text files in a solution.

Please see the What’s new in ReSharper page to learn more about the new features and improvements in ReSharper 2019.1.

Other ReSharper Ultimate tools have received solid updates too:

  • ReSharper C++ 2019.1 greatly improves startup time for your projects, and adds support for C++20’s Contracts, the three-way comparison operator, and some other language features. It also speeds up many navigation actions, introduces a more flexible approach to Clang-Tidy integration, and enhances unit testing support. For Unreal Engine 4 developers, we’ve got completion for reflection specifiers, support for the UE4 naming convention, enhanced auto-import, and more.
  • dotCover 2019.1 integrates with JetBrains Rider allowing unit test coverage analysis and continuous testing for .NET Core applications on Windows, macOS, and Linux.
    Code_coverage_on_mac
  • dotTrace 2019.1 lets you profile Mono and Unity applications on Windows, macOS, and Linux.
  • dotMemory 2019.1 provides initial .NET Core 3.0 support and can instantly navigate to the object’s type declaration in JetBrains Rider.
  • dotPeek 2019.1 adds navigation to the source code from a document token node and navigation to the XML view of the PDB content in the metadata tree. The Assembly Explorer adds the Dependencies node for NuGet packages and allows navigating to nuspec files by double-clicking the NuGet node.

Download ReSharper Ultimate

The post Welcome ReSharper Ultimate 2019.1! appeared first on .NET Tools Blog.

ReSharper Ultimate 2019.1 Updates to 2019.1.2

$
0
0

Five weeks after the first release of the year, we are releasing ReSharper Ultimate 2019.1.2. This build delivers a lot of fixes and improvements to polish the major release.

RU20191-splash

The most important fixes are highlighted below:

  • We’ve added a new shortcut, Alt+R, to quickly access the ReSharper menu, which was hidden under the Extensions menu in Visual Studio 2019.
  • ReSharper Tutorials are back, to help you familiarize yourself with the latest changes and maybe even learn something new about ReSharper.
  • C# support works in a web project even if you disable the ‘Web Languages’ checkbox in ReSharper Options.
  • Fixed a Visual Studio freeze on toggling the ‘Show all files’ option in Solution Explorer for a project.
  • Fixed the “wrong dependencies” error in the plugin ecosystem.
  • Several fixes in MSTest (like Microsoft Fakes support in VS2019) and xUnit support.
  • A couple of fixes in code completion and in licensing.

The full list of fixes for ReSharper 2019.1.2 can be found here.

Other products from ReSharper Ultimate have a solid set of bugfixes: ReSharper C++, dotCover, dotMemory, and dotTrace.

To install ReSharper Ultimate 2019.1.2, download the build from www.jetbrains.com or run ReSharper | Help | Check for Updates right in MS Visual Studio.

The post ReSharper Ultimate 2019.1 Updates to 2019.1.2 appeared first on .NET Tools Blog.

ReSharper Ultimate 2019.2 is released!

$
0
0

Hello everyone!

Please welcome the new ReSharper Ultimate 2019.2 release.

RU20192-blog@2x

ReSharper 2019.2 includes:

  • Smart support for C# 8.0 language features such as indices, ranges, and unmanaged generic structs, as well as many new quick-fixes, inspections, and context actions.

cs-blog@2x

  • The enhanced Convert concatenation to interpolation context action which can now be applied in scope.
  • A new faster “MSBuild-based” way to create a project model, which was borrowed from JetBrains Rider.
  • An updated Performance Guide page.

perfguide-blog@2x

  • Updated debugger data tips: They respect the setting “Enable property evaluation and other implicit function calls” and can evaluate property values on demand.
  • Find Usages uses the data from Solution Wide Error Analysis to gather the results. If you enable SWEA for your solution, Find Usages will show you the results significantly faster.
  • Update in Navigation: “Search in a file” through the “Go to File Member” dialog and filter out comments from the “Go To Text” results.

navigation-blog@2x

  • Improved code formatting: new formatting options for switch expressions, and you can edit EditorConfig properties right inside the Options page UI.
  • Support for the Per-Monitor DPI Awareness mode in MS Visual Studio 2019.

Learn more about the new features and download ReSharper Ultimate 2019.2.

Apart from the new features and improvements, ReSharper also has more than 300 issues fixed.

Other ReSharper Ultimate tools have received some solid updates too:

  • ReSharper C++ 2019.2 provides significantly faster indexing thanks to a new preprocessor implementation. It improves code navigation and completion actions, adds more code hints in the editor, and has new code inspections. V2019.2 also comes with more sophisticated support for the new C++20 standard, as well as better integration for Unreal Engine 4 projects.

cpp-blog@2x

  • dotCover 2019.2 supports Mono applications and unit tests on macOS, Linux, and Windows. dotCover’s console runner is now available on macOS and Linux too.
  • dotTrace 2019.2 as integrated into Rider has become more mature. It includes the full set of Timeline filters, making it easier to analyze Timeline profiling snapshots in place.
  • dotMemory 2019.2 no longer supports remote profiling. To offer you an adequate replacement, we have significantly improved the dotMemory console profiler which now supports almost all application types including .NET Core applications, IIS Express-hosted applications, and Windows services.
    It’s also worth noting that both dotTrace and dotMemory are able to attach to and profile .NET Core 3.0 Preview 7 applications.
  • dotPeek 2019.2 has a new tooltip with the description of a keyword in the IL Viewer, and a couple of updates for the metadata tree and Assembly Explorer.

Download ReSharper Ultimate

The post ReSharper Ultimate 2019.2 is released! appeared first on .NET Tools Blog.


Console Profiler replaces Remote Profiling in dotMemory 2019.2

$
0
0

dotMemory 2019.2 no longer supports remote profiling. Remote profiling allowed you to profile an application running on a remote computer with dotMemory running locally. So, why did we get rid of it?

First, our statistics showed that the user base of the feature was vanishingly small. Not least because of the fact that remote profiling requires some effort from an end-user. You have to launch the remote agent on a remote machine, make sure that the agent is not blocked by a firewall, and so on. This presents certain challenges, especially in production environments.

Second, we believe that the dotMemory console profiler is a better choice for profiling on a remote computer. The process doesn’t require that much preparation and is easily reproducible (you create one batch script and use it anytime).

Before 2019.2, the console profiler could not fully replace the standalone dotMemory as it lacked support for many application types. The 2019.2 release has fixed this issue by adding separate commands for all kinds of applications:

  • get-snapshot – for attaching to a running .NET application and getting a single snapshot.
  • attach – for attaching to a running .NET application and getting any number of snapshots.
  • start – for starting a standalone .NET application under profiling.
  • start-netcore – for a .NET Core application.
  • start-iis – for (re)starting IIS under profiling.
  • start-iis-express – for an IIS Express–hosted web application.
  • start-windows-service – for (re)starting a managed Windows service under profiling.
  • start-wcf-service – for a WCF host with a specified WCF Service Library.
  • start-winrt – for a WinRT application.
  • profile-new-processes – for profiling any managed application that is launched after this command.

To use the console profiler, first, you need to download it. It’s worth noting that the tool is distributed free of charge and does not require any licenses to run.

Getting the console profiler

  1. Download a .zip file with the console profiler from our download page.
  2. Unzip the file on the remote computer.

Actually, that’s it – you’re ready to go! If you prefer NuGet, you can download the corresponding package.

Getting snapshots instantly

The most typical scenario is that some application has a memory problem and you want to instantly get a memory snapshot. For example, there’s an already running application with PID=1234 (it could be a standalone .NET / .NET Core application, IIS server, or a service).

To get a snapshot, run:
dotMemory.exe get-snapshot 1234

If you don’t know the PID but know the name (say, MyApp), run:
dotMemory.exe get-snapshot MyApp --all

Note the --all option at the end. If there’s more than one MyApp process, dotMemory will take a snapshot of each process.

Monitoring applications

Sometimes, you need to track application memory consumption over a long time interval. In this case, you can start or attach to your application under profiling and get snapshots only if a particular condition is satisfied, that is, if a periodic time interval ends, or memory consumption increases by a specified value.

For example, if you want to profile some myapp web app running on IIS server and take snapshots every 5 hours:
dotMemory.exe start-iis --trigger-timer=5h --open-url=localhost/myapp --use-browser=Chrome

Or, for example, if you want to take snapshots only when memory consumption increases by 50%:
dotMemory.exe start-iis --trigger-mem-inc=50% --open-url=localhost/myapp --use-browser=Chrome

Getting snapshots when you want

Sometimes, it’s necessary to have direct control over the profiling process; for example, you need to get a snapshot at some exact moment by a direct command. This can be done by sending special messages to stdin of dotMemory.exe.

Suppose we want to profile some IIS Express-hosted application with a configuration file. Follow these steps:

  1. Start a profiling session:
    dotMemory start-iis-express --service-output --config=.idea\config\applicationhost.config --site=MyWebApp
    Note the --service-output argument. It tells dotMemory to send service messages to stdout, like
    ##dotMemory["connected"]
  2. When you want to take a snapshot, send the following command to stdin:
    ##dotMemory["get-snapshot"]
    After the snapshot is taken, dotMemory will send the following to stdout:
    ##dotMemory["workspace-saved", {path: "..."}]

In this post, we’ve just touched on some of the console profiler’s capabilities. For more information about the tool, please refer to our online documentation or the console profiler’s built-in help:
dotMemory.exe help

To test the updated dotMemory console profiler in action, download it using this link. Note that to examine the snapshots collected by the console profiler, you should use the standalone version of dotMemory.

We’d love to hear your feedback about the console profiler!

The post Console Profiler replaces Remote Profiling in dotMemory 2019.2 appeared first on .NET Tools Blog.

Meet the JetBrains .NET team in Sydney, Melbourne and Brisbane

$
0
0

G’day!

This October, the JetBrains .NET team is coming to Australia, visiting Sydney, Melbourne and Brisbane. Our .NET Developer Advocates Matt Ellis and Maarten Balliauw will be visiting NDC Sydney and be part of several local events. We’ll talk about best practices when using Rider, and memory management in .NET.

Here’s where you can find us:

On Tuesday, October 15th, we are hosting a JetBrains Night in Sydney where Matt and Maarten are joined by local speaker Rob Pearson who will ship ASP.NET Core apps without Windows, using JetBrains Rider and Octopus Deploy. Register here »
While there, we will be at NDC Sydney (October 16-18) where you can find us talk about how Rider is built, and Unity for the enterprise developer. Stop by our booth for some swag and a chat! We’re happy to answer any questions you may have. Learn more »
On Monday, October 21st we’re hosting a free meetup in Melbourne, where Nicholas Blumhardt joins us and share his experience with 10 years of OSS in .NET. Register here »
Our next and final stop will be JetBrains Night Brisbane on October 22, where local speaker Nicholas Blumhardt joins us again. Register here »

Register for these events today (seats are limited). We’re looking forward to seeing you at these events down under!

The post Meet the JetBrains .NET team in Sydney, Melbourne and Brisbane appeared first on .NET Tools Blog.

ReSharper Ultimate 2019.2.3 Bugfix Is Here!

$
0
0

Moments ago we published a new bugfix – please welcome ReSharper Ultimate 2019.2.3. It delivers highly requested support for the .NET Core 3.0 release build, which was released earlier, for all the tools in the ReSharper Ultimate family!
RU2019.2-splash@2x

In addition, ReSharper 2019.2.3 includes about 30 resolved requests such as these:

  • Lots of fixes related to the MSBuild-based project model.
  • “Override” code completion does not touch members above the completed element anymore.
  • Typing a single quote in code comments does not insert a pair of single quotes anymore.

Other tools from the Ultimate pack have lots of fixes as well:

  • ReSharper C++ 2019.2.3 delivers several fixes to better support the MSBuild-based project model while loading C++ projects. The Parameter info popup now appears automatically, and focus is not lost anymore after you apply the “Generate implementation” quick-fix. The full list of fixes is here.
  • dotTrace 2019.2.3 fixes various issues.
  • dotCover 2019.2.3 fixes a number of important issues related to dotCover’s console runner.
  • dotMemory 2019.2.3 fixes issues related to unsupported types and bugs in the profiler core.

To install ReSharper Ultimate 2019.2.3, download the build from www.jetbrains.com or run ReSharper | Help | Check for Updates right in MS Visual Studio.

The post ReSharper Ultimate 2019.2.3 Bugfix Is Here! appeared first on .NET Tools Blog.

ReSharper Ultimate 2019.3 Starts Early Access Program!

$
0
0

Hello everyone,

October seems like a good time to launch the Early Access Program for our third release of the year, so please welcome ReSharper Ultimate 2019.3 EAP.

RU2019.3EAP-blog@2x

In the list below, I highlight several new features and improvements of the ReSharper 2019.3 EAP:

  • Improved C# 8 support including notnull constraint, the target-typed switch expressions, early support for default interface methods, a new hint "Local function can be static", and a new quick-fix "Add missing arms".

cs8@2x

  • New Type Name Hints are available for lambda’s parameters, all var occurrences including pattern matching and tuples deconstruction, range variables inside LINQ statements, and at the end of a line in a method call chain.
  • Xamarin support has a couple of important fixes such as x:DataType and Class attribute support.
  • Find dependent code now works for NuGet references and can be run for a whole solution. Also, the Find results window for Find dependent code has new filters.

find-dependent-code@2x

To see what other fixes we’ve added in the first EAP build, please see this.

For ReSharper C++, here’s what this 2019.3 EAP provides:

  • Initial support for C++20 concepts.

concepts

  • Clang-tidy integration
    • The bundled clang-tidy binary was updated to version 9 with a number of new checks. Additionally, it should no longer prevent modifications to source files.
    • Clang warnings can now be disabled from the inspection menu.
    • Added a setting to use a specific clang-tidy configuration file (instead of a setting which specified the configuration as a string)

clang-warning-disable

  • You can export your formatting options to a .clang-format file.
  • Thanks to some improvements in the code highlighting engine, re-highlighting now happens faster (after a function’s body is changed, only the body itself will be reanalyzed).
  • New quick-fixes are available to help you add a variable to the lambda capture list.
  • Unreal Engine 4 support has been improved:
    • UE smart pointers (TSharedPtr, TSharedRef, TWeakPtr, TUniquePtr) are supported similarly to std::shared_ptr/unique_ptr (e.g. they are supported by the Parameter Info, code analysis, and postfix code completion).

    makeshared

    • The new postfix template for UCLASSes expands to a proper factory function call.
    • New USTRUCT/UCLASS/UENUM/UENUMCLASS live templates are available.
    • We fixed the Visual Studio hang after executing the "Refresh Visual Studio Project" action in the Unreal Engine 4 editor.
  • Several live templates were renamed to match the corresponding keywords (e.g. “cls” to “class”, “str” to “struct”, etc.).
  • A couple of updates to the "Go to file member" dialog:
    • The dialog is now displayed instantly instead of waiting for a file to be fully analyzed.
    • If a file contains both the declaration and the definition of a function, the function is shown only once in the dialog.
  • It’s now possible to navigate to the aggregate class from the opening brace of a brace-enclosed initializer list.

navigate-aggregate

dotMemory 2019.3 EAP shows the virtual memory addresses for object instances.

The EAP for dotTrace command-line tools 2019.3 now supports profiling Mono and .NET Core applications on Linux and macOS.

dotPeek 2019.3 EAP can now navigate to the external sources of NuGet packages that have a source symbols package [*], such as JSON, Moq, or JetBrains.Lifetimes.

Download ReSharper EAP

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

ReSharper Ultimate 2019.3 Release Is Out!

$
0
0

Hello everyone,

We’ve reached the last release milestone for this year – please give a warm welcome to ReSharper Ultimate 2019.3!

RSU2019.3-blog@2x

First, let’s take a brief look at the most important changes:

  • The brand new Localization Manager helps you work more efficiently with many .resx files in your solution. It shows everything in your .resx files on a single grid, so you can observe the current state of the application or website localization and quickly find any missing resource values in any culture.

localization-manager-blog@2x

  • C# 8 support has become even better and now includes support for notnull constraints, target-typed switch expressions, early support for default interface methods, and several new inspections and quick-fixes.
  • Code generation knows more about C# 8 and helps you learn it, too.

generate-blog@2x

  • Find dependent code now works for NuGet references and can be run for the whole solution instead of just a project.

By no means are these the only updates in this release. We have even more for you:

  • C# naming settings now support reading from and exporting to EditorConfig.
  • Type Name Hints are available for all var occurrences, lambda parameters, and more.

type-name-hints-blog@2x

  • The Unit Testing tool windows have new grouping modes and new filters.
  • We’ve added more color settings for extra precision with code highlighting.
  • ReSharper Command Line Tools are available on Linux and macOS, in addition to Windows.

This is just a short list of everything that has kept our team busy over the last 4 months. Please visit What’s New in ReSharper 2019.3 to read about all the changes in more detail.


Download ReSharper Ultimate 2019.3

ReSharper C++ 2019.3

ReSharper C++ 2019.3 is here to help you adopt C++20, including support for Concepts in Find Usages, the Rename refactoring, and code inspections. New type hints in the editor can make your code easier to read, while the new formatter options help tune your code style more precisely. There are also enhancements to navigation, live templates, and Clang-Tidy integration. For game developers working on Unreal Engine 4 projects, v2019.3 delivers more templates to generate UE4-specific code, as well as support for UE4’s Smart Pointers.

cpp-blog@2x

dotTrace 2019.3

dotTrace 2019.3 gets three new features:

  • We have finally released the dotTrace command-line tool for Linux and macOS.
  • Both dotTrace in Rider and the standalone dotTrace command-line profiler now support profiling .NET Core projects on Linux and macOS. Note that only projects targeting .NET Core 3.1 are fully supported. Because of .NET Core limitations, there may be issues with profiling projects that target .NET Core 3.0 or earlier, as in some cases the application being profiled may hang or crash.
  • The call tree in the Timeline Viewer is now easier to analyze, thanks to the flame graph.

dotMemory 2019.3

dotMemory 2019.3 gets these updates:

  • A new self-profiling API, which lets applications initialize and start a profiling session on their own. The self-profiling API is distributed as a NuGet package.
  • The option to export instance details to a .json file (.bson, .hex, and .txt are also available).
  • The ability to view the virtual memory address of an object instance.

dotCover 2019.3

dotCover 2019.3 gains support for Unity projects and projects using Microsoft Fakes. In addition, dotCover is now able to group coverage results by nested namespaces in Rider, in Visual Studio, and in reports generated by the dotCover console tool.

dotPeek 2019.3

dotPeek 2019.3 can navigate to the external sources of NuGet packages that have a source symbols package (.snupkg) and supports decompiling these additional C# 7 language features:

  • Tuples
  • Deconstruction
  • Discards


Download ReSharper Ultimate 2019.3

The post ReSharper Ultimate 2019.3 Release Is Out! appeared first on .NET Tools Blog.

Viewing all 306 articles
Browse latest View live