Win32 Exception error?

For some reason my code:

is outputting this error: and is highlighting the coords list. It causes the game to crash after 20 seconds or so. Does anyone know what to change?

I don’t see anything in the code provided that would cause that kind of error.

The additional info of ‘Creating window handle’ and the ‘System.Windows.Forms’ suggests you’re doing something with winforms or its classes beyond the scope of the code shown here? Unless it has something to do with inheriting from Game1… which as was pointed out in another post you made earlier, isn’t really recommended unless you have a special need. I’d start but making a new class which doesn’t inherit from Game1 and put this code in there instead, then see what happens.

Also, stack traces are very useful. You can see them by looking at the additional details on the error. Depending on how the exception is being handled, the source of the problem could be anywhere.

I second what Rei said. If you don’t need a second game window and just want a class for rendering something specific using SpriteBatch, don’t derive it from Game1.

It’s very annoying to see a second double post when the poster doesn’t reply to the original after answers are given.

So allow me to answer directly and bluntly then.

For some reason my code:

You have shown us a cut off image of a class that is extending game1 for absolutely no reason and doesn’t use anything in game1 it also has a call to base.Draw which is a bad idea when you are not overriding the base class and your draw is local to the derived class and is callable from who knows were.

You then post another image that shows a error to code that is completely unrelated to the code shown in the image you just posted.

is outputting this error

But it is obviously not outputting this error…
component object model windows system 32 Winforms Forms dll (Dynamic Link Library) Exception.

it makes no sense why you would want to extend game1 to the class when you just want to call its method from game1 and then call base.Draw(gameTime); still ?

anyone know what to change?


  1. Tell us what you’re actually trying to do because it is very likely you are trying to do something in completely the wrong way. Because the code you posted is nonsensical in the first place.

  2. Don’t post images of your code.
    Post your code using copy paste (control c in the ide the control v in this posting box), then use the preformatted text button.

  3. Post the actual game1 or the code that is calling the selection class and or the code that is calling the draw method. Which btw the actual drawing loop is fine in fact you can probably call that even from game1 if you had gotten rid of the base.draw call. But it would still make no sense.

  4. Tell me why you didn’t just use a drawable game component as i suggested in your other post or why you need to derive from game1 at all for what reason?
    Tell me why you aren’t adding begin end calls for spritebatch as others suggested to you more then once ?.

  5. Actually read and respond to reply’s instead of double posting the exact same question twice.

1 Like

Whilst I agree, he did just join fairly recently and frankly this forum is not the best of designs for navigation until you realise it is akin to a popularity contest design. not the best for programmers at all. much prefer StackOverflow to be honest… not that I have used it much, and having said this, I went to take a look and there are a lot of posters there under the ‘XNA’ search term……. insert Jackie Chan WHAT!? meme here…

Nevertheless, I adore this forum, just wish we moved to something more, functional… soon.