How to remote debug software after automated releasing software - remote-debugging

I'm currently releasing my asp.net web pages using a vsts release plan.
The build is executed using an on-premise build controller.
Within the build definition a step is added for publishing symbols (using the default settings)
What do I have to do to remotely debug this application? I can attach my debugger but I'm getting a message the breakpoint will not hit because no symbols have been loaded.
What do I have to do to get my symbols loaded?
(Where are my symbols saved, how do I expose them en how do I inform Visual Studio to get them from this specific location, can I do this for both Debug as well as Release version).
A link to some kind of reference/documentation is fine too. I can't find proper documentation of releasing using symbols.

You have probably built the app in "Release" configuration. Try Debug configuration - this way it should be easier to connect to the app with the debugger. Needless to say, once you have ironed out the bugs, you should rebuild in Release so you can publish in production

With publish symbols default settings, the symbols will be source indexed but not published (Leave path to publish symbols argument blank).
You can share a folder and specify this shared folder path to Path To Publish Symbols argument.
To configure Visual Studio’s settings:
Open VS
Debug > Option > Debugging > General, enable source server support and allow source server for partial trust assemblies
Select Symbols
Add new symbol file location and specify cache directory.
More information, you can refer to Build: Index Sources & Publish Symbols article.

Related

Cannot publish web service - Error : Could not open Source file: The given path's format is not supported

We are trying to publish a web service from our Dev box onto the UAT box.
There are no errors when building the web-service, but when trying to publish (using UNC path: \\TEST-SERVER\c$\inetpub\wwwroot\PerformanceReviewWebService) we get the below error message and the process fails:
3>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(1475,5):
Error : Could not open Source file: The given path's format is not supported.
what can we do to track down this error and resolve it?
On the target box we have checked the security of the folder:
..\c$\inetpub\wwwroot\PerformanceReviewWebService
and we definitely have access to write into that directory.
We have no build errors.
Here are a few things you can try that may help debug or resolve the issue:
Try launching Visual Studio as an Administrator and retry publishing.
Try publishing to a local location. Does this succeed?
If yes there is likely a problem with either accessing the UNC path or a file/security permission issue
If local publishing does not succeed, make sure you haven't mistakenly moved any of you bin, contents or webconfig files to a different location.
Check for files in Visual Studio that are light grey, or have an exclamation mark next to them (They may be missing from the project).
Attempt to possibly reload the project to a prior state where publishing was successful. Continue making updates gradually until your project is up to date.
Create a new empty project and attempt to publish to the same location. If this works you have something corrupted or wrong in you existing project. You can try excluding files or folders from the build to narrow down which ones may be causing the problem.
In my case a referenced web-project shared content with the web-project I want to publish. After removing it from the content of the referenced project it was working again.

VS2017 not showing Report Viewer in prerequisites

I am trying to deploy a wpf application with an embedded rdlc report using clickonce. The previous version of report viewer (in VS2015) was built-in so it was easy and convenient to use and I had no issues deploying this project.
Now since easy and convenient is not the goal anymore, in vs2017 after a failed deploy with an error message that gave me absolutely no help, I have come to realize that apparently you have to install 2 additional VS extensions and a report viewer runtime on every machine where an app uses and rdlc reports (feels like crystal reports all over again) and you have to exclude the automatically included Chinese localization files in your clickonce deployment (which cause a manifest parse error). Anyway, the instructions on MS website say that click once should have a "Microsoft Visual Studio Report Viewer" prerequisite option to select as requirement of installing your app. However, after installing the runtime on my development machine, restarting visual studio, this option is not available. Does anyone know how to get this to work?
I used Project|Manage NuGet Packages to add this package to my project.
https://www.nuget.org/packages/Microsoft.ReportViewer.Runtime.Common/12.0.2402.15
If you search with Manage NuGet Packages, there's quite a few ReportViewer related items. I'm not sure which ones are appropriate to your WPF app.
Anyway, the deployment project picked up the various ReportViewer assembly dependencies and everything seems to be working without the EXE redist from MS.

How to debug code in Sitecore

