Skip to content

How to boost your DevExpress Debugging Experience

apobekiaris edited this page May 9, 2019 · 1 revision

Stepping into DevExpresss source code is possible. To do it you need to login to your account, download the symbols and read the detailed article about several aspects you need to know.

image

In this page we will discuss a few ways to automate the information we got from that article..

1. Index the symbols to your custom DevExpresss installation location

It is impossible for DevExpress to index the symbols to your custom installation, so in the article there is a mention that each time we want to step in we have to browse to the required file.

image

However it is possible to reindex the symbols to any location remote or local.

All eXpandFramework assemblies for example are indexed directly to the remote repositories so you can debug without the need to download the sources.

The MS SrcTool utility can be used for this purpose. If you do not want to automate this yourself, you can install the XpandPosh module and reindex the symbols by issuing the next commands in a PowerShell prompt.

$sources='C:\Program Files (x86)\DevExpress 19.1\Components\Sources'
$symbolLocation=A:\Pdb\DX
Get-ChildItem  *.pdb | Update-Symbols -TargetRoot $sources -SourcesRoot $sources 

In addition you may want to know the next commands:

  1. Get-SymbolSources lists the location of each source file for a given symbol.
  2. Test-Symbol checks if the symbol is valid for a given assembly.

After having the symbols indexed, in case of an exception in a DevExpress assembly we can enable the VS menu Debug\Windows\Exception Settings\Common Language Runtime Excception and VS will stop at the exception line inside the DevExpress assembly.

To set a breakpoint inside a DevExpress function for examine local variables and stack trace we have to follow the next steps:

  1. Load in the current solution the csproj that contains the sources of the assembly.
  2. Make sure you change the Solution build configuration to avoid recompilation of the loaded DevExpress project.
  3. Use the tools of our choice to locate any function in the loaded DevExpress project and set the breakpoint.

if we use the Xpand.VSIX VS plugin we can also index the project references against custom directories that contain sources and avoid the previous steps. Next you see how a possible configuration looks like: image

In the above configuration we index three directories and to trigger the project loading we just need to select the references we want like:

image

All select projects will load into current solution and will be excluded from the build configuration.

Disable Debugging Optimization

Quote from the original article:

During the debugging process, you may be unable to watch local variables. This occurs because of debug optimization. To avoid this side-effect, run Visual Studio with COMPLUS_ZapDisable set to 1

  1. Do not attempt to add a USER/MACHINE environmental variable as it will slow your system a lot. (e.g. Doing so in my system results in 30min DevExpress installation while without it is only 3min)
  2. Online resources suggest to use a batch file to start VS and then open the solution you want from inside VS. This works fine, though I like to open my solutions directly from their files instead of inside VS.
  3. Next, I will discuss a solution for installing a global hook that will disable optimizations for any VS instance, so we can open solutions from their files as well.

Again we require the XpandPosh and this time we need to call:

Install-DebugOptimizationHook 

The hook has no performance penalty for your system.