Bizar WPF error - ITfKeystrokeMgr.TestKeyUp - wpf

UPDATE: I've build a WPF app with no code behind, just put in a TextBox and a button and built it. When running this application I can see the same error in this user's machine. You can click on the button, and it works ok, but as soon as you press a key on the keyboard the application throws the same error. Should I reinstall the .Net Framework? Any other recommendations?
Original question:
I have a WPF app distributed via ClickOnce in an enterprise environment. Dozens of users are running my app without issues. However there's 1 single user who can't run the app. If I log-in in his machine I also get an error. The error for the user is the standard error message when any exception occurs. So I needed to remote-debug it.
The program loads without issues and it places the focus on a TextBox as soon as the TextBox looses the focus or the user presses a key, the program crashes.
I've attached my visual studio to the my application running on the problematic machine and I managed to capture the following stack trace.
" at MS.Win32.UnsafeNativeMethods.ITfKeystrokeMgr.TestKeyUp(Int32 wParam, Int32 lParam, Boolean& eaten)
at System.Windows.Input.TextServicesContext.Keystroke(Int32 wParam, Int32 lParam, KeyOp op)
at System.Windows.Input.TextServicesManager.TextServicesKeystroke(TextServicesContext context, KeyEventArgs keyArgs, Boolean test)
at System.Windows.Input.TextServicesManager.PreProcessInput(Object sender, PreProcessInputEventArgs e)
at System.Windows.Input.InputManager.ProcessStagingArea()\r\n at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
at System.Windows.Interop.HwndSource.OnPreprocessMessageThunk(MSG& msg, Boolean& handled)
at System.Windows.Interop.HwndSource.WeakEventPreprocessMessage.OnPreprocessMessage(MSG& msg, Boolean& handled)
at System.Windows.Interop.ComponentDispatcherThread.RaiseThreadMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at TIS.SamSeek.WpfClient.App.Main()"
I get a System.Argument exception with the description: "Value does not fall within the expected range.".
InnerException: null
Source: WindowsBase
TargetSite: {Void TestKeyUp(Int32, Int32, Boolean ByRef)}
DeclaringType: {Name = "ITfKeystrokeMgr" FullName = "MS.Win32.UnsafeNativeMethods+ITfKeystrokeMgr"}
Assembly: {WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35}
Declaring method: '((System.Type)(((System.Reflection.MemberInfo)(((System.Exception)($exception)).TargetSite)).DeclaringType)).DeclaringMethod' threw an exception of type 'System.InvalidOperationException'
Message: "Method may only be called on a Type for which Type.IsGenericParameter is true."
source: "mscorlib"
I put all kinds of traces in the code and I am pretty sure that my code is not directly causing this exception. I do not have any KeyUp events in my code.
What do you suggest?
Thanks a lot

My Psychic Debugger says it's something to do with the tablet input service. Office tends to install weird versions of it, which cause problems. What version of Windows is it?

Paul, you gave me a great hint. The Windows language bar had handwriting and voice recognition options turned on. When I turned these options off my app works fine!
What's up with that??!?!?!?!

Related

Error when trying to create or edit a job step in SQL Server "The system cannot find the file specified."

