当我用 ComboBox 上的笔单击 shaky/nervous/hammering 时,单击项目,在单击的同时移动笔...5 或 10 分钟后控件停止工作。
然后我可以打开 ComboBox,可以单击一个项目,该项目被突出显示,但什么也没有发生:ComboBox 没有关闭,也没有触发任何点击事件。
同样的错误发生在 ContextMenu 上。当错误发生时,所有组合框和所有菜单都不再工作。
当我用笔或手指单击时会发生这种情况,即使控件不再适用于笔或手指,鼠标也能正常工作。
在正常使用情况下,这种情况每个工作日大约发生 5 次,这对我的用户来说非常烦人。 您需要一些“耐心”才能重现错误,可能需要 10 分钟以上的时间……但它确实发生了。
我制作了一个简单的测试应用程序,其中包含一个 ComboBox 和一个带有 ContextMenu 的按钮,您可以用它重现错误。
我的应用程序的目标框架是 4.6.1,用 VS2015 编译。我的应用程序适用于 Windows 8.1 和 Windows 10 Anniversary,以及 .NET 4.6.1 和 4.6.2。
错误发生在 Microsoft Surface Pro 3 和 Pro 4 上
- Windows 10 创意者更新(包含 .NET 4.7)
- 安装了 Windows 10 周年更新和 .NET 4.7
- 安装了 Windows 8.1 和 .NET 4.7
- 安装了 Windows 10 周年更新 (.NET 4.6.2) 和 KB4034658 !!!
对于前三种情况,我找到了如何阻止 Windows Update 安装 Creators Update 和 .NET 4.7,至少在接下来的 6 个月左右。
但是对于 2017 年 8 月的累积更新 KB4034658,我的 Windows 10 用户当前的选择是忍受错误或完全停用所有 Windows 更新。
这是我的测试应用程序的代码:
MainWindow.xaml:
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DotNet47ComboBoxAndMenuError"
mc:Ignorable="d"
Title="" Height="900" Width="715" WindowStartupLocation="Manual" WindowState="Maximized">
<Grid>
<WrapPanel>
<ComboBox FontSize="16" Width="150">
<ComboBoxItem>ComboBoxItem 1</ComboBoxItem>
<ComboBoxItem>ComboBoxItem 2</ComboBoxItem>
<ComboBoxItem>ComboBoxItem 3</ComboBoxItem>
<ComboBoxItem>ComboBoxItem 4</ComboBoxItem>
<ComboBoxItem>ComboBoxItem 5</ComboBoxItem>
<ComboBoxItem>ComboBoxItem 6</ComboBoxItem>
<ComboBoxItem>ComboBoxItem 7</ComboBoxItem>
<ComboBoxItem>ComboBoxItem 8</ComboBoxItem>
<ComboBoxItem>ComboBoxItem 9</ComboBoxItem>
</ComboBox>
<Button x:Name="btnMenu" Content="MENU" FontSize="16" Margin="100,0,0,0">
<Button.ContextMenu>
<ContextMenu>
<MenuItem Header="MenuItem 1"></MenuItem>
<MenuItem Header="MenuItem 2"></MenuItem>
<MenuItem Header="MenuItem 3"></MenuItem>
<MenuItem Header="MenuItem 4"></MenuItem>
<MenuItem Header="MenuItem 5"></MenuItem>
<MenuItem Header="MenuItem 6"></MenuItem>
<MenuItem Header="MenuItem 7"></MenuItem>
<MenuItem Header="MenuItem 8"></MenuItem>
<MenuItem Header="MenuItem 9"></MenuItem>
</ContextMenu>
</Button.ContextMenu>
</Button>
</WrapPanel>
</Grid>
</Window>
只有 XAML,我的测试应用中绝对没有代码。
我的用户还报告说偶尔单击按钮在对话框窗口中没有任何反应。发生这种情况时,他们只能点击右上角的关闭按钮;如上所述,下拉菜单和菜单在主窗口中不再起作用:它们需要关闭并重新启动应用程序。还没有用样本重现这个,我想这是同样的错误。
此外,我的应用偶尔会因 Windows 10 Creators Update 或 .NET 4.7 崩溃,也可能因 KB4034658 而崩溃。不幸的是,我无法判断这些崩溃是何时发生的,但我怀疑它们在某种程度上与上述问题有关。
来自 Windows 事件日志的示例崩溃信息:
<Category>0</Category>
<ComputerName>DESKTOP-XXXXXX</ComputerName>
<EventCode>1026</EventCode>
<EventIdentifier>1026</EventIdentifier>
<EventType>1</EventType>
<InsertionStrings>Application: MyApp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IndexOutOfRangeException
at System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Insert(System.__Canon, System.__Canon, Boolean)
at System.Windows.Input.StylusWisp.WispLogic.CoalesceAndQueueStylusEvent(System.Windows.Input.RawStylusInputReport)
at System.Windows.Input.PenContext.FirePackets(Int32, Int32[], Int32)
at System.Windows.Input.PenThreadWorker.FlushCache(Boolean)
at System.Windows.Input.PenThreadWorker.FireEvent(System.Windows.Input.PenContext, Int32, Int32, Int32, Int32, IntPtr)
at System.Windows.Input.PenThreadWorker.ThreadProc()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
</InsertionStrings>
<Logfile>Application</Logfile>
<Message>Application: MyApp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IndexOutOfRangeException
at System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Insert(System.__Canon, System.__Canon, Boolean)
at System.Windows.Input.StylusWisp.WispLogic.CoalesceAndQueueStylusEvent(System.Windows.Input.RawStylusInputReport)
at System.Windows.Input.PenContext.FirePackets(Int32, Int32[], Int32)
at System.Windows.Input.PenThreadWorker.FlushCache(Boolean)
at System.Windows.Input.PenThreadWorker.FireEvent(System.Windows.Input.PenContext, Int32, Int32, Int32, Int32, IntPtr)
at System.Windows.Input.PenThreadWorker.ThreadProc()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
</Message>
<RecordNumber>250</RecordNumber>
<SourceName>.NET Runtime</SourceName>
<TimeGenerated>8/1/2017 2:10:56 PM</TimeGenerated>
<TimeWritten>8/1/2017 2:10:56 PM</TimeWritten>
<Type>Error</Type>
第二个样本:
<Category>0</Category>
<ComputerName>DESKTOP-XXXXXX</ComputerName>
<EventCode>1026</EventCode>
<EventIdentifier>1026</EventIdentifier>
<EventType>1</EventType>
<InsertionStrings>Application: MyApp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentNullException
at System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].FindEntry(System.__Canon)
at System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TryGetValue(System.__Canon, System.__Canon ByRef)
at System.Windows.Input.StylusLogic.ProcessInputReport(System.Windows.Input.RawStylusInputReport)
at System.Windows.Input.PenContext.FirePenOutOfRange(Int32, Int32)
at System.Windows.Input.PenThreadWorker.ThreadProc()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
</InsertionStrings>
<Logfile>Application</Logfile>
<Message>Application: MyApp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentNullException
at System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].FindEntry(System.__Canon)
at System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TryGetValue(System.__Canon, System.__Canon ByRef)
at System.Windows.Input.StylusLogic.ProcessInputReport(System.Windows.Input.RawStylusInputReport)
at System.Windows.Input.PenContext.FirePenOutOfRange(Int32, Int32)
at System.Windows.Input.PenThreadWorker.ThreadProc()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.ThreadHelper.ThreadStart()
</Message>
<RecordNumber>534</RecordNumber>
<SourceName>.NET Runtime</SourceName>
<TimeGenerated>7/31/2017 1:13:39 PM</TimeGenerated>
<TimeWritten>7/31/2017 1:13:39 PM</TimeWritten>
<Type>Error</Type>
我已在 https://connect.microsoft.com/VisualStudio 报告了错误和 https://github.com/Microsoft/dotnet/issues
我不希望得到这个错误的解决方案,但欢迎任何想法。
我想知道错误是否只发生在 MS Surface 上。我没有找到关于此错误的其他帖子,所以我会这样认为。没有很好的机会尽快修复它...WPF 和 Surface - 太奇特了。
通过这篇文章,我希望一些使用 Surface 的人能够重现错误并将错误报告给 Microsoft,以增加它被 MS 尽快修复的机会。 另外,我想知道这个错误是只发生在 MS Surface 平板电脑上还是其他平板电脑上,也许只发生在高 DPI 平板电脑上?
最佳答案
我们找到了解决方法,但它也有一些缺点。当disabling the RealTimeStylus在应用程序启动时,我们无法再重现该问题。
但是,禁用 RealTimeStylus 也会禁用 ScrollViewer swiping使用触摸。它也可能会影响手写笔的使用,我无法对此进行测试。
虽然此解决方案不是最佳解决方案,但它可能足以满足您的情况(或至少是一个起点)。
public static void DisableWPFTabletSupport()
{
// Get a collection of the tablet devices for this window.
TabletDeviceCollection devices = System.Windows.Input.Tablet.TabletDevices;
if (devices.Count > 0)
{
// Get the Type of InputManager.
Type inputManagerType = typeof(System.Windows.Input.InputManager);
// Call the StylusLogic method on the InputManager.Current instance.
object stylusLogic = inputManagerType.InvokeMember("StylusLogic",
BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic,
null, InputManager.Current, null);
if (stylusLogic != null)
{
// Get the type of the device class.
Type devicesType = devices.GetType();
// Loop until there are no more devices to remove.
int count = devices.Count + 1;
while (devices.Count > 0)
{
// Remove the first tablet device in the devices collection.
devicesType.InvokeMember("HandleTabletRemoved", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.NonPublic, null, devices, new object[] { (uint)0 });
count--;
if (devices.Count != count)
{
throw new Win32Exception("Unable to remove real-time stylus support.");
}
}
}
}
}
关于c# - WPF .NET 应用程序崩溃、组合框和菜单事件未在装有 Windows 10 Creators Update、.NET 4.7 或 KB4034658 的平板电脑上触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45721368/
作为我的Rails应用程序的一部分,我编写了一个小导入程序,它从我们的LDAP系统中吸取数据并将其塞入一个用户表中。不幸的是,与LDAP相关的代码在遍历我们的32K用户时泄漏了大量内存,我一直无法弄清楚如何解决这个问题。这个问题似乎在某种程度上与LDAP库有关,因为当我删除对LDAP内容的调用时,内存使用情况会很好地稳定下来。此外,不断增加的对象是Net::BER::BerIdentifiedString和Net::BER::BerIdentifiedArray,它们都是LDAP库的一部分。当我运行导入时,内存使用量最终达到超过1GB的峰值。如果问题存在,我需要找到一些方法来更正我的代
我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0
Rackup通过Rack的默认处理程序成功运行任何Rack应用程序。例如:classRackAppdefcall(environment)['200',{'Content-Type'=>'text/html'},["Helloworld"]]endendrunRackApp.new但是当最后一行更改为使用Rack的内置CGI处理程序时,rackup给出“NoMethodErrorat/undefinedmethod`call'fornil:NilClass”:Rack::Handler::CGI.runRackApp.newRack的其他内置处理程序也提出了同样的反对意见。例如Rack
我想用ruby编写一个小的命令行实用程序并将其作为gem分发。我知道安装后,Guard、Sass和Thor等某些gem可以从命令行自行运行。为了让gem像二进制文件一样可用,我需要在我的gemspec中指定什么。 最佳答案 Gem::Specification.newdo|s|...s.executable='name_of_executable'...endhttp://docs.rubygems.org/read/chapter/20 关于ruby-在Ruby中编写命令行实用程序
我构建了两个需要相互通信和发送文件的Rails应用程序。例如,一个Rails应用程序会发送请求以查看其他应用程序数据库中的表。然后另一个应用程序将呈现该表的json并将其发回。我还希望一个应用程序将存储在其公共(public)目录中的文本文件发送到另一个应用程序的公共(public)目录。我从来没有做过这样的事情,所以我什至不知道从哪里开始。任何帮助,将不胜感激。谢谢! 最佳答案 无论Rails是什么,几乎所有Web应用程序都有您的要求,大多数现代Web应用程序都需要相互通信。但是有一个小小的理解需要你坚持下去,网站不应直接访问彼此
我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r
刚入门rails,开始慢慢理解。有人可以解释或给我一些关于在application_controller中编码的好处或时间和原因的想法吗?有哪些用例。您如何为Rails应用程序使用应用程序Controller?我不想在那里放太多代码,因为据我了解,每个请求都会调用此Controller。这是真的? 最佳答案 ApplicationController实际上是您应用程序中的每个其他Controller都将从中继承的类(尽管这不是强制性的)。我同意不要用太多代码弄乱它并保持干净整洁的态度,尽管在某些情况下ApplicationContr
是的,我知道最好使用webmock,但我想知道如何在RSpec中模拟此方法:defmethod_to_testurl=URI.parseurireq=Net::HTTP::Post.newurl.pathres=Net::HTTP.start(url.host,url.port)do|http|http.requestreq,foo:1endresend这是RSpec:let(:uri){'http://example.com'}specify'HTTPcall'dohttp=mock:httpNet::HTTP.stub!(:start).and_yieldhttphttp.shou
我在Rails工作并有以下类(class):classPlayer当我运行时bundleexecrailsconsole然后尝试:a=Player.new("me",5.0,"UCLA")我回来了:=>#我不知道为什么Player对象不会在这里初始化。关于可能导致此问题的操作/解释的任何建议?谢谢,马里奥格 最佳答案 havenoideawhythePlayerobjectwouldn'tbeinitializedhere它没有初始化很简单,因为你还没有初始化它!您已经覆盖了ActiveRecord::Base初始化方法,但您没有调
我是一个Rails初学者,但我想从我的RailsView(html.haml文件)中查看Ruby变量的内容。我试图在ruby中打印出变量(认为它会在终端中出现),但没有得到任何结果。有什么建议吗?我知道Rails调试器,但更喜欢使用inspect来打印我的变量。 最佳答案 您可以在View中使用puts方法将信息输出到服务器控制台。您应该能够在View中的任何位置使用Haml执行以下操作:-puts@my_variable.inspect 关于ruby-on-rails-如何在我的R