question

ArturBulakaiev-6276 avatar image
0 Votes"
ArturBulakaiev-6276 asked RobCaplan edited

Get SecRecord work on macOS

Hi!
I'm trying to use SecRecord class with Xamarin for macOS.
When the app is running, I always get the Exception:
System.ArgumentNullException
Value cannot be null
Parameter name: obj

The callstack is:

<myMethod>
Security.SecRecord..ctor()
Foundation.NSMutableDictionary..ctor()
Foundation.NSDictionary..ctor
Foundation.NSObject..ctor
Foundation.NSObject.AllocIfNeeded()
ObjCRuntime.Class.GetHandle() Class.cs:134
ObjCRuntime.Class.GetClassHandle Class.cs : 181
ObjCRuntime.Class.GetClassHandle() Class.cs :151

My code looks like in example from site:

var queryRec = new SecRecord(SecKind.GenericPassword)
{
Service = "123",
Account = "1234",
};

but I've checked, it occures with any SecRecord construction.

This issue is not new, someone met it before: https://stackoverflow.com/questions/50936376/net-core-c-sharp-macos-keychain-api
But he did not find the answer.

What could I do to fix this?

dotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers