Repository: files-community/Files
File: src/Files.App/Utils/Cloud/Detector/GoogleDriveCloudDetector.cs (C#)

Code before:
				};
			}

#if DEBUG
			await Inspect(database, "SELECT * FROM roots", "root_preferences db, roots table");
			await Inspect(database, "SELECT * FROM media", "root_preferences db, media table");
			await Inspect(database, "SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY 1",
				"root_preferences db, all tables");
#endif

			await foreach (var provider in GetGoogleDriveProvidersFromRegistryAsync())
			{

#if DEBUG
				Debug.WriteLine("YIELD RETURNING from GoogleDriveCloudDetector#GetProviders (registry): ");
				Debug.WriteLine("name=" + provider.Name + "; path=" + provider.SyncFolder);
#endif

				yield return provider;
			}
		}

		private async Task Inspect(SqliteConnection database, string sqlCommand, string contentsOf)
		{
			await using var cmdTablesAll =
				new SqliteCommand(sqlCommand, database);
			var reader = await cmdTablesAll.ExecuteReaderAsync();
			var colNamesList = Enumerable.Range(0, reader.FieldCount).Select(j => reader.GetName(j)).ToList();
			var i = 0;
			Debug.WriteLine("BEGIN LOGGING of " + contentsOf + " contents");
			while (reader.Read())
			{
				var colVals = new object[reader.FieldCount];
				reader.GetValues(colVals);
				colVals.Select((val, j) => $"row {i}: column {j}: {colNamesList[j]}: {val}").ToList()
					.ForEach(s => Debug.WriteLine(s));
				i++;
			}
			Debug.WriteLine("END LOGGING of " + contentsOf + " contents");
		}

		private ILogger GetAltLogger(string filename)
		{
			var altLogPath = Path.Combine(ApplicationData.Current.LocalFolder.Path, filename);
			File.Delete(altLogPath);
			var factory = new LoggerFactory().AddFile(altLogPath);
			return factory.CreateLogger<App>();
		}

		private JsonDocument? GetGoogleDriveRegValJson()
        {

Review comment (suggestion):
```suggestion
			await using var cmdTablesAll = new SqliteCommand(sqlCommand, database);
```


Code after:
		private static async Task Inspect(SqliteConnection database, string sqlCommand, string targetDescription)
		{
			await using var cmdTablesAll = new SqliteCommand(sqlCommand, database);
			var reader = await cmdTablesAll.ExecuteReaderAsync();
			var colNamesList = Enumerable.Range(0, reader.FieldCount).Select(i => reader.GetName(i)).ToList();

			Debug.WriteLine($"BEGIN LOGGING of {targetDescription}");

			for (int rowIdx = 0; reader.Read() is not false; rowIdx++)
			{
				var colVals = new object[reader.FieldCount];
				reader.GetValues(colVals);

				colVals.Select((val, colIdx) => $"row {rowIdx}: column {colIdx}: {colNamesList[colIdx]}: {val}")
					.ToList().ForEach(s => Debug.WriteLine(s));
			}

			Debug.WriteLine($"END LOGGING of {targetDescription} contents");
		}

		private static JsonDocument? GetGoogleDriveRegValJson()
		{
			// This will be null if the key name is not found.
			using var googleDriveRegKey = Registry.CurrentUser.OpenSubKey(_googleDriveRegKeyName);

			if (googleDriveRegKey is null)
			{
				_logger.LogWarning($"Google Drive registry key for key name '{_googleDriveRegKeyName}' not found.");
				return null;
			}

			var googleDriveRegVal = googleDriveRegKey.GetValue(_googleDriveRegValName);

			if (googleDriveRegVal is null)
			{
				_logger.LogWarning($"Google Drive registry value for value name '{_googleDriveRegValName}' not found.");
				return null;
			}

			JsonDocument? googleDriveRegValueJson = null;
			try
			{
				googleDriveRegValueJson = JsonDocument.Parse(googleDriveRegVal.ToString() ?? "");
			}
			catch (JsonException je)
			{
				_logger.LogWarning(je, $"Google Drive registry value for value name '{_googleDriveRegValName}' could not be parsed as a JsonDocument.");
			}

			return googleDriveRegValueJson;
		}