We are developing a custom visual and are facing some problems with supporting older versions of Power BI Desktop. Here is our scenario:
- we have updated the apiVersion of our custom visual to 1.9.0
- we package our visual and import it into an older version of Power BI Desktop (I think the one from August)
- we add the visual and select some fields that we wish to display
Our visual is just blank and nothing is displayed.
I have tried to debug this a bit, but didn't get very far. There is some information about the issue in the tracing logs - according to the timestamp this is probably the exception that happens (I removed certain IDs, not sure if they can be shared publicly):
DataMashup.Trace Critical: 24579 : {"Start":"2018-01-04T12:57:38.9880000Z","Action":"PBI.Visual.Exception","Message":"{\"visualType\":\"variance89B79F7D9229463CB8A551500FE7F5E3\",\"isCustom\":\"true\",\"apiVersion\":\"1.9.0\",\"instanceId\":\"INSTANCE_ID\",\"source\":\"\",\"lineNumber\":\"\",\"columnNumber\":\"\",\"stack\":\"TypeError: Cannot read property \\u0027hostAdapter\\u0027 of undefined\\n at VisualApiAdapter.init (ms-pbi://pbi.microsoft.com/minerva/scripts/visualhostcore.js:2189:97)\\n at ms-pbi://pbi.microsoft.com/minerva/scripts/visualhostcore.js:2406:48\\n at VisualSafeExecutionWrapper.executeSafely (ms-pbi://pbi.microsoft.com/minerva/scripts/visualhostcore.js:2486:28)\\n at VisualSafeExecutionWrapper.init (ms-pbi://pbi.microsoft.com/minerva/scripts/visualhostcore.js:2405:49)\\n at SandboxHost.init (ms-pbi://pbi.microsoft.com/minerva/scripts/visualsandbox.js:184:99)\\n at SandboxHost.executeMessage (ms-pbi://pbi.microsoft.com/minerva/scripts/visualsandbox.js:321:95)\\n at SandboxHost.onMessageReceived (ms-pbi://pbi.microsoft.com/minerva/scripts/visualsandbox.js:318:161)\\n at ms-pbi://pbi.microsoft.com/minerva/scripts/visualsandbox.js:166:34\\n at WindowMessageProxy.invokeHandler (ms-pbi://pbi.microsoft.com/minerva/scripts/visualhostcore.js:1884:38)\\n at WindowMessageProxy.dispatchMessage (ms-pbi://pbi.microsoft.com/minerva/scripts/visualhostcore.js:1874:26)\",\"message\":\"Cannot read property \\u0027hostAdapter\\u0027 of undefined\",\"sessionId\":\"SESSION_ID\",\"deviceId\":\"DEVICE_ID\",\"userId\":\"USER_ID\",\"isInternal\":\"False\",\"authenticatedUserId\":\"AUTHENTICATED_USER_ID\"}","ProductVersion":"2.49.4831.521 (PBIDesktop)","ActivityId":"ACTIVITY_ID","Process":"PBIDesktop","Pid":3524,"Tid":10,"Duration":"00:00:22.4797625"}
I guess some new properties were added in the newer version of the API and this version of the Desktop cannot handle them.
We would like to handle scenarios like these so that we can offer a better experience for our customers, so here are my questions:
1. Do you have any guidelines on how to support scenarios like these? Are the users just expected to always update to the newest version or should we have different versions of our visual for different Power BI Desktop version?
2. Is the problem with just including the new api or could we maybe conditionally run different parts of our code depending on the version of Power BI? Is there a way to get the version of the Power BI Desktop application? Can we at least somehow detect this situation and notify the user about it?
3. I guess the Power BI online is always on the latest version?
4. Is there any way at all to debug custom visuals for Power BI Desktop? (apart from returning debug information in the visual itself)