简体   繁体   English

从网络共享启动 WPF clickonce 应用程序时出错

[英]Error when launching WPF clickonce application from network share

We have a WPF application published to a network share using clickonce.我们有一个 WPF 应用程序使用 clickonce 发布到网络共享。 The application is only available online.该应用程序仅在线提供。 After windows update KB4515842 on the client computers we started experiencing problems as described below.在客户端计算机上的 windows 更新 KB4515842 之后,我们开始遇到如下所述的问题。 No changes has been made to the application.没有对应用程序进行任何更改。

When I start the application using IE it is downloaded and started correctly.当我使用 IE 启动应用程序时,它会正确下载并启动。 There are however some parts of the application that doesn't work as before.然而,应用程序的某些部分不能像以前那样工作。 We have a listview with templates for different types of items.我们有一个列表视图,其中包含不同类型项目的模板。 When an item is selected, additional information is shown in an area using a template depending on the selected type of the item in the listview.选择项目时,根据列表视图中项目的所选类型,使用模板在区域中显示附加信息。 The templates are selected using a DataTemplateSelector with the selected item in the listview as input.模板是使用 DataTemplateSelector 选择的,其中列表视图中的选定项目作为输入。 The DataTemplateSelector is not triggered after the update, hence no information is shown for the selected item.更新后不会触发 DataTemplateSelector,因此不会显示所选项目的信息。

The application uses.Net 4.5.2.该应用程序使用.Net 4.5.2。 Problem occurs on both Windows 7 and Windows 10. Windows 7 和 Windows 10 都出现问题。

The problem only occurs when the application is started through the network share.仅当应用程序通过网络共享启动时才会出现此问题。 No problem in Visual studio or when starting the clickonce installed application from..\AppData\Local\Apps\2.0...在 Visual Studio 中或从..\AppData\Local\Apps\2.0 启动 clickonce 安装的应用程序时没有问题...

It also works when I deploy the application as available offline (start menu items created etc.)当我将应用程序部署为离线可用时它也可以工作(创建的开始菜单项等)

Uninstalling the update also resolves the problem.卸载更新也可以解决问题。 On Windows 7 I uninstalled KB4519568, on Windows 10 KB4524098 (which both include KB4515842).在 Windows 7 上,我卸载了 KB4519568,在 Windows 10 KB4524098 上(都包括 KB4515842)。

Any ideas on what to try next?关于下一步尝试什么的任何想法?

I found the reason for our problem so I am posting the solution if anybody encounters the same problem.我找到了问题的原因,所以如果有人遇到同样的问题,我会发布解决方案。

The Selected item in the listview had a binding to a property in our viewmodel.列表视图中的 Selected 项绑定到我们视图模型中的属性。 The property in the viewmodel looked similar to this:视图模型中的属性类似于:

public Shared.Task SelectedTask
{
   get
   {
      return _selectedTask;
   }
   private set
   {
      _selectedTask = value;
      OnPropertyChanged(() => SelectedTask);
   }
}

I am uncertain how this could work with a private access modifier on the set part of the property, but it has worked previously and still works in Visual Studio 2017 and when running the installed version of the clickonce application.我不确定这如何与属性的 set 部分上的私有访问修饰符一起使用,但它以前曾工作过,并且在 Visual Studio 2017 和运行 clickonce 应用程序的已安装版本时仍然有效。 Anyway when I made the set public it also works for our network deployed clickonce application (The PropertyChanged event is fired for SelectedTask and the DataTemplateSelector which listens to changes of SelectedTask returns a new DataTemplate).无论如何,当我公开该集合时,它也适用于我们网络部署的 clickonce 应用程序(为 SelectedTask 触发 PropertyChanged 事件,并且侦听 SelectedTask 更改的 DataTemplateSelector 返回一个新的 DataTemplate)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM