Adds debugger attributes to help visualize objects.
See Milestones for release notes.
This is an add-in for Fody
It is expected that all developers using Fody become a Patron on OpenCollective. See Licensing/Patron FAQ for more information.
See also Fody usage.
Install the Visualize.Fody NuGet package and update the Fody NuGet package:
PM> Install-Package Fody PM> Install-Package Visualize.Fody
The Install-Package Fody is required since NuGet always defaults to the oldest, and most buggy, version of any dependency.
Add <Visualize/> to FodyWeavers.xml
<Weavers> <Visualize/> </Weavers>
public class Example1 { public string Name { get; set; } public int Number { get; set; } } public class Example2 : IEnumerable<int> { public IEnumerator<int> GetEnumerator() { return Enumerable.Range(0, 10).GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } }
[DebuggerDisplay("Name = {Name} | Number = {Number}")] public class Example1 { public string Name { get; set; } public int Number { get; set; } } [DebuggerTypeProxy(typeof(<Example2>Proxy))] public class Example2 : IEnumerable<int> { private sealed class <Example2>Proxy { private readonly Example2 original; public <Example2>Proxy(Example2 original) { this.original = original; } public int[] Items { get { return new List<int>(original).ToArray(); } } } public IEnumerator<int> GetEnumerator() { return Enumerable.Range(0, 10).GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } }
- DebuggerDisplayAttribute on MSDN
- DebuggerTypeProxyAttribute on MSDN
- Enhancing Debugging with the Debugger Display Attributes
Eye designed by Nicolas Ramallo from The Noun Project.