@@ -201,6 +201,47 @@ public static T ThrowArgumentOutOfRangeException<T>(string name, object value, s
201201 }
202202
203203#if ! NETSTANDARD1_4
204+ /// <summary>
205+ /// Throws a new <see cref="COMException"/>.
206+ /// </summary>
207+ /// <typeparam name="T">The type of expected result.</typeparam>
208+ /// <param name="message">The message to include in the exception.</param>
209+ /// <exception cref="COMException">Thrown with the specified parameter.</exception>
210+ /// <returns>This method always throws, so it actually never returns a value.</returns>
211+ [ DoesNotReturn ]
212+ public static T ThrowCOMException < T > ( string message )
213+ {
214+ throw new COMException ( message ) ;
215+ }
216+
217+ /// <summary>
218+ /// Throws a new <see cref="COMException"/>.
219+ /// </summary>
220+ /// <typeparam name="T">The type of expected result.</typeparam>
221+ /// <param name="message">The argument name.</param>
222+ /// <param name="innerException">The inner <see cref="Exception"/> to include.</param>
223+ /// <exception cref="COMException">Thrown with the specified parameters.</exception>
224+ /// <returns>This method always throws, so it actually never returns a value.</returns>
225+ [ DoesNotReturn ]
226+ public static T ThrowCOMException < T > ( string message , Exception innerException )
227+ {
228+ throw new COMException ( message , innerException ) ;
229+ }
230+
231+ /// <summary>
232+ /// Throws a new <see cref="COMException"/>.
233+ /// </summary>
234+ /// <typeparam name="T">The type of expected result.</typeparam>
235+ /// <param name="message">The argument name.</param>
236+ /// <param name="error">The HRESULT of the errror to include.</param>
237+ /// <exception cref="COMException">Thrown with the specified parameters.</exception>
238+ /// <returns>This method always throws, so it actually never returns a value.</returns>
239+ [ DoesNotReturn ]
240+ public static T ThrowCOMException < T > ( string message , int error )
241+ {
242+ throw new COMException ( message , error ) ;
243+ }
244+
204245 /// <summary>
205246 /// Throws a new <see cref="ExternalException"/>.
206247 /// </summary>
0 commit comments