I'm developing a C sharp application in Visual Studio for Mac.
I have set up code signing in the IDE, but now it fails with the following error even though I have not made any changes to the code.
A timestamp was expected but was not found.
Also, when I run the codesign command in the CLI, I get the following results.
$ codesign
-v
--force
--timestamp
--sign [sign_id]
path/to/target_file
Segmentation fault: 11
How can I solve this?
I've already tried the following: Rebuild the certificate.
Add --timestamp=none(Signing works, but error when getting Apple notarization.)
Post
Replies
Boosts
Views
Activity
I'm developing in Visual Studio for mac using C sharp.
I'm using AXIsProcessTrustedWithOptions() to get accessibility permissions, but sometimes the behavior is strange.
var key = new NSObject[] { FromObject("AXTrustedCheckOptionPrompt") };
var obj = new NSObject[] { FromObject((NSNumber)1) };
var options = NSDictionary.FromObjectsAndKeys(obj, key);
AXIsProcessTrustedWithOptions(options.Handle);
Specifically, it looks like this:
"Accessibility Access" dialog will appear.
Click "Open System Preferences".
There isn't my app in the list and can't turn on
Some users of macOS Mojave are experiencing this issue.
Does anyone have any solutions?
I develop apps using C sharp in Visual Studio for Mac.
The app was originally granted accessibility permissions, but after it was notarized by Apple, it failed to determine if it was granted permissions.
This is how it is determined in the code.
var key = new NSObject[] { FromObject("AXTrustedCheckOptionPrompt") };
var obj = new NSObject[] { FromObject((NSNumber)0) };
var options = NSDictionary.FromObjectsAndKeys(obj, key);
if (!AXIsProcessTrustedWithOptions(options.Handle))
{
//some codes
}
This may or may not occur on different devices.
When I compared the console logs of the devices that this occurred and those that didn't, I noticed the following differences.
tccd handle_TCCAccessCopyInformation(): failed to find an Application URL for bundle ID: old.bundle.id.
I recently changed the bundle ID, but the devices seems to refer to the old bundle ID.
By the way, this problem no longer occurs when I reboot the device.
However, I don't want to force users to go through this procedure, so I'm looking for someone who has a solution to this problem.
I'm developing a C sharp application in Visual Studio for Mac.
I have it set up to be signed with a developer ID signature to get it notarized by Apple.
But it's not working.
Here are the steps.
(1). Sign the code using Visual Studio for Mac.
(2). However, this .app file will crash.
(3). When I create a dmg and request notarization with the xcrun altool command, I get the following error.
{
	"logFormatVersion": 1,
	"jobId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
	"status": "Invalid",
	"statusSummary": "Archive contains critical validation errors",
	"statusCode": 4000,
	"archiveFilename": "MyApp.dmg",
	"uploadDate": "2020-08-18T08:29:55Z",
	"sha256": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
	"ticketContents": null,
	"issues": [
		{
			"severity": "error",
			"code": null,
			"path": "MyApp.dmg/MyApp.app/Contents/MonoBundle/SQLite.Interop.dll",
			"message": "The signature of the binary is invalid.",
			"docUrl": null,
			"architecture": "x86_64"
		}
	]
}
Even if this succeeds, it won't matter because it will crash...
Thinking that SQLite.Interop.dll was the cause, I signed the code directly after step (1) and it started successfully.
$ codesign --force --verify --verbose \
		--sign "Developer ID Application: MyCompany (XXXXXXXXX)" \
		"SQLite.Interop.dll" \
		--deep \
		--options runtime \
		--timestamp
However, requesting a notarization with the xcrun altool command returns an error like this:
{
	"logFormatVersion": 1,
	"jobId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
	"status": "Invalid",
	"statusSummary": "Archive contains critical validation errors",
	"statusCode": 4000,
	"archiveFilename": "MyApp.dmg",
	"uploadDate": "2020-08-18T08:29:55Z",
	"sha256": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
	"ticketContents": null,
	"issues": [
		{
			"severity": "error",
			"code": null,
			"path": "MyApp.dmg/MyApp.app/Contents/MacOS/MyApp",
			"message": "The signature of the binary is invalid.",
			"docUrl": null,
			"architecture": "x86_64"
		}
	]
}
I thins this is due to a change in the signature of the dependency SQLite.Interop.dll, which has resulted in an incorrect signature in MyApp.
How can I solve this?
Here's what I've already tried. Manually sign MyApp.dmg/MyApp.app/Contents/MacOS/MyApp again.
Sign SQLite.Interop.dll manually before the procedure (1).
Here is some information that will assist
Settings for signing .csproj files
	<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
		<Optimize>true</Optimize>
		<OutputPath>bin\Release</OutputPath>
		<ErrorReport>prompt</ErrorReport>
		<WarningLevel>4</WarningLevel>
		<EnableCodeSigning>true</EnableCodeSigning>
		<CreatePackage>false</CreatePackage>
		<EnablePackageSigning>false</EnablePackageSigning>
		<IncludeMonoRuntime>true</IncludeMonoRuntime>
		<UseSGen>true</UseSGen>
		<UseRefCounting>true</UseRefCounting>
		<LinkMode>SdkOnly</LinkMode>
		<AOTMode>None</AOTMode>
		<CodeSigningKey>Developer ID Application: MyCompany (XXXXXXXXXXX)</CodeSigningKey>
		<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
		<UseHardenedRuntime>true</UseHardenedRuntime>
		<CodeSignEntitlements>Entitlements.plist</CodeSignEntitlements>
		<CodeSignExtraArgs>--deep</CodeSignExtraArgs>
	</PropertyGroup>
Entitlements.plist
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>com.apple.security.cs.allow-jit</key>
<true/>
</dict>
</plist>
I'm using SQLite.Interop.dll in System.Data.SQLite.Core, which I got from NuGet.
packages/System.Data.SQLite.Core.1.0.111.0/runtimes/osx-x64/native/netstandard2.0/SQLite.Interop.dll