Skip to content

Commit a92a19a

Browse files
committed
Fixes for dumping Func and Delegate types, critical fixes in exceptions rendering, initialization critical fixes on non-standard environments
1 parent 28f03ad commit a92a19a

12 files changed

Lines changed: 77 additions & 47 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ __pycache__/
289289
*.xsd.cs
290290

291291

292-
292+
obj/Dev/*
293293
*.user
294294
.vs/
295295
Assets/node_modules

Completers/StackTrace.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ internal static RenderingCollection CompleteStackTraceForCurrentApplicationPoint
7171
ErrorFileStackTrace = errorFile,
7272
AllStackTraces = stackTraceItems,
7373
ExceptionMessage = message,
74-
ExceptionType = exceptionType.Length > 0 ? exceptionType : ""
74+
ExceptionType = exceptionType.Length > 0 ? exceptionType : "",
75+
ExceptionHash = "",
76+
CausedByHash = "",
77+
CausedByMessage = "",
78+
CausedByType = "",
7579
};
7680
}
7781
internal static StackTraceItem CompleteCallerPoint () {
@@ -99,7 +103,7 @@ internal static StackTraceItem CompleteCallerPoint () {
99103
return result;
100104
}
101105
internal static RenderingCollection RenderStackTraceForException (ExceptionToRender exceptionToRender, bool fileSystemLog = true, bool htmlOut = false, int index = 0) {
102-
StackTraceItem? possibleViewExceptionStackTrace;
106+
//StackTraceItem? possibleViewExceptionStackTrace;
103107
List<StackTraceItem> stackTraceItems = StackTrace._completeStackTraceForSingleException(exceptionToRender.Exception);
104108
StackTraceItem? errorFile = null;
105109
string causedByHash = "";
@@ -113,7 +117,9 @@ internal static RenderingCollection RenderStackTraceForException (ExceptionToRen
113117
errorFile = possibleViewExceptionStackTrace;
114118
}*/
115119
if (exceptionToRender.Exception is HttpCompileException) {
116-
PropertyInfo[] props = exceptionToRender.Exception.GetType().GetProperties(BindingFlags.NonPublic | BindingFlags.Instance);
120+
PropertyInfo[] props = exceptionToRender.Exception.GetType().GetProperties(
121+
BindingFlags.NonPublic | BindingFlags.Instance
122+
);
117123
PropertyInfo prop;
118124
for (int i = 0, l = props.Length; i < l; i += 1) {
119125
prop = props[i];

Core/Module.cs

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,23 @@ public void Init(HttpApplication application) {
3131
application.BeginRequest += delegate (object o, EventArgs e) {
3232
try {
3333
Dispatcher.GetCurrent().WebRequestBegin();
34-
} catch { }
34+
} catch (Exception ex) {
35+
Desharp.Debug.Log(ex.Message + "\r\n" + ex.StackTrace);
36+
}
3537
};
3638
application.AcquireRequestState += delegate (object o, EventArgs e) {
3739
try {
3840
Dispatcher.GetCurrent().WebRequestSessionBegin();
39-
} catch { }
41+
} catch (Exception ex) {
42+
Desharp.Debug.Log(ex.Message + "\r\n" + ex.StackTrace);
43+
}
4044
};
4145
application.PostRequestHandlerExecute += delegate (object o, EventArgs e) {
4246
try {
4347
Dispatcher.GetCurrent().WebRequestSessionEnd();
44-
} catch { }
48+
} catch (Exception ex) {
49+
Desharp.Debug.Log(ex.Message + "\r\n" + ex.StackTrace);
50+
}
4551
};
4652
/*application.EndRequest += delegate (object o, EventArgs e) {
4753
try {
@@ -52,28 +58,38 @@ public void Init(HttpApplication application) {
5258
dispatcher.WebRequestPreSendBody();
5359
Dispatcher.Remove();
5460
}
55-
} catch { }
61+
} catch (Exception ex) {
62+
Desharp.Debug.Log(ex.Message + "\r\n" + ex.StackTrace);
63+
}
5664
};*/
5765
application.PreSendRequestHeaders += delegate (object o, EventArgs e) {
5866
try {
5967
Dispatcher.GetCurrent().WebRequestPreSendHeaders();
60-
} catch { }
68+
} catch (Exception ex) {
69+
Desharp.Debug.Log(ex.Message + "\r\n" + ex.StackTrace);
70+
}
6171
};
6272
application.PreSendRequestContent += delegate (object o, EventArgs e) {
6373
try {
6474
Dispatcher.GetCurrent().WebRequestPreSendBody();
6575
Dispatcher.Remove();
66-
} catch { }
76+
} catch (Exception ex) {
77+
Desharp.Debug.Log(ex.Message + "\r\n" + ex.StackTrace);
78+
}
6779
};
6880
application.Error += delegate (object o, EventArgs e) {
6981
try {
7082
Dispatcher.GetCurrent().WebRequestError();
71-
} catch { }
83+
} catch (Exception ex) {
84+
Desharp.Debug.Log(ex.Message + "\r\n" + ex.StackTrace);
85+
}
7286
};
7387
application.Disposed += delegate (object o, EventArgs e) {
7488
try {
7589
Dispatcher.Disposed();
76-
} catch { }
90+
} catch (Exception ex) {
91+
Desharp.Debug.Log(ex.Message + "\r\n" + ex.StackTrace);
92+
}
7793
};
7894
}
7995
}

