Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
lukaszp
Power BI Team
Power BI Team

Custom Visuals Sandbox is coming - Here's what you need to know

Custom visual authors and users - we'd like you help to find the last bugs in a new feature for custom visuals - sandboxing.  We've seen a lot of great visuals be created by our community, and we've seen how some of those visual interact with each other, with our own UI elements, and with our APIs.  This has led to some glitches for users and visual authors. So we're planning to add sandboxing.  Sandboxing will be enabled in the service on or after March 22nd 2016.  

 

Asks and Acitons for custom visuals users/developers 

  1. Test your visuals using the steps shown below
  2. Review the list of Known Issues.
  3. Reply to this post with issues you find so we can investigate them.

 

 

What is sandboxing for custom visuals

Sandboxing provides a layer of isolation for each custom visual by hosting it in a dedicated iFrame.  Your code and dependencies are injected dynamically into the iFrame.  It ensures you don’t have conflicts with other visuals/elements on your page and removes access to APIs that you shouldn’t be using in your custom visuals.

 

When will Sandboxing be enabled for custom visuals?

We expect it to enabled sandboxing on or around March 22nd 2016. We’ll adjust this based on your feedback and reported issues.

 

What is the impact on my custom visual?

Sandboxing runs your visual’s code in a low privilege iFrame with no domain.  You will not be able to assume access to Power BI styles (CSS), Power BI fonts, or undocumented Power BI APIs.  We will inject all the required interfaces into the iFrame including your visual’s code.  Then we will marshal data points and required settings across the iFrame boundary.  Since the iFrame has no domain, you will not have access to cookies or local storage. Lastly, how you debug your custom visual will change a little, which I’ll cover below.

Here’s an example iFrame that your visual would be loaded into:

<iframe class="visual-sandbox" src="/sandbox?plugin= MyVisualName" style="width: 1177px; height: 682.04px;" sandbox="allow-scripts"></iframe>

 

How can I test my visual in the Sandbox?

Starting now you can test your visuals, dashboards, and reports in the sandbox by adding the following flag to the URL in the address bar.

Follow these steps:

  • Sign-in to your Power BI account
  • Paste the following URL into your browser address bar

https://app.powerbi.com/?sandboxVisualsEnabled=1

 

  • Press enter to navigate to the URL above
  • You know the feature switch successfully applied if after the browser loads the flag is in the URL. For example:

https://app.powerbi.com/groups/me/dashboards/5f3627e4-a662-4111-a5ea-39ef2833fe24?sandboxVisualsEnab...

 

  • Please note that if you needed to sign-in in step #2, the feature switch will not be applied. You can click the URL again, or just paste ?sandboxVisualsEnabled=1 on the URL and refresh.

 

How do I debug in the sandbox?

To debug, the easiest way is to add the following line of code to your visual’s init method or wherever you’d like a breakpoint for the browser’s debugger.

 

debugger;

 

Then, when you’d like to debug your visual, launch the browser’s debugger, add your visual to the page and bind some data to it.  The debugger will automatically break when init is called by Power BI allowing you to see your code.  Without this, you may find it hard to identify where the code is located in the browser’s debugger since it is dynamically injected into the iFrame.

 

A note about unhandled exceptions

One thing that is important for you to add to your visuals is some hardening for unhandled exceptions. To keep the iframe and the host page in sync, we run synchronization code in the iFrame alongside your visual’s code.  If your visual throws an unhandled exception, we attempt to catch it so our synchronization code keeps working. Even then, your code might not work in the resulting state. We’ve found that some custom visuals have unpredictable behaviors after they throw an unhandled exception. Unfortunately, since it’s your code we’re not able to fix those issues on our side. The most common symptom of this is the visual stops resizing correctly when the user resizes the visual in Power BI.  If you see this happening, check if the custom visual is throwing exceptions and resolve those before submitting an issue.

 

Known issues

Here's a list of known bugs we're tracking:

1) Sometimes the visual does not resize in the iFrame.  Usually this is due to an unhandled exception in the visual, but sometmies it's the framework. We're working on a fix. Your code should trap it's exceptions to avoid one of the major causes.

