Locked BC30143 - Unable to embed Resource file

  • Wednesday, June 24, 2009 2:47 PM
     
     
    I have had this issue for quite a while. In fact since VS2005 it concerns me more because so few other people report it.

    During a build, from the VB IDE I get the following error

    vbc : error BC30143: Unable to embed resource file x

    this continues for approximate 38 files. The associated system error is &H8007000e - this system error suggests a memory issue. I do have 4GB RAM in my dev machine. I am running Vista SP2 (although I have had this error since XP)

    I have tried the /3GB switch and the largeaddressaware 'fix', but this can cause issue with other applications.

    If I get the above error in the IDE and then go and do a command line build, there is no problem.

    Periodically I also get numerous system.outofmemoryexception, this can happen when I try and open a form for editing for example. Other times the 38 entries can appear under a number of circumstances, such as closing a form, as if there is some kind of background compile going on (which I am sure there is).

    The above problems may not be related, but given the memory link of the 2 errors I think they are.
     
    I have checked the size of my resources files (in \obj) and there is no consistency to the size of those that won't embed. One that doesn't is 4K, another that doesn't is 379K. Yet there is one resource file at 1500K that embeds just fine.

    To enhance this. Sometimes the 38 will expand to every single file in my solution.

    The general case is to close VS and restart, not an ideal development environment having to close down every couple of hours or so.

    I have checked with my Anti-Virus vendor also. Tried running without AV and have a massive list of file exclusions for VS directories and also my project directories.

    I am using VS2008 Pro, with Developer Express toolset (Coderush and Refactor Pro) and Strataframe

    My application experiences no memory issues when running, this problem lies solely in the IDE.

    Anyone throw me anything on this?
    thanks G

