简体   繁体   English

如何在Visual Studio 2008调试器中查看GUID的值?

[英]How do I see the value of a GUID in the Visual Studio 2008 debugger?

When you look at a GUID values item in the watch window you do not see the value of the item, when you expand the item you just see “ Empty ” this is very misleading! 当您在监视窗口中查看GUID值项目时,您看不到该项目的值,而展开该项目时,您只会看到“ Empty ”( ),这非常容易引起误解!

You have to add “ToString()” to the value to see something useful. 您必须在值中添加“ ToString()”才能看到有用的东西。

So how do I get Visual Studio to add the “ToString()” it's self? 那么,如何使Visual Studio自行添加“ ToString()”呢?


I am using VB.NET if it make a difference. 我正在使用VB.NET,如果有所作为。

Take a look here: Visualizing GUIDs in the Visual Studio 2008 debugger 在这里看看: 在Visual Studio 2008调试器中可视化GUID


Edit by Ian 伊恩编辑

Thanks that worked well, however I had to change 谢谢,效果很好,但是我不得不改变

<Assembly: DebuggerDisplay("{ToString}", Target:=GetType(Guid))> 

to

<Assembly: DebuggerDisplay("{ToString()}", Target:=GetType(Guid))>

so it also worked from C# 所以它也可以在C#中工作

When i add a guid to the watch window, it shows its value without having to expand it (the ToString() is automatically used). 当我将GUID添加到监视窗口时,它无需扩展即可显示其值(自动使用ToString())。

How are you creating your guid? 您如何创建GUID? If you are using 如果您正在使用

Guid x = new Guid();

then yes, it will be an "empty" guid. 那是的,这将是一个“空”的向导。 If you use 如果您使用

Guid x = Guid.NewGuid();

then you will see that it has a value. 那么您将看到它具有价值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio 2008调试器分离 - Visual Studio 2008 debugger detach 如何在 Visual Studio 中将进程附加到调试器? - How do I attach a process to the debugger in Visual Studio? Visual Studio 2008调试器随机死亡 - Visual Studio 2008 Debugger randomly dying Visual Studio - 如何在调试器中更改方法的返回值? - Visual Studio - How to change the return value of a method in the debugger? 如何转储.NET进程,以便Visual Studio 2008将其作为托管转储加载? - How do I dump the .NET process so that Visual Studio 2008 will load it as a managed dump? 如何在Visual Studio Web Developer 2008 SP1中使用ASP.NET MVC RC? - How do I use ASP.NET MVC RC with Visual Studio Web Developer 2008 SP1? 如何从Visual Studio 2008中制作Windows Service安装程序? - How do I make a windows service installer from visual studio 2008? 我如何找到在Visual Studio 2008中正在调用特定功能的所有线/位置/点? - How do i find all the lines/places/points where a particular function is being called in Visual Studio 2008? 如何在普通项目Visual Studio 2008上添加快捷方式do文件 - How to add a shortcut do file on normal project Visual Studio 2008 在Visual Studio调试器值“{}”中它意味着什么? - What does it mean in Visual Studio debugger value “{ }”?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM