Attach to Process

visualstudio

Was getting this error from Visual Studio 2022 while debugging a unit test. Moq error in Visual Studio 2022

The solution for me was to uncheck the “Call string-conversion function on objects in variables windows” checkbox. Solution for Moq error in Visual Studio 2022

Tags: #Debugging #Moq #Tests #VisualStudio

Discuss... or leave a comment below.

If you're trying to publish a SQL Server database project using Visual Studio, but you're not seeing the Publish dialog box show up, check your other Desktop in Windows. I've noticed that every once in a while, the Publish dialog box shows up in another virtual desktop, instead of showing up on the one you're currently working on.

Tags: #SqlServer #VisualStudio

Discuss... or leave a comment below.

Ran into an issue where I could not open rptproj files with Visual Studio 2019. Since these were old SSRS reports, I thought I’d try opening them with Visual Studio 2013. Didn’t work either. Visual Studio 2012? Nope.

Did some more research and eventually found out that this is not a Visual Studio issue. Apparently, to open rptproj files with Visual Studio, you need to install the corresponding Microsoft SQL Server Data Tools – Business Intelligence package. Would not have figured that out had it not been for this post.

So I went here to download the SQL Server Data Tools BI package. Installed it. And now I can open the SSRS solution/project in Visual Studio 2012.

Tags: #VisualStudio

Discuss... or leave a comment below.

For some reason, maybe because I accidentally pressed something on my keyboard, Visual Studio 2019 started comparing code in inline mode. By inline mode, I mean I only got one code comparison window, and the changes were stacked on top of each other. This made it hard for me since I was so used to the side by side code comparison mode, where I had two windows and I can clearly see what's different between files.

It took awhile for me to figure out how to set it back. I spent some time looking through the options in Visual Studio but couldn't figure it out. I even had a hard time searching the internet for answers, because I wasn't sure what to search for. The search key that finally worked for me was “vs 2019 diff inline mode”. That led me to the Stack Overflow post I linked below.

Side-note: I find it hilarious that the question in Stack Overflow was for Visual Studio 2012. Here I am with Visual Studio 2019 and the answer still works. Amazing. And what a gem Stack Overflow is for software developers.

Anyway, there are two ways to set it back to side-by-side mode. You can use the shortcut button for it in the menu bar. Or, you can use the shortcut CTRL + \, CTRL + 2.

Visual Studio Diff View Modes Shortcut

Reference:

How to switch view modes in built-in Diff viewer of Visual Studio 2012 and 2013?

Tags: #VisualStudio

Discuss... or leave a comment below.

When you just want to do a simple WCF service test, you don't need to download third party tools. You can use the WCF Test Client app that usually comes as part of a Visual Studio installation. I keep forgetting where to find it, so I'm writing it down on here to remind myself.

I had Visual Studio 2017 installed on my PC. Here is where I found the WCF Test Client app (WcfTestClient.exe):

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE

Tags: #WCF #DotNet #VisualStudio

Discuss... or leave a comment below.

Was running into a build error in Visual Studio 2017. The Output window says 1 project failed, but the Error List window was empty. The only way I managed to figure out what project was failing, was to copy the contents of the Output window, paste it into Notepad++ and search for the word “FAILED”.

Anyway, I finally figured out that it was the SQL database project that was failing to build. And it turns out, it was getting an “Out of Memory Exception”. Not sure if this specific error causes the Error List window to come up empty. In any case, at least now I have an idea of what to look for whenever this happens again.

Tags: #VisualStudio

Discuss... or leave a comment below.

I was playing around with Visual Studio 2019 and the open source ASP.NET Core blog engine Miniblog.Core. I cloned it to my local, opened it in Visual Studio 2019 and tried to build the solution. I immediately ran into the error below:

Error CS8630 Invalid 'nullable' value: 'Enable' for C# 7.3. Please use language version '8.0' or greater.

So, I looked up the error message and every Stack Overflow page I ended up on, says that I have to set the Language Version in Visual Studio. Okay, so how do I do that? I eventually found this answer, which gives you the steps to get to the Advanced Build Settings dialog box for the project.

  • Right-click YourProject, click Properties
  • Click Build if it's not already selected
  • Change Configuration to All Configurations
  • Click Advanced...
  • Change the language version

When the dialog box showed up however, it didn't give me an option to set the Language Version.

Visual Studio 2019 - Advanced Build Settings

Solution

The solution I ended up with involved manually editing the project file and adding an entry for the Language Version. So, I opened up the Miniblog.Core.csproj file and added <LangVersion>preview</LangVersion> under the <PropertyGroup> settings. It looks like this:

Setting the Language Version manually

Tags: #DotNet #VisualStudio #MiniblogCore

Discuss... or leave a comment below.

Ever since upgrading to Visual Studio 2017, I was always annoyed that it no longer defaulted to opening the Output window whenever I start building the solution. If I remember correctly, opening the Output window or making it visible was the default behavior in Visual Studio 2013 and 2015. So with VS 2017 I've always had to manually open the Output window during or after a build to see the output summary. Turns out the fix for this is a very simple setting in Visual Studio (duh). This saves me a good number of mouse clicks in a day :)

Output Window Setting in Visual Studio

Reference: How to keep output window always open in Visual Studio 2017

#VisualStudio

Discuss... or leave a comment below.

Today I ran into an issue where I was trying to debug an application and I was getting a “Breakpoint failed to bind” error on Visual Studio 2017. I was trying to attach to the process when I got the error. I was already running in Administrator mode, so it wasn't a permissions issue.

Solution

Turns out I had the solution configuration set to “Release” right from the start. The fix then was to set the solution configuration to “Debug” and then rebuild the solution. After that, I was able to attach to the process with no errors whatsoever.

Reference:

https://stackoverflow.com/questions/31732944/breakpoint-failed-to-bind-visual-studio-2015

#VisualStudio #Debugging

Discuss... or leave a comment below.