2) Fonts and CSS styles.  Some visuals depend on Fonts and CSS from Power BI.  Not all styles are available within the sandbox.  You will not have access to Power BI's fonts in the iFrame.  Please adjust the code of your visual to use specific and predictable Fonts and CSS.

2) iFrame within custom visuals are blocked.  This is feature is due to the sandbox security policies we set.  You should updated your code not to use an iFrame.

3) Performance for loading custom visuals.  The is an impact due to the sandbox for how fast cusotm visuals load. We are working on fixes to make this better and some features to make it better still. 

79 REPLIES 79

Hi jdrake,

 

The getViewMode method fix has been implemented and will make it to production soon.

 

Thank you for reporting this,

Bashir

----------------------------------
Microsoft Employee on PowerBi Platform Team

@bashirs Thanks! When the fix gets deployed to production will there be an announcement?

We typically do not do a blog post or anything like that for fixes but if you want I can try to send you a message on the forums when it reaches production. I will let a reminder on my calendar.

----------------------------------
Microsoft Employee on PowerBi Platform Team

@bashirs I just tried adding ?sandboxVisualsEnabled=0 and ?sandboxVisualsEnabled=false to the url and refreshing but my visualization is still in a sandboxed iframe. 

 

Also, I had click handlers inside my visualization that are now not working. They work fine in the power bi dev tools...

It looks like there is a mismatch in the feature flags when we changed the name from "sandboxVisualsDisabled" to "sandboxVisualsEnabled". The name change is already in the pipeline but isn't all the way through yet. For now it works if you specify both flag names:

 

?sandboxVisualsEnabled=false&sandboxVisualsDisabled=true

 

I am sorry for the confusion. Soon this will no longer be necessary.

 

Take care,

Bashir

----------------------------------
Microsoft Employee on PowerBi Platform Team

@bashirs, I provided more details of my problem as requested yesterday.  Have you have a chance to have look?

 

What would be great would be an example of how to change a visual that does not work.  I believe that the visuals from the gallery are not being sandboxed?  Would it be possible to show us an example of how to fix one of these if they were being sandboxed?  For example, if the linear gauge was sandboxed, would it still work?  If not, how would it be fixed.

 

 

Hi Cmn,

 

I need more time to look into your issue with mobile applications. I probably wont be able to get through it tonight. I hope to have something to report early in the work week.

 

Yes, the visuals in the gallery are not sandboxed because they have been verified to be safe for end users. That being said, most visuals work properly in sandbox with no changes. Anything that does not work is considered either (A) a bug in sandbox (which we want to fix) or (B) use of an unsupported PowerBi API unexpected to be used for custom visuals (we want to expose these in a better way) or (C) a security vulnerability (these need to be prevented).

 

Custom visuals is a preview feature and people are using it in ways we could not have ever imgined which is great! But we need to continue to invest to make sure that all (A) and (B) scenarios are supported in a way that will never break long term ever.

----------------------------------
Microsoft Employee on PowerBi Platform Team

Hi @bashirs, any update for me?

Hi cmn,

 

Yes, I was actually typing out a message to you while you sent that. I am looking into this issue right now in collaboration with the mobile app team and we should have some answers soon.

 

Thank you for your patience,

Bashir

----------------------------------
Microsoft Employee on PowerBi Platform Team

@bashirs Something else that changed with the sandbox is that the displayName in my custom capability is no longer being shown in the formatting pane. 

 

For example, I have defined capabilities.objects as:

 

 

objects: {
  fooBar: {
    displayName: 'Foo Bar',
    properties: {
      valueType: {
        displayName: 'Type',
        ...
      }
    }
  }
}

The section shows up as "fooBar" instead of "Foo Bar" and the valueType field shows up as "valueType" instead of "Type".

 

When I use the dev tools with the same capabilities things work as expected.

Hi @bashirs,

 

Still waiting on that update.  Have you been able to reproduce the problem at your end?

 

Thanks.

Hi cmn,

 

Yeah, we have a consistent repro. It works in my testing environments but reacts differently in the App Store applications. I have been working with a member of the app development team today to help them investigate. I dont yet have an estimated time for when the mobile apps will be fixed. I will report that back when I have more information.

 

Take care,

Bashir

----------------------------------
Microsoft Employee on PowerBi Platform Team