I am using
Microsoft SQL Server 2019 (RTM) - 15.0.2000.5 (X64)
Developer Edition (64-bit) on Windows Server 2016 Standard 10.0 <X64> (Build 14393: )
The recent things I have done was creating a job that restores databases dynamically from a path, ran it and disabled it.
Afterwards, when I tried to add a new step I got this error:
The system cannot find the file specified
I can't find any errors in the SQL Server logs.
I am able to create jobs with T-SQL and able to run them.
The other similar question on stack overflow are not relevant to my issue.
Why am I getting this error suddenly?
This is the error copied from management studio:
The system cannot find the file specified.
Program Location:
at Microsoft.SqlServer.Dts.Runtime.Application.get_LogProviderInfos()
at Microsoft.DataTransformationServices.DTSExecUI.Controls.LoggingCtrl..ctor(IDTSExecViewManager treePanel)
at Microsoft.SqlServer.Management.SqlManagerUI.DTSJobSubSystemDefinition.InitializeControls()
at Microsoft.SqlServer.Management.SqlManagerUI.DTSJobSubSystemDefinition..ctor(CDataContainer dataContainer, IMessageBoxProvider messageProvider)
at Microsoft.SqlServer.Management.SqlManagerUI.JobStepSubSystems.CreateJobStepSubSystemSsis(AgentSubSystem agentSubSystem, CDataContainer dataContainer, JobStepData data, IMessageBoxProvider messageProvider)
at Microsoft.SqlServer.Management.SqlManagerUI.JobStepSubSystems.CreateJobStepSubSystem(AgentSubSystem agentSubSystem, CDataContainer dataContainer, JobStepData data, IMessageBoxProvider messageProvider, IServiceProvider serviceProvider)
at Microsoft.SqlServer.Management.SqlManagerUI.JobStepSubSystems..ctor(CDataContainer dataContainer, JobStepData data, IMessageBoxProvider messageProvider, IServiceProvider serviceProvider)
at Microsoft.SqlServer.Management.SqlManagerUI.JobStepProperties.get_SubSystems()
at Microsoft.SqlServer.Management.SqlManagerUI.JobStepProperties.FilterStepCombo(DatabaseEngineEdition engineEdition)
at Microsoft.SqlServer.Management.SqlManagerUI.JobStepProperties.InitializeStepCombo()
at Microsoft.SqlServer.Management.SqlManagerUI.JobStepProperties.InitializeData()
at Microsoft.SqlServer.Management.SqlManagerUI.JobStepProperties.OnInitialization()
at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.SetView(Int32 index, TreeNode node)
at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.SelectCurrentNode()
at Microsoft.SqlServer.Management.SqlMgmt.ViewSwitcherControlsManager.InitializeUI(ViewSwitcherTreeView treeView, ISqlControlCollection viewsHolder, Panel rightPane)
at Microsoft.SqlServer.Management.SqlMgmt.LaunchForm.InitializeForm(XmlDocument doc, IServiceProvider provider, ISqlControlCollection control)
at Microsoft.SqlServer.Management.SqlMgmt.LaunchForm..ctor(ISqlControlCollection control, IServiceProvider provider)
at Microsoft.SqlServer.Management.SqlManagerUI.JobSteps.OnDoubleClick(Object sender, MouseButtonDoubleClickedEventArgs args)
at Microsoft.SqlServer.Management.UI.Grid.GridControl.OnMouseButtonDoubleClicked(HitTestResult htArea, Int64 nRowIndex, Int32 nColIndex, Rectangle rCellRect, MouseButtons btn, GridButtonArea headerArea)
at Microsoft.SqlServer.Management.SqlManagerUI.SqlManagerUIDlgGrid.OnMouseButtonDoubleClicked(HitTestResult htArea, Int64 rowIndex, Int32 colIndex, Rectangle cellRect, MouseButtons btn, GridButtonArea headerArea)
at Microsoft.SqlServer.Management.UI.Grid.GridControl.OnMouseDown(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at Microsoft.SqlServer.Management.UI.Grid.GridControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.RunDialog(Form form)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at Microsoft.SqlServer.Management.SqlMgmt.RunningFormsTable.RunningFormsTableImpl.ThreadStarter.StartThread()
The system cannot find the file specified.
Program Location:
at Microsoft.SqlServer.Dts.Runtime.Wrapper.ApplicationClass.get_LogProviderInfos()
at Microsoft.SqlServer.Dts.Runtime.Application.get_LogProviderInfos()
Thanks in advance.
Turns out it was some problem with SSMS.
I only noticed it when trying to edit a job step on another server.
When opening a new instance of SSMS, everything worked fine.

Exception has been thrown by the target of an invocation. (REDIS Cache)

I'm trying to resolve an issue we have specific to using REDIS cache on our web apps but need help understanding the stacktrace.
We intermittently get Exception has been thrown by the target of an invocation logged in our error table when users are viewing the report viewer, but there are no signs client side that anything has gone wrong.
I've had a read through this article: How to solve: "exception was thrown by the target of invocation" C# however it doesn't seem to cover our specific issue.
The stacktrace logged by our logger;
at System.RuntimeMethodHandle.SerializationInvoke(IRuntimeMethodInfo method, Object target, SerializationInfo info, StreamingContext& context)
at System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo info, StreamingContext context)
at System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder)
at System.Runtime.Serialization.ObjectManager.DoFixups()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at Microsoft.Web.Redis.BinarySerializer.Deserialize(Byte[] data) in D:\BuildAgent\work\f55792526e6d9089\src\Shared\BinarySerializer.cs:line 37
at Microsoft.Web.Redis.ChangeTrackingSessionStateItemCollection.GetData(String normalizedName) in D:\BuildAgent\work\f55792526e6d9089\src\Shared\ChangeTrackingSessionStateItemCollection.cs:line 156
at Microsoft.Web.Redis.ChangeTrackingSessionStateItemCollection.get_Item(String name) in D:\BuildAgent\work\f55792526e6d9089\src\Shared\ChangeTrackingSessionStateItemCollection.cs:line 141
at System.Web.SessionState.HttpSessionStateContainer.get_Item(String name)
at Microsoft.Reporting.WebForms.ViewerDataOperation..ctor()
at Microsoft.Reporting.WebForms.HttpHandler.GetHandler(String operationType)
at Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Looks to be an issue during Deserialization. Could the class definition have changed between when it was serialized and when it is being deserialized?

