This project has moved and is read-only. For the latest updates, please go here.

Difference between 2 classes - LateBinding error?

Oct 22, 2012 at 4:34 PM
Edited Oct 22, 2012 at 4:38 PM

I'm currently using NetOffice 1.41.

I have to (almost) identical classes in an assembly:

  1. MessageCombined
  2. Message

When i call MessageCombined with the parameters, everything goes well.

But when i just change the call with the Message type (has identical methods, ...), then there is the following error:

Exception has been thrown by the target of an invocation.

   at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)   at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)   at LateBindingApi.Core.Invoker.PropertyGet(COMObject comObject, String name, Object[] paramsArray)

I already did this before:

var t = new Core.Functionality.ApiLoad("t");

& Content of the APILoad class:

public class ApiLoad    {        public ApiLoad(string bl)        {            try            {                DebugConsole.FileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Console.txt");                DebugConsole.Mode = ConsoleMode.LogFile;                LateBindingApi.Core.Factory.Initialize();                LateBindingApi.Core.Settings.EnableMessageFilter = false;            }            catch (Exception ex)            {                writelog(ex.Message);
            }        }        public void dummy()        { }
        public void writelog(string text)        {            string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Log.txt");            File.AppendAllText(path, text);
        }    }

So, everything should be called. But i don't understand why the application breaks when i only change 1 Type:

Core.Functionality.MessageCombined newMessage = new Core.Functionality.MessageCombined(XLSFile.FullName, XLS, CSV);

Doesn't work:
Core.Functionality.Message newMessage = new Core.Functionality.Message(XLSFile.FullName, XLS, CSV);

What am i doing wrong?

PS. For being complete, i pasted all classes on (including comment)