문제

My code which uses NSKeyedUnarchiver now throws a TypeLoadException when using the latest monomac from Git:

System.EntryPointNotFoundException: monomac_IntPtr_objc_msgSend_IntPtr at at (wrapper managed-to-native) MonoMac.ObjCRuntime.Messaging:monomac_IntPtr_objc_msgSend_IntPtr (intptr,intptr,intptr) at MonoMac.Foundation.NSKeyedUnarchiver..ctor (MonoMac.Foundation.NSData data) [0x0002a] in /Users/richard/Development/MonoMacSources/gitsrc/monomac/src/Foundation/NSKeyedUnarchiver.g.cs:93

The same code runs fine using the version of monomac.dll which ships with Xamarin Studio.

Test case:

public NSTextFieldCell Cell = new NSTextFieldCell("string");

public override void AwakeFromNib()
{
   base.AwakeFromNib();

   Console.WriteLine(Cell.StringValue);

   using(NSMutableData data = new NSMutableData())
   {
       using(NSKeyedArchiver archiver = new NSKeyedArchiver(data))
       {
           this.Cell.EncodeTo(archiver);
           archiver.FinishEncoding();
       }

       using(NSKeyedUnarchiver unarchiver = new NSKeyedUnarchiver(data))
       {
           var cell = (NSTextFieldCell)Activator.CreateInstance(typeof(NSTextFieldCell), new object[] { unarchiver });
           unarchiver.FinishDecoding();

           Console.WriteLine(cell.StringValue);
       }
   }
}

Exception is thrown at new NSKeyedUnarchiver(data)).

Does anyone have an idea? Or a workaround?

도움이 되었습니까?

해결책

This is effectively a regression in the latest MonoMac from Git.

I will fix it (currently there is no workaround except use an earlier version from Git).

It's fixed now.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top