debugging CF with full framework (e.g. without the emulator) ! and ?

  • Thread starter Thread starter Yechezkal Gutfreund
  • Start date Start date
Y

Yechezkal Gutfreund

I am probably not the first that has found that for many applications, one
does not need the emulator to run CF executables. There are a few
wierdnesses
about the interface when one "links" to the full framework, but other than
that the speed for testing out logic errors versus launching the emulator or
doing a real load via activesync to the PPC is a win in my case.

Please excuse the novice nature of this question:
Here is my question:

I would like to use the VS debugger (e.g. debug->start new instance) to run
this CF project. But the project is targeted for the emulator or for the
real PPC.
Is there a way to temporarily set the project (without jepordizing the code,
or
doing any later rewrites or mods to go back to the PPC version) to run off
of
the full framework?

Specifically, I have a solution with two projects. A Full framework server
component
and a PPC client project. If I start the debugger for the full solution, it
spawns
the server application locally, and the client application remotely (or in
the emulator).

I would like to do a quick VS only mod of the project to make both come up
locally
on the development box, so I can use the local debugger.

Or, is there a way to attach to the local processes instance (that I create
when
I locally run the ppc.exe) and have the breakpoints in the ppc.exe trigger
the VS debugger.
 
Basically, I am hoping for something simple. Like to use the Configuration
Manager to change
the platform from PocketPC to .NET (but the drop down does not give me that
option!).
 
You cannot change the project type, but there is an alternative. When I was debugging a cross-platform CF application, I wrote a simple macro:

Imports EnvDTE
Imports System.Diagnostics
Imports VSLangProj
Imports Microsoft.VisualStudio.VCProjectEngine
Imports Microsoft.VisualStudio.VCProject
Imports System

Public Module Tools

Sub LaunchCEAppInDebugger()
Dim oProj As Project
Dim oCfg As EnvDTE.Configuration
oProj = DTE.ActiveSolutionProjects(0)
Dim vsProj As VSProject
oCfg = oProj.ConfigurationManager.ActiveConfiguration
For Each grp As OutputGroup In oCfg.OutputGroups
If grp.CanonicalName = "Built" Then
Dim filePath As String = grp.FileURLs(0)
filePath = filePath.Replace("\obj\", "\bin\")
Dim uri As Uri = New Uri(filePath)
Dim psi As New ProcessStartInfo(uri.LocalPath)
psi.WorkingDirectory = System.IO.Path.GetDirectoryName(uri.LocalPath)
System.IO.Directory.SetCurrentDirectory(psi.WorkingDirectory)
Dim pr As System.Diagnostics.Process = System.Diagnostics.Process.Start(psi)
pr.WaitForInputIdle(10000)
For Each lp As EnvDTE.Process In DTE.Debugger.LocalProcesses
If lp.ProcessID = pr.Id Then
lp.Attach()
Exit For
End If
Next
End If
Next
vsProj = oProj.Object
End Sub

End Module

1) Hit Alt-F11 to open Macro IDE.
2) Add a new module and paste this macro into it.
3) Close the Macro IDE
4) Right-click on the VS toolbar, select customize, go to Commands tab and scroll down to Macros. On the right side find your new macro and drag it onto toolbar.

At this point you can start your CF app on the desktop in debugger by simply clicking one toolbar button. In my experience sometimes for an unknown reason the debugger fails to attach. In that case simply close the application and try again

Alex Feinman
 
This is perfect, Alex. It does exactly what I want it to do. I can even start debugging on both the client and the server.

Thanks a million!


You cannot change the project type, but there is an alternative. When I was debugging a cross-platform CF application, I wrote a simple macro:

Imports EnvDTE
Imports System.Diagnostics
Imports VSLangProj
Imports Microsoft.VisualStudio.VCProjectEngine
Imports Microsoft.VisualStudio.VCProject
Imports System

Public Module Tools

Sub LaunchCEAppInDebugger()
Dim oProj As Project
Dim oCfg As EnvDTE.Configuration
oProj = DTE.ActiveSolutionProjects(0)
Dim vsProj As VSProject
oCfg = oProj.ConfigurationManager.ActiveConfiguration
For Each grp As OutputGroup In oCfg.OutputGroups
If grp.CanonicalName = "Built" Then
Dim filePath As String = grp.FileURLs(0)
filePath = filePath.Replace("\obj\", "\bin\")
Dim uri As Uri = New Uri(filePath)
Dim psi As New ProcessStartInfo(uri.LocalPath)
psi.WorkingDirectory = System.IO.Path.GetDirectoryName(uri.LocalPath)
System.IO.Directory.SetCurrentDirectory(psi.WorkingDirectory)
Dim pr As System.Diagnostics.Process = System.Diagnostics.Process.Start(psi)
pr.WaitForInputIdle(10000)
For Each lp As EnvDTE.Process In DTE.Debugger.LocalProcesses
If lp.ProcessID = pr.Id Then
lp.Attach()
Exit For
End If
Next
End If
Next
vsProj = oProj.Object
End Sub

End Module

1) Hit Alt-F11 to open Macro IDE.
2) Add a new module and paste this macro into it.
3) Close the Macro IDE
4) Right-click on the VS toolbar, select customize, go to Commands tab and scroll down to Macros. On the right side find your new macro and drag it onto toolbar.

At this point you can start your CF app on the desktop in debugger by simply clicking one toolbar button. In my experience sometimes for an unknown reason the debugger fails to attach. In that case simply close the application and try again

Alex Feinman
 
Back
Top