Bug 17579 - System.ArgumentException when getting MonoTouch.Security.SecRecord.Accessible
Summary: System.ArgumentException when getting MonoTouch.Security.SecRecord.Accessible
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 7.0.6.x
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: 7.2.1
Assignee: Sebastien Pouliot
URL:
Depends on:
Blocks:
 
Reported: 2014-02-03 14:55 UTC by Jonathan Bird
Modified: 2014-03-20 07:01 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Demonstration Project (1.43 MB, application/zip)
2014-02-03 14:55 UTC, Jonathan Bird
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Jonathan Bird 2014-02-03 14:55:55 UTC
Created attachment 5963 [details]
Demonstration Project

Exception is thrown when getting MonoTouch.Security.SecRecord.Accessible on a record retrieved from SecKeyChain.QueryAsRecord().

SecStatusCode res;
var match = SecKeyChain.QueryAsRecord (searchRec, out res);
if (res == SecStatusCode.Success) {
    var accessibility = match.Accessible;  // Crashes here with System.ArgumentException
}

Full demonstration attached.
Comment 1 Sebastien Pouliot 2014-02-03 22:20:04 UTC
It looks like it's created correctly - but it does not match what was expected when read back (and the unknown value triggers the ArgumentException)
Comment 2 Sebastien Pouliot 2014-02-04 18:52:45 UTC
Fixed maccore / 8b3b9efd1dd37c03796f5d2bc715a0f2d2db1b71

It was a comparison issue (internally this is represented as an opaque CFType and more than one pointer can be used to represent the same value).

Keeping the bug open to review if the same pattern was used elsewhere.
Comment 3 Sebastien Pouliot 2014-02-10 14:20:51 UTC
SecProtocol and SecAuthenticationType had the same issue.

Fixed: master 7a0ae845c85a068e4135277a7ec0e755e67ba150

QA: unit tests added in the same revision
Comment 4 Ram Chandra 2014-03-20 07:01:45 UTC
I have checked this issue on following builds:

Mac 10.7.5
Xamarin Studio : 4.2.4 (build 32)
Xamarin.iOS : 7.2.1.20 (Trial Edition)
Build Information
Release ID: 402040032
Git revision: a160c35dac9ab9fd32eeadaa171216316d5a5133
Build date: 2014-03-12 13:55:08-04
Xamarin addins: a779416ceabd54981ce812771a4061c942e8b872

This issue is working fine. Now I am not getting any exception(System.ArgumentException) when I try to get MonoTouch.Security.SecRecord.Accessible on a record retrieved from SecKeyChain.QueryAsRecord() on line no 32 i.e "var accessibility = match.Accessible; ". Hence, I am closing this issue.

screencast:  http://www.screencast.com/t/ZH6P0jMlhAR

I observe that when I put a breakpoint on line no 30 i.e. "var match = SecKeyChain.QueryAsRecord (searchRec, out res);" to check the values of "match" variable debugger stops it's execution with the error "Application Terminated with error: The simulated application quit". So I have filed a new bug 18489.

Please let me know if I have to check anything else.