Skip to content

Commit 39f7b87

Browse files
committed
fixed バグ
1 parent 6c6a7fd commit 39f7b87

File tree

4 files changed

+26
-17
lines changed

4 files changed

+26
-17
lines changed

source/CeVIOAIProxy/App.xaml.cs

+19-13
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public App()
3232
this.Exit += this.App_Exit;
3333

3434
this.DispatcherUnhandledException += this.App_DispatcherUnhandledException;
35+
TaskScheduler.UnobservedTaskException += this.TaskScheduler_UnobservedTaskException;
3536
AppDomain.CurrentDomain.UnhandledException += this.CurrentDomain_UnhandledException;
3637
}
3738

@@ -95,6 +96,14 @@ private void CloseServer()
9596
private void App_DispatcherUnhandledException(
9697
object sender,
9798
DispatcherUnhandledExceptionEventArgs e)
99+
{
100+
e.Handled = true;
101+
this.DumpUnhandledException(e.Exception);
102+
}
103+
104+
private void TaskScheduler_UnobservedTaskException(
105+
object sender,
106+
UnobservedTaskExceptionEventArgs e)
98107
{
99108
this.DumpUnhandledException(e.Exception);
100109
}
@@ -106,30 +115,27 @@ private void CurrentDomain_UnhandledException(
106115
this.DumpUnhandledException(e.ExceptionObject as Exception);
107116
}
108117

109-
private async void DumpUnhandledException(
118+
private void DumpUnhandledException(
110119
Exception ex)
111120
{
112-
await Task.Run(() =>
121+
if (!Directory.Exists(Config.AppData))
113122
{
114-
if (!Directory.Exists(Config.AppData))
115-
{
116-
Directory.CreateDirectory(Config.AppData);
117-
}
118-
119-
File.WriteAllText(
120-
Path.Combine(Config.AppData, @".\CeVIOAIProxy.error.log"),
121-
$"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}\n{ex}",
122-
new UTF8Encoding(false));
123-
});
123+
Directory.CreateDirectory(Config.AppData);
124+
}
124125

126+
File.WriteAllText(
127+
Path.Combine(Config.AppData, @".\CeVIOAIProxy.error.log"),
128+
$"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}\n{ex}",
129+
new UTF8Encoding(false));
125130
this.CloseServer();
131+
126132
CeVIOAIProxy.MainWindow.Instance?.HideNotifyIcon();
127133
Config.Instance.Save();
128134

129135
MessageBox.Show(
130136
"予期しない例外を検知しました。アプリケーションを終了します。\n\n" +
131137
ex,
132-
"Fatal",
138+
"Fatal - CeVIO AI Proxy",
133139
MessageBoxButton.OK,
134140
MessageBoxImage.Error);
135141

source/CeVIOAIProxy/CeVIOAIProxy.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
<AssemblyOriginatorKeyFile>CeVIOAIProxy.pfx</AssemblyOriginatorKeyFile>
1212
<Authors>anoyetta</Authors>
1313
<Copyright>(c) 2021 anoyetta</Copyright>
14-
<AssemblyVersion>1.2.0.0</AssemblyVersion>
14+
<AssemblyVersion>1.2.0.1</AssemblyVersion>
1515
<PackageIcon>share.ico</PackageIcon>
1616
<PackageIconUrl />
1717
<PackageProjectUrl>https://github.com/anoyetta/CeVIOAIProxy</PackageProjectUrl>
1818
<RepositoryUrl>https://github.com/anoyetta/CeVIOAIProxy.git</RepositoryUrl>
1919
<RepositoryType>GitHub</RepositoryType>
20-
<Version>1.0.4</Version>
20+
<Version>1.2.0.1</Version>
2121
<StartupObject>CeVIOAIProxy.App</StartupObject>
22-
<FileVersion>1.2.0.0</FileVersion>
22+
<FileVersion>1.2.0.1</FileVersion>
2323
</PropertyGroup>
2424

2525
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">

source/CeVIOAIProxy/Servers/BouyomiChanHttpServer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public BouyomiChanHttpServer(
1616
int port)
1717
{
1818
this.server = new HttpListener();
19-
this.server.Prefixes.Add($"http://+:{port}/");
19+
this.server.Prefixes.Add($"http://localhost:{port}/");
2020
this.server.Start();
2121
this.server.BeginGetContext(this.GetContextCallback, null);
2222
}

source/CeVIOAIProxy/app.manifest

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
<security>
66
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
77
<!-- 通常 -->
8+
<!--
9+
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
10+
-->
811
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
912

1013
<!-- 管理者権限 -->

0 commit comments

Comments
 (0)