C# Windows 10设备上的System.ExecutionEngineeException
我正在开发一个Windows Phone 8.1应用程序。它在wp8和wp8.1设备上运行良好,但在使用windows10的设备上运行良好C# Windows 10设备上的System.ExecutionEngineeException,c#,windows-phone-8.1,windows-10-mobile,C#,Windows Phone 8.1,Windows 10 Mobile,我正在开发一个Windows Phone 8.1应用程序。它在wp8和wp8.1设备上运行良好,但在使用windows10的设备上运行良好 ExecutionEngineeException未处理。未知模块中发生“System.ExecutionEngineeException”类型的未处理异常。 在“调试”和“发布”的各个部分中,没有任何关于出错原因的数据。有些地方总是抛出异常,有些地方则不时抛出异常。下面的示例代码引发异常-这基本上是一种在选项卡之间切换的方法,当点击按钮(带图像的网格)时,
ExecutionEngineeException未处理。未知模块中发生“System.ExecutionEngineeException”类型的未处理异常。
在“调试”和“发布”的各个部分中,没有任何关于出错原因的数据。有些地方总是抛出异常,有些地方则不时抛出异常。下面的示例代码引发异常-这基本上是一种在选项卡之间切换的方法,当点击按钮(带图像的网格)时,选项卡是堆叠面板:
private void Grid_Tapped(object sender, TappedRoutedEventArgs e)
{
if(!isMapVisible)
{
hideSection();
map_wrapper.Visibility = Windows.UI.Xaml.Visibility.Visible;
map_button.Background = new SolidColorBrush(ColorHelper.FromArgb(0xFF, 40, 110, 73));
map_icon.Source = new BitmapImage(new Uri(FileHelper.getIconPath("tu_2.png")));
isMapVisible = true;
}
}
private void hideSection()
{
if(isMapVisible)
{
map_button.Background = new SolidColorBrush(ColorHelper.FromArgb(0xFF, 238, 238, 238));
map_icon.Source = new BitmapImage(new Uri(FileHelper.getIconPath("tu.png")));
isMapVisible = false;
map_wrapper.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
}
else if(isPhotoVisible)
{
photo_button.Background = new SolidColorBrush(ColorHelper.FromArgb(0xFF, 238, 238, 238));
photo_icon.Source = new BitmapImage(new Uri(FileHelper.getIconPath("photo_green.png")));
isPhotoVisible = false;
image_wrapper.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
}
else if(isListVisible)
{
list_button.Background = new SolidColorBrush(ColorHelper.FromArgb(0xFF, 238, 238, 238));
list_icon.Source = new BitmapImage(new Uri(FileHelper.getIconPath("!2.png")));
isListVisible = false;
news_wrapper.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
}
}
最后我设法修复了代码。但是上面的代码中没有错误。我用了一种叫做“安全导航”的东西。下面的代码显示了该示例:
Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
rootFrame.Navigate(typeof(MainPage));
});
我还使用
await
操作符处理了所有异步方法(之前我将其中一些方法留给异步运行)。其中一项改进修复了这个错误。我知道这比原来的帖子快了两年,但也许这会帮助人们找到这个问题的答案。我一直从Windows10UWP桌面应用程序中收到明显随机的System.ExecutionEngineeException。几天后,我找到了我的问题的答案。我使用了MVVM平台,其中一个视图中的x:UID已损坏
应该是:也要添加到上面。XAML引擎不检查重复的x:Uid,当我有两个同名的x:Uid时,我也遇到了这个错误。使整个项目中的所有x:Uid都是唯一的(不幸的是扩展了资源文件),但这解决了任何进一步的问题。希望XAML设计器检查重复的x:Uid,它检查x:Name的 再一次,希望它能帮助将来的人 干杯
Clyde你能标记抛出异常的行吗?我不能,因为我不知道。我只知道在网格被点击后,当上面的方法被触发时,我会得到异常。异常没有任何附加信息,而且调用堆栈窗口为空。图像的大小是多少?这是什么
在getIconPath(“!2.png”)
中?该错误可能是由程序的某个非托管部分引发的。位图助手和图像反压缩器是典型的嫌疑犯。也可能是您的某个图像已损坏。有关类似问题,请参见和