I have a C# Project that includes 2 .dll files with the following Properties settings:
Build Action : Embedded Resource
Copy to Output Directory : Do not copy
I also have two project references that respectively reference these 2 .dll files. Each of these references have their Properties settings for Copy Local set to False.
**These settings are required for me to have a single .exe file in my build's output directory**
The problem I am seeing is that as long as the 2 .dll files have their Build Action set to Embedded Resource, NCrunch fails to build this project due to a System.OutOfMemoryException even though the project builds just fine through Visual Studio (see following for full spit-out):
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at Mono.Cecil.PE.ByteBuffer.Grow(Int32 desired)
at Mono.Cecil.PE.ByteBuffer.WriteBytes(Byte[] bytes)
at Mono.Cecil.MetadataBuilder.AddResources()
at Mono.Cecil.MetadataBuilder.BuildModule()
at Mono.Cecil.ModuleWriter.<BuildMetadata>b__0(MetadataBuilder builder, MetadataReader _)
at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata)
at Mono.Cecil.ModuleWriter.WriteModuleTo(ModuleDefinition module, Stream stream, WriterParameters parameters)
at Mono.Cecil.ModuleDefinition.Write(Stream stream, WriterParameters parameters)
at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
at nCrunch.Compiler.StaticManipulation.BuiltAssembly.#=q5vpF3zzm5zqKWCqcfbybS1u$DyuX6VxOlACprKPOhos=.#=qiXU_bNfvoheaf1Kj33xMBnSi6oPkLBSuauav99oaDfM=()
at nCrunch.Compiler.StaticManipulation.BuiltAssembly.#=q7yp7R2vCg7OHrM_sd9tAMw==(Action #=qkWXG3M1rwpI6MlmUHfcmCA==)
at nCrunch.Compiler.StaticManipulation.BuiltAssembly.Instrument(ComponentSourceLineMap sourceLineMap, IDictionary`2 instrumentationDirectivesByCodeFileId, IDictionary`2 codeFileIDsByFilePath, Boolean proxyProcessIsActive, Int32 componentId, IInstrumentationFilter[] instrumentationFilters)
at nCrunch.Compiler.RemoteBuildRunner.#=qgKRq1fUIr1IxXJQPqNrCdDnHIt2sr6IitqvDmQ34$FU=(ComponentBuildParameters #=qSQJL7L_EzBixm2aAhyr7pQ==, FilePath #=qOmmMHYYQpG_c7PD9b7zxTo$tlPrG1q1r5uLHobVtx_o=, BuildOutput #=qJ9z5KdrHTj3gG8xDkzDJpg==, DirectoryPath[] #=q8jp6VSMp9XO0CSWIyQa4EFaTpoE$OOwCDUtQgSXJHRQ=, FilePath[] #=qajJdvqLBN9egZtr61G5Ke8CCzie8cGDvhY6gfRfVdH2OyTQgx5OMzyo3KrStLz9q)
at nCrunch.Compiler.RemoteBuildRunner.Build(ComponentBuildParameters parameters)
I am wondering if this is a known issue or if there are any settings I can changes to allow this project to build through NCrunch.
Thanks!
Build/Test Issues
Embedded Resource DLLs cause System.OutOfMemoryException
Started by Arlockff on 7,125 views
Remco NCrunch Developer
#6372
12 Sep 2014 21:59 UTC
Hi, thanks for sharing this issue. It's the first time I've seen this happen.
How large are the two DLL files? Do you notice any difference if one of these files is excluded from being embedded? Also, how much memory do you normally have available?
Is there any chance you can get me a code sample that can reproduce this?
Disabling the 'Instrument output assembly' setting for this project will allow you to work around this problem, but you'll lose all code coverage tracking across the project.
How large are the two DLL files? Do you notice any difference if one of these files is excluded from being embedded? Also, how much memory do you normally have available?
Is there any chance you can get me a code sample that can reproduce this?
Disabling the 'Instrument output assembly' setting for this project will allow you to work around this problem, but you'll lose all code coverage tracking across the project.
Thanks for the reply! The "Instrument output assembly" setting did the trick for me!
I cannot give sample code for this, but the two DLL files are both third party ones:
MahApps.Metro.dll (658 KB [673,792 bytes]) which can be acquired from a nuget package or from http://mahapps.com/
System.Windows.Interactivity.dll (39 KB [39,936 bytes]) which is needed for MahApps.Metro.dll
I found that NCrunch didn't like either of them as Embedded Resources. I am running on pretty good machine (12.0 GB RAM and a Xeon CPU on a Windows 7 64-Bit OS) and using Visual Studio 2013 with Update 3 (Version 12.0.30723.00).
Again, your suggestion fixed my problem, but hopefully this is enough to help you find out the underlying issue.
Thanks again,
James
I cannot give sample code for this, but the two DLL files are both third party ones:
MahApps.Metro.dll (658 KB [673,792 bytes]) which can be acquired from a nuget package or from http://mahapps.com/
System.Windows.Interactivity.dll (39 KB [39,936 bytes]) which is needed for MahApps.Metro.dll
I found that NCrunch didn't like either of them as Embedded Resources. I am running on pretty good machine (12.0 GB RAM and a Xeon CPU on a Windows 7 64-Bit OS) and using Visual Studio 2013 with Update 3 (Version 12.0.30723.00).
Again, your suggestion fixed my problem, but hopefully this is enough to help you find out the underlying issue.
Thanks again,
James
Remco NCrunch Developer
#6393
15 Sep 2014 22:17 UTC
Thanks James, I'll take a look and will see if I can reproduce the issue :)
Cheers,
Remco
Cheers,
Remco
Remco NCrunch Developer
#6612
21 Nov 2014 05:23 UTC
Hi James,
Unfortunately I haven't had any luck in reproducing this issue.
I realise it's been a couple of months since you've reported it, so I'm not sure if this is still troubling you - but if it is, I'm wondering if setting the 'Build process CPU architecture' for this project to 'x64' in your NCrunch project settings makes any difference here? If you manage to put together a sample solution that can make this problem happen, I'd be really keen to get my hands on it. The samples I've attempted to build with the embedded files you've named for me don't seem to cause any memory issues in the build process.
Thanks!
Remco
Unfortunately I haven't had any luck in reproducing this issue.
I realise it's been a couple of months since you've reported it, so I'm not sure if this is still troubling you - but if it is, I'm wondering if setting the 'Build process CPU architecture' for this project to 'x64' in your NCrunch project settings makes any difference here? If you manage to put together a sample solution that can make this problem happen, I'd be really keen to get my hands on it. The samples I've attempted to build with the embedded files you've named for me don't seem to cause any memory issues in the build process.
Thanks!
Remco
Post a reply
Log in to reply.