Sunday, June 30, 2013

Visual Studio throws an exception: "Object reference not set to an instance of an object."


What do you mean "I think it is important". Either you need the line/Size or you need it not. There is no "maybe" in Programming.


From the code you showed us, the Reactangle Size has no meaning at all. It seems to store the precalculated Scaled Size of the texture, but it is never used. The Rendering Engine just takes the Texture and the Scale, not Size.


What makes it even less understandable, is that you have this line in two different places:


Once in Scale.Set()

Once in LoadContent()


The one in Scale.Set() could fail because there is no Texture loaded (yet).


The one in LoadContent() could fail when "theContentManager.Load<Texture2D>(theAssetName);" returns null.




Let's talk about MVVM: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b1a8bf14-4acd-4d77-9df8-bdb95b02dbe2





Yeah I have noticed that this line is typed twice, however I solved it myself.



I LOVE VISUAL STUDIO ULTIMATE 2012!!! (Since I was coding with the express versions, now when I have the brand new one it's great!


No comments:

Post a Comment