{"id":755,"date":"2016-07-17T10:40:59","date_gmt":"2016-07-17T10:40:59","guid":{"rendered":"http:\/\/tpodolak.com\/blog\/?p=755"},"modified":"2016-09-11T13:26:51","modified_gmt":"2016-09-11T13:26:51","slug":"generating-pdb-files-resharper","status":"publish","type":"post","link":"https:\/\/tpodolak.com\/blog\/2016\/07\/17\/generating-pdb-files-resharper\/","title":{"rendered":"Generating PDB files with Resharper"},"content":{"rendered":"<p>The majority of the libraries developers use in their projects these days are open source. So in case something crashes inside third party library or you just want to know how it works, it is possible to get the <i>PDB<\/i> files from <i>Microsoft Symbols Servers<\/i> and debug it. If for some reasons <i>PDB<\/i> cannot be found on the servers,  you can always grab the source code from <i>GitHub<\/i> and add to your project manually. Unfortunately when you use commercial libraries, it is impossible to do any of the previous steps. Luckily with <i>Resharper<\/i> you are able to generate <i>PDB<\/i> files from assembly and use it later in <i>Visual Studio<\/i> to debug it.<br \/>\nLet&#8217;s assume we would like to generate <i>PDB<\/i> files for <i>EntityFramework<\/i>. First of all, we have to locate <i>EntityFramework<\/i> assembly in <i>Assembly Explorer<\/i>. Go to <i>Solution Explorer<\/i>, <i>RMB<\/i> click on assembly you are interested in and select <i>View in Assembly Explorer<\/i>.<br \/>\n<a href=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/ViewInAssemblyExplorer.png\" rel=\"attachment wp-att-764\"><img decoding=\"async\" src=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/ViewInAssemblyExplorer.png\" alt=\"ViewInAssemblyExplorer\" width=\"450\" class=\"aligncenter size-full wp-image-764\" srcset=\"https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/ViewInAssemblyExplorer.png 586w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/ViewInAssemblyExplorer-137x150.png 137w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/ViewInAssemblyExplorer-274x300.png 274w\" sizes=\"(max-width: 586px) 100vw, 586px\" \/><\/a><br \/>\nIn <i>Assembly Explorer<\/i> once again <i>RMB<\/i> click on <i>EntityFramework<\/i> and select &#8220;<i>Generate Pdb\u2026<\/i>&#8221;<br \/>\n<a href=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/GeneratePdbFileMenu.png\" rel=\"attachment wp-att-760\"><img decoding=\"async\" src=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/GeneratePdbFileMenu.png\" alt=\"GeneratePdbFileMenu\" width=\"450\" class=\"aligncenter size-full wp-image-760\" srcset=\"https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/GeneratePdbFileMenu.png 384w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/GeneratePdbFileMenu-122x150.png 122w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/GeneratePdbFileMenu-244x300.png 244w\" sizes=\"(max-width: 384px) 100vw, 384px\" \/><\/a><br \/>\nIn the opened window, select the destination folder for the files.<br \/>\n<a href=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/GeneratedPdbsOption.png\" rel=\"attachment wp-att-759\"><img decoding=\"async\" src=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/GeneratedPdbsOption.png\" alt=\"GeneratedPdbsOption\" width=\"450\" class=\"aligncenter size-full wp-image-759\" srcset=\"https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/GeneratedPdbsOption.png 472w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/GeneratedPdbsOption-142x150.png 142w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/GeneratedPdbsOption-284x300.png 284w\" sizes=\"(max-width: 472px) 100vw, 472px\" \/><\/a><br \/>\nOnce you click &#8220;<i>Generate<\/i>&#8220;, <i>Resharper<\/i> will process the assembly and generate <i>PDBs<\/i>.<br \/>\n<a href=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/PdbGenerated.png\" rel=\"attachment wp-att-763\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/PdbGenerated.png\" alt=\"PdbGenerated\" width=\"450\" height=\"115\" class=\"aligncenter size-full wp-image-763\" \/><\/a><br \/>\nOnce the files are generated we have to tell <i>Visual Studio<\/i> to use them. In order to do that, run the app and stop the execution with some breakpoint, then  go to <i>Debug->Windows-> Modules<\/i>, locate <i>EntityFramework.dll<\/i>, click it with <i>RMB<\/i>, select &#8220;<i>Load Symbols<\/i>&#8221; and choose file(s) generated by <i>Resharper<\/i>.<br \/>\n<a href=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/LoadSymbols.png\" rel=\"attachment wp-att-762\"><img decoding=\"async\" src=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/LoadSymbols.png\" alt=\"LoadSymbols\" width=\"900\"  class=\"aligncenter size-full wp-image-762\" srcset=\"https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/LoadSymbols.png 1230w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/LoadSymbols-150x36.png 150w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/LoadSymbols-300x73.png 300w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/LoadSymbols-1024x249.png 1024w\" sizes=\"(max-width: 1230px) 100vw, 1230px\" \/><\/a><br \/>\nA this point we have <i>PDB<\/i> files ready but we are not able to set any breakpoint as we don&#8217;t have source code of <i>EntityFramework<\/i>. Fortunately <i>Resharper<\/i> once again saves the day as it is able to navigate to decompiled sources. Just make sure that your settings (<i>Resharper->Options->External Sources<\/i>) are the same as in the picture below<br \/>\n<a href=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/decompile.png\" rel=\"attachment wp-att-758\"><img decoding=\"async\" src=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/decompile.png\" alt=\"decompile\" width=\"800\" class=\"aligncenter size-full wp-image-758\" srcset=\"https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/decompile.png 765w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/decompile-150x116.png 150w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/decompile-300x232.png 300w\" sizes=\"(max-width: 765px) 100vw, 765px\" \/><\/a><br \/>\nand you can navigate to external libraries&#8217; source code just like they were in your project. The very last step is to disable &#8220;<i>Enable Just My Code<\/i>&#8221; option in <i>Tools->Options->Debugging->General<\/i><br \/>\n<a href=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/JustMyCode.png\" rel=\"attachment wp-att-761\"><img decoding=\"async\" src=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/JustMyCode.png\" alt=\"JustMyCode\" width=\"800\" class=\"aligncenter size-full wp-image-761\" srcset=\"https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/JustMyCode.png 799w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/JustMyCode-150x92.png 150w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/JustMyCode-300x184.png 300w\" sizes=\"(max-width: 799px) 100vw, 799px\" \/><\/a><br \/>\nand from now on you can debug the external library<br \/>\n<a href=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/DbContextDebugging.png\" rel=\"attachment wp-att-757\"><img decoding=\"async\" src=\"http:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/DbContextDebugging.png\" alt=\"DbContextDebugging\" width=\"900\" class=\"aligncenter size-full wp-image-757\" srcset=\"https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/DbContextDebugging.png 1060w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/DbContextDebugging-150x33.png 150w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/DbContextDebugging-300x66.png 300w, https:\/\/tpodolak.com\/blog\/wp-content\/uploads\/2016\/07\/generating-pdb-files-with-resharper\/DbContextDebugging-1024x224.png 1024w\" sizes=\"(max-width: 1060px) 100vw, 1060px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The majority of the libraries developers use in their projects these days are open source. So in case something crashes inside third party library or you just want to know how it works, it is possible to get the PDB files from Microsoft Symbols Servers and debug it. If for some reasons PDB cannot be [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[50],"tags":[199],"class_list":["post-755","post","type-post","status-publish","format-standard","hentry","category-resharper","tag-resharper"],"_links":{"self":[{"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/posts\/755","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/comments?post=755"}],"version-history":[{"count":8,"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/posts\/755\/revisions"}],"predecessor-version":[{"id":786,"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/posts\/755\/revisions\/786"}],"wp:attachment":[{"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/media?parent=755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/categories?post=755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tpodolak.com\/blog\/wp-json\/wp\/v2\/tags?post=755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}