From 3dfa4756ac142723fdb718625f8dc7bd6b771a02 Mon Sep 17 00:00:00 2001 From: Martin Kuschnik Date: Thu, 1 Jan 2026 17:55:32 +0100 Subject: [PATCH 01/10] Introduce InvalidMethodParametersException to handle cases where invalid parameters are provided to WMI methods. --- .../InvalidMethodParametersException.cs | 29 +++++++++++++++++++ WmiLight/Wbem/WbemServices.cs | 11 ++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 WmiLight/Exceptions/InvalidMethodParametersException.cs diff --git a/WmiLight/Exceptions/InvalidMethodParametersException.cs b/WmiLight/Exceptions/InvalidMethodParametersException.cs new file mode 100644 index 0000000..26f90bb --- /dev/null +++ b/WmiLight/Exceptions/InvalidMethodParametersException.cs @@ -0,0 +1,29 @@ +using WmiLight.Wbem; + +namespace WmiLight +{ + #region Description + /// + /// The exception that is thrown when the provided parameters for a WMI method are not valid . + /// + #endregion + public sealed class InvalidMethodParametersException : WmiException + { + #region Constructors + + #region Description + /// + /// Initializes a new instance of the class. + /// + /// The method name. + /// The HRESULT. + #endregion + internal InvalidMethodParametersException(string method, WbemStatus hresult) + : base($"Parameters provided for the method '{method}' are not valid.") + { + this.HResult = (int)hresult; + } + + #endregion + } +} diff --git a/WmiLight/Wbem/WbemServices.cs b/WmiLight/Wbem/WbemServices.cs index b039ff0..0d2d90e 100644 --- a/WmiLight/Wbem/WbemServices.cs +++ b/WmiLight/Wbem/WbemServices.cs @@ -157,7 +157,16 @@ internal void ExecuteMethod(string classNameOrPath, string methodName, IntPtr in HResult hResult = NativeMethods.ExecMethod(this, classNameOrPath, methodName, IntPtr.Zero, inParams, out IntPtr pOutParams); if (hResult.Failed) - throw (Exception)hResult; + { + switch (hResult) + { + case (int)WbemStatus.WBEM_E_INVALID_METHOD_PARAMETERS: + throw new InvalidMethodParametersException(methodName, WbemStatus.WBEM_E_INVALID_METHOD_PARAMETERS); + + default: + throw (Exception)hResult; + } + } if (pOutParams != IntPtr.Zero) outParams = new WbemClassObject(pOutParams); From 889d54e2bdeddf9e218362a2d641175086345058 Mon Sep 17 00:00:00 2001 From: Martin Kuschnik Date: Thu, 1 Jan 2026 18:05:00 +0100 Subject: [PATCH 02/10] Add InvalidParameterException to the XML comments of all relevant ExecuteMethod overloads in WmiConnection.cs to clarify that these methods may throw this exception when WMI method parameters are invalid. --- WmiLight/WmiConnection.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/WmiLight/WmiConnection.cs b/WmiLight/WmiConnection.cs index d5fb131..8ec3655 100644 --- a/WmiLight/WmiConnection.cs +++ b/WmiLight/WmiConnection.cs @@ -428,6 +428,7 @@ public void DeleteInstance(WmiObject instance) /// The value returned by the method. /// The parameter is null. /// Object already disposed. + /// The WMI method parameters are invalid. #endregion public object ExecuteMethod(WmiMethod method, out WmiMethodParameters outParameters) { @@ -446,6 +447,7 @@ public object ExecuteMethod(WmiMethod method, out WmiMethodParameters outParamet /// The value returned by the method. /// The parameter is null. /// Object already disposed. + /// The WMI method parameters are invalid. #endregion public TResult ExecuteMethod(WmiMethod method, out WmiMethodParameters outParameters) { @@ -465,6 +467,7 @@ public TResult ExecuteMethod(WmiMethod method, out WmiMethodParameters /// The value returned by the method. /// The parameter is null. /// Object already disposed. + /// The WMI method parameters are invalid. #endregion public object ExecuteMethod(WmiMethod method, WmiMethodParameters inParameters, out WmiMethodParameters outParameters) { @@ -484,6 +487,7 @@ public object ExecuteMethod(WmiMethod method, WmiMethodParameters inParameters, /// The value returned by the method. /// The parameter is null. /// Object already disposed. + /// The WMI method parameters are invalid. #endregion public TResult ExecuteMethod(WmiMethod method, WmiMethodParameters inParameters, out WmiMethodParameters outParameters) { @@ -503,6 +507,7 @@ public TResult ExecuteMethod(WmiMethod method, WmiMethodParameters inPa /// The value returned by the method. /// The parameter is null. /// Object already disposed. + /// The WMI method parameters are invalid. #endregion public object ExecuteMethod(WmiMethod method, WmiObject instance, out WmiMethodParameters outParameters) { @@ -522,6 +527,7 @@ public object ExecuteMethod(WmiMethod method, WmiObject instance, out WmiMethodP /// The value returned by the method. /// The parameter is null. /// Object already disposed. + /// The WMI method parameters are invalid. #endregion public TResult ExecuteMethod(WmiMethod method, WmiObject instance, out WmiMethodParameters outParameters) { @@ -542,6 +548,7 @@ public TResult ExecuteMethod(WmiMethod method, WmiObject instance, out /// The value returned by the method. /// The parameter is null. /// Object already disposed. + /// The WMI method parameters are invalid. #endregion public object ExecuteMethod(WmiMethod method, WmiObject instance, WmiMethodParameters inParameters, out WmiMethodParameters outParameters) { @@ -562,6 +569,7 @@ public object ExecuteMethod(WmiMethod method, WmiObject instance, WmiMethodParam /// The value returned by the method. /// The parameter is null. /// Object already disposed. + /// The WMI method parameters are invalid. #endregion public TResult ExecuteMethod(WmiMethod method, WmiObject instance, WmiMethodParameters inParameters, out WmiMethodParameters outParameters) { From 57348833524c69279634d4a6bd0eb52657561dbd Mon Sep 17 00:00:00 2001 From: Martin Kuschnik Date: Thu, 1 Jan 2026 18:12:07 +0100 Subject: [PATCH 03/10] Update XML docs to use InvalidMethodParametersException --- WmiLight/WmiConnection.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/WmiLight/WmiConnection.cs b/WmiLight/WmiConnection.cs index 8ec3655..66678c9 100644 --- a/WmiLight/WmiConnection.cs +++ b/WmiLight/WmiConnection.cs @@ -428,7 +428,7 @@ public void DeleteInstance(WmiObject instance) /// The value returned by the method. /// The parameter is null. /// Object already disposed. - /// The WMI method parameters are invalid. + /// The WMI method parameters are invalid. #endregion public object ExecuteMethod(WmiMethod method, out WmiMethodParameters outParameters) { @@ -447,7 +447,7 @@ public object ExecuteMethod(WmiMethod method, out WmiMethodParameters outParamet /// The value returned by the method. /// The parameter is null. /// Object already disposed. - /// The WMI method parameters are invalid. + /// The WMI method parameters are invalid. #endregion public TResult ExecuteMethod(WmiMethod method, out WmiMethodParameters outParameters) { @@ -467,7 +467,7 @@ public TResult ExecuteMethod(WmiMethod method, out WmiMethodParameters /// The value returned by the method. /// The parameter is null. /// Object already disposed. - /// The WMI method parameters are invalid. + /// The WMI method parameters are invalid. #endregion public object ExecuteMethod(WmiMethod method, WmiMethodParameters inParameters, out WmiMethodParameters outParameters) { @@ -487,7 +487,7 @@ public object ExecuteMethod(WmiMethod method, WmiMethodParameters inParameters, /// The value returned by the method. /// The parameter is null. /// Object already disposed. - /// The WMI method parameters are invalid. + /// The WMI method parameters are invalid. #endregion public TResult ExecuteMethod(WmiMethod method, WmiMethodParameters inParameters, out WmiMethodParameters outParameters) { @@ -507,7 +507,7 @@ public TResult ExecuteMethod(WmiMethod method, WmiMethodParameters inPa /// The value returned by the method. /// The parameter is null. /// Object already disposed. - /// The WMI method parameters are invalid. + /// The WMI method parameters are invalid. #endregion public object ExecuteMethod(WmiMethod method, WmiObject instance, out WmiMethodParameters outParameters) { @@ -527,7 +527,7 @@ public object ExecuteMethod(WmiMethod method, WmiObject instance, out WmiMethodP /// The value returned by the method. /// The parameter is null. /// Object already disposed. - /// The WMI method parameters are invalid. + /// The WMI method parameters are invalid. #endregion public TResult ExecuteMethod(WmiMethod method, WmiObject instance, out WmiMethodParameters outParameters) { @@ -548,7 +548,7 @@ public TResult ExecuteMethod(WmiMethod method, WmiObject instance, out /// The value returned by the method. /// The parameter is null. /// Object already disposed. - /// The WMI method parameters are invalid. + /// The WMI method parameters are invalid. #endregion public object ExecuteMethod(WmiMethod method, WmiObject instance, WmiMethodParameters inParameters, out WmiMethodParameters outParameters) { @@ -569,7 +569,7 @@ public object ExecuteMethod(WmiMethod method, WmiObject instance, WmiMethodParam /// The value returned by the method. /// The parameter is null. /// Object already disposed. - /// The WMI method parameters are invalid. + /// The WMI method parameters are invalid. #endregion public TResult ExecuteMethod(WmiMethod method, WmiObject instance, WmiMethodParameters inParameters, out WmiMethodParameters outParameters) { From cab12f5f74adceb3434ef6fdb3611bf2636e831a Mon Sep 17 00:00:00 2001 From: Martin Kuschnik Date: Thu, 1 Jan 2026 18:13:16 +0100 Subject: [PATCH 04/10] Fix typo in XML doc comment in InvalidMethodParametersException --- WmiLight/Exceptions/InvalidMethodParametersException.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WmiLight/Exceptions/InvalidMethodParametersException.cs b/WmiLight/Exceptions/InvalidMethodParametersException.cs index 26f90bb..1a35186 100644 --- a/WmiLight/Exceptions/InvalidMethodParametersException.cs +++ b/WmiLight/Exceptions/InvalidMethodParametersException.cs @@ -4,7 +4,7 @@ namespace WmiLight { #region Description /// - /// The exception that is thrown when the provided parameters for a WMI method are not valid . + /// The exception that is thrown when the provided parameters for a WMI method are not valid. /// #endregion public sealed class InvalidMethodParametersException : WmiException From d08ea6817d734d3d4fd48c74e3536355e82696a1 Mon Sep 17 00:00:00 2001 From: Martin Kuschnik Date: Thu, 1 Jan 2026 18:16:25 +0100 Subject: [PATCH 05/10] The InvalidMethodParametersException now takes both method and class names, and its message includes both for improved context. --- WmiLight/Exceptions/InvalidMethodParametersException.cs | 7 ++++--- WmiLight/Wbem/WbemServices.cs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/WmiLight/Exceptions/InvalidMethodParametersException.cs b/WmiLight/Exceptions/InvalidMethodParametersException.cs index 1a35186..b66d364 100644 --- a/WmiLight/Exceptions/InvalidMethodParametersException.cs +++ b/WmiLight/Exceptions/InvalidMethodParametersException.cs @@ -15,11 +15,12 @@ public sealed class InvalidMethodParametersException : WmiException /// /// Initializes a new instance of the class. /// - /// The method name. + /// The method name. + /// The class name. /// The HRESULT. #endregion - internal InvalidMethodParametersException(string method, WbemStatus hresult) - : base($"Parameters provided for the method '{method}' are not valid.") + internal InvalidMethodParametersException(string methodName, string className, WbemStatus hresult) + : base($"Parameters provided for the method {methodName} ({className}) are not valid.") { this.HResult = (int)hresult; } diff --git a/WmiLight/Wbem/WbemServices.cs b/WmiLight/Wbem/WbemServices.cs index 0d2d90e..65e715d 100644 --- a/WmiLight/Wbem/WbemServices.cs +++ b/WmiLight/Wbem/WbemServices.cs @@ -161,7 +161,7 @@ internal void ExecuteMethod(string classNameOrPath, string methodName, IntPtr in switch (hResult) { case (int)WbemStatus.WBEM_E_INVALID_METHOD_PARAMETERS: - throw new InvalidMethodParametersException(methodName, WbemStatus.WBEM_E_INVALID_METHOD_PARAMETERS); + throw new InvalidMethodParametersException(methodName, classNameOrPath, WbemStatus.WBEM_E_INVALID_METHOD_PARAMETERS); default: throw (Exception)hResult; From acf5286babc501de3adf7da01c5679995b50d404 Mon Sep 17 00:00:00 2001 From: Martin Kuschnik Date: Thu, 1 Jan 2026 18:31:19 +0100 Subject: [PATCH 06/10] Removed the InvalidMethodParametersException class and replaced all its usages with InvalidParameterException. --- .../InvalidMethodParametersException.cs | 30 ------------------- .../Exceptions/InvalidParameterException.cs | 18 ++++++++++- WmiLight/Wbem/WbemServices.cs | 5 +++- WmiLight/WmiConnection.cs | 16 +++++----- 4 files changed, 29 insertions(+), 40 deletions(-) delete mode 100644 WmiLight/Exceptions/InvalidMethodParametersException.cs diff --git a/WmiLight/Exceptions/InvalidMethodParametersException.cs b/WmiLight/Exceptions/InvalidMethodParametersException.cs deleted file mode 100644 index b66d364..0000000 --- a/WmiLight/Exceptions/InvalidMethodParametersException.cs +++ /dev/null @@ -1,30 +0,0 @@ -using WmiLight.Wbem; - -namespace WmiLight -{ - #region Description - /// - /// The exception that is thrown when the provided parameters for a WMI method are not valid. - /// - #endregion - public sealed class InvalidMethodParametersException : WmiException - { - #region Constructors - - #region Description - /// - /// Initializes a new instance of the class. - /// - /// The method name. - /// The class name. - /// The HRESULT. - #endregion - internal InvalidMethodParametersException(string methodName, string className, WbemStatus hresult) - : base($"Parameters provided for the method {methodName} ({className}) are not valid.") - { - this.HResult = (int)hresult; - } - - #endregion - } -} diff --git a/WmiLight/Exceptions/InvalidParameterException.cs b/WmiLight/Exceptions/InvalidParameterException.cs index 05086e8..ecafc9d 100644 --- a/WmiLight/Exceptions/InvalidParameterException.cs +++ b/WmiLight/Exceptions/InvalidParameterException.cs @@ -1,4 +1,6 @@ -namespace WmiLight +using WmiLight.Wbem; + +namespace WmiLight { #region Description /// @@ -20,6 +22,20 @@ internal InvalidParameterException(HResultInfo hresultInfo) { } + #region Description + /// + /// Initializes a new instance of the class. + /// + /// The method name. + /// The class name. + /// The HRESULT. + #endregion + internal InvalidParameterException(string methodName, string className, WbemStatus hresult) + : base($"Parameters provided for the method {methodName} ({className}) are not valid.") + { + this.HResult = (int)hresult; + } + #endregion } } diff --git a/WmiLight/Wbem/WbemServices.cs b/WmiLight/Wbem/WbemServices.cs index 65e715d..7d3670b 100644 --- a/WmiLight/Wbem/WbemServices.cs +++ b/WmiLight/Wbem/WbemServices.cs @@ -161,7 +161,10 @@ internal void ExecuteMethod(string classNameOrPath, string methodName, IntPtr in switch (hResult) { case (int)WbemStatus.WBEM_E_INVALID_METHOD_PARAMETERS: - throw new InvalidMethodParametersException(methodName, classNameOrPath, WbemStatus.WBEM_E_INVALID_METHOD_PARAMETERS); + throw new InvalidParameterException(methodName, classNameOrPath, WbemStatus.WBEM_E_INVALID_METHOD_PARAMETERS); + + case (int)WbemStatus.WBEM_E_INVALID_PARAMETER: + throw new InvalidParameterException(methodName, classNameOrPath, WbemStatus.WBEM_E_INVALID_METHOD_PARAMETERS); default: throw (Exception)hResult; diff --git a/WmiLight/WmiConnection.cs b/WmiLight/WmiConnection.cs index 66678c9..8ec3655 100644 --- a/WmiLight/WmiConnection.cs +++ b/WmiLight/WmiConnection.cs @@ -428,7 +428,7 @@ public void DeleteInstance(WmiObject instance) /// The value returned by the method. /// The parameter is null. /// Object already disposed. - /// The WMI method parameters are invalid. + /// The WMI method parameters are invalid. #endregion public object ExecuteMethod(WmiMethod method, out WmiMethodParameters outParameters) { @@ -447,7 +447,7 @@ public object ExecuteMethod(WmiMethod method, out WmiMethodParameters outParamet /// The value returned by the method. /// The parameter is null. /// Object already disposed. - /// The WMI method parameters are invalid. + /// The WMI method parameters are invalid. #endregion public TResult ExecuteMethod(WmiMethod method, out WmiMethodParameters outParameters) { @@ -467,7 +467,7 @@ public TResult ExecuteMethod(WmiMethod method, out WmiMethodParameters /// The value returned by the method. /// The parameter is null. /// Object already disposed. - /// The WMI method parameters are invalid. + /// The WMI method parameters are invalid. #endregion public object ExecuteMethod(WmiMethod method, WmiMethodParameters inParameters, out WmiMethodParameters outParameters) { @@ -487,7 +487,7 @@ public object ExecuteMethod(WmiMethod method, WmiMethodParameters inParameters, /// The value returned by the method. /// The parameter is null. /// Object already disposed. - /// The WMI method parameters are invalid. + /// The WMI method parameters are invalid. #endregion public TResult ExecuteMethod(WmiMethod method, WmiMethodParameters inParameters, out WmiMethodParameters outParameters) { @@ -507,7 +507,7 @@ public TResult ExecuteMethod(WmiMethod method, WmiMethodParameters inPa /// The value returned by the method. /// The parameter is null. /// Object already disposed. - /// The WMI method parameters are invalid. + /// The WMI method parameters are invalid. #endregion public object ExecuteMethod(WmiMethod method, WmiObject instance, out WmiMethodParameters outParameters) { @@ -527,7 +527,7 @@ public object ExecuteMethod(WmiMethod method, WmiObject instance, out WmiMethodP /// The value returned by the method. /// The parameter is null. /// Object already disposed. - /// The WMI method parameters are invalid. + /// The WMI method parameters are invalid. #endregion public TResult ExecuteMethod(WmiMethod method, WmiObject instance, out WmiMethodParameters outParameters) { @@ -548,7 +548,7 @@ public TResult ExecuteMethod(WmiMethod method, WmiObject instance, out /// The value returned by the method. /// The parameter is null. /// Object already disposed. - /// The WMI method parameters are invalid. + /// The WMI method parameters are invalid. #endregion public object ExecuteMethod(WmiMethod method, WmiObject instance, WmiMethodParameters inParameters, out WmiMethodParameters outParameters) { @@ -569,7 +569,7 @@ public object ExecuteMethod(WmiMethod method, WmiObject instance, WmiMethodParam /// The value returned by the method. /// The parameter is null. /// Object already disposed. - /// The WMI method parameters are invalid. + /// The WMI method parameters are invalid. #endregion public TResult ExecuteMethod(WmiMethod method, WmiObject instance, WmiMethodParameters inParameters, out WmiMethodParameters outParameters) { From 33b7562ee0800125a17f52132785e2d586e7cb4f Mon Sep 17 00:00:00 2001 From: Martin Kuschnik Date: Thu, 1 Jan 2026 18:36:05 +0100 Subject: [PATCH 07/10] Update assertion messages in ExceptionTests unit tests --- WmiLight.UnitTests/ExceptionTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WmiLight.UnitTests/ExceptionTests.cs b/WmiLight.UnitTests/ExceptionTests.cs index 22362d9..1fc6b85 100644 --- a/WmiLight.UnitTests/ExceptionTests.cs +++ b/WmiLight.UnitTests/ExceptionTests.cs @@ -32,7 +32,7 @@ public void InvalidClassException_Is_Thrown() { foreach (WmiObject _ in connection.CreateQuery("SELECT * FROM INVALID_CLASS_123")) { - Assert.Fail("Should not reach here due to timeout."); + Assert.Fail("Should not reach here."); } } }); @@ -47,7 +47,7 @@ public void InvalidQueryException_Is_Thrown_Without_A_Query() { foreach (WmiObject _ in connection.CreateQuery("THIS IS NOT VALID")) { - Assert.Fail("Should not reach here due to timeout."); + Assert.Fail("Should not reach here."); } } }); @@ -64,7 +64,7 @@ public void InvalidQueryException_Is_Thrown_Witt_A_Query() { foreach (WmiObject _ in connection.CreateQuery("THIS IS NOT VALID", EnumeratorBehaviorOption.DirectRead)) { - Assert.Fail("Should not reach here due to timeout."); + Assert.Fail("Should not reach here."); } } }); From f2d40106c7ca6a8ec12cb01d02ddc108e22308cf Mon Sep 17 00:00:00 2001 From: Martin Kuschnik Date: Thu, 1 Jan 2026 18:36:21 +0100 Subject: [PATCH 08/10] Add tests for InvalidParameterException on WMI method calls --- WmiLight.UnitTests/ExceptionTests.cs | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/WmiLight.UnitTests/ExceptionTests.cs b/WmiLight.UnitTests/ExceptionTests.cs index 1fc6b85..12fb553 100644 --- a/WmiLight.UnitTests/ExceptionTests.cs +++ b/WmiLight.UnitTests/ExceptionTests.cs @@ -72,5 +72,37 @@ public void InvalidQueryException_Is_Thrown_Witt_A_Query() // DirectRead -> Query not set Assert.AreEqual("THIS IS NOT VALID", ex.Query, "Query is different."); } + + [TestMethod] + public void InvalidParameterException_Is_Thrown_For_WBEM_E_INVALID_METHOD_PARAMETERS() + { + Assert.ThrowsException(() => { + + using (WmiConnection connection = new WmiConnection(@"root\Microsoft\Windows\Storage")) + using (WmiMethod method = connection.GetMethod("MSFT_Volume", "GetSupportedFileSystems")) + { + // Don't set required parameters and try to execute + connection.ExecuteMethod(method, null, out WmiMethodParameters outParameters); + + Assert.Fail("Should not reach here."); + } + }); + } + + [TestMethod] + public void InvalidParameterException_Is_Thrown_For_WBEM_E_INVALID_PARAMETER() + { + InvalidParameterException ex = Assert.ThrowsException(() => + { + using (WmiConnection connection = new WmiConnection()) + using (WmiMethod method = connection.GetMethod("Win32_Process", "Create")) + { + // Don't set required parameters and try to execute + connection.ExecuteMethod(method, null, out WmiMethodParameters outParameters); + + Assert.Fail("Should not reach here."); + } + }); + } } } From b396ef93eae4cbaeb40e0a9b762688e525fbd6b7 Mon Sep 17 00:00:00 2001 From: Martin Kuschnik Date: Thu, 1 Jan 2026 18:37:08 +0100 Subject: [PATCH 09/10] Fix incorrect status in InvalidParameterException --- WmiLight/Wbem/WbemServices.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WmiLight/Wbem/WbemServices.cs b/WmiLight/Wbem/WbemServices.cs index 7d3670b..9c152ff 100644 --- a/WmiLight/Wbem/WbemServices.cs +++ b/WmiLight/Wbem/WbemServices.cs @@ -164,7 +164,7 @@ internal void ExecuteMethod(string classNameOrPath, string methodName, IntPtr in throw new InvalidParameterException(methodName, classNameOrPath, WbemStatus.WBEM_E_INVALID_METHOD_PARAMETERS); case (int)WbemStatus.WBEM_E_INVALID_PARAMETER: - throw new InvalidParameterException(methodName, classNameOrPath, WbemStatus.WBEM_E_INVALID_METHOD_PARAMETERS); + throw new InvalidParameterException(methodName, classNameOrPath, WbemStatus.WBEM_E_INVALID_PARAMETER); default: throw (Exception)hResult; From a5a2fd6abb6c425e8ac56f2b5a4b96c2d028b34f Mon Sep 17 00:00:00 2001 From: Martin Kuschnik Date: Thu, 1 Jan 2026 19:08:59 +0100 Subject: [PATCH 10/10] remove unused variable in exception test --- WmiLight.UnitTests/ExceptionTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WmiLight.UnitTests/ExceptionTests.cs b/WmiLight.UnitTests/ExceptionTests.cs index 12fb553..cd8a44c 100644 --- a/WmiLight.UnitTests/ExceptionTests.cs +++ b/WmiLight.UnitTests/ExceptionTests.cs @@ -92,7 +92,7 @@ public void InvalidParameterException_Is_Thrown_For_WBEM_E_INVALID_METHOD_PARAME [TestMethod] public void InvalidParameterException_Is_Thrown_For_WBEM_E_INVALID_PARAMETER() { - InvalidParameterException ex = Assert.ThrowsException(() => + Assert.ThrowsException(() => { using (WmiConnection connection = new WmiConnection()) using (WmiMethod method = connection.GetMethod("Win32_Process", "Create"))