@bashirs, is there any update on a workaround or eta for a fix?  We are under a lot of pressure from clients to have this issue resolved.  Even a rough ETA would be appreciated.  Are we talking days, weeks or months for a fix?  

 

Is a rollback possible, or a flag to turn off sandboxing at our own risk?  

 

There are other posts highlighting the same issue. Here are some that I have found, in case you have missed them:

 

http://community.powerbi.com/t5/Mobile-Apps/Custom-Visuals-no-longer-working-with-iPhone-app/m-p/284...

http://community.powerbi.com/t5/Service/Custom-Visuals-not-working/m-p/28687

http://community.powerbi.com/t5/Developer/Links-in-Custom-Visuals-for-Microsoft-Showcase-URGENT/m-p/...

 

 

Hi cmn,

 

I am working with the mobile team to come up with an estimate. When I get that information from them I will let you know.

 

Thanks,

Bashir

----------------------------------
Microsoft Employee on PowerBi Platform Team

Hi @bashirs,  I haven't hassled you for almost a week, but we really need an ETA for when this will be resolved, or at least a workaround.  Even a rough idea would be gratefull - is it more likely to be days, weeks or longer.  I'm sure you're already aware, but this is URGENT!  Our project rollout is on hold until this gets resolved.

Seconded. Worse than the lack of a fix or any suggestions is the week without any further communication.

Hi tomhawley and cmn,

 

We are working with the mobile team on pushing a fix soon.

 

If you have any other questions or support requests please PowerBi support: https://powerbi.microsoft.com/en-us/support/

 

Thank you for your patience,

Bashir

----------------------------------
Microsoft Employee on PowerBi Platform Team

@bashirs, In the email I received showing your post, you said "I heard back from the mobile team and they have pushed out a fix. The mobile app should be working again now."  I assume you have edited your post, as it now says "We are working with the mobile team on pushing a fix soon."

 

Either way, the mobile app is now working worse than it was.  Now, even standard, non modified custom visuals are not dispalying on my iPhone now.  Previously custom visuals straight from the official gallery would display ok.  For example, I was using an unmodified CardsWithState custom visual and it was rendering fine yesterday.  Now, the tile displays with the title and refresh date, but the content is blank.  Also, if I now create a new dashboard with one of the customised custom visuals, the whole dashboard fails to load.  All I get is the loading spinner.

 

Can you update this situation?  Are you still working on the fix?

@bashirs

 

I have another update. The out-of-the-box cards with state visual is still not displaying at all on the iphone app (this was working yesterday).  However, my customised linear gauge visual (the one that was not working yesterday) seems to working sporadically now.  Sometimes when I open a dashboard it works, sometimes it does not.  I have a colleauge using the android app and he says the customised linear gauage works all the time, but for him the cards with state visual is not working either.

 

So in summary:

  1. Cards with state (out of the box) does not work on either iphone or android app anymore
  2. My customised linear gauge renders sometimes on iphone, but all the time on android.

Please keep up posted on progress.  Thanks for your efforts so far. 

 

Hi cmn,

 

I am sorry to hear that you and your team has experienced varied and unexpected behavior with the IOS and Android applications. I am not the best contact for issues with the mobile product since that is not my feature area. I have forwarded your issues to the mobile team so far and I know that they are working very hard right now to deliver fixes but I am not an expert in that area of the product portfolio.

 

I would suggest you file a support ticket(s) with PowerBi Support (https://powerbi.microsoft.com/en-us/support/) and they will put you in contact with someone from that feature area that can assist you.

 

Thank you for your patience,

Bashir

----------------------------------
Microsoft Employee on PowerBi Platform Team

Hi @bashirs.  I'm sad to here that.  You are the only one that seems to be taking this problem seriously.  I have raised a support ticket for this (Pro license) but have had no response.  Is it possible to get one of the mobile team to respond via this forum?  If they have just released a fix, these are the people we need to dealing with.  They fully undertstand the background of the issue, know the fixes that have just been applied, etc.  If I am forced to go via a support ticket, the person I will be dealing with will have no idea what I am talking about, and this will delay any resolution.

 

I undertstand this is not you area, and greatly appreciate your help so far.  Anyway you can keep following this one, as we seem to be very close to a resolution?

 

Thanks again.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.