-
-
Notifications
You must be signed in to change notification settings - Fork 41
How to boost your DevExpress Debugging Experience
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.
In this page we will discuss a few ways to automate the information we got from that article..
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.
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:
-
Get-SymbolSources
lists the location of each source file for a given symbol. -
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:
- Load in the current solution the csproj that contains the sources of the assembly.
- Make sure you change the Solution build configuration to avoid recompilation of the loaded DevExpress project.
- 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:
In the above configuration we index three directories and to trigger the project loading we just need to select the references we want like:
All select projects will load into current solution and will be excluded from the build configuration.
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
- 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)
- 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.
- 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.