Desharp 1.3.0

Desharp - C#/VB .NET debuging utility to dump or log structured variables, exceptions, stack traces and much more into console, visual studio console, into html web response as floating window or into html/text log files on HDD.
Download and install Visual Studio code snippets for Desharp: https://github.com/debug-sharp/codesnippets
Dependencies .NET Framework >= 4.0.0.0 (Microsoft.CSharp, System, System.Configuration, System.Core, System.Data, System.Data.DataSetExtensions, System.Web, System.Web.Extensions, System.Xml)

There is a newer version of this package available.
See the version list below for details.

Requires NuGet 2.6 or higher.

Install-Package Desharp -Version 1.3.0
dotnet add package Desharp --version 1.3.0
<PackageReference Include="Desharp" Version="1.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Desharp --version 1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Desharp, 1.3.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Desharp as a Cake Addin
#addin nuget:?package=Desharp&version=1.3.0

// Install Desharp as a Cake Tool
#tool nuget:?package=Desharp&version=1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

About

C# & VB .NET debugging utility for:

  • dump or log any structuralized variables
  • dump or log exceptions with stack trace and inner exceptions

Dump any variables into:

  • Console window
  • Output debug panel in Visual Studio
  • Web response in floating window
  • Html/text log files on HDD
  • Any WinForms or WPF field component

Instalation

Desharp on Nuget.org

PM> Install-Package Desharp

Demos & Examples


Do Not Miss

  • Visual Studio code snippets
    Download and install predefined VS snippets for most offten Desharp calls.
  • Visual Studio opener
    Automatic Visual Studio (or any other) editor opening on specific file and line from rendered logs and exceptions.

Usage In Code

Dumping & Logging Any Structuralized Variables

C# Basic Example
using Desharp;
using System.Collections.Generic;

var list = new List<int?>() { 100, 200, null };
Debug.Dump(list);  // print list by Console.WriteLine(); or append into html response as floating window
Debug.Log(list);   // store dumped list in debug.log or debug.html file on HDD
VB Basic Example
Imports Desharp
Imports System.Collections.Generic

Dim list As New List(Of Int32?)() { 100, 200, null }
Debug.Dump(list)  ' print list by Console.WriteLine(); or append into html response as floating window
Debug.Log(list)   ' store dumped list in debug.log or debug.html file on HDD

Dumped result for both languages:

[List<Int32?>[3]]
   0: 100 [Int32]
   1: 200 [Int32]
   2: null

Dumping & Logging Exceptions

C# Basic Example
try {
   throw new Exception("Something wrong!");
} catch (Exception e) {
   Debug.Dump(e);  // print exception by Console.WriteLine(); or append into html response as floating window
   Debug.Log(e);   // store dumped exception in exception.log or exception.html file on HDD
}
VB Basic Example
Try
   Throw New Exception("Something wrong!")
Catch e As Exception
   Debug.Dump(e)  ' print exception by Console.WriteLine(); or append into html response as floating window
   Debug.Log(e)   ' store dumped exception in exception.log or exception.html file on HDD
End Try

Dumped result for both languages:

