I can't submit this as a bug through NCrunch because the wonderful corporate proxy I'm forced to go through appears to block it.
1. Created Xamarin Forms cross platform mobile application, with netstandard shared project.
2. Add <DesignTimeBuild Condition="'$(NCrunch)' == '1'">true</DesignTimeBuild> to the netstandard shared project so that it will build (as specified in a recent thread on the forum).
3. Add .net core 2.1 xunit test project using the default visual studio template.
4. Add some basic tests. One test uses a small PDF which is included in a resources .resx as a byte[] to test some Stream code.
5. NCrunch throws this exception to the output window when building the project:
An error occurred while analysing this project after it was built: NCrunch encountered an unexpected error occurred while building an environment to analyse an assembly: nCrunch.TaskRunner.Ipc.IpcConnectionClosedException: The connection has been closed
at nCrunch.Core.ProcessManagement.ExternalProcessManager.(ProcessorArchitecture , ProcessLoadParameters )
at nCrunch.Core.ProcessManagement.ExternalProcessManager.LoadExternalProcess(ProcessLoadParameters parameters, GridClientId client)
at nCrunch.Core.TestManagement.TestRunnerProcess..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Core.TestManagement.TestRunnerProcess.(Nullable`1 , FilePath , GridClientId , CustomEnvironmentVariable[] )
at nCrunch.Core.TestManagement.TestRunnerProcess..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Core.TestManagement.TestRunnerProcess.LoadTestRunnerProcessForProjectReturningProcessId(SnapshotComponent snapshotComponent, IList`1 componentsInProcess, TestFrameworkDescription[] testingFrameworks, Nullable`1 newProcessTag, FilePath solutionFilePath, GridClientId client, CustomEnvironmentVariable[] customEnvironmentVariables)
at nCrunch.Core.Processing.AnalysisTaskLogic.DoProcessTaskAndReturnSuccessFlag()
I saved the bug report .zip file, if you let me know where to email it to I'll send it over.
Remco, I removed the reference to the xamarin forms project from the xUnit project, and fixed up the tests so they are essentially empty. NCrunch still fails to build the xUnit project, throwing the same error.
Just to confirm, using the trick in the thread I linked to, NCrunch does build the xamarin project.
I forgot to mention in my first post, I get a message saying: "Unable to restore require Nuget packages for .NET Core test environment".
Following your suggestion above, I added package references to the xUnit project for the following three packages (which were listed in the output window).
Once I got it to build, I added the reference back to the Xamarin.Forms project, re-enabled the tests to properly test things in the xamarin.forms project and everything thing builds, test tests run. In fact, NCrunch, Resharper and the VS Test Runner all agree that the same tests fail for the same (currently expected) reasons.
So I would say that your assertion that Xamarin projects are not currently (officially) supported is perhaps not 100% accurate :)
sgrassie wrote:
I forgot to mention in my first post, I get a message saying: "Unable to restore require Nuget packages for .NET Core test environment".
When you have problems like this one, a message like this is definitely a red flag. NCrunch has certain package dependencies of its own, and when it can't restore those packages, it often won't be able to build test environments without .NET Core bugging out in weird ways. Most likely the steps you've taken have resulted in the necessary packages being restored, so that now the problem is completely gone :)
sgrassie wrote:
So I would say that your assertion that Xamarin projects are not currently (officially) supported is perhaps not 100% accurate :)
I tend to toe a careful line when making claims about supported toolsets. NCrunch probably will work with a very broad range of toolsets and frameworks without any testing or work required from our side, but there is an important difference between the application working with a toolset and the dev team providing support for such a setup. The big problem with Xamarin is that it is a very broad set of tools and that have changed considerably over the last few years. For me to confidently say that we support it would require me to ensure that all existing and prior Xamarin project types would work with NCrunch out of the box with no changes necessary, and that any newly introduced changes would be tested with all edge cases handled. Right now, I can't make this statement. We simply haven't had the dev capacity to tackle Xamarin (yet).
sgrassie wrote:
...
Following your suggestion above, I added package references to the xUnit project for the following three packages (which were listed in the output window).
For what it's worth, here's an update on this after I updated to NCrunch 3.18.02.
I've removed the package references in the unit test project, and it still builds, and the tests run without problems. Additionally the warning about being unable to restore required nuget packages for .net core test environment is gone.
I've left the previously mentioned hack in place, although I understand that I could now use the 'Custom build properties' feature to achieve the same goal without unnecessarily messing with the .csproj, but :shrug:, it's fine as it is.
Thanks for confirming that v3.18 works better in this area. There was a significant change introduced in v3.18 to try and address the platform dependency issues caused by NCrunch's own assemblies targeting earlier versions of .NET Core. I would hope that this change would render your primary issue impossible.
Yes, the 'Custom build properties' setting can also be used to override your build behaviour :)