mono / mono-addins

Mono.Addins is a generic framework for creating extensible applications, and for creating add-ins which extend those applications.
MIT License
164 stars 93 forks source link

Question about ConsoleProgressStatus as subclass of System.MarshalByRefObject #193

Closed santiago-ribero closed 1 year ago

santiago-ribero commented 1 year ago

Hello. We are using Mono.Addins 1.3.7. One of our users reported a problem that is logged as:

First error message:

Add-in scan operation failed. The runtime may have encountered an error while trying to load an assembly.

Second error message:

Add-in scan operation failed System.Runtime.Remoting.RemotingException: The argument type 'System.MarshalByRefObject' cannot be converted into parameter type 'Mono.Addins.IProgressStatus'. ---> System.InvalidCastException: Object must implement IConvertible.
   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
   at System.Runtime.Remoting.Messaging.Message.CoerceArg(Object value, Type pt)

Apparently what is happening is: 1) An Exception is thrown in RemoteSetupDomain.Scan (for an unknown reason). 2) The Exception is catched in AddinDatabase.RunScannerProcess , and the first error message is logged. 3) A second Exception (InvalidCastException) occurs in that same catch, more precisely when the following is executed:

scanMonitor = new ConsoleProgressStatus (true);

I see that on 14-Jul-2021, the commit https://github.com/mono/mono-addins/commit/847c4a1b8c7631528024b8b7e583e31a0289f1ae#diff-5aaae4188077feb93880e8c3d56ce290c4da0e26d1179300cb71e6e9eed33e7f makes ConsoleProgressStatus a subclass of MarshalByRefObject only under the following condition: "#if NETFRAMEWORK" .

My questions:

  1. Would you mind telling me if that change is meant to solve the InvalidCastException that I described?
  2. Would it be possible for you to give me some hint on how I can reproduce (as a Mono.Addins 1.3.7 user) the InvalidCastException that I described? (since all I have is a log file from a final user).
  3. The DLL I am using is "Mono.Addins.1.3.7\lib\net45\Mono.Addins.dll" , with TargetFramework(".NETFramework,Version=v4.5", FrameworkDisplayName = ".NET Framework 4.5")] . I understand that by upgrading to the latest version (with the preprocessor directive), the ConsoleProgressStatus would still be a subclass of MarshalByRefObject . Am I right?

Thank you very much. Any hint or advice would be much appreciated. Kind regards.