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

Notification

Icon
Error

NCrunch Build Failing on MATLAB Reference
cshouts
#1 Posted : Monday, June 11, 2012 1:22:29 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/5/2012(UTC)
Posts: 4
Location: Milwaukee, WI

Thanks: 1 times
When attempting to build a project that references MATLAB's MWArray.dll, NCrunch generates the following error message:
Quote:
CSC (0)#1: Metadata file 'c:\Users\cshoutc\AppData\Local\NCrunch\8484\109\_ncrunchreferences\MWArray.dll' could not be opened -- 'Error importing module 'ManagedCPPAPI.netmodule' of assembly 'c:\Users\cshoutc\AppData\Local\NCrunch\8484\109\_ncrunchreferences\MWArray.dll' -- The system cannot find the file specified. '

This project builds fine using Visual Studio locally or MSBuild on the CI server. Any suggestions? I have verified that the MATLAB Compiler Runtime v7.13 is installed and have rebooted since installation. I'm fresh out of ideas.

Thanks,

Chris
Remco
#2 Posted : Monday, June 11, 2012 9:29:28 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi Chris -

I haven't heard of anyone using NCrunch with a MATLAB project before, so this is uncharted territory .. but let's see if we can get this to work :)

If you right click on the project with a failing build, then choose Advanced->Browse to workspace, can you find the MWArray.dll file in the workspace at the expected path?

Adjusting the 'Include static references in workspace' option MAY solve this problem - although I'm hoping to remove this configuration option soon, so it would be good to figure out why this isn't working. Is there also any chance you could submit a bug report after the build fails?


Thanks!

Remco
cshouts
#3 Posted : Tuesday, June 12, 2012 12:25:58 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/5/2012(UTC)
Posts: 4
Location: Milwaukee, WI

Thanks: 1 times
Remco;2141 wrote:

If you right click on the project with a failing build, then choose Advanced->Browse to workspace, can you find the MWArray.dll file in the workspace at the expected path?

I have checked the workspace and verified that MWArray.dll does exist at the expected path
Remco;2141 wrote:

Adjusting the 'Include static references in workspace' option MAY solve this problem - although I'm hoping to remove this configuration option soon, so it would be good to figure out why this isn't working.

The 'Include static references in workspace' option was set to 'True' for all of my projects. Setting that option to 'False' for the projects with a reference to MWArray.dll appears to have fixed the build issue. When NCrunch attempts to run the related unit tests however, they fail with the following error message:
Quote:

System.BadImageFormatException: Could not load file or assembly 'MWArray, Version=2.10.0.0, Culture=neutral, PublicKeyToken=e1d84a0da19db86f' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'MWArray, Version=2.10.0.0, Culture=neutral, PublicKeyToken=e1d84a0da19db86f' ---> System.BadImageFormatException: Could not load file or assembly 'file:///C:\AnonymousSolution\lib\Matlab\MWArray.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'file:///C:\AnonymousSolution\lib\Matlab\MWArray.dll'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at nCrunch.Common.CustomAssemblyResolver.ResolveAssemblyWithShortName(String shortAssemblyName)
at nCrunch.Common.CustomAssemblyResolver.#=qv0KZ_UwTbsHg6IgpYUSrs9wZQLwP1D4aQqcSl6MVHPU=(Object #=qsmZFRLWL1wlpfQ6z355tLw==, ResolveEventArgs #=qIjyzl5SKDG0dmtpmuiVHQA==)
at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
at AnonymousSolution.Tests.Matlab.MatlabConverterTest.ToMwCellArrayTest()

The unit tests all pass if I run them outside of NCrunch with MSTest or ReSharper.
Remco;2141 wrote:

Is there also any chance you could submit a bug report after the build fails?

I submitted a bug report after a failed rebuild attempt as requested.

Thank you very much for your assistance thus far and please let me know if you need any more information to determine the root cause.

Cheers,

Chris
Remco
#4 Posted : Tuesday, June 12, 2012 9:26:59 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Thanks Chris - I'll take a look at the issue and will get back to you when I have more information.
Remco
#5 Posted : Wednesday, June 13, 2012 1:58:30 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi Chris -

I've looked at this a bit deeper, and it looks like at this stage it won't be feasible to add support for MATLAB libraries with NCrunch. Sorry, there's not much I can do to help here.


Cheers,

Remco
1 user thanked Remco for this useful post.
cshouts on 6/13/2012(UTC)
cshouts
#6 Posted : Wednesday, June 13, 2012 11:55:21 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/5/2012(UTC)
Posts: 4
Location: Milwaukee, WI

Thanks: 1 times
Remco;2155 wrote:
Hi Chris -

I've looked at this a bit deeper, and it looks like at this stage it won't be feasible to add support for MATLAB libraries with NCrunch. Sorry, there's not much I can do to help here.


Cheers,

Remco


That's unfortunate, but thank you for looking into it. Do you have any more details about why it is infeasible? Is MATLAB doing some strange voodoo magic? I am quite curious about this!

Thanks again,

Chris
Remco
#7 Posted : Wednesday, June 13, 2012 10:26:46 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi Chris,

It seems like the format of the MATLAB library is somehow inconsistent with a normal CLR reference. My theory is that there must be some kind of injection point or custom build step that is specific to MATLAB, but in all truth the problem leaves me quite clueless. The main barrier I found was in needing to set up and learn the dimensions of a new development environment in order to recreate and isolate the issue. At this stage in NCrunch's development it's difficult to commit the resources to this, though perhaps it could be looked into at a later date.


Cheers,

Remco
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.064 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download