How to debug code in Sitecore - 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.

Related

Team Explorer can't resolve git local repository which was migrated by VSS2Git

I was trying to migrate/upgrade a solution(Database project) from VSS to Git.
After a few operations(like disconnect the source control, upgrade project file, etc), I found out the most of the options in team explorer are gone.
Now there is only Settings left but there suppose to have Changes, Braches, Sync. Like
And the worst is, I thought it's because I messed up something in the solution(local repository) but I found out that all repositories now behave the same when I open them by Visual studio.
What should I do to fix this situation?
It seems perhaps one of my operations disconnect me from Git instead of VSS cause those options resume after I reconnect to TFS Git proactively.
I ran into the same problem again. It seems VSS2Git somehow dis-attached the repo from Team Explorer so you can see it shows Offline caption right after Home.
Solution
1. In Team Explorer, switch to connect tab.
2. Under local git repositories clicks Add and select the repo you want.
3. Double click the repo you picked in the previous step to attach it.
4. Now you should be able to have correct home page with repo you are targeting.
After steps above, if you lost entries in Solution Explorer, means the VSS didn't unbind fully by VSS. Try the following
File > Source Control > Change Source Control
Unbind project which still sticks with VSS

Turning off Windows Update on Google Cloud Platform Windows Virtual Machine (Server 2016)

Much as it pains me to do so, I have to run a Windows VM on Google Cloud Platform in order to run some legacy data extraction software on a nightly basis.
It works fine (except the recurring feeling that I am stepping back in time every time I RDP into the VM), except over the holidays when the extract stopped. I checked the update logs and it seemed to be when an automatic Windows Update took place. As such I want to stop these from happening, however I cannot find any way of stopping them!
I own the GCP project and VM, so should have permissions to change any settings I like, does anybody have a clue how to do this please?
You do have the right to do whatever in your VM Windows.
For windows 7
1- Log in to the Windows 7 or Windows 8 guest operating system as an
administrator.
2- Click Start > Control Panel > System and Security > Turn automatic
updating on or off.
3- In the Important updates menu, select Never check for updates.
4- Deselect Give me recommended updates the same way I receive
important updates.
5- Deselect Allow all users to install updates on this computer and
click OK.
For Windows 10
I suugest your to follow the steps provided Here as the windows 10 has a policy of forced updates three option available.
Tracked down the answer! Posting here in case it helps somebody else...
https://community.shavlik.com/docs/DOC-24588
Solution
Open SCONFIG and verify your current Windows Update Settings:
Open a command prompt with Admin permissions.
Type sconfig and press Enter.
NOTE: There may be a short pause as the tool inspects your system.
Option #5 shows the current configuration of your Windows Update settings.
Config.PNG
To change your Automatic Update Settings, follow these steps:
From the SCONFIG screen press 5 and then Enter. This will bring up the following options for you to choose from:
(A)utomatic – This will configure your machine to automatically scan, download, install and reboot after applying any updates.
(D)ownloadOnly – This will automatically scan, download and notify the admin if updates need to be installed. This is the default setting on Windows Server 2016.
(M)anual -- This turns Automatic Updates off. Your system will never check for updates.
2. Press the letter specified in the "( )" and press Enter to apply.
3. When the tool applies the configuration you have selected, you will see a message pop-up similar to the one below. Click the OK button to dismiss the message. The tool will refresh the menu and option 5 will now show the new configuration.

Visual Studio 2017 2 users on one desktop

I have the following problem: I have a Laptop with two different user accounts (UserA & UserB / they belong to the same person but have different priveleges).
UserA: can build the solution and run tests locally (Everything is working as expected)
UserB: Has the rights to publish to the specific network drive, however he cannot build the project. The reason is that the Windows user itself has not the correct proxy settings configured, and thats why the nuget packages cannot be downloaded.
I have no possibility to change the proxy settings for UserB right now (It depends on internal processes, which might take a while)
However I would have expected, that when I build the solution with UserA, UserB would not need to build it again and just can publish it. This, does not work, as soon as I want to publish, VS tries to rebuild the solution and this does not work because some dependencies are missing and cannot be loaded.
Is there any solution for this problem? I tried to make a research, however I was not really sure for the correct keywords to search for.
Edit: I have now the domain added to my UserB, but I still have some other problems. However I found out that this article is heavily related to my issue: Unable to launch Visual Studio 2015 as a different user.
When I start Visual Studio via Command Line with the mentioned arguments, more works, however I am now not able any longer to connect to my database using Integrated Security = true in the connection string. But at least I can build now. Deploying also works but I just get a 500 Server error when I try to connect to the resource.
Edit2: I needed to add the domain to my user when opening Visual Studio with the command mentioned in the link above. This fixed my problem with connecting to the database.
Actually I do not need an answer anymore for my initial question but I will not delete it because maybe someone has an answer for a person who will have the same question later on.

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.

Webstorm never show debug warning when application is running

I accidentally clicked "never show warning" checkbox when you start debugging an application when there's a current debug session running. That pop up is very useful for me when I don't know if my application is running already and instead of rebuilding I can just use it.
I've already tried deleting the .WebStorm folder in C:\Users\username\ and uninstalling + reinstalling. I am unable to get the popup to show again.
Is this setting being stored somewhere?
EDIT: I found the exact string.
'application' is single-instance run configuration. Are you sure you want to stop the running one?
and the checkbox
Do not show this dialog in the future
Seems like a build configuration setting.