From 8e6b2a23876325cf49a7c742eeb04978d5870fc0 Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Mon, 17 Jun 2024 13:28:09 -0400 Subject: [PATCH] Dispose DbCommand in DbMetaDataFactory.ExecuteCommand A static analysis tool has flagged that DbCommand is an IDisposable, so it should be Disposed() to free up resources. --- .../Common/src/System/Data/ProviderBase/DbMetaDataFactory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Common/src/System/Data/ProviderBase/DbMetaDataFactory.cs b/src/libraries/Common/src/System/Data/ProviderBase/DbMetaDataFactory.cs index cc8547a4bd8d05..427ba7b445efaf 100644 --- a/src/libraries/Common/src/System/Data/ProviderBase/DbMetaDataFactory.cs +++ b/src/libraries/Common/src/System/Data/ProviderBase/DbMetaDataFactory.cs @@ -122,7 +122,7 @@ private DataTable ExecuteCommand(DataRow requestedCollectionRow, string?[]? rest throw ADP.TooManyRestrictions(collectionName); } - command = connection.CreateCommand(); + using command = connection.CreateCommand(); command.CommandText = sqlCommand; command.CommandTimeout = Math.Max(command.CommandTimeout, 180);