resgen RG0000: Object reference not set to an instance of an object

Proposed Answer resgen RG0000: Object reference not set to an instance of an object

  • Monday, July 26, 2010 8:34 PM
     
     

    Hi,

    On Visual Studio 2010 RTM running on Windows XP, Windows Server 2003 (both 32 bit), I am experiencing an error building a project with resources. The build is running on a ClearCase Dynamic View, targetting view private directories. The build is targetting .NET 3.5 SP1

    When I run the build, the project fails on the ResGen step (resgen.exe ... /compile WorkOrderDetails.resx,obj\Debug\MyNamespace.WorkOrderDetails.resources) with the statement:

    WorkOrderDetails.resx : error RG0000: Object reference not set to an instance of an object.

    The full command that we are using is:

     "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\ResGen.exe" /useSourcePath /r:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll /r:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /r:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /r:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /r:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /r:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.XML.dll /r:\\View\Deploy_Release2_Maintenance\CLMTRS\NU.ClmTrs\NU.ClmTrs.Reports\Library\Telerik.Reporting.dll /compile WorkOrderDetails.resx,obj\Debug\NU.ClmTrs.Reports.WorkOrderDetails.resources

    I have seen reports of this error where the 64bit factor is a problem, but we don't have that installed. We're pure 32bit for now.

    I appreciate any help you can provide,

     

    Gary Klesczewski / Northeast Utilities

All Replies

  • Tuesday, July 27, 2010 2:49 AM
    Moderator
     
     

    Hello,

    Please try to change Target .NET framework from 3.5 to 4.0. To do it, you can navigate to Project Properties >> Application, and change Target framework to .NET Framework 4. For more information, please see:

    http://connect.microsoft.com/VisualStudio/feedback/details/557469/visual-studio-2010-generates-invalid-assembly-in-some-cases

    Please let me know the result.

    Regards,

    Nancy Shao [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com


    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.
  • Friday, July 30, 2010 9:09 AM
    Moderator
     
     

    Hello,

    I am writing to follow up this issue. Please let me know what I can help. Thanks.

     

    Regards,

    Nancy Shao [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com


    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.
  • Wednesday, November 03, 2010 3:00 PM
     
     

    Hi,

    I have actually the same problem and found out that resgen.exe with unc path in parameter /r cause the problem. As I can see you're using an unc path (\\view\deploy....) too. When I remove this path it works. So it seems to me that resgen.exe can't handle unc path?

    We're using VS 2010 and TFS 2008

     

    Frank Jona

  • Monday, January 03, 2011 3:05 PM
     
     

    I have the same issue. The project is a Windows Forms application created in VS2010 using .NET Framework 4. If I try to downconvert the target framework to anything less than 4, I get this error, even though there's nothing in the project that should depend on v4.

    Maybe something got put into the .resx when it was created against v4 which tickles a bug in the resource compiler when it attempts to build against pre-v4?

  • Tuesday, June 28, 2011 8:02 AM
     
     Proposed Answer
    In my case I found references to framework 4 assemblies in the resx-file. (Only in one form of the project?!?) When I changed the references to 2.0.0.0 the problem disappeared.
    • Proposed As Answer by Lenin Paredes Sunday, October 30, 2011 11:36 PM
    •  
  • Sunday, October 30, 2011 11:38 PM
     
     
    Uli F response is correct. recompile after fix
  • Tuesday, April 17, 2012 5:59 PM
     
     

    I debugged resgen.exe and dug up the following exception, which got swallowed somewhere along the road:

    System.IO.FileLoadException occurred
      Message=Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
      Source=mscorlib
      StackTrace:
           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)
      InnerException: