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

Notification

Icon
Error

NCrunch dots not showing correctly for VSTO project
tamagochi
#1 Posted : Monday, May 30, 2016 7:50:43 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/30/2016(UTC)
Posts: 3
Location: Lithuania

Hi,

I've run into similar problem with VSTO project as described here http://forum.ncrunch.net...ject-build-failure.aspx
Working with VS2013, latest version of NCrunch.

There are two projects in my solution:
1) VSTO 4.0 Outlook plugin
2) NUnit test project, referencing the first one

When NCrunch is enabled with default settings, I get the following error for plugin project:
..\..\..\..\..\..\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets (176, 9): The "FindRibbons" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'Gsync, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. File name: 'Gsync, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

The test project seems to build fine, but gives various ambiguity warnings like:
WARNING - Data\OutlookContactRepositoryTests.cs (83, 31): Ambiguity between method 'Microsoft.Office.Interop.Outlook._ContactItem.Close(Microsoft.Office.Interop.Outlook.OlInspectorClose)' and non-method 'Microsoft.Office.Interop.Outlook.ItemEvents_10_Event.Close'. Using method group.

Afterwards I've set "copy referenced assemblies to the workspace" to true for the plugin project. The problem with not finding the file seems to be gone and the tests run. However the code covered by the tests in the main project is not marked by green/red dots - they are all black as if the lines were not covered at all. Any ideas how to resolve this?
Remco
#2 Posted : Monday, May 30, 2016 10:45:53 AM(UTC)
Rank: NCrunch Developer

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

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

I have no personal experience with VSTO projects, but it appears to me that this project type involves the execution of a build step that requires referenced assemblies to exist in the same directory as the assembly being built. Although undesirable, this isn't an unusual situation. Turning on the 'Copy referenced assemblies to workspace' should be the correct way to solve your build problem.

The missing test coverage is more of a mystery. Is the VSTO project, by chance, installed in your GAC? I'm wondering if it may be that NCrunch isn't able to resolve its instrumented version of this project's built assembly during test execution. A way you can confirm this is by running your tests using NCrunch with the debugger enabled, and examining the list of loaded modules in the debug session. The VSTO project should be loaded from inside one of the NCrunch workspaces.

I also suggest checking to see if the engine is giving you any warnings about abnormal assembly resolution behaviour. NCrunch will often detect when the test environment is not as it should be, and it will warn you about this.
tamagochi
#3 Posted : Monday, May 30, 2016 8:20:34 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/30/2016(UTC)
Posts: 3
Location: Lithuania

Thanks for the response. I've checked the debug output and the main project output "gsync.dll" is loaded correctly. Debug dump below:

'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestHost45.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestHost45.x86.exe): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\nCrunch.TestHost45.x86.exe'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestHost45.x86.exe): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\nCrunch.TaskRunner.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestHost45.x86.exe): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\nCrunch.Common.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestHost45.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestHost45.x86.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\nCrunch.TaskRunner.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\nCrunch.Common.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\nCrunch.TestExecution.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\nCrunch.Reflection.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Users\aungu\AppData\Local\NCrunch\14580\2\Gsync.Tests\bin\Debug\Gsync.Tests.dll'. Symbols loaded.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\Modules\NUnit\nCrunch.Module.NUnit.dll'. Cannot find or open the PDB file.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\Modules\NUnit\nunit.core.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2013\Modules\NUnit\nunit.core.interfaces.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Users\aungu\AppData\Local\NCrunch\14580\2\_ncrunchreferences\nunit.framework.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\assembly\GAC_MSIL\nCrunch.TestRuntime\2.23.0.2__01d101bf6f3e0aea\nCrunch.TestRuntime.dll'. Cannot find or open the PDB file.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Cannot find or open the PDB file.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Cannot find or open the PDB file.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Users\aungu\AppData\Local\NCrunch\14580\2\_ncrunchreferences\Gsync.dll'. Symbols loaded.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Users\aungu\AppData\Local\NCrunch\14580\2\_ncrunchreferences\NSubstitute.dll'. Cannot find or open the PDB file.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Users\aungu\AppData\Local\NCrunch\14580\2\_ncrunchreferences\NodaTime.dll'. Cannot find or open the PDB file.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Outlook\15.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Outlook.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Users\aungu\AppData\Local\NCrunch\14580\2\_ncrunchreferences\log4net.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll'. Cannot find or open the PDB file.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'DynamicProxyGenAssembly2'.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'DynamicProxyGenAssembly2'.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\assembly\GAC_MSIL\office\15.0.0.0__71e9bce111e9429c\office.dll'. Module was built without symbols.
'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Windows\assembly\GAC\stdole\7.0.3300.0__b03f5f7f11d50a3a\stdole.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
tamagochi
#4 Posted : Monday, May 30, 2016 8:26:45 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/30/2016(UTC)
Posts: 3
Location: Lithuania

After fiddling a bit more, I've discovered a solution.

In NCrunch configuration for tests project, added the implicit reference to the main project. Afterwards the coverage dots automagically appeared :)
Remco
#5 Posted : Monday, May 30, 2016 9:37:29 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Yes, it looks like this is a 'lost reference':

'nCrunch.TestHost45.x86.exe' (CLR v4.0.30319: nCrunch.TestRunner.AppDomain_ca9ef31b355b4da581c044df1545bca2): Loaded 'C:\Users\aungu\AppData\Local\NCrunch\14580\2\_ncrunchreferences\Gsync.dll'. Symbols loaded.

My assumption is that the Gsync assembly is being referenced by DLL, not by a project reference? In this case, the NCrunch should warn you about this problem. It can be solved by turning on this setting - http://www.ncrunch.net/documentation/reference_solution-configuration_infer-project-references-using-assembly.
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.057 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download