3

After publishing my XBAP application, I am missing all (or some) TextBlocks. It looks like this:

strange "feature"

The buttons should be labeled, there should be various TextBlocks all over the main screen.

To make things more strange:

  • This application works perfectly when Debugging.
  • Not all the texts are always missing, some are there from time to time.
  • I implemented a changing LayoutTransform to rezise with the hosting browser. On some sizes, all (or some) texts are suddenly there. (With a fixed LayoutTransform, sometimes texts are missing, too). Changing to a RenderTransform instead does not change this behavior. Neither does removing the rezising.
  • Texts in a diagram I am painting are missing. They are drawn in OnRender in a custom control.
  • This behavior is only seen on some computers. I suspect all of them have .NET 4.0 installed. When compiling for .NET 4.0, all is well, but since .NET 4.0 is not widely installed yet, I'd rather compile for .NET 3.5

Any Ideas what might be causing this? Please ask if you need more information! Thanks!

Edit: I've made a small project to reproduce the bug. You can find it published here. Note that this bug seems to affecct .NET 4.0 only.

Starting with a WPF Browser application, this is my code in Page1.xaml

<Page x:Class="BugDemo.Page1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
    <Grid x:Name="LayoutRoot">
        <TextBlock FontSize="35" Text="Vanishing Text" />
        <Grid.LayoutTransform>
            <ScaleTransform />
        </Grid.LayoutTransform>
    </Grid>
</Page>

CodeBehind:

public partial class Page1 : Page
{
    public Page1()
    {
        InitializeComponent();    
        this.Loaded += AppPage_Loaded;
    }

    public double Scale
    {
        get { return ((ScaleTransform)this.LayoutRoot.LayoutTransform).ScaleX; }
        set
        {
            ((ScaleTransform)this.LayoutRoot.LayoutTransform).ScaleX = value;
            ((ScaleTransform)this.LayoutRoot.LayoutTransform).ScaleY = value;
        }
    }

   void AppPage_Loaded(object sender, RoutedEventArgs e)
    {
        App.Current.MainWindow.SizeChanged += (o, args) => UpdateScale();
        UpdateScale();
    }

    private void UpdateScale()
    {            
        double xscale = (App.Current.MainWindow.ActualWidth) / 300;
        double yscale = (App.Current.MainWindow.ActualHeight) / 200;

        Scale = Math.Min(xscale, yscale);                       
    }
}

After publishing this, The "Vanishing Text" can only be seen at some zoom levels. It works fine in Debug.

Jens
  • 25,229
  • 9
  • 75
  • 117

1 Answers1

2

This seems to be a bug in the IE9.0 beta. Rolling back to IE8.0 fixed the problem.

Jens
  • 25,229
  • 9
  • 75
  • 117