From 874e0a8b6dd29b46f12065c1fae5971e4091c98f Mon Sep 17 00:00:00 2001 From: Alberto Spelta Date: Tue, 1 Sep 2026 15:54:18 +0200 Subject: [PATCH] Fix invalid catalog after `pbiazure://` to XMLA redirect AdomdConnectionWrapper previously called ChangeDatabase() using the internal catalog name format (sobe_wowvirtualserver-). Since AdomdClient 19.96.1, the Analyze-in-Excel to public XMLA redirect is no longer restricted to an application ID allow-list. As a result, opening a cloud dataset connection now transparently redirects from pbiazure:// to powerbi:// and updates the catalog to the dataset's display name. The subsequent explicit call to ChangeDatabase() sent the outdated catalog name to the XMLA endpoint, causing it to reject the connection as a non-existent database. ChangeDatabase() was redundant in both wrappers, as the catalog is already specified by the Initial Catalog connection string property. This call has been removed, and the effective catalog is now read directly from Connection.Database when needed. --- src/Infrastructure/Services/ConnectionWrapper.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Infrastructure/Services/ConnectionWrapper.cs b/src/Infrastructure/Services/ConnectionWrapper.cs index 8e23d692..f208afba 100644 --- a/src/Infrastructure/Services/ConnectionWrapper.cs +++ b/src/Infrastructure/Services/ConnectionWrapper.cs @@ -53,7 +53,6 @@ public AdomdConnection CreateAdomdConnection(bool open = true) if (open) { connection.Open(); - connection.ChangeDatabase(Database.Name); } return connection; @@ -88,11 +87,10 @@ public static TabularConnectionWrapper ConnectTo(PBIDesktopReport report) internal class AdomdConnectionWrapper : IDisposable { - private AdomdConnectionWrapper(string connectionString, string databaseName) + private AdomdConnectionWrapper(string connectionString) { Connection = new AdomdConnection(connectionString); ProcessHelper.RunOnUISynchronizationContext(() => Connection.Open()); - Connection.ChangeDatabase(databaseName); IsServerVersion13OrGreater = Version.TryParse(Connection.ServerVersion, out var version) && version >= new Version(13, 0); } @@ -134,20 +132,16 @@ public void Dispose() public static AdomdConnectionWrapper ConnectTo(PBICloudDataset dataset, string accessToken) { - BravoUnexpectedException.ThrowIfNull(dataset.ExternalDatabaseName); - var connectionString = ConnectionStringHelper.BuildFor(dataset, accessToken); - var connection = new AdomdConnectionWrapper(connectionString, dataset.ExternalDatabaseName); + var connection = new AdomdConnectionWrapper(connectionString); return connection; } public static AdomdConnectionWrapper ConnectTo(PBIDesktopReport report) { - BravoUnexpectedException.ThrowIfNull(report.DatabaseName); - var connectionString = ConnectionStringHelper.BuildFor(report); - var connection = new AdomdConnectionWrapper(connectionString, report.DatabaseName); + var connection = new AdomdConnectionWrapper(connectionString); return connection; }