0

I'm trying to rebuild an old C# project (VS 2010, .Net 2.0) 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 features).

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

The actual error I get in the output is in the ResGen running: 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?

Community
  • 1
  • 1
dfranca
  • 5,156
  • 2
  • 32
  • 60
  • the error is obvious.. but what's not obvious is which object is causing the error.. we can't see your code so posting code that is relevant to your current issue would help many of us.. if you have an object declared something like this `MyObject = null;` then somewhere in your code where you are trying to use the Object of a particular `Class` then you must `new` that object for example `MyObjecy someobj = new MyObject()` – MethodMan Oct 21 '14 at 22:06
  • Could you post the whole Stack Trace? – Michael Hommé Oct 21 '14 at 22:06
  • The error is being raised in a resource (resx, xml), and it's only being raised in the new computer, the same code in the old computer build fine, even changing the .net target framework to 4.0 it builds fine in the new computer, so my guess is that it's much more related to compatibility issue than a simple null object. – dfranca Oct 22 '14 at 02:43
  • I edited with a better explanation and more details – dfranca Oct 22 '14 at 07:42

0 Answers0