Desharp 1.3.0
See the version list below for details.
Requires NuGet 2.6 or higher.
dotnet add package Desharp --version 1.3.0
NuGet\Install-Package Desharp -Version 1.3.0
<PackageReference Include="Desharp" Version="1.3.0" />
paket add Desharp --version 1.3.0
#r "nuget: Desharp, 1.3.0"
// 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
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
PM> Install-Package Desharp
Demos & Examples
- Console Application Demo (C#), (VB.NET)
Demo dumps and exceptions rendering into console window, logging on HDD and optional tests running. - Windows Forms Application Demo (C#)
Demo dumps and exceptions rendering into text field component, into debug output window and logging on HDD. - Web Basic Application Demo (C#)
Demo dumps and exceptions rendering into floating browser bar and logging on HDD. - Web MVC Application Demo (C#)
Demo dumps and exceptions rendering into floating browser bar and logging on HDD. - Web Forms Application Demo (C#)
Demo dumps and exceptions rendering into floating browser bar and logging on HDD.
Do Not Miss
- Visual Studio code snippets
Download and install predefined VS snippets for most offtenDesharp
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
andDataRow
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<>
andDelegate
types- reflection objects are only displayed as type names
- primitive variables and it's primitive arrays like:
- 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
)
- source location call (default:
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 theDebug.dump()
orDebug.Log()
has been called or whereException
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
- if optional flag for catched exception is
- dump or log has always rendered
Product | Versions |
---|---|
.NET Framework | net40 net403 net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48 net481 |
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 | Downloads | Last updated |
---|---|---|
1.3.0.3 | 2,893 | 9/26/2019 |
1.3.0.2 | 480 | 9/26/2019 |
1.3.0.1 | 494 | 9/26/2019 |
1.3.0 | 830 | 9/25/2019 |
1.2.15 | 444 | 9/20/2019 |
1.2.12 | 8,484 | 1/18/2019 |
1.2.11 | 6,733 | 12/11/2017 |
1.2.9 | 1,403 | 11/28/2017 |
1.2.8 | 1,162 | 11/7/2017 |
1.2.4 | 4,465 | 6/14/2017 |
1.2.3 | 948 | 6/12/2017 |
1.1.6 | 874 | 6/5/2017 |
1.1.5 | 1,034 | 6/4/2017 |
1.0.1 | 1,060 | 3/26/2017 |
1.0.0 | 901 | 3/23/2017 |