VS2022, Roslyn Source Generators, Other Improvements

by Remco 10. July 2021 19:04

It's been a bit longer than we would have liked since our last release.  We had a few things that stretched the schedule out a bit, but I hope it has been worth the wait.

The most significant of these was support for the new VS2022 preview build that was recently released by MS.  Originally, we planned for VS2022 support to be introduced in NCrunch 4.10, but thankfully we were able to knock this one out quicker than expected and made the call to delay v4.9 a little for the chance to include it.

We also have some very large new features coming soon that aren't ready for release yet, but we've still been investing a lot of time into them.  I'll publish more information about these features as they start to solidify.  Anyway, I'm happy to announce that NCrunch v4.9 is now available for download.  I'll do my best to summarise here what is contained in v4.9.


VS2022 Preview Support

Most of you will already be aware that last month MS released the first preview build of VS2022.  We've been anticipating this build for some time and in expectation of it being a big one, we planned most of our work around it.  It's been 3 years since the last significant release of VS, so we expected this to be a big one.  Fortunately, the level of internal change in the IDE was less than we expected, so we've been able to hammer out support for it quickly.  This means that NCrunch v4.9 is now the first build that support VS2022.

Note that as VS2022 is still in a preview state, there is a high chance that NCrunch v4.9 will not work with later preview builds of VS2022 or with its RTM state.  We're expecting there are still more changes to come to the IDE, and we'll adapt NCrunch to these as we become aware of them.  I'd like to ask everyone to be patient with this as integrating with preview builds is often a troublesome and frustrating process.


Roslyn Source Generation Support

Over the last few months we've had many requests for NCrunch to work with the new source generation system integrated with Roslyn's code analyzers.  This has been a bumpy road for us, as the tooling in this area is still largely in a preview state with much of the documentation fragmented or unreliable.  This has not been helped by the scope of change still being made to the way the source generation works, as many of the older code samples simply haven't worked for us in a development or testing scenario.

The good news is that we now finally have this solved with NCrunch v4.9 and it should work out of the box.  However, because of the way the source generation works, we presently can't instrument the source generation code or perform any level of impact detection for this code.  This means that if you change your source generators, you will likely need to queue your tests for execution manually if you are operating in the 'Run impacted tests automatically, others manually' engine mode.


Custom Engine Mode Button Colouring

We've added the ability to change the colour of the engine mode button on the Tests Window.  This is controlled through a new configuration setting, 'Engine mode colour'.


The 'Engine mode colour' setting is typically overridden by the engine modes themselves.  This makes it easy to see which engine mode you are operating in (as long as you have the Tests Window open while you work).


We've added some colours to the default engine modes that are automatically added by NCrunch the first time it's used.  If you've customised your engine modes, you might need to add these settings in manually to take advantage of the new feature.


Automatic Synchronisation of Additional Files for Grid Processing


The 'Additional files for grid processing' setting has long been available to make it easier to share bulky resources with grid nodes that are too big to be copied between NCrunch's workspaces.  The major drawback of this setting is that it hasn't had any synchronisation system built into it, so if the resources are changed on disk, the entire NCrunch engine needs to be reset before they'll be copied up to the grid node.

To put it simply, we've fixed this now so that the resources will be automatically uploaded to the grid when NCrunch detects them as changed on disk, so it's now no longer necessary to reset the engine.


Automatic Synchronisation of Configuration with File System


We've also updated the NCrunch settings engine so it will automatically load any changes to the NCrunch settings files detected on disk.  This means that the settings should now be seamlessly shared with anything pulled down from a VCS or even between multiple sessions of NCrunch.  It is now no longer necessary to reload the solution to pick up any changes made to NCrunch settings after a git pull.


Ability to Pin Tests By Namespace and Project


It's now possible to pin tests by namespace and project in the NCrunch Tests Window.  Note that although tests can be pinned in this way, the namespaces and projects are not represented in the hierarchical structure.  This means that if you pin a namespace, NCrunch will pin all tests in the namespace but it will not pin the namespace itself.  If a new fixture is added to the pinned namespace, it won't be pinned.  This logic has to do with the different grouping structures available in the Tests Window.  There was no way we could implement hierarchical pinning through projects or namespaces without creating some crazy and difficult to understand UX scenarios.  So this is the next best thing we could come up with.


Retiring Old Code


Because of some very big features we have in the works right now, we've taken the opportunity to remove redundant areas of the product that are no longer being used or simply aren't needed anymore.  This has become necessary because updating this old code to work with the new features would be tricky and unnecessary, so it just wasn't worth keeping it in the product anymore.

The first thing we've taken out is support for VS2008.  We haven't had a download of NCrunch for VS2008 for a long time now, so it's pretty clear the world has moved on.  Please note that we presently have no plans to remove VS2010 in the near future, as this version of VS is similar enough to later VS versions that we don't have a good reason to pull it out.  There are also a surprising number of people that still use VS2010.

The second thing we've removed is our old instrumentation system that was dependent on Mono.Cecil.  The release of NCrunch v4 saw the introduction of a new instrumentation system with significantly improved performance and better compatibility with certain areas of .NET.  This means that the legacy 'Instrumentation Mode' setting has now been removed from NCrunch and all code will now need to use the new optimised CIL system.


Other Stuff


As it's been a while since v4.8 went out the door, we have quite a few smaller fixes and adjustments in the v4.9 release.  Check out the full list of changes for more information, and go grab the new build!


Month List

Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download