Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

[VS2017] When NCrunch is Enabled, NuGet packages are being uninstalled
mmisztal
#1 Posted : Sunday, March 12, 2017 9:57:26 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/17/2013(UTC)
Posts: 8
Location: Poland

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hi,

I'm facing a rather weird issue.

I'm using NCrunch 3.5.0.1 and VS2017 Professional.

When ncrunch is becoming ENABLED, it's uninstalling packages from my project - which in consequence makes the builds fail

Am I missing something? or is this a new feature I'm not yet aware of?
Remco
#2 Posted : Sunday, March 12, 2017 10:01:04 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,145

Thanks: 960 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi, thanks for sharing this issue.

This is .. very weird. I haven't heard a report like this before.

Can you describe in detail what you're seeing when these packages uninstall? Are we talking about the references from a project to Nuget packages?

Package references are usually declared in project XML. There is no code in NCrunch that manipulates source code or project XML.
mmisztal
#3 Posted : Monday, March 13, 2017 12:05:07 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/17/2013(UTC)
Posts: 8
Location: Poland

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Here you go: https://youtu.be/tjbhHdUiZnk

There was some audio but apparently my mic is broken.
Basically, NCrunch seems to remove the package that was added last (Shoudly) to the unit tests project.
After re-adding the package, NCrunch didn't pick this fact up, so I had to manually start a rebuild process, which triggered the package removal again.

In a different SLN it removed a package (MediatR) from the only assembly in the project.

Hope this helps.
Remco
#4 Posted : Monday, March 13, 2017 2:51:25 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,145

Thanks: 960 times
Was thanked: 1290 time(s) in 1196 post(s)
Wow.. It just vanished! That's crazy.

There is one thing I can think of that will do this.

When NCrunch loads a project for the first time, it will run 'dotnet.exe restore' for this project. This will happen if the project is using the new CPS system (i.e. minimal .csproj template).

So my best guess here is that dotnet restore is dropping the reference for some reason.

When you start NCrunch, have all changes to the project been saved to disk?

Also, can you confirm the TargetFramework for this project? (you can just grab this out of the project XML, i.e. <TargetFramework>netcoreapp1.1</TargetFramework>)
Remco
#5 Posted : Monday, March 13, 2017 3:45:03 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,145

Thanks: 960 times
Was thanked: 1290 time(s) in 1196 post(s)
Ok, I've managed to get this happening for me.

It's because the project changes haven't been saved to disk.

NCrunch accepts the in-memory changes from VS, and then uses these changes to load the project. It doesn't save the changes to disk, so 'dotnet.exe restore' doesn't have them when it works with the project file. Because dotnet restore touches the project file, VS discards its in-memory changes and automatically reloads the project file from disk.

This is rather messy. It means that project changes will automatically be stripped by NCrunch if the engine is running while the changes are made.

To work around this, make sure NCrunch is disabled when you make changes to your projects. Always save in-memory changes before starting the engine.

I'll see what I can do about implementing a proper fix.
Remco
#6 Posted : Wednesday, March 15, 2017 4:38:19 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,145

Thanks: 960 times
Was thanked: 1290 time(s) in 1196 post(s)
A fix for this is now out with v3.6.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.046 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download