diff --git a/.github/fabricbot.json b/.github/fabricbot.json index 1857296f70..6b523c758c 100644 --- a/.github/fabricbot.json +++ b/.github/fabricbot.json @@ -32,6 +32,233 @@ ] } }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssuesOnlyResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "name": "labelAdded", + "parameters": { + "label": "need-repro" + } + } + ] + }, + "eventType": "issue", + "eventNames": [ + "issues", + "project_card" + ], + "taskName": "Add comment when 'need-repro' is applied to issue", + "actions": [ + { + "name": "addReply", + "parameters": { + "comment": "Hi @${issueAuthor}. We have added the \"need-repro\" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/xamarin/xamarin-macios/blob/main/docs/bug-repro.md\n\nThis issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time." + } + } + ] + } + }, + { + "taskType": "scheduled", + "capabilityId": "ScheduledSearch", + "subCapability": "ScheduledSearch", + "version": "1.1", + "config": { + "frequency": [ + { + "weekDay": 1, + "hours": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23 + ], + "timezoneOffset": -5 + }, + { + "weekDay": 2, + "hours": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23 + ], + "timezoneOffset": -5 + }, + { + "weekDay": 3, + "hours": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23 + ], + "timezoneOffset": -5 + }, + { + "weekDay": 4, + "hours": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23 + ], + "timezoneOffset": -5 + }, + { + "weekDay": 5, + "hours": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23 + ], + "timezoneOffset": -5 + } + ], + "searchTerms": [ + { + "name": "isIssue", + "parameters": {} + }, + { + "name": "isOpen", + "parameters": {} + }, { + "name": "hasLabel", + "parameters": { + "label": "need-info" + } + }, + { + "name": "noActivitySince", + "parameters": { + "days": 7 + } + } + ], + "taskName": "[Idle Issue Management] Close stale 'need-info' issues", + "actions": [ + { + "name": "addReply", + "parameters": { + "comment": "Hi @${issueAuthor}. Due to inactivity, we will be closing this issue. Please feel free to re-open this issue if the issue persists. For enhanced visibility, if over 7 days have passed, please open a new issue and link this issue there. Thank you." + } + }, + { + "name": "closeIssue", + "parameters": {} + } + ] + } + }, { "taskType": "scheduled", "capabilityId": "ScheduledSearch", @@ -199,12 +426,12 @@ "name": "isOpen", "parameters": {} }, - { - "name": "hasLabel", - "parameters": { - "label": "need-info" - } - }, + { + "name": "hasLabel", + "parameters": { + "label": "need-repro" + } + }, { "name": "noActivitySince", "parameters": { @@ -212,7 +439,7 @@ } } ], - "taskName": "[Idle Issue Management] Close stale 'need-info' issues", + "taskName": "[Idle Issue Management] Close stale 'need-repro' issues", "actions": [ { "name": "addReply", @@ -246,12 +473,23 @@ "name": "isOpen", "parameters": {} }, - { - "name": "hasLabel", - "parameters": { - "label": "need-info" - } - }, + { + "operator": "or", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "need-info" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "need-repro" + } + } + ] + }, { "operator": "not", "operands": [ @@ -280,7 +518,7 @@ "eventNames": [ "issue_comment" ], - "taskName": "[Idle Issue Management] Replace 'need-info' with 'need-attention' label when the customer comments on an issue", + "taskName": "[Idle Issue Management] Replace 'need-info' and 'need-repro' with 'need-attention' label when the customer comments on an issue", "actions": [ { "name": "removeLabel", @@ -288,6 +526,12 @@ "label": "need-info" } }, + { + "name": "removeLabel", + "parameters": { + "label": "need-repro" + } + }, { "name": "addLabel", "parameters": { @@ -379,6 +623,12 @@ "label": "need-info" } }, + { + "name": "removeLabel", + "parameters": { + "label": "need-repro" + } + }, { "name": "addLabel", "parameters": { @@ -544,5 +794,228 @@ } ] } - } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssuesOnlyResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "name": "isOpen", + "parameters": {} + }, + { + "name": "labelAdded", + "parameters": { + "label": "move-to-vs-feedback" + } + } + ] + }, + "eventType": "issue", + "eventNames": [ + "issues", + "project_card" + ], + "taskName": "Ask user to use VS Feedback for VS issues", + "actions": [ + { + "name": "addReply", + "parameters": { + "comment": "Thanks for the issue report @${issueAuthor}! This issue appears to be a problem with Visual Studio, so we ask that you use the VS feedback tool to report the issue. That way it will get to the routed to the team that owns this experience in VS.\n\nIf you encounter a problem with Visual Studio, we want to know about it so that we can diagnose and fix it. By using the Report a Problem tool, you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks.\n\n1. Go to the [Visual Studio for Windows feedback tool](https://docs.microsoft.com/visualstudio/ide/how-to-report-a-problem-with-visual-studio?view=vs-2022) or [Visual Studio for Mac feedback tool](https://learn.microsoft.com/en-us/visualstudio/mac/report-a-problem?view=vsmac-2022) to report the issue\n2. Close this bug, and consider adding a link to the VS Feedback issue so that others can follow its activity there.\n\nThis issue will be automatically closed in 3 days if there are no further comments." + } + } + ] + } + }, + { + "taskType": "scheduled", + "capabilityId": "ScheduledSearch", + "subCapability": "ScheduledSearch", + "version": "1.1", + "config": { + "frequency": [ + { + "weekDay": 0, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 1, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 2, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 3, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 4, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 5, + "hours": [ + 0, + 6, + 12, + 18 + ] + }, + { + "weekDay": 6, + "hours": [ + 0, + 6, + 12, + 18 + ] + } + ], + "searchTerms": [ + { + "name": "isOpen", + "parameters": {} + }, + { + "name": "hasLabel", + "parameters": { + "label": "move-to-vs-feedback" + } + }, + { + "name": "noActivitySince", + "parameters": { + "days": 3 + } + } + ], + "taskName": "Close 'move-to-vs-feedback' after 3 days of no activity", + "actions": [ + { + "name": "addReply", + "parameters": { + "comment": "This issue is being closed due to inactivity. If this issue is still affecting you, please follow the steps above to use the VS Feedback Tool to report the issue." + } + }, + { + "name": "closeIssue", + "parameters": {} + } + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssueCommentResponder", + "version": "1.0", + "config": { + "conditions": { + "operator": "and", + "operands": [ + { + "name": "isOpen", + "parameters": {} + }, + { + "name": "isAction", + "parameters": { + "action": "created" + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "move-to-vs-feedback" + } + }, + { + "operator": "not", + "operands": [ + { + "name": "noActivitySince", + "parameters": { + "days": 3 + } + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "isCloseAndComment", + "parameters": {} + } + ] + }, + { + "name": "isActivitySender", + "parameters": { + "user": { + "type": "author" + } + } + }, + { + "name": "activitySenderHasPermissions", + "parameters": { + "permissions": "none" + } + } + ] + }, + "eventType": "issue", + "eventNames": [ + "issue_comment" + ], + "taskName": "For issues labeled with 'move-to-vs-feedback' mark as 'need-attention' if there is activity", + "actions": [ + { + "name": "removeLabel", + "parameters": { + "label": "move-to-vs-feedback" + } + }, + { + "name": "addLabel", + "parameters": { + "label": "need-attention" + } + } + ] + } + } ] diff --git a/DOWNLOADS.md b/DOWNLOADS.md index 8ad7ec547f..5fc055e2df 100644 --- a/DOWNLOADS.md +++ b/DOWNLOADS.md @@ -2,7 +2,8 @@ | Date | Version | Package | Release Notes | |------|---------|---------|---------------| -|2022/09/27|16.0.0.72|[xamarin.ios-16.0.0.72.pkg](https://download.visualstudio.microsoft.com/download/pr/60e4de68-2380-4aa3-b12e-2c65838a0bdb/656877ed7c3b5e5b94f7d2fbeb886655/xamarin.ios-16.0.0.72.pkg)|| +|2022/12/15|16.1.1.27|[xamarin.ios-16.1.1.27.pkg](https://download.visualstudio.microsoft.com/download/pr/c8bc547f-869e-4d64-a271-f8b3a29ee545/3d8cfa414fa3e4005dd5b9b9d3817aa4/xamarin.ios-16.1.1.27.pkg)|| +|2022/10/11|16.0.0.72|[xamarin.ios-16.0.0.72.pkg](https://download.visualstudio.microsoft.com/download/pr/81c41aaa-a3d7-4875-8416-d04b472379b7/21d9f6c5ad3a6bc2479b2ec4b0685b6c/xamarin.ios-16.0.0.72.pkg)|| |2022/08/09|15.12.0.2|[xamarin.ios-15.12.0.2.pkg](https://download.visualstudio.microsoft.com/download/pr/e81e04d3-768a-4310-9c9b-f32e8ba00eaa/0e27caf0877adb5c6fe6d634d26da40a/xamarin.ios-15.12.0.2.pkg)|| |2022/06/14|15.10.0.5|[xamarin.ios-15.10.0.5.pkg](https://download.visualstudio.microsoft.com/download/pr/09e9572f-1c2a-4d79-a1e8-5469de9410e8/3c7be8df7e8249f2c3142e4c10ae5523/xamarin.ios-15.10.0.5.pkg)|| |2022/05/23|15.10.0.1|[xamarin.ios-15.10.0.1.pkg](https://download.visualstudio.microsoft.com/download/pr/afed6f32-67b3-4684-b0a4-e2b74d751bce/efaa7d62658b8285baafc2d6fc8f930a/xamarin.ios-15.10.0.1.pkg)|| @@ -169,6 +170,7 @@ | Date | Version | Package | Release Notes | |------|---------|---------|---------------| +|2022/12/15|9.0.0.27|[xamarin.mac-9.0.0.27.pkg](https://download.visualstudio.microsoft.com/download/pr/c8bc547f-869e-4d64-a271-f8b3a29ee545/4fbfc55453fe36fe5bf4128d6d495911/xamarin.mac-9.0.0.27.pkg)|| |2022/08/09|8.12.0.2|[xamarin.mac-8.12.0.2.pkg](https://download.visualstudio.microsoft.com/download/pr/e81e04d3-768a-4310-9c9b-f32e8ba00eaa/bcff5cca8701bc5871b8892fd32fb3e6/xamarin.mac-8.12.0.2.pkg)|| |2022/06/14|8.10.0.5|[xamarin.mac-8.10.0.5.pkg](https://download.visualstudio.microsoft.com/download/pr/09e9572f-1c2a-4d79-a1e8-5469de9410e8/f4ee484851ac275ccd51fcee70451fb0/xamarin.mac-8.10.0.5.pkg)|| |2022/05/23|8.10.0.1|[xamarin.mac-8.10.0.1.pkg](https://download.visualstudio.microsoft.com/download/pr/afed6f32-67b3-4684-b0a4-e2b74d751bce/7a6059ca429d778d1e1a3525a337eb66/xamarin.mac-8.10.0.1.pkg)|| diff --git a/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..3215885075 --- /dev/null +++ b/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..42140c1ba9 --- /dev/null +++ b/Localize/loc/cs/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..081899164f --- /dev/null +++ b/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..b55adfa227 --- /dev/null +++ b/Localize/loc/de/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..a0c6486fa5 --- /dev/null +++ b/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..25badf1c14 --- /dev/null +++ b/Localize/loc/es/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..ad53bd30e3 --- /dev/null +++ b/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..1f4f47b1d6 --- /dev/null +++ b/Localize/loc/fr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..91b11ed76a --- /dev/null +++ b/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..7dfa3fc178 --- /dev/null +++ b/Localize/loc/it/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..9ac5a0742a --- /dev/null +++ b/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..ba8d0b1081 --- /dev/null +++ b/Localize/loc/ja/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..5fc63f6d7a --- /dev/null +++ b/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..7ab158983f --- /dev/null +++ b/Localize/loc/ko/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..0c68f0df46 --- /dev/null +++ b/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..7c170f79b1 --- /dev/null +++ b/Localize/loc/pl/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..5e2b0616f6 --- /dev/null +++ b/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..d5a39daf4b --- /dev/null +++ b/Localize/loc/pt-BR/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..d32131a85f --- /dev/null +++ b/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..39b67d8628 --- /dev/null +++ b/Localize/loc/ru/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..586f7a51ff --- /dev/null +++ b/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..5392194bc6 --- /dev/null +++ b/Localize/loc/tr/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..5f085aef3b --- /dev/null +++ b/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..a90bac6529 --- /dev/null +++ b/Localize/loc/zh-Hans/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..c23fbfa3ad --- /dev/null +++ b/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/csharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl b/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl new file mode 100644 index 0000000000..b80576c389 --- /dev/null +++ b/Localize/loc/zh-Hant/dotnet/Templates/Microsoft.iOS.Templates/ios/fsharp/.template.config/localize/templatestrings.json.lcl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/bug-repro.md b/docs/bug-repro.md new file mode 100644 index 0000000000..ec0796b2a5 --- /dev/null +++ b/docs/bug-repro.md @@ -0,0 +1,159 @@ +# Bug Report Reproduction Guide + +First of all, thank you for reporting this potential bug. Nobody likes bugs +and to help us diagnose and resolve your potential issue as effective and +quickly as possible, we would like to give you a bit more information about +why we ask you for a reproducible example of the problem, and how to provide +one. + +## What is a reproduction? + +A reproduction, reproducible example or just repro for short is the most basic +code to demonstrate the issue that you're seeing. It's the simplest way to +reproduce the issue. Ideally, you should be able to reproduce the issue by +just running the code in the project you have provided and see the problem. If +any reproduction steps are needed, either note them in the issue or include +them in the project somehow. + +## Why do we ask for a reproducible example? + +Depending on your project a codebase can be pretty big. The bigger your +project, the more factors that can be of influence on a bug or issue that you +might be seeing. + +In order to be sure that this is something that is happening in the Apple SDKs +for .NET and not something in your code (or a combination of these things), it +is super helpful to have a small sample that reproduces the issue. This way we +can: + +* better pinpoint the source of the issue +* therefore, we can fix the issue faster +* and we can make sure that the issue is not a false positive + +It also acts as a double-edged sword. When you take your code apart +piece-by-piece in a new project, adding things back one by one, it will become +very clear what different factors are at play here and you might discover that +the issue might be something in your code. At the very least you will be able +to provide a very detailed description of what you're seeing. That helps us +get to the cause faster and resolve the issue quicker. + +### I just want to report a bug, why do you want a reproduction? + +We hear this a lot. We understand you're busy, we're all busy! A reproduction +is not just about pleasing us or you doing our work. As already mentioned +above, it will help you get a better understanding of where the issue is +exactly. We've seen lots of cases where people realized, through a +reproduction, that the solution was right within their reach. Regardless of it +being a bug in this .NET SDK or not. + +We like to see this as a team effort. + +#### But I don't have time for this! + +Please help us, help you! This is an open-source project under the MIT +license. We care about our project and therefore by extension also about your +project. But realize that when you come onto our repo, maybe frustrated +because things are not working and you just drop a one-liner, no reproduction, +mentioning that you don't have the time, that's also not very motivating for +us. On the other end of these GitHub issues are still people. People that are +doing their best to move this project forward, people that do not enjoying +seeing you being blocked. + +Also consider how that comes across. If you don't have the time to report in +detail what is going on, then really how important is the issue? If this is +really important and blocking you, it would seem to make sense to prioritize +getting us all the details to help resolve this faster. We are all here to +help you. But remember that we don't know your project and we don't know any +details, please help us understand and be nice. + +## How to provide a reproduction project? + +With a reproduction we want to rule out a couple of things: + +* The issue is not in your code, but in the iOS/tvOS/macOS/Mac Catalyst SDKs for .NET. +* The issue has not been already resolved in the latest version of the SDK. + +Therefore we would like to propose the following steps to create a reproduction sample: + +* Check if you are using the latest version of the .NET workloads and you can + still reproduce the issue. +* If yes, please check any available preview versions and see if you can + reproduce the issue. +* If you still can, please check to see if there are is an issue already + opened on the repository for it: + * If there is, see if you can add any more detail about your specific case, + that might help to resolve it quicker. If you don't have any additional + information, add an emoji to the first post of the issue so we know how + many people are impacted by this. + * When in doubt, always file a new issue. It's much easier to mark an issue + as a duplicate of another, than it is to split an issue into two (or more) + isssues after an extensive conversation in the issue that effectively + derailed the original issue because it turned out to be something + unrelated. +* If there is no issue for it yet, please open one and provide detailed + answers to everything in the New Issue form. + +At this point we would love for you to include the reproduction. + +* Start with a File > New .NET iOS / tvOS / macOS / Mac Catalyst project, in + other words, a clean, new project. Make sure that you are using the last + version of the .NET workloads. +* Start extracting the code from your project, piece-by-piece, until you have + reached the issue. +* Try to remove some code or make small changes to see how that influences the + issue you're seeing. Remove any code that is not needed to reproduce the + issue. This is noise and will interfere with getting to a cause and + solution. +* Put the code on a GitHub repository and include that link in the issue that + you're opening. +* Get a [binary build log][1] and attach that to the issue as well. + +> **Warning** +> +> **We can't accept any zip files attached to the issue.** If we need the code +> in a zip, we can get that from the GitHub repository. This will also make it +> easier to collaborate. If we think we spot something that doesn't look +> right, we can open a PR on your repro repo (😬) and you can easily see the +> differences. + +## Why can't you just download my zip file reproduction?! + +While we've never had problems with this, it is still a potential attack +vector for hackers and other malicious people. Even unzipping a zip file could +execute code, let alone load code into Visual Studio that we could not +(easily) look at before opening it. Because we value your safety and privacy +as well as our own, we want to make sure that none of this can happen. + +Also, by putting it in a GitHub repo it's easier to potentially collaborate. +We (and our amazing community!) can comment on a piece of code right then and +there and help you further. It can even serve as a nice example for other +people! + +If you don't like to have a lot of repos, you could opt for a repo where on +the `main` branch you put a File > New Project, and from there create branches +for different issues. + +## Big don'ts! + +- Never put any sensitive information in your code. No API keys, credentials, + personal information, etc. +- Never put any propriatary code in your reproduction. We are contractually + not allowed to look at code that you do not own without big legal hassles + and NDA's, that's not fun for anyone. +- Never submit binaries (mostly covered by putting it on a GitHub repo) +- Do not reference external data-sources, this should rarely be needed. +- Always refer to concrete version numbers. Avoid saying "this happens in the + latest version". We don't know if you're using a preview version or maybe + you _think_ you're using the latest version but actually aren't. To avoid + any confusion, always refer to exact version numbers. + +# That's it! + +The first time might take you a bit longer to go through all this, but once +you've done it you'll see it isn't that much more work and it will benefit the +process a lot. + +Thank you so much for taking some of your valuable time to make .NET MAUI the +best version it can be! We really appreciate it. + +[1]: https://github.com/xamarin/xamarin-macios/wiki/Diagnosis#binary-build-logs diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index 94b11f47af..ca379559a4 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -198,7 +198,6 @@ _CollectBundleResources; _RunRidSpecificBuild; - _CompileEntitlements; _DetectAppManifest; _ReadAppManifest; _WriteAppManifest; @@ -221,7 +220,6 @@ _CreatePkgInfo; _SmeltMetal; _TemperMetal; - _CompileEntitlements; _DetectAppManifest; _ReadAppManifest; _WriteAppManifest; @@ -248,13 +246,13 @@ _CreateDebugSettings; _CreateDebugConfiguration; + _CompileEntitlements; $(CreateAppBundleDependsOn); $(CreateAppBundleDependsOn); - _CompileEntitlements; _CreateMergedAppBundle; _PostProcessAppBundle; @@ -330,6 +328,7 @@ _ProcessedColladaAssetsPath=$(_ProcessedColladaAssetsPath); _ProcessedTextureAtlasesPath=$(_ProcessedTextureAtlasesPath); _ProcessedCoreMLModelsPath=$(_ProcessedCoreMLModelsPath); + _CompiledEntitlementsPath=$(_CompiledEntitlementsPath); @@ -1579,7 +1578,7 @@ <_CreateDumpExecutableToSign Include="@(_CreateDumpExecutable -> '$(_DylibPublishDir)%(RelativePath)')" KeepMetadata="false"> $(_CodesignAllocate) true - $(IntermediateOutputPath)Entitlements.xcent + $(_CompiledEntitlementsPath) $(CodesignExtraArgs) $(CodesignKeychain) $(_PreparedResourceRules) diff --git a/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets b/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets index b89871f6f5..86bdc40fef 100644 --- a/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets +++ b/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets @@ -27,7 +27,6 @@ Copyright (C) 2014 Xamarin. All rights reserved. <_PreparedResourceRules> - <_AppBundleName>$(AssemblyName) diff --git a/msbuild/Xamarin.Shared/Xamarin.Shared.props b/msbuild/Xamarin.Shared/Xamarin.Shared.props index e4bf312178..10f0530f89 100644 --- a/msbuild/Xamarin.Shared/Xamarin.Shared.props +++ b/msbuild/Xamarin.Shared/Xamarin.Shared.props @@ -307,6 +307,8 @@ Copyright (C) 2020 Microsoft. All rights reserved. all + + <_AppBundleName>$(AssemblyName) diff --git a/msbuild/Xamarin.Shared/Xamarin.Shared.targets b/msbuild/Xamarin.Shared/Xamarin.Shared.targets index 079b2e686f..b50f783288 100644 --- a/msbuild/Xamarin.Shared/Xamarin.Shared.targets +++ b/msbuild/Xamarin.Shared/Xamarin.Shared.targets @@ -164,8 +164,8 @@ Copyright (C) 2018 Microsoft. All rights reserved. Outputs="$(BindingResourcePath).stamp"> @@ -644,7 +644,7 @@ Copyright (C) 2018 Microsoft. All rights reserved. + Outputs="$(_CompiledEntitlementsPath)"> @@ -658,7 +658,7 @@ Copyright (C) 2018 Microsoft. All rights reserved. BundleIdentifier="$(_BundleIdentifier)" CustomEntitlements="@(CustomEntitlements)" Entitlements="$(CodesignEntitlements)" - CompiledEntitlements="$(DeviceSpecificIntermediateOutputPath)Entitlements.xcent" + CompiledEntitlements="$(_CompiledEntitlementsPath)" IsAppExtension="$(IsAppExtension)" ProvisioningProfile="$(_ProvisioningProfile)" SdkIsSimulator="$(_SdkIsSimulator)" @@ -685,6 +685,10 @@ Copyright (C) 2018 Microsoft. All rights reserved. + + + + @@ -1132,6 +1136,7 @@ Copyright (C) 2018 Microsoft. All rights reserved. <_ProcessedColladaAssetsPath Condition="'$(_ProcessedColladaAssetsPath)' == ''">$(DeviceSpecificIntermediateOutputPath)collada\_ProcessedColladaAssetsPath.items <_ProcessedTextureAtlasesPath Condition="'$(_ProcessedTextureAtlasesPath)' == ''">$(DeviceSpecificIntermediateOutputPath)atlas\_ProcessedTextureAtlasesPath.items <_ProcessedCoreMLModelsPath Condition="'$(_ProcessedCoreMLModelsPath)' == ''">$(DeviceSpecificIntermediateOutputPath)coremlc\_ProcessedCoreMLModelsPath.items + <_CompiledEntitlementsPath Condition="'$(_CompiledEntitlementsPath)' == ''">$(DeviceSpecificIntermediateOutputPath)Entitlements.xcent <_SaveProcessedItems Condition="'$(RuntimeIdentifiers)' != '' And '$(UsingAppleNETSdk)' == 'true'">true diff --git a/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Common.targets b/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Common.targets index af563fb3d8..abf710a05d 100644 --- a/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Common.targets +++ b/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Common.targets @@ -27,7 +27,6 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved. <_CanDeployToDeviceOrSimulator Condition="('$(OutputType)' == 'Exe' Or '$(IsAppExtension)' == 'true') And '$(IsWatchApp)' == 'false'">True <_PreparedResourceRules> - <_AppBundleName>$(AssemblyName) diff --git a/runtime/runtime.m b/runtime/runtime.m index e83c64b015..d063c23d5c 100644 --- a/runtime/runtime.m +++ b/runtime/runtime.m @@ -2830,6 +2830,16 @@ xamarin_locate_assembly_resource_for_root (const char *root, const char *culture } else if (xamarin_file_exists (path)) { return true; } + + if (culture != NULL && *culture != 0) { + // culture-specific directory + if (snprintf (path, pathlen, "%s/%s/.xamarin/%s/%s", root, culture, RUNTIMEIDENTIFIER, resource) < 0) { + LOG (PRODUCT ": Failed to construct path for assembly resource (root directory: '%s', culture: '%s', resource: '%s', runtimeidentifier: %s): %s", root, culture, resource, RUNTIMEIDENTIFIER, strerror (errno)); + return false; + } else if (xamarin_file_exists (path)) { + return true; + } + } #endif // just the file, no extensions, etc. diff --git a/src/AVFoundation/AVAudioPlayer.cs b/src/AVFoundation/AVAudioPlayer.cs index c1111dfbea..c24c47f09f 100644 --- a/src/AVFoundation/AVAudioPlayer.cs +++ b/src/AVFoundation/AVAudioPlayer.cs @@ -23,8 +23,8 @@ // using Foundation; using ObjCRuntime; -using AudioToolbox; using System; +using System.Runtime.InteropServices; #nullable enable @@ -32,58 +32,48 @@ namespace AVFoundation { #if !WATCH public partial class AVAudioPlayer { + [DllImport (Constants.ObjectiveCLibrary, EntryPoint = "objc_msgSend")] + unsafe static extern IntPtr objc_msgSend (IntPtr receiver, IntPtr selector, IntPtr arg1, IntPtr* arg2); + public static AVAudioPlayer? FromUrl (NSUrl url, out NSError? error) { + error = null; + IntPtr url__handle__ = url!.GetNonNullHandle (nameof (url)); + IntPtr handle = Messaging.IntPtr_objc_msgSend (class_ptr, Selector.GetHandle ("alloc")); + IntPtr errorptr = IntPtr.Zero; + if (handle == IntPtr.Zero) + return null; unsafe { - IntPtr errhandle; - IntPtr ptrtohandle = (IntPtr) (&errhandle); - - var ap = new AVAudioPlayer (url, ptrtohandle); - if (ap.Handle == IntPtr.Zero) { - error = Runtime.GetNSObject (errhandle); - return null; - } else - error = null; - return ap; + handle = objc_msgSend (handle, Selector.GetHandle ("initWithContentsOfURL:error:"), url__handle__, &errorptr); } + error = Runtime.GetNSObject (errorptr); + return Runtime.GetNSObject (handle, owns: true); } public static AVAudioPlayer? FromUrl (NSUrl url) { - unsafe { - var ap = new AVAudioPlayer (url, IntPtr.Zero); - if (ap.Handle == IntPtr.Zero) - return null; - - return ap; - } + return FromUrl (url, out _); } public static AVAudioPlayer? FromData (NSData data, out NSError? error) { - unsafe { - IntPtr errhandle; - IntPtr ptrtohandle = (IntPtr) (&errhandle); + error = null; + IntPtr data__handle__ = data!.GetNonNullHandle (nameof (data)); + IntPtr errorptr = IntPtr.Zero; + IntPtr handle = Messaging.IntPtr_objc_msgSend (class_ptr, Selector.GetHandle ("alloc")); - var ap = new AVAudioPlayer (data, ptrtohandle); - if (ap.Handle == IntPtr.Zero) { - error = Runtime.GetNSObject (errhandle); - return null; - } else - error = null; - return ap; + if (handle == IntPtr.Zero) + return null; + unsafe { + handle = objc_msgSend (handle, Selector.GetHandle ("initWithData:error:"), data__handle__, &errorptr); } + error = Runtime.GetNSObject (errorptr); + return Runtime.GetNSObject (handle, owns: true); } public static AVAudioPlayer? FromData (NSData data) { - unsafe { - var ap = new AVAudioPlayer (data, IntPtr.Zero); - if (ap.Handle == IntPtr.Zero) - return null; - - return ap; - } + return FromData (data, out _); } } #endif // !WATCH diff --git a/src/AVFoundation/Events.cs b/src/AVFoundation/Events.cs index 4804cb674d..0b1f85719f 100644 --- a/src/AVFoundation/Events.cs +++ b/src/AVFoundation/Events.cs @@ -361,11 +361,12 @@ namespace AVFoundation { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveInterruption' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveInterruption' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveInterruption' instead.")] #endif @@ -380,11 +381,12 @@ namespace AVFoundation { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveInterruption' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveInterruption' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveInterruption' instead.")] #endif @@ -399,11 +401,12 @@ namespace AVFoundation { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #endif @@ -418,11 +421,12 @@ namespace AVFoundation { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #endif @@ -437,11 +441,12 @@ namespace AVFoundation { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #endif @@ -457,11 +462,12 @@ namespace AVFoundation { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #endif @@ -477,11 +483,12 @@ namespace AVFoundation { } #if NET - [SupportedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("ios6.0", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] + [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #else [Deprecated (PlatformName.iOS, 6, 0, message: "Use 'AVAudioSession.Notification.ObserveAudioRouteChange' instead.")] #endif diff --git a/src/AddressBookUI/.gitignore b/src/AddressBookUI/.gitignore deleted file mode 100644 index 94053bc9bd..0000000000 --- a/src/AddressBookUI/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/*.g.cs diff --git a/src/AppKit/.gitignore b/src/AppKit/.gitignore deleted file mode 100644 index bd99fb0524..0000000000 --- a/src/AppKit/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.g.cs diff --git a/src/AppKit/NSWindow.cs b/src/AppKit/NSWindow.cs index 71604a914f..d9be1d2406 100644 --- a/src/AppKit/NSWindow.cs +++ b/src/AppKit/NSWindow.cs @@ -59,6 +59,7 @@ namespace AppKit { } } +#if !NET static IntPtr selInitWithWindowRef = Selector.GetHandle ("initWithWindowRef:"); // Do not actually export because NSObjectFlag is not exportable. @@ -74,10 +75,15 @@ namespace AppKit { } InitializeReleasedWhenClosed (); } +#endif static public NSWindow FromWindowRef (IntPtr windowRef) { +#if NET + return new NSWindow (windowRef); +#else return new NSWindow (windowRef, NSObjectFlag.Empty); +#endif } void InitializeReleasedWhenClosed () diff --git a/src/AudioUnit/AUEnums.cs b/src/AudioUnit/AUEnums.cs index 8011ee073f..62584f384e 100644 --- a/src/AudioUnit/AUEnums.cs +++ b/src/AudioUnit/AUEnums.cs @@ -172,7 +172,11 @@ namespace AudioUnit { System = 0, } -#if !XAMCORE_3_0 || MONOMAC || __MACCATALYST__ + [MacCatalyst (13, 1)] + [NoTV, NoWatch] +#if NET + [NoiOS] +#endif public enum AudioObjectPropertySelector : uint { PropertyDevices = 1684370979, // 'dev#' Devices = 1684370979, // 'dev#' @@ -189,20 +193,16 @@ namespace AudioUnit { TranslateUIDToBox = 1969841250, // 'uidb' ClockDeviceList = 1668049699, //'clk#' TranslateUidToClockDevice = 1969841251, // 'uidc', -#if XAMCORE_3_0 - [NoiOS][NoTV] -#endif +#if !XAMCORE_5_0 [MacCatalyst (13, 1)] // This is required for .NET, because otherwise the generator thinks it's not available because it's not available on iOS. [Deprecated (PlatformName.iOS, 15, 0, message: "Use the 'ProcessIsMain' element instead.")] + [Deprecated (PlatformName.TvOS, 15, 0, message: "Use the 'ProcessIsMain' element instead.")] [Deprecated (PlatformName.MacCatalyst, 15, 0, message: "Use the 'ProcessIsMain' element instead.")] [Deprecated (PlatformName.MacOSX, 12, 0, message: "Use the 'ProcessIsMain' element instead.")] [Obsolete ("Use the 'ProcessIsMain' element instead.")] ProcessIsMaster = 1835103092, // 'mast' -#if !XAMCORE_3_0 - [iOS (15, 0)] -#else +#endif // !XAMCORE_5_0 [NoiOS] -#endif [MacCatalyst (15, 0), Mac (12, 0), NoTV, NoWatch] ProcessIsMain = 1835100526, // 'main' IsInitingOrExiting = 1768845172, // 'inot' @@ -217,15 +217,16 @@ namespace AudioUnit { ActualSampleRate = 1634955892,// 'asrt', ClockDevice = 1634755428, // 'apcd', IOThreadOSWorkgroup = 1869838183, // 'oswg' -#if !XAMCORE_3_0 - [iOS (15, 0)] -#else [NoiOS] -#endif [MacCatalyst (15, 0), Mac (12, 0), NoTV, NoWatch] ProcessMute = 1634758765, // 'appm' } + [MacCatalyst (13, 1)] + [NoTV, NoWatch] +#if NET + [NoiOS] +#endif public enum AudioObjectPropertyScope : uint { Global = 1735159650, // 'glob' Input = 1768845428, // 'inpt' @@ -233,6 +234,11 @@ namespace AudioUnit { PlayThrough = 1886679669, // 'ptru' } + [MacCatalyst (13, 1)] + [NoTV, NoWatch] +#if NET + [NoiOS] +#endif public enum AudioObjectPropertyElement : uint { #if !NET [Obsolete ("Use the 'Main' element instead.")] @@ -240,7 +246,6 @@ namespace AudioUnit { #endif Main = 0, // 0 } -#endif // !XAMCORE_3_0 || MONOMAC #if XAMCORE_3_0 [Internal] @@ -565,8 +570,11 @@ namespace AudioUnit { AULowShelfCutoffFrequency = 0, AULowShelfGain = 1, +#if !XAMCORE_5_0 // I can't find this value in the headers anymore [Obsoleted (PlatformName.iOS, 7, 0)] + [Obsoleted (PlatformName.MacCatalyst, 13, 1)] AUDCFilterDecayTime = 0, +#endif // AUParametricEQ ParametricEQCenterFreq = 0, diff --git a/src/AudioUnit/AudioComponent.cs b/src/AudioUnit/AudioComponent.cs index 572e46fc8a..12d8128f9f 100644 --- a/src/AudioUnit/AudioComponent.cs +++ b/src/AudioUnit/AudioComponent.cs @@ -460,9 +460,9 @@ namespace AudioUnit { // extern NSImage * __nullable AudioComponentGetIcon (AudioComponent __nonnull comp) __attribute__((availability(macosx, introduced=10.11))); #if NET [SupportedOSPlatform ("macos")] - [SupportedOSPlatform ("ios")] - [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("ios")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("tvos")] [ObsoletedOSPlatform ("macos11.0")] #else [Mac (10,11)] @@ -473,10 +473,10 @@ namespace AudioUnit { #if NET [SupportedOSPlatform ("macos")] - [SupportedOSPlatform ("ios")] - [SupportedOSPlatform ("maccatalyst")] - [SupportedOSPlatform ("tvos")] - [ObsoletedOSPlatform ("macos11.0")] + [UnsupportedOSPlatform ("ios")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("tvos")] + [UnsupportedOSPlatform ("macos")] #else [Mac (10,11)] [Deprecated (PlatformName.MacOSX, 11, 0)] diff --git a/src/BackgroundTasks/Enums.cs b/src/BackgroundTasks/Enums.cs index ed9ac62cd1..16b8d49b90 100644 --- a/src/BackgroundTasks/Enums.cs +++ b/src/BackgroundTasks/Enums.cs @@ -10,6 +10,8 @@ using System; using Foundation; using ObjCRuntime; +#nullable enable + namespace BackgroundTasks { [TV (13, 0), NoWatch, NoMac, iOS (13, 0)] diff --git a/src/BusinessChat/Enums.cs b/src/BusinessChat/Enums.cs index 178df62ed1..69c0403d3b 100644 --- a/src/BusinessChat/Enums.cs +++ b/src/BusinessChat/Enums.cs @@ -1,6 +1,8 @@ using ObjCRuntime; using Foundation; +#nullable enable + namespace BusinessChat { [Mac (10, 13, 4), iOS (11, 3)] diff --git a/src/CFNetwork/CFHTTPMessage.cs b/src/CFNetwork/CFHTTPMessage.cs index 4154932066..b0bf3a5326 100644 --- a/src/CFNetwork/CFHTTPMessage.cs +++ b/src/CFNetwork/CFHTTPMessage.cs @@ -257,7 +257,7 @@ namespace CoreServices { /* CFHTTPAuthenticationRef */ IntPtr auth, /* CFString */ IntPtr username, /* CFString */ IntPtr password, /* CFStreamError* */ out CFStreamError error); - public void ApplyCredentials (CFHTTPAuthentication auth, NetworkCredential credential) + public void ApplyCredentials (CFHTTPAuthentication? auth, NetworkCredential credential) { if (auth is null) ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (auth)); diff --git a/src/CFNetwork/Content.cs b/src/CFNetwork/Content.cs index 1ad7798d65..8c98ef2108 100644 --- a/src/CFNetwork/Content.cs +++ b/src/CFNetwork/Content.cs @@ -37,6 +37,8 @@ using System.Net.Http.Headers; using System.Threading.Tasks; using Foundation; +#nullable enable + namespace CFNetwork { class Content : StreamContent { @@ -61,9 +63,7 @@ namespace CFNetwork { protected override void Dispose (bool disposing) { if (disposing) { - if (responseStream != null) - responseStream.Dispose (); - responseStream = null; + responseStream.Dispose (); } } diff --git a/src/CFNetwork/MessageHandler.cs b/src/CFNetwork/MessageHandler.cs index 2e26aca665..afaebc9ae0 100644 --- a/src/CFNetwork/MessageHandler.cs +++ b/src/CFNetwork/MessageHandler.cs @@ -41,6 +41,8 @@ using CoreFoundation; using CoreServices; using Foundation; +#nullable enable + namespace CFNetwork { [Obsolete ("Use 'System.Net.Http.CFNetworkHandler' or the more recent 'Foundation.NSUrlSessionHandler' instead.")] @@ -54,7 +56,7 @@ namespace CFNetwork { WorkerThread = worker; } - public WorkerThread WorkerThread { + public WorkerThread? WorkerThread { get; private set; } @@ -77,7 +79,7 @@ namespace CFNetwork { * request. * */ - CFHTTPAuthentication auth; + CFHTTPAuthentication? auth; #region implemented abstract members of HttpMessageHandler #if MONOMAC && !NET @@ -121,15 +123,15 @@ namespace CFNetwork { void SetupRequest (HttpRequestMessage request, CFHTTPMessage message, bool isFirstRequest) { - string accept_encoding = null; + string? accept_encoding = null; if ((AutomaticDecompression & DecompressionMethods.GZip) != 0) accept_encoding = "gzip"; if ((AutomaticDecompression & DecompressionMethods.Deflate) != 0) - accept_encoding = accept_encoding != null ? "gzip, deflate" : "deflate"; - if (accept_encoding != null) + accept_encoding = accept_encoding is not null ? "gzip, deflate" : "deflate"; + if (accept_encoding is not null) message.SetHeaderFieldValue ("Accept-Encoding", accept_encoding); - if (request.Content != null) { + if (request.Content is not null) { foreach (var header in request.Content.Headers) { if (!isFirstRequest && header.Key == "Authorization") continue; @@ -139,23 +141,23 @@ namespace CFNetwork { } foreach (var header in request.Headers) { - if ((accept_encoding != null) && header.Key.Equals ("Accept-Encoding")) + if ((accept_encoding is not null) && header.Key.Equals ("Accept-Encoding")) continue; var value = string.Join (",", header.Value); message.SetHeaderFieldValue (header.Key, value); } - if (UseCookies && (CookieContainer != null)) { + if (UseCookies && (CookieContainer is not null)) { string cookieHeader = CookieContainer.GetCookieHeader (request.RequestUri); if (cookieHeader != "") message.SetHeaderFieldValue ("Cookie", cookieHeader); } } - async Task CreateBody (HttpRequestMessage request, CFHTTPMessage message, + async Task CreateBody (HttpRequestMessage request, CFHTTPMessage message, CancellationToken cancellationToken) { - if (request.Content == null) + if (request.Content is null) return null; /* @@ -174,7 +176,7 @@ namespace CFNetwork { * */ var length = request.Content.Headers.ContentLength; - if ((request.Content is StreamContent) || (length == null)) { + if ((request.Content is StreamContent) || (length is null)) { var stream = await request.Content.ReadAsStreamAsync ().ConfigureAwait (false); return new WebRequestStream (stream, cancellationToken); } @@ -210,31 +212,33 @@ namespace CFNetwork { async Task ProcessRequest (HttpRequestMessage request, CFHTTPMessage message, - WebRequestStream body, + WebRequestStream? body, bool retryWithCredentials, CancellationToken cancellationToken, bool isFirstRequest) { cancellationToken.ThrowIfCancellationRequested (); - WebResponseStream stream; - if (body != null) + WebResponseStream? stream; + if (body is not null) stream = WebResponseStream.Create (message, body); else stream = WebResponseStream.Create (message); - if (stream == null) + if (stream is null) throw new HttpRequestException (string.Format ( "Failed to create web request for '{0}'.", request.RequestUri) ); - if (!isFirstRequest) - stream.Stream.ShouldAutoredirect = AllowAutoRedirect; - stream.Stream.AttemptPersistentConnection = GetKeepAlive (request); + if (stream.Stream is not null) { + if (!isFirstRequest) + stream.Stream.ShouldAutoredirect = AllowAutoRedirect; + stream.Stream.AttemptPersistentConnection = GetKeepAlive (request); + } var response = await stream.Open ( - WorkerThread, cancellationToken).ConfigureAwait (true); // with false, we will have a deadlock. + WorkerThread!, cancellationToken).ConfigureAwait (true); // with false, we will have a deadlock. - var status = (HttpStatusCode) response.ResponseStatusCode; + var status = (HttpStatusCode) response!.ResponseStatusCode; if (IsRedirect (status)) { request.Headers.Authorization = null; @@ -247,7 +251,7 @@ namespace CFNetwork { } } - if (retryWithCredentials && (body == null) && + if (retryWithCredentials && (body is null) && (status == HttpStatusCode.Unauthorized) || (status == HttpStatusCode.ProxyAuthenticationRequired)) { if (HandleAuthentication (request.RequestUri, message, response)) { @@ -274,7 +278,7 @@ namespace CFNetwork { return retval; } - string GetReasonPhrase (CFHTTPMessage response) + string? GetReasonPhrase (CFHTTPMessage response) { var line = response.ResponseStatusLine; var match = Regex.Match (line, "HTTP/1.(0|1) (\\d+) (.*)"); @@ -286,7 +290,7 @@ namespace CFNetwork { bool HandleAuthentication (Uri uri, CFHTTPMessage request, CFHTTPMessage response) { - if (Credentials == null) + if (Credentials is null) return false; if (PreAuthenticate) { @@ -298,10 +302,10 @@ namespace CFNetwork { var digest = Credentials.GetCredential (uri, "Digest"); bool ok = false; - if ((basic != null) && (digest == null)) + if ((basic is not null) && (digest is null)) ok = HandleAuthentication ( request, response, CFHTTPMessage.AuthenticationScheme.Basic, basic); - if ((digest != null) && (basic == null)) + if ((digest is not null) && (basic is null)) ok = HandleAuthentication ( request, response, CFHTTPMessage.AuthenticationScheme.Digest, digest); if (ok) @@ -313,9 +317,9 @@ namespace CFNetwork { bool HandlePreAuthentication (Uri uri, CFHTTPMessage message) { - var method = auth.GetMethod (); + var method = auth?.GetMethod (); var credential = Credentials.GetCredential (uri, method); - if (credential == null) + if (credential is null) return false; message.ApplyCredentials (auth, credential); @@ -335,16 +339,16 @@ namespace CFNetwork { void FindAuthenticationObject (CFHTTPMessage response) { - if (auth != null) { + if (auth is not null) { if (auth.IsValid) return; auth.Dispose (); auth = null; } - if (auth == null) { + if (auth is null) { auth = CFHTTPAuthentication.CreateFromResponse (response); - if (auth == null) + if (auth is null) throw new HttpRequestException ("Failed to create CFHTTPAuthentication"); } @@ -354,10 +358,11 @@ namespace CFNetwork { void DecodeHeaders (CFHTTPMessage message, HttpResponseMessage response, Content content) { - using (var dict = message.GetAllHeaderFields ()) { - foreach (var entry in dict) { - DecodeHeader (response, content, entry); - } + using var dict = message.GetAllHeaderFields (); + if (dict is null) + return; + foreach (var entry in dict) { + DecodeHeader (response, content, entry); } } @@ -388,7 +393,7 @@ namespace CFNetwork { protected override void Dispose (bool disposing) { if (disposing) { - if (auth != null) { + if (auth is not null) { auth.Dispose (); auth = null; } diff --git a/src/CFNetwork/WebRequestStream.cs b/src/CFNetwork/WebRequestStream.cs index 219f2247e2..8bc16ba0d2 100644 --- a/src/CFNetwork/WebRequestStream.cs +++ b/src/CFNetwork/WebRequestStream.cs @@ -37,13 +37,15 @@ using CoreFoundation; using CoreServices; using Foundation; +#nullable enable + namespace CFNetwork { class WebRequestStream { Stream stream; CFReadStream readStream; CFWriteStream writeStream; - TaskCompletionSource openTcs; + TaskCompletionSource openTcs; CancellationTokenSource cts; byte [] buffer; @@ -61,7 +63,7 @@ namespace CFNetwork { buffer = new byte [BufferSize]; cts = CancellationTokenSource.CreateLinkedTokenSource (cancellationToken); - openTcs = new TaskCompletionSource (); + openTcs = new TaskCompletionSource (); cts.Token.Register (() => Close ()); diff --git a/src/CFNetwork/WebResponseStream.cs b/src/CFNetwork/WebResponseStream.cs index 04e1dc7cc2..e0582f73fe 100644 --- a/src/CFNetwork/WebResponseStream.cs +++ b/src/CFNetwork/WebResponseStream.cs @@ -39,6 +39,8 @@ using CoreServices; using Foundation; using CFNetwork; +#nullable enable + namespace CFNetwork { /* * For optimal performance and reliability, either only access the @@ -51,55 +53,55 @@ namespace CFNetwork { */ class WebResponseStream : Stream, IDisposable { - CFHTTPStream stream; - WorkerThread worker; - WebRequestStream body; - CancellationTokenSource openCts; - TaskCompletionSource openTcs; - IOperation currentOperation; + CFHTTPStream? stream; + WorkerThread? worker; + WebRequestStream? body; + CancellationTokenSource? openCts; + TaskCompletionSource? openTcs; + IOperation? currentOperation; bool bytesAvailable; bool busy; - Thread mainThread; - Thread workerThread; + Thread? mainThread; + Thread? workerThread; volatile bool crossThreadAccess; object syncRoot; bool open; bool canceled; bool completed; - Exception lastError; + Exception? lastError; - WebResponseStream (CFHTTPStream stream, WebRequestStream body) + WebResponseStream (CFHTTPStream stream, WebRequestStream? body) { this.stream = stream; this.body = body; syncRoot = new object (); } - public static WebResponseStream Create (CFHTTPMessage request) + public static WebResponseStream? Create (CFHTTPMessage request) { var stream = CFStream.CreateForHTTPRequest (request); - if (stream == null) + if (stream is null) return null; return new WebResponseStream (stream, null); } - public static WebResponseStream Create (CFHTTPMessage request, WebRequestStream body) + public static WebResponseStream? Create (CFHTTPMessage request, WebRequestStream body) { var stream = CFStream.CreateForStreamedHTTPRequest (request, body.ReadStream); - if (stream == null) + if (stream is null) return null; return new WebResponseStream (stream, body); } - public static WebResponseStream Create (Uri uri, HttpMethod method, Version version) + public static WebResponseStream? Create (Uri uri, HttpMethod method, Version version) { using (var req = CFHTTPMessage.CreateRequest (uri, method.Method, version)) return Create (req); } - public CFHTTPStream Stream { + public CFHTTPStream? Stream { get { return stream; } } @@ -112,11 +114,11 @@ namespace CFNetwork { { if (disposing) { OnCanceled (); - if (stream != null) { + if (stream is not null) { stream.Dispose (); stream = null; } - if (openCts != null) { + if (openCts is not null) { openCts.Dispose (); openCts = null; } @@ -124,9 +126,9 @@ namespace CFNetwork { base.Dispose (disposing); } - void OnError (Exception error) + void OnError (Exception? error) { - if (error == null) + if (error is null) error = new InvalidOperationException ("Unknown error."); if (completed) @@ -134,13 +136,13 @@ namespace CFNetwork { lastError = error; completed = true; - stream.Close (); + stream?.Close (); if (!open) - openTcs.SetException (error); + openTcs?.SetException (error); var operation = Interlocked.Exchange (ref currentOperation, null); - if (operation != null) + if (operation is not null) operation.SetException (error); } @@ -150,13 +152,13 @@ namespace CFNetwork { return; completed = canceled = true; - stream.Close (); + stream?.Close (); if (!open) - openTcs.SetCanceled (); + openTcs?.SetCanceled (); var operation = Interlocked.Exchange (ref currentOperation, null); - if (operation != null) + if (operation is not null) operation.SetCanceled (); } @@ -166,15 +168,15 @@ namespace CFNetwork { return; completed = true; - stream.Close (); + stream?.Close (); if (!open) { - openTcs.SetException (new InvalidOperationException ()); + openTcs?.SetException (new InvalidOperationException ()); return; } var operation = Interlocked.Exchange (ref currentOperation, null); - if (operation != null) + if (operation is not null) operation.SetCompleted (); } @@ -194,14 +196,14 @@ namespace CFNetwork { { bool isCrossThread; lock (syncRoot) { - if (!open || (currentOperation != null)) + if (!open || (currentOperation is not null)) throw new InvalidOperationException (); if (canceled) { operation.SetCanceled (); return; } - if (lastError != null) { + if (lastError is not null) { operation.SetException (lastError); return; } @@ -225,7 +227,7 @@ namespace CFNetwork { * don't have to worry about any locking or anything. * */ - if ((worker != null) && !Thread.CurrentThread.Equals (workerThread)) { + if ((worker is not null) && !Thread.CurrentThread.Equals (workerThread)) { worker.Post (() => { if (bytesAvailable) OnBytesAvailable (false); @@ -278,7 +280,7 @@ namespace CFNetwork { * */ if (!crossThreadAccess) { - if ((currentOperation == null) || busy) { + if ((currentOperation is null) || busy) { bytesAvailable = true; return; } @@ -296,7 +298,7 @@ namespace CFNetwork { Monitor.Enter (syncRoot); - if ((currentOperation == null) || busy) { + if ((currentOperation is null) || busy) { bytesAvailable = true; Monitor.Exit (syncRoot); return; @@ -331,11 +333,11 @@ namespace CFNetwork { async Task ReadFromServer (bool exitContext) { int index, count; - var buffer = currentOperation.GetBuffer (out index, out count); + var buffer = currentOperation!.GetBuffer (out index, out count); nint ret; try { - ret = stream.Read (buffer, index, count); + ret = stream!.Read (buffer, index, count); } catch (Exception ex) { OnError (ex); return false; @@ -348,7 +350,7 @@ namespace CFNetwork { */ if (ret < 0) { - OnError (stream.GetError ()); + OnError (stream?.GetError ()); return false; } else if (ret == 0) { OnCompleted (); @@ -385,8 +387,8 @@ namespace CFNetwork { if (keepGoing) return true; - var operation = Interlocked.Exchange (ref currentOperation, null); - operation.SetCompleted (); + var operation = Interlocked.Exchange (ref currentOperation, null); + operation?.SetCompleted (); return false; } @@ -407,8 +409,8 @@ namespace CFNetwork { } abstract class Operation : IOperation, IDisposable { - CancellationTokenSource cts; - TaskCompletionSource tcs; + CancellationTokenSource? cts; + TaskCompletionSource tcs; bool completed; protected Operation (WebResponseStream parent, @@ -417,10 +419,10 @@ namespace CFNetwork { cts = CancellationTokenSource.CreateLinkedTokenSource ( cancellationToken); cts.Token.Register (() => parent.OnCanceled ()); - tcs = new TaskCompletionSource (); + tcs = new TaskCompletionSource (); } - public Task Task { + public Task Task { get { return tcs.Task; } } @@ -428,12 +430,12 @@ namespace CFNetwork { get { return completed; } } - protected TaskCompletionSource TaskCompletionSource { + protected TaskCompletionSource TaskCompletionSource { get { return tcs; } } - protected CancellationToken CancellationToken { - get { return cts.Token; } + protected CancellationToken? CancellationToken { + get { return cts?.Token; } } public void SetCanceled () @@ -481,7 +483,7 @@ namespace CFNetwork { { if (disposing) { SetCanceled (); - if (cts != null) { + if (cts is not null) { cts.Dispose (); cts = null; } @@ -511,7 +513,7 @@ namespace CFNetwork { public override async Task Write (int count) { - await destination.WriteAsync (buffer, 0, count, CancellationToken); + await destination.WriteAsync (buffer, 0, count, CancellationToken ?? System.Threading.CancellationToken.None); return true; } @@ -558,11 +560,11 @@ namespace CFNetwork { } } - public async Task Open (WorkerThread worker, + public async Task Open (WorkerThread worker, CancellationToken cancellationToken) { this.worker = worker; - openTcs = new TaskCompletionSource (); + openTcs = new TaskCompletionSource (); openCts = CancellationTokenSource.CreateLinkedTokenSource (cancellationToken); openCts.Token.Register (() => OnCanceled ()); @@ -570,7 +572,7 @@ namespace CFNetwork { mainThread = Thread.CurrentThread; try { - if (worker != null) + if (worker is not null) await worker.Post (c => DoOpen (), openCts.Token); else DoOpen (); @@ -584,8 +586,8 @@ namespace CFNetwork { void DoOpen () { - if (lastError != null) { - openTcs.SetException (lastError); + if (lastError is not null) { + openTcs!.SetException (lastError); return; } @@ -595,26 +597,26 @@ namespace CFNetwork { * */ - stream.ErrorEvent += (sender, e) => { - OnError (stream.GetError ()); + stream!.ErrorEvent += (sender, e) => { + OnError (stream!.GetError ()); }; stream.ClosedEvent += (sender, e) => { if (!open) { open = true; - openTcs.SetResult (stream.GetResponseHeader ()); + openTcs!.SetResult (stream.GetResponseHeader ()); } OnCompleted (); }; stream.HasBytesAvailableEvent += (sender, e) => { if (!open) { open = true; - openTcs.SetResult (stream.GetResponseHeader ()); + openTcs!.SetResult (stream.GetResponseHeader ()); } HasBytesAvailable (); }; stream.OpenCompletedEvent += (sender, e) => { - if (body == null) + if (body is null) return; body.Open (); }; diff --git a/src/CFNetwork/WorkerThread.cs b/src/CFNetwork/WorkerThread.cs index 5eeed2173e..82929bcae8 100644 --- a/src/CFNetwork/WorkerThread.cs +++ b/src/CFNetwork/WorkerThread.cs @@ -38,14 +38,16 @@ using System.Diagnostics; using Foundation; using CoreFoundation; +#nullable enable + using CFRunLoopModeString = global::Foundation.NSString; namespace CFNetwork { public class WorkerThread { - CFRunLoop loop; - Source source; - Context context; + CFRunLoop? loop; + Source? source; + Context? context; CancellationTokenSource cts; ManualResetEventSlim readyEvent; ConcurrentQueue eventQueue = new ConcurrentQueue (); @@ -88,8 +90,9 @@ namespace CFNetwork { public void Stop () { cts.Cancel (); - loop.RemoveSource (source, CFRunLoop.ModeDefault); - loop.Stop (); + if (source is not null) + loop?.RemoveSource (source, CFRunLoop.ModeDefault); + loop?.Stop (); } protected void PostNoResult (Action callback) @@ -100,8 +103,8 @@ namespace CFNetwork { return null; }; eventQueue.Enqueue (ev); - source.Signal (); - loop.WakeUp (); + source?.Signal (); + loop?.WakeUp (); } public Task Post (Action callback) @@ -116,11 +119,11 @@ namespace CFNetwork { callback (c); return null; }; - ev.Tcs = new TaskCompletionSource (); + ev.Tcs = new TaskCompletionSource (); ev.Cts = CancellationTokenSource.CreateLinkedTokenSource (cts.Token, cancellationToken); eventQueue.Enqueue (ev); - source.Signal (); - loop.WakeUp (); + source?.Signal (); + loop?.WakeUp (); try { await ev.Tcs.Task; @@ -129,25 +132,25 @@ namespace CFNetwork { } } - public Task Post (Func callback) + public Task Post (Func callback) { return Post (c => callback (), CancellationToken.None); } - public async Task Post (Func callback, + public async Task Post (Func callback, CancellationToken cancellationToken) { var ev = new Event (); ev.Callback = c => callback (c); - ev.Tcs = new TaskCompletionSource (); + ev.Tcs = new TaskCompletionSource (); ev.Cts = CancellationTokenSource.CreateLinkedTokenSource (cts.Token, cancellationToken); eventQueue.Enqueue (ev); - source.Signal (); - loop.WakeUp (); + source?.Signal (); + loop?.WakeUp (); try { var result = await ev.Tcs.Task; - if (result != null) + if (result is not null) return (T) result; else return default (T); @@ -162,7 +165,7 @@ namespace CFNetwork { if (!eventQueue.TryDequeue (out ev)) return; - if ((ev.Cts != null) && ev.Cts.IsCancellationRequested) { + if ((ev.Cts is not null) && ev.Cts.IsCancellationRequested) { ev.Tcs.SetCanceled (); return; } @@ -171,20 +174,20 @@ namespace CFNetwork { try { var result = ev.Callback (effectiveCts.Token); - if (ev.Tcs != null) + if (ev.Tcs is not null) ev.Tcs.SetResult (result); } catch (TaskCanceledException) { - if (ev.Tcs != null) + if (ev.Tcs is not null) ev.Tcs.SetCanceled (); } catch (Exception ex) { - if (ev.Tcs != null) + if (ev.Tcs is not null) ev.Tcs.SetException (ex); } } struct Event { - public Func Callback; - public TaskCompletionSource Tcs; + public Func Callback; + public TaskCompletionSource Tcs; public CancellationTokenSource Cts; } diff --git a/src/CloudKit/Enums.cs b/src/CloudKit/Enums.cs index d1b7006e5a..72af7b31d4 100644 --- a/src/CloudKit/Enums.cs +++ b/src/CloudKit/Enums.cs @@ -3,6 +3,8 @@ using ObjCRuntime; using Foundation; using System; +#nullable enable + namespace CloudKit { // NSInteger -> CKContainer.h [Watch (3, 0)] diff --git a/src/Contacts/CNEnums.cs b/src/Contacts/CNEnums.cs index 6528f30c5d..6838c2aec3 100644 --- a/src/Contacts/CNEnums.cs +++ b/src/Contacts/CNEnums.cs @@ -11,6 +11,8 @@ using System; using ObjCRuntime; using Foundation; +#nullable enable + namespace Contacts { // NSInteger -> CNContact.h diff --git a/src/CoreHaptics/Enums.cs b/src/CoreHaptics/Enums.cs index eadd27fb12..e62dcbd845 100644 --- a/src/CoreHaptics/Enums.cs +++ b/src/CoreHaptics/Enums.cs @@ -10,6 +10,8 @@ using System; using Foundation; using ObjCRuntime; +#nullable enable + namespace CoreHaptics { [Mac (10, 15), iOS (13, 0), TV (14, 0)] diff --git a/src/CoreLocation/CLEnums.cs b/src/CoreLocation/CLEnums.cs index cd43278d9d..08ac15e299 100644 --- a/src/CoreLocation/CLEnums.cs +++ b/src/CoreLocation/CLEnums.cs @@ -32,6 +32,8 @@ using System; using ObjCRuntime; +#nullable enable + namespace CoreLocation { // NSInteger -> CLError.h diff --git a/src/CoreLocation/CLLocationDistance.cs b/src/CoreLocation/CLLocationDistance.cs deleted file mode 100644 index d1cda7e2e8..0000000000 --- a/src/CoreLocation/CLLocationDistance.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// CLLocationDistance.cs: Type wrapper for CLLocationDistance -// -// Authors: -// Marek Safar (marek.safar@gmail.com) -// -// Copyright 2012-2013, Xamarin, Inc -// -// The class can be either constructed from a string (from user code) -// or from a handle (from iphone-sharp.dll internal calls). This -// delays the creation of the actual managed string until actually -// required -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -// moved to corelocation.cs -#if false - -using System; -using ObjCRuntime; - -namespace CoreLocation { - - public static class CLLocationDistance - { - static double? max_distance; - static double? filter_none; - - public static double MaxDistance { - get { - if (max_distance == null) - max_distance = Dlfcn.GetDouble (Libraries.CoreLocation.Handle, "CLLocationDistanceMax"); - return max_distance.Value; - } - } - - public static double FilterNone { - get { - if (filter_none == null) - filter_none = Dlfcn.GetDouble (Libraries.CoreLocation.Handle, "kCLDistanceFilterNone"); - return filter_none.Value; - } - } - } -} - -#endif diff --git a/src/CoreMedia/CMEnums.cs b/src/CoreMedia/CMEnums.cs index 3e894f649f..1d3049b8cc 100644 --- a/src/CoreMedia/CMEnums.cs +++ b/src/CoreMedia/CMEnums.cs @@ -12,6 +12,8 @@ using System.Runtime.InteropServices; using Foundation; using ObjCRuntime; +#nullable enable + namespace CoreMedia { // FourCharCode -> CMFormatDescription.h diff --git a/src/CoreMedia/Enums.cs b/src/CoreMedia/Enums.cs index cb20506593..77a4cef893 100644 --- a/src/CoreMedia/Enums.cs +++ b/src/CoreMedia/Enums.cs @@ -3,6 +3,8 @@ using System.Runtime.InteropServices; using Foundation; using ObjCRuntime; +#nullable enable + namespace CoreMedia { // keys names got changed at some point, but they all refer to a CMSampleBuffer (there is not CMSample obj) [Watch (6, 0)] diff --git a/src/CoreMidi/MidiCompat.cs b/src/CoreMidi/MidiCompat.cs index d649726494..ae18c76a9a 100644 --- a/src/CoreMidi/MidiCompat.cs +++ b/src/CoreMidi/MidiCompat.cs @@ -5,6 +5,8 @@ using System; using Foundation; using ObjCRuntime; +#nullable enable + namespace CoreMidi { #if !COREBUILD public delegate void MidiCIPropertyChangedHandler (MidiCISession session, byte channel, NSData data); @@ -27,7 +29,7 @@ namespace CoreMidi { => throw new NotSupportedException (); [Obsolete ("Empty stub (not a public API).")] - public virtual MidiCIPropertyChangedHandler PropertyChangedCallback { get; set; } + public virtual MidiCIPropertyChangedHandler? PropertyChangedCallback { get; set; } [Obsolete ("Always throws 'NotSupportedException' (not a public API).")] public virtual void SetProperty (NSData inquiry, byte channel, MidiCIPropertyResponseHandler handler) diff --git a/src/CoreSpotlight/CSCompat.cs b/src/CoreSpotlight/CSCompat.cs index a210bd144a..b911392f61 100644 --- a/src/CoreSpotlight/CSCompat.cs +++ b/src/CoreSpotlight/CSCompat.cs @@ -4,6 +4,8 @@ using System; using System.ComponentModel; using ObjCRuntime; +#nullable enable + namespace CoreSpotlight { #if !NET && IOS @@ -27,7 +29,7 @@ namespace CoreSpotlight { [UnsupportedOSPlatform ("maccatalyst")] [UnsupportedOSPlatform ("macos")] #endif - public virtual string [] ProtectionClasses { + public virtual string []? ProtectionClasses { get => null; set => throw new InvalidOperationException (Constants.ApiRemovedGeneral); } diff --git a/src/CoreSpotlight/CSEnums.cs b/src/CoreSpotlight/CSEnums.cs index fc379abe15..bd4d8cf0cb 100644 --- a/src/CoreSpotlight/CSEnums.cs +++ b/src/CoreSpotlight/CSEnums.cs @@ -11,6 +11,8 @@ using System; using ObjCRuntime; using Foundation; +#nullable enable + namespace CoreSpotlight { // NSInteger -> CNContact.h [NoTV] // CS_TVOS_UNAVAILABLE diff --git a/src/CoreTelephony/CTEnums.cs b/src/CoreTelephony/CTEnums.cs index d45223ba7c..b639438cd4 100644 --- a/src/CoreTelephony/CTEnums.cs +++ b/src/CoreTelephony/CTEnums.cs @@ -1,6 +1,8 @@ using ObjCRuntime; using System; +#nullable enable + namespace CoreTelephony { // untyped enum -> CoreTelephonyDefines.h diff --git a/src/FileProvider/Compat.cs b/src/FileProvider/Compat.cs index eb1a386537..dcc89d6c90 100644 --- a/src/FileProvider/Compat.cs +++ b/src/FileProvider/Compat.cs @@ -3,6 +3,8 @@ using System; using ObjCRuntime; +#nullable enable + namespace FileProvider { #if MONOMAC diff --git a/src/Foundation/.gitignore b/src/Foundation/.gitignore deleted file mode 100644 index d9fb70c58f..0000000000 --- a/src/Foundation/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -/*.g.cs diff --git a/src/Foundation/NSItemProvider.cs b/src/Foundation/NSItemProvider.cs index e278b497cb..f5c9791b1f 100644 --- a/src/Foundation/NSItemProvider.cs +++ b/src/Foundation/NSItemProvider.cs @@ -4,9 +4,7 @@ using CloudKit; using ObjCRuntime; namespace Foundation { -#if MONOMAC || IOS - public partial class NSItemProvider - { + public partial class NSItemProvider { #if !NET && MONOMAC [Obsolete ("Use RegisterCloudKitShare (CloudKitRegistrationPreparationAction) instead.")] public virtual void RegisterCloudKitShare (Action preparationHandler) @@ -15,7 +13,7 @@ namespace Foundation { RegisterCloudKitShare (action); } #endif - + #if MONOMAC public virtual Task RegisterCloudKitShareAsync () { @@ -34,15 +32,14 @@ namespace Foundation { [SupportedOSPlatform ("ios11.0")] [SupportedOSPlatform ("maccatalyst")] #else - [Watch (4,0)] - [TV (11,0)] - [Mac (10,13)] - [iOS (11,0)] + [Watch (4, 0)] + [TV (11, 0)] + [Mac (10, 13)] + [iOS (11, 0)] #endif - public NSProgress LoadObject (Action completionHandler) where T: NSObject, INSItemProviderReading + public NSProgress LoadObject (Action completionHandler) where T : NSObject, INSItemProviderReading { - return LoadObject (new Class (typeof (T)), (rv, err) => - { + return LoadObject (new Class (typeof (T)), (rv, err) => { var obj = rv as T; if (obj == null && rv != null) obj = Runtime.ConstructNSObject (rv.Handle); @@ -56,16 +53,15 @@ namespace Foundation { [SupportedOSPlatform ("ios11.0")] [SupportedOSPlatform ("maccatalyst")] #else - [Watch (4,0)] - [TV (11,0)] - [Mac (10,13)] - [iOS (11,0)] + [Watch (4, 0)] + [TV (11, 0)] + [Mac (10, 13)] + [iOS (11, 0)] #endif - public Task LoadObjectAsync () where T: NSObject, INSItemProviderReading + public Task LoadObjectAsync () where T : NSObject, INSItemProviderReading { var rv = LoadObjectAsync (new Class (typeof (T))); - return rv.ContinueWith ((v) => - { + return rv.ContinueWith ((v) => { var obj = v.Result as T; if (obj == null && v.Result != null) obj = Runtime.ConstructNSObject (v.Result.Handle); @@ -79,16 +75,15 @@ namespace Foundation { [SupportedOSPlatform ("ios11.0")] [SupportedOSPlatform ("maccatalyst")] #else - [Watch (4,0)] - [TV (11,0)] - [Mac (10,13)] - [iOS (11,0)] + [Watch (4, 0)] + [TV (11, 0)] + [Mac (10, 13)] + [iOS (11, 0)] #endif - public Task LoadObjectAsync (out NSProgress result) where T: NSObject, INSItemProviderReading + public Task LoadObjectAsync (out NSProgress result) where T : NSObject, INSItemProviderReading { var rv = LoadObjectAsync (new Class (typeof (T)), out result); - return rv.ContinueWith ((v) => - { + return rv.ContinueWith ((v) => { var obj = v.Result as T; if (obj == null && v.Result != null) obj = Runtime.ConstructNSObject (v.Result.Handle); @@ -96,5 +91,4 @@ namespace Foundation { }); } } -#endif // MONOMAC || IOS } diff --git a/src/Makefile b/src/Makefile index 65181ba941..264e7dd3fb 100644 --- a/src/Makefile +++ b/src/Makefile @@ -72,6 +72,7 @@ DOTNET_REFERENCES = \ /r:$(DOTNET_BCL_DIR)/System.Runtime.CompilerServices.Unsafe.dll \ /r:$(DOTNET_BCL_DIR)/System.Runtime.Extensions.dll \ /r:$(DOTNET_BCL_DIR)/System.Runtime.InteropServices.dll \ + /r:$(DOTNET_BCL_DIR)/System.Runtime.Loader.dll \ /r:$(DOTNET_BCL_DIR)/System.Security.Cryptography.dll \ /r:$(DOTNET_BCL_DIR)/System.Security.Cryptography.X509Certificates.dll \ /r:$(DOTNET_BCL_DIR)/System.Text.RegularExpressions.dll \ diff --git a/src/Metal/MTLRenderCommandEncoder.cs b/src/Metal/MTLRenderCommandEncoder.cs index ed6bd16c8d..716c5fd4c4 100644 --- a/src/Metal/MTLRenderCommandEncoder.cs +++ b/src/Metal/MTLRenderCommandEncoder.cs @@ -15,79 +15,83 @@ namespace Metal { [SupportedOSPlatform ("tvos")] #endif public static class IMTLRenderCommandEncoder_Extensions { -#if MONOMAC +#if !WATCH #if NET [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("maccatalyst")] - [UnsupportedOSPlatform ("ios")] - [UnsupportedOSPlatform ("tvos")] + [SupportedOSPlatform ("ios12.0")] + [SupportedOSPlatform ("tvos14.5")] #else - [Mac (10,13)] - [NoiOS] - [NoTV] + [Mac (10, 13)] + [iOS (12, 0)] + [TV (14, 5)] [NoWatch] #endif public unsafe static void SetViewports (this IMTLRenderCommandEncoder This, MTLViewport [] viewports) { fixed (void* handle = viewports) - This.SetViewports ((IntPtr)handle, (nuint)(viewports?.Length ?? 0)); + This.SetViewports ((IntPtr) handle, (nuint) (viewports?.Length ?? 0)); } +#endif // !WATCH +#if !WATCH #if NET [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("maccatalyst")] - [UnsupportedOSPlatform ("ios")] - [UnsupportedOSPlatform ("tvos")] + [SupportedOSPlatform ("ios12.0")] + [SupportedOSPlatform ("tvos14.5")] #else - [Mac (10,13)] - [NoiOS] - [NoTV] + [Mac (10, 13)] + [iOS (12, 0)] + [TV (14, 5)] [NoWatch] #endif public unsafe static void SetScissorRects (this IMTLRenderCommandEncoder This, MTLScissorRect [] scissorRects) { fixed (void* handle = scissorRects) - This.SetScissorRects ((IntPtr)handle, (nuint)(scissorRects?.Length ?? 0)); + This.SetScissorRects ((IntPtr) handle, (nuint) (scissorRects?.Length ?? 0)); } -#endif +#endif // !WATCH -#if IOS +#if !WATCH #if NET [SupportedOSPlatform ("ios11.0")] [SupportedOSPlatform ("maccatalyst")] - [UnsupportedOSPlatform ("tvos")] - [UnsupportedOSPlatform ("macos")] + [SupportedOSPlatform ("tvos14.5")] + [SupportedOSPlatform ("macos11.0")] #else - [iOS (11,0)] - [NoTV] - [NoMac] + [iOS (11, 0)] + [TV (14, 5)] + [Mac (11, 0)] [NoWatch] #endif - public unsafe static void SetTileBuffers (this IMTLRenderCommandEncoder This, IMTLBuffer[] buffers, nuint[] offsets, NSRange range) + public unsafe static void SetTileBuffers (this IMTLRenderCommandEncoder This, IMTLBuffer [] buffers, nuint [] offsets, NSRange range) { fixed (void* handle = offsets) - This.SetTileBuffers (buffers, (IntPtr)handle, range); + This.SetTileBuffers (buffers, (IntPtr) handle, range); } +#endif // !WATCH +#if !WATCH #if NET [SupportedOSPlatform ("ios11.0")] [SupportedOSPlatform ("maccatalyst")] - [UnsupportedOSPlatform ("tvos")] - [UnsupportedOSPlatform ("macos")] + [SupportedOSPlatform ("tvos14.5")] + [SupportedOSPlatform ("macos11.0")] #else - [iOS (11,0)] - [NoTV] - [NoMac] + [iOS (11, 0)] + [TV (14, 5)] + [Mac (11, 0)] [NoWatch] #endif - public unsafe static void SetTileSamplerStates (this IMTLRenderCommandEncoder This, IMTLSamplerState[] samplers, float[] lodMinClamps, float[] lodMaxClamps, NSRange range) + public unsafe static void SetTileSamplerStates (this IMTLRenderCommandEncoder This, IMTLSamplerState [] samplers, float [] lodMinClamps, float [] lodMaxClamps, NSRange range) { fixed (void* minHandle = lodMinClamps) { fixed (void* maxHandle = lodMaxClamps) { - This.SetTileSamplerStates (samplers, (IntPtr)minHandle, (IntPtr)maxHandle, range); + This.SetTileSamplerStates (samplers, (IntPtr) minHandle, (IntPtr) maxHandle, range); } } } -#endif +#endif // !WATCH } } diff --git a/src/MetricKit/MXMetaData.cs b/src/MetricKit/MXMetaData.cs index 962717a179..22c833ab49 100644 --- a/src/MetricKit/MXMetaData.cs +++ b/src/MetricKit/MXMetaData.cs @@ -1,4 +1,4 @@ -#if IOS +#if IOS || __MACCATALYST__ #nullable enable @@ -12,6 +12,15 @@ namespace MetricKit { public partial class MXMetaData { +#if NET + [SupportedOSPlatform ("ios14.0")] + [SupportedOSPlatform ("maccatalyst14.0")] + [SupportedOSPlatform ("macos12.0")] + [UnsupportedOSPlatform ("tvos")] +#else + [Introduced (PlatformName.iOS, 14, 0)] + [Introduced (PlatformName.MacOSX, 12, 0)] +#endif public virtual NSDictionary DictionaryRepresentation { get { if (SystemVersion.CheckiOS (14,0)) diff --git a/src/NearbyInteraction/NICompat.cs b/src/NearbyInteraction/NICompat.cs index fc7dfaa4eb..1c2b96e17c 100644 --- a/src/NearbyInteraction/NICompat.cs +++ b/src/NearbyInteraction/NICompat.cs @@ -4,6 +4,8 @@ // Copyright (C) Microsoft Corporation. All rights reserved. // +#if !XAMCORE_5_0 + using System; using System.ComponentModel; using System.Threading.Tasks; @@ -29,19 +31,26 @@ using MatrixFloat4x4 = global::OpenTK.NMatrix4; #nullable enable namespace NearbyInteraction { -#if WATCH +#if !__MACOS__ && !__TVOS__ public partial class NISession { -#if !NET +#if WATCH [Obsolete ("This method was removed and will always throw a InvalidOperationException.")] -#endif + [EditorBrowsable (EditorBrowsableState.Never)] public virtual void SetARSession (ARSession session) => throw new InvalidOperationException (Constants.ApiRemovedGeneral); -#if !NET [Obsolete ("This method was removed and will always throw a InvalidOperationException.")] -#endif + [EditorBrowsable (EditorBrowsableState.Never)] public virtual MatrixFloat4x4 GetWorldTransform (NINearbyObject @object) => throw new InvalidOperationException (Constants.ApiRemovedGeneral); +#endif // WATCH - } +#if __MACCATALYST__ + [Obsolete ("This method was removed and will always throw a InvalidOperationException.")] + [EditorBrowsable (EditorBrowsableState.Never)] + public virtual void SetARSession (NSObject session) => throw new InvalidOperationException (Constants.ApiRemovedGeneral); #endif + } +#endif // !__MACOS__ && !__TVOS__ } + +#endif // !XAMCORE_5_0 diff --git a/src/ObjCRuntime/.gitignore b/src/ObjCRuntime/.gitignore deleted file mode 100644 index 94053bc9bd..0000000000 --- a/src/ObjCRuntime/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/*.g.cs diff --git a/src/ObjCRuntime/Class.cs b/src/ObjCRuntime/Class.cs index 3950ea3721..de5f758447 100644 --- a/src/ObjCRuntime/Class.cs +++ b/src/ObjCRuntime/Class.cs @@ -646,25 +646,56 @@ namespace ObjCRuntime { } [DllImport (Messaging.LIBOBJC_DYLIB)] - internal static extern IntPtr objc_allocateClassPair (IntPtr superclass, string name, IntPtr extraBytes); + static extern IntPtr objc_allocateClassPair (IntPtr superclass, IntPtr name, IntPtr extraBytes); + + internal static IntPtr objc_allocateClassPair (IntPtr superclass, string name, IntPtr extraBytes) + { + using var namePtr = new TransientString (name); + return objc_allocateClassPair (superclass, namePtr, extraBytes); + } [DllImport (Messaging.LIBOBJC_DYLIB)] - internal static extern IntPtr objc_getClass (string name); + static extern IntPtr objc_getClass (IntPtr name); + + internal static IntPtr objc_getClass (string name) + { + using var namePtr = new TransientString (name); + return objc_getClass (namePtr); + } [DllImport (Messaging.LIBOBJC_DYLIB)] internal static extern void objc_registerClassPair (IntPtr cls); [DllImport (Messaging.LIBOBJC_DYLIB)] [return: MarshalAs (UnmanagedType.U1)] - internal static extern bool class_addIvar (IntPtr cls, string name, IntPtr size, byte alignment, string types); + static extern bool class_addIvar (IntPtr cls, IntPtr name, IntPtr size, byte alignment, IntPtr types); + + internal static bool class_addIvar (IntPtr cls, string name, IntPtr size, byte alignment, string types) + { + using var namePtr = new TransientString (name); + using var typesPtr = new TransientString (types); + return class_addIvar (cls, namePtr, size, alignment, typesPtr); + } [DllImport (Messaging.LIBOBJC_DYLIB)] [return: MarshalAs (UnmanagedType.U1)] - internal static extern bool class_addMethod (IntPtr cls, IntPtr name, IntPtr imp, string types); + static extern bool class_addMethod (IntPtr cls, IntPtr name, IntPtr imp, IntPtr types); + + internal static bool class_addMethod (IntPtr cls, IntPtr name, IntPtr imp, string types) + { + using var typesPtr = new TransientString (types); + return class_addMethod (cls, name, imp, typesPtr); + } [DllImport (Messaging.LIBOBJC_DYLIB)] [return: MarshalAs (UnmanagedType.U1)] - internal extern static bool class_addMethod (IntPtr cls, IntPtr name, Delegate imp, string types); + internal extern static bool class_addMethod (IntPtr cls, IntPtr name, Delegate imp, IntPtr types); + + internal static bool class_addMethod (IntPtr cls, IntPtr name, Delegate imp, string types) + { + using var typesPtr = new TransientString (types); + return class_addMethod (cls, name, imp, typesPtr); + } [DllImport (Messaging.LIBOBJC_DYLIB)] [return: MarshalAs (UnmanagedType.U1)] @@ -683,14 +714,52 @@ namespace ObjCRuntime { internal extern static IntPtr class_getMethodImplementation (IntPtr cls, IntPtr sel); [DllImport (Messaging.LIBOBJC_DYLIB)] - internal extern static IntPtr class_getInstanceVariable (IntPtr cls, string name); + internal extern static IntPtr class_getInstanceVariable (IntPtr cls, IntPtr name); + + internal static IntPtr class_getInstanceVariable (IntPtr cls, string name) + { + using var namePtr = new TransientString (name); + return class_getInstanceVariable (cls, namePtr); + } [DllImport (Messaging.LIBOBJC_DYLIB)] internal extern static IntPtr class_getInstanceMethod (IntPtr cls, IntPtr sel); [DllImport (Messaging.LIBOBJC_DYLIB, CharSet = CharSet.Ansi)] [return: MarshalAs (UnmanagedType.U1)] - internal extern static bool class_addProperty (IntPtr cls, string name, objc_attribute_prop [] attributes, int count); + extern unsafe static bool class_addProperty (IntPtr cls, IntPtr name, IntPtr* attributes, int count); + + internal static bool class_addProperty (IntPtr cls, string name, objc_attribute_prop [] attributes, int count) + { + using var namePtr = new TransientString (name, TransientString.Encoding.Ansi); + var ptrs = PropertyStringsToPtrs (attributes); + bool retval = false; + unsafe { + fixed (IntPtr* ptrsPtr = ptrs) { + retval = class_addProperty (cls, namePtr, ptrsPtr, count); + } + } + FreeStringPtrs (ptrs); + return retval; + } + + internal static IntPtr [] PropertyStringsToPtrs (objc_attribute_prop [] props) + { + var ptrs = new IntPtr [props.Length * 2]; + var index = 0; + foreach (var prop in props) { + ptrs [index++] = Marshal.StringToHGlobalAnsi (prop.name); + ptrs [index++] = Marshal.StringToHGlobalAnsi (prop.value); + } + return ptrs; + } + + internal static void FreeStringPtrs (IntPtr [] ptrs) + { + foreach (var ptr in ptrs) { + Marshal.FreeHGlobal (ptr); + } + } [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Ansi)] internal struct objc_attribute_prop { diff --git a/src/ObjCRuntime/Dlfcn.cs b/src/ObjCRuntime/Dlfcn.cs index 41f23151cd..eed92987d3 100644 --- a/src/ObjCRuntime/Dlfcn.cs +++ b/src/ObjCRuntime/Dlfcn.cs @@ -109,7 +109,13 @@ namespace ObjCRuntime { public static extern int dlclose (IntPtr handle); [DllImport (Constants.libSystemLibrary, EntryPoint = "dlopen")] - internal static extern IntPtr _dlopen (string? path, Mode mode /* this is int32, not nint */); + static extern IntPtr _dlopen (IntPtr path, Mode mode /* this is int32, not nint */); + + internal static IntPtr _dlopen (string? path, Mode mode /* this is int32, not nint */) + { + using var pathPtr = new TransientString (path); + return _dlopen (pathPtr, mode); + } public static IntPtr dlopen (string? path, int mode) { @@ -148,7 +154,13 @@ namespace ObjCRuntime { } [DllImport (Constants.libSystemLibrary)] - public static extern IntPtr dlsym (IntPtr handle, string symbol); + static extern IntPtr dlsym (IntPtr handle, IntPtr symbol); + + public static IntPtr dlsym (IntPtr handle, string symbol) + { + using var symbolPtr = new TransientString (symbol); + return dlsym (handle, symbolPtr); + } public static IntPtr dlsym (RTLD lookupType, string symbol) { diff --git a/src/ObjCRuntime/Protocol.cs b/src/ObjCRuntime/Protocol.cs index 1033cf981d..913de56a10 100644 --- a/src/ObjCRuntime/Protocol.cs +++ b/src/ObjCRuntime/Protocol.cs @@ -62,19 +62,49 @@ namespace ObjCRuntime { } [DllImport (Messaging.LIBOBJC_DYLIB)] - internal extern static IntPtr objc_getProtocol (string? name); + extern static IntPtr objc_getProtocol (IntPtr name); + + internal static IntPtr objc_getProtocol (string? name) + { + var namePtr = new TransientString (name); + return objc_getProtocol (namePtr); + } [DllImport (Messaging.LIBOBJC_DYLIB)] - internal extern static IntPtr objc_allocateProtocol (string name); + extern static IntPtr objc_allocateProtocol (IntPtr name); + + internal static IntPtr objc_allocateProtocol (string name) + { + using var namePtr = new TransientString (name); + return objc_allocateProtocol (namePtr); + } [DllImport (Messaging.LIBOBJC_DYLIB)] internal extern static void objc_registerProtocol (IntPtr protocol); [DllImport (Messaging.LIBOBJC_DYLIB)] - internal extern static void protocol_addProperty (IntPtr protocol, string name, Class.objc_attribute_prop [] attributes, int count, [MarshalAs (UnmanagedType.I1)] bool isRequired, [MarshalAs (UnmanagedType.I1)] bool isInstance); + extern static unsafe void protocol_addProperty (IntPtr protocol, IntPtr name, IntPtr* attributes, int count, [MarshalAs (UnmanagedType.I1)] bool isRequired, [MarshalAs (UnmanagedType.I1)] bool isInstance); + + internal static void protocol_addProperty (IntPtr protocol, string name, Class.objc_attribute_prop [] attributes, int count, [MarshalAs (UnmanagedType.I1)] bool isRequired, [MarshalAs (UnmanagedType.I1)] bool isInstance) + { + using var namePtr = new TransientString (name); + var propArr = Class.PropertyStringsToPtrs (attributes); + unsafe { + fixed (IntPtr* propArrPtr = propArr) { + protocol_addProperty (protocol, namePtr, propArrPtr, count, isRequired, isInstance); + } + } + Class.FreeStringPtrs (propArr); + } [DllImport (Messaging.LIBOBJC_DYLIB)] - internal extern static void protocol_addMethodDescription (IntPtr protocol, IntPtr nameSelector, string signature, [MarshalAs (UnmanagedType.I1)] bool isRequired, [MarshalAs (UnmanagedType.I1)] bool isInstance); + extern static void protocol_addMethodDescription (IntPtr protocol, IntPtr nameSelector, IntPtr signature, [MarshalAs (UnmanagedType.I1)] bool isRequired, [MarshalAs (UnmanagedType.I1)] bool isInstance); + + internal static void protocol_addMethodDescription (IntPtr protocol, IntPtr nameSelector, string signature, [MarshalAs (UnmanagedType.I1)] bool isRequired, [MarshalAs (UnmanagedType.I1)] bool isInstance) + { + using var signaturePtr = new TransientString (signature); + protocol_addMethodDescription (protocol, nameSelector, signaturePtr, isRequired, isInstance); + } [DllImport (Messaging.LIBOBJC_DYLIB)] internal extern static void protocol_addProtocol (IntPtr protocol, IntPtr addition); diff --git a/src/ObjCRuntime/Runtime.CoreCLR.cs b/src/ObjCRuntime/Runtime.CoreCLR.cs index b2edefa14d..4d77311135 100644 --- a/src/ObjCRuntime/Runtime.CoreCLR.cs +++ b/src/ObjCRuntime/Runtime.CoreCLR.cs @@ -30,6 +30,7 @@ using System.Runtime.CompilerServices; using System.Runtime.ExceptionServices; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ObjectiveC; +using System.Runtime.Loader; using System.Text; using Foundation; @@ -142,6 +143,33 @@ namespace ObjCRuntime { delegate* unmanaged isReferencedCallback = (delegate* unmanaged) options->reference_tracking_is_referenced_callback; delegate* unmanaged trackedObjectEnteredFinalization = (delegate* unmanaged) options->reference_tracking_tracked_object_entered_finalization; ObjectiveCMarshal.Initialize (beginEndCallback, isReferencedCallback, trackedObjectEnteredFinalization, UnhandledExceptionPropagationHandler); + + AssemblyLoadContext.Default.Resolving += ResolvingEventHandler; + } + + [DllImport ("__Internal")] + static extern byte xamarin_locate_assembly_resource (IntPtr assembly_name, IntPtr culture, IntPtr resource, IntPtr path, nint pathlen); + + static bool xamarin_locate_assembly_resource (string assembly_name, string? culture, string resource, [NotNullWhen (true)] out string? path) + { + path = null; + + const int path_size = 1024; + using var assembly_name_ptr = new TransientString (assembly_name); + using var culture_ptr = new TransientString (culture); + using var resource_ptr = new TransientString (resource); + using var path_ptr = new TransientString (path_size); + var rv = xamarin_locate_assembly_resource (assembly_name_ptr, culture_ptr, resource_ptr, path_ptr, path_size) != 0; + if (rv) + path = (string?) path_ptr; + return path is not null; + } + + static Assembly? ResolvingEventHandler (AssemblyLoadContext sender, AssemblyName assemblyName) + { + if (xamarin_locate_assembly_resource (assemblyName.Name!, assemblyName.CultureName, assemblyName.Name + ".dll", out var path)) + return sender.LoadFromAssemblyPath (path); + return null; } static unsafe delegate* unmanaged UnhandledExceptionPropagationHandler (Exception exception, RuntimeMethodHandle lastMethod, out IntPtr context) diff --git a/src/ObjCRuntime/Runtime.cs b/src/ObjCRuntime/Runtime.cs index d289f5ce94..1f62edfd20 100644 --- a/src/ObjCRuntime/Runtime.cs +++ b/src/ObjCRuntime/Runtime.cs @@ -1855,8 +1855,8 @@ namespace ObjCRuntime { ConnectMethod (method.DeclaringType!, method, selector); } - [DllImport ("__Internal", CharSet = CharSet.Unicode)] - extern static void xamarin_log (string s); + [DllImport ("__Internal")] + extern static void xamarin_log (IntPtr s); [DllImport (Constants.libcLibrary)] extern static nint write (int filedes, byte [] buf, nint nbyte); @@ -1864,7 +1864,8 @@ namespace ObjCRuntime { internal static void NSLog (string value) { try { - xamarin_log (value); + using var valuePtr = new TransientString (value, TransientString.Encoding.Unicode); + xamarin_log (valuePtr); } catch { // Append a newline like NSLog does if (!value.EndsWith ('\n')) diff --git a/src/ObjCRuntime/Runtime.iOS.cs b/src/ObjCRuntime/Runtime.iOS.cs index 247d76d7fe..4e50f4be36 100644 --- a/src/ObjCRuntime/Runtime.iOS.cs +++ b/src/ObjCRuntime/Runtime.iOS.cs @@ -144,7 +144,7 @@ namespace ObjCRuntime { } [DllImport ("__Internal")] - static extern void xamarin_start_wwan (string uri); + static extern void xamarin_start_wwan (IntPtr uri); public static void StartWWAN (Uri uri) { @@ -157,7 +157,8 @@ namespace ObjCRuntime { if (Runtime.Arch == Arch.SIMULATOR) return; - xamarin_start_wwan (uri.ToString ()); + using var uriPtr = new TransientString (uri.ToString ()); + xamarin_start_wwan (uriPtr); } #endif // !TVOS && !WATCH #endif // !COREBUILD diff --git a/src/ObjCRuntime/TransientString.cs b/src/ObjCRuntime/TransientString.cs index 04df0f790b..56382b8b1b 100644 --- a/src/ObjCRuntime/TransientString.cs +++ b/src/ObjCRuntime/TransientString.cs @@ -11,6 +11,13 @@ namespace ObjCRuntime { // // If SomePInvoke doesn't make a copy, this is not the right tool // for you. + // + // It can also allocate a chunk of memory to be used as a parameter + // for a method that will write a string to a pointer: + // using var outstr = new NativeString (255); // 255 bytes of memory + // SomePInvoke (outstr); + // var str = (string) outstr; // convert the returned native string + // to a managed string. internal struct TransientString : IDisposable { IntPtr ptr; public enum Encoding { @@ -20,6 +27,10 @@ namespace ObjCRuntime { Unicode, }; + public TransientString (nint size) + { + ptr = Marshal.AllocHGlobal ((IntPtr) size); + } public TransientString (string? str, Encoding encoding = Encoding.Auto) { @@ -50,7 +61,7 @@ namespace ObjCRuntime { } public static implicit operator IntPtr (TransientString str) => str.ptr; - + public static explicit operator string? (TransientString str) => Marshal.PtrToStringAuto (str.ptr); public static string? ToStringAndFree (IntPtr ptr, Encoding encoding = Encoding.Auto) { diff --git a/src/PushToTalk/Compat.cs b/src/PushToTalk/Compat.cs new file mode 100644 index 0000000000..7af47680f4 --- /dev/null +++ b/src/PushToTalk/Compat.cs @@ -0,0 +1,23 @@ +#nullable enable + +#if !XAMCORE_5_0 + +using System; +using Foundation; +using ObjCRuntime; + +#if !NET +using NativeHandle = System.IntPtr; +#endif + +namespace PushToTalk { + public partial class PTChannelManagerDelegate { + public override NativeHandle ClassHandle { get => base.ClassHandle; } + } + + public partial class PTChannelRestorationDelegate { + public override NativeHandle ClassHandle { get => base.ClassHandle; } + } +} + +#endif // !XAMCORE_5_0 diff --git a/src/QTKit/.gitignore b/src/QTKit/.gitignore deleted file mode 100644 index bd99fb0524..0000000000 --- a/src/QTKit/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.g.cs diff --git a/src/StoreKit/.gitignore b/src/StoreKit/.gitignore deleted file mode 100644 index 94053bc9bd..0000000000 --- a/src/StoreKit/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/*.g.cs diff --git a/src/UIKit/.gitignore b/src/UIKit/.gitignore deleted file mode 100644 index 94053bc9bd..0000000000 --- a/src/UIKit/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/*.g.cs diff --git a/src/appkit.cs b/src/appkit.cs index 819c86fa5d..25bc1696bf 100644 --- a/src/appkit.cs +++ b/src/appkit.cs @@ -20649,6 +20649,12 @@ namespace AppKit { [PostSnippet ("InitializeReleasedWhenClosed ();", Optimizable = true)] NativeHandle Constructor (CGRect contentRect, NSWindowStyle aStyle, NSBackingStore bufferingType, bool deferCreation, NSScreen screen); +#if NET + [Export ("initWithWindowRef:")] + [PostSnippet ("InitializeReleasedWhenClosed ();", Optimizable = true)] + NativeHandle Constructor (IntPtr windowRef); +#endif + [Export ("title")] string Title { get; set; } diff --git a/src/avfoundation.cs b/src/avfoundation.cs index 2d4a742fe7..d9679779dc 100644 --- a/src/avfoundation.cs +++ b/src/avfoundation.cs @@ -1589,13 +1589,6 @@ namespace AVFoundation { [BaseType (typeof (NSObject))] [DisableDefaultCtor] interface AVAudioPlayer { - [Export ("initWithContentsOfURL:error:")] - [Internal] - NativeHandle Constructor (NSUrl url, IntPtr outError); - - [Export ("initWithData:error:")] - [Internal] - NativeHandle Constructor (NSData data, IntPtr outError); [Export ("prepareToPlay")] bool PrepareToPlay (); @@ -7441,17 +7434,17 @@ namespace AVFoundation { AVMovieTrack [] GetTracks (AVMediaCharacteristics mediaCharacteristic); [Async] - [Watch (8, 0), TV (15, 0), Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] + [Watch (8, 0), NoTV, Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] [Export ("loadTrackWithTrackID:completionHandler:")] void LoadTrack (int trackId, Action completionHandler); [Async] - [Watch (8, 0), TV (15, 0), Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] + [Watch (8, 0), NoTV, Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] [Export ("loadTracksWithMediaType:completionHandler:")] void LoadTracksWithMediaType (string mediaType, Action, NSError> completionHandler); [Async] - [Watch (8, 0), TV (15, 0), Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] + [Watch (8, 0), NoTV, Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] [Export ("loadTracksWithMediaCharacteristic:completionHandler:")] void LoadTracksWithMediaCharacteristic (string mediaCharacteristic, Action, NSError> completionHandler); } @@ -7516,17 +7509,17 @@ namespace AVFoundation { CMTime InterleavingPeriod { get; set; } [Async] - [Watch (8, 0), TV (15, 0), Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] + [Watch (8, 0), NoTV, Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] [Export ("loadTrackWithTrackID:completionHandler:")] void LoadTrack (int trackId, Action completionHandler); [Async] - [Watch (8, 0), TV (15, 0), Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] + [Watch (8, 0), NoTV, Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] [Export ("loadTracksWithMediaType:completionHandler:")] void LoadTracksWithMediaType (string mediaType, Action, NSError> completionHandler); [Async] - [Watch (8, 0), TV (15, 0), Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] + [Watch (8, 0), NoTV, Mac (12, 0), iOS (15, 0), MacCatalyst (15, 0)] [Export ("loadTracksWithMediaCharacteristic:completionHandler:")] void LoadTracksWithMediaCharacteristic (string mediaCharacteristic, Action, NSError> completionHandler); } diff --git a/src/contactsui.cs b/src/contactsui.cs index 9cdb3d301e..0c5d982c8d 100644 --- a/src/contactsui.cs +++ b/src/contactsui.cs @@ -121,12 +121,19 @@ namespace ContactsUI { ICNKeyDescriptor DescriptorForRequiredKeys { get; } #if MONOMAC - [NullAllowed, Export ("contact", ArgumentSemantic.Copy)] - CNContact Contact { get; [NoiOS]set; } + [NullAllowed] + [Export ("contact", ArgumentSemantic.Copy)] #else [Export ("contact", ArgumentSemantic.Strong)] - CNContact Contact { get; } #endif + CNContact Contact { + get; + [NoiOS] + [NoTV] + [NoWatch] + [NoMacCatalyst] + set; + } [NoMac] [Static] diff --git a/src/foundation.cs b/src/foundation.cs index ee28ad2fa0..1d293c0e98 100644 --- a/src/foundation.cs +++ b/src/foundation.cs @@ -10980,10 +10980,8 @@ namespace Foundation { [Export ("preferredPresentationSize")] CGSize PreferredPresentationSize { get; -#if !MONOMAC [NoMac] set; -#endif } [NoiOS, NoTV, NoWatch, NoMacCatalyst] @@ -15461,6 +15459,14 @@ namespace Foundation { [Static] [Deprecated (PlatformName.MacOSX, 10, 15)] +#if XAMCORE_5_0 + [NoMacCatalyst] +#else +#if MACCATALYST + [Obsolete ("Do not use; this method is not available on Mac Catalyst.")] + [EditorBrowsable (EditorBrowsableState.Never)] +#endif // MACCATALYST +#endif // XAMCORE_5_0 [Export ("launchedTaskWithLaunchPath:arguments:")] NSTask LaunchFromPath (string path, string [] arguments); diff --git a/src/frameworks.sources b/src/frameworks.sources index 106dd0554e..f623dbfaba 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -568,7 +568,6 @@ CORELOCATION_API_SOURCES = \ CoreLocation/CLEnums.cs CORELOCATION_CORE_SOURCES = \ - CoreLocation/CLLocationDistance.cs \ CoreLocation/CoreLocation.cs \ CORELOCATION_SOURCES = \ @@ -1472,6 +1471,10 @@ PHOTOSUI_API_SOURCES = \ PRINTCORE_SOURCES = \ PrintCore/Defs.cs \ PrintCore/PrintCore.cs + +# PushToTalk +PUSHTOTALK_SOURCES = \ + PushToTalk/Compat.cs \ # QTKit diff --git a/src/gamekit.cs b/src/gamekit.cs index 4a70708a1a..967276a7cb 100644 --- a/src/gamekit.cs +++ b/src/gamekit.cs @@ -818,12 +818,12 @@ namespace GameKit { [NullAllowed] // by default this property is null [Export ("authenticateHandler", ArgumentSemantic.Copy)] + [Mac (10, 9)] #if WATCH Action AuthenticateHandler { get; set; } #elif !MONOMAC Action AuthenticateHandler { get; set; } #else - [Mac (10,9)] Action AuthenticateHandler { get; set; } #endif diff --git a/src/generator.cs b/src/generator.cs index 6c0fdc7755..a820c7423b 100644 --- a/src/generator.cs +++ b/src/generator.cs @@ -3699,8 +3699,12 @@ public partial class Generator : IMemberGatherer { List availabilityToConsider = new List (); if (inlinedTypeAvailability != null) { availabilityToConsider.AddRange (inlinedTypeAvailability); + // Don't copy parent attributes if the conflict with the type we're inlining members into + // Example: don't copy Introduced on top of Unavailable. + CopyValidAttributes (availabilityToConsider, parentContextAvailability); + } else { + availabilityToConsider.AddRange (parentContextAvailability); } - availabilityToConsider.AddRange (parentContextAvailability); // We do not support Watch, so strip from both our input sources before any processing memberAvailability = memberAvailability.Where (x => x.Platform != PlatformName.WatchOS).ToList (); @@ -3712,6 +3716,23 @@ public partial class Generator : IMemberGatherer { // Copy down any unavailable from the parent before expanding, since a [NoMacCatalyst] on the type trumps [iOS] on a member CopyValidAttributes (memberAvailability, availabilityToConsider.Where (attr => attr.AvailabilityKind != AvailabilityKind.Introduced)); + if (inlinedType is not null && inlinedType != mi.DeclaringType && memberAvailability.Count > 1) { + // We might have gotten conflicting availability attributes for inlined members, where the inlined member + // might be available on a platform the target type isn't. The target type's unavailability will come + // later in the list, which means that if we have an unavailable attribute after an introduced attribute, + // then we need to remove the introduced attribute. + for (var i = memberAvailability.Count - 1; i >= 0; i--) { + if (memberAvailability [i].AvailabilityKind != AvailabilityKind.Unavailable) + continue; + for (var k = i - 1; k >= 0; k--) { + if (memberAvailability [k].AvailabilityKind == AvailabilityKind.Introduced && memberAvailability [k].Platform == memberAvailability [i].Platform) { + memberAvailability.RemoveAt (k); + i--; + } + } + } + } + // Add implied catalyst\TVOS from [iOS] _before_ copying down from parent if no catalyst\TVOS attributes // As those take precedent. We will do this a second time later in a moment.. AddImpliedPlatforms (memberAvailability); @@ -5283,6 +5304,7 @@ public partial class Generator : IMemberGatherer { bool use_underscore = minfo.is_unified_internal; var mod = minfo.GetVisibility (); minfo.protocolize = Protocolize (pi); + GetAccessorInfo (pi, out var getter, out var setter, out var generate_getter, out var generate_setter); var nullable = !pi.PropertyType.IsValueType && AttributeManager.HasAttribute (pi); @@ -5322,7 +5344,7 @@ public partial class Generator : IMemberGatherer { pi.Name.GetSafeParamName (), use_underscore ? "_" : ""); indent++; - if (pi.CanRead) { + if (generate_getter) { #if !NET PrintAttributes (pi, platform: true); #endif @@ -5344,7 +5366,7 @@ public partial class Generator : IMemberGatherer { indent--; print ("}"); } - if (pi.CanWrite) { + if (generate_setter) { #if !NET PrintAttributes (pi, platform: true); #endif @@ -5422,7 +5444,7 @@ public partial class Generator : IMemberGatherer { if (minfo.has_inner_wrap_attribute) { // If property getter or setter has its own WrapAttribute we let the user do whatever their heart desires - if (pi.CanRead) { + if (generate_getter) { PrintAttributes (pi, platform: true); PrintAttributes (pi.GetGetMethod (), platform: true, preserve: true, advice: true); print ("get {"); @@ -5433,8 +5455,7 @@ public partial class Generator : IMemberGatherer { indent--; print ("}"); } - if (pi.CanWrite) { - var setter = pi.GetSetMethod (); + if (generate_setter) { var not_implemented_attr = AttributeManager.GetCustomAttribute (setter); PrintAttributes (pi, platform: true); @@ -5455,8 +5476,7 @@ public partial class Generator : IMemberGatherer { return; } - if (pi.CanRead) { - var getter = pi.GetGetMethod (); + if (generate_getter) { var ba = GetBindAttribute (getter); string sel = ba != null ? ba.Selector : export.Selector; @@ -5517,8 +5537,7 @@ public partial class Generator : IMemberGatherer { print ("}\n"); } } - if (pi.CanWrite) { - var setter = pi.GetSetMethod (); + if (generate_setter) { var ba = GetBindAttribute (setter); bool null_allowed = AttributeManager.HasAttribute (setter); if (null_allowed) @@ -6393,11 +6412,11 @@ public partial class Generator : IMemberGatherer { mod = "unsafe "; // IsValueType check needed for `IntPtr` signatures (which can't become `IntPtr?`) var nullable = !pi.PropertyType.IsValueType && AttributeManager.HasAttribute (pi) ? "?" : String.Empty; - print ("{0}{1}{2} {3} {{", mod, FormatType (type, pi.PropertyType), nullable, pi.Name, pi.CanRead ? "get;" : string.Empty, pi.CanWrite ? "set;" : string.Empty); + GetAccessorInfo (pi, out var getMethod, out var setMethod, out var generate_getter, out var generate_setter); + print ("{0}{1}{2} {3} {{", mod, FormatType (type, pi.PropertyType), nullable, pi.Name, generate_getter ? "get;" : string.Empty, generate_setter ? "set;" : string.Empty); indent++; - if (pi.CanRead) { + if (generate_getter) { var ea = GetGetterExportAttribute (pi); - var getMethod = pi.GetGetMethod (); // there can be a [Bind] there that override the selector name to be used // e.g. IMTLTexture.FramebufferOnly var ba = GetBindAttribute (getMethod); @@ -6411,8 +6430,7 @@ public partial class Generator : IMemberGatherer { PrintAttributes (getMethod, notImplemented: true); print ("get;"); } - if (pi.CanWrite) { - var setMethod = pi.GetSetMethod (); + if (generate_setter) { PrintBlockProxy (pi.PropertyType); PrintAttributes (setMethod, notImplemented: true); if (!AttributeManager.HasAttribute (setMethod)) @@ -6450,15 +6468,14 @@ public partial class Generator : IMemberGatherer { // C# does not support extension properties, so create Get* and Set* accessors instead. foreach (var pi in optionalInstanceProperties) { + GetAccessorInfo (pi, out var getter, out var setter, out var generate_getter, out var generate_setter); var attrib = GetExportAttribute (pi); - var getter = pi.GetGetMethod (); - if (getter != null) { + if (generate_getter) { PrintAttributes (pi, preserve: true, advice: true); var ba = GetBindAttribute (getter); GenerateMethod (type, getter, false, null, false, false, true, ba?.Selector ?? attrib.ToGetter (pi).Selector); } - var setter = pi.GetSetMethod (); - if (setter != null) { + if (generate_setter) { PrintAttributes (pi, preserve: true, advice: true); var ba = GetBindAttribute (setter); GenerateMethod (type, setter, false, null, false, false, true, ba?.Selector ?? attrib.ToSetter (pi).Selector); @@ -6597,6 +6614,22 @@ public partial class Generator : IMemberGatherer { } } + void GetAccessorInfo (PropertyInfo pi, out MethodInfo getter, out MethodInfo setter, out bool generate_getter, out bool generate_setter) + { + getter = null; + setter = null; + generate_getter = false; + generate_setter = false; + if (pi.CanRead) { + getter = pi.GetGetMethod (); + generate_getter = !getter.IsUnavailable (this); + } + if (pi.CanWrite) { + setter = pi.GetSetMethod (); + generate_setter = !setter.IsUnavailable (this); + } + } + class MethodData { public MethodInfo Method; public ExportAttribute ExportAttribute; @@ -7124,7 +7157,8 @@ public partial class Generator : IMemberGatherer { if (default_ctor_visibility != null) { switch (default_ctor_visibility.Visibility) { case Visibility.Public: - break; // default + ctor_visibility = "public"; + break; case Visibility.Internal: ctor_visibility = "internal"; break; @@ -7146,7 +7180,7 @@ public partial class Generator : IMemberGatherer { if (TypeName != "NSObject") { var initSelector = (InlineSelectors || BindThirdPartyLibrary) ? "Selector.GetHandle (\"init\")" : "Selector.Init"; var initWithCoderSelector = (InlineSelectors || BindThirdPartyLibrary) ? "Selector.GetHandle (\"initWithCoder:\")" : "Selector.InitWithCoder"; - string v = class_mod == "abstract " ? "protected" : ctor_visibility; + string v = (class_mod == "abstract " && default_ctor_visibility is null) ? "protected" : ctor_visibility; var is32BitNotSupported = Is64BitiOSOnly (type); if (external) { if (!disable_default_ctor) { diff --git a/src/healthkit.cs b/src/healthkit.cs index ee4a34f907..7464d5591e 100644 --- a/src/healthkit.cs +++ b/src/healthkit.cs @@ -3501,7 +3501,7 @@ namespace HealthKit { [BaseType (typeof (NSObject))] [DisableDefaultCtor] interface HKSeriesBuilder -#if !MONOMAC +#if !MONOMAC && !XAMCORE_5_0 : NSSecureCoding #endif { diff --git a/src/intents.cs b/src/intents.cs index 44dea44d43..23a511098f 100644 --- a/src/intents.cs +++ b/src/intents.cs @@ -7324,7 +7324,10 @@ namespace Intents { #endif (INStartAudioCallIntent intent, Action completion); - [Watch (4, 0), Mac (10, 13), iOS (11, 0)] +#if !NET + [Mac (10, 13)] +#endif + [Watch (4, 0), iOS (11, 0)] [Export ("resolveDestinationTypeForStartAudioCall:withCompletion:")] void ResolveDestinationType (INStartAudioCallIntent intent, Action completion); diff --git a/src/mediaplayer.cs b/src/mediaplayer.cs index 8dd3c8c263..abd0d04b1d 100644 --- a/src/mediaplayer.cs +++ b/src/mediaplayer.cs @@ -42,7 +42,6 @@ using NativeHandle = System.IntPtr; #endif namespace MediaPlayer { - [Mac (10, 12, 2)] // type exists only to expose fields [BaseType (typeof (NSObject))] #if !MONOMAC #if NET @@ -54,8 +53,9 @@ namespace MediaPlayer { [TV (14, 0)] interface MPMediaEntity : NSSecureCoding { #else + [Mac (10, 12, 2)] // type exists only to expose fields interface MPMediaItem : NSSecureCoding { -#endif +#endif // !MONOMAC [Static] [Export ("canFilterByProperty:")] bool CanFilterByProperty (NSString property); diff --git a/src/nearbyinteraction.cs b/src/nearbyinteraction.cs index 0d30159912..eca62ea086 100644 --- a/src/nearbyinteraction.cs +++ b/src/nearbyinteraction.cs @@ -125,7 +125,8 @@ namespace NearbyInteraction { [Export ("invalidate")] void Invalidate (); - [NoWatch, NoTV, NoMac, iOS (16, 0), MacCatalyst (16, 0)] + [NoMacCatalyst] // We don't have ARKit bindings for Mac Catalyst (because ARKit doesn't work on Mac Catalyst), so we can't bind this method. + [NoWatch, NoTV, NoMac, iOS (16, 0)] [Export ("setARSession:")] void SetARSession (ARSession session); diff --git a/src/pushtotalk.cs b/src/pushtotalk.cs index 8da0168965..5c00ef52b8 100644 --- a/src/pushtotalk.cs +++ b/src/pushtotalk.cs @@ -137,6 +137,14 @@ namespace PushToTalk { [NoWatch, NoTV, NoMac, iOS (16, 0), MacCatalyst (16, 0)] [Protocol] +#if NET + [Model] +#if !XAMCORE_5_0 + [DefaultCtorVisibility (Visibility.Public)] +#endif +#else + [Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface PTChannelManagerDelegate { [Abstract] @@ -190,6 +198,14 @@ namespace PushToTalk { [NoWatch, NoTV, NoMac, iOS (16, 0), MacCatalyst (16, 0)] [Protocol] +#if NET + [Model] +#if !XAMCORE_5_0 + [DefaultCtorVisibility (Visibility.Public)] +#endif +#else + [Model (AutoGeneratedName = true)] +#endif [BaseType (typeof (NSObject))] interface PTChannelRestorationDelegate { [Abstract] diff --git a/src/quicklook.cs b/src/quicklook.cs index 73aa1f4014..2785c0f852 100644 --- a/src/quicklook.cs +++ b/src/quicklook.cs @@ -277,7 +277,7 @@ namespace QuickLook { [Export ("preparePreviewOfFileAtURL:completionHandler:")] void PreparePreviewOfFile (NSUrl url, Action handler); - [iOS (15, 0), Mac (12, 0), MacCatalyst (15, 0)] + [iOS (15, 0), MacCatalyst (15, 0)] [Export ("providePreviewForFileRequest:completionHandler:")] void ProvidePreview (QLFilePreviewRequest request, Action handler); } diff --git a/src/scenekit.cs b/src/scenekit.cs index 96c943526c..31d2c5819e 100644 --- a/src/scenekit.cs +++ b/src/scenekit.cs @@ -1285,6 +1285,7 @@ namespace SceneKit { #endif [NoTV] [Deprecated (PlatformName.MacOSX, 10, 10)] + [NoMacCatalyst] [Export ("attributeForKey:")] [return: NullAllowed] NSObject GetAttribute (NSString lightAttribute); @@ -1296,6 +1297,7 @@ namespace SceneKit { #endif [NoTV] [Deprecated (PlatformName.MacOSX, 10, 10)] + [NoMacCatalyst] [Export ("setAttribute:forKey:")] void SetAttribute ([NullAllowed] NSObject value, NSString attribuetKey); diff --git a/src/storekit.cs b/src/storekit.cs index 0852fcfa2c..8a52be80fe 100644 --- a/src/storekit.cs +++ b/src/storekit.cs @@ -652,11 +652,11 @@ namespace StoreKit { [iOS (11, 0)] [TV (11, 0)] [Export ("ProductIdentifier")] - string ProductIdentifier { get; } + string ProductIdentifier { get; set; } [iOS (8, 3)] [Export ("ProviderToken")] - string ProviderToken { get; } + string ProviderToken { get; set; } [iOS (11, 3), TV (11, 3), NoMac] [Export ("AdNetworkAttributionSignature")] @@ -680,11 +680,11 @@ namespace StoreKit { [NoWatch, NoMac, TV (14, 0), iOS (14, 0)] [Export ("AdNetworkSourceAppStoreIdentifier")] - string AdNetworkSourceAppStoreIdentifier { get; } + string AdNetworkSourceAppStoreIdentifier { get; set; } [NoWatch, NoMac, TV (14, 0), iOS (14, 0)] [Export ("AdNetworkVersion")] - string AdNetworkVersion { get; } + string AdNetworkVersion { get; set; } } [NoWatch] diff --git a/src/webkit.cs b/src/webkit.cs index f5fd764801..3cf9ded9c3 100644 --- a/src/webkit.cs +++ b/src/webkit.cs @@ -1705,6 +1705,12 @@ namespace WebKit { [Export ("click")] void Click (); + + [Export ("form", ArgumentSemantic.Retain)] + DomHtmlFormElement Form { get; } + + [Export ("files", ArgumentSemantic.Retain), Mac (10, 9)] + DomFileList Files { get; set; } } [NoiOS, NoTV, NoWatch, NoMacCatalyst] @@ -1754,6 +1760,9 @@ namespace WebKit { [Export ("select")] void Select (); + + [Export ("form", ArgumentSemantic.Retain)] + DomHtmlFormElement Form { get; } } [NoiOS, NoTV, NoWatch, NoMacCatalyst] @@ -2290,6 +2299,21 @@ namespace WebKit { [Export ("webView:unableToImplementPolicyWithError:frame:"), EventArgs ("WebFailureToImplementPolicy")] void UnableToImplementPolicy (WebView webView, NSError error, WebFrame frame); + + [Field ("WebActionNavigationTypeKey")] + NSString WebActionNavigationTypeKey { get; } + + [Field ("WebActionElementKey")] + NSString WebActionElementKey { get; } + + [Field ("WebActionButtonKey")] + NSString WebActionButtonKey { get; } + + [Field ("WebActionModifierFlagsKey")] + NSString WebActionModifierFlagsKey { get; } + + [Field ("WebActionOriginalURLKey")] + NSString WebActionOriginalUrlKey { get; } } [NoiOS, NoTV, NoWatch, NoMacCatalyst] @@ -3029,25 +3053,6 @@ namespace WebKit { void SelectSentence (NSObject sender); } - [NoiOS, NoTV, NoWatch, NoMacCatalyst] - partial interface WebPolicyDelegate { - - [Field ("WebActionNavigationTypeKey")] - NSString WebActionNavigationTypeKey { get; } - - [Field ("WebActionElementKey")] - NSString WebActionElementKey { get; } - - [Field ("WebActionButtonKey")] - NSString WebActionButtonKey { get; } - - [Field ("WebActionModifierFlagsKey")] - NSString WebActionModifierFlagsKey { get; } - - [Field ("WebActionOriginalURLKey")] - NSString WebActionOriginalUrlKey { get; } - } - [NoiOS, NoTV, NoWatch, NoMacCatalyst] [Deprecated (PlatformName.MacOSX, 10, 14, message: "No longer supported.")] [BaseType (typeof (DomObject), Name = "DOMBlob")] @@ -3117,19 +3122,6 @@ namespace WebKit { void Reset (); } - partial interface DomHtmlTextAreaElement { - [Export ("form", ArgumentSemantic.Retain)] - DomHtmlFormElement Form { get; } - } - - partial interface DomHtmlInputElement { - [Export ("form", ArgumentSemantic.Retain)] - DomHtmlFormElement Form { get; } - - [Export ("files", ArgumentSemantic.Retain), Mac (10, 9)] - DomFileList Files { get; set; } - } - [NoiOS, NoTV, NoWatch, NoMacCatalyst] [Deprecated (PlatformName.MacOSX, 10, 14, message: "No longer supported.")] [BaseType (typeof (DomHtmlElement), Name = "DOMHTMLAnchorElement")] diff --git a/tests/EmbeddedResources/ResourcesTest.cs b/tests/EmbeddedResources/ResourcesTest.cs index 4fc723abe0..4677cd110d 100644 --- a/tests/EmbeddedResources/ResourcesTest.cs +++ b/tests/EmbeddedResources/ResourcesTest.cs @@ -35,7 +35,7 @@ namespace EmbeddedResources { #endif -#if MONOMAC +#if MONOMAC && !NET var manager = new ResourceManager ("xammac_tests.EmbeddedResources.Welcome", typeof (ResourcesTest).Assembly); #else var manager = new ResourceManager ("EmbeddedResources.Welcome", typeof (ResourcesTest).Assembly); diff --git a/tests/bgen/Makefile b/tests/bgen/Makefile new file mode 100644 index 0000000000..e1cca50ff1 --- /dev/null +++ b/tests/bgen/Makefile @@ -0,0 +1,5 @@ +TOP=../.. +include $(TOP)/Make.config + +run-tests: + $(DOTNET) test diff --git a/tests/bindings-test/ProtocolTest.cs b/tests/bindings-test/ProtocolTest.cs index ef7d04c1ba..c0a1253c0e 100644 --- a/tests/bindings-test/ProtocolTest.cs +++ b/tests/bindings-test/ProtocolTest.cs @@ -14,8 +14,14 @@ namespace Xamarin.BindingTests { public class ProtocolTest { bool HasProtocolAttributes { get { - if (TestRuntime.IsLinkAll && !Runtime.DynamicRegistrationSupported) + if (TestRuntime.IsLinkAll) { +#if OPTIMIZEALL && __MACOS__ return false; +#endif + if (!Runtime.DynamicRegistrationSupported) + return false; + } + return true; } diff --git a/tests/bindings-test/RegistrarBindingTest.cs b/tests/bindings-test/RegistrarBindingTest.cs index e1944ae0fe..b483997349 100644 --- a/tests/bindings-test/RegistrarBindingTest.cs +++ b/tests/bindings-test/RegistrarBindingTest.cs @@ -332,8 +332,14 @@ namespace Xamarin.BindingTests { Messaging.void_objc_msgSend_IntPtr_bool_bool (Class.GetHandle (typeof (ObjCBlockTester)), Selector.GetHandle ("setProtocolWithBlockProperties:required:instance:"), pb.Handle, required, instance); Assert.Fail ("Expected an MT8028 error"); } catch (RuntimeException re) { +#if __MACOS__ + Assert.AreEqual (8009, re.Code, "Code"); + Console.WriteLine (re.Message); + Assert.That (re.Message, Does.StartWith ("Unable to locate the block to delegate conversion method for the method Xamarin.BindingTests.RegistrarBindingTest+FakePropertyBlock.set_"), re.Message, "Message"); +#else Assert.AreEqual (8028, re.Code, "Code"); Assert.AreEqual ("The runtime function get_block_wrapper_creator has been linked away.", re.Message, "Message"); +#endif } } } diff --git a/tests/cecil-tests/ApiAvailabilityTest.cs b/tests/cecil-tests/ApiAvailabilityTest.cs index 938978a5c1..9802be083d 100644 --- a/tests/cecil-tests/ApiAvailabilityTest.cs +++ b/tests/cecil-tests/ApiAvailabilityTest.cs @@ -315,13 +315,6 @@ namespace Cecil.Tests { "System.Boolean Security.SecRecord::UseNoAuthenticationUI()", "System.Double Speech.SFTranscription::AveragePauseDuration()", "System.Double Speech.SFTranscription::SpeakingRate()", - "System.EventHandler AVFoundation.AVAudioSession::BeginInterruption (event)", - "System.EventHandler AVFoundation.AVAudioSession::EndInterruption (event)", - "System.EventHandler`1 AVFoundation.AVAudioSession::CategoryChanged (event)", - "System.EventHandler`1 AVFoundation.AVAudioSession::InputChannelsChanged (event)", - "System.EventHandler`1 AVFoundation.AVAudioSession::OutputChannelsChanged (event)", - "System.EventHandler`1 AVFoundation.AVAudioSession::SampleRateChanged (event)", - "System.EventHandler`1 AVFoundation.AVAudioSession::InputAvailabilityChanged (event)", "System.String PassKit.PKAddShareablePassConfiguration::ProvisioningPolicyIdentifier()", "System.String PassKit.PKShareablePassMetadata::LocalizedDescription()", "System.String PassKit.PKShareablePassMetadata::OwnerDisplayName()", diff --git a/tests/cecil-tests/BlittablePInvokes.cs b/tests/cecil-tests/BlittablePInvokes.cs index 749a2c09f7..0e216e72ba 100644 --- a/tests/cecil-tests/BlittablePInvokes.cs +++ b/tests/cecil-tests/BlittablePInvokes.cs @@ -41,7 +41,7 @@ namespace Cecil.Tests { public string Reason; } - [Ignore ("work in progress - there are 100 failures, mostly due to strings")] + [Ignore ("work in progress - there are 40 failures, mostly due to delegates")] [TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformImplementationAssemblyDefinitions))] public void CheckForNonBlittablePInvokes (AssemblyInfo info) { diff --git a/tests/cecil-tests/ConstructorTest.cs b/tests/cecil-tests/ConstructorTest.cs index 10cfb72ac1..e0c27cb0b6 100644 --- a/tests/cecil-tests/ConstructorTest.cs +++ b/tests/cecil-tests/ConstructorTest.cs @@ -255,6 +255,7 @@ namespace Cecil.Tests { case "NSConditionLock": // has a nint (i.e. IntPtr) constructor (condition) - not a mistake case "NSScrubberProportionalLayout": // has a nint (i.e. IntPtr) constructor (numberOfVisibleItems) - not a mistake case "NSIndexSet": // has a nuint (i.e. UIntPtr) constructor (index) - not a mistake + case "NSWindow": // has an actual IntPtr constructor (initWithWindowRef:) - not a mistake continue; } diff --git a/tests/common/AppDelegate.cs b/tests/common/AppDelegate.cs index c4d5ac3e9f..bc895afcec 100644 --- a/tests/common/AppDelegate.cs +++ b/tests/common/AppDelegate.cs @@ -20,8 +20,6 @@ public partial class AppDelegate : UIApplicationDelegate { public override UIWindow Window { get; set; } #endif - public partial IEnumerable GetTestAssemblies (); - partial void PostFinishedLaunching (); public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions) @@ -32,7 +30,7 @@ public partial class AppDelegate : UIApplicationDelegate { var window = new UIWindow (UIScreen.MainScreen.Bounds); var runner = new TouchRunner (window); - foreach (var assembly in GetTestAssemblies ()) + foreach (var assembly in TestLoader.GetTestAssemblies ()) runner.Add (assembly); Window = window; diff --git a/tests/common/BinLog.cs b/tests/common/BinLog.cs index d17cef328a..43a5d42e0b 100644 --- a/tests/common/BinLog.cs +++ b/tests/common/BinLog.cs @@ -24,6 +24,43 @@ namespace Xamarin.Tests { public string? File; public string? ProjectFile; public string? Message; + + public override string ToString () + { + var rv = new StringBuilder (); + + if (!string.IsNullOrEmpty (File)) { + rv.Append (File); + if (LineNumber > 0) { + rv.Append ('('); + rv.Append (LineNumber.ToString ()); + if (EndLineNumber > 0) { + rv.Append (','); + rv.Append (EndLineNumber.ToString ()); + } + rv.Append ("): "); + } + } + switch (Type) { + case BuildLogEventType.Error: + rv.Append ("error"); + break; + case BuildLogEventType.Warning: + rv.Append ("warning"); + break; + case BuildLogEventType.Message: + rv.Append ("message"); + break; + } + if (!string.IsNullOrEmpty (Code)) { + rv.Append (' '); + rv.Append (Code); + } + rv.Append (": "); + if (!string.IsNullOrEmpty (Message)) + rv.Append (Message); + return rv.ToString (); + } } public enum BuildLogEventType { diff --git a/tests/common/Configuration.cs b/tests/common/Configuration.cs index d971d819e1..7c96e256cf 100644 --- a/tests/common/Configuration.cs +++ b/tests/common/Configuration.cs @@ -715,6 +715,13 @@ namespace Xamarin.Tests { } } + public static string GetBaseLibrary (ApplePlatform platform, bool isDotNet) + { + if (isDotNet) + return Path.Combine (GetRefDirectory (platform), GetBaseLibraryName (platform, isDotNet)); + return GetBaseLibrary (platform.AsProfile ()); + } + static string GetBaseLibraryName (TargetFramework targetFramework) { return GetBaseLibraryName (targetFramework.Platform, targetFramework.IsDotNet); diff --git a/tests/common/Profile.cs b/tests/common/Profile.cs index eab8253de1..f7513f3203 100644 --- a/tests/common/Profile.cs +++ b/tests/common/Profile.cs @@ -11,6 +11,7 @@ namespace Xamarin.Tests { macOSMobile, macOSFull, macOSSystem, + MacCatalyst, } public static class ProfileExtensions { @@ -33,5 +34,25 @@ namespace Xamarin.Tests { throw new NotImplementedException (profile.ToString ()); } } + + public static Profile AsProfile (this ApplePlatform platform) + { + switch (platform) { + case ApplePlatform.iOS: + return Profile.iOS; + case ApplePlatform.MacCatalyst: + return Profile.MacCatalyst; + case ApplePlatform.MacOSX: + return Profile.macOSMobile; + case ApplePlatform.None: + return Profile.None; + case ApplePlatform.TVOS: + return Profile.tvOS; + case ApplePlatform.WatchOS: + return Profile.watchOS; + default: + throw new NotImplementedException (platform.ToString ()); + } + } } } diff --git a/tests/common/TestAssemblyLoader.cs b/tests/common/TestAssemblyLoader.cs new file mode 100644 index 0000000000..2d3d2bb913 --- /dev/null +++ b/tests/common/TestAssemblyLoader.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Reflection; + +#nullable enable + +public static partial class TestLoader { + public static IEnumerable GetTestAssemblies () + { + var assemblies = new HashSet (); + assemblies.Add (Assembly.GetExecutingAssembly ()); + AddTestAssembliesImpl (assemblies); + return assemblies; + } + + static partial void AddTestAssembliesImpl (HashSet assemblies); +} diff --git a/tests/common/mac/MacMain.cs b/tests/common/mac/MacMain.cs index e8774972c4..53c80c5db6 100644 --- a/tests/common/mac/MacMain.cs +++ b/tests/common/mac/MacMain.cs @@ -16,11 +16,7 @@ namespace Xamarin.Mac.Tests { var arguments = new List (args); arguments.RemoveAll ((arg) => arg.StartsWith ("-psn_", StringComparison.Ordinal)); - var assemblies = new List (); - assemblies.Add (typeof (MainClass).Assembly); - TestLoader.AddTestAssemblies (assemblies); - - var exit_code = await MonoTouch.NUnit.UI.MacRunner.MainAsync (arguments, true, _exit, assemblies.ToArray ()); + var exit_code = await MonoTouch.NUnit.UI.MacRunner.MainAsync (arguments, true, _exit, TestLoader.GetTestAssemblies ().ToArray ()); #if NET var exit_monitor = new Thread (() => { @@ -48,13 +44,4 @@ namespace Xamarin.Mac.Tests { [DllImport ("/usr/lib/libSystem.dylib")] static extern void _exit (int exit_code); } - - public static partial class TestLoader { - static partial void AddTestAssembliesImpl (List assemblies); - - public static void AddTestAssemblies (List assemblies) - { - AddTestAssembliesImpl (assemblies); - } - } } diff --git a/tests/common/shared-dotnet.csproj b/tests/common/shared-dotnet.csproj index 1eaeec24f0..60f9b5f4f4 100644 --- a/tests/common/shared-dotnet.csproj +++ b/tests/common/shared-dotnet.csproj @@ -66,7 +66,7 @@ - + diff --git a/tests/dotnet/Net6_0SimpleApp/MacCatalyst/Net6_0SimpleApp.csproj b/tests/dotnet/Net6_0SimpleApp/MacCatalyst/Net6_0SimpleApp.csproj index ccebf1f778..9e013fe6ea 100644 --- a/tests/dotnet/Net6_0SimpleApp/MacCatalyst/Net6_0SimpleApp.csproj +++ b/tests/dotnet/Net6_0SimpleApp/MacCatalyst/Net6_0SimpleApp.csproj @@ -2,6 +2,7 @@ net6.0-maccatalyst + 14.0 diff --git a/tests/dotnet/Net6_0SimpleApp/iOS/Net6_0SimpleApp.csproj b/tests/dotnet/Net6_0SimpleApp/iOS/Net6_0SimpleApp.csproj index bbb942faa1..e2ee33af73 100644 --- a/tests/dotnet/Net6_0SimpleApp/iOS/Net6_0SimpleApp.csproj +++ b/tests/dotnet/Net6_0SimpleApp/iOS/Net6_0SimpleApp.csproj @@ -2,6 +2,7 @@ net6.0-ios + 11.0 diff --git a/tests/dotnet/Net6_0SimpleApp/macOS/Net6_0SimpleApp.csproj b/tests/dotnet/Net6_0SimpleApp/macOS/Net6_0SimpleApp.csproj index 56f7fe0d8c..c3586842bb 100644 --- a/tests/dotnet/Net6_0SimpleApp/macOS/Net6_0SimpleApp.csproj +++ b/tests/dotnet/Net6_0SimpleApp/macOS/Net6_0SimpleApp.csproj @@ -2,6 +2,7 @@ net6.0-macos + 10.15 diff --git a/tests/dotnet/Net6_0SimpleApp/tvOS/Net6_0SimpleApp.csproj b/tests/dotnet/Net6_0SimpleApp/tvOS/Net6_0SimpleApp.csproj index 07832eb3e0..56313acece 100644 --- a/tests/dotnet/Net6_0SimpleApp/tvOS/Net6_0SimpleApp.csproj +++ b/tests/dotnet/Net6_0SimpleApp/tvOS/Net6_0SimpleApp.csproj @@ -2,6 +2,7 @@ net6.0-tvos + 11.0 diff --git a/tests/dotnet/UnitTests/Extensions.cs b/tests/dotnet/UnitTests/Extensions.cs new file mode 100644 index 0000000000..5bca6fbd29 --- /dev/null +++ b/tests/dotnet/UnitTests/Extensions.cs @@ -0,0 +1,16 @@ +using System; + +#nullable enable + +namespace Xamarin.Tests { + public static class Extensions { + public static void AssertNoWarnings (this ExecutionResult result) + { + var warnings = BinLog.GetBuildLogWarnings (result.BinLogPath).ToArray (); + if (!warnings.Any ()) + return; + + Assert.Fail ($"No warnings expected, but got:\n\t{string.Join ("\n\t", warnings.Select (v => v.ToString ()))}"); + } + } +} diff --git a/tests/dotnet/UnitTests/ProjectTest.cs b/tests/dotnet/UnitTests/ProjectTest.cs index 34163ce25f..8436735c6f 100644 --- a/tests/dotnet/UnitTests/ProjectTest.cs +++ b/tests/dotnet/UnitTests/ProjectTest.cs @@ -1182,6 +1182,25 @@ namespace Xamarin.Tests { } } + // [TestCase (ApplePlatform.MacCatalyst, null, "Release")] + [TestCase (ApplePlatform.MacOSX, null, "Release")] + public void NoWarnCodesign (ApplePlatform platform, string runtimeIdentifiers, string configuration) + { + var project = "Entitlements"; + Configuration.IgnoreIfIgnoredPlatform (platform); + + var project_path = GetProjectPath (project, runtimeIdentifiers: runtimeIdentifiers, platform: platform, out var appPath, configuration: configuration); + Clean (project_path); + + var properties = GetDefaultProperties (runtimeIdentifiers); + properties ["Configuration"] = configuration; + properties ["EnableCodeSigning"] = "true"; + properties ["ExcludeNUnitLiteReference"] = "true"; + properties ["ExcludeTouchUnitReference"] = "true"; + var rv = DotNet.AssertBuild (project_path, properties); + rv.AssertNoWarnings (); + } + [Test] [TestCase (ApplePlatform.MacOSX, "osx-x64")] public void BuildAndExecuteAppWithNativeDynamicLibrariesInPackageReference (ApplePlatform platform, string runtimeIdentifier) diff --git a/tests/dotnet/UnitTests/TestBaseClass.cs b/tests/dotnet/UnitTests/TestBaseClass.cs index 53770f3878..4cdcbcf8ea 100644 --- a/tests/dotnet/UnitTests/TestBaseClass.cs +++ b/tests/dotnet/UnitTests/TestBaseClass.cs @@ -66,12 +66,12 @@ namespace Xamarin.Tests { { var rv = GetProjectPath (project, subdir, platform); if (string.IsNullOrEmpty (runtimeIdentifiers)) - runtimeIdentifiers = GetDefaultRuntimeIdentifier (platform); + runtimeIdentifiers = GetDefaultRuntimeIdentifier (platform, configuration); var appPathRuntimeIdentifier = runtimeIdentifiers.IndexOf (';') >= 0 ? "" : runtimeIdentifiers; return Path.Combine (Path.GetDirectoryName (rv)!, "bin", configuration, platform.ToFramework (netVersion), appPathRuntimeIdentifier); } - protected string GetDefaultRuntimeIdentifier (ApplePlatform platform) + protected string GetDefaultRuntimeIdentifier (ApplePlatform platform, string configuration = "Debug") { switch (platform) { case ApplePlatform.iOS: @@ -79,9 +79,9 @@ namespace Xamarin.Tests { case ApplePlatform.TVOS: return "tvossimulator-x64"; case ApplePlatform.MacOSX: - return "osx-x64"; + return "Release".Equals (configuration, StringComparison.OrdinalIgnoreCase) ? "osx-x64;osx-arm64" : "osx-x64"; case ApplePlatform.MacCatalyst: - return "maccatalyst-x64"; + return "Release".Equals (configuration, StringComparison.OrdinalIgnoreCase) ? "maccatalyst-x64;maccatalyst-arm64" : "maccatalyst-x64"; default: throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}"); } diff --git a/tests/framework-test/dotnet/shared.csproj b/tests/framework-test/dotnet/shared.csproj index 67e522e170..958d2c4ad4 100644 --- a/tests/framework-test/dotnet/shared.csproj +++ b/tests/framework-test/dotnet/shared.csproj @@ -28,10 +28,10 @@ - - + + TestRuntime.cs diff --git a/tests/framework-test/iOS/AppDelegate.cs b/tests/framework-test/iOS/AppDelegate.cs deleted file mode 100644 index 6cf252b489..0000000000 --- a/tests/framework-test/iOS/AppDelegate.cs +++ /dev/null @@ -1,17 +0,0 @@ -#if !__WATCHOS__ -using System; -using System.Reflection; -using System.Collections.Generic; - -using Foundation; - -public partial class AppDelegate { - public partial IEnumerable GetTestAssemblies () - { - return new Assembly [] { - Assembly.GetExecutingAssembly (), - }; - } -} - -#endif // !__WATCHOS__ diff --git a/tests/framework-test/iOS/framework-test-ios.csproj b/tests/framework-test/iOS/framework-test-ios.csproj index 2ee795dc06..c31cabbb6b 100644 --- a/tests/framework-test/iOS/framework-test-ios.csproj +++ b/tests/framework-test/iOS/framework-test-ios.csproj @@ -150,9 +150,9 @@ - + diff --git a/tests/framework-test/macOS/framework-test-mac.csproj b/tests/framework-test/macOS/framework-test-mac.csproj index af49aa0af5..bf7cc2bc62 100644 --- a/tests/framework-test/macOS/framework-test-mac.csproj +++ b/tests/framework-test/macOS/framework-test-mac.csproj @@ -69,6 +69,9 @@ MacMain.cs + + TestAssemblyLoader.cs + TestRuntime.cs diff --git a/tests/generator/BGenTests.cs b/tests/generator/BGenTests.cs index 2f1cacb929..e8816fe1e2 100644 --- a/tests/generator/BGenTests.cs +++ b/tests/generator/BGenTests.cs @@ -1009,6 +1009,63 @@ namespace GeneratorTests { BuildFile (Profile.iOS, "tests/csharp10syntax.cs"); } + [Test] + [TestCase (Profile.iOS)] +#if !NET + [Ignore ("This only applies to .NET")] +#endif + public void AttributesFromInlinedProtocols (Profile profile) + { + Configuration.IgnoreIfIgnoredPlatform (profile.AsPlatform ()); + + var bgen = new BGenTool (); + bgen.Profile = profile; + bgen.AddTestApiDefinition ("tests/attributes-from-inlined-protocols.cs"); + bgen.CreateTemporaryBinding (); + bgen.AssertExecute ("build"); + + var type = bgen.ApiAssembly.MainModule.GetType ("NS", "TypeA"); + var someMethod1 = type.Methods.Single (v => v.Name == "SomeMethod1"); + var someMethod2 = type.Methods.Single (v => v.Name == "SomeMethod2"); + var someMethod3 = type.Methods.Single (v => v.Name == "SomeMethod3"); + var someMethod4 = type.Methods.Single (v => v.Name == "SomeMethod4"); + + var renderedSomeMethod1 = string.Join ("\n", someMethod1.CustomAttributes.Select (ca => RenderSupportedOSPlatformAttribute (ca)).OrderBy (v => v)); + var renderedSomeMethod2 = string.Join ("\n", someMethod2.CustomAttributes.Select (ca => RenderSupportedOSPlatformAttribute (ca)).OrderBy (v => v)); + var renderedSomeMethod3 = string.Join ("\n", someMethod3.CustomAttributes.Select (ca => RenderSupportedOSPlatformAttribute (ca)).OrderBy (v => v)); + var renderedSomeMethod4 = string.Join ("\n", someMethod4.CustomAttributes.Select (ca => RenderSupportedOSPlatformAttribute (ca)).OrderBy (v => v)); + + const string expectedAttributes1 = +@"[BindingImpl(3)] +[Export(""someMethod1:"")] +[SupportedOSPlatform(""ios12.0"")] +[SupportedOSPlatform(""maccatalyst"")] +[UnsupportedOSPlatform(""tvos"")]"; + const string expectedAttributes2 = +@"[BindingImpl(3)] +[Export(""someMethod2:"")] +[SupportedOSPlatform(""ios12.0"")] +[SupportedOSPlatform(""maccatalyst"")] +[UnsupportedOSPlatform(""tvos"")]"; + const string expectedAttributes3 = +@"[BindingImpl(3)] +[Export(""someMethod3:"")] +[SupportedOSPlatform(""ios11.0"")] +[SupportedOSPlatform(""maccatalyst"")] +[UnsupportedOSPlatform(""tvos"")]"; + const string expectedAttributes4 = +@"[BindingImpl(3)] +[Export(""someMethod4:"")] +[SupportedOSPlatform(""ios11.0"")] +[SupportedOSPlatform(""maccatalyst"")] +[UnsupportedOSPlatform(""tvos"")]"; + + Assert.AreEqual (expectedAttributes1, renderedSomeMethod1, "SomeMethod1"); + Assert.AreEqual (expectedAttributes2, renderedSomeMethod2, "SomeMethod2"); + Assert.AreEqual (expectedAttributes3, renderedSomeMethod3, "SomeMethod3"); + Assert.AreEqual (expectedAttributes4, renderedSomeMethod4, "SomeMethod4"); + } + [Test] public void NFloatType () { @@ -1020,6 +1077,42 @@ namespace GeneratorTests { Assert.IsNotNull (pinvoke, "PInvoke"); } + [Test] + [TestCase (Profile.iOS)] + public void NoAvailabilityForAccessors (Profile profile) + { + Configuration.IgnoreIfIgnoredPlatform (profile.AsPlatform ()); + var bgen = new BGenTool (); + bgen.Profile = profile; + bgen.AddTestApiDefinition ("tests/no-availability-for-accessors.cs"); + bgen.CreateTemporaryBinding (); + bgen.AssertExecute ("build"); + + bgen.AssertMethod ("NS.Whatever", "get_PropA"); + bgen.AssertNoMethod ("NS.Whatever", "set_PropA", parameterTypes: "Foundation.NSObject"); + bgen.AssertMethod ("NS.Whatever", "set_PropB", parameterTypes: "Foundation.NSObject"); + bgen.AssertNoMethod ("NS.Whatever", "get_PropB"); + bgen.AssertMethod ("NS.Whatever", "get_IPropA"); + bgen.AssertNoMethod ("NS.Whatever", "set_IPropA", parameterTypes: "Foundation.NSObject"); + bgen.AssertMethod ("NS.Whatever", "set_IPropB", parameterTypes: "Foundation.NSObject"); + bgen.AssertNoMethod ("NS.Whatever", "get_IPropB"); + bgen.AssertMethod ("NS.Whatever", "get_IPropAOpt"); + bgen.AssertNoMethod ("NS.Whatever", "set_IPropAOpt", parameterTypes: "Foundation.NSObject"); + bgen.AssertMethod ("NS.Whatever", "set_IPropBOpt", parameterTypes: "Foundation.NSObject"); + bgen.AssertNoMethod ("NS.Whatever", "get_IPropBOpt"); + bgen.AssertPublicMethodCount ("NS.Whatever", 9); // 6 accessors + 2 constructors + ClassHandle getter + + bgen.AssertMethod ("NS.IIProtocol", "get_IPropA"); + bgen.AssertNoMethod ("NS.IIProtocol", "set_IPropA", parameterTypes: "Foundation.NSObject"); + bgen.AssertMethod ("NS.IIProtocol", "set_IPropB", parameterTypes: "Foundation.NSObject"); + bgen.AssertNoMethod ("NS.IIProtocol", "get_IPropB"); + bgen.AssertPublicMethodCount ("NS.IIProtocol", 2); + + bgen.AssertMethod ("NS.IProtocol_Extensions", "GetIPropAOpt", parameterTypes: "NS.IIProtocol"); + bgen.AssertMethod ("NS.IProtocol_Extensions", "SetIPropBOpt", parameterTypes: new string [] { "NS.IIProtocol", "Foundation.NSObject" }); + bgen.AssertPublicMethodCount ("NS.IProtocol_Extensions", 2); + } + BGenTool BuildFile (Profile profile, params string [] filenames) { return BuildFile (profile, true, false, filenames); diff --git a/tests/generator/BGenTool.cs b/tests/generator/BGenTool.cs index 37698969bd..548559748e 100644 --- a/tests/generator/BGenTool.cs +++ b/tests/generator/BGenTool.cs @@ -304,14 +304,15 @@ namespace Xamarin.Tests { { LoadAssembly (); - var t = assembly.MainModule.Types.FirstOrDefault ((v) => v.FullName == typename); - var actual = t.Methods.Count ((v) => { + var t = assembly.MainModule.Types.First ((v) => v.FullName == typename); + var actual = t.Methods.Where ((v) => { if (v.IsPrivate || v.IsFamily || v.IsFamilyAndAssembly) return false; return true; }); - if (actual != count) - Assert.Fail ($"Expected {count} publicly accessible method(s) in {typename}, found {actual} publicly accessible method(s). {message}"); + if (actual.Count () != count) { + Assert.Fail ($"Expected {count} publicly accessible method(s) in {typename}, found {actual} publicly accessible method(s): {message}\n\t{string.Join ("\n\t", actual.Select (v => v.FullName).OrderBy (v => v))}"); + } } public void AssertType (string fullname, TypeAttributes? attributes = null, string message = null) @@ -326,6 +327,11 @@ namespace Xamarin.Tests { Assert.AreEqual (attributes.Value, t.Attributes, $"Incorrect attributes for type {fullname}."); } + public void AssertMethod (string typename, string method, params string [] parameterTypes) + { + AssertMethod (typename, method, null, null, parameterTypes); + } + public void AssertMethod (string typename, string method, string returnType = null, params string [] parameterTypes) { AssertMethod (typename, method, null, returnType, parameterTypes); @@ -333,9 +339,29 @@ namespace Xamarin.Tests { public void AssertMethod (string typename, string method, MethodAttributes? attributes = null, string returnType = null, params string [] parameterTypes) { - LoadAssembly (); + var m = FindMethod (typename, method, returnType, parameterTypes); + if (m is null) { + Assert.Fail ($"No method '{method}' with signature '{string.Join ("', '", parameterTypes)}' on the type '{typename}' was found."); + return; + } + if (attributes.HasValue) + Assert.AreEqual (attributes.Value, m.Attributes, "Attributes for {0}", m.FullName); + } + + public void AssertNoMethod (string typename, string method, string returnType = null, params string [] parameterTypes) + { + var m = FindMethod (typename, method, returnType, parameterTypes); + if (m is not null) + Assert.Fail ($"Unexpectedly found method '{method}' with signature '{string.Join ("', '", parameterTypes)}' on the type '{typename}'."); + } + + MethodDefinition FindMethod (string typename, string method, string returnType, params string [] parameterTypes) + { + var assembly = LoadAssembly (); + var t = assembly.MainModule.Types.FirstOrDefault ((v) => v.FullName == typename); + if (t is null) + return null; - var t = assembly.MainModule.Types.First ((v) => v.FullName == typename); var m = t.Methods.FirstOrDefault ((v) => { if (v.Name != method) return false; @@ -346,22 +372,24 @@ namespace Xamarin.Tests { return false; return true; }); - if (m == null) - Assert.Fail ($"No method '{method}' with signature '{string.Join ("', '", parameterTypes)}' was found."); - if (attributes.HasValue) - Assert.AreEqual (attributes.Value, m.Attributes, "Attributes for {0}", m.FullName); + return m; } - void LoadAssembly () + AssemblyDefinition LoadAssembly () { if (assembly is null) { var parameters = new ReaderParameters (); var resolver = new DefaultAssemblyResolver (); +#if NET + var searchdir = Path.GetDirectoryName (Configuration.GetBaseLibrary (Profile.AsPlatform (), true)); +#else var searchdir = Path.GetDirectoryName (Configuration.GetBaseLibrary (Profile)); +#endif resolver.AddSearchDirectory (searchdir); parameters.AssemblyResolver = resolver; assembly = AssemblyDefinition.ReadAssembly (Out ?? (Path.Combine (TmpDirectory, Path.GetFileNameWithoutExtension (ApiDefinitions [0]).Replace ('-', '_') + ".dll")), parameters); } + return assembly; } void EnsureTempDir () diff --git a/tests/generator/tests/attributes-from-inlined-protocols.cs b/tests/generator/tests/attributes-from-inlined-protocols.cs new file mode 100644 index 0000000000..e886aa580a --- /dev/null +++ b/tests/generator/tests/attributes-from-inlined-protocols.cs @@ -0,0 +1,32 @@ +using System; + +using Foundation; +using ObjCRuntime; + +namespace NS { + [NoTV] + [BaseType (typeof (NSObject))] + interface TypeA : ProtocolA { + } + + [Introduced (PlatformName.iOS, 11, 0)] + [Introduced (PlatformName.TvOS, 11, 0)] + [Protocol] + interface ProtocolA { + [Introduced (PlatformName.iOS, 12, 0)] + [Introduced (PlatformName.TvOS, 12, 0)] + [Export ("someMethod1:")] + void SomeMethod1 (nint row); + + [Introduced (PlatformName.iOS, 12, 0)] + [Export ("someMethod2:")] + void SomeMethod2 (nint row); + + [Introduced (PlatformName.TvOS, 12, 0)] + [Export ("someMethod3:")] + void SomeMethod3 (nint row); + + [Export ("someMethod4:")] + void SomeMethod4 (nint row); + } +} diff --git a/tests/generator/tests/no-availability-for-accessors.cs b/tests/generator/tests/no-availability-for-accessors.cs new file mode 100644 index 0000000000..e827db70fe --- /dev/null +++ b/tests/generator/tests/no-availability-for-accessors.cs @@ -0,0 +1,56 @@ +using System; + +using Foundation; +using ObjCRuntime; + +namespace NS { + [BaseType (typeof (NSObject))] + interface Whatever : IProtocol { + [Export ("propA")] + NSObject PropA { + get; + [NoiOS] + set; + } + + [Export ("propB")] + NSObject PropB { + [NoiOS] + get; + set; + } + } + + [Protocol] + interface IProtocol { + [Abstract] + [Export ("iPropA")] + NSObject IPropA { + get; + [NoiOS] + set; + } + + [Abstract] + [Export ("iPropB")] + NSObject IPropB { + [NoiOS] + get; + set; + } + + [Export ("iPropAOpt")] + NSObject IPropAOpt { + get; + [NoiOS] + set; + } + + [Export ("iPropBOpt")] + NSObject IPropBOpt { + [NoiOS] + get; + set; + } + } +} diff --git a/tests/interdependent-binding-projects/Main.cs b/tests/interdependent-binding-projects/Main.cs index 55db402d2f..0142548af5 100644 --- a/tests/interdependent-binding-projects/Main.cs +++ b/tests/interdependent-binding-projects/Main.cs @@ -1,53 +1,24 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Reflection; -using Foundation; -#if !__MACOS__ -using UIKit; -#endif - -using MonoTouch.NUnit.UI; using NUnit.Framework; -using NUnit.Framework.Internal; -#if __MACOS__ -namespace Xamarin.Mac.Tests { - public static partial class TestLoader { - static partial void AddTestAssembliesImpl (List assemblies) - { - assemblies.Add (typeof (Xamarin.BindingTests2.BindingTest).Assembly); - assemblies.Add (typeof (Xamarin.BindingTests.ProtocolTest).Assembly); - } - } -} -#elif !__WATCHOS__ -public partial class AppDelegate { - public partial IEnumerable GetTestAssemblies () - { - return new Assembly [] { - Assembly.GetExecutingAssembly (), - typeof (Xamarin.BindingTests2.BindingTest).Assembly, - typeof (Xamarin.BindingTests.ProtocolTest).Assembly, - }; - } -} -#else +#nullable enable + public static partial class TestLoader { - static partial void AddTestAssembliesImpl (BaseTouchRunner runner) + static partial void AddTestAssembliesImpl (HashSet assemblies) { - runner.Add (typeof (Xamarin.BindingTests2.BindingTest).Assembly); - runner.Add (typeof (Xamarin.BindingTests.ProtocolTest).Assembly); + assemblies.Add (typeof (Xamarin.BindingTests2.BindingTest).Assembly); + assemblies.Add (typeof (Xamarin.BindingTests.ProtocolTest).Assembly); } } -#endif // !__WATCHOS__ - -// In some cases NUnit fails if asked to run tests from an assembly that doesn't have any tests. So add a dummy test here to not fail in that scenario. [TestFixture] -public class DummyTest { - public void TestMe () +public class LoaderTest { + public void TestAssemblyCount () { - Assert.True (true, "YAY!"); + Assert.AreEqual (3, TestLoader.GetTestAssemblies ().Count (), "Test assembly count"); } } diff --git a/tests/interdependent-binding-projects/dotnet/shared.csproj b/tests/interdependent-binding-projects/dotnet/shared.csproj index d879074086..199798b31b 100644 --- a/tests/interdependent-binding-projects/dotnet/shared.csproj +++ b/tests/interdependent-binding-projects/dotnet/shared.csproj @@ -30,6 +30,7 @@ + TestRuntime.cs diff --git a/tests/interdependent-binding-projects/interdependent-binding-projects.csproj b/tests/interdependent-binding-projects/interdependent-binding-projects.csproj index 92acbcb055..86a5aad46b 100644 --- a/tests/interdependent-binding-projects/interdependent-binding-projects.csproj +++ b/tests/interdependent-binding-projects/interdependent-binding-projects.csproj @@ -144,6 +144,7 @@ + diff --git a/tests/introspection/Mac/introspection-mac.csproj b/tests/introspection/Mac/introspection-mac.csproj index 95e7913491..64c5b40d46 100644 --- a/tests/introspection/Mac/introspection-mac.csproj +++ b/tests/introspection/Mac/introspection-mac.csproj @@ -141,6 +141,9 @@ SdkVersions.cs + + TestAssemblyLoader.cs + ApiFrameworkTest.cs diff --git a/tests/introspection/dotnet/shared.csproj b/tests/introspection/dotnet/shared.csproj index 724a30ac5c..e1e8979eb8 100644 --- a/tests/introspection/dotnet/shared.csproj +++ b/tests/introspection/dotnet/shared.csproj @@ -41,7 +41,6 @@ - @@ -139,6 +138,9 @@ SdkVersions.cs + + TestAssemblyLoader.cs + ApiFrameworkTest.cs diff --git a/tests/introspection/iOS/AppDelegate.cs b/tests/introspection/iOS/AppDelegate.cs deleted file mode 100644 index 6cf252b489..0000000000 --- a/tests/introspection/iOS/AppDelegate.cs +++ /dev/null @@ -1,17 +0,0 @@ -#if !__WATCHOS__ -using System; -using System.Reflection; -using System.Collections.Generic; - -using Foundation; - -public partial class AppDelegate { - public partial IEnumerable GetTestAssemblies () - { - return new Assembly [] { - Assembly.GetExecutingAssembly (), - }; - } -} - -#endif // !__WATCHOS__ diff --git a/tests/introspection/iOS/introspection-ios.csproj b/tests/introspection/iOS/introspection-ios.csproj index f626cf8284..7493a26333 100644 --- a/tests/introspection/iOS/introspection-ios.csproj +++ b/tests/introspection/iOS/introspection-ios.csproj @@ -149,8 +149,8 @@ - + diff --git a/tests/linker/AppDelegate.cs b/tests/linker/AppDelegate.cs index 49c837407f..93a07e3b3b 100644 --- a/tests/linker/AppDelegate.cs +++ b/tests/linker/AppDelegate.cs @@ -1,18 +1,21 @@ -#if !__WATCHOS__ using System; using System.Reflection; using System.Collections.Generic; +using System.Linq; -using Foundation; +using NUnit.Framework; -public partial class AppDelegate { - public partial IEnumerable GetTestAssemblies () +public static partial class TestLoader { + static partial void AddTestAssembliesImpl (HashSet assemblies) { - return new Assembly [] { - Assembly.GetExecutingAssembly (), - typeof (BundledResources.ResourcesTest).Assembly, - }; + assemblies.Add (typeof (BundledResources.ResourcesTest).Assembly); } } -#endif // !__WATCHOS__ +[TestFixture] +public class LoaderTest { + public void TestAssemblyCount () + { + Assert.AreEqual (2, TestLoader.GetTestAssemblies ().Count (), "Test assembly count"); + } +} diff --git a/tests/linker/ios/dont link/dont link.csproj b/tests/linker/ios/dont link/dont link.csproj index b5af873d23..406316e285 100644 --- a/tests/linker/ios/dont link/dont link.csproj +++ b/tests/linker/ios/dont link/dont link.csproj @@ -142,6 +142,7 @@ + diff --git a/tests/linker/ios/dont link/dotnet/shared.csproj b/tests/linker/ios/dont link/dotnet/shared.csproj index 485b4e57ab..6a3ce95cf2 100644 --- a/tests/linker/ios/dont link/dotnet/shared.csproj +++ b/tests/linker/ios/dont link/dotnet/shared.csproj @@ -46,6 +46,7 @@ CommonDontLinkTest.cs + diff --git a/tests/linker/ios/link all/dotnet/shared.csproj b/tests/linker/ios/link all/dotnet/shared.csproj index 1984e81389..0f5ef0851e 100644 --- a/tests/linker/ios/link all/dotnet/shared.csproj +++ b/tests/linker/ios/link all/dotnet/shared.csproj @@ -84,6 +84,7 @@ NetworkResources.cs + diff --git a/tests/linker/ios/link all/link all.csproj b/tests/linker/ios/link all/link all.csproj index 28f9918fb6..16b1734a2f 100644 --- a/tests/linker/ios/link all/link all.csproj +++ b/tests/linker/ios/link all/link all.csproj @@ -185,6 +185,7 @@ + TestRuntime.cs diff --git a/tests/linker/ios/link sdk/dotnet/shared.csproj b/tests/linker/ios/link sdk/dotnet/shared.csproj index c110980a21..e833d901fc 100644 --- a/tests/linker/ios/link sdk/dotnet/shared.csproj +++ b/tests/linker/ios/link sdk/dotnet/shared.csproj @@ -78,6 +78,7 @@ NetworkResources.cs + diff --git a/tests/linker/ios/link sdk/link sdk.csproj b/tests/linker/ios/link sdk/link sdk.csproj index e565e31e3e..177802e4a9 100644 --- a/tests/linker/ios/link sdk/link sdk.csproj +++ b/tests/linker/ios/link sdk/link sdk.csproj @@ -179,6 +179,7 @@ + TestRuntime.cs diff --git a/tests/linker/ios/trimmode copy/dotnet/shared.csproj b/tests/linker/ios/trimmode copy/dotnet/shared.csproj index 68c6f06d54..6cc8a0ed2f 100644 --- a/tests/linker/ios/trimmode copy/dotnet/shared.csproj +++ b/tests/linker/ios/trimmode copy/dotnet/shared.csproj @@ -47,6 +47,7 @@ ApplePlatform.cs + diff --git a/tests/linker/ios/trimmode link/dotnet/shared.csproj b/tests/linker/ios/trimmode link/dotnet/shared.csproj index 4c05aaf8ea..5bd441413b 100644 --- a/tests/linker/ios/trimmode link/dotnet/shared.csproj +++ b/tests/linker/ios/trimmode link/dotnet/shared.csproj @@ -84,6 +84,7 @@ ApplePlatform.cs + diff --git a/tests/linker/mac/dont link/dont link-mac.csproj b/tests/linker/mac/dont link/dont link-mac.csproj index c003ff5c41..9c052ca104 100644 --- a/tests/linker/mac/dont link/dont link-mac.csproj +++ b/tests/linker/mac/dont link/dont link-mac.csproj @@ -74,6 +74,9 @@ MacMain.cs + + TestAssemblyLoader.cs + TestRuntime.cs diff --git a/tests/linker/mac/link all/link all-mac.csproj b/tests/linker/mac/link all/link all-mac.csproj index 5113e024f5..c348bb1acf 100644 --- a/tests/linker/mac/link all/link all-mac.csproj +++ b/tests/linker/mac/link all/link all-mac.csproj @@ -75,6 +75,9 @@ Mac.cs + + TestAssemblyLoader.cs + DataContractTest.cs diff --git a/tests/linker/mac/link sdk/link sdk-mac.csproj b/tests/linker/mac/link sdk/link sdk-mac.csproj index 47d2e77f36..68d5ed4d4c 100644 --- a/tests/linker/mac/link sdk/link sdk-mac.csproj +++ b/tests/linker/mac/link sdk/link sdk-mac.csproj @@ -73,6 +73,9 @@ Mac.cs + + TestAssemblyLoader.cs + ApplePlatform.cs diff --git a/tests/mono-native/macOS/mono-native.csproj.template b/tests/mono-native/macOS/mono-native.csproj.template index a4081ec327..8727ac7e7f 100644 --- a/tests/mono-native/macOS/mono-native.csproj.template +++ b/tests/mono-native/macOS/mono-native.csproj.template @@ -52,6 +52,9 @@ MonoNativeConfig.cs + + TestAssemblyLoader.cs + MonoNativePlatform.cs diff --git a/tests/monotouch-test/AVFoundation/AudioPlayerTest.cs b/tests/monotouch-test/AVFoundation/AudioPlayerTest.cs index a08a5cdb2a..e37cfd1c8f 100644 --- a/tests/monotouch-test/AVFoundation/AudioPlayerTest.cs +++ b/tests/monotouch-test/AVFoundation/AudioPlayerTest.cs @@ -13,6 +13,7 @@ using System.IO; using Foundation; using AVFoundation; using NUnit.Framework; +using System; namespace MonoTouchFixtures.AVFoundation { @@ -25,13 +26,44 @@ namespace MonoTouchFixtures.AVFoundation { { string file = Path.Combine (NSBundle.MainBundle.ResourcePath, "Hand.wav"); Assert.True (File.Exists (file), file); - NSError error; - using (var url = new NSUrl (file, false)) - using (var ap = AVAudioPlayer.FromUrl (url, out error)) { + using (NSUrl url = new (file, false)) + using (AVAudioPlayer ap = AVAudioPlayer.FromUrl (url, out NSError error)) { Assert.NotNull (ap, "AVAudioPlayer"); Assert.Null (error, "NSError"); } } + + [Test] + public void FromUrlWithInvalidUrl () + { + Assert.DoesNotThrow (() => { + using (AVAudioPlayer player = AVAudioPlayer.FromUrl (NSUrl.FromString ("sdf"), out NSError error)) { + Assert.Null (player, "AVAudioPlayer"); + Assert.NotNull (error, "NSError"); + } + }); + } + + [Test] + public void FromData () + { + using (NSData data = NSData.FromFile (NSBundle.MainBundle.PathForResource ("Hand", "wav"))) + using (AVAudioPlayer player = AVAudioPlayer.FromData (data, out NSError error)) { + Assert.NotNull (player, "AVAudioPlayer"); + Assert.Null (error, "NSError"); + } + } + + [Test] + public void FromDataWithNullData () + { + Assert.Throws (() => { + using (var player = AVAudioPlayer.FromData (null, out NSError error)) { + Assert.Null (player, "AVAudioPlayer"); + Assert.NotNull (error, "NSError"); + } + }); + } } } diff --git a/tests/monotouch-test/AppDelegate.cs b/tests/monotouch-test/AppDelegate.cs index 32f786445e..caef479bea 100644 --- a/tests/monotouch-test/AppDelegate.cs +++ b/tests/monotouch-test/AppDelegate.cs @@ -26,15 +26,6 @@ public partial class AppDelegate : UIApplicationDelegate { } #endif - public partial IEnumerable GetTestAssemblies () - { - return new Assembly [] { - Assembly.GetExecutingAssembly (), - typeof (EmbeddedResources.ResourcesTest).Assembly, - typeof (Xamarin.BindingTests.ProtocolTest).Assembly, - }; - } - partial void PostFinishedLaunching () { // required for the background tasks tests, we can only register the tasks in this method diff --git a/tests/monotouch-test/ObjCRuntime/ResourcesTest.cs b/tests/monotouch-test/ObjCRuntime/ResourcesTest.cs new file mode 100644 index 0000000000..5db5e07231 --- /dev/null +++ b/tests/monotouch-test/ObjCRuntime/ResourcesTest.cs @@ -0,0 +1,41 @@ +// +// Resource Bundling Tests +// +// Authors: +// Rolf Bjarne Kvinge (rolf@xamarin.com) +// +// Copyright 2022 Microsoft Corp. All rights reserved. +// + +using System; +using System.IO; +using System.Resources; +using System.Globalization; +using System.Reflection; +using System.Reflection.Emit; +using NUnit.Framework; + +using Foundation; +using ObjCRuntime; + +namespace MonoTouchFixtures.ObjCRuntime { + + [TestFixture] + [Preserve (AllMembers = true)] + public class ResourcesTest { + + [Test] + public void Embedded () + { + var manager = new ResourceManager ("monotouchtest.Welcome", typeof (ResourcesTest).Assembly); + + Assert.AreEqual ("Welcome!", manager.GetString ("String1", new CultureInfo ("en")), "en"); + Assert.AreEqual ("G'day!", manager.GetString ("String1", new CultureInfo ("en-AU")), "en-AU"); + Assert.AreEqual ("Willkommen!", manager.GetString ("String1", new CultureInfo ("de")), "de"); + Assert.AreEqual ("Willkommen!", manager.GetString ("String1", new CultureInfo ("de-DE")), "de-DE"); + Assert.AreEqual ("Bienvenido!", manager.GetString ("String1", new CultureInfo ("es")), "es"); + Assert.AreEqual ("Bienvenido!", manager.GetString ("String1", new CultureInfo ("es-AR")), "es-AR"); + Assert.AreEqual ("Bienvenido!", manager.GetString ("String1", new CultureInfo ("es-ES")), "es-ES"); + } + } +} diff --git a/tests/monotouch-test/Resources/Welcome.de.resx b/tests/monotouch-test/Resources/Welcome.de.resx new file mode 100755 index 0000000000..b3af7f8a05 --- /dev/null +++ b/tests/monotouch-test/Resources/Welcome.de.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Willkommen! + + \ No newline at end of file diff --git a/tests/monotouch-test/Resources/Welcome.en-AU.resx b/tests/monotouch-test/Resources/Welcome.en-AU.resx new file mode 100755 index 0000000000..78128ea5a6 --- /dev/null +++ b/tests/monotouch-test/Resources/Welcome.en-AU.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + G'day! + + \ No newline at end of file diff --git a/tests/monotouch-test/Resources/Welcome.es.resx b/tests/monotouch-test/Resources/Welcome.es.resx new file mode 100755 index 0000000000..01def8cc90 --- /dev/null +++ b/tests/monotouch-test/Resources/Welcome.es.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Bienvenido! + + \ No newline at end of file diff --git a/tests/monotouch-test/Resources/Welcome.resx b/tests/monotouch-test/Resources/Welcome.resx new file mode 100755 index 0000000000..84bd58aab1 --- /dev/null +++ b/tests/monotouch-test/Resources/Welcome.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Welcome! + + \ No newline at end of file diff --git a/tests/monotouch-test/TestLoader.cs b/tests/monotouch-test/TestLoader.cs new file mode 100644 index 0000000000..7ae2b57f18 --- /dev/null +++ b/tests/monotouch-test/TestLoader.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + +using NUnit.Framework; + +using Foundation; + +#nullable enable + +public static partial class TestLoader { + static partial void AddTestAssembliesImpl (HashSet assemblies) + { + assemblies.Add (typeof (EmbeddedResources.ResourcesTest).Assembly); + assemblies.Add (typeof (Xamarin.BindingTests.ProtocolTest).Assembly); + } +} + +[TestFixture] +[Preserve (AllMembers = true)] +public class LoaderTest { + public void TestAssemblyCount () + { + Assert.AreEqual (3, TestLoader.GetTestAssemblies ().Count (), "Test assembly count"); + } +} diff --git a/tests/monotouch-test/dotnet/shared.csproj b/tests/monotouch-test/dotnet/shared.csproj index 38998cd86b..927abc37a0 100644 --- a/tests/monotouch-test/dotnet/shared.csproj +++ b/tests/monotouch-test/dotnet/shared.csproj @@ -55,6 +55,9 @@ Extensions.cs + + TestAssemblyLoader.cs + ApplePlatform.cs @@ -156,6 +159,18 @@ monotouchtest.Security.openssl_crt.der + + monotouchtest.Welcome.resources + + + monotouchtest.Welcome.en-AU.resources + + + monotouchtest.Welcome.es.resources + + + monotouchtest.Welcome.de.resources + diff --git a/tests/monotouch-test/monotouch-test.csproj b/tests/monotouch-test/monotouch-test.csproj index a0f1a8ad5b..ce040de6d1 100644 --- a/tests/monotouch-test/monotouch-test.csproj +++ b/tests/monotouch-test/monotouch-test.csproj @@ -206,6 +206,9 @@ Extensions.cs + + TestAssemblyLoader.cs + ApplePlatform.cs @@ -352,6 +355,18 @@ monotouchtest.Security.openssl_crt.der + + monotouchtest.Welcome.resources + + + monotouchtest.Welcome.en-AU.resources + + + monotouchtest.Welcome.es.resources + + + monotouchtest.Welcome.de.resources + diff --git a/tests/packaged-macos-tests.mk b/tests/packaged-macos-tests.mk index f49dec576c..5e9730d7c6 100644 --- a/tests/packaged-macos-tests.mk +++ b/tests/packaged-macos-tests.mk @@ -26,7 +26,7 @@ LAUNCH_ARGUMENTS=--autostart --autoexit # Time test runs out after 5 minutes (300 seconds) RUN_WITH_TIMEOUT=./run-with-timeout.csharp 300 -# Some tests need a bit more time... (introspection) +# Some tests need a bit more time... (introspection, monotouch-test/xammac_tests) RUN_WITH_TIMEOUT_LONGER=./run-with-timeout.csharp 600 .stamp-configure-projects-mac: Makefile xharness/xharness.exe @@ -94,7 +94,7 @@ build-mac-modern-xammac_tests: xammac_tests/xammac_tests.csproj .stamp-nuget-res exec-mac-modern-xammac_tests: @echo "ℹ️ Executing the 'xammac' test for Xamarin.Mac (Modern profile) ℹ️" - $(Q) $(RUN_WITH_TIMEOUT) xammac_tests/bin/x86/$(CONFIG)/xammac_tests.app/Contents/MacOS/xammac_tests + $(Q) $(RUN_WITH_TIMEOUT_LONGER) xammac_tests/bin/x86/$(CONFIG)/xammac_tests.app/Contents/MacOS/xammac_tests # # link all @@ -221,7 +221,7 @@ endif $$(Q) if test -e ".$$@-failure.stamp"; then cat ".$$@-failure.stamp"; rm ".$$@-failure.stamp"; exit 1; fi endef -$(eval $(call DotNetNormalTest,monotouch-test,monotouchtest)) +$(eval $(call DotNetNormalTest,monotouch-test,monotouchtest,_LONGER)) $(eval $(call DotNetNormalTest,introspection,introspection,_LONGER)) ### .NET linker tests diff --git a/tests/xammac_tests/xammac_tests.csproj b/tests/xammac_tests/xammac_tests.csproj index 6cef21d0c5..193a040dd0 100644 --- a/tests/xammac_tests/xammac_tests.csproj +++ b/tests/xammac_tests/xammac_tests.csproj @@ -132,6 +132,9 @@ ExecutionHelper.cs + + TestAssemblyLoader.cs + api-shared\ObjCRuntime\RegistrarTest.cs @@ -265,6 +268,18 @@ EmbeddedResources\Welcome.es.resx + + monotouchtest.Welcome.resources + + + monotouchtest.Welcome.en-AU.resources + + + monotouchtest.Welcome.es.resources + + + monotouchtest.Welcome.de.resources + diff --git a/tests/xcframework-test/dotnet/shared.csproj b/tests/xcframework-test/dotnet/shared.csproj index 80466ebc6a..4434b8963c 100644 --- a/tests/xcframework-test/dotnet/shared.csproj +++ b/tests/xcframework-test/dotnet/shared.csproj @@ -28,10 +28,10 @@ - + TestRuntime.cs diff --git a/tests/xcframework-test/iOS/AppDelegate.cs b/tests/xcframework-test/iOS/AppDelegate.cs deleted file mode 100644 index 6cf252b489..0000000000 --- a/tests/xcframework-test/iOS/AppDelegate.cs +++ /dev/null @@ -1,17 +0,0 @@ -#if !__WATCHOS__ -using System; -using System.Reflection; -using System.Collections.Generic; - -using Foundation; - -public partial class AppDelegate { - public partial IEnumerable GetTestAssemblies () - { - return new Assembly [] { - Assembly.GetExecutingAssembly (), - }; - } -} - -#endif // !__WATCHOS__ diff --git a/tests/xcframework-test/iOS/xcframework-test-ios.csproj b/tests/xcframework-test/iOS/xcframework-test-ios.csproj index 04413c7620..85e6289e5d 100644 --- a/tests/xcframework-test/iOS/xcframework-test-ios.csproj +++ b/tests/xcframework-test/iOS/xcframework-test-ios.csproj @@ -165,8 +165,8 @@ - + diff --git a/tests/xcframework-test/macOS/xcframework-test-mac.csproj b/tests/xcframework-test/macOS/xcframework-test-mac.csproj index c33c25f5cf..d65f4db1c1 100644 --- a/tests/xcframework-test/macOS/xcframework-test-mac.csproj +++ b/tests/xcframework-test/macOS/xcframework-test-mac.csproj @@ -69,6 +69,9 @@ MacMain.cs + + TestAssemblyLoader.cs + TestRuntime.cs diff --git a/tests/xharness/Jenkins/TestVariationsFactory.cs b/tests/xharness/Jenkins/TestVariationsFactory.cs index a891584ee8..5f5e89bf53 100644 --- a/tests/xharness/Jenkins/TestVariationsFactory.cs +++ b/tests/xharness/Jenkins/TestVariationsFactory.cs @@ -151,8 +151,13 @@ namespace Xharness.Jenkins { yield return new TestData { Variation = "Debug (static registrar)", Registrar = "static", Debug = true, Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Monotouch) || !jenkins.TestSelection.IsEnabled (PlatformLabel.Mac), }; yield return new TestData { Variation = "Debug (static registrar, ARM64)", Registrar = "static", Debug = true, Profiling = false, Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Monotouch) || !jenkins.TestSelection.IsEnabled (PlatformLabel.Mac) || !mac_supports_arm64, RuntimeIdentifier = arm64_runtime_identifier, }; } - if (test.Platform == TestPlatform.MacCatalyst) + if (test.Platform == TestPlatform.MacCatalyst) { yield return new TestData { Variation = "Release (ARM64, LLVM)", Debug = false, UseLlvm = true, Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Monotouch) || !jenkins.TestSelection.IsEnabled (PlatformLabel.MacCatalyst) || !mac_supports_arm64, RuntimeIdentifier = arm64_runtime_identifier }; + yield return new TestData { Variation = "Release", Debug = false, Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Monotouch) || !jenkins.TestSelection.IsEnabled (PlatformLabel.MacCatalyst) }; + } + if (test.Platform == TestPlatform.Mac) { + yield return new TestData { Variation = "Release", Debug = false, Ignored = !jenkins.TestSelection.IsEnabled (TestLabel.Monotouch) || !jenkins.TestSelection.IsEnabled (PlatformLabel.Mac) }; + } } break; case "xammac tests": diff --git a/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVFoundation.ignore b/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVFoundation.ignore index 74e15e6946..a10ca55f52 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVFoundation.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVFoundation.ignore @@ -12,3 +12,8 @@ ### deprecated in iOS8 !missing-protocol-member! AVAudioPlayerDelegate::audioPlayerEndInterruption:withFlags: not found + +## https://github.com/xamarin/xamarin-macios/issues/16229 prevents crashing instead of return null +## so these selectors have been bound manually +!missing-selector! AVAudioPlayer::initWithContentsOfURL:error: not bound +!missing-selector! AVAudioPlayer::initWithData:error: not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVFoundation.ignore b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVFoundation.ignore index 065f8e7d96..6427e4c916 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVFoundation.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVFoundation.ignore @@ -43,3 +43,8 @@ # not used on macOS !missing-enum! AVAudioSessionInterruptionReason not bound + +## https://github.com/xamarin/xamarin-macios/issues/16229 prevents crashing instead of return null +## so these selectors have been bound manually +!missing-selector! AVAudioPlayer::initWithContentsOfURL:error: not bound +!missing-selector! AVAudioPlayer::initWithData:error: not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore index c44407e73a..f10fa3ed59 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore @@ -1697,7 +1697,6 @@ !missing-selector! NSWindow::handleSaveScriptCommand: not bound !missing-selector! NSWindow::hasCloseBox not bound !missing-selector! NSWindow::hasTitleBar not bound -!missing-selector! NSWindow::initWithWindowRef: not bound !missing-selector! NSWindow::isFloatingPanel not bound !missing-selector! NSWindow::isMiniaturizable not bound !missing-selector! NSWindow::isModalPanel not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVFoundation.ignore b/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVFoundation.ignore index b01b308c8f..66de0b4a1e 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVFoundation.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVFoundation.ignore @@ -9,3 +9,8 @@ ### deprecated in iOS8 !missing-protocol-member! AVAudioPlayerDelegate::audioPlayerEndInterruption:withFlags: not found + +## https://github.com/xamarin/xamarin-macios/issues/16229 prevents crashing instead of return null +## so these selectors have been bound manually +!missing-selector! AVAudioPlayer::initWithContentsOfURL:error: not bound +!missing-selector! AVAudioPlayer::initWithData:error: not bound diff --git a/tests/xtro-sharpie/iOS-AVFoundation.ignore b/tests/xtro-sharpie/iOS-AVFoundation.ignore index f3bb8993b1..bf09307248 100644 --- a/tests/xtro-sharpie/iOS-AVFoundation.ignore +++ b/tests/xtro-sharpie/iOS-AVFoundation.ignore @@ -29,3 +29,10 @@ !incorrect-protocol-member! AVAudio3DMixing::sourceMode is REQUIRED and should be abstract !extra-null-allowed! 'Foundation.NSNumber[] AVFoundation.AVVideoCompositionInstruction::get_RequiredSourceTrackIDs()' has a extraneous [NullAllowed] on return type !missing-field! AVPlayerItemTimeJumpedOriginatingParticipantKey not bound + +## https://github.com/xamarin/xamarin-macios/issues/16229 prevents crashing instead of return null +## so these selectors have been bound manually +!missing-selector! AVAudioPlayer::initWithContentsOfURL:error: not bound +!missing-selector! AVAudioPlayer::initWithData:error: not bound + + diff --git a/tests/xtro-sharpie/macOS-AVFoundation.ignore b/tests/xtro-sharpie/macOS-AVFoundation.ignore index 8c83f2062b..56e7081c32 100644 --- a/tests/xtro-sharpie/macOS-AVFoundation.ignore +++ b/tests/xtro-sharpie/macOS-AVFoundation.ignore @@ -61,3 +61,10 @@ !incorrect-protocol-member! AVAudio3DMixing::sourceMode is REQUIRED and should be abstract !extra-null-allowed! 'Foundation.NSNumber[] AVFoundation.AVVideoCompositionInstruction::get_RequiredSourceTrackIDs()' has a extraneous [NullAllowed] on return type !missing-field! AVPlayerItemTimeJumpedOriginatingParticipantKey not bound + +## https://github.com/xamarin/xamarin-macios/issues/16229 prevents crashing instead of return null +## so these selectors have been bound manually +!missing-selector! AVAudioPlayer::initWithContentsOfURL:error: not bound +!missing-selector! AVAudioPlayer::initWithData:error: not bound + + diff --git a/tests/xtro-sharpie/tvOS-AVFoundation.ignore b/tests/xtro-sharpie/tvOS-AVFoundation.ignore index 8e0c60da5e..c6d83fb7ba 100644 --- a/tests/xtro-sharpie/tvOS-AVFoundation.ignore +++ b/tests/xtro-sharpie/tvOS-AVFoundation.ignore @@ -24,3 +24,8 @@ !incorrect-protocol-member! AVAudio3DMixing::sourceMode is REQUIRED and should be abstract !extra-null-allowed! 'Foundation.NSNumber[] AVFoundation.AVVideoCompositionInstruction::get_RequiredSourceTrackIDs()' has a extraneous [NullAllowed] on return type !missing-field! AVPlayerItemTimeJumpedOriginatingParticipantKey not bound + +## https://github.com/xamarin/xamarin-macios/issues/16229 prevents crashing instead of return null +## so these selectors have been bound manually +!missing-selector! AVAudioPlayer::initWithContentsOfURL:error: not bound +!missing-selector! AVAudioPlayer::initWithData:error: not bound diff --git a/tests/xtro-sharpie/watchOS-AVFoundation.ignore b/tests/xtro-sharpie/watchOS-AVFoundation.ignore index 2583e96ade..a4251c18bc 100644 --- a/tests/xtro-sharpie/watchOS-AVFoundation.ignore +++ b/tests/xtro-sharpie/watchOS-AVFoundation.ignore @@ -31,3 +31,8 @@ !unknown-native-enum! AVAudioSessionFlags bound !missing-protocol-member! AVAudioPlayerDelegate::audioPlayerEndInterruption:withFlags: not found !missing-protocol-member! AVAudioRecorderDelegate::audioRecorderEndInterruption:withOptions: not found + +## https://github.com/xamarin/xamarin-macios/issues/16229 prevents crashing instead of return null +## so these selectors have been bound manually +!missing-selector! AVAudioPlayer::initWithContentsOfURL:error: not bound +!missing-selector! AVAudioPlayer::initWithData:error: not bound diff --git a/tools/common/Frameworks.cs b/tools/common/Frameworks.cs index aa1472fee1..b73f532068 100644 --- a/tools/common/Frameworks.cs +++ b/tools/common/Frameworks.cs @@ -454,7 +454,7 @@ public class Frameworks : Dictionary { { "AVRouting", "AVRouting", 16,0}, { "BackgroundAssets", "BackgroundAssets", 16,0}, - { "PushToTalk", "PushToTalk", new Version (16,0), NotAvailableInSimulator}, + { "PushToTalk", "PushToTalk", new Version (16,0), new Version (16, 2) /* available to build with, although it's unusable */}, { "SharedWithYou", "SharedWithYou", 16, 0 }, { "SharedWithYouCore", "SharedWithYouCore", 16, 0 }, diff --git a/tools/mtouch/TranslatedAssemblies/Errors.cs.resx b/tools/mtouch/TranslatedAssemblies/Errors.cs.resx index 948e49ac96..a5e2a31b18 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.cs.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.cs.resx @@ -1747,7 +1747,7 @@ Nelze vytvořit instanci typu {0}. - An exception occurred while trying to invoke the function {0}: {1} + Při pokusu o vyvolání funkce {0} došlo k výjimce: {1} 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.de.resx b/tools/mtouch/TranslatedAssemblies/Errors.de.resx index d3fd283db2..afefd29dd0 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.de.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.de.resx @@ -1747,7 +1747,7 @@ Es kann keine Instanz des Typs {0}erstellt werden. - An exception occurred while trying to invoke the function {0}: {1} + Ausnahme beim Aufrufen der Funktion {0}: {1} 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.es.resx b/tools/mtouch/TranslatedAssemblies/Errors.es.resx index e3d027d240..137b6b9801 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.es.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.es.resx @@ -1747,7 +1747,7 @@ No se puede crear una instancia de tipo {0}. - An exception occurred while trying to invoke the function {0}: {1} + Excepción al intentar invocar la función {0}: {1}. 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.fr.resx b/tools/mtouch/TranslatedAssemblies/Errors.fr.resx index 69315e6365..c2d4027c31 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.fr.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.fr.resx @@ -1747,7 +1747,7 @@ Impossible de créer une instance du type {0}. - An exception occurred while trying to invoke the function {0}: {1} + Une exception s’est produite lors de la tentative d’appel de la fonction {0} : {1}. 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.it.resx b/tools/mtouch/TranslatedAssemblies/Errors.it.resx index 71746a6957..c46ff95efa 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.it.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.it.resx @@ -1747,7 +1747,7 @@ Impossibile creare un'istanza del tipo di {0}. - An exception occurred while trying to invoke the function {0}: {1} + È stata rilevata un'eccezione durante un tentativo di richiamare la funzione {0}: {1} 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.ja.resx b/tools/mtouch/TranslatedAssemblies/Errors.ja.resx index b13c0a8f91..5340eeb6cd 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.ja.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.ja.resx @@ -1748,7 +1748,7 @@ 型 {0} のインスタンスを作成できません。 - An exception occurred while trying to invoke the function {0}: {1} + 関数 {0} の呼び出し中に例外が発生しました: {1} 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.ko.resx b/tools/mtouch/TranslatedAssemblies/Errors.ko.resx index b10e67af53..17c358f6f4 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.ko.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.ko.resx @@ -1747,7 +1747,7 @@ {0} 형식의 인스턴스를 만들 수 없습니다. - An exception occurred while trying to invoke the function {0}: {1} + 함수 {0}: {1}을(를) 호출하는 동안 예외가 발생했습니다. 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.pl.resx b/tools/mtouch/TranslatedAssemblies/Errors.pl.resx index d0b71ba9ba..f89251ca29 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.pl.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.pl.resx @@ -1747,7 +1747,7 @@ Nie można utworzyć wystąpienia typu {0}. - An exception occurred while trying to invoke the function {0}: {1} + Wystąpił wyjątek podczas próby wywołania funkcji {0}: {1} 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.pt-BR.resx b/tools/mtouch/TranslatedAssemblies/Errors.pt-BR.resx index 624385bb9a..0870e68ae6 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.pt-BR.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.pt-BR.resx @@ -1747,7 +1747,7 @@ Não foi possível criar uma instância do tipo {0}. - An exception occurred while trying to invoke the function {0}: {1} + Ocorreu uma exceção ao tentar invocar a função {0}: {1} 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.ru.resx b/tools/mtouch/TranslatedAssemblies/Errors.ru.resx index 5f1c57ac02..60b84af388 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.ru.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.ru.resx @@ -1747,7 +1747,7 @@ Невозможно создать экземпляр типа {0}. - An exception occurred while trying to invoke the function {0}: {1} + Возникло исключение при попытке вызвать функцию {0}: {1}. 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.tr.resx b/tools/mtouch/TranslatedAssemblies/Errors.tr.resx index fdf30183ec..e822cd6083 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.tr.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.tr.resx @@ -1747,7 +1747,7 @@ {0} türünde örnek oluşturulamıyor. - An exception occurred while trying to invoke the function {0}: {1} + {0} işlevi çağrılmaya çalışılırken özel durum oluştu: {1} 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.zh-Hans.resx b/tools/mtouch/TranslatedAssemblies/Errors.zh-Hans.resx index 5ca5560deb..aa470ad72a 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.zh-Hans.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.zh-Hans.resx @@ -1747,7 +1747,7 @@ 无法创建类型 {0} 的实例。 - An exception occurred while trying to invoke the function {0}: {1} + 尝试调用函数 {0} 时发生异常: {1}。 0: name of function 1: exception info diff --git a/tools/mtouch/TranslatedAssemblies/Errors.zh-Hant.resx b/tools/mtouch/TranslatedAssemblies/Errors.zh-Hant.resx index e520853a1c..07e9d37ca8 100644 --- a/tools/mtouch/TranslatedAssemblies/Errors.zh-Hant.resx +++ b/tools/mtouch/TranslatedAssemblies/Errors.zh-Hant.resx @@ -1747,7 +1747,7 @@ 無法建立 {0} 類型的執行個體。 - An exception occurred while trying to invoke the function {0}: {1} + 嘗試叫用函數 {0} 時發生例外狀況: {1} 0: name of function 1: exception info