   [MDX] Cloning Mesh
  hello,i want to clone a mesh (to get a mesh with diffuse color) and then read from the vertexbuffer. my code looks like this:rope = Mesh.Cylinder(device, 0.01f, 0.01f, 1f, 40, 1);Mesh tmpMesh = rope.Clone(rope.Options.Value, VertexFormats.Position | VertexFormats.Diffuse, device);rope.Dispose();rope = tmpMesh;VertexBuffer vb = rope.VertexBuffer;CustomVertex.PositionColored[] verts = (CustomVertex.PositionColored[])vb.Lock(0, LockFlags.None);vb.Unlock();as u can see its really quite simple. i create the mesh, clone it, get the vertexbuffer and try to lock the buffer. but in the line with the lock call i get this exception:An unhandled exception of type 'System.NullReferenceException' occurred in mscorlib.dllAdditional information: Object reference not set to an instance of an object.i have absolutely NO idea why i get this exception. what am i doing wrong?   
  I have found that the managed DirectX Mesh primitives are somewhat buggy -- trying to work with the internal vertex buffers often doesn't work right. Even functions like SetVertexBufferData() don't seem to work right.Instead, I've written a managed C++ library which can take the vertex and index buffers from the mesh and operate on them, and that works right.To make sure that you're not doing something wrong in your own code, though, I would put a breakpoint in the code where you Lock(), and make sure that "vb" is in fact not NULL.   ;  i already checked that. the vertexbuffer (vb) is definitely NOT null. thats so strange >;[   ;  At first glance it all looks legal.  Have you read the Forum FAQ on debugging? If you're doing something wrong there should be something in the Debug Output.;  i guess thats the right point to tell u my generel problem with mdx debugging.on the dx control panel i checked the box "use debug version of d3d" and pulled the "debug output level" slider to the right. in vs.net i use the debug build (not  the release build) and show the debug output window (ctrl+alt+o). althought i dont get any debug informations about directx! no INFO, no WARN, no ERROR - just nothing. so besides my problem with the mesh: does anybody know what i have forgotten to turn of debugging information?   ;Quote:Original post by compileri guess thats the right point to tell u my generel problem with mdx debugging.on the dx control panel i checked the box "use debug version of d3d" and pulled the "debug output level" slider to the right. in vs.net i use the debug build (not  the release build) and show the debug output window (ctrl+alt+o). althought i dont get any debug informations about directx! no INFO, no WARN, no ERROR - just nothing. so besides my problem with the mesh: does anybody know what i have forgotten to turn of debugging information?Enable "Unmanaged Code Debugging" for your project.   ;  shame on me. thx for the hint. at least debugging works now ;)anyway, i dont get any specific error message on the lock line. its still just the following message:An unhandled exception of type 'System.NullReferenceException' occurred in mscorlib.dllAdditional information: Object reference not set to an instance of an object.could this be a bug in the dx runtime?   