x64 上的 ScatterView 运行时异常 [英] ScatterView runtime exception on x64

查看:29
本文介绍了x64 上的 ScatterView 运行时异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了与此处所述相同的问题.

I have the same issue as described here.

我们使用旧的 Microsoft Surface 2.0 开发了多个应用程序开发工具包. 应用程序构建为 AnyCPU 并且它们在 32 位和 64 位模式下都可以完美运行.在其中一个应用程序中,我使用了 ScatterView.

We have developed several applications using the old Microsoft Surface 2.0 SDK. The applications are built as AnyCPU and those work perfectly fine running both in 32 bit and 64 bit mode. In one of these application I use a ScatterView.

<Window x:Class="WpfApplication1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="http://schemas.microsoft.com/surface/2008"
    Title="MainWindow" Height="350" Width="525">
    <Grid>
        <s:ScatterView x:Name="timeline">
            <Rectangle></Rectangle>
        </s:ScatterView>
    </Grid>
</Window>

但是,如果我尝试在新的空白 Window 中添加新的 ScatterView,我会收到此错误:

However if I try to add a new ScatterView in a new blank Window I get this error:

{"The type initializer for 'Microsoft.Surface.Core.InteractiveSurface' threw an exception."}

System.TypeInitializationException was unhandled
HResult=-2146233036
Message=The type initializer for 'Microsoft.Surface.Presentation.Input.InteractiveSurface'  threw an exception.
Source=Microsoft.Surface.Presentation
TypeName=Microsoft.Surface.Presentation.Input.InteractiveSurface

如果我强制应用程序以 32 位 运行,它会完美运行.但是,该应用程序占用大量内存,因此我也想以 64 位 运行它.

If I force the application to run in 32 bit it runs perfectly. However the application is pretty memory intensive so I would like to run it in 64 bit as well.

我的问题是:为什么我当前应用程序中的 ScatterView 可以在 64 位完美运行,但是向该应用程序添加额外的 ScatterView 或创建全新的应用程序会立即崩溃.不幸的是,前面问题中给出的答案有一个死链接.

My question is: How come the ScatterView in my current application runs perfectly in 64 bit, but adding an additional ScatterView to this application or creating a brend new application crashes immediately. Unfortunately the answer given in the previous questions has a dead link.

推荐答案

当然,经过 48 小时的搜索,我找到了自己问题的解决方案.

Of course after 48 hours of searching I found a solution to my own question.

当您在 ScatterView 中添加项目时,会调用 Microsoft.Surface.Presentation.Controls.ScatterCanvas 中的函数 GetItemOrientation>.这个函数决定了 ScatterViewItem 的旋转.在 64bit 中运行您的应用程序时,此方法失败并引发异常,这可能是由于调用本机方法以确定它应该运行的 SUR40 的方向所致.

When you add an item in the ScatterView, a call is made to the function GetItemOrientation in Microsoft.Surface.Presentation.Controls.ScatterCanvas. This function determines the rotation of the ScatterViewItem. When running your application in 64bit this method fails and throws an exception, probably caused by a call to a native method to determine the orientation of the SUR40 on which it is supposed to run.

解决方案:您可以通过自己设置 ScatterViewItem 上的 Orientation 属性或通过设置 ScatterViewItem.CanRotate = false<来禁用对 GetItemOrientation 的函数调用/代码>.

Solution: You can disable the function call to GetItemOrientation by setting the Orientation property on the ScatterViewItem yourself or by setting ScatterViewItem.CanRotate = false.

这篇关于x64 上的 ScatterView 运行时异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