Search code examples
c#.netvisual-studio-2010.net-2.0

“Object reference not set to an instance of an object.” running ResGen in .Net 2.0


I'm trying to rebuild an old C# project (VS 2010, .Net 2.0, originally developed in VS2008) in a Windows 8 PC, but I keep getting this error in one of the resources (windows forms): Error 29 Object reference not set to an instance of an object.

After some research I found that one of the possible solutions is to change the .Net target framework... I did it, changing to .Net 4.0 make it build... but the app starts giving a lot of errors while running (i.e: it stops playing videos, which is one of the main features).

Removing the resource make it works (build and play videos), but of course I can't access the form/resource I removed:P I tried to search for some .Net 4.0 reference in the resource file... no success.

The actual error I get is this one in the ResGen output: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\ResGen.exe /useSourcePath /r:[...] UI\Config\EmulationFonts.resx : error RG0000: Object reference not set to an instance of an object. UI\Config\EmulationFonts.en-US.resx : error RG0000: Object reference not set to an instance of an object.

I don't think it's duplicated of the question What is a NullReferenceException, and how do I fix it? It's more related to this: https://social.msdn.microsoft.com/Forums/vstudio/en-US/8a061a50-a507-419b-9785-b1205bbec93b/resgen-rg0000-object-reference-not-set-to-an-instance-of-an-object?forum=msbuild

In that case the error was solved changing the target framework to .Net 4.0, but in my case it makes the video playing feature stop working.

Any idea about what can be causing the error?


Solution

  • I solved it moving from VS2010 to VS2013.