I fixed it. Turs out it was c++/vs related. There was a problem with my project file I synced the working project file settings with my application, fixed a few issues and it seems to be stable. Thanks for the help
c++ is a very very difficult language to program in. I wonder why the sdk is in c++? I wish it was c#