# Error creating event handler in for Swift WPF app

**URL:** https://talk.remobjects.com/t/error-creating-event-handler-in-for-swift-wpf-app/22778
**Category:** Water
**Tags:** visual-studio
**Created:** [August 9, 2020, 2:19pm UTC](https://talk.remobjects.com/t/error-creating-event-handler-in-for-swift-wpf-app/22778 "2020-08-09T14:19:03Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![ron](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/r/ecae2f/32.png) [@ron](https://talk.remobjects.com/u/ron)
#### Post date: [August 9, 2020, 2:19pm UTC](https://talk.remobjects.com/t/error-creating-event-handler-in-for-swift-wpf-app/22778/1 "2020-08-09T14:19:03Z")

</div>

I’m a first time user of RemObjects, but I haven’t been successful in getting through the WPF Windows App (for Swift) tutorial because of installation issues.

I’ve just created a new virtual machine with a clean version of Windows 10 (Version 1909), installed Visual Studio 2019 Community edition and latest release of RemObjects Water (with support for Visual Studio).

All seems good until I try to create an event handler for the button (in the tutorial). When I double-click on the button I receive the following Visual Studio dll error:

```
System.TypeLoadException
Could not load type 'Microsoft.VisualStudio.DesignTools.Utility.ITypeNameFormatter' from assembly 'Microsoft.VisualStudio.DesignTools.Utility, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
   at RemObjects.Oxygene.VisualStudio.OxygeneProject.DesignerContextProviders.OxygeneEventBindingProvider.EVParamInfo..ctor(EventParameter aParam, CodeCompletionCompiler aCompiler)
   at RemObjects.Oxygene.VisualStudio.OxygeneProject.DesignerContextProviders.OxygeneEventBindingProvider.<GetCompatibleMethods>d __1.<MoveNext>b__ 1(EventParameter a)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at RemObjects.Oxygene.VisualStudio.OxygeneProject.DesignerContextProviders.OxygeneEventBindingProvider.<GetCompatibleMethods>d__1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteHostCodeContext.<>c __DisplayClass18_0.<Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.IRemoteHostCodeContext.GetCompatibleMethods>b__ 0()
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.<>c __DisplayClass48_0`1.<MarshalIn>b__ 0()
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()

System.TypeLoadException
Could not load type 'Microsoft.VisualStudio.DesignTools.Utility.ITypeNameFormatter' from assembly 'Microsoft.VisualStudio.DesignTools.Utility, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Server stack trace: 
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalInSynchronous(Action action, Int32 targetApartmentId, CancellationToken cancelToken, CallModality callModality, String methodName, String filePath, Int32 lineNumber)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalIn(Action action, Int32 targetApartmentId, CancellationToken cancelToken, CallSynchronizationMode syncMode, CallModality callModality, String methodName, String filePath, Int32 lineNumber)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalIn(IRemoteObject targetObject, Action action, CallSynchronizationMode syncMode, CallModality callModality, ApartmentState apartmentState, String memberName, String filePath, Int32 lineNumber)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalIn[TResult](IRemoteObject targetObject, Func`1 func, CallModality callModality, ApartmentState apartmentState, String memberName, String filePath, Int32 lineNumber)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.RemoteHostCodeContext.Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.IRemoteHostCodeContext.GetCompatibleMethods(String eventName, RemoteHostParameter[] parameters, String returnType)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.IRemoteHostCodeContext.GetCompatibleMethods(String eventName, RemoteHostParameter[] parameters, String returnType)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalHostCodeContext.<>c __DisplayClass19_0.<Microsoft.VisualStudio.DesignTools.DesignerContract.IHostCodeContext.GetCompatibleMethods>b__ 0(IRemoteHostCodeContext cxt)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.<>c __DisplayClass32_0`2.<MarshalOut>b__ 0()
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()

System.TypeLoadException
Could not load type 'Microsoft.VisualStudio.DesignTools.Utility.ITypeNameFormatter' from assembly 'Microsoft.VisualStudio.DesignTools.Utility, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.WaitForCompletion(NestedCallContext nestedCallContext, BlockingCall call, WaitHandle timeoutSignal)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalOutSynchronous(Action action, Int32 targetApartmentId, WaitHandle aborted, WaitHandle timeoutSignal, CancellationToken cancelToken, String methodName, String filePath, Int32 lineNumber)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.STAMarshaler.MarshalOut(Action action, Int32 targetApartmentId, WaitHandle aborted, CancellationToken cancelToken, CallSynchronizationMode syncMode, WaitHandle timeoutSignal, String methodName, String filePath, Int32 lineNumber)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalOut[TValue](RemoteHandle`1 targetObject, Action action, CallSynchronizationMode syncMode, ApartmentState apartmentState, String methodName, String filePath, Int32 lineNumber)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.ThreadMarshaler.MarshalOut[TResult,TValue](RemoteHandle`1 targetObject, Func`2 func, CallSynchronizationMode syncMode, ApartmentState apartmentState, String methodName, String filePath, Int32 lineNumber)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalHostCodeContext.Microsoft.VisualStudio.DesignTools.DesignerContract.IHostCodeContext.GetCompatibleMethods(IHostCodeEvent codeEvent)
   at Microsoft.VisualStudio.DesignTools.Designer.UI.PropertyInspector.CodeContext.CreateEventHandler(ISourceItemContext item, String typeName, IEvent eventKey, String methodName)
   at Microsoft.VisualStudio.DesignTools.Designer.UI.PropertyInspector.EventHandlerProvider.CreateEventHandler(IEvent eventKey, String methodName)
   at Microsoft.VisualStudio.DesignTools.Designer.UI.PropertyInspector.EventHandlerModel.SetMethodName(String newName)
   at Microsoft.VisualStudio.DesignTools.Designer.UI.PropertyInspector.EventHandlerModel.GenerateAndCommit()
   at Microsoft.VisualStudio.DesignTools.Designer.Tools.Selection.ElementEditorBehavior.ProcessDoubleClick(Boolean setDefaultHandler, SceneNode clickedElement)
   at Microsoft.VisualStudio.DesignTools.XamlDesigner.Tools.XamlElementEditorBehavior.ProcessDoubleClick(Boolean setDefaultHandler, SceneNode clickedElement)
   at Microsoft.VisualStudio.DesignTools.Designer.Tools.Selection.ElementEditorBehavior.OnClickEnd(Point pointerPosition, Int32 clickCount)
   at Microsoft.VisualStudio.DesignTools.Designer.Tools.EventRouter.ScopeElement_MouseUp(Object sender, MouseButtonEventArgs args)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.DesignerProcess.RunApplication()
   at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.DesignerProcess.<>c __DisplayClass3_0.<Main>b__ 0()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

```

It also happens if I merely type the name of the event handler into the properties of the button. I’ve run a repair from both the visual studio installation and the RemObjects installation, but that doesn’t seem to help.

Surely someone has gotten RemObjects Swift up and running in Visual Studio on Windows, so any advice on solving this installation issue of RemObjects would be greatly appreciated.

Thanks,

- Ron

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [August 9, 2020, 2:23pm UTC](https://talk.remobjects.com/t/error-creating-event-handler-in-for-swift-wpf-app/22778/2 "2020-08-09T14:23:58Z")

</div>

Ron,

> [@ron](#):
>
> I’ve just created a new virtual machine with a clean version of Windows 10 (Version 1909), installed Visual Studio 2019 Community edition and latest release of RemObjects Water (with support for Visual Studio).
> 
> All seems good until I try to create an event handler for the button (in the tutorial). When I double-click on the button I receive the following Visual Studio dll error:

I’m sorry about this, this definitely sounds like a bug on our side. I am assuming you are using build .2525, right?

I’ve uploaded the more recent build .2539 from Friday to you Personal Downloads page. Can you see if the problem persists for you with that version? In either case, I’ll log a bug and will try to get this addressed this coming week.

thanx,  
marc

---

<div class="post-metadata">

### Author: ![RemObjectsSoftware](https://talk.remobjects.com/user_avatar/talk.remobjects.com/remobjectssoftware/32/15947_2.png) [@RemObjectsSoftware](https://talk.remobjects.com/u/RemObjectsSoftware)
#### Post date: [August 9, 2020, 2:24pm UTC](https://talk.remobjects.com/t/error-creating-event-handler-in-for-swift-wpf-app/22778/3 "2020-08-09T14:24:02Z")

</div>

Thanks, logged as [bugs://84781](https://www.remobjects.com/portal/bugs/?id=84781)

---

<div class="post-metadata">

### Author: ![ron](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/r/ecae2f/32.png) [@ron](https://talk.remobjects.com/u/ron)
#### Post date: [August 9, 2020, 2:27pm UTC](https://talk.remobjects.com/t/error-creating-event-handler-in-for-swift-wpf-app/22778/4 "2020-08-09T14:27:36Z")

</div>

> [@ron](#):
>
> `Microsoft.VisualStudio.DesignTools.Utility`

Hi Marc,

Thanks for looking at this on a Sunday. Yep, it was version 2525. I’ll try the latest build and let you know.

Best,

- Ron

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [August 9, 2020, 2:28pm UTC](https://talk.remobjects.com/t/error-creating-event-handler-in-for-swift-wpf-app/22778/5 "2020-08-09T14:28:38Z")

</div>

> [@ron](#):
>
> I’ll try the latest build and let you know.

Cool, thanx!

---

<div class="post-metadata">

### Author: ![ron](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/r/ecae2f/32.png) [@ron](https://talk.remobjects.com/u/ron)
#### Post date: [August 9, 2020, 3:20pm UTC](https://talk.remobjects.com/t/error-creating-event-handler-in-for-swift-wpf-app/22778/6 "2020-08-09T15:20:33Z")

</div>

Hi Marc,

I just went looking for that build in my personal downloads but didn’t see it. Not wanting to push you on a Sunday, so just let me know when it’s there and I’ll give it a try. In the meantime, I’m going to uninstall Visual Studio 2019 community and install Visual Studio 2017 community to see if there is any difference.

Thanks,

- Ron

---

<div class="post-metadata">

### Author: ![ron](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/r/ecae2f/32.png) [@ron](https://talk.remobjects.com/u/ron)
#### Post date: [August 9, 2020, 5:53pm UTC](https://talk.remobjects.com/t/error-creating-event-handler-in-for-swift-wpf-app/22778/7 "2020-08-09T17:53:20Z")

</div>

Hi Mark,

Just wanted to let you know that version 2525 does work as expected with Visual Studio 2017 Community edition. I’ll just stick with that for now. Let me know if you want me to test your latest build with the latest version of Visual Studio.

Thanks,

- Ron

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [August 9, 2020, 10:53pm UTC](https://talk.remobjects.com/t/error-creating-event-handler-in-for-swift-wpf-app/22778/8 "2020-08-09T22:53:02Z")

</div>

> [@ron](#):
>
> I just went looking for that build in my personal downloads but didn’t see

Strange. your login is yout gmail address, right? Or do you have a second account?

> [@ron](#):
>
> Not wanting to push you on a Sunday,

No worries. What are weekdays? 😉

> [@ron](#):
>
> Just wanted to let you know that version 2525 does work as expected with Visual Studio 2017 Community edition. I’ll just stick with that for now. Let me know if you want me to test your latest build with the latest version of Visual Studio.

Interesting. That’s good info to have, that it’s 2019-specifc; its will help narrow this down.

—marc

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [August 10, 2020, 12:42pm UTC](https://talk.remobjects.com/t/error-creating-event-handler-in-for-swift-wpf-app/22778/9 "2020-08-10T12:42:11Z")

</div>

Confirmed the issue with VS2019, even in the latest.

---

<div class="post-metadata">

### Author: ![ron](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/r/ecae2f/32.png) [@ron](https://talk.remobjects.com/u/ron)
#### Post date: [August 10, 2020, 2:12pm UTC](https://talk.remobjects.com/t/error-creating-event-handler-in-for-swift-wpf-app/22778/10 "2020-08-10T14:12:38Z")

</div>

Sorry, you’'re totally correct in that yes I forgot I had created 2 accounts and I had just looked at my business email.

I saw that you had independently confirmed the issue even with the latest build. Please let me know if there is anything else I can do to help the effort.

---

<div class="post-metadata">

### Author: ![RemObjectsSoftware](https://talk.remobjects.com/user_avatar/talk.remobjects.com/remobjectssoftware/32/15947_2.png) [@RemObjectsSoftware](https://talk.remobjects.com/u/RemObjectsSoftware)
#### Post date: [August 14, 2020, 8:13am UTC](https://talk.remobjects.com/t/error-creating-event-handler-in-for-swift-wpf-app/22778/11 "2020-08-14T08:13:37Z")

</div>

[bugs://84781](https://www.remobjects.com/portal/bugs/?id=84781) got closed with status fixed.
