Définir « ne fonctionne pas » ... il fonctionne certainement en C# (je ne sais pas si l'éditeur du C soutient - il suffit de traduire les éléments suivants qui fonctionne en C# pour savoir ;-P)
using System.Diagnostics;
[DebuggerDisplay("HiWorld={Bar}")]
class Foo
{
public string Bar { get; set; }
static void Main()
{
Foo foo = new Foo { Bar = "abc" };
// breakpoint and hover shows: HiWorld="abc"
}
}
Je ne "fais" C++ plus, mais réflecteur dit:
[DebuggerDisplay(S"HiWorld={Bar}")]
private __gc class Foo
{
// Methods
private: static void __gc* Main()
{
Foo __gc* <>g__initLocal0 = __gc new Foo();
<>g__initLocal0->Bar = S"abc";
Foo __gc* foo = <>g__initLocal0;
}
// Properties
[CompilerGenerated]
public: __property String __gc* get_Bar()
{
return this-><Bar>k__BackingField;
}
[CompilerGenerated]
public: __property void __gc* set_Bar(String __gc* value)
{
this-><Bar>k__BackingField = value;
}
// Fields
[CompilerGenerated]
private: String __gc* <Bar>k__BackingField;
};
Extrait de code? Qu'est-ce qui échoue? – Brian
Il n'affiche pas le texte personnalisé juste l'habituel: "employee = 0x058482f8 {age = 46 tracker = 0x0584f1cc nID = 14 ...}" –
Maintenant pris en charge dans Update2 VS2015. https://blogs.msdn.microsoft.com/vcblog/2016/02/12/natvis-for-ccli-available-to-preview-in-vs2015-update-2/ – Jordan