Automatically generate PDBs with dotPeek - dotpeek

I just discovered dotPeek and its symbol server greatness. The only drawback for me currently is that I need to manually add each DLL I want to debug and manually generate the PDB for it. It would be excellent if I could either do this in batch and just generate PDBs for a whole directory, or automatically generate them when requested in the symbol server (and the DLL is in the assembly explorer or something). Or another way to automate more of it. Is any of that possible?

The closest solution I've found, which will probably work for me, is to set the "Generate symbol files for" option in Tools > Options > Symbol Server to "Assemblies opened in the Assembly Explorer". This seems to automatically find anything in the explorer and generate a PDB on the fly if you open dotPeek and start the symbol server before you start Visual Studio.

Related

How do install OmniPascal into vscode

From the OmniPascal page on Visual Studio Marketplace:
How to install
Install Visual Studio Code and open it.
Open View -> Command Palette... and type ext install OmniPascal
Restart Visual Studio Code and open File -> Preferences -> User Settings
Add the key "objectpascal.delphiInstallationPath" to the right editor and set its value to the Delphi installation path. Don't forget to escape the backslashes! Example:
"objectpascal.delphiInstallationPath" = "C:\\Program Files (x86)\\Embarcadero\\Studio\\16.0",
Except that seems to be wrong; it complains that it shouldn't be an = (equals), but a : (colon):
I assume that's a typo, and it should be a colon:
But what should the path be?
The page gives the example path as:
C:\\Program Files (x86)\\Embarcadero\\Studio\\16.0
But the animated installation pastes in a path leading to the subfolder source:
Which is it? I only ask because neither path seems to enable suggestions:
Except that seems to be wrong; it complains that it shouldn't be an = (equals), but a : (colon)
Oh, obviously there's an error in the documentation. This will be fixed with the next release. Thanks.
Of course it should be a colon since it is an entry in a JSON file.
But what should the path be?
The entry objectpascal.delphiInstallationPath should point to the path where Delphi is installed. It doesn't matter whether you define the source subdirectory or not. The path is internally used to find Delphi units recursively. As all .pas files are located in the source folder the lookup is slightly faster when the entry looks like this:
"objectpascal.delphiInstallationPath": "C:\\Program Files (x86)\\Embarcadero\\Studio\\16.0\\Source"
Free Pascal users should point to the FPC directory
Sample:
"objectpascal.delphiInstallationPath": "C:\\lazarus\\fpc"
I only ask because neither path seems to enable suggestions
The syntax highlighting in your screenshot seems to come from another Pascal plugin for Visual Studio Code. When the OmniPascal plugin is active in a .pas file then the current file type is "ObjectPascal". You see it in the bottom right corner next to the smiling feedback button:
When the current file type is "Pascal" or anything else then the wrong plugin is active. Click on the file type and change it to "ObjectPascal". Now you should get code completion, quick infos and more.

How does Delphi 7 find all the dcu files during compilation?

I am helping a coworker set up his computer so that his Delphi 7 environment works like mine. He has Delphi 7 installed plus the third party tools we use. We have a Delphi app with source. It compiles fine on my computer but when he compiles it on his computer, it keeps coming up with 'file not found' errors for many dcu files. These are dcu files of third party components, either which come with Delphi IDE or have been installed manually.
I renamed his C:\Program Files (x86)\Borland folder and copied my whole Borland folder structure to his so that he has what I have. So now his Delphi IDE and the app structure resembles mine, yet he still gets missing dcu's. Every time he gets a missing dcu, he adds its path to Delphi's 'Search path' list. For some dcu's, they exist in different folders which means we have to troubleshoot further to make sure we picked the correct version. My 'Search Path' is empty as shown below which tells me my Delphi doesn't use this entry to search for dcu's. Our computer's PATH environment variable entry has the same values for anything related to Delphi.
My question is why my delphi app compiles fine as it finds all the dcu's it needs which reside in different folders yet his Delphi is not finding them when we have the same folder structure and PATH?
How does the Delphi IDE finds all the dcu's it needs during compilation? What is left now to look at is the registry. Are the search patterns in the registry? Where? (We also have Delphi XE installed if this means anything)
You don't want to add these directories to your project's search path. That will make it so that only this project is able to use these components. Instead, you need to do this in the global library path, which applies for all projects. Check the library path of your existing installation, surely you'll find a large list of directories here.
Main Menu -> Tools -> Environment options dialog -> Library page -> Library Path edit box
They are the output paths, try looking in the following location
Tools > Options > Environment Options > delphi Options > Paths and Directories
This tells the IDE what source files to include. The only other difference can be if you system variables are different if you have any.
http://docwiki.embarcadero.com/RADStudio/XE8/en/Library

How to load symbols in Visual Studio 2012

When I am debugging my app I see messages:
cannot find or open the PDB file
I seem to remember being able to specify the location of the PDB file while debugging the app. How can I do this? I'm using Visual Studio 2012.
Adding Symbols Location
Open Settings: Tools->Options -> Debugging -> Symbols and add directory, where your .PDB files are located.
screenshot of Visual Studio Interface where this menu located
You can add custom path, like for each project, and also you can edit common path, where Visual Studio will save all .pdb cache.
Making post-build script
I made in each project post-compile event, which copy all .pdb to one folder, by this i have all in one place. But you can store it separately, which i found not so convenient, as it require each time edit list of locations.
Example of post-debug script to copy .pdb and .dll to Symbols cache location:
xcopy /Y /R "$(TargetDir)$(ProjectName).pdb" "D:\VS_CACHE\"
xcopy /Y /R "$(TargetDir)$(ProjectName).dll" "D:\VS_CACHE\"
Solving problem if symbols not found
When you in debug mode, and for some reason symbols not found, it can be because of multiple reasons:
You have .pdb in Symbols cache, but it's outdated (you can get if this a case, if you put breakpoint in code and hover it)
You have multiple .dll which use this part of code (you can get if this a case, if you put breakpoint in code and hover it)
Symbols not loaded, in this case you can check it by going to: Debug-> Windows -> Modules and trying to load needed module.
screenshot of Visual Studio interface Modules -> Load Symbols
Making Debugging more easy:
To re-attach VS Debugger to running application, i recommend to use this free Visual Studio add-on (support VS 2015):
ReAttach: visualstudiogallery.msdn.microsoft.com/8cccc206-b9de-42ef-8f5a-160ad0f017ae
It will save you a lot of time! :)

scripts don't recognize FSharp.Data

Somewhat of a F# beginner. I'm trying to test out some of my XmlTypeProvider code in the interactive window by first entering it in a script (fsx) file. The script file won't recognize the following
open FSharp.Data // gives "The namespace or module 'FSharp' is not defined"
Everything has been added to reference, and .fs files seem to not have any problems finding the XmlTypeProvider reference but for some reason, a script in the same project does not. I even got the code to work in a .fs file.
I added FSharp.Data with nuget and everything seem to add correctly. What am I missing here?
Add a reference in the script to the nuget packages folder that contains FSharp.Data.dll. That folder also contains the designer dll (FSharp.Data.DesignTime.dll)
#r #"<your nuget packages folder>\FSharp.Data.2.1.0\lib\net40\FSharp.Data.dll"
Incidentally, I was just debugging this error last week. There are essentially three possible reasons:
The file could not be found. The most obvious one is that F# actually cannot find the dll file. Make sure the reference is correct (check References in the project properties) or make sure your #r points to the right file (when using an F# script file)
Type provider is not trusted. The type provider is blocked by Visual Studio. This can happen if you click on "Disable" when you load the provider for the first time. To fix this, go to "Tools" - "Options" - "F# Tools" - "Type Providers" and enable the type provider (check "Trusted").
The DLL is blocked by OS. Finally, if the dll comes from an untrusted source, Windows might block it (this happens especially if you download a zip file and extract the file using Windows). To unblock the file, go to file properties and click "Unblock". There is a good description here..

how to pass directives to dcc32 via msbuild? [duplicate]

I'm using the line below to have MSBuild build a Delphi 2010 groupproj:
MSBuild C:\src\myprojgroup.groupproj /target:Build /p:config=Release
I can't figure out how to modify the line above so that I can pass this argument
-EC:\mypath
to the compiler (bcc32.exe).
I've spent a fair amount of time trying to find this on the web. /property:name=value seemed likely to be what I need, but hasn't thus far.
Is this even possible, or do I have to learn about MSBUILD configuration files now...
Tom --
Probably the easiest way to do this would be to open the project in the IDE, set the settings in the IDE that you want, and then save.
Even better would be to set up a specific build configuration for these settings, and use that.
The IDE uses MSBuild itself, so any settings that you make in the IDE are saved in the *.DPROJ file (or GROUPPROJ, in your case), and so when you execute the command line, the exact same settings are used as were set in the IDE. If you use a specific build configuration for this specific set of options, you can simply call that configuration on the command line and you'll get what you want.
In other, shorter words: Let the IDE do the work for you.
Change your build configuration within Delphi, or manually yourself in the .DPROJ file. If you change the Release config itself in either of those places, you'll be fine.
Alternately, look at the .dproj file and see what the setting you want is called (eg., "IncludePath" or "OutputDir"). You can then use msbuild's /property switch. For example:
msbuild /property:WarningLevel-2;OutputDir=bin\Debug myproj.dproj
You can see these command-line switches and examples using the following from a command window prompt:
msbuild /? | more
A quick check of a .dproj file from D2007 indicates you're probably looking for either the DCC_IncludePath or DCC_UnitSearchPath properties.

Resources