Hi Rolf. I have found the bug! And here is my adventure on what it is and how to fix it.
I'm using AdMob library with Alex Desoto implementation, and the protocol crashes when theAdMob library does it's requests (because that i was getting random crashes also). Double checked the AdMob library is for iOS 6 and recompiled again the .net dll with no luck. After some googling, found that AdMob uses internally a ProtocolHandler to make it's requests, which gave me a little clue. To nail down the problem, first I removed the protocol and everything started to work and no random crash. So I modified my protocol to return always false to CanInitWithRequest, in theory the query must be propagated until a protocol handles it, so if it was a problem because my protocol was handling it's request it will work. To my surprise it crashed too. After that I removed the AdMob library, created a mini protocol with only CanInitWithRequest and registered my real protocol and this new mini protocol to see if calls where propagated between various protocols, and it did but a WebBrowser in my app stopped working, so a bit of light was seen. So, struggling my brain and a bit desperated went to the assembly inspector to see how was implemented the class and found a veri "nice" thing. CanInitWithRequest must be an static method but is declared as a virtual instance method. Very nice XD. When I wrote the protocol handler, monodevelop detected a CanInitWithRequest, so it said the "new" keyword must be used. But here is the trick, no static CanInitWithRequest method exists and don't know why but that is what was breaking everything. I've removed the new keyword and the browser worked again. And finally I have filtered my protocol to do not handle the admob request and all is working finally. So that's an example on how three letters can destroy a program XD. Hope this helps to anyone having the same problems. A question, should I fill this as a bug or this is an implementation decission?? And thanks for the help :) -- View this message in context: http://monotouch.2284126.n4.nabble.com/Random-crashes-using-NSUrlProtocol-tp4657239p4657262.html Sent from the MonoTouch mailing list archive at Nabble.com. _______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
