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

Notification

Icon
Error

Azure Functions project causes a Console to be open every time NCrunch builds
rodolfograve
#1 Posted : Tuesday, February 6, 2018 1:09:25 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/6/2018(UTC)
Posts: 1
Location: United Kingdom

Hi.

I am having a very annoying issue whenever there is an Azure Functions project in my solution.

Environment:
  • Visual Studio 2017 15.5.5
    Windows 7
    NCrunch 2.12.0.15


Reproduction:
In a solution with NCrunch enabled, create a new Azure Functions project. You will repeatedly see a cmd console being opened every time you make a change. The title of the console is "Microsoft.NET.Sdk.Functions.Generator.exe"

Current workaround:
Configure NCrunch to completely ignore the project, but this is far from ideal.

Were you aware of this issue? Is there a better workaround available?
Remco
#2 Posted : Tuesday, February 6, 2018 10:22:10 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi, thanks for posting.

For a good number of years now, NCrunch hasn't contained any code that would instantiate a console window under windows. My guess would be that this is being triggered by a build step in your project that is creating the window in its own code. As such, the problem would be in your build system rather than NCrunch itself.

Unfortunately there isn't much I can do to help you with this problem. Azure projects aren't officially supported by NCrunch. I recommend looking to see if there are any updates to your Azure toolkit or whether there are any build steps you can safely disable using NCrunch-conditional build behaviour.


Edit: I've had an idea that may help. If the build system contains code that insists on creating a visible window, there isn't much NCrunch can do to stop it. However, it IS possible to set up your environment in such a way that the build code will run under a different user profile. You can do this using NCrunch's distributed processing. Basically, set up a grid node on your local machine, transfer all the local processing to it (disable (local) in the Grid Management Window), then set this node to run under a different user account on your machine. In this way, you'll never see the window appear unless you run a test with the debugger attached.
dlaughland
#3 Posted : Wednesday, March 14, 2018 8:28:10 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/12/2014(UTC)
Posts: 2
Location: United States of America

Was thanked: 1 time(s) in 1 post(s)
I'm having this issue too. The window is being created in the SDK at this point, but there isn't a great point to override this in any of the Functions SDK built targets. I opened a pull request with Microsoft asking them if we can change the window behavior; we'll see what they say.

The workaround I'm currently using is to add this to my .csproj:

Code:
<PropertyGroup Condition=" '$(NCrunch)'=='1' ">
  <ExcludeRestorePackageImports>true</ExcludeRestorePackageImports>
</PropertyGroup>


But this has the effect of excluding all build targets that come from NuGet packages, which may have other bad side-effects. Since my tests don't depend on the entire package being in place--only the main function assembly, this at least gets me up and running.
dlaughland
#4 Posted : Wednesday, March 21, 2018 9:05:14 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/12/2014(UTC)
Posts: 2
Location: United States of America

Was thanked: 1 time(s) in 1 post(s)
Good news! The folks at Microsoft just published v1.0.10 of the Microsoft.Net.SDK.Functions package to NuGet, which contains a fix for this issue.
1 user thanked dlaughland for this useful post.
Remco on 3/21/2018(UTC)
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.041 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download