none
WndProc(Message& m) - is not marked as serializable RRS feed

  • Question

  • I set the following in my AddIn to log uncaught exceptions:

    System.Windows.Forms.Application.ThreadException += Application_ThreadException;

    And we have a case where we are getting the following exception:

    System.Runtime.Serialization.SerializationException: Type 'Laserfiche.OfficePlugin.SaveToLaserfiche.MessageFilter' in Assembly 'Laserfiche.Word2010Plugin, Version=8.3.0.0, Culture=neutral, PublicKeyToken=607dd73ee2bd1c00' is not marked as serializable.
       at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)
       at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
       at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
       at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)
       at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)
       at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
       at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
       at System.Runtime.Remoting.RemotingServices.MarshalToBuffer(Object o)
       at System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(IntPtr pUnk)
       at System.Windows.Forms.Application.ThreadContext.get_ComponentManager()
       at System.Windows.Forms.Application.ThreadContext.FormActivated(Boolean activate)
       at System.Windows.Forms.Form.WmActivate(Message& m)
       at System.Windows.Forms.Form.WndProc(Message& m)
       at DevExpress.XtraEditors.XtraForm.WndProc(Message& msg)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    

    Which leads to three questions:

      • Our AddIn is not Laserfiche - is there anything we can/should do to avoid this problem? Or is it something Laserfiche needs to do?
      • What do they need to do?
      • Is there a way to get the call stack above NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)? So we can wrap our code that leads to this in a try/catch?

    thanks - dave


    Who will win The International Collegiate Programming Championships?

    Wednesday, October 17, 2012 3:19 PM

Answers

All replies

  • HI dave,

    Thanks for posting in the MSDN Forum.

    The first step for trouble shooting is double check where your installed Laserfiche Office Plugin on your development environment. You are able to check the Programs and Features list or [HKEY_CURRENT_USER]\Software\Microsoft\Office\Word\Addins\]/[HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\Office\Word\Addins\](64-bit platform & 32-bit Office suites only) to confirm it.

    It’s based on my experience that the exception raised via Laserfiche.OfficePlugin.SaveToLaserfiche.MessageFilter, and I think that method will invoke WndProc(Message& m). I think we are hard to track it, and it will be meaningless to help you out. The key of your issue is find out why your program will let Laserfiche Office Plugin have exception. I think you’d better post a consult message in its Official forum for more helpful information. And we are hard to say why it does, after all we are not hackers.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, October 18, 2012 6:42 AM
    Moderator
  • Hi Tom;

    I agree that we cannot do anything to stop the Laserfiche AddIn from throwing an exception. And we have reached out to them. But can you please help with these two questions:

      • What does Laserfiche they need to do to avoid this problem?
      • Is there a way to get the call stack above NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)? So we can wrap our code that leads to this in a try/catch?

    The big question is how do we find where our code starts all of this so that we can wrap that code of ours in a try/catch. We need the full call stack.

    ??? - thanks - dave


    Who will win The International Collegiate Programming Championships?

    Thursday, October 18, 2012 1:10 PM
  • Hi DavidThi808,

     What does Laserfiche they need to do to avoid this problem?

    I don't know how about it. I think these is a problem which worth Laserfiche's engineers to consider. They need provide more detail reference for users to tell them which kind of situation will let that add-in crash.

     Is there a way to get the call stack above NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)? So we can wrap our code that leads to this in a try/catch?

    I have no idea about it. I think NavieWindow.Callback method is related to Winform issue. I found something there, I hope it can help you: http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/1f36d59a-ecfc-43b6-b1d0-8d9bfe75a7a8

    http://www.aboutmydot.net/desktop-applications/debugging/unhandled-exception-win32exceptionerror-creating-window-handle.html

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us


    Friday, October 19, 2012 7:05 AM
    Moderator