Core/Structs/DumpOptions.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public struct DumpOptions {
1818
/// Set true if you want to return dumped string as result of Desharp.Debug.Dump() function call.
1919
/// </summary>
2020
public bool? Return;
21-
internal bool? CatchedException;
21+
/// <summary>
22+
/// Set true if you want to render red exception over whole browser screen.
23+
/// </summary>
24+
public bool? CatchedException;
2225
}
2326
}

Core/Tools.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ static Tools () {
6868
Tools.Editor = cfgEditor;
6969
}
7070
internal static string RelativeSourceFullPath (string fileName) {
71+
if (String.IsNullOrEmpty(Dispatcher.AppRoot)) return fileName;
7172
int appRootPos = fileName.IndexOf(Dispatcher.AppRoot);
7273
if (appRootPos == 0) {
7374
fileName = fileName.Substring(Dispatcher.AppRoot.Length);

Desharp.csproj

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<WarningLevel>4</WarningLevel>
3535
<Prefer32Bit>false</Prefer32Bit>
3636
<DocumentationFile>bin\Debug\Desharp.XML</DocumentationFile>
37+
<RegisterForComInterop>true</RegisterForComInterop>
3738
</PropertyGroup>
3839
<PropertyGroup>
3940
<ApplicationIcon>
@@ -45,6 +46,17 @@
4546
<PropertyGroup>
4647
<AssemblyOriginatorKeyFile>Tom Flidr - .NET.pfx</AssemblyOriginatorKeyFile>
4748
</PropertyGroup>
49+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|AnyCPU'">
50+
<DebugSymbols>true</DebugSymbols>
51+
<OutputPath>bin\Dev\</OutputPath>
52+
<DefineConstants>TRACE;DEBUG</DefineConstants>
53+
<DocumentationFile>bin\Debug\Desharp.XML</DocumentationFile>
54+
<RegisterForComInterop>true</RegisterForComInterop>
55+
<DebugType>full</DebugType>
56+
<PlatformTarget>AnyCPU</PlatformTarget>
57+
<ErrorReport>prompt</ErrorReport>
58+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
59+
</PropertyGroup>
4860
<ItemGroup>
4961
<Reference Include="System" />
5062
<Reference Include="System.Configuration" />
@@ -127,34 +139,29 @@
127139
<SubType>Designer</SubType>
128140
</None>
129141
<None Include="content\Web.config.uninstall.xdt" />
130-
<None Include="Tom Flidr - .NET.pfx" />
131-
<None Include="_CreateNewNuGetPackage\DoNotModify\NuGet.exe" />
132142
<None Include="packages.config" />
133-
<None Include="_CreateNewNuGetPackage\Config.ps1" />
134-
<None Include="_CreateNewNuGetPackage\DoNotModify\CreateNuGetPackage.ps1" />
135-
<None Include="_CreateNewNuGetPackage\DoNotModify\New-NuGetPackage.ps1" />
136-
<None Include="_CreateNewNuGetPackage\DoNotModify\UploadNuGetPackage.ps1" />
137-
<None Include="_CreateNewNuGetPackage\RunMeToUploadNuGetPackage.cmd" />
143+
<None Include="Tom Flidr - .NET.pfx" />
138144
</ItemGroup>
139145
<ItemGroup>
140146
<Folder Include="Assets\node_modules\desharp-assets\src\" />
141147
</ItemGroup>
142148
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
143149
<PropertyGroup>
144-
<PreBuildEvent>@IF $(ConfigurationName) EQU Release (
150+
<PreBuildEvent>@IF $(ConfigurationName) NEQ Dev (
145151
@IF EXIST $(ProjectDir)Assets\node_modules\desharp-assets (
146152
CD $(ProjectDir)Assets\node_modules\desharp-assets\dev-tools
147-
build.cmd
153+
build.cmd
148154
)
149155
)</PreBuildEvent>
150156
</PropertyGroup>
151157
<PropertyGroup>
152-
<PostBuildEvent>@IF $(ConfigurationName) EQU Release (
158+
<PostBuildEvent>@IF $(ConfigurationName) NEQ Dev (
153159
REM Create a NuGet package for this project and place the .nupkg file in the project's output directory.
154160
REM If you see this in Visual Studio's Error List window, check the Output window's Build tab for the actual error.
155161
ECHO Creating NuGet package in Post-Build event...
156-
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "&amp; '$(ProjectDir)_CreateNewNuGetPackage\DoNotModify\CreateNuGetPackage.ps1' -ProjectFilePath '$(ProjectPath)' -OutputDirectory '$(TargetDir)' -BuildConfiguration '$(ConfigurationName)' -BuildPlatform '$(PlatformName)'"
157-
)</PostBuildEvent>
162+
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "&amp; '$(ProjectDir)_CreateNewNuGetPackage\DoNotModify\CreateNuGetPackage.ps1' -ProjectFilePath '$(ProjectPath)' -NuSpecFilePath '$(ProjectDir)Desharp.nuspec' -OutputDirectory '$(TargetDir)' -BuildConfiguration '$(ConfigurationName)' -BuildPlatform '$(PlatformName)'"
163+
)
164+
</PostBuildEvent>
158165
</PropertyGroup>
159166
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
160167
Other similar extension points exist, see Microsoft.Common.targets.

Desharp.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
33
<metadata minClientVersion="2.6">
44
<id>Desharp</id>
5-
<version>1.2.12.0</version>
5+
<version>1.2.13.0</version>
66
<title>Desharp - C#/VB.NET Debugging Tool</title>
77
<authors>Tom Flidr</authors>
88
<owners>Tom Flidr</owners>

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@
3535
// You can specify all the values or you can default the Build and Revision Numbers
3636
// by using the '*' as shown below:
3737
// [assembly: AssemblyVersion("1.0.*")]
38-
[assembly: AssemblyVersion("1.2.12.0")]
39-
[assembly: AssemblyFileVersion("1.2.12.0")]
38+
[assembly: AssemblyVersion("1.2.13.0")]
39+
[assembly: AssemblyFileVersion("1.2.13.0")]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# **[Desharp](https://www.nuget.org/packages/Desharp/)** - C#/VB .NET Debugging Tool
22

3-
[![Latest Stable Version](https://img.shields.io/badge/Stable-v1.2.11-brightgreen.svg?style=plastic)](https://github.com/tomFlidr/desharp/releases)
3+
[![Latest Stable Version](https://img.shields.io/badge/Stable-v1.2.13-brightgreen.svg?style=plastic)](https://github.com/tomFlidr/desharp/releases)
44
[![License](https://img.shields.io/badge/Licence-BSD-brightgreen.svg?style=plastic)](https://raw.githubusercontent.com/debug-sharp/desharp/master/LICENCE.md)
55
![.NET Version](https://img.shields.io/badge/.NET->=4.0-brightgreen.svg?style=plastic)
66

Renderers/Dumper.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -576,17 +576,17 @@ private static string _dumpFunc(object obj, int level, bool htmlOut, List<int> i
576576
if (prms.Length > 0) {
577577
for (int i = 0, l = prms.Length; i < l; i += 1) {
578578
result += (result.Length == 0
579-
? "Func<"
580-
: ", ") + prms[i].ParameterType.Name + " " + prms[i].Name;
579+
? "Func<param "
580+
: ", param ") + prms[i].ParameterType.Name + " " + prms[i].Name;
581581
}
582-
result += ", out " + mi.ReturnType.Name + ">";
582+
result += ", return " + mi.ReturnType.Name + ">()";
583583
} else {
584-
result += "Func<out " + mi.ReturnType.Name + ">";
584+
result += "Func<return " + mi.ReturnType.Name + ">()";
585585
}
586586
if (htmlOut) {
587-
result = $@"<div class=""item dump dump-{sequence}{obj.GetHashCode()} func"">"
588-
+ result
589-
+ "</div>";
587+
result = $@"<span class=""runtimetype func"">"
588+
+ result.Replace("<", "&lt;").Replace(">", "&gt;")
589+
+ @"</span>&nbsp;<span class=""type"">[System.Func]</span>";
590590
}
591591
return result;
592592
}
@@ -606,9 +606,9 @@ private static string _dumpDelegate(object obj, int level, bool htmlOut, List<in
606606
result += mi.ReturnType.Name + " " + objType.FullName + "()";
607607
}
608608
if (htmlOut) {
609-
result = $@"<div class=""item dump dump-{sequence}{obj.GetHashCode()} delegate"">"
609+
result = $@"<span class=""runtimetype delegate"">"
610610
+ result
611-
+ "</div>";
611+
+ @"</span>&nbsp;<span class=""type"">[System.Delegate]</span>";
612612
}
613613
return result;
614614
}

0 commit comments

Comments
 (0)