Visual Studio 17.4.4 debug output: double-clicking solution-relative path - c#

There are many questions that seem to be related, but they are all old, while I am almost sure this started happening with the latest update to visual studio version 17.4.4.
The problem:
In an as-concise-as-possible summary:
Double-clicking a line starting with solution-relative path in the debug output of Visual Studio in a multi-project solution opens up the file in the editor as an unusable plain text file.
As you know, if a debug output line starts with D:\Full\Path\To\SourceFile.cs(99): then it is double-clickable, and it opens the given file in the editor, and places the caret at the given line. That's immensely useful, so all my logs are in exactly that format. It can also be prefixed with optional whitespace, so all of my (indented) exception stack traces are also in that format.
The pathnames given by [CallerFileName] or StackFrame.GetFileName() are absolute, so they start from the drive letter and include the kitchen sink; in order to save screen real-estate and to produce logs that are also meaningful on machines other than the machine where the software was compiled, I have been converting all these absolute pathnames to solution-relative, and Visual Studio has been understanding them just fine. Until a couple of days ago.
So I recently upgraded my Visual Studio to version 17.4.4 and I installed/removed a whole bunch of frameworks for various things. Now, I am having the following problem: relative path-names in the output window still work for single-project solutions where the project is in the same directory as the solution; for multi-project solutions, the following bad thing happens:
When I double-click on a line in the debug output, Visual Studio opens the corresponding file in a new tab even if it already had it in an existing tab, and in this new tab the file is unusable: there is no syntax highlighting, no tooltips, no navigation, nothing.
The question(s):
Is anyone else experiencing this?
Has anyone found a workaround?
The Bug Report
I would have filed this bug report with Microsoft, but in order to do that they require me to authenticate first, and their authentication mechanism does not work. (I suppose that's one way of reducing the number of bug reports; J. D. Salinger would be proud.) So, here is the bug report that I would have filed.
I am programming in C# using Visual Studio with ReSharper.
I have tried the following both with DotNet Framework 4.6.2 and with DotNet 7.0.
Full version information follows at the end.
Steps to reproduce:
Create a console application, ConsoleApp2.
Uncheck the "Place solution and project in the same directory" checkbox.
At the end of the auto-generated Program.cs add the following line of code: System.Diagnostics.Debug.WriteLine( "ConsoleApp2\\Program.cs(4): Hello, Output Window!" );
Compile the solution
Close the solution and re-open it.
Launch ConsoleApp2 (with debugging)
In the debug output of Visual Studio, double-click on the line that says "Hello, Output Window!".
Expected behavior:
Visual Studio switches to the already existing tab with Program.cs, and places the caret at line 4.
Syntax highlighting continues to work as expected.
Gutter symbols continue to appear.
Code tooltips are still available.
Navigation such as go-to-definition still works.
The tooltip of a tab shows the full path of the source file.
The "Open Containing Folder" command on the tab opens the folder containing the file.
Actual behavior:
Visual Studio opens an entirely new tab, loads Program.cs in it, and places the caret at line 4.
Syntax highlighting is completely gone.
Gutter symbols have disappeared.
Code tooltips are not shown anywhere in the code.
Navigation such as go-to-definition does not work anymore.
The tooltip of a tab shows only a relative path.
The "Open Containing Folder" command on the tab gives an error message box saying "Unable to open the folder. It might have been deleted or [...]"
Notes:
If the solution and the project are in the same directory, the problem does not occur.
The problem does not occur on the first try; the step which says "Close the solution and re-open it" appears to be necessary.
If you edit text in the "phantom" tab and save it, the changes do appear in the real tab.
Why is this a big problem:
The ability to double-click on a line in the debug output window and to be taken to the source code that emitted that line is a major convenience.
When the IDE shows a wrong or otherwise unusable file, there is no way to open the right file other than carefully selecting part of the log line and pasting into the search box so as to perform a manual search for that file, which means that this major convenience is completely annulled.
Version information
From "About Microsoft Visual Studio":
Microsoft Visual Studio Community 2022
Version 17.4.4
VisualStudio.17.Release/17.4.4+33213.308
Microsoft .NET Framework
Version 4.8.04084
Installed Version: Community
ASP.NET and Web Tools 17.4.326.54890
ASP.NET and Web Tools
Azure App Service Tools v3.0.0 17.4.326.54890
Azure App Service Tools v3.0.0
C# Tools 4.4.0-6.22608.27+af1e46ad38d900023f8b1a2839484e471ece1502
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Clear MEF Component Cache 1.4
Clears the Visual Studio MEF component cache to fix issues with cache corruption.
Dotfuscator Community Edition 6.5.0+76d4669002
PreEmptive Protection - Dotfuscator CE
Extensibility Essentials 2022 1.1.14
A collection of extensions that makes it much easier to write Visual Studio extensions
Extensibility Margin 1.0.9
Shows relevant information about the current file and language to extensibility authors
Extensibility Message Bus 1.4.1 (main#2ee106a)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
Image Manifest Tools 1.1.8
Makes it easier to create and maintain .imagemanifest files for Visual Studio extension
Insert Guid 1.3.6
Makes it super easy to insert a new GUID into any editor and input field
KnownMonikers Explorer 2022 1.2.42
A tool window for Visual Studio extension authors to explore the KnownMonikers image collection
Markdown Editor v2 2.0.132
A full featured Markdown editor with live preview and syntax highlighting. Supports GitHub flavored Markdown.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Mono Debugging for Visual Studio 17.4.19 (8c0a575)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 6.4.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Pkgdef Language 1.3.88
Full language support with IntelliSense, validation, outlining, and more for .pkgdef and .pkgundef files
Razor (ASP.NET Core) 17.0.0.2246202+61cc048d36a3fc9246d2f04625988b19a18ab8f0
Provides languages services for ASP.NET Core Razor.
TypeScript Tools 17.0.10921.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 4.4.0-6.22608.27+af1e46ad38d900023f8b1a2839484e471ece1502
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 17.4.0-beta.22512.4+525d5109e389341bb90b144c24e2ad1ceec91e7b
Microsoft Visual F# Tools
VisualStudio.DeviceLog 1.0
Information about my package
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
VS Theme Colors 2022 1.0.11
Makes it easy to browse all the brushes and select the right theme color for your Visual Studio extension UI.
VSCode Theme Converter 1.0.15
A super easy way to convert VS Code themes to Visual Studio using the official CLI tool under the hood
VSColorOutput64 2022.2
Color output for build and debug windows - https://mike-ward.net/vscoloroutput
VSIX Synchronizer 1.0.27
Provides the ability to generate code-behind files for .vsixmanfiest and .vsct files in managed code to make the information easy to consume from the rest of the extension.
VSPackage Extension 1.0
VSPackage Visual Studio Extension Detailed Info
Xamarin 17.4.0.312 (d17-4#be7e8d1)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 17.4.0.138 (remotes/origin/d17-4#d36bba3cc9)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin.Android SDK 13.1.0.1 (d17-4/13ba222)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: a96bde9
Java.Interop: xamarin/java.interop/d17-4#fcc33ce2
SQLite: xamarin/sqlite/3.39.3#23e1ae7
Xamarin.Android Tools: xamarin/xamarin-android-tools/main#0be567a

Related

Visual Studio for Mac Browser .Net Core code from SourceLink

I don't know if this feature is existing or not on vs for Mac but I'm asking myself if it's possible to browser .Net 6 source code when navigating through implementation of specific object or method when I'm not in debug mode just like I do In standard visual studio.
Currently on Mac I'm able to see the assembly explorer, but it doesn't contain methods content for example for WebApplication.CreateBuilder method all I get is:
In standard visual studio I'm able to browser .Net source code using SourceLink like this:
Is this feature is even enable in vs for Mac ? If it is do you know how to enable it, I already enabled source link for nuget packages and I'm able to browse source code of libraries like Newtonsoft.Json in assembly explorer.
The Assembly Viewer in your case will be showing the reference assembly which will not have any implementation. If you find the assembly that has the implementation you can drag that dll or open it in Visual Studio for Mac.
By default Visual Studio for Mac opens the ASP.NET Core reference assemblies from:
/usr/local/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/
Instead you can open the assemblies from this other folder which has the full implementation:
/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App/
An alternative way is to step into the .NET code when you are debugging.
In order to step into .NET code you need to enable the Microsoft symbol server. In Preferences - Debugger - Symbol Servers, check Use Microsoft Symbol server
Then you should be able to step into .NET Code.
Note that this can make debugging slower since the symbols need to be downloaded from the symbol server, at least until the symbols are cached.

Why does Visual Studio Code not have intellisense for Unity keywords such as transform, or Vector3?

I am trying to learn Unity3d game development and would really appreciate some help here...
My issue is that upon typing a word such as transform (e.g transform.Rotate), instead of Intellisense lighting it up as a keyword, it highlights other suggestions such as OnTransformChildrenChanged()
or OnTransformParentChanged().
Any possible way of fixing this?
I just downloaded Visual Studio Code and the extensions needed to work with Unity3d.
I also have Unity3d's code editor set to Visual Studio Code via Preferences -> External Tools -> External Tool Editor.
I have watched multiple tutorials and downloaded multiple extensions for unity tools in VSCode, but still no fix to the Intellisense.
first download and install this runtime app
Windows: .NET Framework 4.6 Targeting Pack
macOS: Download .NET SDK.
download link all package for unity (package).
Open up Unity Preferences>-> External Tools>-> as External Script Editor.
after this choice the browse for the Visual Studio Cod executable .
The Visual Studio Code executable can be found at mac (osx)
/Applications/Visual Studio Code.app.
or at windows
C:\users{username}\AppData\Local\Programs\Microsoft VS Code\Code.exe
by default.
after restart both application
double click on c# file and choice VS code for ide.
I realize what my problem was, it had to do with HOW I was opening my C# scripts.
In Unity, instead of double clicking the C# script to open it up in VSCode, Right click the Assets Folder and then choose Open C# Script.
This solved the problem I was having completely.

How to get visual studio debugger to completely ignore original source file location

I'm beginning the work of moving an internal class library (.net framework, C#) to a series of nuget .net standard packages, which we will also serve internally. I'm in the research phase.
And I am attempting to research using the VS (2017) debugger and working to create our conventions for where debug versions of the packages (with symbols) will be and where the release versions (without symbols) will be.
I build a small dummy .net standard package in one solution, and have used nuget add to place it in a file share. And I have successfully consumed it in a different solution.
However, when I try to step into the code in the consuming solution, somehow, visual studio is doing something smart and actually stepping me into the source at its ORIGINAL location. Which is fine in some ways of thinking about it, but I want to simulate the situation of a different developer on a different machine consuming the package and not having that original source available, such that the only way to step into packaged code would be to consume a debug version with symbols. But visual studio is foiling me by figuring out the original source location and I don't see how it is doing that.
How can I get VS to be "dumber" so I can simulate on my machine what it would be to consume packages on another machine that didn't have this package source?
Thanks in advance.
How can I get VS to be "dumber" so I can simulate on my machine what it would be to consume packages on another machine that didn't have this package source?
You can try to specify the Symbols of that .net standard project to exclude from automatic loading.
Detail:
As we know:
The Program database (.pdb) files, also called symbol files, map
identifiers and statements in your project's source code to
corresponding identifiers and instructions in compiled apps.
Symbol files also show the location of the source files, and
optionally, the server to retrieve them from.
And the default setting of symbols loading for debugging in Visual Studio is that Load all modules:
That is the reason why Visual Studio smart and actually stepping your into the source at its ORIGINAL location.
So, to resolve this issue, we need to disable Visual Studio "Load all modules", we could specify excluded modules for your .net standard project.
To accomplish this, click the link on that window, then add the name of your .net standard:
Then Visual Studio get to be "dumber", not find the ORIGINAL location.
Hope this helps.

Visual studio doesn't support specific csproj file

I am getting this error when I try to open the solution file of my project. The solution is 2012 file (checked using notepad).
If I click on Ok, The solution opens up except for one csproject which does not load.
I get a migration report in UpgradeLog.htm file, with the following error for the project which failed to load. Could not figure out much from it.
Error:
The application which this project type is based on was not found.
Please try this link for further information:
http://go.microsoft.com/fwlink/?prd=12395&pver=11&sbp=ProjectTypeDeprecated&plcid=0x409&clcid=0x409&ar=MSDN&sar=ProjectCompatibility&o1=82b43b9b-a64c-4715-b499-d71e9ca2bd60
Does the upgrade report mean that it is a project from previous version of Visual studio? It does not open in Visual Studio 2010 either.
The error doesn't say that Visual Studio doesn't support .csproj files at all, it says it doesn't support a specific project type in that particular project file. This means this either isn't your project as you claim, or you are trying to build it on a different machine from the one used to create the project.
Visual Studio uses various elements in a .csproj file to determine its project type. See How do you tell the Visual Studio project type from an existing Visual Studio project and What is the significance of ProjectTypeGuids tag in the visual studio project file. It does this so it knows how to compile your project, what properties tabs to show, what context menu options should be available and so on.
Certain project types can cause this error. Usually they require some kind of SDK to be installed on the machine used to open or build the project.
You should search the web for the GUID mentioned in the error message you show (the value after o1=). You can also open the project file in a text editor and find the <ProjectTypeGuids> elements, which contains comma-separated project type GUIDs.
Then search the web for those GUIDs to find out which SDK or tool you need to install in order to be able to open or build the project.
If you paste the specific GUID from your error message in your favorite web search engine, you'll find Problem solved: Visual Studio / There is a missing project subtype. Subtype: '{82b43b9b-a64c-4715-b499-d71e9ca2bd60}' is unsupported by this installation., where it is mentioned you'll need to install the Visual Studio 2013 SDK. This means that in this case, your project is a Visual Studio 2013 extension.
This is what documentation is for. You should at least put a ReadMe.txt file in your project directory, explaining what the prerequisites for building a project are, especially when it won't open or build with Visual Studio out of the box.
I had this issue when I used Update 5 for VS 2013.
For me I had to click ok and read the next few steps, that popped up. I was initially clicking cancel.
On mine the project was missing Web Tools, so had to reinstall those and once done it was working.
Hope that helps someone.
This issue also appears when trying to import an ASP.Net project into Visual Studio 2015 Express for Desktop, and can be solved by simply downloading and installing Express 2015 for Web - or by using Visual Studio Community/Standard.
I am currently using VS 2017 v 15.7.4. This error came out of no where without any updates on my part. Usually when I have errors like this I just delete the .vs folder in my solution and that clears the problem. In this case that is what I did and the problem was fixed.
Close VS
Delete .vs folder
Load VS
Note: This was for a Xamarin based solution.
I solved this problem by downloading and installing (Microsoft Visual Studio Installer Projects). Close the project then install. After the installation, open your project then reload .csproj file
I had the same issue with VS 2017.
Eventually i solved it by just enable the SSIS in the following way:
1. In VS 2017 - Click on Extensions and Updates in the Tools menu.
Locate the Microsoft Integration Services Projects.
if you can't find it then you will have to install it first.
Click on the Enable button.
Close VS and start it again and SSIS projects are now available.
enter image description here
This (the error that states "Visual studio doesn't support specific csproj file") also occurs when the .vs folder is removed; however, closing and reopening Visual Studio will resolve the error.

MSM Merge Modules in Visual Studio 2013

Could someone please let me know where I might find resources for creating MSM files? While I am able to create MSI files using InstallShield, it seems that Visual Studio no longer supports Merge Module Projects, judging by the link below and the screenshot of my version of Visual Studio 2013 - http://msdn.microsoft.com/en-us/library/z6z02ts5(v=vs.80).aspx
To create a new merge module project:
On the File menu, point to Add, then click New Project.
In the resulting Add New Project dialog box, in the Project types pane, open the Other Project Types node and select Setup and Deployment Projects.
In the Templates pane, choose Merge Module Project.
For those still looking to use Merge Modules in Visual Studio; there is an official Microsoft extension for Visual Studio 2013 that lets you create Merge Module projects again.
Information on the extension, click here. The page leads to the Visual Studio Gallery where you can download the extension
Update 17 Sept 2015: an extension for VS2015 is also available here.
As discussed in the comments, Setup projects got removed from Visual Studio; a version of InstallShield was provided as their replacement. The standard alternative to InstallShield is WiX. WiX is somewhat arcane at first - it's a pretty thin layer over Windows Installer - but there are quite a few resources and examples out there.
Good resources for getting into WiX are http://wix.tramontana.co.hu/ and http://wixtoolset.org/documentation/manual/v3/. You can download the tooling from http://wixtoolset.org/

Categories