Log first change exception

This commit is contained in:
bao-qian
2016-05-15 17:03:06 +01:00
parent 87497d2d09
commit cf9c41f437
20 changed files with 92 additions and 71 deletions

View File

@@ -6,6 +6,7 @@ using Wox.Core.Plugin;
using Wox.Core.UserSettings;
using Wox.Helper;
using Wox.Infrastructure.Image;
using Wox.Infrastructure.Logger;
using Wox.Infrastructure.Storage;
using Wox.ViewModel;
using Stopwatch = Wox.Infrastructure.Stopwatch;
@@ -22,7 +23,8 @@ namespace Wox
[STAThread]
public static void Main()
{
RegisterAppDomainUnhandledException();
RegisterAppDomainExceptions();
if (SingleInstance<App>.InitializeAsFirstInstance(Unique))
{
using (var application = new App())
@@ -74,18 +76,31 @@ namespace Wox
Current.Exit += (s, e) => Dispose();
Current.SessionEnding += (s, e) => Dispose();
}
/// <summary>
/// let exception throw as normal is better for Debug
/// </summary>
[Conditional("RELEASE")]
private void RegisterDispatcherUnhandledException()
{
// let exception throw as normal is better for Debug
DispatcherUnhandledException += ErrorReporting.DispatcherUnhandledException;
}
/// <summary>
/// let exception throw as normal is better for Debug
/// </summary>
[Conditional("RELEASE")]
private static void RegisterAppDomainUnhandledException()
private static void RegisterAppDomainExceptions()
{
// let exception throw as normal is better for Debug
AppDomain.CurrentDomain.UnhandledException += ErrorReporting.UnhandledExceptionHandle;
AppDomain.CurrentDomain.FirstChanceException += (s, e) =>
{
Log.Error("First Chance Exception:");
Log.Exception(e.Exception);
};
}
public void Dispose()

View File

@@ -405,29 +405,30 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
xcopy /Y $(ProjectDir)Themes\* $(TargetDir)Themes\
xcopy /Y /E $(ProjectDir)Images\* $(TargetDir)Images\
xcopy /Y /D /E $(SolutionDir)Plugins\HelloWorldPython\* $(TargetDir)Plugins\HelloWorldPython\*
xcopy /Y $(ProjectDir)Themes\* $(TargetDir)Themes\
xcopy /Y /E $(ProjectDir)Images\* $(TargetDir)Images\
xcopy /Y /D /E $(SolutionDir)Plugins\HelloWorldPython\* $(TargetDir)Plugins\HelloWorldPython\*
cd $(SolutionDir)packages\squirrel*\tools
copy /Y Squirrel.exe $(TargetDir)..\Update.exe
cd $(SolutionDir)
if $(ConfigurationName) == Release (
cd "$(TargetDir)Plugins" &amp; del /s /q NLog.dll
cd "$(TargetDir)Plugins" &amp; del /s /q NLog.config
cd "$(TargetDir)Plugins" &amp; del /s /q Wox.Plugin.pdb
cd "$(TargetDir)Plugins" &amp; del /s /q Wox.Plugin.dll
cd "$(TargetDir)Plugins" &amp; del /s /q Wox.Core.dll
cd "$(TargetDir)Plugins" &amp; del /s /q Wox.Core.pdb
cd "$(TargetDir)Plugins" &amp; del /s /q ICSharpCode.SharpZipLib.dll
cd "$(TargetDir)Plugins" &amp; del /s /q NAppUpdate.Framework.dll
cd "$(TargetDir)Plugins" &amp; del /s /q Wox.Infrastructure.dll
cd "$(TargetDir)Plugins" &amp; del /s /q Wox.Infrastructure.pdb
cd "$(TargetDir)Plugins" &amp; del /s /q Newtonsoft.Json.dll
cd "$(TargetDir)Plugins" &amp; del /s /q JetBrains.Annotations.dll
cd "$(TargetDir)Plugins" &amp; del /s /q Pinyin4Net.dll
cd "$(TargetDir)" &amp; del /s /q *.xml
)
if $(ConfigurationName) == Release (
cd "$(TargetDir)Plugins" &amp; del /s /q NLog.dll
cd "$(TargetDir)Plugins" &amp; del /s /q NLog.config
cd "$(TargetDir)Plugins" &amp; del /s /q Wox.Plugin.pdb
cd "$(TargetDir)Plugins" &amp; del /s /q Wox.Plugin.dll
cd "$(TargetDir)Plugins" &amp; del /s /q Wox.Core.dll
cd "$(TargetDir)Plugins" &amp; del /s /q Wox.Core.pdb
cd "$(TargetDir)Plugins" &amp; del /s /q ICSharpCode.SharpZipLib.dll
cd "$(TargetDir)Plugins" &amp; del /s /q NAppUpdate.Framework.dll
cd "$(TargetDir)Plugins" &amp; del /s /q Wox.Infrastructure.dll
cd "$(TargetDir)Plugins" &amp; del /s /q Wox.Infrastructure.pdb
cd "$(TargetDir)Plugins" &amp; del /s /q Newtonsoft.Json.dll
cd "$(TargetDir)Plugins" &amp; del /s /q JetBrains.Annotations.dll
cd "$(TargetDir)Plugins" &amp; del /s /q Pinyin4Net.dll
cd "$(TargetDir)" &amp; del /s /q *.xml
)
</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
@@ -438,11 +439,6 @@
!-->
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release' And '$(APPVEYOR_BUILD_FOLDER)' == '' ">
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
<Output TaskParameter="Assemblies" ItemName="myAssemblyInfo" />
</GetAssemblyIdentity>
<Exec Command="nuget pack $(SolutionDir)Deploy\wox.nuspec -Version %(myAssemblyInfo.Version) -Properties Configuration=Release -OutputDirectory $(TargetDir) -BasePath $(TargetDir)" />
<Exec Command="squirrel --releasify $(TargetDir)Wox.%(myAssemblyInfo.Version).nupkg --releaseDir $(TargetDir)Installer --no-msi" />
<Target Name="AfterBuild">
</Target>
</Project>