I would like to debug the Sitecore code just like asp.net code, but do not know how to.
The solution is outside wwwroot.
Using Visual Studio 2013, IIS 10.0, Windows 10, Sitecore 8
Does attaching a process, is all I have to do to be able to debug.
In Visual Studio, when I click on Tools > Attach Process, there is no aspnet_wp.exe or w3wp.exe.
Is there any other process to follow.
When you try Debug > Attach to Proces please make sure your site is running.
Please also check if "Show Process from all users" is checked.
See below picture:
You can use dotpeek to debug the Sitecore Code.
Steps to debug Sitecore Code:
Download and Install Dotpeek.
Open dotPeek and click on StartSymbolServer default dotPeek uses port 33417.
Open Visual Studio options
In Debugging/Symbols tab click on add new symbol files location and enter http://localhost:33417 (or the port that you assigned in the previous step)
In VS options go to Debugging/General and uncheck “Enable Just My Code” option if it is checked
In dotPeek click on open icon that will show a dialog for loading an assembly
After the assembly is loaded right click on it and click generate pdb. In the appeared window choose the namespaces that you need to debug (or each one as I did) and click Generate
Now we are ready for debugging
Open VS and attach to the sitecore process (loading symbols may take longer than usual)
More info: http://bilyukov.com/debugging-sitecore-dotpeek/
Note: You can also export the Sitecore dll to a VS Solution in dotpeek along with its pdb file, then follow the above steps to configure your VS. You need to attach to the Process of the exported Sitecore Solution.
I use Attach to Process in Sitecore rocks.
Sitecore Rocks can be found in the Visual Studio Marketplace via the Tools | Extensions and Updates option in visual studio. Search for Sitecore Rocks in the Online folder.
If you want to attach to w3wp.exe you have to make sure the website is running in IIS under its own app pool with its own domain binded as well as host file updated to associate that domain with localhost 127.0.0.1. If you need more help, along with simplified detailed instructions, please reach out to me.
You can do one thing in this case. Go in Visual Studio to Debug > Attach to process....
Now you'll see a window containing available processes. We need to connect to IIS , hence mark the checkbox saying Show processes from all users. Once you do that, you'll find a process w3wp.exe. Jut select it and click Attach.

Trying to load unmmanaged c++ dll in azure

I'm trying to call to my unmanaged dll from my asp.net mvc web app.
when I call this dll from localhost it work just fine.
when publish the app to azure and try to call this dll I'm getting this:
Error:System.DllNotFoundException: Unable to load DLL 'SerenityConfigCodec.dll': A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A).
I succeed to call to a simple dll in azure (not mine). According to Microsoft azure documentation.
I use a dependency walker on my dll to know the dlls that I need in azure and add them.
I have some theory that my dll need some extra dll in azure that dependency walker not tell me about them.
Or maybe I need to connect my website to iis and try to use iisreset to cause maybe the .bin folder in azure get into locked at run time and let iisreset unlock it.
Sounds like Azure cannot find your referenced DLL.
Is this DLL added as a Dependency in your project? or as a Nuget package?.
If it's a Dependency there two possible solutions depending on your publishing method:
Add the Copy Local to True if you are publishing using Web Deploy (Right-click > Publish from Visual Studio)
If you are publishing through Continuous Integration and a link to a repository (GitHub / Bitbucket / VSO / etc), add the DLL file to your repository (maybe in a folder especifically for that) and reference it in your project using that folder path.
If it's a Nuget package, it will fail if you are using Web Deploy (unless you set the Copy Local to True), if you are deploying through Continuous Integration, Kudu takes care of downloading all the packages on the deployment process.
I solved this problem by adding the compiled unmanaged DLL file to the managed project, so it would be included in the publish package. Since the added file was either the debug or release DLL I had to manually edit the .csproj file to conditionally copy either the debug or release build DLL depending on if I'm building the debug or release managed DLL. This in turn generates warnings every time I load the project but the builder handles it right. And I need to remember to rebuild the managed DLL to get it to pick up on changes to the unmanaged DLL since it hasn't been doing that for me automatically.
Depending on which version of VS you're using you may need to install the C++ runtime DLLs as well.
The 0x8007045A error indicates that the DLL was found but init failed, while the 0x8007007E error mentioned an a comment to another answer indicates that it couldn't find the DLL to load.

Where can I create free symbol server for open source project?

My open source project it is C++ dynamic linking library. Most of bugs - crash.
I want create public symbol server to simplify debugging with memory dump.
See also: Setting up a Symbol Server
I assume you're using Microsoft tools? If so, all you should need to do is expose your 'symstore' directory with a web server then configure debuggers to access that store:
srv*symbol-cache-location*http://your.web.server.com/symboldir
The "Debugging Tools for Windows" docs (debugger.chm) has details for configuring IIS - I'm sure any other HTTP server will work just as well if you don't need authentication, which I imagine would be the case for an open source project. As far as I know, symsrv.dll just makes normal HTTP GET requests for symbol files when it's trying to get them from an HTTP server.
You'll also need to build the symbol store using the 'symstore' utility. Hopefully that can be integrated into your build or packaging process so it happens automatically. Again, debugger.chm has good docs on the tool.
This will not be a real answer, but you might want to take a moment to vote for C++ support in NuGet in work item Support Managed C++ Project Types or have a look at the discussion about C++ Project support. When that gets in, SymbolSource support will follow shortly (currently it only supports hosting symbols for .NET assemblies).