# [.net] Problem Debugging

This topic is 3805 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello all, i had a coot around but couldn't find an answer to my problems so was hoping someone here could help me :) Basically i my app doesn't reach breakpoints in my code for some reason, the application is build in debug mode, at the moment there is a c++ DLL and a c# Application, i'm not testing the c++ code just the c#, its very very simple so far, this is what i've got
[SOURCE]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace QMTerrainEditor
{
public partial class TerrainEditor : Form
{
public enum QMERRORCODE
{
QM_OK = 1,
QM_FAIL = 100,
QM_CREATEDEVICE = 200,
QM_INVALIDPARAM = 300,
QM_OPENFAILED = 400,
QM_TERRAINSIZEINVALID = 500,
QM_CREATEVBUFFERFAILED = 600,
QM_CREATEIBUFFERFAILED = 700,
QM_BUFFERSIZE = 800,
QM_BUFFERLOCK = 900,
QM_DRAWINDEXPRIM = 1000,
QM_CREATETEXTURE = 1500,
};

#region D3D9 DLL Imports
[DllImport("QMD3D.dll", ExactSpelling = true, CallingConvention=CallingConvention.StdCall)]
public static extern QMERRORCODE D3D9Init(IntPtr hWnd);
[DllImport("QMD3D.dll", ExactSpelling = true, CallingConvention=CallingConvention.StdCall)]
public static extern void D3D9Shutdown();
[DllImport("QMD3D.dll", ExactSpelling = true, CallingConvention=CallingConvention.StdCall)]
public static extern QMERRORCODE D3D9RenderScene();
[DllImport("QMD3D.dll", ExactSpelling = true, CallingConvention=CallingConvention.StdCall)]
#endregion

public TerrainEditor()
{
InitializeComponent();
if(D3D9Init(DrawPanel.Handle) != QMERRORCODE.QM_OK)
MessageBox.Show("Error", "Error in Initialising D3D9", MessageBoxButtons.OK);
}

// Shutdown the DirectX panel when the form is closed
private void TerrainEditor_FormClosed(object sender, FormClosedEventArgs e)
{
D3D9Shutdown();
}

}
}
[/SOURCE]
[/source] as you can see, nothing special going on here, but if i try to put a debug point in TerrainEditor() or TerrainEditor_FormClosed() my program runs but it doesn't hit the breakpoint. I was initially having a problem along the lines of "Bad system" when loading the dll i managed to fix these however by changing the compilation system from Any to x86, however before changing this i could debug fine. :S Another problem is that i dont like to copy the DLL every time i do a rebuild is there anyway to set an option within the c# application to search a specific folder for the c++ DLL? I just confirmed that when the project is set to x64 it breaks but says there is no source code available, do you want to see the dissasembly. But when i try with the project set to x86 it doesn't break :S

##### Share on other sites
You're debugging (F5) this through the IDE, and not executing the .EXE, correct?

##### Share on other sites
Quote:
 Original post by ZachE84You're debugging (F5) this through the IDE, and not executing the .EXE, correct?

off course, as i said the breakpoint is hit if i build the x64 exe but not the x86 one

##### Share on other sites
Hmm...have you tried making a 64bit version of the DLL, and then try running the app?

1. 1
2. 2
Rutin
22
3. 3
JoeJ
18
4. 4
5. 5

• 17
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631726
• Total Posts
3001910
×