Silverlight Unhandled Error

I am getting the following error in Silverlight for one of the users. The target runtime is 4.1.10329.0 and the application is built using Silverlight 4. I don't happen to understand what may be the issue. Looks like it is trying to load something on LoadComponent and failing:
Message: Unhandled Error in Silverlight Application
Parser_CreateFromValue_CannotConvertInitializationText]
Arguments: PropertyChanged,System.Windows.Data.UpdateSourceTrigger
Debugging resource strings are unavailable. Often the key and arguments provide
sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?
linkid=106663&Version=4.1.10329.0&File=System.Windows.dll&Key=
Parser_CreateFromValue_Cannot ConvertInitializationText
[Line: 582 Position: 273] at
System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at Samplexxx.MainPage.InitializeComponent()
at Samplexxx.MainPage..ctor()
at Samplexxx.App.Application_Startup(Object sender, StartupEventArgs e)
at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate
handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs,
Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
Any ideas on what could be the issue?
Open IIS on the server, go to HTTP headers, click on Mime Types, click “Add New” and add the following:
Extension – Mime Type
.xaml – application/xaml+xml
.xap – application/x-silverlight-app
.xbap – application/x-ms-xbap

UnhandledException while fetching a dll from isolated storage in silverlight5

I am trying to develop one silverlight app which will save and retrieve a dll from isolated storage.
For example I have downloaded and saved System.Drawing.dll into isolated storage if it not exists in isolated storage. But if it exists in isolated storage, i am trying fetch that dll from isolated storage and then creating a object of that System.Drawing to draw a rectangle over captured image. But the problem is after fetching that dll it will return the following error.
[Window Title]
Visual Studio Just-In-Time Debugger
[Main Instruction]
An unhandled exception ('Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.DependencyAttribute' from assembly 'mscorlib, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
at System.Reflection.RuntimeAssembly.GetCustomAttributes(Type attributeType, Boolean inherit)
at System.Attribute.GetCustomAttributes(Assembly element, Type attributeType, Boolean inherit)
at MS.Internal.XamlSchemaContext.ProcessXmlnsDefinitions(Assembly assembly, String assemblyName)
at MS.Internal.XamlSchemaContext.EnsureManagedAssemblyAttributesLoaded()
') occurred in iexplore.exe [3892].
The Just-In-Time debugger was launched without necessary security permissions. To debug this process, the Just-In-Time debugger must be run as an Administrator. Would you like to debug this process?
[V] View process details [Yes, debug iexplore.exe] [No, cancel debugging]
[Expanded Information]
Process Name: C:\Program Files\Internet Explorer\iexplore.exe
Please let me know the solution for this error.
As far as I know it is not possible to reference a .NET assembly from Silverlight, regardless of whether the DLL is located in isolated storage or not. From a Silverlight application you should only be able to reference Silverlight DLL:s or, if you are using P/Invoke functionality in SL 5, unmanaged DLL:s.
If you want to draw a rectangle in a captured (bitmap) image, you could instead download and reference the third-party library writablebitmapex and use the one of the rectangle drawing methods from that library. The writeablebitmapex library is available for Silverlight and WP7 applications as well as for WPF and Metro applications.
You should be able to do something similar to this:
var captImg = new BitmapImage(new Uri("capturedimage.jpg", UriKind.Relative));
var editCaptImg = new WriteableBitmap(captImg);
// Draw rectangle starting at (5,5), 100 px wide, 150 px high and color red
editCaptImg.DrawRectangle(5, 5, 100, 150, Colors.Red);

Error communicating with WCF WPF app hosted in Windows Service

When there are two different machines access the same WCF service is the error below:
Exception throw:
=+=+ BASE EXCEPTION:
APLICATION: mscorlib
ERROR: The socket connection was aborted. This may have
caused by an error processing your message, a timeout
reception exceeded by the remote host or by a problem of network resource
underlying. The local socket timeout was '00: 30:00 '.
CALLSTACK:
Server stack trace:
in
System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32
offset, Int32 size, TimeSpan timeout, Boolean closing)
in
System.ServiceModel.Channels.SocketConnection.Read(Byte[] buffer, Int32 offset,
Int32 size, TimeSpan timeout)
in
System.ServiceModel.Channels.DelegatingConnection.Read(Byte[] buffer, Int32
offset, Int32 size, TimeSpan timeout)
in
System.ServiceModel.Channels.SessionConnectionReader.Receive(TimeSpan timeout)
in
System.ServiceModel.Channels.SynchronizedMessageSource.Receive(TimeSpan
timeout)
in
System.ServiceModel.Channels.FramingDuplexSessionChannel.Receive(TimeSpan
timeout)
in
System.ServiceModel.Channels.FramingDuplexSessionChannel.TryReceive(TimeSpan
timeout, Message& message)
in
System.ServiceModel.Dispatcher.DuplexChannelBinder.Request(Message message,
TimeSpan timeout)
in
System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway,
ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
in
System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
methodCall, ProxyOperationRuntime operation)
in
System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
in
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,
IMessage retMsg)
in
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
in
Evolution.WCF.Contract.IMenuService.GetFullMenu(Int32 userId, Int32 softwareId)
in
Evolution.CompanyPage.MenuVertical.btn_Menu_Click(Object sender,
RoutedEventArgs e) =+=+ INNER EXCEPTION:
APLICATION: System
ERRO: Was forced to cancel an existing connection by remote host
CALLSTACK:
in System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32
size, SocketFlags socketFlags)
in
System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32
offset, Int32 size, TimeSpan timeout, Boolean closing) END INNER EXCEPTION =+=+
END BASE EXCEPTION =+=+ =+=+=+=+=+=+=+=+=+=+=+=+ END EXCEPTION
=+=+=+=+=+=+=+=+=+=+=+=+
It seems to me that you are having a timeout exception. Try increasing the timeout option of your service.
Also, sometimes you can get this exception if you have a problem with the security related setting of WCF service endpoing. Try disabling it (for testing purposes) and see if you still get the problem. More info about how to disable it here.

Resources