I'm using ICSharpCode.SharpZipLib for unzip a file that contain file, folders and subfolders inside, but i'm getting an error that I didn't find here or in any other forum.
Code:
public static void UnZipFiles(string zipPathAndFile, string outputFolder, string password, bool deleteZipFile)
{
ZipInputStream s = new ZipInputStream(File.OpenRead(zipPathAndFile));
if (password != null && password != String.Empty)
s.Password = password;
ZipEntry theEntry;
string tmpEntry = String.Empty;
while ((theEntry = s.GetNextEntry()) != null)
{
string directoryName = outputFolder;
string fileName = Path.GetFileName(theEntry.Name);
// create directory
if (directoryName != "")
{
Directory.CreateDirectory(directoryName);
}
if (fileName != String.Empty)
{
if (theEntry.Name.IndexOf(".ini") < 0)
{
string fullPath = directoryName + "\\" + theEntry.Name;
fullPath = fullPath.Replace("\\ ", "\\");
string fullDirPath = Path.GetDirectoryName(fullPath);
if (!Directory.Exists(fullDirPath)) Directory.CreateDirectory(fullDirPath);
FileStream streamWriter = File.Create(fullPath);
int size = 2048;
byte[] data = new byte[2048];
while (true)
{
size = s.Read(data, 0, data.Length);
if (size > 0)
{
streamWriter.Write(data, 0, size);
}
else
{
break;
}
}
streamWriter.Close();
}
}
}
s.Close();
if (deleteZipFile)
{
File.Delete(zipPathAndFile);
}
}
Error got:
Unhandled Exception: ICSharpCode.SharpZipLib.SharpZipBaseException: Unknown block type 6
at ICSharpCode.SharpZipLib.Zip.Compression.Inflater.Decode () [0x00000] in <filename unknown>:0
at ICSharpCode.SharpZipLib.Zip.Compression.Inflater.Inflate (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] in <filename unknown>:0
at ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream.Read (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] in <filename unknown>:0
at ICSharpCode.SharpZipLib.Zip.ZipInputStream.BodyRead (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] in <filename unknown>:0
at ICSharpCode.SharpZipLib.Zip.ZipInputStream.InitialRead (System.Byte[] destination, Int32 offset, Int32 count) [0x00000] in <filename unknown>:0
at ICSharpCode.SharpZipLib.Zip.ZipInputStream.Read (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] in <filename unknown>:0
at ICSharpCode.SharpZipLib.Zip.ZipInputStream.CloseEntry () [0x00000] in <filename unknown>:0Error connecting stdout and stderr (127.0.0.1:10001)
at ICSharpCode.SharpZipLib.Zip.ZipInputStream.GetNextEntry () [0x00000] in <filename unknown>:0
at FolderNavigation.ZipController.UnZipFiles (System.String zipPathAndFile, System.String outputFolder, System.String password, Boolean deleteZipFile) [0x00119] in /Users/claudio/Projects/FolderNavigation/FolderNavigation/ZipController.cs:15
at FolderNavigation.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x0005e] in /Users/claudio/Projects/FolderNavigation/FolderNavigation/Main.cs:43
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/plasma/Source/iphone/monotouch/UIKit/UIApplication.cs:26
at MonoTouch.UIKit.UIApplication.Main (System.String[] args) [0x00000] in /Users/plasma/Source/iphone/monotouch/UIKit/UIApplication.cs:31
at FolderNavigation.Application.Main (System.String[] args) [0x00000] in /Users/claudio/Projects/FolderNavigation/FolderNavigation/Main.cs:14
Any idea?
Regards,
Claudio
Have you tried to unzip the file via the code on .NET in windows for example? Maybe the file is zipped by some technique SharpZipLib does not support?
I'm judging by the fact that error happens in 'ICSharpCode.SharpZipLib.Zip.Compression.Inflater.Decode' method, which if you check the source code for the SharpZipLib just decodes the array of deflated bytes.
Related
In the context of N-API node_api.h, what is the maining of the field code of the function napi_throw_type_error? The documentation only says "Optional error code to be set on the error.", usually what kind of data should this contain?
My function is working fine without this parameter, but I am thinking in pass the return code as a string there:
napi_value Node_GI_iDisplayScript(napi_env env, napi_callback_info info)
{
napi_status status;
size_t ulSize;
size_t argc = 1;
napi_value argv[4];
status = napi_get_cb_info(env, info, &argc, argv, NULL, NULL);
if (status != napi_ok) RETURN_ERROR(status);
if (argc < 1) {
napi_throw_type_error(env, NULL, "Wrong number of arguments");
return NULL;
}
char szScript[20000];
status = napi_get_value_string_latin1(env, argv[0], szScript, sizeof(szScript), &ulSize);
if (status != napi_ok) RETURN_ERROR(status);
int iRet = GI_iDisplayScript(szScript);
if (iRet) {
// char szErrorCode[50];
// sprintf(szErrorCode, "%d", iRet);
napi_throw_type_error(env, NULL /* szErrorCode */, "Invalid script");
return NULL;
}
napi_value value;
unsigned char *data;
status = napi_create_arraybuffer(env, gulSize, (void **) &data, &value);
if (status != napi_ok) RETURN_ERROR(status);
memcpy(data, gpvbBmp, gulSize);
return value;
}
Is this an acceptable use?
I am trying to run an executable program on Linux via Mono (as Wine will not comply), and I am given this output. I have searched and do not know what to do:
WARNING: The runtime version supported by this application is unavailable.
Using default runtime: v4.0.30319
cannot open file /root/Desktop/tool\GeoIP.dat
System.IO.DirectoryNotFoundException: Directory '/root/Desktop/tool\plugin\' not found.
at System.IO.Directory.ValidateDirectoryListing (System.String path, System.String searchPattern, System.Boolean& stop) <0x7f11f1ba74c0 + 0x0019c> in :0
at System.IO.Directory.GetFileSystemEntries (System.String path, System.String searchPattern, FileAttributes mask, FileAttributes attrs) <0x7f11f1ba7700 + 0x00066> in :0
at System.IO.Directory.GetFiles (System.String path, System.String searchPattern) <0x7f11f1ba6d50 + 0x00018> in :0
at njRAT.Form1. (System.Object , System.EventArgs ) <0x4102ea90 + 0x006ea> in :0
at System.Windows.Forms.Form.OnLoad (System.EventArgs e) <0x410218f0 + 0x00071> in :0
at System.Windows.Forms.Form.OnLoadInternal (System.EventArgs e) <0x410216d0 + 0x0007f> in :0
System.NullReferenceException: Object reference not set to an instance of an object
at +. () <0x4103f510 + 0x001e6> in :0
at njRAT.Form1. (System.Object , System.Windows.Forms.FormClosingEventArgs ) <0x4103e250 + 0x000ab> in :0
at System.Windows.Forms.Form.OnFormClosing (System.Windows.Forms.FormClosingEventArgs e) <0x4103e1c0 + 0x00065> in :0
at System.Windows.Forms.Form.FireClosingEvents (CloseReason reason, Boolean cancel) <0x4103e070 + 0x0009d> in :0
at (wrapper remoting-invoke-with-check) System.Windows.Forms.Form:FireClosingEvents (System.Windows.Forms.CloseReason,bool)
at System.Windows.Forms.Application.Exit (System.ComponentModel.CancelEventArgs e) <0x4103db20 + 0x001b7> in :0
at System.Windows.Forms.Application.Exit () <0x4103dae0 + 0x00027> in :0
at System.Windows.Forms.Application.OnThreadException (System.Exception t) <0x4103d630 + 0x00147> in :0
at System.Windows.Forms.Form.OnLoadInternal (System.EventArgs e) <0x410216d0 + 0x00097> in :0
at System.Windows.Forms.Form.OnCreateControl () <0x41020ef0 + 0x0004f> in :0
at System.Windows.Forms.Control.CreateControl () <0x412a3170 + 0x0011f> in :0
at System.Windows.Forms.Control.WmShowWindow (System.Windows.Forms.Message& m) <0x412ab7b0 + 0x00167> in :0
at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) <0x412aa4a0 + 0x002d7> in :0
at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message& m) <0x4101b3b0 + 0x00013> in :0
at System.Windows.Forms.ContainerControl.WndProc (System.Windows.Forms.Message& m) <0x4101b330 + 0x0005b> in :0
at System.Windows.Forms.Form.WndProc (System.Windows.Forms.Message& m) <0x4101af50 + 0x00257> in :0
at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) <0x412aa470 + 0x00024> in :0
at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) <0x412aa430 + 0x00036> in :0
at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) <0x412a8d70 + 0x0031c> in :0
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at +. () <0x4103f510 + 0x001e6> in :0
at njRAT.Form1. (System.Object , System.Windows.Forms.FormClosingEventArgs ) <0x4103e250 + 0x000ab> in :0
at System.Windows.Forms.Form.OnFormClosing (System.Windows.Forms.FormClosingEventArgs e) <0x4103e1c0 + 0x00065> in :0
at System.Windows.Forms.Form.FireClosingEvents (CloseReason reason, Boolean cancel) <0x4103e070 + 0x0009d> in :0
at (wrapper remoting-invoke-with-check) System.Windows.Forms.Form:FireClosingEvents (System.Windows.Forms.CloseReason,bool)
at System.Windows.Forms.Application.Exit (System.ComponentModel.CancelEventArgs e) <0x4103db20 + 0x001b7> in :0
at System.Windows.Forms.Application.Exit () <0x4103dae0 + 0x00027> in :0
at System.Windows.Forms.Application.OnThreadException (System.Exception t) <0x4103d630 + 0x00147> in :0
at System.Windows.Forms.NativeWindow.OnThreadException (System.Exception e) <0x41040a70 + 0x00013> in :0
at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) <0x412a8d70 + 0x00b51> in :0
at System.Windows.Forms.XplatUIX11.SendMessage (IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam) <0x412a8650 + 0x0044f> in :0
at System.Windows.Forms.XplatUIX11.MapWindow (System.Windows.Forms.Hwnd hwnd, WindowType windows) <0x412ab2d0 + 0x001f3> in :0
at System.Windows.Forms.XplatUIX11.CreateWindow (System.Windows.Forms.CreateParams cp) <0x412a37e0 + 0x00c53> in :0
at System.Windows.Forms.XplatUI.CreateWindow (System.Windows.Forms.CreateParams cp) <0x412a37b0 + 0x0001f> in :0
at System.Windows.Forms.NativeWindow.CreateHandle (System.Windows.Forms.CreateParams cp) <0x412a3700 + 0x0003f> in :0
at System.Windows.Forms.Control.CreateHandle () <0x412a3420 + 0x00069> in :0
at System.Windows.Forms.Form.CreateHandle () <0x41019c40 + 0x00027> in :0
at System.Windows.Forms.Control.CreateControl () <0x412a3170 + 0x00087> in :0
at System.Windows.Forms.Control.SetVisibleCore (Boolean value) <0x412b4bb0 + 0x00083> in :0
at System.Windows.Forms.Form.SetVisibleCore (Boolean value) <0x41019420 + 0x00317> in :0
at System.Windows.Forms.Control.set_Visible (Boolean value) <0x412b4b30 + 0x00032> in :0
at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:set_Visible (bool)
at System.Windows.Forms.Application.RunLoop (Boolean Modal, System.Windows.Forms.ApplicationContext context) <0x41017ec0 + 0x0033f> in :0
at System.Windows.Forms.Application.Run (System.Windows.Forms.ApplicationContext context) <0x41017e10 + 0x00057> in :0
at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm) <0x41017dc0 + 0x00033> in :0
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun () <0x4125e9d0 + 0x00077> in :0
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run (System.String[] commandLine) <0x4125e9b0 + 0x00010> in :0
at . (System.String[] ) <0x4125bd50 + 0x00043> in :0
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
at +. () <0x4103f510 + 0x001e6> in :0
at njRAT.Form1. (System.Object , System.Windows.Forms.FormClosingEventArgs ) <0x4103e250 + 0x000ab> in :0
at System.Windows.Forms.Form.OnFormClosing (System.Windows.Forms.FormClosingEventArgs e) <0x4103e1c0 + 0x00065> in :0
at System.Windows.Forms.Form.FireClosingEvents (CloseReason reason, Boolean cancel) <0x4103e070 + 0x0009d> in :0
at (wrapper remoting-invoke-with-check) System.Windows.Forms.Form:FireClosingEvents (System.Windows.Forms.CloseReason,bool)
at System.Windows.Forms.Application.Exit (System.ComponentModel.CancelEventArgs e) <0x4103db20 + 0x001b7> in :0
at System.Windows.Forms.Application.Exit () <0x4103dae0 + 0x00027> in :0
at System.Windows.Forms.Application.OnThreadException (System.Exception t) <0x4103d630 + 0x00147> in :0
at System.Windows.Forms.NativeWindow.OnThreadException (System.Exception e) <0x41040a70 + 0x00013> in :0
at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) <0x412a8d70 + 0x00b51> in :0
at System.Windows.Forms.XplatUIX11.SendMessage (IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam) <0x412a8650 + 0x0044f> in :0
at System.Windows.Forms.XplatUIX11.MapWindow (System.Windows.Forms.Hwnd hwnd, WindowType windows) <0x412ab2d0 + 0x001f3> in :0
at System.Windows.Forms.XplatUIX11.CreateWindow (System.Windows.Forms.CreateParams cp) <0x412a37e0 + 0x00c53> in :0
at System.Windows.Forms.XplatUI.CreateWindow (System.Windows.Forms.CreateParams cp) <0x412a37b0 + 0x0001f> in :0
at System.Windows.Forms.NativeWindow.CreateHandle (System.Windows.Forms.CreateParams cp) <0x412a3700 + 0x0003f> in :0
at System.Windows.Forms.Control.CreateHandle () <0x412a3420 + 0x00069> in :0
at System.Windows.Forms.Form.CreateHandle () <0x41019c40 + 0x00027> in :0
at System.Windows.Forms.Control.CreateControl () <0x412a3170 + 0x00087> in :0
at System.Windows.Forms.Control.SetVisibleCore (Boolean value) <0x412b4bb0 + 0x00083> in :0
at System.Windows.Forms.Form.SetVisibleCore (Boolean value) <0x41019420 + 0x00317> in :0
at System.Windows.Forms.Control.set_Visible (Boolean value) <0x412b4b30 + 0x00032> in :0
at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:set_Visible (bool)
at System.Windows.Forms.Application.RunLoop (Boolean Modal, System.Windows.Forms.ApplicationContext context) <0x41017ec0 + 0x0033f> in :0
at System.Windows.Forms.Application.Run (System.Windows.Forms.ApplicationContext context) <0x41017e10 + 0x00057> in :0
at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm) <0x41017dc0 + 0x00033> in :0
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun () <0x4125e9d0 + 0x00077> in :0
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run (System.String[] commandLine) <0x4125e9b0 + 0x00010> in :0
at . (System.String[] ) <0x4125bd50 + 0x00043> in :0
Nothing to do with the warning, but an exception showed later. Your form tries to load an GeoIP file from disk but it uses a Windows only file path which definitely fails on Linux. Learn the file system differences and revise your code.
I'm currently working on a project to convert from postfix to infix using a stack implemented through a linked list. I'm trying to take in a line and then pushing each character onto a stack however I keep getting the error.
Error: invalid user-defined conversion from ‘char’ to ‘const stack_element& {aka const std::basic_string&}’
Here is my code:
#include "stack.h"
string convert(string expression)
{
stack c;
string post = " ";
for (int i =0; i<expression.length(); i++)
{
c.push(expression[i]);
}
}
int main()
{
string expression;
cout<<" Enter a Post Fix expression: ";
getline(cin,expression);
return 0;
}
and here is the push function written in another .cpp file
void stack::push(const stack_element & item)
{
cout<<"Inside push \n";
stack_node *p = new stack_node;
p->data = item;
p->next = s_top;
s_top = p;
}
do not use const as parameter in your push function
void stack::push(stack_element & item)
Change void stack::push(const stack_element & item)
to void stack::push(cons char& item) , As in your case , you are trying to create stac of characters . If you want generic use templates.
I have the following signature from c++
IDTECHREADER_EXPORTS void ReadTwoBlocks(char *pathConfig,
char *datablock1, char *datablock2, int timeout, bool &ret )
I was able to Marshal this correctly on the Full .NetFrameWork and it works as below
[DllImport("IDTechReader.dll", EntryPoint = "ReadTwoBlocks" )]
private static extern void _ReadTwoBlocks(
[In][MarshalAs(UnmanagedType.LPStr)] string pathConfig,
[Out][MarshalAs(UnmanagedType.LPStr)] StringBuilder datablock1,
[Out] [MarshalAs(UnmanagedType.LPStr)] StringBuilder datablock2,
int TimeOut,
ref bool result);
However using the same Marshaling as above doesn't work on the NetcompactFramework(Windows CE) it gives an error "NotSupported Exception"
How do we correctly Marshal the above C++ method signature so that it will work correctly on the .NET CompactFramework(windows CE)
any ideas are apperciated...thanks.
The marshaler is probably choking on the MarshalAs(UnmanagedType.LPStr). You're either going to have to change the signature to a fixed size byte[] and do the string conversion in managed code using Encoding.ASCII.GetString(), or you could use an IntPtr type and allocate the memory using Marshal.AllocHGlobal/FreeHGlobal and deal with the string conversion in your code.
I think this might work..
private const int MAX_STRING = 256;
[DllImport("IDTechReader.dll", EntryPoint = "ReadTwoBlocks")]
private static extern void _ReadTwoBlocks(
byte[] pathConfig,
[Out] byte[] datablock1,
[Out] byte[] datablock2,
int TimeOut,
ref bool result);
public void ReadTwoBlocks(string pathConfig,
StringBuilder datablock1,
StringBuilder datablock2,
int TimeOut,
ref bool result)
{
var pathConfigBuff = new byte[MAX_STRING];
var datablock1Buff = new byte[MAX_STRING];
var datablock2Buff = new byte[MAX_STRING];
// Convert unicode string to null terminated single byte charater string
Array.Copy(Encoding.ASCII.GetBytes(pathConfig), pathConfigBuff, pathConfig.Length);
// Call your native method
_ReadTwoBlocks(pathConfigBuff, datablock1Buff, datablock2Buff, TimeOut, ref result);
// If success, copy the datablocks to the StringBuffers
if (result)
{
datablock1.Append(Encoding.ASCII.GetString(datablock1Buff, 0, MAX_STRING).Replace('\0', ' ').Trim());
datablock2.Append(Encoding.ASCII.GetString(datablock2Buff, 0, MAX_STRING).Replace('\0', ' ').Trim());
}
}
It would be something like this:
[DllImport("IDTechReader.dll")]
private static extern void ReadTwoBlocks(IntPtr pathConfig,
IntPtr datablock1, IntPtr datablock2, int timeout, ref bool ret);
and when you use it like this:
string pathConfig = "..\program.ini";
IntPtr ptrPathConfig = IntPtr.Zero;
ptrPathConfig = Marshal.StringToHGlobalAnsi(pathConfig);
IntPtr ptrDatablock1 = IntPtr.Zero;
IntPtr ptrDatablock2 = IntPtr.Zero;
int timeout = 300;
bool ret = false;
ReadTwoBlocks(ptrPathConfig, ptrDatablock1, ptrDatablock2, timeout, ref ret);
string db1 = Marshal.PtrToStringAnsi(ptrDatablock1);
string db2 = Marshal.PtrToStringAnsi(ptrDatablock2);
I have a problem using multiple UIBarButtonItems within a UIToolbar on one side of a UINavigationController. I‘ve used one of the many examples on how to put multiple buttons in the navigation bar (using a toolbar), and while I got it displaying correctly now, I always get an unkown Objective-C exception thrown when a button is pressed.
This is the full test UIViewController I use for adding multiple buttons:
using System;
using System.Drawing;
using MonoTouch.UIKit;
namespace TestProject
{
public class Test : UIViewController
{
public override void ViewDidLoad ()
{
base.ViewDidLoad();
UIBarButtonItem btn1 = new UIBarButtonItem( "foo", UIBarButtonItemStyle.Bordered, delegate(object sender, EventArgs e) {
Console.WriteLine( "asdf" );
} );
UIBarButtonItem btn2 = new UIBarButtonItem();
btn2.Style = UIBarButtonItemStyle.Bordered;
btn2.Title = "bar";
btn2.Clicked += delegate(object sender, EventArgs e) {
Console.WriteLine( "fdsa" );
};
UIToolbar tb = new UIToolbar( new RectangleF( 0, 0, 150, 44.0f ) );
tb.SetItems( new UIBarButtonItem[] { btn1, btn2 }, false );
NavigationItem.RightBarButtonItem = new UIBarButtonItem( tb );
}
}
}
I put that controller within a UINavigationController and display its view as the only window content. Everything works fine, until I click one of the buttons:
Error connecting stdout and stderr (127.0.0.1:10001)
Stacktrace:
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x0009f, 0xffffffff>
at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x00038] in /Developer/MonoTouch/Source/monotouch/monotouch/UIKit/UIApplication.cs:26
at TestProject.Application.Main (string[]) [0x00000] in /Users/Apple/Projects/TestProject/TestProject/Main.cs:16
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>
Native stacktrace:
0 TestProject 0x000d0de8 mono_handle_native_sigsegv + 343
1 TestProject 0x0000f74c mono_sigsegv_signal_handler + 322
2 libSystem.B.dylib 0x906fc45b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 UIKit 0x01ee6cc3 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 156
5 UIKit 0x01cd44fd -[UIApplication sendAction:to:from:forEvent:] + 119
6 UIKit 0x01d64799 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x01d66c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
8 UIKit 0x01d657d8 -[UIControl touchesEnded:withEvent:] + 458
9 UIKit 0x01cf8ded -[UIWindow _sendTouchesForEvent:] + 567
10 UIKit 0x01cd9c37 -[UIApplication sendEvent:] + 447
11 UIKit 0x01cdef2e _UIApplicationHandleEvent + 7576
12 GraphicsServices 0x0404f992 PurpleEventCallback + 1550
13 CoreFoundation 0x00ea2944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
14 CoreFoundation 0x00e02cf7 __CFRunLoopDoSource1 + 215
15 CoreFoundation 0x00dfff83 __CFRunLoopRun + 979
16 CoreFoundation 0x00dff840 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x00dff761 CFRunLoopRunInMode + 97
18 GraphicsServices 0x0404e1c4 GSEventRunModal + 217
19 GraphicsServices 0x0404e289 GSEventRun + 115
20 UIKit 0x01ce2c93 UIApplicationMain + 1160
21 ??? 0x077efe64 0x0 + 125763172
22 ??? 0x077ef1e2 0x0 + 125759970
23 ??? 0x077ef0be 0x0 + 125759678
24 ??? 0x077ef145 0x0 + 125759813
25 TestProject 0x0000f507 mono_jit_runtime_invoke + 1332
26 TestProject 0x001ed259 mono_runtime_invoke + 137
27 TestProject 0x001ef940 mono_runtime_exec_main + 669
28 TestProject 0x001eed2a mono_runtime_run_main + 843
29 TestProject 0x000a3093 mono_jit_exec + 200
30 TestProject 0x002a163d main + 4060
31 TestProject 0x00002819 _start + 208
32 TestProject 0x00002748 start + 40
Debug info from gdb:
dyld: could not load inserted library: /Users/Apple/Library/Application Support/iPhone Simulator/4.3/Applications/86C48AC1-821F-49DD-B344-58471F02D31B/TestProject.app/monotouch-fixes.dylib
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Does anyone know what‘s causing this, and more importantly how to avoid it? When setting just a single button as the RightBarButtonItem it works without any problems.
edit
Above error seems to randomly cycle with this one:
Error connecting stdout and stderr (127.0.0.1:10001)
2011-08-25 13:30:05.409 TestProject[1235:a0b] -[__NSCFSet InvokeAction:]: unrecognized selector sent to instance 0x7168980
Unhandled Exception: MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[__NSCFSet InvokeAction:]: unrecognized selector sent to instance 0x7168980
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Developer/MonoTouch/Source/monotouch/monotouch/UIKit/UIApplication.cs:26
at TestProject.Application.Main (System.String[] args) [0x00000] in /Users/Apple/Projects/TestProject/TestProject/Main.cs:16
[ERROR] FATAL UNHANDLED EXCEPTION: MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[__NSCFSet InvokeAction:]: unrecognized selector sent to instance 0x7168980
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Developer/MonoTouch/Source/monotouch/monotouch/UIKit/UIApplication.cs:26
at TestProject.Application.Main (System.String[] args) [0x00000] in /Users/Apple/Projects/TestProject/TestProject/Main.cs:16
Declare the buttons as class variables. The GC collects them so your event handlers are causing memory leaks.