开发者

Silverlight preview XAML file exception

I have upgraded my Silverlight project from 2 to 3 and uses VS 2008. When I open the XAML-file preview in VS 2008 an exception occured:

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at MS.Internal.XcpImports.RenderTargetBitmapRenderNative(IntPtr nativePtr, IntPtr element, Int32& dirtyX, Int32& dirtyY, Int32& dirtyWidth, Int32& dirtyHeight)
   at MS.Internal.XcpImports.RenderTargetBitmapRender(HostingRenderTargetBitmap bitmap, UIElement visual, Int32& dirtyX, Int32& dirtyY, Int32& dirtyWidth, Int32& dirtyHeight)
   at System.Windows.Interop.HostingRenderTargetBitmap.Render(UIElement visual)
   at MS.Internal.Silverlight.Host.RuntimeInterop.RenderElementToTargetBitmap(Int32 elementKey, Int32 targetBitmapIdentifier)
   at MS.Internal.Silverlight.Host.Interop.RenderElementToTargetBitmap(Int32 element, Int32 targetBitmapIdentifier, ISilverlightContentDownloadCallback urlcallback)
   at MS.Internal.Silverlight.Host.CiderSilverlightImageHost.CiderInternalImage.UpdateBitmap()
   at MS.Internal.Silverlight.Host.CiderSilverlightImageHost.CiderInternalImage.UpdateTree()
   at MS.Internal.Silverlight.Host.CiderSilverlightImageHost.CiderInternalImage.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Silverlight.Host.CiderSilverlightImageHost.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.UIElement.UpdateLayout()
   at System.Windows.Interop.HwndSource.Process_WM_SIZE(UIElement rootUIElement, IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at System.Windows.Interop.HwndSource.LayoutFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Bool开发者_如何转开发ean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)

Why is it trouble to run Silverlight 3? Here is the code:

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

Width="400" Height="150">
    <Grid x:Name="LayoutRoot" Background="White" ShowGridLines="False">
    <Rectangle Style="{StaticResource PopupRectangle}"/>
    <Border Width="400"
            Style="{StaticResource BorderThin}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="20"/>
                <RowDefinition Height="70"/>
                <RowDefinition Height="30"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="70"/>
                <ColumnDefinition Width="310"/>
            </Grid.ColumnDefinitions>

            <TextBlock Text="Anteckning"
                   Grid.Row="1"
                   Grid.Column="0"/>
            <TextBox x:Name="txtNote"
                 Grid.Row="1"
                 Grid.Column="1"
                 TextWrapping="Wrap"
                 VerticalScrollBarVisibility="Auto"
                 Margin="5"/>                
        </Grid>
    </Border>
</Grid> </UserControl>


Visual Studio 2008 isn't supported for previewing XAML files - this very old feature was removed for the final release of the Silverlight 3 tools.

Silverlight 3 and 4 do support XAML preview in Visual Studio 2010.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