   [.net] C# and Tao.SDL
  I've tried to get together with C# and SDL for a while, and for my surprise I found Tao SDL which I thought would help me alot in learning SDL, especially since you can actually follow books meant for C++. Anyway, there is though some problems.I've more and more experienced a NullReferenceException. This is when I try to marshal an SDL type.using System;using System.Text;using System.Runtime.InteropServices;using Tao.Sdl;namespace Example_3{    class Program    {   const int SCREEN_WIDTH = 640;   const int SCREEN_HEIGHT = 480;   IntPtr g_pDisplaySurface;   IntPtr g_pBitmapSurface;   Sdl.SDL_Surface g_DisplaySurface;   Sdl.SDL_Surface g_BitmapSurface;   Sdl.SDL_Event g_Event;   Sdl.SDL_Rect g_SrcRect, g_DstRect;   Random rand = new Random();   static void Main(string[] args)   {  new Program();   }   public Program()   {  Sdl.SDL_Init(Sdl.SDL_INIT_VIDEO);  g_pDisplaySurface = Sdl.SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 0, Sdl.SDL_ANYFORMAT);  g_pBitmapSurface = Sdl.SDL_LoadBMP("ball.bmp");  g_DisplaySurface = (Sdl.SDL_Surface)Marshal.PtrToStructure(g_pDisplaySurface, typeof(Sdl.SDL_Surface));  g_BitmapSurface = (Sdl.SDL_Surface)Marshal.PtrToStructure(g_pBitmapSurface, typeof(Sdl.SDL_Surface));  g_SrcRect.w = g_DstRect.w = (short)g_BitmapSurface.w;  g_SrcRect.h = g_DstRect.h = (short)g_BitmapSurface.h;  g_SrcRect.x = g_SrcRect.y = 0;  for (; ; )  { if (Sdl.SDL_PollEvent(out g_Event) == 0) {g_DstRect.x = (short)rand.Next(SCREEN_WIDTH - g_DstRect.w);g_DstRect.y = (short)rand.Next(SCREEN_HEIGHT - g_DstRect.h);Sdl.SDL_BlitSurface(g_pBitmapSurface, ref g_SrcRect, g_pDisplaySurface, ref g_DstRect);Sdl.SDL_UpdateRect(g_pDisplaySurface, 0, 0, 0, 0); } else {if (g_Event.type == Sdl.SDL_QUIT) break; }  }  Sdl.SDL_Quit();   }    }}When I try to marshal g_DisplaySurface, there is no problem, but when I try to Marshal g_BitmapSurface I get an NullReferenceException. The same problems comes up when I try to marshal a VideoInfo type.The other strange part is that this only occurs in Windows but when I try to debug in mono on Linux, it works smoothly.I use the latest version of Tao if that may be to any help.Hopefully I've brought enough information. I would be appreciate if very much if someone can help me out with this :)   