System.Exception (Hash Code: 50632145):
   Message   : Something wrong!
   Time      : 2017-06-10 13:18:07:300
   Process ID: 7972
   Thread ID : 1
   File      : /Program.cs:8
   -------
       4 | namespace ExampleConsole {
       5 |     class Program {
       6 |         static void Main(string[] args) {
       7 |             try {
   ->  8 |                 throw new Exception("Something wrong!");
       9 |             } catch (Exception e) {
      10 |                 Debug.Dump(e);  // print exception by Console.WriteLine(); or append into html response as floating window
      11 |                 Debug.Log(e);   // store dumped exception in exception.log or exception.html file on HDD
      12 |             }
   -------
   Callstack: 
      ExampleConsole.Program.Main(String[] args) /Program.cs 8

Dumps & Logs Outputs

  • console window for console applications
  • Visual Studio console for Windows Forms or WPF applications
  • floating window in html response for web applications
  • special HTTP headers for FilePHP browser extension for web applications
  • file logs in text/html formats

What You Can Dump Or Log

  • any variables
    • primitive variables and it's primitive arrays like: char, int?[] and more
    • collections: Lists, Dictionaries or any collections (IList, IDictionary, ICollection, IEnumerable...)
    • database results: DataSet, DataTable and DataRow with values
    • formated instances: DateTimeOffset, DateTime, TimeSpan, Guid, StringBuilder
    • any custom class instances with rendered events targets, properties values and fields values
    • anonymous objects like: new { any = "value" }
    • Func<> and Delegate types
    • reflection objects are only displayed as type names
  • exceptions
  • exceptions with inner exceptions
  • much more... you can try:-)

What Is Rendered (Dumps & Logs)

  • variables

    • always is rendered/logged the dumped variable:-)
    • dump is rendered with configurable return flag (to return dumped result as string)
    • dump or log is rendered with configurable:
      • source location call (default: false)
      • dump depth (default: 3)
      • maximum string length (default: 1024)
  • exceptions

    • dump or log has always rendered
      • exception message, process and thread id
      • file and line, where exception has been dumped, logged or thrown
        (only if source code is possible to target by *.PDB file, there is rendered
        a few lines from source code, where the Debug.dump() or Debug.Log()
        has been called or where Exception has been thrown)
      • exception callstack
        (with editor opener links in web dump or in html log)
      • all inner exceptions inside the given exception
    • exceptions in web environment has always rendered:
      • requested URL, all http request headers and client IP
      • all loaded assemblies
      • there are different dump rendering for catched and not catched exceptions:
        • if optional flag for catched exception is true, exception is rendered as
          openable exception in floating bar in left bottom screen corner
        • if optional flag for catched exception is false, exception is rendered
          over whole browser window immediately with possibility to close it back into floating bar

About

C# & VB .NET debugging utility for:

  • dump or log any structuralized variables
  • dump or log exceptions with stack trace and inner exceptions

Dump any variables into:

  • Console window
  • Output debug panel in Visual Studio
  • Web response in floating window
  • Html/text log files on HDD
  • Any WinForms or WPF field component

Instalation

Desharp on Nuget.org

PM> Install-Package Desharp

Demos & Examples


Do Not Miss

  • Visual Studio code snippets
    Download and install predefined VS snippets for most offten Desharp calls.
  • Visual Studio opener
    Automatic Visual Studio (or any other) editor opening on specific file and line from rendered logs and exceptions.

Usage In Code

Dumping & Logging Any Structuralized Variables

C# Basic Example
using Desharp;
using System.Collections.Generic;

var list = new List<int?>() { 100, 200, null };
Debug.Dump(list);  // print list by Console.WriteLine(); or append into html response as floating window
Debug.Log(list);   // store dumped list in debug.log or debug.html file on HDD
VB Basic Example
Imports Desharp
Imports System.Collections.Generic

Dim list As New List(Of Int32?)() { 100, 200, null }
Debug.Dump(list)  ' print list by Console.WriteLine(); or append into html response as floating window
Debug.Log(list)   ' store dumped list in debug.log or debug.html file on HDD

Dumped result for both languages:

[List<Int32?>[3]]
   0: 100 [Int32]
   1: 200 [Int32]
   2: null

Dumping & Logging Exceptions

C# Basic Example
try {
   throw new Exception("Something wrong!");
} catch (Exception e) {
   Debug.Dump(e);  // print exception by Console.WriteLine(); or append into html response as floating window
   Debug.Log(e);   // store dumped exception in exception.log or exception.html file on HDD
}
VB Basic Example
Try
   Throw New Exception("Something wrong!")
Catch e As Exception
   Debug.Dump(e)  ' print exception by Console.WriteLine(); or append into html response as floating window
   Debug.Log(e)   ' store dumped exception in exception.log or exception.html file on HDD
End Try

Dumped result for both languages:

System.Exception (Hash Code: 50632145):
   Message   : Something wrong!
   Time      : 2017-06-10 13:18:07:300
   Process ID: 7972
   Thread ID : 1
   File      : /Program.cs:8
   -------
       4 | namespace ExampleConsole {
       5 |     class Program {
       6 |         static void Main(string[] args) {
       7 |             try {
   ->  8 |                 throw new Exception("Something wrong!");
       9 |             } catch (Exception e) {
      10 |                 Debug.Dump(e);  // print exception by Console.WriteLine(); or append into html response as floating window
      11 |                 Debug.Log(e);   // store dumped exception in exception.log or exception.html file on HDD
      12 |             }
   -------
   Callstack: 
      ExampleConsole.Program.Main(String[] args) /Program.cs 8

Dumps & Logs Outputs

  • console window for console applications
  • Visual Studio console for Windows Forms or WPF applications
  • floating window in html response for web applications
  • special HTTP headers for FilePHP browser extension for web applications
  • file logs in text/html formats

What You Can Dump Or Log

  • any variables
    • primitive variables and it's primitive arrays like: char, int?[] and more
    • collections: Lists, Dictionaries or any collections (IList, IDictionary, ICollection, IEnumerable...)
    • database results: DataSet, DataTable and DataRow with values
    • formated instances: DateTimeOffset, DateTime, TimeSpan, Guid, StringBuilder
    • any custom class instances with rendered events targets, properties values and fields values
    • anonymous objects like: new { any = "value" }
    • Func<> and Delegate types
    • reflection objects are only displayed as type names
  • exceptions
  • exceptions with inner exceptions
  • much more... you can try:-)

What Is Rendered (Dumps & Logs)

  • variables

    • always is rendered/logged the dumped variable:-)
    • dump is rendered with configurable return flag (to return dumped result as string)
    • dump or log is rendered with configurable:
      • source location call (default: false)
      • dump depth (default: 3)
      • maximum string length (default: 1024)
  • exceptions

    • dump or log has always rendered
      • exception message, process and thread id
      • file and line, where exception has been dumped, logged or thrown
        (only if source code is possible to target by *.PDB file, there is rendered
        a few lines from source code, where the Debug.dump() or Debug.Log()
        has been called or where Exception has been thrown)
      • exception callstack
        (with editor opener links in web dump or in html log)
      • all inner exceptions inside the given exception
    • exceptions in web environment has always rendered:
      • requested URL, all http request headers and client IP
      • all loaded assemblies
      • there are different dump rendering for catched and not catched exceptions:
        • if optional flag for catched exception is true, exception is rendered as
          openable exception in floating bar in left bottom screen corner
        • if optional flag for catched exception is false, exception is rendered
          over whole browser window immediately with possibility to close it back into floating bar

Release Notes

https://github.com/debug-sharp/desharp/releases

Dependencies

This package has no dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Desharp:

Package Downloads
MvcCore
MvcCore - C# MVC Extensible Framework based on MvcCore PHP library.
FalkonryClient
C# ADK for integrating with Falkonry's condition prediction APIs
DbSharp
C#/VB.NET database utility to comfortly write pure Microsoft SQL/MySQL queries and load them into typed classes and collections.
Desharp.Tests
Desharp - dumping, logging and exceptions rendering tests.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.3.0.3 710 9/26/2019
1.3.0.2 243 9/26/2019
1.3.0.1 257 9/26/2019
1.3.0 337 9/25/2019
1.2.15 225 9/20/2019
1.2.12 6,017 1/18/2019
1.2.11 5,906 12/11/2017
1.2.9 808 11/28/2017
1.2.8 866 11/7/2017
1.2.4 2,261 6/14/2017
1.2.3 638 6/12/2017
1.1.6 580 6/5/2017
1.1.5 622 6/4/2017
1.0.1 650 3/26/2017
1.0.0 586 3/23/2017