Closed BADF00D closed 6 years ago
In addition to SerialPort, there are more classes where a call to Close can be recognized, as if it was a call to Dispose:
SqlConnection connection = null; SqlCommand command = null; SqlDataReader reader = null; try { connection = new SqlConnection(connectionString); await connection.OpenAsync(); command = connection.CreateCommand(); command.Connection = connection; command.CommandText = ""; command.CommandType = CommandType.Text; stopWatch.Start(); reader = await command.ExecuteReaderAsync(); // << warning!!! stopWatch.Stop(); LoggerHelper.LogStress("LoadCustomerInformations", "SELECT [Name]", stopWatch.Elapsed, ""); stopWatch.Restart(); while (await reader.ReadAsync()) { customerInformations.Add(new KeyValuePair<string, string>((string)reader["Name"], (string)reader["ConnectionString"])); } LoggerHelper.LogStress("LoadCustomerInformations", null, stopWatch.Elapsed, ""); } finally { reader?.Close(); connection?.Dispose(); command?.Dispose(); }
Will be part of next release (probably 1.0.1)
Cool! Thanks!
@xperiandri Just uploaded version 1.0.1. Should be available soon.
Prerequisites
Description
In addition to SerialPort, there are more classes where a call to Close can be recognized, as if it was a call to Dispose:
Source Code
Screenshot