cudaGraphicsGLRegisterImage Causes Access Violation

I am trying to do some cross card communication with cuda running on my K20 and opengl running on my quadro but I seem to be unable to register the texture I want to use with cuda.

My code looks something like this

glGenTextures(1, &texId);
glBindTexture(GL_TEXTURE_2D, texId);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, textureSize, textureSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); 
glBindTexture(GL_TEXTURE_2D, 0);

checkGLError();  // Passes 

// This will cause an Access Violation when run from visual studio 10 debugger 
cudaGraphicsGLRegisterImage(&texRes, texId, GL_TEXTURE_2D,cudaGraphicsRegisterFlagsNone);

// If ran with out debugger, cudaGetErrorString() will spit out "invalid argument"
checkCudaError();

cudaGraphicsGLRegisterImage causes an Access Violation when run from visual studio 10 debugger

but…

If ran with out debugger, cudaGetErrorString() will spit out “invalid argument”

I am not sure what the problem could be and it is made more confusing by the different error messages.
Any help will be appreciated.

thanks…

Fun fact, if you change line 3 to

glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, textureSize, textureSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);

it works…
Problem seems to be solved