NAV2018 - AddIn "A Call to System.Object.get_XXXX failed with this message: The type of one ore ..."

AchimMueller
Member Posts: 2
Hi there,
working on NAV2018 CU06 I'm getting this error by trying to use a self programmed AddIn: A call to "System.Object.get_CallingSource failed with this message: The type of one or more arguments does not match the method's parameter type." I found some entries at the Net but nothing fixed this.
I'm on programming an AddIn an the error occurs by calling an event in C# which is returning selfmade EventArgs into NAV and using the returned parameter.property e.CallingSource which type is string.
Because of missing event in NAV-pages like "OnAfterLoad" I'm working with a short working timer. This is because on run.page the trigger "OnAfterGetCurrentRecord" is raised before the AddIn is visible. Maybe stupid but not depending on my problem.
Here I'm as a not really good developer in C#:
public class MyAddin : WinFormsControlAddInBase , IObjectControlAddInDefinition
{
[ApplicationVisible]
public event EventHandler <TimerEndReachedEventArgs> TimerEndReached = delegate { };
//I tried different version of this. " = delegate.." is a tip from the Net - without same error result
protected virtual void RaiseTimerEndReached(TimerEndReachedEventArgs e)
{
if (TimerEndReached != null)
{
TimerEndReached(this, e);
}
}
}
public class TimerEndReachedEventArgs : EventArgs
{
public string CallingSource { get; set; }
}
So the event in NAV-Page looks like this:
MyAddInControl::TimerEndReached(sender : Variant;e : DotNet ("MyAddIn.TimerEndReachedEventArgs")
MESSAGE('%1',e.CallingSource);
On raising the event in C# i get the error as describted.
I've wrote two moore events - calling without a timer, also with self made EventArgs - all thees are throwing the error.
Here is a part of the system log:
A call to System.Object.get_CallingSource failed with this message: The type of one or more arguments does not match the method's parameter type.
ExceptionStackTrace:
at Microsoft.Dynamics.Nav.Runtime.NavApplicationMethod.InvokeMethod(ITreeObject obj, String methodName, Object[] args, Boolean resolveHandler, Boolean throwOnNotFound)
at Microsoft.Dynamics.Nav.Service.NSField.InvokeEventTriggerInternal(NavSession con, String eventName)
at Microsoft.Dynamics.Nav.Service.NSField.InvokeEventTrigger(NavSession session, String eventName)
at SyncInvokeInvokeEventTrigger(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at Microsoft.Dynamics.Nav.Service.ServiceOperationInvoker.RunInTransactionCombinator(ServiceOperation innerOperation, NSServiceBase serviceInstance, MethodBase syncMethod, Object[] inputs, Object[]& outputs)
at Microsoft.Dynamics.Nav.Service.ServiceOperationInvoker.<>c__DisplayClass25_0.<Combine>b__1(NSServiceBase serviceInstance, Object[] inputs, Object[]& outputs)
Anyone with ideas? Thank you!
Achim
working on NAV2018 CU06 I'm getting this error by trying to use a self programmed AddIn: A call to "System.Object.get_CallingSource failed with this message: The type of one or more arguments does not match the method's parameter type." I found some entries at the Net but nothing fixed this.
I'm on programming an AddIn an the error occurs by calling an event in C# which is returning selfmade EventArgs into NAV and using the returned parameter.property e.CallingSource which type is string.
Because of missing event in NAV-pages like "OnAfterLoad" I'm working with a short working timer. This is because on run.page the trigger "OnAfterGetCurrentRecord" is raised before the AddIn is visible. Maybe stupid but not depending on my problem.
Here I'm as a not really good developer in C#:
public class MyAddin : WinFormsControlAddInBase , IObjectControlAddInDefinition
{
[ApplicationVisible]
public event EventHandler <TimerEndReachedEventArgs> TimerEndReached = delegate { };
//I tried different version of this. " = delegate.." is a tip from the Net - without same error result
protected virtual void RaiseTimerEndReached(TimerEndReachedEventArgs e)
{
if (TimerEndReached != null)
{
TimerEndReached(this, e);
}
}
}
public class TimerEndReachedEventArgs : EventArgs
{
public string CallingSource { get; set; }
}
So the event in NAV-Page looks like this:
MyAddInControl::TimerEndReached(sender : Variant;e : DotNet ("MyAddIn.TimerEndReachedEventArgs")
MESSAGE('%1',e.CallingSource);
On raising the event in C# i get the error as describted.
I've wrote two moore events - calling without a timer, also with self made EventArgs - all thees are throwing the error.
Here is a part of the system log:
A call to System.Object.get_CallingSource failed with this message: The type of one or more arguments does not match the method's parameter type.
ExceptionStackTrace:
at Microsoft.Dynamics.Nav.Runtime.NavApplicationMethod.InvokeMethod(ITreeObject obj, String methodName, Object[] args, Boolean resolveHandler, Boolean throwOnNotFound)
at Microsoft.Dynamics.Nav.Service.NSField.InvokeEventTriggerInternal(NavSession con, String eventName)
at Microsoft.Dynamics.Nav.Service.NSField.InvokeEventTrigger(NavSession session, String eventName)
at SyncInvokeInvokeEventTrigger(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at Microsoft.Dynamics.Nav.Service.ServiceOperationInvoker.RunInTransactionCombinator(ServiceOperation innerOperation, NSServiceBase serviceInstance, MethodBase syncMethod, Object[] inputs, Object[]& outputs)
at Microsoft.Dynamics.Nav.Service.ServiceOperationInvoker.<>c__DisplayClass25_0.<Combine>b__1(NSServiceBase serviceInstance, Object[] inputs, Object[]& outputs)
Anyone with ideas? Thank you!
Achim
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions