Surface Runtime Exception on Windows 8

2019-09-17 00:46发布

问题:

We are experiencing a strange problem with a software we already developed few month ago, today we had to reopen the app for the customer to make some improvement. But a strange exception start to show up. it seem that is coming from the ScatterView. But the strange thing the app is working on production and the code is the same what could be the cause? Here the 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

Here you can find the full stack trace http://pastebin.com/y3vVurfm

Thanks I forgot to say the app is developed on .net 4.5

回答1:

The runtime exception you are facing might be the result that you are compiling for Any CPU and are now using an x64 operating system. You can overcome this by recompiling for x86 only.

Please note: on Windows 8 there are some other restrictions in regard to have an application running that targets Microsoft Pixelsense / Samsung SUR40 (touch events not being reported). The Pixelsense SDK was created when Microsoft Windows 8 wasn't released yet, so don'T expect this being supported.

If you want to have support for both platforms see https://blogs.sevensteps.com/Lists/Posts/Post.aspx?ID=10 for an idea on how to achieve this.



回答2:

I encountered the same problem and finally found a solution:

The exception is thrown by a function in GetItemOrientation in Microsoft.Surface.Presentation.Controls.ScatterCanvas.

You can omit the failing function call in GetItemOrientation by setting the Orientation property on the ScatterViewItem yourself or by setting ScatterViewItem.CanRotate = false.