All Replies

  • Wednesday, June 24, 2009 4:38 PM
     
     
    I embedded files all the time in my executable file without any problem. Can you explain the steps you took to embed files in resources.
    kaymaf
    I hope this helps, if that is what you want, just mark it as answer so that we can move on
  • Thursday, June 25, 2009 8:22 AM
     
     

    Hi ScottishYorkshireMan,

    If you feel free, please elaborate your question as kaymaf mentioned.

    Here are some references which may be helpful to you.
    1. Error Message: Unable to embed resource file '<filename>'
    http://msdn.microsoft.com/en-us/library/bh5zx4b5.aspx
    The Visual Basic compiler calls the Assembly Linker (Al.exe, also known as Alink) to generate an assembly with a manifest. The linker has reported an error embedding a native COM+ resource file directly into the assembly.


    2. KB: How to embed a manifest file in an executable file in Visual Studio .NET
    http://support.microsoft.com/kb/944276

    3. KB: How to embed and access resources in Visual Studio .NET
    http://support.microsoft.com/kb/319292



    Best regards,
    Martin Xie

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Thursday, June 25, 2009 8:35 AM
     
     
    Hi Kaymaf,

    The embedded files for me are simple images, icons, these are added from the image property on a button. Although, there do seem to be some strings in there from components that are added to forms. These are not added by me but by VS in the natural cause of development.

    This is why I am really quite puzzled by this and why it selects the files it does. Like I say I am sure this is a memory issue, but it has to be something unique to my setups. If I move the application to my laptop, again Vista SP2, but with 3GB ram, the issue is still prevalent.

    thanks for the interest.

    SYM.

    • Proposed As Answer by Caio.César Friday, May 11, 2012 12:47 PM
    • Unproposed As Answer by Caio.César Friday, May 11, 2012 12:47 PM
    •  
  • Thursday, June 25, 2009 11:12 AM
     
     
    Hi Martin,

    I had seen the details regarding the error from AL.exe, however I have never seen this in any output generated. More interesting for me is the description of the error as being related to embedding native com+ resources. I am not aware of any com+ resources in my application, that does not mean there are none, I am just not aware of adding any myself.

    I have run a diagnostic build this morning, however it has generated a fairly significant amount of text, including the errors in this case. However, I am reluctant to post it as it is over 1MB in size, but it could be zipped. Is there anything specific I should look for?

    The problem still only lies on a build done in the IDE. Despite the IDE failing the build, MSBuild in a command window does not fail. My project builds without issue. MSBuild has never failed my project.

    When Devenv.exe loads, it occupies approximately 80MB of memory. With no project loaded. When my project is loaded and CPU activity for DevEnv process returns to 0, 494MB is in use.

    1st Build (Diagnostic) - Memory returns to 497MB (succeeded)
    Modified 1 form and 1 Developer Express Report (note both items still open in IDE)
    2nd Build (Debug Run) - Memory now 653MB (succeeded)
    Modified 1 form and closed it - Start page only visible now - Memory now at 681MB
    attempted to open a form and dialog box showing Exception of type 'System.OutOfMemoryException' was thrown.
    3rd Build (Diagnostic) - Memory now showing 720MB (failed) - 31 Errors displayed - Unable to Embed resource file.

    Close Solution - Memory now at 510MB (note that no solution is loaded in IDE)

    CLose DevEnv.exe

    Restart DevEnv.exe
    1st Build (Diagnostic) Not Changes to last failed build - Build Succeeded.

    If the diagnostic file may help, please tell me where I can send it. I appreciate your help with this Martin, it has dogged me with this application since VS2005. I hope that VS2010 doesn't have the problem, but no one else seems to have it so my hope is limited.

    I would be happy to be told I have a configuration setting wrong somewhat, that would be great.

    thanks in advance.
    SYM




  • Thursday, June 25, 2009 1:17 PM
     
     
    Hi ScottishYorkshireMan,
      Below are links that explain how to embed file to executable or DLL. Some of the links have C# syntax but it almost the same as VB.

    http://www.devx.com/dotnet/Article/10831/0/page/2
    http://support.microsoft.com/kb/319292#appliesto
    http://blogs.msdn.com/rahulso/archive/2007/08/20/read-or-write-resources-from-into-a-dll-in-net-2-0.aspx

    VB
    http://www.vb-helper.com/howto_net_embedded_resources.html
    http://edndoc.esri.com/arcobjects/8.3/GettingStarted/WorkingwithResources.htm
    http://www.tek-tips.com/faqs.cfm?fid=4758

    kaymaf
    I hope this helps, if that is what you want, just mark it as answer so that we can move on
  • Thursday, June 25, 2009 1:51 PM
     
     
    Kaymaf,

    Thanks for this.

    If the problem was with how I had entered/were using my embedded resources, would the problem not also exist when the build was done from MSBuild?

    I appreciate your thoughts.

    SYM

  • Friday, June 26, 2009 8:36 AM
     
     Answered

    Hi SYM,

    I notice that When you start Visual Studio 2005, the Devenv.exe process occupies approximately 80MB of memory, that is very abnormal. Mine occupies approximately only 30M.

    Please try the following suggestions for general guidelines to fix VS IDE issues.

    1. Disable Add-ins (e.g. “Tools” | “Add-in Manager”) such as DevExpress toolset (Coderush and Refactor Pro) and Strataframe;
        or Start Visual Studio in safemode by command: devenv.exe /safemode.
    By doing this, Visual Studio will not load any add-in. This can eliminate the possibility that third party Add-ins are causing problems.

    2. Apply the latest service packs of Visual Studio.

    3. Create a new project, do you have the issue?
        Sometimes corrupted project settings can cause problems.

    4. Try the same solution in another machine with VS 2005.

    5. Tools menu -> Import and Export Settings -> Reset all settings

    Reference: http://social.msdn.microsoft.com/Forums/en/vbide/thread/15a42319-26f2-4a17-9943-f6feda086322/


    Best regards,
    Martin Xie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Thursday, July 02, 2009 11:20 AM
     
     

    Hello SYM,

    Does this help? If you have any future questions or concerns, please feel free to let us know. Thanks!



    Best regards,
    Martin Xie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Sunday, September 13, 2009 4:10 PM
     
     

    Hi SYM

    I am having an IDENTICAL issue to you, running on Vista 64bit with 4GB memory.

    In your first post you say:
    "vbc : error BC30143: Unable to embed resource file x

    this continues for approximate 38 files"

    ... then in ur 3rd post you say "31 Errors displayed - Unable to Embed resource file"

    My errors start at 7 and end on 38, thus also 31 Errors.  Is it the same with yours?

    Additionally, if I rebuild my solution the errors go away but as soon as I try run it I get:

    "
    The "GenerateResource" task failed unexpectedly.
    System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
       at System.IO.MemoryStream.set_Capacity(Int32 value)
       at System.IO.MemoryStream.EnsureCapacity(Int32 value)
       at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
       at System.IO.BinaryWriter.Write(Byte[] buffer)
       at System.Runtime.Serialization.Formatters.Binary.__BinaryWriter.WriteSingleArray(NameInfo memberNameInfo, NameInfo arrayNameInfo, WriteObjectInfo objectInfo, NameInfo arrayElemTypeNameInfo, Int32 length, Int32 lowerBound, Array array)
       at System.Runtime.Serialization.Formatters.Binary.__BinaryWriter.WriteObjectByteArray(NameInfo memberNameInfo, NameInfo arrayNameInfo, WriteObjectInfo objectInfo, NameInfo arrayElemTypeNameInfo, Int32 length, Int32 lowerBound, Byte[] byteA)
       at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteArray(WriteObjectInfo objectInfo, NameInfo memberNameInfo, WriteObjectInfo memberObjectInfo)
       at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo)
       at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
       at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
       at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
       at System.Resources.ResourceWriter.WriteValue(ResourceTypeCode typeCode, Object value, BinaryWriter writer, IFormatter objFormatter)
       at System.Resources.ResourceWriter.Generate()
       at System.Resources.ResourceWriter.Dispose(Boolean disposing)
       at System.Resources.ResourceWriter.Close()
       at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(IResourceWriter writer)
       at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(String filename)
       at Microsoft.Build.Tasks.ProcessResourceFiles.ProcessFile(String inFile, String outFile)
       at Microsoft.Build.Tasks.ProcessResourceFiles.Run(TaskLoggingHelper log, ITaskItem[] assemblyFilesList, ArrayList inputs, ArrayList outputs, Boolean sourcePath, String language, String namespacename, String filename, String classname, Boolean publicClass)
       at Microsoft.Build.Tasks.GenerateResource.Execute()
       at Microsoft.Build.BuildEngine.TaskEngine.ExecuteTask(ExecutionMode howToExecuteTask, Hashtable projectItemsAvailableToTask, BuildPropertyGroup projectPropertiesAvailableToTask, Boolean& taskClassWasFound)  
    "

    This is followed by a single:

    "Unable to open file 'C:\...\Form.Resources.resources': System Error &H80070020&"

    So you are right, it is definitely a memory issue, somewhere in the "GenerateResource" task...

    My problem is also only rectified with a VS restart, which is a pain as it takes a couple of minutes to reload some solutions.

    Did you manage to find another solution to this problem?

    regards,

    fieryneck
  • Sunday, October 04, 2009 12:52 PM
     
     
    Sir, I have the same problem. 
    It seems that you have got your solution though ,please help me with this:-
    'Error 1 Unable to embed resource file 'D:\Project\Project2\fxp\fxp\obj\Release\WindowsApplication1.Comp_prop_remote_select_remoteu_add_loc.resources': Not enough storage is available to complete this operation.  fxp'

  • Monday, March 12, 2012 8:20 AM
     
     

    Hello !

    I have resolved this in a simple mode:

    I have VS2008 + sp 1. The build ran well since an a day, when the above error rise.

    I've closed the VS, delete the obj folder, restart, and the build have been done.

    Success !

  • Friday, May 11, 2012 12:53 PM
     
     

    I had the same problem,

    I resolved by by cleaning registry and files of my pc running CCleaner and seting up windows to preformance mode you should run a dsk clean and defrag too.


    • Edited by Caio.César Friday, May 11, 2012 12:54 PM
    •