File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -112,13 +112,13 @@ public static unsafe bool TryEnqueue<T1, T2>(this DispatcherQueue dispatcherQueu
112
112
/// <exception cref="Exception">Thrown when the enqueue operation fails.</exception>
113
113
private static unsafe bool TryEnqueue ( DispatcherQueue dispatcherQueue , IDispatcherQueueHandler * dispatcherQueueHandler )
114
114
{
115
- IDispatcherQueue * dispatcherQueuePtr = ( IDispatcherQueue * ) ( ( IWinRTObject ) dispatcherQueue ) . NativeObject . ThisPtr ;
116
-
117
115
bool success ;
118
116
int hResult ;
119
117
120
118
try
121
119
{
120
+ IDispatcherQueue * dispatcherQueuePtr = ( IDispatcherQueue * ) ( ( IWinRTObject ) dispatcherQueue ) . NativeObject . ThisPtr ;
121
+
122
122
hResult = dispatcherQueuePtr ->TryEnqueue ( dispatcherQueueHandler , ( byte * ) & success ) ;
123
123
124
124
GC . KeepAlive ( dispatcherQueue ) ;
@@ -146,13 +146,13 @@ private static unsafe bool TryEnqueue(DispatcherQueue dispatcherQueue, IDispatch
146
146
/// <exception cref="Exception">Thrown when the enqueue operation fails.</exception>
147
147
private static unsafe bool TryEnqueue ( DispatcherQueue dispatcherQueue , DispatcherQueuePriority priority , IDispatcherQueueHandler * dispatcherQueueHandler )
148
148
{
149
- IDispatcherQueue * dispatcherQueuePtr = ( IDispatcherQueue * ) ( ( IWinRTObject ) dispatcherQueue ) . NativeObject . ThisPtr ;
150
-
151
149
bool success ;
152
150
int hResult ;
153
151
154
152
try
155
153
{
154
+ IDispatcherQueue * dispatcherQueuePtr = ( IDispatcherQueue * ) ( ( IWinRTObject ) dispatcherQueue ) . NativeObject . ThisPtr ;
155
+
156
156
hResult = dispatcherQueuePtr ->TryEnqueueWithPriority ( priority , dispatcherQueueHandler , ( byte * ) & success ) ;
157
157
158
158
GC . KeepAlive ( dispatcherQueue ) ;
Original file line number Diff line number Diff line change 6
6
using System . Runtime . CompilerServices ;
7
7
using System . Runtime . InteropServices ;
8
8
using System . Threading ;
9
+ using WinRT ;
9
10
using static CommunityToolkit . WinUI . Interop . Windows ;
10
11
11
12
#nullable enable
@@ -179,8 +180,11 @@ public static int Invoke(DispatcherQueueProxyHandler1* @this)
179
180
// need to make the proxy type itself generic, so without knowing the actual type argument.
180
181
Unsafe . As < DispatcherQueueHandler < object > > ( callback ) ( state ) ;
181
182
}
182
- catch
183
+ catch ( Exception e )
183
184
{
185
+ ExceptionHelpers . SetErrorInfo ( e ) ;
186
+
187
+ return ExceptionHelpers . GetHRForException ( e ) ;
184
188
}
185
189
186
190
return S_OK ;
Original file line number Diff line number Diff line change 6
6
using System . Runtime . CompilerServices ;
7
7
using System . Runtime . InteropServices ;
8
8
using System . Threading ;
9
+ using WinRT ;
9
10
using static CommunityToolkit . WinUI . Interop . Windows ;
10
11
11
12
#nullable enable
@@ -184,8 +185,11 @@ public static int Invoke(DispatcherQueueProxyHandler2* @this)
184
185
// Same optimization as in DispatcherQueueProxyHandler1
185
186
Unsafe . As < DispatcherQueueHandler < object , object > > ( callback ) ( state1 , state2 ) ;
186
187
}
187
- catch
188
+ catch ( Exception e )
188
189
{
190
+ ExceptionHelpers . SetErrorInfo ( e ) ;
191
+
192
+ return ExceptionHelpers . GetHRForException ( e ) ;
189
193
}
190
194
191
195
return S_OK ;
You can’t perform that action at this time.
0 commit comments