diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index 6d3f2efaf848ce..015825df43d7a6 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -3,19 +3,19 @@
"isRoot": true,
"tools": {
"coverlet.console": {
- "version": "1.7.2",
+ "version": "3.1.0",
"commands": [
"coverlet"
]
},
"dotnet-reportgenerator-globaltool": {
- "version": "4.5.8",
+ "version": "5.0.2",
"commands": [
"reportgenerator"
]
},
"microsoft.dotnet.xharness.cli": {
- "version": "1.0.0-prerelease.21622.1",
+ "version": "1.0.0-prerelease.22062.1",
"commands": [
"xharness"
]
diff --git a/.github/fabricbot.json b/.github/fabricbot.json
index 72acfd8440a06d..c885e482566300 100644
--- a/.github/fabricbot.json
+++ b/.github/fabricbot.json
@@ -6003,25 +6003,7 @@
{
"name": "hasLabel",
"parameters": {
- "label": "area-System.Collections"
- }
- },
- {
- "name": "hasLabel",
- "parameters": {
- "label": "area-System.Linq"
- }
- },
- {
- "name": "hasLabel",
- "parameters": {
- "label": "area-System.Text.Json"
- }
- },
- {
- "name": "hasLabel",
- "parameters": {
- "label": "area-System.Xml"
+ "label": "area-Meta"
}
}
]
@@ -6032,7 +6014,7 @@
{
"name": "isInProject",
"parameters": {
- "projectName": "Area Pod: Eirik / Krzysztof / Layomi - PRs",
+ "projectName": "Area Pod: Eric / Jeff - PRs",
"isOrgProject": true
}
}
@@ -6046,12 +6028,12 @@
"issues",
"project_card"
],
- "taskName": "[Area Pod: Eirik / Krzysztof / Layomi - PRs] Add new PR to Board",
+ "taskName": "[Area Pod: Eric / Jeff - PRs] Add new PR to Board",
"actions": [
{
"name": "addToProject",
"parameters": {
- "projectName": "Area Pod: Eirik / Krzysztof / Layomi - PRs",
+ "projectName": "Area Pod: Eric / Jeff - PRs",
"columnName": "Needs Champion",
"isOrgProject": true
}
@@ -6723,6 +6705,119 @@
]
}
},
+ {
+ "taskType": "trigger",
+ "capabilityId": "IssueResponder",
+ "subCapability": "PullRequestResponder",
+ "version": "1.0",
+ "config": {
+ "conditions": {
+ "operator": "and",
+ "operands": [
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.CodeDom"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Configuration"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Reflection"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Reflection.Emit"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Reflection.Metadata"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Resources"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Runtime.CompilerServices"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Text.RegularExpressions"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Threading.Channels"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Threading.Tasks"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.DirectoryServices"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "isInProject",
+ "parameters": {
+ "projectName": "Area Pod: Buyaa / Jose / Steve - PRs",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "eventType": "pull_request",
+ "eventNames": [
+ "pull_request",
+ "issues",
+ "project_card"
+ ],
+ "taskName": "[Area Pod: Buyaa / Jose / Steve - PRs] Add new PR to Board",
+ "actions": [
+ {
+ "name": "addToProject",
+ "parameters": {
+ "projectName": "Area Pod: Buyaa / Jose / Steve - PRs",
+ "columnName": "Needs Champion",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ },
{
"taskType": "trigger",
"capabilityId": "IssueResponder",
@@ -7294,6 +7389,77 @@
]
}
},
+ {
+ "taskType": "trigger",
+ "capabilityId": "IssueResponder",
+ "subCapability": "PullRequestResponder",
+ "version": "1.0",
+ "config": {
+ "conditions": {
+ "operator": "and",
+ "operands": [
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Collections"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Linq"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Text.Json"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Xml"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "isInProject",
+ "parameters": {
+ "projectName": "Area Pod: Eirik / Krzysztof / Layomi - PRs",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "eventType": "pull_request",
+ "eventNames": [
+ "pull_request",
+ "issues",
+ "project_card"
+ ],
+ "taskName": "[Area Pod: Eirik / Krzysztof / Layomi - PRs] Add new PR to Board",
+ "actions": [
+ {
+ "name": "addToProject",
+ "parameters": {
+ "projectName": "Area Pod: Eirik / Krzysztof / Layomi - PRs",
+ "columnName": "Needs Champion",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ },
{
"taskType": "trigger",
"capabilityId": "IssueResponder",
@@ -7379,5 +7545,984 @@
}
]
}
+ },
+ {
+ "taskType": "trigger",
+ "capabilityId": "IssueResponder",
+ "subCapability": "IssuesOnlyResponder",
+ "version": "1.0",
+ "config": {
+ "conditions": {
+ "operator": "and",
+ "operands": [
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "operator": "and",
+ "operands": [
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-DependencyModel"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Caching"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Configuration"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-DependencyInjection"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Hosting"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Logging"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Options"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Primitives"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel.Composition"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Composition"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Diagnostics.Activity"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Globalization"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "name": "isAction",
+ "parameters": {
+ "action": "reopened"
+ }
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "isInMilestone",
+ "parameters": {}
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-DependencyModel"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-Extensions-Caching"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-Extensions-Configuration"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-Extensions-DependencyInjection"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-Extensions-Hosting"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-Extensions-Logging"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-Extensions-Options"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-Extensions-Primitives"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-System.ComponentModel"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-System.ComponentModel.Composition"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-System.Composition"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-System.Diagnostics.Activity"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-System.Globalization"
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name": "isOpen",
+ "parameters": {}
+ },
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "isInProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "isOrgProject": true
+ }
+ }
+ ]
+ },
+ {
+ "name": "isInProjectColumn",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "isOrgProject": true,
+ "columnName": "Triaged"
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "eventType": "issue",
+ "eventNames": [
+ "issues",
+ "project_card"
+ ],
+ "taskName": "[Area Pod: Eric / Maryam / Tarek - Issue Triage] Add new issue to Board",
+ "actions": [
+ {
+ "name": "addToProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "columnName": "Needs Triage",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ },
+ {
+ "taskType": "trigger",
+ "capabilityId": "IssueResponder",
+ "subCapability": "IssueCommentResponder",
+ "version": "1.0",
+ "config": {
+ "conditions": {
+ "operator": "and",
+ "operands": [
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-DependencyModel"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Caching"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Configuration"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-DependencyInjection"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Hosting"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Logging"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Options"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Primitives"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel.Composition"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Composition"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Diagnostics.Activity"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Globalization"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "isCloseAndComment",
+ "parameters": {}
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "activitySenderHasPermissions",
+ "parameters": {
+ "permissions": "write"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "isInProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "isOrgProject": true
+ }
+ }
+ ]
+ },
+ {
+ "name": "isInProjectColumn",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "columnName": "Triaged",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "eventType": "issue",
+ "eventNames": [
+ "issue_comment"
+ ],
+ "taskName": "[Area Pod: Eric / Maryam / Tarek - Issue Triage] Needs Further Triage",
+ "actions": [
+ {
+ "name": "addToProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "columnName": "Needs Triage",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ },
+ {
+ "taskType": "trigger",
+ "capabilityId": "IssueResponder",
+ "subCapability": "IssuesOnlyResponder",
+ "version": "1.0",
+ "config": {
+ "conditions": {
+ "operator": "and",
+ "operands": [
+ {
+ "name": "isInProjectColumn",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "columnName": "Needs Triage",
+ "isOrgProject": true
+ }
+ },
+ {
+ "operator": "and",
+ "operands": [
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-DependencyModel"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Caching"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Configuration"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-DependencyInjection"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Hosting"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Logging"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Options"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Primitives"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel.Composition"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Composition"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Diagnostics.Activity"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Globalization"
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "eventType": "issue",
+ "eventNames": [
+ "issues",
+ "project_card"
+ ],
+ "taskName": "[Area Pod: Eric / Maryam / Tarek - Issue Triage] Remove relabeled issues",
+ "actions": [
+ {
+ "name": "removeFromProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ },
+ {
+ "taskType": "trigger",
+ "capabilityId": "IssueResponder",
+ "subCapability": "IssuesOnlyResponder",
+ "version": "1.0",
+ "config": {
+ "conditions": {
+ "operator": "and",
+ "operands": [
+ {
+ "name": "isInProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "isOrgProject": true
+ }
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "isInProjectColumn",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "columnName": "Triaged"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "name": "addedToMilestone",
+ "parameters": {}
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "needs more info"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "api-ready-for-review"
+ }
+ },
+ {
+ "name": "isAction",
+ "parameters": {
+ "action": "closed"
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "eventType": "issue",
+ "eventNames": [
+ "issues",
+ "project_card"
+ ],
+ "taskName": "[Area Pod: Eric / Maryam / Tarek - Issue Triage] Move to Triaged Column",
+ "actions": [
+ {
+ "name": "addToProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "columnName": "Triaged",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ },
+ {
+ "taskType": "trigger",
+ "capabilityId": "IssueResponder",
+ "subCapability": "PullRequestResponder",
+ "version": "1.0",
+ "config": {
+ "conditions": {
+ "operator": "and",
+ "operands": [
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-DependencyModel"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Caching"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Configuration"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-DependencyInjection"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Hosting"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Logging"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Options"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Primitives"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel.Composition"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Composition"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Diagnostics.Activity"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Globalization"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "isInProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - PRs",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "eventType": "pull_request",
+ "eventNames": [
+ "pull_request",
+ "issues",
+ "project_card"
+ ],
+ "taskName": "[Area Pod: Eric / Maryam / Tarek - PRs] Add new PR to Board",
+ "actions": [
+ {
+ "name": "addToProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - PRs",
+ "columnName": "Needs Champion",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ },
+ {
+ "taskType": "trigger",
+ "capabilityId": "IssueResponder",
+ "subCapability": "PullRequestResponder",
+ "version": "1.0",
+ "config": {
+ "conditions": {
+ "operator": "and",
+ "operands": [
+ {
+ "name": "isInProjectColumn",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - PRs",
+ "columnName": "Needs Champion",
+ "isOrgProject": true
+ }
+ },
+ {
+ "operator": "and",
+ "operands": [
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-DependencyModel"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Caching"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Configuration"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-DependencyInjection"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Hosting"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Logging"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Options"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Primitives"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel.Composition"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Composition"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Diagnostics.Activity"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Globalization"
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "eventType": "pull_request",
+ "eventNames": [
+ "pull_request",
+ "issues",
+ "project_card"
+ ],
+ "taskName": "[Area Pod: Eric / Maryam / Tarek - PRs] Remove relabeled PRs",
+ "actions": [
+ {
+ "name": "removeFromProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - PRs",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
}
]
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index c1a783db2aa7c9..6627d2c2d0a75b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -187,6 +187,7 @@ node_modules/
*.metaproj.tmp
bin.localpkg/
src/mono/wasm/runtime/dotnet.d.ts.sha256
+src/mono/sample/wasm/browser-nextjs/public/
# RIA/Silverlight projects
Generated_Code/
diff --git a/Directory.Build.props b/Directory.Build.props
index 0983ba4ae36f89..e9e6fc4e362346 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -31,6 +31,7 @@
arm
armel
arm64
+ loongarch64
s390x
wasm
x64
@@ -157,26 +158,27 @@
- <_toolRuntimeRID Condition="'$(CrossBuild)' == 'true'">$(_hostOS.ToLowerInvariant)-$(_hostArch)
- <_toolRuntimeRID Condition="'$(BuildingInsideVisualStudio)' == 'true'">$(_runtimeOS)-x64
- <_toolRuntimeRID Condition="'$(_toolRuntimeRID)' == ''">$(_runtimeOS)-$(_hostArch)
+ <_toolsRID Condition="'$(CrossBuild)' == 'true'">$(_hostOS.ToLowerInvariant)-$(_hostArch)
+ <_toolsRID Condition="'$(BuildingInsideVisualStudio)' == 'true'">$(_runtimeOS)-x64
+ <_toolsRID Condition="'$(_toolsRID)' == ''">$(_runtimeOS)-$(_hostArch)
- <_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser'">linux-x64
- <_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser' and '$(HostOS)' == 'windows'">win-x64
- <_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser' and '$(HostOS)' == 'osx'">osx-x64
+ <_toolsRID Condition="'$(_runtimeOS)' == 'browser'">linux-x64
+ <_toolsRID Condition="'$(_runtimeOS)' == 'browser' and '$(HostOS)' == 'windows'">win-x64
+ <_toolsRID Condition="'$(_runtimeOS)' == 'browser' and '$(HostOS)' == 'osx'">osx-x64
- <_toolRuntimeRID Condition="'$(_runtimeOS)' == 'android'">linux-x64
- <_toolRuntimeRID Condition="'$(_runtimeOS)' == 'android' and '$(HostOS)' == 'windows'">win-x64
- <_toolRuntimeRID Condition="'$(_runtimeOS)' == 'android' and '$(HostOS)' == 'osx'">osx-x64
+ <_toolsRID Condition="'$(_runtimeOS)' == 'android'">linux-x64
+ <_toolsRID Condition="'$(_runtimeOS)' == 'android' and '$(HostOS)' == 'windows'">win-x64
+ <_toolsRID Condition="'$(_runtimeOS)' == 'android' and '$(HostOS)' == 'osx'">osx-x64
- <_toolRuntimeRID Condition="'$(_runtimeOS)' == 'maccatalyst' or '$(_runtimeOS)' == 'ios' or '$(_runtimeOS)' == 'iOSSimulator' or '$(_runtimeOS)' == 'tvos' or '$(_runtimeOS)' == 'tvOSSimulator'">osx-x64
+ <_toolsRID Condition="'$(_runtimeOS)' == 'maccatalyst' or '$(_runtimeOS)' == 'ios' or '$(_runtimeOS)' == 'iOSSimulator' or '$(_runtimeOS)' == 'tvos' or '$(_runtimeOS)' == 'tvOSSimulator'">osx-x64
-
- linux-$(_hostArch)
- $(_toolRuntimeRID)
+
+ linux-$(_hostArch)
+ $(_toolsRID)
+ $(ToolsRID)
$(_packageOS)-$(TargetArchitecture)
diff --git a/docs/coding-guidelines/interop-guidelines.md b/docs/coding-guidelines/interop-guidelines.md
index 997aa1fd3772a8..55d4e9ddcae0ab 100644
--- a/docs/coding-guidelines/interop-guidelines.md
+++ b/docs/coding-guidelines/interop-guidelines.md
@@ -166,6 +166,12 @@ Using enums instead of partial, static classes can lead to needing lots of casts
When defining the P/Invoke signatures and structs, we follow the guidelines in the [interop best practices documentation](https://docs.microsoft.com/en-us/dotnet/standard/native-interop/best-practices).
+The runtime repo makes use of [source-generated p/invokes](../design/features/source-generator-pinvokes.md) whenever possible (see [the compatibility doc](../design/libraries/DllImportGenerator/Compatibility.md) for unsupported scenarios). Methods should be marked `GeneratedDllImport` and be `static` and `partial`.
+
+If implicit framework references are disabled (as is the case for most libraries projects), explicit references to the below are required for marshalling arrays:
+ - `System.Memory`
+ - `System.Runtime.CompilerServices.Unsafe`
+
## UNIX shims
Often, various UNIX flavors offer the same API from the point-of-view of compatibility with C/C++ source code, but they do not have the same ABI. e.g. Fields can be laid out differently, constants can have different numeric values, exports can be named differently, etc. There are not only differences between operating systems (Mac OS X vs. Ubuntu vs. FreeBSD), but also differences related to the underlying processor architecture (x64 vs. x86 vs. ARM).
@@ -174,6 +180,8 @@ This leaves us with a situation where we can't write portable P/Invoke declarati
To address this, we're moving to a model where all UNIX interop from dotnet/runtime starts with a P/Invoke to a C++ lib written specifically for dotnet/runtime. These libs -- System.*.Native.so (aka "shims") -- are intended to be very thin layers over underlying platform libraries. Generally, they are not there to add any significant abstraction, but to create a stable ABI such that the same IL assembly can work across UNIX flavors.
+The System.Native shims are a private implementation detail of the Microsoft.NETCore.App shared framework and are intended only for use by code inside of the shared framework. Calling into the shims from external to Microsoft.NETCore.App has similar risks to using private reflection, with no guarantees from version to version or even patch to patch of stable exports. Assemblies that ship outside of the shared framework (e.g. Microsoft.Extensions.*) must not directly access the shims.
+
Guidelines for shim C++ API:
- Keep them as "thin"/1:1 as possible.
diff --git a/docs/design/features/standalone-gc-loading.md b/docs/design/features/standalone-gc-loading.md
index 3373bf5559f553..ed7440002e8da8 100644
--- a/docs/design/features/standalone-gc-loading.md
+++ b/docs/design/features/standalone-gc-loading.md
@@ -47,7 +47,7 @@ Worth noting is that the JIT (both RyuJIT and the legacy JIT(s) before it) can b
and have realized these same benefits. The existence of an interface and an implementation loadable
from shared libraries has enabled RyuJIT in particular to be used as the code generator for both the
CoreRT compiler and crossgen, while still being flexible enough to be tested using tools that implement
-very non-standard execution engines such as [SuperPMI](https://github.com/dotnet/runtime/blob/main/src/coreclr/ToolBox/superpmi/readme.txt).
+very non-standard execution engines such as [SuperPMI](https://github.com/dotnet/runtime/blob/main/src/coreclr/tools/superpmi/readme.md).
The below loading protocol is inspired directly by the JIT loader and many aspects of the GC loader are identical
to what the JIT does when loading dynamic shared libraries.
diff --git a/docs/design/mono/debugger.md b/docs/design/mono/debugger.md
index 3a3a2936b79eb4..2268d81bf1047b 100644
--- a/docs/design/mono/debugger.md
+++ b/docs/design/mono/debugger.md
@@ -18,4 +18,11 @@ Web Assembly Debugger supports usage of following attributes:
- Stepping In/Over: results in an additional stepping need to proceed to the next line.
- __System.Diagnostics.DebuggerDisplay__
- __System.Diagnostics.DebuggerTypeProxy__
-- ...
\ No newline at end of file
+- __System.Diagnostics.DebuggerBrowsable__ ([doc](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.debuggerbrowsableattribute?view=net-6.0))
+ - Collapsed - displayed normally.
+ - RootHidden:
+ - Simple type - not displayed in the debugger window.
+ - Collection / Array - the values of a collection are displayed in a flat view, using the naming convention: *rootName[idx]*.
+
+ - Never - not displayed in the debugger window.
+
diff --git a/docs/project/glossary.md b/docs/project/glossary.md
index cb7e0b21538b8c..9104049e947ec1 100644
--- a/docs/project/glossary.md
+++ b/docs/project/glossary.md
@@ -43,7 +43,7 @@ terminology.
| SDK | Software Development Kit. The [.NET SDK](https://docs.microsoft.com/dotnet/core/sdk) contains the .NET CLI, .NET libraries and runtime, and the dotnet driver. |
| SEH | [Structured Exception Handling](https://docs.microsoft.com/windows/win32/debug/structured-exception-handling). Unified mechanism for handling hardware and software exceptions on Windows. |
| SOS | [Son of Strike](https://docs.microsoft.com/archive/blogs/jasonz/sos-debugging-of-the-clr-part-1). The debugging extension for DbgEng based debuggers. Uses the DAC as an abstraction layer for its operation. |
-| SuperPMI | JIT component test framework (super fast JIT testing - it mocks/replays EE in EE-JIT interface) - see [SuperPMI details](https://github.com/dotnet/runtime/blob/main/src/coreclr/ToolBox/superpmi/readme.txt). |
+| SuperPMI | JIT component test framework (super fast JIT testing - it mocks/replays EE in EE-JIT interface) - see [SuperPMI details](https://github.com/dotnet/runtime/blob/main/src/coreclr/tools/superpmi/readme.md). |
| SVR | The CLR used to be built as two variants, with one called "mscorsvr.dll", to mean the "server" version. In particular, it contained the server GC implementation, which was intended for multi-threaded apps capable of taking advantage of multiple processors. In the .NET Framework 2 release, the two variants were merged into "mscorwks.dll". The WKS version was the default, however the SVR version remained available. |
| TFM | [Target Framework Moniker](https://docs.microsoft.com/dotnet/standard/frameworks) such as `net6.0` or `netstandard2.0`. |
| TPA | Trusted Platform Assemblies used to be a special set of assemblies that comprised the platform assemblies, when it was originally designed. As of today, it is simply the set of assemblies known to constitute the application. |
diff --git a/docs/workflow/Codespaces.md b/docs/workflow/Codespaces.md
index 391cd4087429e6..858da337216f25 100644
--- a/docs/workflow/Codespaces.md
+++ b/docs/workflow/Codespaces.md
@@ -5,13 +5,11 @@ Codespaces allows you to develop in a Docker container running in the cloud. You
dotnet/runtime runs a nightly GitHub Action to build the latest code in the repo. This allows you to immediately start developing and testing after creating a codespace without having to build the whole repo. When the machine is created, it will have built the repo using the code as of 6 AM UTC that morning.
-**NOTE**: In order to use a prebuilt codespace, when you create your machine be sure to select an **`8 core`** machine.
-
1. From https://github.com/dotnet/runtime, drop-down the `Code` button and select the `Codespaces` tab.

-2. Select `8-core` for the Machine type. This will ensure you get a "pre built" image.
+2. Select the Machine type. For dotnet/runtime, it is recommended to select at least a `4-core` machine. You can also verify that a "Prebuild" is ready.

diff --git a/docs/workflow/codespace-machine-size.png b/docs/workflow/codespace-machine-size.png
index 07945fb9ff672d..d0687c85b05f36 100644
Binary files a/docs/workflow/codespace-machine-size.png and b/docs/workflow/codespace-machine-size.png differ
diff --git a/docs/workflow/debugging/coreclr/debugging-aot-compilers.md b/docs/workflow/debugging/coreclr/debugging-aot-compilers.md
index 048d571df45f21..d21fa21a5cb77b 100644
--- a/docs/workflow/debugging/coreclr/debugging-aot-compilers.md
+++ b/docs/workflow/debugging/coreclr/debugging-aot-compilers.md
@@ -19,7 +19,7 @@ Built in debugging aids in the managed compilers
---------------------------------
- When debugging a multi-threaded component of the compiler and not investigating a multi-threading issue itself, it is generally advisable to disable the use of multiple threads.
-To do this use the `--parallelism 1` switch (for crossgen2) or `--singlethreaded` (for ILC) to specify that the maximum parallelism of the process shall be 1.
+To do this use the `--parallelism 1` switch to specify that the maximum parallelism of the process shall be 1.
- When debugging the behavior of compiling a single method, the compiler may be instructed to only compile a single method. This is done via the various --singlemethod options
@@ -172,3 +172,7 @@ devenv /debugexe C:\git2\runtime\.dotnet\dotnet.exe "c:\git2\runtime\artifacts\t
```
This will launch the Visual Studio debugger, with a solution setup for debugging the dotnet.exe process. By default this solution will debug the native code of the process only. To debug the managed components, edit the properties on the solution and set the `Debugger Type` to `Managed (.NET Core, .NET 5+)` or `Mixed (.NET Core, .NET 5+)`.
+
+# Debugging compilation graph
+
+The AOT compilation is driven by a dependency graph. If you need to troubleshoot the dependency graph (to figure out why something was or wasn't generated) you can follow [this guide](debuging-compiler-dependency-analysis.md)
diff --git a/docs/workflow/debugging/coreclr/debuging-compiler-dependency-analysis.md b/docs/workflow/debugging/coreclr/debuging-compiler-dependency-analysis.md
new file mode 100644
index 00000000000000..cc918c391f62a1
--- /dev/null
+++ b/docs/workflow/debugging/coreclr/debuging-compiler-dependency-analysis.md
@@ -0,0 +1,47 @@
+Debugging Compiler Dependency Analysis
+============================
+
+The general technique is to identify what node is missing from the graph or is erroneously present in the graph, and change the dependency analysis logic to adjust the graph. This document describes the various ways of debugging to identify what's happening.
+
+Analysis techniques for the dependency graph.
+1. Use the DependencyGraphViewer tool (if running on Windows). This tool is located in `src/coreclr/tools/aot/DependencyGraphViewer`
+ - This is the only convenient way to examine the graph while also simultaneously debugging the compiler.
+ - While this is currently Windows only due to use of WinForms, it would be fairly straightforward to make a command line based tool.
+ - Dependency graph does not support multiple simultaneous logging facilities, so make sure that you do not set IlcGenerateDgmlFile or invoke ILCompiler with the DGML generation turned on.
+2. Pass command line switches to the compiler to generate a dependency graph dgml file. This will produce the same data as is viewable in the viewer tool, but in a textual xml format.
+ - Future efforts may make the xml file loadable by the viewer tool.
+3. Instrument the compiler dependency analysis. (This may be necessary in cases where the viewer is unable to provide sufficient information about why the graph is structured as it is.)
+
+DependencyGraphViewer
+====================================
+
+This application allows viewing the dependency graph produced by the AOT compilation.
+
+Usage instructions:
+1. Launch the process as an administrator
+2. Run the compiler
+- The compiler can be run to completion, or stopped.
+3. Explore through the graph
+
+# Graphs View #
+- Choose one of the graphs that appears in the Dependency Graphs view to explore. As compilers execute, new graphs will automatically appear here.
+- The set of graphs loaded into the process is limited by available memory space. To clear the used memory, close all windows of the application.
+
+# Graph View #
+- In the Dependency Graph view, enter a regular expression in the text box, and then press ""Filter"". This will display a list of the nodes in the graph which have names which match the regular expression.
+- Commonly, if there is a object file symbol associated with the node it should be used as part of the regular expression. See the various implementations of GetName in the compiler for naming behavior.
+- Additionally, the event source marking mode assigns an Id to each node, and that is found as the mark object on the node, so if a specific id is known, just type that in, and it will appear in the window. (This is for use when using this tool in parallel with debugging the compiler.
+
+# Single Node Exploration #
+Once the interesting node(s) have been identified in the dependency graph window, select one of them, and then press Explore.
+ - In the Node Explorer window, the Dependent nodes (the ones which dependend on the current node are the nodes displayed above, and the Dependee nodes (the nodes that this node depends on) are displayed below. Each node in the list is paired with a textual reason as to why that edge in the graph exists.
+ - Select a node to explore further and press the corresponding button to make it happen.
+
+WhyDGML
+=======
+This tool can be used to visualize paths from a node of interest to the roots. To use it, pass command line option to the compiler to generate the DGML file (`--dgmllog name_of_output_file`) and then use this tool to find the path to the root. If you're looking at an optimized NativeAOT compilation, `--scandgmllog` might be preferable since it will have more details.
+The input to the tool is the DGML file and name of a node of interest. The output is the list of reasons why that node was included.
+
+This tool located in folder `src/coreclr/tools/aot/WhyDgml`
+
+See https://github.com/dotnet/corert/pull/7962 for example of usage and output.
diff --git a/docs/workflow/requirements/freebsd-requirements.md b/docs/workflow/requirements/freebsd-requirements.md
index 941b949a252878..c14c1c1a27cf01 100644
--- a/docs/workflow/requirements/freebsd-requirements.md
+++ b/docs/workflow/requirements/freebsd-requirements.md
@@ -1,13 +1,12 @@
-Requirements to build dotnet/runtime on FreeBSD
+Requirements to build and run dotnet/runtime on FreeBSD
=====================
-This guide will walk you through the requirements needed to build dotnet/runtime on FreeBSD. We'll start by showing how to set up your environment from scratch.
+This guide will walk you through the requirements needed to build and run dotnet/runtime on FreeBSD. We'll start by showing how to set up your environment from scratch.
Since there is no official build and FreeBSD package, native build on FreeBSD is not trivial. There are generally three options, sorted by ease of use:
- cross-compile on Linux using Docker
- cross-compile on Linux using Toolchain
- build on FreeBSD
-
Environment
===========
@@ -65,3 +64,46 @@ sudo pkg install --yes libunwind icu libinotify lttng-ust krb5 cmake openssl nin
Additionally, working dotnet cli with SDK is needed. On other platforms this would be downloaded automatically during build but it is not currently available for FreeBSD.
It needs to be built once on supported platform or obtained via community resources.
+Running on FreeBSD
+-------------------
+Install the following packages:
+- icu
+- libunwind
+- lttng-ust (optional, debug support)
+- krb5
+- openssl (optional, SSL support)
+- libinotify
+- terminfo-db (optional, terminal colors)
+
+The lines to install all the packages above using package manager.
+
+```sh
+sudo pkg install --yes libunwind icu libinotify lttng-ust krb5 openssl terminfo-db
+```
+
+Extract the SDK:
+The canonical location for the SDK is `/usr/share/dotnet`
+
+"VERSION" is the SDK version being unpacked.
+
+```sh
+sudo mkdir /usr/share/dotnet
+tar xf /tmp/dotnet-sdk-VERSION-freebsd-x64.tar.gz -C /usr/share/dotnet/
+```
+
+NuGet Packages:
+The canonical location for the NuGet packages is `/var/cache/nuget`
+
+"VERSION" is the same version as the SDK from above.
+
+- Microsoft.NETCore.App.Host.freebsd-x64.VERSION.nupkg
+- Microsoft.NETCore.App.Runtime.freebsd-x64.VERSION.nupkg
+- Microsoft.AspNetCore.App.Runtime.freebsd-x64.VERSION.nupkg
+
+Add the following line to any `NuGet.config` you are using under the `` section:
+
+```xml
+
+```
+
+Finally, either add `/usr/share/dotnet` to your PATH or create a symbolic for `/usr/share/dotnet/dotnet`
diff --git a/eng/CodeAnalysis.src.globalconfig b/eng/CodeAnalysis.src.globalconfig
index 400c8c432c21bf..0fc9bf8e5a7eeb 100644
--- a/eng/CodeAnalysis.src.globalconfig
+++ b/eng/CodeAnalysis.src.globalconfig
@@ -1444,7 +1444,7 @@ dotnet_diagnostic.IDE0057.severity = suggestion
dotnet_diagnostic.IDE0058.severity = silent
# IDE0059: Unnecessary assignment of a value
-dotnet_diagnostic.IDE0059.severity = suggestion
+dotnet_diagnostic.IDE0059.severity = warning
# IDE0060: Remove unused parameter
dotnet_diagnostic.IDE0060.severity = silent
diff --git a/eng/Subsets.props b/eng/Subsets.props
index f0bb31a28aea72..772fbfcb995329 100644
--- a/eng/Subsets.props
+++ b/eng/Subsets.props
@@ -243,7 +243,7 @@
-
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index e3a571f451cdea..f2f65abdb43a30 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -1,8 +1,8 @@
-
+
https://github.com/dotnet/icu
- d9371f17932fbf828f1d1e2f21a99b64ba40eba5
+ aae7d341a8ee7841ed0cb1cf298ab17fe04c187b
https://github.com/dotnet/msquic
@@ -16,159 +16,159 @@
https://github.com/dotnet/wcf
7f504aabb1988e9a093c1e74d8040bd52feb2f01
-
+
https://github.com/dotnet/llvm-project
- ef5d90bc37b53288e32d78dbf34eae32cd0893d3
+ e7e0ebc663c70ccb19c331af50d418a06dc92df8
-
+
https://github.com/dotnet/llvm-project
- ef5d90bc37b53288e32d78dbf34eae32cd0893d3
+ e7e0ebc663c70ccb19c331af50d418a06dc92df8
-
+
https://github.com/dotnet/llvm-project
- ef5d90bc37b53288e32d78dbf34eae32cd0893d3
+ e7e0ebc663c70ccb19c331af50d418a06dc92df8
-
+
https://github.com/dotnet/llvm-project
- ef5d90bc37b53288e32d78dbf34eae32cd0893d3
+ e7e0ebc663c70ccb19c331af50d418a06dc92df8
-
+
https://github.com/dotnet/llvm-project
- ef5d90bc37b53288e32d78dbf34eae32cd0893d3
+ e7e0ebc663c70ccb19c331af50d418a06dc92df8
-
+
https://github.com/dotnet/llvm-project
- ef5d90bc37b53288e32d78dbf34eae32cd0893d3
+ e7e0ebc663c70ccb19c331af50d418a06dc92df8
-
+
https://github.com/dotnet/llvm-project
- ef5d90bc37b53288e32d78dbf34eae32cd0893d3
+ e7e0ebc663c70ccb19c331af50d418a06dc92df8
-
+
https://github.com/dotnet/llvm-project
- ef5d90bc37b53288e32d78dbf34eae32cd0893d3
+ e7e0ebc663c70ccb19c331af50d418a06dc92df8
-
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
-
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
-
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
-
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
-
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
-
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
-
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
-
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
-
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
-
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
-
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
-
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
-
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
-
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
-
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
-
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
-
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
-
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
https://github.com/microsoft/vstest
140434f7109d357d0158ade9e5164a4861513965
-
+
https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+
https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+
https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+
https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+
https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+
https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+
https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+
https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+
https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+
https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+
https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
https://github.com/dotnet/llvm-project
@@ -202,53 +202,57 @@
https://github.com/dotnet/llvm-project
662aff66999c435aec09c58643e9fd703eadc3e0
-
+
https://github.com/dotnet/runtime
- 834b278911962102919b3a7dec22ca6cb26bfa8a
+ a2af6294767b4a3f4c2ce787c5dda2abeeda7a00
-
+
https://github.com/dotnet/runtime
- 834b278911962102919b3a7dec22ca6cb26bfa8a
+ a2af6294767b4a3f4c2ce787c5dda2abeeda7a00
-
+
https://github.com/dotnet/runtime
- 834b278911962102919b3a7dec22ca6cb26bfa8a
+ a2af6294767b4a3f4c2ce787c5dda2abeeda7a00
-
+
https://github.com/dotnet/runtime
- 834b278911962102919b3a7dec22ca6cb26bfa8a
+ a2af6294767b4a3f4c2ce787c5dda2abeeda7a00
-
+
https://github.com/dotnet/runtime
- 834b278911962102919b3a7dec22ca6cb26bfa8a
+ a2af6294767b4a3f4c2ce787c5dda2abeeda7a00
-
+
https://github.com/dotnet/runtime
- 834b278911962102919b3a7dec22ca6cb26bfa8a
+ a2af6294767b4a3f4c2ce787c5dda2abeeda7a00
-
+
https://github.com/dotnet/runtime
- 834b278911962102919b3a7dec22ca6cb26bfa8a
+ a2af6294767b4a3f4c2ce787c5dda2abeeda7a00
-
+
https://github.com/dotnet/runtime
- 834b278911962102919b3a7dec22ca6cb26bfa8a
+ a2af6294767b4a3f4c2ce787c5dda2abeeda7a00
-
+
https://github.com/dotnet/linker
- 41467d340a3345f08cb8ba67c20c1ea40c57682f
+ e485816b48273d03bd6266a64dad9bea97f861d5
-
+
https://github.com/dotnet/xharness
- 7ad8d01a879af9437a7c33d01409bd761700cdad
+ d33e67a6c2cc5fe415917c6f9bd17046a929dcc0
-
+
https://github.com/dotnet/xharness
- 7ad8d01a879af9437a7c33d01409bd761700cdad
+ d33e67a6c2cc5fe415917c6f9bd17046a929dcc0
-
+
+ https://github.com/dotnet/xharness
+ d33e67a6c2cc5fe415917c6f9bd17046a929dcc0
+
+
https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 34bc5b1611e13bd0ee6a9f38ab8524d2ee489be5
https://dev.azure.com/dnceng/internal/_git/dotnet-optimization
@@ -266,13 +270,13 @@
https://dev.azure.com/dnceng/internal/_git/dotnet-optimization
91d6b3c1f51888d166701510189505f35714665c
-
+
https://github.com/dotnet/hotreload-utils
- f0d838421286fed81005fd4ddf6562555b641b3b
+ 5bc948c6242bc9423c3269d122dcdf0ad6c06a83
-
+
https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
https://github.com/dotnet/roslyn-analyzers
diff --git a/eng/Versions.props b/eng/Versions.props
index 47d31b37c8e334..ceff6ee674bc45 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -42,50 +42,50 @@
3.11.0
- 4.0.0-4.final
- 4.0.0-4.final
+ 4.0.1
+ 4.0.1
3.3.2
- 4.0.0-4.final
- 4.0.0-4.final
+ 4.0.1
+ 4.0.1
7.0.0-preview1.21613.1
2.0.0-alpha.1.21525.11
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 2.5.1-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
+ 7.0.0-beta.22056.6
+ 7.0.0-beta.22056.6
+ 7.0.0-beta.22056.6
+ 7.0.0-beta.22056.6
+ 7.0.0-beta.22056.6
+ 7.0.0-beta.22056.6
+ 2.5.1-beta.22056.6
+ 7.0.0-beta.22056.6
+ 7.0.0-beta.22056.6
+ 7.0.0-beta.22056.6
+ 7.0.0-beta.22056.6
+ 7.0.0-beta.22056.6
+ 7.0.0-beta.22056.6
+ 7.0.0-beta.22056.6
+ 7.0.0-beta.22056.6
6.0.0-preview.1.102
- 7.0.0-alpha.1.21620.1
- 7.0.0-alpha.1.21620.1
- 7.0.0-alpha.1.21620.1
+ 7.0.0-alpha.1.22059.2
+ 7.0.0-alpha.1.22059.2
+ 7.0.0-alpha.1.22059.2
3.1.0
- 7.0.0-alpha.1.21620.1
- 1.0.0-alpha.1.21630.1
- 1.0.0-alpha.1.21630.1
- 1.0.0-alpha.1.21630.1
- 1.0.0-alpha.1.21630.1
- 1.0.0-alpha.1.21630.1
- 1.0.0-alpha.1.21630.1
- 1.0.0-alpha.1.21630.1
- 1.0.0-alpha.1.21630.1
+ 7.0.0-alpha.1.22059.2
+ 1.0.0-alpha.1.22060.1
+ 1.0.0-alpha.1.22060.1
+ 1.0.0-alpha.1.22060.1
+ 1.0.0-alpha.1.22060.1
+ 1.0.0-alpha.1.22060.1
+ 1.0.0-alpha.1.22060.1
+ 1.0.0-alpha.1.22060.1
+ 1.0.0-alpha.1.22060.1
5.0.0
4.3.0
@@ -120,24 +120,24 @@
5.0.0
5.0.0
4.9.0-rc2.21473.1
- 7.0.0-alpha.1.21620.1
- 7.0.0-alpha.1.21620.1
+ 7.0.0-alpha.1.22059.2
+ 7.0.0-alpha.1.22059.2
4.5.4
4.5.0
- 7.0.0-alpha.1.21620.1
+ 7.0.0-alpha.1.22059.2
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
1.0.0-prerelease.21577.2
1.0.0-prerelease.21577.2
@@ -160,12 +160,13 @@
1.0.1-prerelease-00006
16.9.0-preview-20201201-01
- 1.0.0-prerelease.21622.1
- 1.0.0-prerelease.21622.1
- 1.0.2-alpha.0.21620.2
+ 1.0.0-prerelease.22062.1
+ 1.0.0-prerelease.22062.1
+ 1.0.0-prerelease.22062.1
+ 1.0.2-alpha.0.22060.2
2.4.2-pre.9
2.4.2
- 1.3.0
+ 3.1.0
12.0.3
2.0.4
4.12.0
@@ -175,10 +176,10 @@
6.0.0-preview-20211019.1
- 7.0.100-1.21620.1
+ 7.0.100-1.22063.2
$(MicrosoftNETILLinkTasksVersion)
- 7.0.0-alpha.1.21620.1
+ 7.0.0-alpha.1.22060.1
7.0.0-alpha.1.21529.3
diff --git a/eng/build.sh b/eng/build.sh
index f1ef5958fdbc92..ea8e3089e95f4d 100755
--- a/eng/build.sh
+++ b/eng/build.sh
@@ -17,7 +17,7 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
usage()
{
echo "Common settings:"
- echo " --arch (-a) Target platform: x86, x64, arm, armel, arm64, s390x or wasm."
+ echo " --arch (-a) Target platform: x86, x64, arm, armel, arm64, loongarch64, s390x or wasm."
echo " [Default: Your machine's architecture.]"
echo " --binaryLog (-bl) Output binary log."
echo " --cross Optional argument to signify cross compilation."
@@ -206,12 +206,12 @@ while [[ $# > 0 ]]; do
fi
passedArch="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
case "$passedArch" in
- x64|x86|arm|armel|arm64|s390x|wasm)
+ x64|x86|arm|armel|arm64|loongarch64|s390x|wasm)
arch=$passedArch
;;
*)
echo "Unsupported target architecture '$2'."
- echo "The allowed values are x86, x64, arm, armel, arm64, s390x, and wasm."
+ echo "The allowed values are x86, x64, arm, armel, arm64, loongarch64, s390x, and wasm."
exit 1
;;
esac
diff --git a/eng/common/cross/arm/tizen-build-rootfs.sh b/eng/common/cross/arm/tizen-build-rootfs.sh
new file mode 100644
index 00000000000000..9fdb32e920e22c
--- /dev/null
+++ b/eng/common/cross/arm/tizen-build-rootfs.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+set -e
+
+__ARM_HARDFP_CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+__TIZEN_CROSSDIR="$__ARM_HARDFP_CrossDir/tizen"
+
+if [[ -z "$ROOTFS_DIR" ]]; then
+ echo "ROOTFS_DIR is not defined."
+ exit 1;
+fi
+
+TIZEN_TMP_DIR=$ROOTFS_DIR/tizen_tmp
+mkdir -p $TIZEN_TMP_DIR
+
+# Download files
+echo ">>Start downloading files"
+VERBOSE=1 $__ARM_HARDFP_CrossDir/tizen-fetch.sh $TIZEN_TMP_DIR
+echo "<>Start constructing Tizen rootfs"
+TIZEN_RPM_FILES=`ls $TIZEN_TMP_DIR/*.rpm`
+cd $ROOTFS_DIR
+for f in $TIZEN_RPM_FILES; do
+ rpm2cpio $f | cpio -idm --quiet
+done
+echo "<>Start configuring Tizen rootfs"
+ln -sfn asm-arm ./usr/include/asm
+patch -p1 < $__TIZEN_CROSSDIR/tizen.patch
+echo "</dev/null; then
+ VERBOSE=0
+fi
+
+Log()
+{
+ if [ $VERBOSE -ge $1 ]; then
+ echo ${@:2}
+ fi
+}
+
+Inform()
+{
+ Log 1 -e "\x1B[0;34m$@\x1B[m"
+}
+
+Debug()
+{
+ Log 2 -e "\x1B[0;32m$@\x1B[m"
+}
+
+Error()
+{
+ >&2 Log 0 -e "\x1B[0;31m$@\x1B[m"
+}
+
+Fetch()
+{
+ URL=$1
+ FILE=$2
+ PROGRESS=$3
+ if [ $VERBOSE -ge 1 ] && [ $PROGRESS ]; then
+ CURL_OPT="--progress-bar"
+ else
+ CURL_OPT="--silent"
+ fi
+ curl $CURL_OPT $URL > $FILE
+}
+
+hash curl 2> /dev/null || { Error "Require 'curl' Aborting."; exit 1; }
+hash xmllint 2> /dev/null || { Error "Require 'xmllint' Aborting."; exit 1; }
+hash sha256sum 2> /dev/null || { Error "Require 'sha256sum' Aborting."; exit 1; }
+
+TMPDIR=$1
+if [ ! -d $TMPDIR ]; then
+ TMPDIR=./tizen_tmp
+ Debug "Create temporary directory : $TMPDIR"
+ mkdir -p $TMPDIR
+fi
+
+TIZEN_URL=http://download.tizen.org/snapshots/tizen
+BUILD_XML=build.xml
+REPOMD_XML=repomd.xml
+PRIMARY_XML=primary.xml
+TARGET_URL="http://__not_initialized"
+
+Xpath_get()
+{
+ XPATH_RESULT=''
+ XPATH=$1
+ XML_FILE=$2
+ RESULT=$(xmllint --xpath $XPATH $XML_FILE)
+ if [[ -z ${RESULT// } ]]; then
+ Error "Can not find target from $XML_FILE"
+ Debug "Xpath = $XPATH"
+ exit 1
+ fi
+ XPATH_RESULT=$RESULT
+}
+
+fetch_tizen_pkgs_init()
+{
+ TARGET=$1
+ PROFILE=$2
+ Debug "Initialize TARGET=$TARGET, PROFILE=$PROFILE"
+
+ TMP_PKG_DIR=$TMPDIR/tizen_${PROFILE}_pkgs
+ if [ -d $TMP_PKG_DIR ]; then rm -rf $TMP_PKG_DIR; fi
+ mkdir -p $TMP_PKG_DIR
+
+ PKG_URL=$TIZEN_URL/$PROFILE/latest
+
+ BUILD_XML_URL=$PKG_URL/$BUILD_XML
+ TMP_BUILD=$TMP_PKG_DIR/$BUILD_XML
+ TMP_REPOMD=$TMP_PKG_DIR/$REPOMD_XML
+ TMP_PRIMARY=$TMP_PKG_DIR/$PRIMARY_XML
+ TMP_PRIMARYGZ=${TMP_PRIMARY}.gz
+
+ Fetch $BUILD_XML_URL $TMP_BUILD
+
+ Debug "fetch $BUILD_XML_URL to $TMP_BUILD"
+
+ TARGET_XPATH="//build/buildtargets/buildtarget[@name=\"$TARGET\"]/repo[@type=\"binary\"]/text()"
+ Xpath_get $TARGET_XPATH $TMP_BUILD
+ TARGET_PATH=$XPATH_RESULT
+ TARGET_URL=$PKG_URL/$TARGET_PATH
+
+ REPOMD_URL=$TARGET_URL/repodata/repomd.xml
+ PRIMARY_XPATH='string(//*[local-name()="data"][@type="primary"]/*[local-name()="location"]/@href)'
+
+ Fetch $REPOMD_URL $TMP_REPOMD
+
+ Debug "fetch $REPOMD_URL to $TMP_REPOMD"
+
+ Xpath_get $PRIMARY_XPATH $TMP_REPOMD
+ PRIMARY_XML_PATH=$XPATH_RESULT
+ PRIMARY_URL=$TARGET_URL/$PRIMARY_XML_PATH
+
+ Fetch $PRIMARY_URL $TMP_PRIMARYGZ
+
+ Debug "fetch $PRIMARY_URL to $TMP_PRIMARYGZ"
+
+ gunzip $TMP_PRIMARYGZ
+
+ Debug "unzip $TMP_PRIMARYGZ to $TMP_PRIMARY"
+}
+
+fetch_tizen_pkgs()
+{
+ ARCH=$1
+ PACKAGE_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="location"]/@href)'
+
+ PACKAGE_CHECKSUM_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="checksum"]/text())'
+
+ for pkg in ${@:2}
+ do
+ Inform "Fetching... $pkg"
+ XPATH=${PACKAGE_XPATH_TPL/_PKG_/$pkg}
+ XPATH=${XPATH/_ARCH_/$ARCH}
+ Xpath_get $XPATH $TMP_PRIMARY
+ PKG_PATH=$XPATH_RESULT
+
+ XPATH=${PACKAGE_CHECKSUM_XPATH_TPL/_PKG_/$pkg}
+ XPATH=${XPATH/_ARCH_/$ARCH}
+ Xpath_get $XPATH $TMP_PRIMARY
+ CHECKSUM=$XPATH_RESULT
+
+ PKG_URL=$TARGET_URL/$PKG_PATH
+ PKG_FILE=$(basename $PKG_PATH)
+ PKG_PATH=$TMPDIR/$PKG_FILE
+
+ Debug "Download $PKG_URL to $PKG_PATH"
+ Fetch $PKG_URL $PKG_PATH true
+
+ echo "$CHECKSUM $PKG_PATH" | sha256sum -c - > /dev/null
+ if [ $? -ne 0 ]; then
+ Error "Fail to fetch $PKG_URL to $PKG_PATH"
+ Debug "Checksum = $CHECKSUM"
+ exit 1
+ fi
+ done
+}
+
+Inform "Initialize arm base"
+fetch_tizen_pkgs_init standard base
+Inform "fetch common packages"
+fetch_tizen_pkgs armv7hl gcc gcc-devel-static glibc glibc-devel libicu libicu-devel libatomic linux-glibc-devel keyutils keyutils-devel libkeyutils
+Inform "fetch coreclr packages"
+fetch_tizen_pkgs armv7hl lldb lldb-devel libgcc libstdc++ libstdc++-devel libunwind libunwind-devel lttng-ust-devel lttng-ust userspace-rcu-devel userspace-rcu
+Inform "fetch corefx packages"
+fetch_tizen_pkgs armv7hl libcom_err libcom_err-devel zlib zlib-devel libopenssl11 libopenssl1.1-devel krb5 krb5-devel
+
+Inform "Initialize standard unified"
+fetch_tizen_pkgs_init standard unified
+Inform "fetch corefx packages"
+fetch_tizen_pkgs armv7hl gssdp gssdp-devel tizen-release
+
diff --git a/eng/common/cross/arm/tizen/tizen.patch b/eng/common/cross/arm/tizen/tizen.patch
new file mode 100644
index 00000000000000..fb12ade7250ae9
--- /dev/null
+++ b/eng/common/cross/arm/tizen/tizen.patch
@@ -0,0 +1,9 @@
+diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so
+--- a/usr/lib/libc.so 2016-12-30 23:00:08.284951863 +0900
++++ b/usr/lib/libc.so 2016-12-30 23:00:32.140951815 +0900
+@@ -2,4 +2,4 @@
+ Use the shared library, but some functions are only in
+ the static library, so try that secondarily. */
+ OUTPUT_FORMAT(elf32-littlearm)
+-GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux-armhf.so.3 ) )
++GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-armhf.so.3 ) )
diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh
index 5102245b7b5e3f..e94d13d62ef64d 100755
--- a/eng/common/cross/build-rootfs.sh
+++ b/eng/common/cross/build-rootfs.sh
@@ -185,8 +185,8 @@ while :; do
__LLDB_Package="liblldb-6.0-dev"
;;
tizen)
- if [ "$__BuildArch" != "armel" ] && [ "$__BuildArch" != "arm64" ]; then
- echo "Tizen is available only for armel and arm64."
+ if [ "$__BuildArch" != "arm" ] && [ "$__BuildArch" != "armel" ] && [ "$__BuildArch" != "arm64" ]; then
+ echo "Tizen is available only for arm, armel and arm64."
usage;
exit 1;
fi
diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake
index 9d22fc92693031..f7878dddd39211 100644
--- a/eng/common/cross/toolchain.cmake
+++ b/eng/common/cross/toolchain.cmake
@@ -34,6 +34,9 @@ elseif(TARGET_ARCH_NAME STREQUAL "arm")
else()
set(TOOLCHAIN "arm-linux-gnueabihf")
endif()
+ if(TIZEN)
+ set(TIZEN_TOOLCHAIN "armv7hl-tizen-linux-gnueabihf/9.2.0")
+ endif()
elseif(TARGET_ARCH_NAME STREQUAL "arm64")
set(CMAKE_SYSTEM_PROCESSOR aarch64)
if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-alpine-linux-musl)
@@ -66,6 +69,10 @@ endif()
# Specify include paths
if(TIZEN)
+ if(TARGET_ARCH_NAME STREQUAL "arm")
+ include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/)
+ include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/armv7hl-tizen-linux-gnueabihf)
+ endif()
if(TARGET_ARCH_NAME STREQUAL "armel")
include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/)
include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/armv7l-tizen-linux-gnueabi)
@@ -160,7 +167,7 @@ if(LINUX)
add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib/${TOOLCHAIN}")
endif()
-if(TARGET_ARCH_NAME STREQUAL "armel")
+if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$")
if(TIZEN)
add_toolchain_linker_flag("-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}")
add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib")
@@ -215,7 +222,7 @@ elseif(TARGET_ARCH_NAME STREQUAL "x86")
endif()
if(TIZEN)
- if(TARGET_ARCH_NAME MATCHES "^(armel|arm64)$")
+ if(TARGET_ARCH_NAME MATCHES "^(arm|armel|arm64)$")
add_compile_options(-Wno-deprecated-declarations) # compile-time option
add_compile_options(-D__extern_always_inline=inline) # compile-time option
endif()
diff --git a/eng/common/generate-graph-files.ps1 b/eng/common/generate-graph-files.ps1
deleted file mode 100644
index 0728b1a8b570d6..00000000000000
--- a/eng/common/generate-graph-files.ps1
+++ /dev/null
@@ -1,86 +0,0 @@
-Param(
- [Parameter(Mandatory=$true)][string] $barToken, # Token generated at https://maestro-prod.westus2.cloudapp.azure.com/Account/Tokens
- [Parameter(Mandatory=$true)][string] $gitHubPat, # GitHub personal access token from https://github.com/settings/tokens (no auth scopes needed)
- [Parameter(Mandatory=$true)][string] $azdoPat, # Azure Dev Ops tokens from https://dev.azure.com/dnceng/_details/security/tokens (code read scope needed)
- [Parameter(Mandatory=$true)][string] $outputFolder, # Where the graphviz.txt file will be created
- [string] $darcVersion, # darc's version
- [string] $graphvizVersion = '2.38', # GraphViz version
- [switch] $includeToolset # Whether the graph should include toolset dependencies or not. i.e. arcade, optimization. For more about
- # toolset dependencies see https://github.com/dotnet/arcade/blob/master/Documentation/Darc.md#toolset-vs-product-dependencies
-)
-
-function CheckExitCode ([string]$stage)
-{
- $exitCode = $LASTEXITCODE
- if ($exitCode -ne 0) {
- Write-PipelineTelemetryError -Category 'Arcade' -Message "Something failed in stage: '$stage'. Check for errors above. Exiting now..."
- ExitWithExitCode $exitCode
- }
-}
-
-try {
- $ErrorActionPreference = 'Stop'
- . $PSScriptRoot\tools.ps1
-
- Import-Module -Name (Join-Path $PSScriptRoot 'native\CommonLibrary.psm1')
-
- Push-Location $PSScriptRoot
-
- Write-Host 'Installing darc...'
- . .\darc-init.ps1 -darcVersion $darcVersion
- CheckExitCode 'Running darc-init'
-
- $engCommonBaseDir = Join-Path $PSScriptRoot 'native\'
- $graphvizInstallDir = CommonLibrary\Get-NativeInstallDirectory
- $nativeToolBaseUri = 'https://netcorenativeassets.blob.core.windows.net/resource-packages/external'
- $installBin = Join-Path $graphvizInstallDir 'bin'
-
- Write-Host 'Installing dot...'
- .\native\install-tool.ps1 -ToolName graphviz -InstallPath $installBin -BaseUri $nativeToolBaseUri -CommonLibraryDirectory $engCommonBaseDir -Version $graphvizVersion -Verbose
-
- $darcExe = "$env:USERPROFILE\.dotnet\tools"
- $darcExe = Resolve-Path "$darcExe\darc.exe"
-
- Create-Directory $outputFolder
-
- # Generate 3 graph descriptions:
- # 1. Flat with coherency information
- # 2. Graphviz (dot) file
- # 3. Standard dependency graph
- $graphVizFilePath = "$outputFolder\graphviz.txt"
- $graphVizImageFilePath = "$outputFolder\graph.png"
- $normalGraphFilePath = "$outputFolder\graph-full.txt"
- $flatGraphFilePath = "$outputFolder\graph-flat.txt"
- $baseOptions = @( '--github-pat', "$gitHubPat", '--azdev-pat', "$azdoPat", '--password', "$barToken" )
-
- if ($includeToolset) {
- Write-Host 'Toolsets will be included in the graph...'
- $baseOptions += @( '--include-toolset' )
- }
-
- Write-Host 'Generating standard dependency graph...'
- & "$darcExe" get-dependency-graph @baseOptions --output-file $normalGraphFilePath
- CheckExitCode 'Generating normal dependency graph'
-
- Write-Host 'Generating flat dependency graph and graphviz file...'
- & "$darcExe" get-dependency-graph @baseOptions --flat --coherency --graphviz $graphVizFilePath --output-file $flatGraphFilePath
- CheckExitCode 'Generating flat and graphviz dependency graph'
-
- Write-Host "Generating graph image $graphVizFilePath"
- $dotFilePath = Join-Path $installBin "graphviz\$graphvizVersion\release\bin\dot.exe"
- & "$dotFilePath" -Tpng -o"$graphVizImageFilePath" "$graphVizFilePath"
- CheckExitCode 'Generating graphviz image'
-
- Write-Host "'$graphVizFilePath', '$flatGraphFilePath', '$normalGraphFilePath' and '$graphVizImageFilePath' created!"
-}
-catch {
- if (!$includeToolset) {
- Write-Host 'This might be a toolset repo which includes only toolset dependencies. ' -NoNewline -ForegroundColor Yellow
- Write-Host 'Since -includeToolset is not set there is no graph to create. Include -includeToolset and try again...' -ForegroundColor Yellow
- }
- Write-Host $_.ScriptStackTrace
- Write-PipelineTelemetryError -Category 'Arcade' -Message $_
- ExitWithExitCode 1
-} finally {
- Pop-Location
-}
\ No newline at end of file
diff --git a/eng/common/sdl/configure-sdl-tool.ps1 b/eng/common/sdl/configure-sdl-tool.ps1
index 8a68fc24b11b0d..bdbf49e6c71de8 100644
--- a/eng/common/sdl/configure-sdl-tool.ps1
+++ b/eng/common/sdl/configure-sdl-tool.ps1
@@ -15,7 +15,9 @@ Param(
# Optional: Additional params to add to any tool using CredScan.
[string[]] $CrScanAdditionalRunConfigParams,
# Optional: Additional params to add to any tool using PoliCheck.
- [string[]] $PoliCheckAdditionalRunConfigParams
+ [string[]] $PoliCheckAdditionalRunConfigParams,
+ # Optional: Additional params to add to any tool using CodeQL/Semmle.
+ [string[]] $CodeQLAdditionalRunConfigParams
)
$ErrorActionPreference = 'Stop'
@@ -78,6 +80,11 @@ try {
$tool.Args += "`"Target < $TargetDirectory`""
}
$tool.Args += $PoliCheckAdditionalRunConfigParams
+ } elseif ($tool.Name -eq 'semmle' -or $tool.Name -eq 'codeql') {
+ if ($targetDirectory) {
+ $tool.Args += "`"SourceCodeDirectory < $TargetDirectory`""
+ }
+ $tool.Args += $CodeQLAdditionalRunConfigParams
}
# Create variable pointing to the args array directly so we can use splat syntax later.
diff --git a/eng/common/sdl/execute-all-sdl-tools.ps1 b/eng/common/sdl/execute-all-sdl-tools.ps1
index e5bef8ebd3a3b4..4797e012c7d2f7 100644
--- a/eng/common/sdl/execute-all-sdl-tools.ps1
+++ b/eng/common/sdl/execute-all-sdl-tools.ps1
@@ -34,6 +34,7 @@ Param(
[string] $GuardianLoggerLevel='Standard', # Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error
[string[]] $CrScanAdditionalRunConfigParams, # Optional: Additional Params to custom build a CredScan run config in the format @("xyz:abc","sdf:1")
[string[]] $PoliCheckAdditionalRunConfigParams, # Optional: Additional Params to custom build a Policheck run config in the format @("xyz:abc","sdf:1")
+ [string[]] $CodeQLAdditionalRunConfigParams, # Optional: Additional Params to custom build a Semmle/CodeQL run config in the format @("xyz < abc","sdf < 1")
[bool] $BreakOnFailure=$False # Optional: Fail the build if there were errors during the run
)
@@ -105,7 +106,8 @@ try {
-AzureDevOpsAccessToken $AzureDevOpsAccessToken `
-GuardianLoggerLevel $GuardianLoggerLevel `
-CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams `
- -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams
+ -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams `
+ -CodeQLAdditionalRunConfigParams $CodeQLAdditionalRunConfigParams
if ($BreakOnFailure) {
Exit-IfNZEC "Sdl"
}
diff --git a/eng/common/templates/job/generate-graph-files.yml b/eng/common/templates/job/generate-graph-files.yml
deleted file mode 100644
index e54ce956f9088e..00000000000000
--- a/eng/common/templates/job/generate-graph-files.yml
+++ /dev/null
@@ -1,48 +0,0 @@
-parameters:
- # Optional: dependencies of the job
- dependsOn: ''
-
- # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool
- pool: {}
-
- # Optional: Include toolset dependencies in the generated graph files
- includeToolset: false
-
-jobs:
-- job: Generate_Graph_Files
-
- dependsOn: ${{ parameters.dependsOn }}
-
- displayName: Generate Graph Files
-
- pool: ${{ parameters.pool }}
-
- variables:
- # Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT
- # DotNet-AllOrgs-Darc-Pats provides: dn-bot-devdiv-dnceng-rw-code-pat
- - group: Publish-Build-Assets
- - group: DotNet-AllOrgs-Darc-Pats
- - name: _GraphArguments
- value: -gitHubPat $(BotAccount-dotnet-maestro-bot-PAT)
- -azdoPat $(dn-bot-devdiv-dnceng-rw-code-pat)
- -barToken $(MaestroAccessToken)
- -outputFolder '$(Build.StagingDirectory)/GraphFiles/'
- - ${{ if ne(parameters.includeToolset, 'false') }}:
- - name: _GraphArguments
- value: ${{ variables._GraphArguments }} -includeToolset
-
- steps:
- - task: PowerShell@2
- displayName: Generate Graph Files
- inputs:
- filePath: eng\common\generate-graph-files.ps1
- arguments: $(_GraphArguments)
- continueOnError: true
- - task: PublishBuildArtifacts@1
- displayName: Publish Graph to Artifacts
- inputs:
- PathtoPublish: '$(Build.StagingDirectory)/GraphFiles'
- PublishLocation: Container
- ArtifactName: GraphFiles
- continueOnError: true
- condition: always()
diff --git a/eng/common/templates/jobs/codeql-build.yml b/eng/common/templates/jobs/codeql-build.yml
new file mode 100644
index 00000000000000..f7dc5ea4aaa63c
--- /dev/null
+++ b/eng/common/templates/jobs/codeql-build.yml
@@ -0,0 +1,31 @@
+parameters:
+ # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md
+ continueOnError: false
+ # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job
+ jobs: []
+ # Optional: if specified, restore and use this version of Guardian instead of the default.
+ overrideGuardianVersion: ''
+
+jobs:
+- template: /eng/common/templates/jobs/jobs.yml
+ parameters:
+ enableMicrobuild: false
+ enablePublishBuildArtifacts: false
+ enablePublishTestResults: false
+ enablePublishBuildAssets: false
+ enablePublishUsingPipelines: false
+ enableTelemetry: true
+
+ variables:
+ - group: Publish-Build-Assets
+ # The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in
+ # sync with the packages.config file.
+ - name: DefaultGuardianVersion
+ value: 0.109.0
+ - name: GuardianPackagesConfigFile
+ value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config
+ - name: GuardianVersion
+ value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }}
+
+ jobs: ${{ parameters.jobs }}
+
diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml
index 8dd1fdbd144a06..ff4ab75c886dc7 100644
--- a/eng/common/templates/jobs/jobs.yml
+++ b/eng/common/templates/jobs/jobs.yml
@@ -87,13 +87,3 @@ jobs:
runAsPublic: ${{ parameters.runAsPublic }}
publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }}
enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }}
-
- - ${{ if eq(parameters.graphFileGeneration.enabled, true) }}:
- - template: ../job/generate-graph-files.yml
- parameters:
- continueOnError: ${{ parameters.continueOnError }}
- includeToolset: ${{ parameters.graphFileGeneration.includeToolset }}
- dependsOn:
- - Asset_Registry_Publish
- pool:
- vmImage: 'windows-2019'
diff --git a/eng/common/templates/steps/execute-codeql.yml b/eng/common/templates/steps/execute-codeql.yml
new file mode 100644
index 00000000000000..3930b1630214b3
--- /dev/null
+++ b/eng/common/templates/steps/execute-codeql.yml
@@ -0,0 +1,32 @@
+parameters:
+ # Language that should be analyzed. Defaults to csharp
+ language: csharp
+ # Build Commands
+ buildCommands: ''
+ overrideParameters: '' # Optional: to override values for parameters.
+ additionalParameters: '' # Optional: parameters that need user specific values eg: '-SourceToolsList @("abc","def") -ArtifactToolsList @("ghi","jkl")'
+ # Optional: if specified, restore and use this version of Guardian instead of the default.
+ overrideGuardianVersion: ''
+ # Optional: if true, publish the '.gdn' folder as a pipeline artifact. This can help with in-depth
+ # diagnosis of problems with specific tool configurations.
+ publishGuardianDirectoryToPipeline: false
+ # The script to run to execute all SDL tools. Use this if you want to use a script to define SDL
+ # parameters rather than relying on YAML. It may be better to use a local script, because you can
+ # reproduce results locally without piecing together a command based on the YAML.
+ executeAllSdlToolsScript: 'eng/common/sdl/execute-all-sdl-tools.ps1'
+ # There is some sort of bug (has been reported) in Azure DevOps where if this parameter is named
+ # 'continueOnError', the parameter value is not correctly picked up.
+ # This can also be remedied by the caller (post-build.yml) if it does not use a nested parameter
+ # optional: determines whether to continue the build if the step errors;
+ sdlContinueOnError: false
+
+steps:
+- template: /eng/common/templates/steps/execute-sdl.yml
+ parameters:
+ overrideGuardianVersion: ${{ parameters.overrideGuardianVersion }}
+ executeAllSdlToolsScript: ${{ parameters.executeAllSdlToolsScript }}
+ overrideParameters: ${{ parameters.overrideParameters }}
+ additionalParameters: '${{ parameters.additionalParameters }}
+ -CodeQLAdditionalRunConfigParams @("BuildCommands < ${{ parameters.buildCommands }}", "Language < ${{ parameters.language }}")'
+ publishGuardianDirectoryToPipeline: ${{ parameters.publishGuardianDirectoryToPipeline }}
+ sdlContinueOnError: ${{ parameters.sdlContinueOnError }}
\ No newline at end of file
diff --git a/eng/generators.targets b/eng/generators.targets
index 4c32554b5e2195..843842937ef3f7 100644
--- a/eng/generators.targets
+++ b/eng/generators.targets
@@ -84,10 +84,6 @@
true
$(DefineConstants);DLLIMPORTGENERATOR_INTERNALUNSAFE
-
-
- $(DefineConstants);DLLIMPORTGENERATOR_ENABLED
-
diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh
index 8f1a746752a347..373091b13a0014 100755
--- a/eng/native/build-commons.sh
+++ b/eng/native/build-commons.sh
@@ -197,7 +197,7 @@ usage()
echo ""
echo "Common Options:"
echo ""
- echo "BuildArch can be: -arm, -armel, -arm64, -s390x, x64, x86, -wasm"
+ echo "BuildArch can be: -arm, -armel, -arm64, -loongarch64, -s390x, x64, x86, -wasm"
echo "BuildType can be: -debug, -checked, -release"
echo "-os: target OS (defaults to running OS)"
echo "-bindir: output directory (defaults to $__ProjectRoot/artifacts)"
@@ -377,6 +377,10 @@ while :; do
__BuildArch=x64
;;
+ loongarch64|-loongarch64)
+ __BuildArch=loongarch64
+ ;;
+
s390x|-s390x)
__BuildArch=s390x
;;
diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake
index 5a20591cc025bb..fad1ac58d39c88 100644
--- a/eng/native/configurecompiler.cmake
+++ b/eng/native/configurecompiler.cmake
@@ -216,6 +216,9 @@ elseif (CLR_CMAKE_HOST_ARCH_ARM)
elseif (CLR_CMAKE_HOST_ARCH_ARM64)
set(ARCH_HOST_NAME arm64)
add_definitions(-DHOST_ARM64 -DHOST_64BIT)
+elseif (CLR_CMAKE_HOST_ARCH_LOONGARCH64)
+ set(ARCH_HOST_NAME loongarch64)
+ add_definitions(-DHOST_LOONGARCH64 -DHOST_64BIT)
elseif (CLR_CMAKE_HOST_ARCH_S390X)
set(ARCH_HOST_NAME s390x)
add_definitions(-DHOST_S390X -DHOST_64BIT -DBIGENDIAN)
@@ -237,6 +240,8 @@ if (CLR_CMAKE_HOST_UNIX)
message("Detected Linux ARM")
elseif(CLR_CMAKE_HOST_UNIX_ARM64)
message("Detected Linux ARM64")
+ elseif(CLR_CMAKE_HOST_UNIX_LOONGARCH64)
+ message("Detected Linux LOONGARCH64")
elseif(CLR_CMAKE_HOST_UNIX_X86)
message("Detected Linux i686")
elseif(CLR_CMAKE_HOST_UNIX_S390X)
@@ -301,6 +306,11 @@ elseif (CLR_CMAKE_TARGET_ARCH_I386)
set(ARCH_SOURCES_DIR i386)
add_compile_definitions($<$>>:TARGET_X86>)
add_compile_definitions($<$>>:TARGET_32BIT>)
+elseif (CLR_CMAKE_TARGET_ARCH_LOONGARCH64)
+ set(ARCH_TARGET_NAME loongarch64)
+ set(ARCH_SOURCES_DIR loongarch64)
+ add_compile_definitions($<$>>:TARGET_LOONGARCH64>)
+ add_compile_definitions($<$>>:TARGET_64BIT>)
elseif (CLR_CMAKE_TARGET_ARCH_S390X)
set(ARCH_TARGET_NAME s390x)
set(ARCH_SOURCES_DIR s390x)
diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake
index f5c8abe66991a0..cdf33430b49f11 100644
--- a/eng/native/configureplatform.cmake
+++ b/eng/native/configureplatform.cmake
@@ -43,6 +43,8 @@ if(CLR_CMAKE_HOST_OS STREQUAL Linux)
set(CLR_CMAKE_HOST_UNIX_ARM 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm64)
set(CLR_CMAKE_HOST_UNIX_ARM64 1)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL loongarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL loongarch64)
+ set(CLR_CMAKE_HOST_UNIX_LOONGARCH64 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686 OR CMAKE_SYSTEM_PROCESSOR STREQUAL x86)
set(CLR_CMAKE_HOST_UNIX_X86 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL s390x)
@@ -218,6 +220,9 @@ if(CLR_CMAKE_HOST_UNIX_ARM)
elseif(CLR_CMAKE_HOST_UNIX_ARM64)
set(CLR_CMAKE_HOST_ARCH_ARM64 1)
set(CLR_CMAKE_HOST_ARCH "arm64")
+elseif(CLR_CMAKE_HOST_UNIX_LOONGARCH64)
+ set(CLR_CMAKE_HOST_ARCH_LOONGARCH64 1)
+ set(CLR_CMAKE_HOST_ARCH "loongarch64")
elseif(CLR_CMAKE_HOST_UNIX_AMD64)
set(CLR_CMAKE_HOST_ARCH_AMD64 1)
set(CLR_CMAKE_HOST_ARCH "x64")
@@ -268,6 +273,8 @@ if (CLR_CMAKE_TARGET_ARCH STREQUAL x64)
set(CLR_CMAKE_TARGET_ARCH_I386 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm64)
set(CLR_CMAKE_TARGET_ARCH_ARM64 1)
+ elseif(CLR_CMAKE_TARGET_ARCH STREQUAL loongarch64)
+ set(CLR_CMAKE_TARGET_ARCH_LOONGARCH64 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm)
set(CLR_CMAKE_TARGET_ARCH_ARM 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL armel)
@@ -374,6 +381,8 @@ if(CLR_CMAKE_TARGET_UNIX)
set(CLR_CMAKE_TARGET_UNIX_ARM 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm64)
set(CLR_CMAKE_TARGET_UNIX_ARM64 1)
+ elseif(CLR_CMAKE_TARGET_ARCH STREQUAL loongarch64)
+ set(CLR_CMAKE_TARGET_UNIX_LOONGARCH64 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL x86)
set(CLR_CMAKE_TARGET_UNIX_X86 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL s390x)
diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake
index 87b4d15734bf69..c4af68ba7dc610 100644
--- a/eng/native/functions.cmake
+++ b/eng/native/functions.cmake
@@ -4,10 +4,75 @@ function(clr_unknown_arch)
elseif(CLR_CROSS_COMPONENTS_BUILD)
message(FATAL_ERROR "Only AMD64, I386 host are supported for linux cross-architecture component. Found: ${CMAKE_SYSTEM_PROCESSOR}")
else()
- message(FATAL_ERROR "Only AMD64, ARM64 and ARM are supported. Found: ${CMAKE_SYSTEM_PROCESSOR}")
+ message(FATAL_ERROR "Only AMD64, ARM64, LOONGARCH64 and ARM are supported. Found: ${CMAKE_SYSTEM_PROCESSOR}")
endif()
endfunction()
+# C to MASM include file translator
+# This is replacement for the deprecated h2inc tool that used to be part of VS.
+function(h2inc filename output)
+ file(STRINGS ${filename} lines)
+ get_filename_component(path "${filename}" DIRECTORY)
+ file(RELATIVE_PATH relative_filename "${CLR_REPO_ROOT_DIR}" "${filename}")
+
+ file(APPEND "${output}" "// File start: ${relative_filename}\n")
+
+ # Use of NEWLINE_CONSUME is needed for lines with trailing backslash
+ file(STRINGS ${filename} contents NEWLINE_CONSUME)
+ string(REGEX REPLACE "\\\\\n" "\\\\\\\\ \n" contents "${contents}")
+ string(REGEX REPLACE "\n" ";" lines "${contents}")
+
+ foreach(line IN LISTS lines)
+ string(REGEX REPLACE "\\\\\\\\ " "\\\\" line "${line}")
+
+ if(line MATCHES "^ *# pragma")
+ # Ignore pragmas
+ continue()
+ endif()
+
+ if(line MATCHES "^ *# *include *\"(.*)\"")
+ # Expand includes.
+ h2inc("${path}/${CMAKE_MATCH_1}" "${output}")
+ continue()
+ endif()
+
+ if(line MATCHES "^ *#define +([0-9A-Za-z_()]+) *(.*)")
+ # Augment #defines with their MASM equivalent
+ set(name "${CMAKE_MATCH_1}")
+ set(value "${CMAKE_MATCH_2}")
+
+ # Note that we do not handle multiline constants
+
+ # Strip comments from value
+ string(REGEX REPLACE "//.*" "" value "${value}")
+ string(REGEX REPLACE "/\\*.*\\*/" "" value "${value}")
+
+ # Strip whitespaces from value
+ string(REPLACE " +$" "" value "${value}")
+
+ # ignore #defines with arguments
+ if(NOT "${name}" MATCHES "\\(")
+ set(HEX_NUMBER_PATTERN "0x([0-9A-Fa-f]+)")
+ set(DECIMAL_NUMBER_PATTERN "(-?[0-9]+)")
+
+ if("${value}" MATCHES "${HEX_NUMBER_PATTERN}")
+ string(REGEX REPLACE "${HEX_NUMBER_PATTERN}" "0\\1h" value "${value}") # Convert hex constants
+ file(APPEND "${output}" "${name} EQU ${value}\n")
+ elseif("${value}" MATCHES "${DECIMAL_NUMBER_PATTERN}" AND (NOT "${value}" MATCHES "[G-Zg-z]+" OR "${value}" MATCHES "\\("))
+ string(REGEX REPLACE "${DECIMAL_NUMBER_PATTERN}" "\\1t" value "${value}") # Convert dec constants
+ file(APPEND "${output}" "${name} EQU ${value}\n")
+ else()
+ file(APPEND "${output}" "${name} TEXTEQU <${value}>\n")
+ endif()
+ endif()
+ endif()
+
+ file(APPEND "${output}" "${line}\n")
+ endforeach()
+
+ file(APPEND "${output}" "// File end: ${relative_filename}\n")
+endfunction()
+
# Build a list of compiler definitions by putting -D in front of each define.
function(get_compile_definitions DefinitionName)
# Get the current list of definitions
@@ -94,6 +159,10 @@ function(find_unwind_libs UnwindLibs)
find_library(UNWIND_ARCH NAMES unwind-aarch64)
endif()
+ if(CLR_CMAKE_HOST_ARCH_LOONGARCH64)
+ find_library(UNWIND_ARCH NAMES unwind-loongarch64)
+ endif()
+
if(CLR_CMAKE_HOST_ARCH_AMD64)
find_library(UNWIND_ARCH NAMES unwind-x86_64)
endif()
diff --git a/eng/native/init-os-and-arch.sh b/eng/native/init-os-and-arch.sh
index fc4078fa3a9aa4..586534be1c8aa9 100644
--- a/eng/native/init-os-and-arch.sh
+++ b/eng/native/init-os-and-arch.sh
@@ -37,6 +37,10 @@ case "$CPUName" in
arch=arm64
;;
+ loongarch64)
+ arch=loongarch64
+ ;;
+
amd64|x86_64)
arch=x64
;;
diff --git a/eng/native/tryrun.cmake b/eng/native/tryrun.cmake
index 96199969da69c9..e8a04c5698ad35 100644
--- a/eng/native/tryrun.cmake
+++ b/eng/native/tryrun.cmake
@@ -68,7 +68,7 @@ if(DARWIN)
else()
message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm64 or x64 is supported for OSX cross build!")
endif()
-elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|s390x|x86)$" OR FREEBSD OR ILLUMOS)
+elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|loongarch64|s390x|x86)$" OR FREEBSD OR ILLUMOS)
set_cache_value(FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL_EXITCODE 1)
set_cache_value(GETPWUID_R_SETS_ERRNO_EXITCODE 0)
set_cache_value(HAS_POSIX_SEMAPHORES_EXITCODE 0)
@@ -146,9 +146,9 @@ elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|s390x|x86)$" OR FREEBSD OR IL
set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0)
endif()
else()
- message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64, s390x and x86 are supported!")
+ message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64, loongarch64, s390x and x86 are supported!")
endif()
-if(TARGET_ARCH_NAME STREQUAL "x86" OR TARGET_ARCH_NAME STREQUAL "s390x")
+if(TARGET_ARCH_NAME STREQUAL "x86" OR TARGET_ARCH_NAME STREQUAL "s390x" OR TARGET_ARCH_NAME STREQUAL "loongarch64")
set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0)
endif()
diff --git a/eng/packaging.targets b/eng/packaging.targets
index 6d2bbce10da346..667837fbff1067 100644
--- a/eng/packaging.targets
+++ b/eng/packaging.targets
@@ -23,6 +23,10 @@
'$(PreReleaseVersionLabel)' != 'servicing' and
'$(GitHubRepositoryName)' != 'runtimelab'">true
false
+
+ true
$(XmlDocFileRoot)1033\$(AssemblyName).xml
true
@@ -259,7 +263,7 @@
diff --git a/eng/pipelines/coreclr/perf_slow.yml b/eng/pipelines/coreclr/perf_slow.yml
index e8410af6d361f9..04994eac96a44b 100644
--- a/eng/pipelines/coreclr/perf_slow.yml
+++ b/eng/pipelines/coreclr/perf_slow.yml
@@ -137,10 +137,11 @@ jobs:
buildConfig: release
container: ubuntu-18.04-cross-arm64-20211022152824-b2c2436
runtimeFlavor: mono
+ runtimeVariant: 'llvmaot'
platforms:
- Linux_arm64
jobParameters:
- buildArgs: -s mono+libs+host+packs -c $(_BuildConfig)
+ buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) /p:MonoEnableLLVM=true /p:MonoBundleLLVMOptimizer=true
nameSuffix: AOT
isOfficialBuild: false
extraStepsTemplate: /eng/pipelines/common/upload-artifact-step.yml
diff --git a/eng/pipelines/coreclr/superpmi-collect.yml b/eng/pipelines/coreclr/superpmi-collect.yml
index 0d41f151d6b554..8918ee8cbfcd39 100644
--- a/eng/pipelines/coreclr/superpmi-collect.yml
+++ b/eng/pipelines/coreclr/superpmi-collect.yml
@@ -30,8 +30,7 @@ jobs:
jobTemplate: /eng/pipelines/common/build-coreclr-and-libraries-job.yml
buildConfig: checked
platforms:
- # Linux tests are built on the OSX machines.
- # - OSX_x64
+ - OSX_arm64
- Linux_arm
- Linux_arm64
- Linux_x64
@@ -46,6 +45,16 @@ jobs:
- Linux_x64
- windows_x64
+# superpmi-collect-job that targets macOS/arm64 depends on coreclr binaries produced by the macOS/x64 job
+- template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/coreclr/templates/build-job.yml
+ buildConfig: checked
+ platforms:
+ - OSX_x64
+ jobParameters:
+ testGroup: outerloop
+
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/templates/runtimes/build-test-job.yml
@@ -62,6 +71,7 @@ jobs:
platforms:
# Linux tests are built on the OSX machines.
# - OSX_x64
+ - OSX_arm64
- Linux_arm
- Linux_arm64
- Linux_x64
@@ -83,6 +93,7 @@ jobs:
platforms:
# Linux tests are built on the OSX machines.
# - OSX_x64
+ - OSX_arm64
- Linux_arm
- Linux_arm64
- Linux_x64
@@ -105,6 +116,7 @@ jobs:
platforms:
# Linux tests are built on the OSX machines.
# - OSX_x64
+ - OSX_arm64
- Linux_arm
- Linux_arm64
- Linux_x64
@@ -127,6 +139,7 @@ jobs:
platforms:
# Linux tests are built on the OSX machines.
# - OSX_x64
+ - OSX_arm64
- Linux_arm
- Linux_arm64
- Linux_x64
@@ -148,6 +161,7 @@ jobs:
platforms:
# Linux tests are built on the OSX machines.
# - OSX_x64
+ - OSX_arm64
#TODO: Need special handling of running "benchmark build" from inside TMP folder on helix machine.
# - Linux_arm
# - Linux_arm64
diff --git a/eng/pipelines/coreclr/templates/run-superpmi-collect-job.yml b/eng/pipelines/coreclr/templates/run-superpmi-collect-job.yml
index 1ac235f6f6d08e..be05b52b6b1859 100644
--- a/eng/pipelines/coreclr/templates/run-superpmi-collect-job.yml
+++ b/eng/pipelines/coreclr/templates/run-superpmi-collect-job.yml
@@ -106,7 +106,7 @@ jobs:
steps:
- ${{ parameters.steps }}
- - script: $(PythonScript) $(Build.SourcesDirectory)/src/coreclr/scripts/superpmi_collect_setup.py -source_directory $(Build.SourcesDirectory) -core_root_directory $(Core_Root_Dir) -arch $(archType) -mch_file_tag $(MchFileTag) -input_directory $(InputDirectory) -collection_name $(CollectionName) -collection_type $(CollectionType) -max_size 50 # size in MB
+ - script: $(PythonScript) $(Build.SourcesDirectory)/src/coreclr/scripts/superpmi_collect_setup.py -source_directory $(Build.SourcesDirectory) -core_root_directory $(Core_Root_Dir) -arch $(archType) -platform $(osGroup) -mch_file_tag $(MchFileTag) -input_directory $(InputDirectory) -collection_name $(CollectionName) -collection_type $(CollectionType) -max_size 50 # size in MB
displayName: ${{ format('SuperPMI setup ({0})', parameters.osGroup) }}
# Create required directories for merged mch collection and superpmi logs
@@ -159,6 +159,10 @@ jobs:
artifactName: 'SuperPMI_Collection_$(CollectionName)_$(CollectionType)_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)'
displayName: ${{ format('Upload artifacts SuperPMI {0}-{1} collection', parameters.collectionName, parameters.collectionType) }}
+ # Ensure the Python azure-storage-blob package is installed before doing the upload.
+ - script: $(PipScript) install --user --upgrade pip && $(PipScript) install --user azure.storage.blob==12.5.0 --force-reinstall
+ displayName: Upgrade Pip to latest and install azure-storage-blob Python package
+
- script: $(PythonScript) $(Build.SourcesDirectory)/src/coreclr/scripts/superpmi.py upload -log_level DEBUG -arch $(archType) -build_type $(buildConfig) -mch_files $(MergedMchFileLocation)$(CollectionName).$(CollectionType).$(MchFileTag).mch -core_root $(Build.SourcesDirectory)/artifacts/bin/coreclr/$(osGroup).x64.$(buildConfigUpper)
displayName: ${{ format('Upload SuperPMI {0}-{1} collection to Azure Storage', parameters.collectionName, parameters.collectionType) }}
env:
diff --git a/eng/pipelines/coreclr/templates/superpmi-collect-job.yml b/eng/pipelines/coreclr/templates/superpmi-collect-job.yml
index 6c990a25ff4aa3..652d17af08eba5 100644
--- a/eng/pipelines/coreclr/templates/superpmi-collect-job.yml
+++ b/eng/pipelines/coreclr/templates/superpmi-collect-job.yml
@@ -84,8 +84,8 @@ jobs:
- template: /eng/pipelines/common/download-artifact-step.yml
parameters:
unpackFolder: '$(Build.SourcesDirectory)/artifacts/tests/libraries_zipped/$(osGroup).$(archType).$(buildConfigUpper)'
- artifactFileName: 'libraries_test_assets_${{ parameters.osGroup }}_x64_Release$(archiveExtension)'
- artifactName: ${{ format('libraries_test_assets_{0}_x64_Release', parameters.osGroup) }}
+ artifactFileName: 'libraries_test_assets_${{ parameters.osGroup }}_$(archType)_Release$(archiveExtension)'
+ artifactName: ${{ format('libraries_test_assets_{0}_$(archType)_Release', parameters.osGroup) }}
displayName: 'generic libraries test artifacts'
# Unzip individual test projects
diff --git a/eng/pipelines/runtime-manual.yml b/eng/pipelines/runtime-manual.yml
index a4391cff70da59..997849ed2b86c1 100644
--- a/eng/pipelines/runtime-manual.yml
+++ b/eng/pipelines/runtime-manual.yml
@@ -465,7 +465,7 @@ jobs:
- normal
#
-# Build for Browser/wasm and test it on NodeJS
+# Build for Browser/wasm and test it on v8, browser, and nodejs
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
@@ -488,9 +488,7 @@ jobs:
timeoutInMinutes: 180
condition: >-
or(
- eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
- eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
- eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
+ eq(variables['isManualOrIsNotPR'], true),
eq(variables['isFullMatrix'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
@@ -498,6 +496,8 @@ jobs:
creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
scenarios:
+ - normal
+ - WasmTestOnBrowser
- WasmTestOnNodeJs
condition: >-
or(
diff --git a/eng/run-test.sh b/eng/run-test.sh
index 64474cc435af16..0475cff40cd839 100644
--- a/eng/run-test.sh
+++ b/eng/run-test.sh
@@ -31,7 +31,7 @@ usage()
echo " default: Debug"
echo " --os OS to run (FreeBSD, Linux, NetBSD, illumos or Solaris)"
echo " default: detect current OS"
- echo " --arch Architecture to run (x64, arm, armel, x86, arm64)"
+ echo " --arch Architecture to run (x64, arm, armel, x86, arm64, loongarch64)"
echo " default: detect current architecture"
echo
echo "Execution options:"
diff --git a/eng/targetingpacks.targets b/eng/targetingpacks.targets
index 9dd37bef8fa1c3..4213c84e709d9c 100644
--- a/eng/targetingpacks.targets
+++ b/eng/targetingpacks.targets
@@ -33,7 +33,7 @@
LatestRuntimeFrameworkVersion="$(ProductVersion)"
RuntimeFrameworkName="$(LocalFrameworkOverrideName)"
RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.**RID**"
- RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64"
+ RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-loongarch64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64"
TargetFramework="$(NetCoreAppCurrent)"
TargetingPackName="$(LocalFrameworkOverrideName).Ref"
TargetingPackVersion="$(ProductVersion)"
@@ -43,13 +43,13 @@
RuntimeFrameworkName="$(LocalFrameworkOverrideName)"
LatestRuntimeFrameworkVersion="$(ProductVersion)"
RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.Mono.**RID**"
- RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;browser-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86"
+ RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-loongarch64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;browser-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86"
RuntimePackLabels="Mono"
Condition="'@(KnownRuntimePack)' == '' or !@(KnownRuntimePack->AnyHaveMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))"/>
-
@@ -169,6 +168,7 @@
+
diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets
index 192363c4b170a1..da8da1d2f4bfa9 100644
--- a/eng/testing/tests.mobile.targets
+++ b/eng/testing/tests.mobile.targets
@@ -198,7 +198,8 @@
+ AfterTargets="ComputeResolvedFilesToPublishList"
+ Condition="'$(TestFramework)' == 'xunit'">
<_runnerFilesToPublish Include="$(AndroidTestRunnerDir)*" Condition="'$(TargetOS)' == 'Android'" />
<_runnerFilesToPublish Include="$(AppleTestRunnerDir)*" Condition="'$(TargetOS)' == 'MacCatalyst' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'iOSSimulator' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'tvOSSimulator'" />
diff --git a/eng/testing/tests.props b/eng/testing/tests.props
index a6a9034a8099d2..86c661d4bb2813 100644
--- a/eng/testing/tests.props
+++ b/eng/testing/tests.props
@@ -38,6 +38,10 @@
+
+
+
+
$(RunTestsCommand) --runtime-path "$(NetCoreAppCurrentTestHostPath.TrimEnd('\/'))"
$(RunTestsCommand) --rsp-file "$(TestRspFile)"
- "$(RunScriptOutputPath)" $(AssemblyName) $(TargetArchitecture) $(TargetOS.ToLowerInvariant()) $(TestProjectName) $(AdditionalXHarnessArguments)
+
+
+
+ "$(RunScriptOutputPath)" $(AssemblyName) $(TargetArchitecture) $(TargetOS.ToLowerInvariant()) $(TestProjectName)
+ $(RunTestsCommand) $(Configuration) $(AdditionalXHarnessArguments)
+ $(RunTestsCommand) $(AdditionalXHarnessArguments)
"$(RunScriptOutputPath)" $(JSEngine) $(AssemblyName).dll $(Scenario)
diff --git a/eng/testing/tests.wasm.targets b/eng/testing/tests.wasm.targets
index 273ab76ef90a3f..191d2c2295690f 100644
--- a/eng/testing/tests.wasm.targets
+++ b/eng/testing/tests.wasm.targets
@@ -47,7 +47,8 @@
<_XHarnessArgs Condition="'$(IsFunctionalTest)' == 'true'" >$(_XHarnessArgs) --expected-exit-code=$(ExpectedExitCode)
<_XHarnessArgs Condition="'$(WasmXHarnessArgs)' != ''" >$(_XHarnessArgs) $(WasmXHarnessArgs)
- <_AppArgs Condition="'$(IsFunctionalTest)' != 'true' and '$(Scenario)' != 'BuildWasmApps'">--run WasmTestRunner.dll $(AssemblyName).dll
+ <_AppArgs Condition="'$(IsFunctionalTest)' != 'true' and '$(Scenario)' != 'BuildWasmApps' and '$(WasmMainAssemblyFileName)' == ''">--run WasmTestRunner.dll $(AssemblyName).dll
+ <_AppArgs Condition="'$(IsFunctionalTest)' != 'true' and '$(WasmMainAssemblyFileName)' != ''">--run $(WasmMainAssemblyFileName)
<_AppArgs Condition="'$(IsFunctionalTest)' == 'true'">--run $(AssemblyName).dll
<_AppArgs Condition="'$(WasmTestAppArgs)' != ''">$(_AppArgs) $(WasmTestAppArgs)
diff --git a/global.json b/global.json
index e2c9f881274f55..f191cfdd2e3525 100644
--- a/global.json
+++ b/global.json
@@ -12,12 +12,12 @@
"python3": "3.7.1"
},
"msbuild-sdks": {
- "Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "7.0.0-beta.21621.3",
- "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21621.3",
- "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.21621.3",
- "Microsoft.DotNet.SharedFramework.Sdk": "7.0.0-beta.21621.3",
+ "Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "7.0.0-beta.22056.6",
+ "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22056.6",
+ "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.22056.6",
+ "Microsoft.DotNet.SharedFramework.Sdk": "7.0.0-beta.22056.6",
"Microsoft.Build.NoTargets": "3.1.0",
"Microsoft.Build.Traversal": "3.0.23",
- "Microsoft.NET.Sdk.IL": "7.0.0-alpha.1.21620.1"
+ "Microsoft.NET.Sdk.IL": "7.0.0-alpha.1.22059.2"
}
}
diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt
index 2440f6ca999cad..38e5488938b6d7 100644
--- a/src/coreclr/CMakeLists.txt
+++ b/src/coreclr/CMakeLists.txt
@@ -247,7 +247,6 @@ add_subdirectory(debug)
add_subdirectory(binder)
add_subdirectory(classlibnative)
add_subdirectory(dlls)
-add_subdirectory(ToolBox)
add_subdirectory(tools)
add_subdirectory(unwinder)
add_subdirectory(interop)
diff --git a/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj
index f62c8b95b7c143..e1230d59401d86 100644
--- a/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj
+++ b/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj
@@ -78,6 +78,10 @@
AnyCPU
$(DefineConstants);TARGET_ARM64
+
+ AnyCPU
+ $(DefineConstants);TARGET_LOONGARCH64
+
diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs
index 44884c129e2374..fe5da8367cdd43 100644
--- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs
+++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs
@@ -46,7 +46,7 @@ internal static string UnmangleTypeName(string typeName)
while (true)
{
i = typeName.LastIndexOf('+', i);
- if (i == -1)
+ if (i < 0)
{
break;
}
@@ -626,7 +626,7 @@ internal Type[] GetTypesNoLock()
{
// Are there any possible special characters left?
int i = className.AsSpan(startIndex).IndexOfAny('[', '*', '&');
- if (i == -1)
+ if (i < 0)
{
// No, type name is simple.
baseName = className;
diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs
index 36fe011d10d4f5..6d9b8121fa6b42 100644
--- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs
+++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs
@@ -527,7 +527,7 @@ internal TypeBuilder(
}
int iLast = fullname.LastIndexOf('.');
- if (iLast == -1 || iLast == 0)
+ if (iLast <= 0)
{
// no name space
m_strNameSpace = string.Empty;
diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs
index dd9c22987203a8..cba7d80fa15b09 100644
--- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs
+++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs
@@ -523,7 +523,7 @@ public override string Name
int i = s.LastIndexOf(System.IO.Path.DirectorySeparatorChar);
- if (i == -1)
+ if (i < 0)
return s;
return s.Substring(i + 1);
diff --git a/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs b/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs
index 240a78ecfdde75..977d73e5c3b990 100644
--- a/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs
+++ b/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs
@@ -15,7 +15,7 @@
namespace System
{
[NonVersionable]
- public unsafe partial struct RuntimeTypeHandle : ISerializable
+ public unsafe partial struct RuntimeTypeHandle : IEquatable, ISerializable
{
// Returns handle for interop with EE. The handle is guaranteed to be non-null.
internal RuntimeTypeHandle GetNativeHandle()
@@ -814,7 +814,7 @@ RuntimeMethodHandleInternal Value
}
[NonVersionable]
- public unsafe partial struct RuntimeMethodHandle : ISerializable
+ public unsafe partial struct RuntimeMethodHandle : IEquatable, ISerializable
{
// Returns handle for interop with EE. The handle is guaranteed to be non-null.
internal static IRuntimeMethodInfo EnsureNonNullMethodInfo(IRuntimeMethodInfo method)
@@ -1139,7 +1139,7 @@ internal sealed class RuntimeFieldInfoStub : IRuntimeFieldInfo
}
[NonVersionable]
- public unsafe struct RuntimeFieldHandle : ISerializable
+ public unsafe struct RuntimeFieldHandle : IEquatable, ISerializable
{
// Returns handle for interop with EE. The handle is guaranteed to be non-null.
internal RuntimeFieldHandle GetNativeHandle()
diff --git a/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
index 2c7bb900641aaf..a0d7026b544078 100644
--- a/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
+++ b/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
@@ -1992,8 +1992,8 @@ private static void SplitName(string? fullname, out string? name, out string? ns
return;
// Get namespace
- int nsDelimiter = fullname.LastIndexOf(".", StringComparison.Ordinal);
- if (nsDelimiter != -1)
+ int nsDelimiter = fullname.LastIndexOf('.');
+ if (nsDelimiter >= 0)
{
ns = fullname.Substring(0, nsDelimiter);
int nameLength = fullname.Length - ns.Length - 1;
diff --git a/src/coreclr/System.Private.CoreLib/src/System/StubHelpers.cs b/src/coreclr/System.Private.CoreLib/src/System/StubHelpers.cs
index 406e1dc8c533da..d51fca9673e39c 100644
--- a/src/coreclr/System.Private.CoreLib/src/System/StubHelpers.cs
+++ b/src/coreclr/System.Private.CoreLib/src/System/StubHelpers.cs
@@ -184,7 +184,7 @@ internal static unsafe void ConvertFixedToNative(int flags, string strManaged, I
internal static unsafe string ConvertFixedToManaged(IntPtr cstr, int length)
{
int end = SpanHelpers.IndexOf(ref *(byte*)cstr, 0, length);
- if (end != -1)
+ if (end >= 0)
{
length = end;
}
@@ -512,7 +512,7 @@ internal static unsafe void ConvertToNative(string? strManaged, IntPtr nativeHom
internal static unsafe string ConvertToManaged(IntPtr nativeHome, int length)
{
int end = SpanHelpers.IndexOf(ref *(char*)nativeHome, '\0', length);
- if (end != -1)
+ if (end >= 0)
{
length = end;
}
diff --git a/src/coreclr/ToolBox/CMakeLists.txt b/src/coreclr/ToolBox/CMakeLists.txt
deleted file mode 100644
index 4e7f4368681d1d..00000000000000
--- a/src/coreclr/ToolBox/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-add_subdirectory(SOS)
-add_subdirectory(superpmi)
diff --git a/src/coreclr/binder/assemblybindercommon.cpp b/src/coreclr/binder/assemblybindercommon.cpp
index 830c673ea06a63..7b48a0a90ce831 100644
--- a/src/coreclr/binder/assemblybindercommon.cpp
+++ b/src/coreclr/binder/assemblybindercommon.cpp
@@ -972,7 +972,7 @@ namespace BINDER_SPACE
{
// Search Assembly.ni.dll, then Assembly.dll
// The Assembly.ni.dll paths are rare, and intended for supporting managed C++ R2R assemblies.
- SString candidates[] = { W(".ni.dll"), W(".dll") };
+ const WCHAR* const candidates[] = { W(".ni.dll"), W(".dll") };
// Loop through the binding paths looking for a matching assembly
for (int i = 0; i < 2; i++)
diff --git a/src/coreclr/binder/bindertracing.cpp b/src/coreclr/binder/bindertracing.cpp
index 499e20d928887f..e349b99b3c14e0 100644
--- a/src/coreclr/binder/bindertracing.cpp
+++ b/src/coreclr/binder/bindertracing.cpp
@@ -176,8 +176,8 @@ namespace BinderTracing
{
static thread_local bool t_AssemblyLoadStartInProgress = false;
- AssemblyBindOperation::AssemblyBindOperation(AssemblySpec *assemblySpec, const WCHAR *assemblyPath)
- : m_bindRequest { assemblySpec, nullptr, assemblyPath }
+ AssemblyBindOperation::AssemblyBindOperation(AssemblySpec *assemblySpec, const SString& assemblyPath)
+ : m_bindRequest { assemblySpec, SString::Empty(), assemblyPath }
, m_populatedBindRequest { false }
, m_checkedIgnoreBind { false }
, m_ignoreBind { false }
diff --git a/src/coreclr/binder/inc/bindertracing.h b/src/coreclr/binder/inc/bindertracing.h
index 75d8270b8eee51..ca28c045196388 100644
--- a/src/coreclr/binder/inc/bindertracing.h
+++ b/src/coreclr/binder/inc/bindertracing.h
@@ -27,7 +27,7 @@ namespace BinderTracing
{
public:
// This class assumes the assembly spec will have a longer lifetime than itself
- AssemblyBindOperation(AssemblySpec *assemblySpec, const WCHAR *assemblyPath = nullptr);
+ AssemblyBindOperation(AssemblySpec *assemblySpec, const SString& assemblyPath = SString::Empty());
~AssemblyBindOperation();
void SetResult(PEAssembly *assembly, bool cached = false);
diff --git a/src/coreclr/binder/textualidentityparser.cpp b/src/coreclr/binder/textualidentityparser.cpp
index 5d85a0a71cf377..f69e0bf66b202b 100644
--- a/src/coreclr/binder/textualidentityparser.cpp
+++ b/src/coreclr/binder/textualidentityparser.cpp
@@ -77,7 +77,7 @@ namespace BINDER_SPACE
}
}
- inline void BinToUnicodeHex(const BYTE *pSrc, UINT cSrc, __out_ecount(2*cSrc) LPWSTR pDst)
+ inline void BinToUnicodeHex(const BYTE *pSrc, UINT cSrc, _Out_writes_(2*cSrc) LPWSTR pDst)
{
UINT x;
UINT y;
diff --git a/src/coreclr/build-runtime.sh b/src/coreclr/build-runtime.sh
index 09529929492821..8d42b92ce95c0a 100755
--- a/src/coreclr/build-runtime.sh
+++ b/src/coreclr/build-runtime.sh
@@ -50,6 +50,8 @@ build_cross_architecture_components()
__SkipCrossArchBuild=0
elif [[ "$__BuildArch" == "arm64" && "$__CrossArch" == "x64" ]]; then
__SkipCrossArchBuild=0
+ elif [[ "$__BuildArch" == "loongarch64" && "$__CrossArch" == "x64" ]]; then
+ __SkipCrossArchBuild=0
else
# not supported
return
diff --git a/src/coreclr/classlibnative/bcltype/arraynative.cpp b/src/coreclr/classlibnative/bcltype/arraynative.cpp
index 738fd98c7f9e76..ca60fa978a626c 100644
--- a/src/coreclr/classlibnative/bcltype/arraynative.cpp
+++ b/src/coreclr/classlibnative/bcltype/arraynative.cpp
@@ -1154,23 +1154,25 @@ FCIMPL2_IV(void, ArrayNative::InitializeArray, ArrayBase* pArrayRef, FCALLRuntim
}
FCIMPLEND
-FCIMPL3(void*, ArrayNative::GetSpanDataFrom, FCALLRuntimeFieldHandle structField, FCALLRuntimeTypeHandle targetType, INT32* count)
+FCIMPL3_VVI(void*, ArrayNative::GetSpanDataFrom, FCALLRuntimeFieldHandle structField, FCALLRuntimeTypeHandle targetTypeUnsafe, INT32* count)
{
FCALL_CONTRACT;
struct
{
REFLECTFIELDREF refField;
+ REFLECTCLASSBASEREF refClass;
} gc;
gc.refField = (REFLECTFIELDREF)ObjectToOBJECTREF(FCALL_RFH_TO_REFLECTFIELD(structField));
+ gc.refClass = (REFLECTCLASSBASEREF)ObjectToOBJECTREF(FCALL_RTH_TO_REFLECTCLASS(targetTypeUnsafe));
void* data;
- HELPER_METHOD_FRAME_BEGIN_RET_1(gc);
+ HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc);
FieldDesc* pField = (FieldDesc*)gc.refField->GetField();
if (!pField->IsRVA())
COMPlusThrow(kArgumentException);
- TypeHandle targetTypeHandle = FCALL_RTH_TO_REFLECTCLASS(targetType)->GetType();
+ TypeHandle targetTypeHandle = gc.refClass->GetType();
if (!CorTypeInfo::IsPrimitiveType(targetTypeHandle.GetSignatureCorElementType()) && !targetTypeHandle.IsEnum())
COMPlusThrow(kArgumentException);
@@ -1180,8 +1182,9 @@ FCIMPL3(void*, ArrayNative::GetSpanDataFrom, FCALLRuntimeFieldHandle structField
// Report the RVA field to the logger.
g_IBCLogger.LogRVADataAccess(pField);
- _ASSERTE(data != NULL && count != NULL);
data = pField->GetStaticAddressHandle(NULL);
+ _ASSERTE(data != NULL);
+ _ASSERTE(count != NULL);
if (AlignUp((UINT_PTR)data, targetTypeSize) != (UINT_PTR)data)
COMPlusThrow(kArgumentException);
diff --git a/src/coreclr/classlibnative/bcltype/arraynative.h b/src/coreclr/classlibnative/bcltype/arraynative.h
index 6a1c8979525cdb..bd74be3d3ea6ac 100644
--- a/src/coreclr/classlibnative/bcltype/arraynative.h
+++ b/src/coreclr/classlibnative/bcltype/arraynative.h
@@ -48,7 +48,7 @@ class ArrayNative
// This method will acquire data to create a span from a TypeHandle
// to a field.
- static FCDECL3(void*, GetSpanDataFrom, FCALLRuntimeFieldHandle structField, FCALLRuntimeTypeHandle targetType, INT32* count);
+ static FCDECL3_VVI(void*, GetSpanDataFrom, FCALLRuntimeFieldHandle structField, FCALLRuntimeTypeHandle targetTypeUnsafe, INT32* count);
private:
// Helper for CreateInstance
diff --git a/src/coreclr/clrdefinitions.cmake b/src/coreclr/clrdefinitions.cmake
index 50aab221c8032e..d5fc9f5e1ee8e5 100644
--- a/src/coreclr/clrdefinitions.cmake
+++ b/src/coreclr/clrdefinitions.cmake
@@ -191,12 +191,12 @@ if (CLR_CMAKE_TARGET_ARCH_AMD64)
add_definitions(-DUNIX_AMD64_ABI_ITF)
endif (CLR_CMAKE_TARGET_ARCH_AMD64)
add_definitions(-DFEATURE_USE_ASM_GC_WRITE_BARRIERS)
-if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64)
+if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_LOONGARCH64)
add_definitions(-DFEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP)
-endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64)
-if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64)
+endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_LOONGARCH64)
+if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_LOONGARCH64)
add_definitions(-DFEATURE_MANUALLY_MANAGED_CARD_BUNDLES)
-endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64)
+endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_LOONGARCH64)
if(NOT CLR_CMAKE_TARGET_UNIX)
add_definitions(-DFEATURE_WIN32_REGISTRY)
@@ -240,6 +240,7 @@ function(set_target_definitions_to_custom_os_and_arch)
elseif (TARGETDETAILS_ARCH STREQUAL "x86")
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE UNIX_X86_ABI)
elseif (TARGETDETAILS_ARCH STREQUAL "arm64")
+ elseif (TARGETDETAILS_ARCH STREQUAL "loongarch64")
endif()
if ((TARGETDETAILS_ARCH STREQUAL "arm64") AND (TARGETDETAILS_OS STREQUAL "unix_osx"))
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE OSX_ARM64_ABI)
@@ -260,6 +261,10 @@ function(set_target_definitions_to_custom_os_and_arch)
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_64BIT)
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_ARM64)
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_MULTIREG_RETURN)
+ elseif(TARGETDETAILS_ARCH STREQUAL "loongarch64")
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_64BIT)
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_LOONGARCH64)
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_MULTIREG_RETURN)
elseif((TARGETDETAILS_ARCH STREQUAL "arm") OR (TARGETDETAILS_ARCH STREQUAL "armel"))
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_ARM)
endif()
diff --git a/src/coreclr/debug/createdump/crashinfomac.cpp b/src/coreclr/debug/createdump/crashinfomac.cpp
index ad9c247e37dfdc..3ada3bd767c964 100644
--- a/src/coreclr/debug/createdump/crashinfomac.cpp
+++ b/src/coreclr/debug/createdump/crashinfomac.cpp
@@ -277,6 +277,9 @@ void CrashInfo::VisitSegment(MachOModule& module, const segment_command_64& segm
uint64_t start = segment.vmaddr + module.LoadBias();
uint64_t end = start + segment.vmsize;
+ // Add this module segment to the set used by the thread unwinding to lookup the module base address for an ip.
+ AddModuleAddressRange(start, end, module.BaseAddress());
+
// Round to page boundary
start = start & PAGE_MASK;
_ASSERTE(start > 0);
@@ -297,9 +300,6 @@ void CrashInfo::VisitSegment(MachOModule& module, const segment_command_64& segm
}
// Add this module segment to the module mappings list
m_moduleMappings.insert(moduleRegion);
-
- // Add this module segment to the set used by the thread unwinding to lookup the module base address for an ip.
- AddModuleAddressRange(start, end, module.BaseAddress());
}
else
{
diff --git a/src/coreclr/debug/createdump/stackframe.h b/src/coreclr/debug/createdump/stackframe.h
index 75e20d93120c0c..00c3a1cfb7fd8f 100644
--- a/src/coreclr/debug/createdump/stackframe.h
+++ b/src/coreclr/debug/createdump/stackframe.h
@@ -66,9 +66,16 @@ struct StackFrame
}
}
+// See comment in threadinfo.cpp UnwindNativeFrames function
+#if defined(__aarch64__)
+ #define STACK_POINTER_MASK ~0x7
+#else
+ #define STACK_POINTER_MASK ~0x0
+#endif
+
inline uint64_t ModuleAddress() const { return m_moduleAddress; }
inline uint64_t InstructionPointer() const { return m_instructionPointer; }
- inline uint64_t StackPointer() const { return m_stackPointer; }
+ inline uint64_t StackPointer() const { return m_stackPointer & STACK_POINTER_MASK; }
inline uint32_t NativeOffset() const { return m_nativeOffset; }
inline uint32_t Token() const { return m_token; }
inline uint32_t ILOffset() const { return m_ilOffset; }
diff --git a/src/coreclr/debug/createdump/threadinfo.cpp b/src/coreclr/debug/createdump/threadinfo.cpp
index 82509f52750653..e64eafc8d29a96 100644
--- a/src/coreclr/debug/createdump/threadinfo.cpp
+++ b/src/coreclr/debug/createdump/threadinfo.cpp
@@ -53,6 +53,16 @@ ThreadInfo::UnwindNativeFrames(CONTEXT* pContext)
uint64_t ip = 0, sp = 0;
GetFrameLocation(pContext, &ip, &sp);
+#if defined(__aarch64__)
+ // ARM64 can have frames with the same SP but different IPs. Increment sp so it gets added to the stack
+ // frames in the correct order and to prevent the below loop termination on non-increasing sp. Since stack
+ // pointers are always 8 byte align, this increase is masked off in StackFrame::StackPointer() to get the
+ // original stack pointer.
+ if (sp == previousSp && ip != previousIp)
+ {
+ sp++;
+ }
+#endif
if (ip == 0 || sp <= previousSp) {
TRACE_VERBOSE("Unwind: sp not increasing or ip == 0 sp %p ip %p\n", (void*)sp, (void*)ip);
break;
diff --git a/src/coreclr/debug/daccess/daccess.cpp b/src/coreclr/debug/daccess/daccess.cpp
index f9ec95c1f41838..9aaf6e6e4cb171 100644
--- a/src/coreclr/debug/daccess/daccess.cpp
+++ b/src/coreclr/debug/daccess/daccess.cpp
@@ -92,10 +92,10 @@ BOOL WINAPI DllMain(HANDLE instance, DWORD reason, LPVOID reserved)
}
HRESULT
-ConvertUtf8(__in LPCUTF8 utf8,
+ConvertUtf8(_In_ LPCUTF8 utf8,
ULONG32 bufLen,
ULONG32* nameLen,
- __out_ecount_part_opt(bufLen, *nameLen) PWSTR buffer)
+ _Out_writes_to_opt_(bufLen, *nameLen) PWSTR buffer)
{
if (nameLen)
{
@@ -118,9 +118,9 @@ ConvertUtf8(__in LPCUTF8 utf8,
}
HRESULT
-AllocUtf8(__in_opt LPCWSTR wstr,
+AllocUtf8(_In_opt_ LPCWSTR wstr,
ULONG32 srcChars,
- __deref_out LPUTF8* utf8)
+ _Outptr_ LPUTF8* utf8)
{
ULONG32 chars = WszWideCharToMultiByte(CP_UTF8, 0, wstr, srcChars,
NULL, 0, NULL, NULL);
@@ -165,7 +165,7 @@ HRESULT
GetFullClassNameFromMetadata(IMDInternalImport* mdImport,
mdTypeDef classToken,
ULONG32 bufferChars,
- __inout_ecount(bufferChars) LPUTF8 buffer)
+ _Inout_updates_(bufferChars) LPUTF8 buffer)
{
HRESULT hr;
LPCUTF8 baseName, namespaceName;
@@ -179,7 +179,7 @@ HRESULT
GetFullMethodNameFromMetadata(IMDInternalImport* mdImport,
mdMethodDef methodToken,
ULONG32 bufferChars,
- __inout_ecount(bufferChars) LPUTF8 buffer)
+ _Inout_updates_(bufferChars) LPUTF8 buffer)
{
HRESULT status;
HRESULT hr;
@@ -228,13 +228,13 @@ GetFullMethodNameFromMetadata(IMDInternalImport* mdImport,
}
HRESULT
-SplitFullName(__in_z __in PCWSTR fullName,
+SplitFullName(_In_z_ PCWSTR fullName,
SplitSyntax syntax,
ULONG32 memberDots,
- __deref_out_opt LPUTF8* namespaceName,
- __deref_out_opt LPUTF8* typeName,
- __deref_out_opt LPUTF8* memberName,
- __deref_out_opt LPUTF8* params)
+ _Outptr_opt_ LPUTF8* namespaceName,
+ _Outptr_opt_ LPUTF8* typeName,
+ _Outptr_opt_ LPUTF8* memberName,
+ _Outptr_opt_ LPUTF8* params)
{
HRESULT status;
PCWSTR paramsStart, memberStart, memberEnd, typeStart;
@@ -401,7 +401,7 @@ SplitFullName(__in_z __in PCWSTR fullName,
}
int
-CompareUtf8(__in LPCUTF8 str1, __in LPCUTF8 str2, __in ULONG32 nameFlags)
+CompareUtf8(_In_ LPCUTF8 str1, _In_ LPCUTF8 str2, _In_ ULONG32 nameFlags)
{
if (nameFlags & CLRDATA_BYNAME_CASE_INSENSITIVE)
{
@@ -469,8 +469,8 @@ MetaEnum::End(void)
HRESULT
MetaEnum::NextToken(mdToken* token,
- __deref_opt_out_opt LPCUTF8* namespaceName,
- __deref_opt_out_opt LPCUTF8* name)
+ _Outptr_opt_result_maybenull_ LPCUTF8* namespaceName,
+ _Outptr_opt_result_maybenull_ LPCUTF8* name)
{
HRESULT hr;
if (!m_mdImport)
@@ -584,8 +584,8 @@ MetaEnum::NextDomainToken(AppDomain** appDomain,
}
HRESULT
-MetaEnum::NextTokenByName(__in_opt LPCUTF8 namespaceName,
- __in_opt LPCUTF8 name,
+MetaEnum::NextTokenByName(_In_opt_ LPCUTF8 namespaceName,
+ _In_opt_ LPCUTF8 name,
ULONG32 nameFlags,
mdToken* token)
{
@@ -617,8 +617,8 @@ MetaEnum::NextTokenByName(__in_opt LPCUTF8 namespaceName,
}
HRESULT
-MetaEnum::NextDomainTokenByName(__in_opt LPCUTF8 namespaceName,
- __in_opt LPCUTF8 name,
+MetaEnum::NextDomainTokenByName(_In_opt_ LPCUTF8 namespaceName,
+ _In_opt_ LPCUTF8 name,
ULONG32 nameFlags,
AppDomain** appDomain, mdToken* token)
{
@@ -755,7 +755,7 @@ SplitName::Clear(void)
}
HRESULT
-SplitName::SplitString(__in_opt PCWSTR fullName)
+SplitName::SplitString(_In_opt_ PCWSTR fullName)
{
if (m_syntax == SPLIT_NO_NAME)
{
@@ -800,7 +800,7 @@ WCHAR* wcrscan(LPCWSTR beg, LPCWSTR end, WCHAR ch)
// sepName to point to the second '+' character in the string. When sepName
// points to the first '+' character this function will return "Outer" in
// pResult and sepName will point one WCHAR before fullName.
-HRESULT NextEnclosingClasName(LPCWSTR fullName, __deref_inout LPWSTR& sepName, __deref_out LPUTF8 *pResult)
+HRESULT NextEnclosingClasName(LPCWSTR fullName, _Outref_ LPWSTR& sepName, _Outptr_ LPUTF8 *pResult)
{
if (sepName < fullName)
{
@@ -994,7 +994,7 @@ SplitName::FindField(IMDInternalImport* mdInternal)
}
HRESULT
-SplitName::AllocAndSplitString(__in_opt PCWSTR fullName,
+SplitName::AllocAndSplitString(_In_opt_ PCWSTR fullName,
SplitSyntax syntax,
ULONG32 nameFlags,
ULONG32 memberDots,
@@ -1024,7 +1024,7 @@ SplitName::AllocAndSplitString(__in_opt PCWSTR fullName,
}
HRESULT
-SplitName::CdStartMethod(__in_opt PCWSTR fullName,
+SplitName::CdStartMethod(_In_opt_ PCWSTR fullName,
ULONG32 nameFlags,
Module* mod,
mdTypeDef typeToken,
@@ -1138,7 +1138,7 @@ SplitName::CdNextDomainMethod(CLRDATA_ENUM* handle,
}
HRESULT
-SplitName::CdStartField(__in_opt PCWSTR fullName,
+SplitName::CdStartField(_In_opt_ PCWSTR fullName,
ULONG32 nameFlags,
ULONG32 fieldFlags,
IXCLRDataTypeInstance* fromTypeInst,
@@ -1241,7 +1241,7 @@ SplitName::CdNextField(ClrDataAccess* dac,
IXCLRDataValue** value,
ULONG32 nameBufRetLen,
ULONG32* nameLenRet,
- __out_ecount_part_opt(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
+ _Out_writes_to_opt_(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
IXCLRDataModule** tokenScopeRet,
mdFieldDef* tokenRet)
{
@@ -1419,7 +1419,7 @@ SplitName::CdNextDomainField(ClrDataAccess* dac,
}
HRESULT
-SplitName::CdStartType(__in_opt PCWSTR fullName,
+SplitName::CdStartType(_In_opt_ PCWSTR fullName,
ULONG32 nameFlags,
Module* mod,
AppDomain* appDomain,
@@ -3698,7 +3698,7 @@ ClrDataAccess::GetRuntimeNameByAddress(
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *symbolLen,
- /* [size_is][out] */ __out_ecount_opt(bufLen) WCHAR symbolBuf[ ],
+ /* [size_is][out] */ _Out_writes_bytes_opt_(bufLen) WCHAR symbolBuf[ ],
/* [out] */ CLRDATA_ADDRESS* displacement)
{
HRESULT status;
@@ -4317,7 +4317,7 @@ ClrDataAccess::GetDataByAddress(
/* [in] */ IXCLRDataTask* tlsTask,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataValue **value,
/* [out] */ CLRDATA_ADDRESS *displacement)
{
@@ -5642,7 +5642,7 @@ ClrDataAccess::GetFullMethodName(
IN MethodDesc* methodDesc,
IN ULONG32 symbolChars,
OUT ULONG32* symbolLen,
- __out_ecount_part_opt(symbolChars, *symbolLen) LPWSTR symbol
+ _Out_writes_to_opt_(symbolChars, *symbolLen) LPWSTR symbol
)
{
StackSString s;
@@ -5690,7 +5690,7 @@ ClrDataAccess::GetJitHelperName(
#define JITHELPER(code,fn,sig) #code,
#include
};
- static_assert_no_msg(COUNTOF(s_rgHelperNames) == CORINFO_HELP_COUNT);
+ static_assert_no_msg(ARRAY_SIZE(s_rgHelperNames) == CORINFO_HELP_COUNT);
#ifdef TARGET_UNIX
if (!dynamicHelpersOnly)
@@ -5737,7 +5737,7 @@ ClrDataAccess::RawGetMethodName(
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *symbolLen,
- /* [size_is][out] */ __out_ecount_opt(bufLen) WCHAR symbolBuf[ ],
+ /* [size_is][out] */ _Out_writes_bytes_opt_(bufLen) WCHAR symbolBuf[ ],
/* [out] */ CLRDATA_ADDRESS* displacement)
{
#ifdef TARGET_ARM
@@ -5745,7 +5745,7 @@ ClrDataAccess::RawGetMethodName(
address &= ~THUMB_CODE;
#endif
- const UINT k_cch64BitHexFormat = COUNTOF("1234567812345678");
+ const UINT k_cch64BitHexFormat = ARRAY_SIZE("1234567812345678");
HRESULT status;
if (flags != 0)
@@ -5887,7 +5887,7 @@ ClrDataAccess::RawGetMethodName(
// Printf failed. Estimate a size that will be at least big enough to hold the name
if (symbolLen)
{
- size_t cchSymbol = COUNTOF(s_wszFormatNameWithStubManager) +
+ size_t cchSymbol = ARRAY_SIZE(s_wszFormatNameWithStubManager) +
wcslen(wszStubManagerName) +
k_cch64BitHexFormat +
1;
@@ -5950,7 +5950,7 @@ ClrDataAccess::RawGetMethodName(
// Printf failed. Estimate a size that will be at least big enough to hold the name
if (symbolLen)
{
- size_t cchSymbol = COUNTOF(s_wszFormatNameAddressOnly) +
+ size_t cchSymbol = ARRAY_SIZE(s_wszFormatNameAddressOnly) +
k_cch64BitHexFormat +
1;
@@ -6460,7 +6460,7 @@ ClrDataAccess::GetMetaDataFileInfoFromPEFile(PEAssembly *pPEAssembly,
DWORD &dwDataSize,
DWORD &dwRvaHint,
bool &isNGEN,
- __out_ecount(cchFilePath) LPWSTR wszFilePath,
+ _Out_writes_(cchFilePath) LPWSTR wszFilePath,
const DWORD cchFilePath)
{
SUPPORTS_DAC_HOST_ONLY;
@@ -6524,7 +6524,7 @@ ClrDataAccess::GetMetaDataFileInfoFromPEFile(PEAssembly *pPEAssembly,
bool ClrDataAccess::GetILImageInfoFromNgenPEFile(PEAssembly *pPEAssembly,
DWORD &dwTimeStamp,
DWORD &dwSize,
- __out_ecount(cchFilePath) LPWSTR wszFilePath,
+ _Out_writes_(cchFilePath) LPWSTR wszFilePath,
const DWORD cchFilePath)
{
SUPPORTS_DAC_HOST_ONLY;
@@ -6548,7 +6548,7 @@ bool ClrDataAccess::GetILImageInfoFromNgenPEFile(PEAssembly *pPEAssembly,
// In the end we add given ilExtension.
// This dependecy is based on Apollo installer behavior.
bool ClrDataAccess::GetILImageNameFromNgenImage( LPCWSTR ilExtension,
- __out_ecount(cchFilePath) LPWSTR wszFilePath,
+ _Out_writes_(cchFilePath) LPWSTR wszFilePath,
const DWORD cchFilePath)
{
if (wszFilePath == NULL || cchFilePath == 0)
@@ -7565,9 +7565,9 @@ typedef struct _WER_RUNTIME_EXCEPTION_INFORMATION
// else detailed error code.
//
//----------------------------------------------------------------------------
-STDAPI OutOfProcessExceptionEventGetWatsonBucket(__in PDWORD pContext,
- __in const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
- __out GenericModeBlock * pGMB)
+STDAPI OutOfProcessExceptionEventGetWatsonBucket(_In_ PDWORD pContext,
+ _In_ const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
+ _Out_ GenericModeBlock * pGMB)
{
HANDLE hProcess = pExceptionInformation->hProcess;
HANDLE hThread = pExceptionInformation->hThread;
@@ -7656,12 +7656,12 @@ STDAPI OutOfProcessExceptionEventGetWatsonBucket(__in PDWORD pContext,
// Since this is called by external modules it's important that we don't let any exceptions leak out (see Win8 95224).
//
//----------------------------------------------------------------------------
-STDAPI OutOfProcessExceptionEventCallback(__in PDWORD pContext,
- __in const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
- __out BOOL * pbOwnershipClaimed,
- __out_ecount(*pchSize) PWSTR pwszEventName,
+STDAPI OutOfProcessExceptionEventCallback(_In_ PDWORD pContext,
+ _In_ const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
+ _Out_ BOOL * pbOwnershipClaimed,
+ _Out_writes_(*pchSize) PWSTR pwszEventName,
__inout PDWORD pchSize,
- __out PDWORD pdwSignatureCount)
+ _Out_ PDWORD pdwSignatureCount)
{
SUPPORTS_DAC_HOST_ONLY;
@@ -7748,12 +7748,12 @@ STDAPI OutOfProcessExceptionEventCallback(__in PDWORD pContext,
// Since this is called by external modules it's important that we don't let any exceptions leak out (see Win8 95224).
//
//----------------------------------------------------------------------------
-STDAPI OutOfProcessExceptionEventSignatureCallback(__in PDWORD pContext,
- __in const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
- __in DWORD dwIndex,
- __out_ecount(*pchName) PWSTR pwszName,
+STDAPI OutOfProcessExceptionEventSignatureCallback(_In_ PDWORD pContext,
+ _In_ const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
+ _In_ DWORD dwIndex,
+ _Out_writes_(*pchName) PWSTR pwszName,
__inout PDWORD pchName,
- __out_ecount(*pchValue) PWSTR pwszValue,
+ _Out_writes_(*pchValue) PWSTR pwszValue,
__inout PDWORD pchValue)
{
SUPPORTS_DAC_HOST_ONLY;
@@ -7873,12 +7873,12 @@ STDAPI OutOfProcessExceptionEventSignatureCallback(__in PDWORD pContext,
// this function are of the pwszName and pwszValue buffers.
//
//----------------------------------------------------------------------------
-STDAPI OutOfProcessExceptionEventDebuggerLaunchCallback(__in PDWORD pContext,
- __in const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
- __out BOOL * pbCustomDebuggerNeeded,
- __out_ecount_opt(*pchSize) PWSTR pwszDebuggerLaunch,
+STDAPI OutOfProcessExceptionEventDebuggerLaunchCallback(_In_ PDWORD pContext,
+ _In_ const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
+ _Out_ BOOL * pbCustomDebuggerNeeded,
+ _Out_writes_opt_(*pchSize) PWSTR pwszDebuggerLaunch,
__inout PDWORD pchSize,
- __out BOOL * pbAutoLaunchDebugger)
+ _Out_ BOOL * pbAutoLaunchDebugger)
{
SUPPORTS_DAC_HOST_ONLY;
diff --git a/src/coreclr/debug/daccess/dacfn.cpp b/src/coreclr/debug/daccess/dacfn.cpp
index e1b83aba17e20c..11f798ed04c199 100644
--- a/src/coreclr/debug/daccess/dacfn.cpp
+++ b/src/coreclr/debug/daccess/dacfn.cpp
@@ -89,7 +89,7 @@ DacExceptionFilter(Exception* ex, ClrDataAccess* access,
}
void __cdecl
-DacWarning(__in char* format, ...)
+DacWarning(_In_ char* format, ...)
{
char text[256];
va_list args;
diff --git a/src/coreclr/debug/daccess/dacimpl.h b/src/coreclr/debug/daccess/dacimpl.h
index 948bef16e498da..57a4dc1bbab8fc 100644
--- a/src/coreclr/debug/daccess/dacimpl.h
+++ b/src/coreclr/debug/daccess/dacimpl.h
@@ -222,22 +222,22 @@ struct METH_EXTENTS
CLRDATA_ADDRESS_RANGE extents[1];
};
-HRESULT ConvertUtf8(__in LPCUTF8 utf8,
+HRESULT ConvertUtf8(_In_ LPCUTF8 utf8,
ULONG32 bufLen,
ULONG32* nameLen,
- __out_ecount_part_opt(bufLen, *nameLen) PWSTR buffer);
-HRESULT AllocUtf8(__in_opt LPCWSTR wstr,
+ _Out_writes_to_opt_(bufLen, *nameLen) PWSTR buffer);
+HRESULT AllocUtf8(_In_opt_ LPCWSTR wstr,
ULONG32 srcChars,
- __deref_out LPUTF8* utf8);
+ _Outptr_ LPUTF8* utf8);
HRESULT GetFullClassNameFromMetadata(IMDInternalImport* mdImport,
mdTypeDef classToken,
ULONG32 bufferChars,
- __inout_ecount(bufferChars) LPUTF8 buffer);
+ _Inout_updates_(bufferChars) LPUTF8 buffer);
HRESULT GetFullMethodNameFromMetadata(IMDInternalImport* mdImport,
mdMethodDef methodToken,
ULONG32 bufferChars,
- __inout_ecount(bufferChars) LPUTF8 buffer);
+ _Inout_updates_(bufferChars) LPUTF8 buffer);
enum SplitSyntax
{
@@ -247,15 +247,15 @@ enum SplitSyntax
SPLIT_NO_NAME,
};
-HRESULT SplitFullName(__in_z __in PCWSTR fullName,
+HRESULT SplitFullName(_In_z_ PCWSTR fullName,
SplitSyntax syntax,
ULONG32 memberDots,
- __deref_out_opt LPUTF8* namespaceName,
- __deref_out_opt LPUTF8* typeName,
- __deref_out_opt LPUTF8* memberName,
- __deref_out_opt LPUTF8* params);
+ _Outptr_opt_ LPUTF8* namespaceName,
+ _Outptr_opt_ LPUTF8* typeName,
+ _Outptr_opt_ LPUTF8* memberName,
+ _Outptr_opt_ LPUTF8* params);
-int CompareUtf8(__in LPCUTF8 str1, __in LPCUTF8 str2, __in ULONG32 nameFlags);
+int CompareUtf8(_In_ LPCUTF8 str1, _In_ LPCUTF8 str2, _In_ ULONG32 nameFlags);
#define INH_STATIC \
(CLRDATA_VALUE_ALL_KINDS | \
@@ -304,16 +304,16 @@ class MetaEnum
void End(void);
HRESULT NextToken(mdToken* token,
- __deref_opt_out_opt LPCUTF8* namespaceName,
- __deref_opt_out_opt LPCUTF8* name);
+ _Outptr_opt_result_maybenull_ LPCUTF8* namespaceName,
+ _Outptr_opt_result_maybenull_ LPCUTF8* name);
HRESULT NextDomainToken(AppDomain** appDomain,
mdToken* token);
- HRESULT NextTokenByName(__in_opt LPCUTF8 namespaceName,
- __in_opt LPCUTF8 name,
+ HRESULT NextTokenByName(_In_opt_ LPCUTF8 namespaceName,
+ _In_opt_ LPCUTF8 name,
ULONG32 nameFlags,
mdToken* token);
- HRESULT NextDomainTokenByName(__in_opt LPCUTF8 namespaceName,
- __in_opt LPCUTF8 name,
+ HRESULT NextDomainTokenByName(_In_opt_ LPCUTF8 namespaceName,
+ _In_opt_ LPCUTF8 name,
ULONG32 nameFlags,
AppDomain** appDomain, mdToken* token);
@@ -410,7 +410,7 @@ class SplitName
void Delete(void);
void Clear(void);
- HRESULT SplitString(__in_opt PCWSTR fullName);
+ HRESULT SplitString(_In_opt_ PCWSTR fullName);
bool FindType(IMDInternalImport* mdInternal);
bool FindMethod(IMDInternalImport* mdInternal);
@@ -421,13 +421,13 @@ class SplitName
return CompareUtf8(str1, str2, m_nameFlags);
}
- static HRESULT AllocAndSplitString(__in_opt PCWSTR fullName,
+ static HRESULT AllocAndSplitString(_In_opt_ PCWSTR fullName,
SplitSyntax syntax,
ULONG32 nameFlags,
ULONG32 memberDots,
SplitName** split);
- static HRESULT CdStartMethod(__in_opt PCWSTR fullName,
+ static HRESULT CdStartMethod(_In_opt_ PCWSTR fullName,
ULONG32 nameFlags,
Module* mod,
mdTypeDef typeToken,
@@ -441,7 +441,7 @@ class SplitName
AppDomain** appDomain,
mdMethodDef* token);
- static HRESULT CdStartField(__in_opt PCWSTR fullName,
+ static HRESULT CdStartField(_In_opt_ PCWSTR fullName,
ULONG32 nameFlags,
ULONG32 fieldFlags,
IXCLRDataTypeInstance* fromTypeInst,
@@ -462,14 +462,14 @@ class SplitName
IXCLRDataValue** value,
ULONG32 nameBufRetLen,
ULONG32* nameLenRet,
- __out_ecount_part_opt(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
+ _Out_writes_to_opt_(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
IXCLRDataModule** tokenScopeRet,
mdFieldDef* tokenRet);
static HRESULT CdNextDomainField(ClrDataAccess* dac,
CLRDATA_ENUM* handle,
IXCLRDataValue** value);
- static HRESULT CdStartType(__in_opt PCWSTR fullName,
+ static HRESULT CdStartType(_In_opt_ PCWSTR fullName,
ULONG32 nameFlags,
Module* mod,
AppDomain* appDomain,
@@ -901,7 +901,7 @@ class ClrDataAccess
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_opt(bufLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_bytes_opt_(bufLen) WCHAR nameBuf[ ],
/* [out] */ CLRDATA_ADDRESS* displacement);
virtual HRESULT STDMETHODCALLTYPE StartEnumAppDomains(
@@ -972,7 +972,7 @@ class ClrDataAccess
/* [in] */ IXCLRDataTask* tlsTask,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataValue **value,
/* [out] */ CLRDATA_ADDRESS *displacement);
@@ -1080,10 +1080,10 @@ class ClrDataAccess
virtual HRESULT STDMETHODCALLTYPE GetAppDomainStoreData(struct DacpAppDomainStoreData *data);
virtual HRESULT STDMETHODCALLTYPE GetAppDomainList(unsigned int count, CLRDATA_ADDRESS values[], unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetAppDomainData(CLRDATA_ADDRESS addr, struct DacpAppDomainData *data);
- virtual HRESULT STDMETHODCALLTYPE GetAppDomainName(CLRDATA_ADDRESS addr, unsigned int count, __out_z __inout_ecount(count) WCHAR *name, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetAppDomainName(CLRDATA_ADDRESS addr, unsigned int count, _Inout_updates_z_(count) WCHAR *name, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetAssemblyList(CLRDATA_ADDRESS appDomain, int count, CLRDATA_ADDRESS values[], int *fetched);
virtual HRESULT STDMETHODCALLTYPE GetAssemblyData(CLRDATA_ADDRESS baseDomainPtr, CLRDATA_ADDRESS assembly, struct DacpAssemblyData *data);
- virtual HRESULT STDMETHODCALLTYPE GetAssemblyName(CLRDATA_ADDRESS assembly, unsigned int count, __out_z __inout_ecount(count) WCHAR *name, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetAssemblyName(CLRDATA_ADDRESS assembly, unsigned int count, _Inout_updates_z_(count) WCHAR *name, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetThreadData(CLRDATA_ADDRESS thread, struct DacpThreadData *data);
virtual HRESULT STDMETHODCALLTYPE GetThreadFromThinlockID(UINT thinLockId, CLRDATA_ADDRESS *pThread);
virtual HRESULT STDMETHODCALLTYPE GetStackLimits(CLRDATA_ADDRESS threadPtr, CLRDATA_ADDRESS *lower, CLRDATA_ADDRESS *upper, CLRDATA_ADDRESS *fp);
@@ -1091,27 +1091,27 @@ class ClrDataAccess
virtual HRESULT STDMETHODCALLTYPE GetMethodDescData(CLRDATA_ADDRESS methodDesc, CLRDATA_ADDRESS ip, struct DacpMethodDescData *data, ULONG cRevertedRejitVersions, DacpReJitData * rgRevertedRejitData, ULONG * pcNeededRevertedRejitData);
virtual HRESULT STDMETHODCALLTYPE GetMethodDescPtrFromIP(CLRDATA_ADDRESS ip, CLRDATA_ADDRESS * ppMD);
- virtual HRESULT STDMETHODCALLTYPE GetMethodDescName(CLRDATA_ADDRESS methodDesc, unsigned int count, __out_z __inout_ecount(count) WCHAR *name, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetMethodDescName(CLRDATA_ADDRESS methodDesc, unsigned int count, _Inout_updates_z_(count) WCHAR *name, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetMethodDescPtrFromFrame(CLRDATA_ADDRESS frameAddr, CLRDATA_ADDRESS * ppMD);
virtual HRESULT STDMETHODCALLTYPE GetCodeHeaderData(CLRDATA_ADDRESS ip, struct DacpCodeHeaderData *data);
virtual HRESULT STDMETHODCALLTYPE GetThreadpoolData(struct DacpThreadpoolData *data);
virtual HRESULT STDMETHODCALLTYPE GetWorkRequestData(CLRDATA_ADDRESS addrWorkRequest, struct DacpWorkRequestData *data);
virtual HRESULT STDMETHODCALLTYPE GetObjectData(CLRDATA_ADDRESS objAddr, struct DacpObjectData *data);
- virtual HRESULT STDMETHODCALLTYPE GetObjectStringData(CLRDATA_ADDRESS obj, unsigned int count, __out_z __inout_ecount(count) WCHAR *stringData, unsigned int *pNeeded);
- virtual HRESULT STDMETHODCALLTYPE GetObjectClassName(CLRDATA_ADDRESS obj, unsigned int count, __out_z __inout_ecount(count) WCHAR *className, unsigned int *pNeeded);
- virtual HRESULT STDMETHODCALLTYPE GetMethodTableName(CLRDATA_ADDRESS mt, unsigned int count, __out_z __inout_ecount(count) WCHAR *mtName, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetObjectStringData(CLRDATA_ADDRESS obj, unsigned int count, _Inout_updates_z_(count) WCHAR *stringData, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetObjectClassName(CLRDATA_ADDRESS obj, unsigned int count, _Inout_updates_z_(count) WCHAR *className, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetMethodTableName(CLRDATA_ADDRESS mt, unsigned int count, _Inout_updates_z_(count) WCHAR *mtName, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetMethodTableData(CLRDATA_ADDRESS mt, struct DacpMethodTableData *data);
virtual HRESULT STDMETHODCALLTYPE GetMethodTableFieldData(CLRDATA_ADDRESS mt, struct DacpMethodTableFieldData *data);
virtual HRESULT STDMETHODCALLTYPE GetMethodTableTransparencyData(CLRDATA_ADDRESS mt, struct DacpMethodTableTransparencyData *data);
virtual HRESULT STDMETHODCALLTYPE GetMethodTableForEEClass(CLRDATA_ADDRESS eeClass, CLRDATA_ADDRESS *value);
virtual HRESULT STDMETHODCALLTYPE GetFieldDescData(CLRDATA_ADDRESS fieldDesc, struct DacpFieldDescData *data);
- virtual HRESULT STDMETHODCALLTYPE GetFrameName(CLRDATA_ADDRESS vtable, unsigned int count, __out_z __inout_ecount(count) WCHAR *frameName, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetFrameName(CLRDATA_ADDRESS vtable, unsigned int count, _Inout_updates_z_(count) WCHAR *frameName, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetModule(CLRDATA_ADDRESS addr, IXCLRDataModule **mod);
virtual HRESULT STDMETHODCALLTYPE GetModuleData(CLRDATA_ADDRESS moduleAddr, struct DacpModuleData *data);
virtual HRESULT STDMETHODCALLTYPE TraverseModuleMap(ModuleMapType mmt, CLRDATA_ADDRESS moduleAddr, MODULEMAPTRAVERSE pCallback, LPVOID token);
virtual HRESULT STDMETHODCALLTYPE GetMethodDescFromToken(CLRDATA_ADDRESS moduleAddr, mdToken token, CLRDATA_ADDRESS *methodDesc);
virtual HRESULT STDMETHODCALLTYPE GetPEFileBase(CLRDATA_ADDRESS addr, CLRDATA_ADDRESS *base);
- virtual HRESULT STDMETHODCALLTYPE GetPEFileName(CLRDATA_ADDRESS addr, unsigned int count, __out_z __inout_ecount(count) WCHAR *fileName, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetPEFileName(CLRDATA_ADDRESS addr, unsigned int count, _Inout_updates_z_(count) WCHAR *fileName, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetAssemblyModuleList(CLRDATA_ADDRESS assembly, unsigned int count, CLRDATA_ADDRESS modules[], unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetGCHeapData(struct DacpGcHeapData *data);
virtual HRESULT STDMETHODCALLTYPE GetGCHeapList(unsigned int count, CLRDATA_ADDRESS heaps[], unsigned int *pNeeded);
@@ -1127,7 +1127,7 @@ class ClrDataAccess
virtual HRESULT STDMETHODCALLTYPE TraverseEHInfo(CLRDATA_ADDRESS ip, DUMPEHINFO pCallback, LPVOID token);
virtual HRESULT STDMETHODCALLTYPE GetStressLogAddress(CLRDATA_ADDRESS *stressLog);
virtual HRESULT STDMETHODCALLTYPE GetJitManagerList(unsigned int count, struct DacpJitManagerInfo managers[], unsigned int *pNeeded);
- virtual HRESULT STDMETHODCALLTYPE GetJitHelperFunctionName(CLRDATA_ADDRESS ip, unsigned int count, __out_z __inout_ecount(count) char *name, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetJitHelperFunctionName(CLRDATA_ADDRESS ip, unsigned int count, _Inout_updates_z_(count) char *name, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetJumpThunkTarget(T_CONTEXT *ctx, CLRDATA_ADDRESS *targetIP, CLRDATA_ADDRESS *targetMD);
virtual HRESULT STDMETHODCALLTYPE TraverseLoaderHeap(CLRDATA_ADDRESS loaderHeapAddr, VISITHEAP pCallback);
virtual HRESULT STDMETHODCALLTYPE GetCodeHeapList(CLRDATA_ADDRESS jitManager, unsigned int count, struct DacpJitCodeHeapInfo codeHeaps[], unsigned int *pNeeded);
@@ -1152,17 +1152,17 @@ class ClrDataAccess
virtual HRESULT STDMETHODCALLTYPE GetDacModuleHandle(HMODULE *phModule);
virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyList(CLRDATA_ADDRESS appDomain, int count, CLRDATA_ADDRESS values[], unsigned int *pNeeded);
- virtual HRESULT STDMETHODCALLTYPE GetPrivateBinPaths(CLRDATA_ADDRESS appDomain, int count, __out_z __inout_ecount(count) WCHAR *paths, unsigned int *pNeeded);
- virtual HRESULT STDMETHODCALLTYPE GetAssemblyLocation(CLRDATA_ADDRESS assembly, int count, __out_z __inout_ecount(count) WCHAR *location, unsigned int *pNeeded);
- virtual HRESULT STDMETHODCALLTYPE GetAppDomainConfigFile(CLRDATA_ADDRESS appDomain, int count, __out_z __inout_ecount(count) WCHAR *configFile, unsigned int *pNeeded);
- virtual HRESULT STDMETHODCALLTYPE GetApplicationBase(CLRDATA_ADDRESS appDomain, int count, __out_z __inout_ecount(count) WCHAR *base, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetPrivateBinPaths(CLRDATA_ADDRESS appDomain, int count, _Inout_updates_z_(count) WCHAR *paths, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetAssemblyLocation(CLRDATA_ADDRESS assembly, int count, _Inout_updates_z_(count) WCHAR *location, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetAppDomainConfigFile(CLRDATA_ADDRESS appDomain, int count, _Inout_updates_z_(count) WCHAR *configFile, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetApplicationBase(CLRDATA_ADDRESS appDomain, int count, _Inout_updates_z_(count) WCHAR *base, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyData(CLRDATA_ADDRESS assembly, unsigned int *pContext, HRESULT *pResult);
- virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyLocation(CLRDATA_ADDRESS assembly, unsigned int count, __out_z __inout_ecount(count) WCHAR *location, unsigned int *pNeeded);
- virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyDisplayName(CLRDATA_ADDRESS assembly, unsigned int count, __out_z __inout_ecount(count) WCHAR *name, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyLocation(CLRDATA_ADDRESS assembly, unsigned int count, _Inout_updates_z_(count) WCHAR *location, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyDisplayName(CLRDATA_ADDRESS assembly, unsigned int count, _Inout_updates_z_(count) WCHAR *name, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetStackReferences(DWORD osThreadID, ISOSStackRefEnum **ppEnum);
- virtual HRESULT STDMETHODCALLTYPE GetRegisterName(int regNum, unsigned int count, __out_z __inout_ecount(count) WCHAR *buffer, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetRegisterName(int regNum, unsigned int count, _Inout_updates_z_(count) WCHAR *buffer, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetHandleEnum(ISOSHandleEnum **ppHandleEnum);
virtual HRESULT STDMETHODCALLTYPE GetHandleEnumForTypes(unsigned int types[], unsigned int count, ISOSHandleEnum **ppHandleEnum);
@@ -1244,12 +1244,12 @@ class ClrDataAccess
HRESULT GetFullMethodName(IN MethodDesc* methodDesc,
IN ULONG32 symbolChars,
IN ULONG32* symbolLen,
- __out_ecount_part_opt(symbolChars, *symbolLen) LPWSTR symbol);
+ _Out_writes_to_opt_(symbolChars, *symbolLen) LPWSTR symbol);
HRESULT RawGetMethodName(/* [in] */ CLRDATA_ADDRESS address,
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_opt(bufLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_bytes_opt_(bufLen) WCHAR nameBuf[ ],
/* [out] */ CLRDATA_ADDRESS* displacement);
HRESULT FollowStubStep(
@@ -1512,17 +1512,17 @@ class ClrDataAccess
DWORD &dwDataSize,
DWORD &dwRvaHint,
bool &isNGEN,
- __out_ecount(cchFilePath) LPWSTR wszFilePath,
+ _Out_writes_(cchFilePath) LPWSTR wszFilePath,
DWORD cchFilePath);
static bool GetILImageInfoFromNgenPEFile(PEAssembly *pPEAssembly,
DWORD &dwTimeStamp,
DWORD &dwSize,
- __out_ecount(cchPath) LPWSTR wszPath,
+ _Out_writes_(cchPath) LPWSTR wszPath,
const DWORD cchPath);
#if defined(FEATURE_CORESYSTEM)
static bool GetILImageNameFromNgenImage(LPCWSTR ilExtension,
- __out_ecount(cchFilePath) LPWSTR wszFilePath,
+ _Out_writes_(cchFilePath) LPWSTR wszFilePath,
const DWORD cchFilePath);
#endif // FEATURE_CORESYSTEM
};
@@ -2348,7 +2348,7 @@ class ClrDataAppDomain : public IXCLRDataAppDomain
virtual HRESULT STDMETHODCALLTYPE GetName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetUniqueID(
/* [out] */ ULONG64 *id);
@@ -2429,17 +2429,17 @@ class ClrDataAssembly : public IXCLRDataAssembly
virtual HRESULT STDMETHODCALLTYPE GetName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetFileName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetDisplayName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetFlags(
/* [out] */ ULONG32 *flags);
@@ -2601,12 +2601,12 @@ class ClrDataModule : public IXCLRDataModule, IXCLRDataModule2
virtual HRESULT STDMETHODCALLTYPE GetName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetFileName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetVersionId(
/* [out] */ GUID* vid);
@@ -2747,7 +2747,7 @@ class ClrDataTypeDefinition : public IXCLRDataTypeDefinition
/* [out][in] */ CLRDATA_ENUM *handle,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataTypeDefinition **type,
/* [out] */ ULONG32 *flags,
/* [out] */ mdFieldDef *token);
@@ -2756,7 +2756,7 @@ class ClrDataTypeDefinition : public IXCLRDataTypeDefinition
/* [out][in] */ CLRDATA_ENUM *handle,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataTypeDefinition **type,
/* [out] */ ULONG32 *flags,
/* [out] */ IXCLRDataModule** tokenScope,
@@ -2791,7 +2791,7 @@ class ClrDataTypeDefinition : public IXCLRDataTypeDefinition
/* [in] */ mdFieldDef token,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataTypeDefinition **type,
/* [out] */ ULONG32* flags);
@@ -2800,7 +2800,7 @@ class ClrDataTypeDefinition : public IXCLRDataTypeDefinition
/* [in] */ mdFieldDef token,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataTypeDefinition **type,
/* [out] */ ULONG32* flags);
@@ -2808,7 +2808,7 @@ class ClrDataTypeDefinition : public IXCLRDataTypeDefinition
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ]);
virtual HRESULT STDMETHODCALLTYPE GetTokenAndScope(
/* [out] */ mdTypeDef *token,
@@ -2918,7 +2918,7 @@ class ClrDataTypeInstance : public IXCLRDataTypeInstance
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ mdFieldDef *token);
virtual HRESULT STDMETHODCALLTYPE StartEnumStaticFieldsByName(
@@ -2952,7 +2952,7 @@ class ClrDataTypeInstance : public IXCLRDataTypeInstance
/* [out] */ IXCLRDataValue **value,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataModule** tokenScope,
/* [out] */ mdFieldDef *token);
@@ -2985,7 +2985,7 @@ class ClrDataTypeInstance : public IXCLRDataTypeInstance
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ]);
virtual HRESULT STDMETHODCALLTYPE GetStaticFieldByToken2(
/* [in] */ IXCLRDataModule* tokenScope,
@@ -2994,13 +2994,13 @@ class ClrDataTypeInstance : public IXCLRDataTypeInstance
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ]);
virtual HRESULT STDMETHODCALLTYPE GetName(
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ]);
virtual HRESULT STDMETHODCALLTYPE GetModule(
/* [out] */ IXCLRDataModule **mod);
@@ -3095,7 +3095,7 @@ class ClrDataMethodDefinition : public IXCLRDataMethodDefinition
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetTokenAndScope(
/* [out] */ mdMethodDef *token,
@@ -3200,7 +3200,7 @@ class ClrDataMethodInstance : public IXCLRDataMethodInstance
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetFlags(
/* [out] */ ULONG32 *flags);
@@ -3304,7 +3304,7 @@ class ClrDataTask : public IXCLRDataTask
virtual HRESULT STDMETHODCALLTYPE GetName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetUniqueID(
/* [out] */ ULONG64 *id);
@@ -3500,7 +3500,7 @@ class ClrDataFrame : public IXCLRDataFrame,
/* [out] */ IXCLRDataValue **arg,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetNumLocalVariables(
/* [out] */ ULONG32 *numLocals);
@@ -3510,7 +3510,7 @@ class ClrDataFrame : public IXCLRDataFrame,
/* [out] */ IXCLRDataValue **localVariable,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetNumTypeArguments(
/* [out] */ ULONG32 *numTypeArgs);
@@ -3523,7 +3523,7 @@ class ClrDataFrame : public IXCLRDataFrame,
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_opt(bufLen) WCHAR nameBuf[ ]);
+ /* [size_is][out] */ _Out_writes_bytes_opt_(bufLen) WCHAR nameBuf[ ]);
virtual HRESULT STDMETHODCALLTYPE GetMethodInstance(
/* [out] */ IXCLRDataMethodInstance **method);
@@ -3620,7 +3620,7 @@ class ClrDataExceptionState : public IXCLRDataExceptionState
virtual HRESULT STDMETHODCALLTYPE GetString(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *strLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *strLen) WCHAR str[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *strLen) WCHAR str[ ]);
virtual HRESULT STDMETHODCALLTYPE IsSameState(
/* [in] */ EXCEPTION_RECORD64 *exRecord,
@@ -3724,7 +3724,7 @@ class ClrDataValue : public IXCLRDataValue
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ mdFieldDef *token);
virtual HRESULT STDMETHODCALLTYPE GetNumFields2(
@@ -3742,7 +3742,7 @@ class ClrDataValue : public IXCLRDataValue
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ mdFieldDef *token);
virtual HRESULT STDMETHODCALLTYPE EnumField2(
@@ -3750,7 +3750,7 @@ class ClrDataValue : public IXCLRDataValue
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataModule** tokenScope,
/* [out] */ mdFieldDef *token);
@@ -3783,7 +3783,7 @@ class ClrDataValue : public IXCLRDataValue
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ]);
virtual HRESULT STDMETHODCALLTYPE GetFieldByToken2(
/* [in] */ IXCLRDataModule* tokenScope,
@@ -3791,7 +3791,7 @@ class ClrDataValue : public IXCLRDataValue
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ]);
virtual HRESULT STDMETHODCALLTYPE GetAssociatedValue(
/* [out] */ IXCLRDataValue **assocValue);
@@ -3802,7 +3802,7 @@ class ClrDataValue : public IXCLRDataValue
virtual HRESULT STDMETHODCALLTYPE GetString(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *strLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *strLen) WCHAR str[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *strLen) WCHAR str[ ]);
virtual HRESULT STDMETHODCALLTYPE GetArrayProperties(
/* [out] */ ULONG32 *rank,
@@ -3844,7 +3844,7 @@ class ClrDataValue : public IXCLRDataValue
IXCLRDataValue** pubValue,
ULONG32 nameBufRetLen,
ULONG32* nameLenRet,
- __out_ecount_part_opt(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
+ _Out_writes_to_opt_(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
IXCLRDataModule** tokenScopeRet,
mdFieldDef* tokenRet);
@@ -3854,7 +3854,7 @@ class ClrDataValue : public IXCLRDataValue
IXCLRDataValue** pubValue,
ULONG32 nameBufRetLen,
ULONG32* nameLenRet,
- __out_ecount_part_opt(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
+ _Out_writes_to_opt_(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
IXCLRDataModule** tokenScopeRet,
mdFieldDef* tokenRet)
{
diff --git a/src/coreclr/debug/daccess/inspect.cpp b/src/coreclr/debug/daccess/inspect.cpp
index 21afb220103cb6..0a3138c5b77dbd 100644
--- a/src/coreclr/debug/daccess/inspect.cpp
+++ b/src/coreclr/debug/daccess/inspect.cpp
@@ -574,7 +574,7 @@ ClrDataValue::GetFieldByIndex(
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ mdFieldDef *token)
{
// XXX Microsoft - Obsolete method, never implemented.
@@ -661,7 +661,7 @@ ClrDataValue::EnumField(
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ mdFieldDef *token)
{
return EnumField2(handle, field, nameBufLen, nameLen, nameBuf,
@@ -674,7 +674,7 @@ ClrDataValue::EnumField2(
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataModule** tokenScope,
/* [out] */ mdFieldDef *token)
{
@@ -839,7 +839,7 @@ ClrDataValue::GetFieldByToken(
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ])
{
return GetFieldByToken2(NULL, token, field, bufLen, nameLen, nameBuf);
}
@@ -851,7 +851,7 @@ ClrDataValue::GetFieldByToken2(
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ])
{
HRESULT status;
@@ -1029,7 +1029,7 @@ HRESULT STDMETHODCALLTYPE
ClrDataValue::GetString(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *strLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *strLen) WCHAR str[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *strLen) WCHAR str[ ])
{
HRESULT status;
@@ -1381,7 +1381,7 @@ ClrDataValue::NewFromFieldDesc(ClrDataAccess* dac,
IXCLRDataValue** pubValue,
ULONG32 nameBufRetLen,
ULONG32 *nameLenRet,
- __out_ecount_part_opt(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
+ _Out_writes_to_opt_(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
IXCLRDataModule** tokenScopeRet,
mdFieldDef *tokenRet)
{
@@ -1991,7 +1991,7 @@ ClrDataTypeDefinition::EnumField(
/* [out][in] */ CLRDATA_ENUM *handle,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataTypeDefinition **type,
/* [out] */ ULONG32 *flags,
/* [out] */ mdFieldDef *token)
@@ -2005,7 +2005,7 @@ ClrDataTypeDefinition::EnumField2(
/* [out][in] */ CLRDATA_ENUM *handle,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataTypeDefinition **type,
/* [out] */ ULONG32 *flags,
/* [out] */ IXCLRDataModule** tokenScope,
@@ -2180,7 +2180,7 @@ ClrDataTypeDefinition::GetFieldByToken(
/* [in] */ mdFieldDef token,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataTypeDefinition **type,
/* [out] */ ULONG32 *flags)
{
@@ -2194,7 +2194,7 @@ ClrDataTypeDefinition::GetFieldByToken2(
/* [in] */ mdFieldDef token,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataTypeDefinition **type,
/* [out] */ ULONG32 *flags)
{
@@ -2276,7 +2276,7 @@ ClrDataTypeDefinition::GetName(
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ])
{
HRESULT status = S_OK;
@@ -3014,7 +3014,7 @@ ClrDataTypeInstance::GetStaticFieldByIndex(
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ mdFieldDef *token)
{
HRESULT status;
@@ -3186,7 +3186,7 @@ ClrDataTypeInstance::EnumStaticField2(
/* [out] */ IXCLRDataValue **value,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataModule** tokenScope,
/* [out] */ mdFieldDef *token)
{
@@ -3351,7 +3351,7 @@ ClrDataTypeInstance::GetStaticFieldByToken(
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ])
{
return GetStaticFieldByToken2(NULL, token, tlsTask, field,
bufLen, nameLen, nameBuf);
@@ -3365,7 +3365,7 @@ ClrDataTypeInstance::GetStaticFieldByToken2(
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ])
{
HRESULT status;
@@ -3430,7 +3430,7 @@ ClrDataTypeInstance::GetName(
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ])
{
HRESULT status = S_OK;
diff --git a/src/coreclr/debug/daccess/request.cpp b/src/coreclr/debug/daccess/request.cpp
index fe66a8b30b4212..1e327721f4a92d 100644
--- a/src/coreclr/debug/daccess/request.cpp
+++ b/src/coreclr/debug/daccess/request.cpp
@@ -580,7 +580,7 @@ ClrDataAccess::GetStackLimits(CLRDATA_ADDRESS threadPtr, CLRDATA_ADDRESS *lower,
}
HRESULT
-ClrDataAccess::GetRegisterName(int regNum, unsigned int count, __out_z __inout_ecount(count) WCHAR *buffer, unsigned int *pNeeded)
+ClrDataAccess::GetRegisterName(int regNum, unsigned int count, _Inout_updates_z_(count) WCHAR *buffer, unsigned int *pNeeded)
{
if (!buffer && !pNeeded)
return E_POINTER;
@@ -1322,7 +1322,7 @@ ClrDataAccess::GetMethodDescPtrFromIP(CLRDATA_ADDRESS ip, CLRDATA_ADDRESS * ppMD
}
HRESULT
-ClrDataAccess::GetMethodDescName(CLRDATA_ADDRESS methodDesc, unsigned int count, __out_z __inout_ecount(count) WCHAR *name, unsigned int *pNeeded)
+ClrDataAccess::GetMethodDescName(CLRDATA_ADDRESS methodDesc, unsigned int count, _Inout_updates_z_(count) WCHAR *name, unsigned int *pNeeded)
{
if (methodDesc == 0)
return E_INVALIDARG;
@@ -1426,7 +1426,7 @@ ClrDataAccess::GetDomainFromContext(CLRDATA_ADDRESS contextAddr, CLRDATA_ADDRESS
HRESULT
-ClrDataAccess::GetObjectStringData(CLRDATA_ADDRESS obj, unsigned int count, __out_z __inout_ecount(count) WCHAR *stringData, unsigned int *pNeeded)
+ClrDataAccess::GetObjectStringData(CLRDATA_ADDRESS obj, unsigned int count, _Inout_updates_z_(count) WCHAR *stringData, unsigned int *pNeeded)
{
if (obj == 0)
return E_INVALIDARG;
@@ -1478,7 +1478,7 @@ ClrDataAccess::GetObjectStringData(CLRDATA_ADDRESS obj, unsigned int count, __ou
}
HRESULT
-ClrDataAccess::GetObjectClassName(CLRDATA_ADDRESS obj, unsigned int count, __out_z __inout_ecount(count) WCHAR *className, unsigned int *pNeeded)
+ClrDataAccess::GetObjectClassName(CLRDATA_ADDRESS obj, unsigned int count, _Inout_updates_z_(count) WCHAR *className, unsigned int *pNeeded)
{
if (obj == 0)
return E_INVALIDARG;
@@ -1740,7 +1740,7 @@ ClrDataAccess::GetMethodTableData(CLRDATA_ADDRESS mt, struct DacpMethodTableData
}
HRESULT
-ClrDataAccess::GetMethodTableName(CLRDATA_ADDRESS mt, unsigned int count, __out_z __inout_ecount(count) WCHAR *mtName, unsigned int *pNeeded)
+ClrDataAccess::GetMethodTableName(CLRDATA_ADDRESS mt, unsigned int count, _Inout_updates_z_(count) WCHAR *mtName, unsigned int *pNeeded)
{
if (mt == 0)
return E_INVALIDARG;
@@ -2003,7 +2003,7 @@ ClrDataAccess::GetMethodTableForEEClass(CLRDATA_ADDRESS eeClass, CLRDATA_ADDRESS
}
HRESULT
-ClrDataAccess::GetFrameName(CLRDATA_ADDRESS vtable, unsigned int count, __out_z __inout_ecount(count) WCHAR *frameName, unsigned int *pNeeded)
+ClrDataAccess::GetFrameName(CLRDATA_ADDRESS vtable, unsigned int count, _Inout_updates_z_(count) WCHAR *frameName, unsigned int *pNeeded)
{
if (vtable == 0)
return E_INVALIDARG;
@@ -2043,7 +2043,7 @@ ClrDataAccess::GetFrameName(CLRDATA_ADDRESS vtable, unsigned int count, __out_z
}
HRESULT
-ClrDataAccess::GetPEFileName(CLRDATA_ADDRESS addr, unsigned int count, __out_z __inout_ecount(count) WCHAR *fileName, unsigned int *pNeeded)
+ClrDataAccess::GetPEFileName(CLRDATA_ADDRESS addr, unsigned int count, _Inout_updates_z_(count) WCHAR *fileName, unsigned int *pNeeded)
{
if (addr == 0 || (fileName == NULL && pNeeded == NULL) || (fileName != NULL && count == 0))
return E_INVALIDARG;
@@ -2369,7 +2369,7 @@ ClrDataAccess::GetFailedAssemblyData(CLRDATA_ADDRESS assembly, unsigned int *pCo
HRESULT
ClrDataAccess::GetFailedAssemblyLocation(CLRDATA_ADDRESS assembly, unsigned int count,
- __out_z __inout_ecount(count) WCHAR *location, unsigned int *pNeeded)
+ _Inout_updates_z_(count) WCHAR *location, unsigned int *pNeeded)
{
if (assembly == NULL || (location == NULL && pNeeded == NULL) || (location != NULL && count == 0))
return E_INVALIDARG;
@@ -2399,7 +2399,7 @@ ClrDataAccess::GetFailedAssemblyLocation(CLRDATA_ADDRESS assembly, unsigned int
}
HRESULT
-ClrDataAccess::GetFailedAssemblyDisplayName(CLRDATA_ADDRESS assembly, unsigned int count, __out_z __inout_ecount(count) WCHAR *name, unsigned int *pNeeded)
+ClrDataAccess::GetFailedAssemblyDisplayName(CLRDATA_ADDRESS assembly, unsigned int count, _Inout_updates_z_(count) WCHAR *name, unsigned int *pNeeded)
{
if (assembly == NULL || (name == NULL && pNeeded == NULL) || (name != NULL && count == 0))
return E_INVALIDARG;
@@ -2509,7 +2509,7 @@ ClrDataAccess::GetFailedAssemblyList(CLRDATA_ADDRESS appDomain, int count,
}
HRESULT
-ClrDataAccess::GetAppDomainName(CLRDATA_ADDRESS addr, unsigned int count, __out_z __inout_ecount(count) WCHAR *name, unsigned int *pNeeded)
+ClrDataAccess::GetAppDomainName(CLRDATA_ADDRESS addr, unsigned int count, _Inout_updates_z_(count) WCHAR *name, unsigned int *pNeeded)
{
SOSDacEnter();
@@ -2550,7 +2550,7 @@ ClrDataAccess::GetAppDomainName(CLRDATA_ADDRESS addr, unsigned int count, __out_
HRESULT
ClrDataAccess::GetApplicationBase(CLRDATA_ADDRESS appDomain, int count,
- __out_z __inout_ecount(count) WCHAR *base, unsigned int *pNeeded)
+ _Inout_updates_z_(count) WCHAR *base, unsigned int *pNeeded)
{
// Method is not supported on CoreCLR
@@ -2559,7 +2559,7 @@ ClrDataAccess::GetApplicationBase(CLRDATA_ADDRESS appDomain, int count,
HRESULT
ClrDataAccess::GetPrivateBinPaths(CLRDATA_ADDRESS appDomain, int count,
- __out_z __inout_ecount(count) WCHAR *paths, unsigned int *pNeeded)
+ _Inout_updates_z_(count) WCHAR *paths, unsigned int *pNeeded)
{
// Method is not supported on CoreCLR
@@ -2568,7 +2568,7 @@ ClrDataAccess::GetPrivateBinPaths(CLRDATA_ADDRESS appDomain, int count,
HRESULT
ClrDataAccess::GetAppDomainConfigFile(CLRDATA_ADDRESS appDomain, int count,
- __out_z __inout_ecount(count) WCHAR *configFile, unsigned int *pNeeded)
+ _Inout_updates_z_(count) WCHAR *configFile, unsigned int *pNeeded)
{
// Method is not supported on CoreCLR
@@ -2620,7 +2620,7 @@ ClrDataAccess::GetAssemblyData(CLRDATA_ADDRESS cdBaseDomainPtr, CLRDATA_ADDRESS
}
HRESULT
-ClrDataAccess::GetAssemblyName(CLRDATA_ADDRESS assembly, unsigned int count, __out_z __inout_ecount(count) WCHAR *name, unsigned int *pNeeded)
+ClrDataAccess::GetAssemblyName(CLRDATA_ADDRESS assembly, unsigned int count, _Inout_updates_z_(count) WCHAR *name, unsigned int *pNeeded)
{
SOSDacEnter();
Assembly* pAssembly = PTR_Assembly(TO_TADDR(assembly));
@@ -2661,7 +2661,7 @@ ClrDataAccess::GetAssemblyName(CLRDATA_ADDRESS assembly, unsigned int count, __o
}
HRESULT
-ClrDataAccess::GetAssemblyLocation(CLRDATA_ADDRESS assembly, int count, __out_z __inout_ecount(count) WCHAR *location, unsigned int *pNeeded)
+ClrDataAccess::GetAssemblyLocation(CLRDATA_ADDRESS assembly, int count, _Inout_updates_z_(count) WCHAR *location, unsigned int *pNeeded)
{
if ((assembly == NULL) || (location == NULL && pNeeded == NULL) || (location != NULL && count == 0))
{
@@ -3636,7 +3636,7 @@ ClrDataAccess::GetSyncBlockCleanupData(CLRDATA_ADDRESS syncBlock, struct DacpSyn
}
HRESULT
-ClrDataAccess::GetJitHelperFunctionName(CLRDATA_ADDRESS ip, unsigned int count, __out_z __inout_ecount(count) char *name, unsigned int *pNeeded)
+ClrDataAccess::GetJitHelperFunctionName(CLRDATA_ADDRESS ip, unsigned int count, _Inout_updates_z_(count) char *name, unsigned int *pNeeded)
{
SOSDacEnter();
diff --git a/src/coreclr/debug/daccess/stack.cpp b/src/coreclr/debug/daccess/stack.cpp
index 6ced6d60b35391..dfcb16c31523f3 100644
--- a/src/coreclr/debug/daccess/stack.cpp
+++ b/src/coreclr/debug/daccess/stack.cpp
@@ -787,7 +787,7 @@ ClrDataFrame::GetArgumentByIndex(
/* [out] */ IXCLRDataValue **arg,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -942,7 +942,7 @@ ClrDataFrame::GetLocalVariableByIndex(
/* [out] */ IXCLRDataValue **localVariable,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -1111,7 +1111,7 @@ ClrDataFrame::GetCodeName(
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *symbolLen,
- /* [size_is][out] */ __out_ecount_opt(bufLen) WCHAR symbolBuf[ ])
+ /* [size_is][out] */ _Out_writes_bytes_opt_(bufLen) WCHAR symbolBuf[ ])
{
HRESULT status = E_FAIL;
diff --git a/src/coreclr/debug/daccess/task.cpp b/src/coreclr/debug/daccess/task.cpp
index 42c4e0becce1c1..30abc5e090cc9e 100644
--- a/src/coreclr/debug/daccess/task.cpp
+++ b/src/coreclr/debug/daccess/task.cpp
@@ -149,7 +149,7 @@ HRESULT STDMETHODCALLTYPE
ClrDataTask::GetName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -713,7 +713,7 @@ HRESULT STDMETHODCALLTYPE
ClrDataAppDomain::GetName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status = S_OK;
@@ -1132,7 +1132,7 @@ HRESULT STDMETHODCALLTYPE
ClrDataAssembly::GetName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -1160,7 +1160,7 @@ HRESULT STDMETHODCALLTYPE
ClrDataAssembly::GetFileName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -1201,7 +1201,7 @@ HRESULT STDMETHODCALLTYPE
ClrDataAssembly::GetDisplayName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -2376,7 +2376,7 @@ HRESULT STDMETHODCALLTYPE
ClrDataModule::GetName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -2404,7 +2404,7 @@ HRESULT STDMETHODCALLTYPE
ClrDataModule::GetFileName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -3115,7 +3115,7 @@ ClrDataMethodDefinition::GetName(
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -3858,7 +3858,7 @@ ClrDataMethodInstance::GetName(
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -4735,7 +4735,7 @@ HRESULT STDMETHODCALLTYPE
ClrDataExceptionState::GetString(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *strLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *strLen) WCHAR str[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *strLen) WCHAR str[ ])
{
HRESULT status = E_FAIL;
diff --git a/src/coreclr/debug/dbgutil/machoreader.cpp b/src/coreclr/debug/dbgutil/machoreader.cpp
index d2801547cb9ba9..7fef34e1afb16d 100644
--- a/src/coreclr/debug/dbgutil/machoreader.cpp
+++ b/src/coreclr/debug/dbgutil/machoreader.cpp
@@ -229,9 +229,8 @@ MachOModule::ReadLoadCommands()
m_segments.push_back(segment);
// Calculate the load bias for the module. This is the value to add to the vmaddr of a
- // segment to get the actual address. For shared modules, this is 0 since those segments
- // are absolute address.
- if (segment->fileoff == 0 && segment->filesize > 0)
+ // segment to get the actual address.
+ if (strcmp(segment->segname, SEG_TEXT) == 0)
{
m_loadBias = m_baseAddress - segment->vmaddr;
}
diff --git a/src/coreclr/debug/di/cordb.cpp b/src/coreclr/debug/di/cordb.cpp
index 2c11397fcd3bc7..e195f3731a9e6f 100644
--- a/src/coreclr/debug/di/cordb.cpp
+++ b/src/coreclr/debug/di/cordb.cpp
@@ -443,10 +443,10 @@ STDAPI GetRequestedRuntimeInfo(LPCWSTR pExe,
LPCWSTR pConfigurationFile,
DWORD startupFlags,
DWORD runtimeInfoFlags,
- __out_ecount_opt(dwDirectory) LPWSTR pDirectory,
+ _Out_writes_bytes_opt_(dwDirectory) LPWSTR pDirectory,
DWORD dwDirectory,
DWORD *dwDirectoryLength,
- __out_ecount_opt(cchBuffer) LPWSTR pVersion,
+ _Out_writes_bytes_opt_(cchBuffer) LPWSTR pVersion,
DWORD cchBuffer,
DWORD* dwlength)
{
diff --git a/src/coreclr/debug/di/divalue.cpp b/src/coreclr/debug/di/divalue.cpp
index 2e70a306180c59..b8c9e745260db2 100644
--- a/src/coreclr/debug/di/divalue.cpp
+++ b/src/coreclr/debug/di/divalue.cpp
@@ -2320,7 +2320,7 @@ HRESULT CordbObjectValue::GetLength(ULONG32 *pcchString)
// Return Value: S_OK or CORDBG_E_INVALID_OBJECT, CORDBG_E_OBJECT_NEUTERED, or E_INVALIDARG on failure
HRESULT CordbObjectValue::GetString(ULONG32 cchString,
ULONG32 *pcchString,
- __out_ecount_opt(cchString) WCHAR szString[])
+ _Out_writes_bytes_opt_(cchString) WCHAR szString[])
{
PUBLIC_REENTRANT_API_ENTRY(this);
FAIL_IF_NEUTERED(this);
diff --git a/src/coreclr/debug/di/module.cpp b/src/coreclr/debug/di/module.cpp
index 9951d4a6af305f..6d6a7a55befa2e 100644
--- a/src/coreclr/debug/di/module.cpp
+++ b/src/coreclr/debug/di/module.cpp
@@ -1256,7 +1256,7 @@ HRESULT CordbModule::GetAssembly(ICorDebugAssembly **ppAssembly)
// Public implementation of ICorDebugModule::GetName,
// wrapper around code:GetNameWorker (which throws).
-HRESULT CordbModule::GetName(ULONG32 cchName, ULONG32 *pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+HRESULT CordbModule::GetName(ULONG32 cchName, ULONG32 *pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
HRESULT hr = S_OK;
PUBLIC_API_BEGIN(this)
@@ -1324,7 +1324,7 @@ HRESULT CordbModule::GetName(ULONG32 cchName, ULONG32 *pcchName, __out_ecount_pa
// Note:
// Filename isn't necessarily the same as the module name in the metadata.
//
-HRESULT CordbModule::GetNameWorker(ULONG32 cchName, ULONG32 *pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+HRESULT CordbModule::GetNameWorker(ULONG32 cchName, ULONG32 *pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
CONTRACTL
{
diff --git a/src/coreclr/debug/di/process.cpp b/src/coreclr/debug/di/process.cpp
index 9b21fa47e67285..59af4cc8d9c649 100644
--- a/src/coreclr/debug/di/process.cpp
+++ b/src/coreclr/debug/di/process.cpp
@@ -1111,7 +1111,7 @@ HRESULT ShimProcess::CreateProcess(
Cordb * pCordb,
ICorDebugRemoteTarget * pRemoteTarget,
LPCWSTR szProgramName,
- __in_z LPWSTR szProgramArgs,
+ _In_z_ LPWSTR szProgramArgs,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL fInheritHandles,
@@ -8624,7 +8624,7 @@ HRESULT CordbProcess::EnableLogMessages(BOOL fOnOff)
/*
* ModifyLogSwitch modifies the specified switch's severity level.
*/
-COM_METHOD CordbProcess::ModifyLogSwitch(__in_z WCHAR *pLogSwitchName, LONG lLevel)
+COM_METHOD CordbProcess::ModifyLogSwitch(_In_z_ WCHAR *pLogSwitchName, LONG lLevel)
{
PUBLIC_API_ENTRY(this);
FAIL_IF_NEUTERED(this);
@@ -13674,7 +13674,7 @@ void CordbWin32EventThread::ForceDbgContinue(CordbProcess *pProcess, CordbUnmana
HRESULT CordbWin32EventThread::SendCreateProcessEvent(
MachineInfo machineInfo,
LPCWSTR programName,
- __in_z LPWSTR programArgs,
+ _In_z_ LPWSTR programArgs,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
diff --git a/src/coreclr/debug/di/publish.cpp b/src/coreclr/debug/di/publish.cpp
index 23003b980ad9f1..1d7741fb9ea75b 100644
--- a/src/coreclr/debug/di/publish.cpp
+++ b/src/coreclr/debug/di/publish.cpp
@@ -658,7 +658,7 @@ HRESULT AllocateAndReadRemoteString(
HANDLE hProcess,
void * pRemotePtr,
SIZE_T cbSize, // size of buffer to allocate + copy.
- __deref_out_bcount(cbSize) WCHAR * * ppNewLocalBuffer
+ _Outptr_result_bytebuffer_(cbSize) WCHAR * * ppNewLocalBuffer
)
{
// Make sure buffer has right geometry.
@@ -902,7 +902,7 @@ HRESULT CorpubProcess::GetProcessID(unsigned *pid)
*/
HRESULT CorpubProcess::GetDisplayName(ULONG32 cchName,
ULONG32 *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
VALIDATE_POINTER_TO_OBJECT_ARRAY_OR_NULL(szName, WCHAR, cchName, true, true);
VALIDATE_POINTER_TO_OBJECT_OR_NULL(pcchName, ULONG32 *);
@@ -928,7 +928,7 @@ HRESULT CorpubProcess::GetDisplayName(ULONG32 cchName,
// CorpubAppDomain
// ******************************************
-CorpubAppDomain::CorpubAppDomain (__in LPWSTR szAppDomainName, ULONG Id)
+CorpubAppDomain::CorpubAppDomain (_In_ LPWSTR szAppDomainName, ULONG Id)
: CordbCommonBase (0, enumCorpubAppDomain),
m_pNext (NULL),
m_szAppDomainName (szAppDomainName),
@@ -976,7 +976,7 @@ HRESULT CorpubAppDomain::GetID (ULONG32 *pId)
*/
HRESULT CorpubAppDomain::GetName(ULONG32 cchName,
ULONG32 *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
VALIDATE_POINTER_TO_OBJECT_ARRAY_OR_NULL(szName, WCHAR, cchName, true, true);
VALIDATE_POINTER_TO_OBJECT_OR_NULL(pcchName, ULONG32 *);
diff --git a/src/coreclr/debug/di/rsappdomain.cpp b/src/coreclr/debug/di/rsappdomain.cpp
index 6b4da4ee206027..081baa95216d5b 100644
--- a/src/coreclr/debug/di/rsappdomain.cpp
+++ b/src/coreclr/debug/di/rsappdomain.cpp
@@ -700,7 +700,7 @@ HRESULT CordbAppDomain::Attach()
*/
HRESULT CordbAppDomain::GetName(ULONG32 cchName,
ULONG32 *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
HRESULT hr = S_OK;
PUBLIC_API_BEGIN(this)
diff --git a/src/coreclr/debug/di/rsassembly.cpp b/src/coreclr/debug/di/rsassembly.cpp
index b7b7d6756391d7..73c864f6e2159a 100644
--- a/src/coreclr/debug/di/rsassembly.cpp
+++ b/src/coreclr/debug/di/rsassembly.cpp
@@ -202,7 +202,7 @@ HRESULT CordbAssembly::EnumerateModules(ICorDebugModuleEnum **ppModules)
*/
HRESULT CordbAssembly::GetCodeBase(ULONG32 cchName,
ULONG32 *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
PUBLIC_API_ENTRY(this);
FAIL_IF_NEUTERED(this);
@@ -232,7 +232,7 @@ HRESULT CordbAssembly::GetCodeBase(ULONG32 cchName,
//
HRESULT CordbAssembly::GetName(ULONG32 cchName,
ULONG32 *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
PUBLIC_API_ENTRY(this);
FAIL_IF_NEUTERED(this);
diff --git a/src/coreclr/debug/di/rsmain.cpp b/src/coreclr/debug/di/rsmain.cpp
index ff49f2186a40ca..5594b299e2d125 100644
--- a/src/coreclr/debug/di/rsmain.cpp
+++ b/src/coreclr/debug/di/rsmain.cpp
@@ -595,7 +595,7 @@ namespace
COM_METHOD CreateConnection(ICorDebugProcess *pProcess,
CONNID dwConnectionId,
- __in_z WCHAR* pConnectionName);
+ _In_z_ WCHAR* pConnectionName);
COM_METHOD ChangeConnection(ICorDebugProcess *pProcess, CONNID dwConnectionId);
COM_METHOD DestroyConnection(ICorDebugProcess *pProcess, CONNID dwConnectionId);
@@ -725,7 +725,7 @@ namespace
HRESULT
DefaultManagedCallback2::CreateConnection(ICorDebugProcess *pProcess,
CONNID dwConnectionId,
- __in_z WCHAR* pConnectionName)
+ _In_z_ WCHAR* pConnectionName)
{
_ASSERTE(!"DefaultManagedCallback2::CreateConnection not implemented");
return E_NOTIMPL;
@@ -1572,7 +1572,7 @@ bool Cordb::IsInteropDebuggingSupported()
//
//---------------------------------------------------------------------------------------
HRESULT Cordb::CreateProcess(LPCWSTR lpApplicationName,
- __in_z LPWSTR lpCommandLine,
+ _In_z_ LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
@@ -1601,7 +1601,7 @@ HRESULT Cordb::CreateProcess(LPCWSTR lpApplicationName,
HRESULT Cordb::CreateProcessCommon(ICorDebugRemoteTarget * pRemoteTarget,
LPCWSTR lpApplicationName,
- __in_z LPWSTR lpCommandLine,
+ _In_z_ LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
@@ -1735,7 +1735,7 @@ HRESULT Cordb::CreateProcessCommon(ICorDebugRemoteTarget * pRemoteTarget,
HRESULT Cordb::CreateProcessEx(ICorDebugRemoteTarget * pRemoteTarget,
LPCWSTR lpApplicationName,
- __in_z LPWSTR lpCommandLine,
+ _In_z_ LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
diff --git a/src/coreclr/debug/di/rsmda.cpp b/src/coreclr/debug/di/rsmda.cpp
index 517e6dcfdeb015..822e9824a1d417 100644
--- a/src/coreclr/debug/di/rsmda.cpp
+++ b/src/coreclr/debug/di/rsmda.cpp
@@ -102,7 +102,7 @@ HRESULT CordbMDA::QueryInterface(REFIID riid, void **ppInterface)
//
// Returns: S_OK on success.
//-----------------------------------------------------------------------------
-HRESULT CopyOutString(LPCWSTR pInputString, ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+HRESULT CopyOutString(LPCWSTR pInputString, ULONG32 cchName, ULONG32 * pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
_ASSERTE(pInputString != NULL);
ULONG32 len = (ULONG32) wcslen(pInputString) + 1;
@@ -144,7 +144,7 @@ HRESULT CopyOutString(LPCWSTR pInputString, ULONG32 cchName, ULONG32 * pcchName,
// the type from that based off the schema.
// See CopyOutString for parameter details.
//-----------------------------------------------------------------------------
-HRESULT CordbMDA::GetName(ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+HRESULT CordbMDA::GetName(ULONG32 cchName, ULONG32 * pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
HRESULT hr = S_OK;
PUBLIC_API_BEGIN(this)
@@ -159,7 +159,7 @@ HRESULT CordbMDA::GetName(ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part
// Get a string description of the MDA. This may be empty (0-length).
// See CopyOutString for parameter details.
//-----------------------------------------------------------------------------
-HRESULT CordbMDA::GetDescription(ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+HRESULT CordbMDA::GetDescription(ULONG32 cchName, ULONG32 * pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
HRESULT hr = S_OK;
PUBLIC_API_BEGIN(this)
@@ -176,7 +176,7 @@ HRESULT CordbMDA::GetDescription(ULONG32 cchName, ULONG32 * pcchName, __out_ecou
// See the MDA documentation for the schema for this XML stream.
// See CopyOutString for parameter details.
//-----------------------------------------------------------------------------
-HRESULT CordbMDA::GetXML(ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+HRESULT CordbMDA::GetXML(ULONG32 cchName, ULONG32 * pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
HRESULT hr = S_OK;
PUBLIC_API_BEGIN(this)
diff --git a/src/coreclr/debug/di/rspriv.h b/src/coreclr/debug/di/rspriv.h
index a34dd0e6a07288..690917c2795a91 100644
--- a/src/coreclr/debug/di/rspriv.h
+++ b/src/coreclr/debug/di/rspriv.h
@@ -2211,7 +2211,7 @@ class Cordb : public CordbBase, public ICorDebug, public ICorDebugRemote
COM_METHOD SetManagedHandler(ICorDebugManagedCallback *pCallback);
COM_METHOD SetUnmanagedHandler(ICorDebugUnmanagedCallback *pCallback);
COM_METHOD CreateProcess(LPCWSTR lpApplicationName,
- __in_z LPWSTR lpCommandLine,
+ _In_z_ LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
@@ -2243,7 +2243,7 @@ class Cordb : public CordbBase, public ICorDebug, public ICorDebugRemote
COM_METHOD CreateProcessEx(ICorDebugRemoteTarget * pRemoteTarget,
LPCWSTR lpApplicationName,
- __in_z LPWSTR lpCommandLine,
+ _In_z_ LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
@@ -2267,7 +2267,7 @@ class Cordb : public CordbBase, public ICorDebug, public ICorDebugRemote
HRESULT CreateProcessCommon(ICorDebugRemoteTarget * pRemoteTarget,
LPCWSTR lpApplicationName,
- __in_z LPWSTR lpCommandLine,
+ _In_z_ LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
@@ -2463,7 +2463,7 @@ class CordbAppDomain : public CordbBase,
// Returns the friendly name of the AppDomain
COM_METHOD GetName(ULONG32 cchName,
ULONG32 * pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
/*
* GetObject returns the runtime app domain object.
@@ -2646,12 +2646,12 @@ class CordbAssembly : public CordbBase, public ICorDebugAssembly, ICorDebugAssem
*/
COM_METHOD GetCodeBase(ULONG32 cchName,
ULONG32 * pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
// returns the filename of the assembly, or "" for in-memory assemblies
COM_METHOD GetName(ULONG32 cchName,
ULONG32 * pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
//-----------------------------------------------------------
@@ -3079,7 +3079,7 @@ class CordbProcess :
/*
* ModifyLogSwitch modifies the specified switch's severity level.
*/
- COM_METHOD ModifyLogSwitch(__in_z WCHAR *pLogSwitchName, LONG lLevel);
+ COM_METHOD ModifyLogSwitch(_In_z_ WCHAR *pLogSwitchName, LONG lLevel);
COM_METHOD EnumerateAppDomains(ICorDebugAppDomainEnum **ppAppDomains);
COM_METHOD GetObject(ICorDebugValue **ppObject);
@@ -4180,7 +4180,7 @@ class CordbModule : public CordbBase,
COM_METHOD GetProcess(ICorDebugProcess **ppProcess);
COM_METHOD GetBaseAddress(CORDB_ADDRESS *pAddress);
COM_METHOD GetAssembly(ICorDebugAssembly **ppAssembly);
- COM_METHOD GetName(ULONG32 cchName, ULONG32 *pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ COM_METHOD GetName(ULONG32 cchName, ULONG32 *pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
COM_METHOD EnableJITDebugging(BOOL bTrackJITInfo, BOOL bAllowJitOpts);
COM_METHOD EnableClassLoadCallbacks(BOOL bClassLoadCallbacks);
@@ -4252,7 +4252,7 @@ class CordbModule : public CordbBase,
#endif // _DEBUG
// Internal help to get the "name" (filename or pretty name) of the module.
- HRESULT GetNameWorker(ULONG32 cchName, ULONG32 *pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ HRESULT GetNameWorker(ULONG32 cchName, ULONG32 *pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
// Marks that the module's metadata has become invalid and needs to be refetched.
void RefreshMetaData();
@@ -4484,15 +4484,15 @@ class CordbMDA : public CordbBase, public ICorDebugMDA
// Get the string for the type of the MDA. Never empty.
// This is a convenient performant alternative to getting the XML stream and extracting
// the type from that based off the schema.
- COM_METHOD GetName(ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ COM_METHOD GetName(ULONG32 cchName, ULONG32 * pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
// Get a string description of the MDA. This may be empty (0-length).
- COM_METHOD GetDescription(ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ COM_METHOD GetDescription(ULONG32 cchName, ULONG32 * pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
// Get the full associated XML for the MDA. This may be empty.
// This could be a potentially expensive operation if the xml stream is large.
// See the MDA documentation for the schema for this XML stream.
- COM_METHOD GetXML(ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ COM_METHOD GetXML(ULONG32 cchName, ULONG32 * pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
COM_METHOD GetFlags(CorDebugMDAFlags * pFlags);
@@ -9292,7 +9292,7 @@ class CordbObjectValue : public CordbValue,
COM_METHOD GetLength(ULONG32 * pcchString);
COM_METHOD GetString(ULONG32 cchString,
ULONG32 * ppcchStrin,
- __out_ecount_opt(cchString) WCHAR szString[]);
+ _Out_writes_bytes_opt_(cchString) WCHAR szString[]);
//-----------------------------------------------------------
// ICorDebugExceptionObjectValue
@@ -10120,7 +10120,7 @@ class CordbWin32EventThread
HRESULT SendCreateProcessEvent(MachineInfo machineInfo,
LPCWSTR programName,
- __in_z LPWSTR programArgs,
+ _In_z_ LPWSTR programArgs,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
@@ -10811,7 +10811,7 @@ class CorpubProcess : public CordbCommonBase, public ICorPublishProcess
*/
COM_METHOD GetDisplayName(ULONG32 cchName,
ULONG32 *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
CorpubProcess *GetNextProcess () { return m_pNext;}
void SetNext (CorpubProcess *pNext) { m_pNext = pNext;}
@@ -10838,7 +10838,7 @@ class CorpubProcess : public CordbCommonBase, public ICorPublishProcess
class CorpubAppDomain : public CordbCommonBase, public ICorPublishAppDomain
{
public:
- CorpubAppDomain (__in LPWSTR szAppDomainName, ULONG Id);
+ CorpubAppDomain (_In_ LPWSTR szAppDomainName, ULONG Id);
virtual ~CorpubAppDomain();
#ifdef _DEBUG
@@ -10873,7 +10873,7 @@ class CorpubAppDomain : public CordbCommonBase, public ICorPublishAppDomain
*/
COM_METHOD GetName (ULONG32 cchName,
ULONG32 *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
CorpubAppDomain *GetNextAppDomain () { return m_pNext;}
void SetNext (CorpubAppDomain *pNext) { m_pNext = pNext;}
@@ -11142,7 +11142,7 @@ class CordbEnumFilter : public CordbBase,
void CheckAgainstDAC(CordbFunction * pFunc, void * pIP, mdMethodDef mdExpected);
#endif
-HRESULT CopyOutString(const WCHAR * pInputString, ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+HRESULT CopyOutString(const WCHAR * pInputString, ULONG32 cchName, ULONG32 * pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
diff --git a/src/coreclr/debug/di/shimcallback.cpp b/src/coreclr/debug/di/shimcallback.cpp
index ba5f0771fca49a..4e8f029209def7 100644
--- a/src/coreclr/debug/di/shimcallback.cpp
+++ b/src/coreclr/debug/di/shimcallback.cpp
@@ -659,7 +659,7 @@ HRESULT ShimProxyCallback::DebuggerError(ICorDebugProcess * pProcess, HRESULT er
// Implementation of ICorDebugManagedCallback::LogMessage
-HRESULT ShimProxyCallback::LogMessage(ICorDebugAppDomain * pAppDomain, ICorDebugThread * pThread, LONG lLevel, __in LPWSTR pLogSwitchName, __in LPWSTR pMessage)
+HRESULT ShimProxyCallback::LogMessage(ICorDebugAppDomain * pAppDomain, ICorDebugThread * pThread, LONG lLevel, _In_ LPWSTR pLogSwitchName, _In_ LPWSTR pMessage)
{
m_pShim->PreDispatchEvent();
class LogMessageEvent : public ManagedEvent
@@ -695,7 +695,7 @@ HRESULT ShimProxyCallback::LogMessage(ICorDebugAppDomain * pAppDomain, ICorDebug
// Implementation of ICorDebugManagedCallback::LogSwitch
-HRESULT ShimProxyCallback::LogSwitch(ICorDebugAppDomain * pAppDomain, ICorDebugThread * pThread, LONG lLevel, ULONG ulReason, __in LPWSTR pLogSwitchName, __in LPWSTR pParentName)
+HRESULT ShimProxyCallback::LogSwitch(ICorDebugAppDomain * pAppDomain, ICorDebugThread * pThread, LONG lLevel, ULONG ulReason, _In_ LPWSTR pLogSwitchName, _In_ LPWSTR pParentName)
{
m_pShim->PreDispatchEvent();
class LogSwitchEvent : public ManagedEvent
@@ -1060,7 +1060,7 @@ HRESULT ShimProxyCallback::FunctionRemapOpportunity(ICorDebugAppDomain * pAppDom
// Implementation of ICorDebugManagedCallback2::CreateConnection
-HRESULT ShimProxyCallback::CreateConnection(ICorDebugProcess * pProcess, CONNID dwConnectionId, __in LPWSTR pConnectionName)
+HRESULT ShimProxyCallback::CreateConnection(ICorDebugProcess * pProcess, CONNID dwConnectionId, _In_ LPWSTR pConnectionName)
{
m_pShim->PreDispatchEvent();
class CreateConnectionEvent : public ManagedEvent
diff --git a/src/coreclr/debug/di/shimpriv.h b/src/coreclr/debug/di/shimpriv.h
index 89a0c0d0c79374..26a939ee8a3a8e 100644
--- a/src/coreclr/debug/di/shimpriv.h
+++ b/src/coreclr/debug/di/shimpriv.h
@@ -128,15 +128,15 @@ class ShimProxyCallback :
COM_METHOD LogMessage( ICorDebugAppDomain *pAppDomain,
ICorDebugThread *pThread,
LONG lLevel,
- __in LPWSTR pLogSwitchName,
- __in LPWSTR pMessage);
+ _In_ LPWSTR pLogSwitchName,
+ _In_ LPWSTR pMessage);
COM_METHOD LogSwitch( ICorDebugAppDomain *pAppDomain,
ICorDebugThread *pThread,
LONG lLevel,
ULONG ulReason,
- __in LPWSTR pLogSwitchName,
- __in LPWSTR pParentName);
+ _In_ LPWSTR pLogSwitchName,
+ _In_ LPWSTR pParentName);
COM_METHOD CreateAppDomain(ICorDebugProcess *pProcess,
ICorDebugAppDomain *pAppDomain);
@@ -178,7 +178,7 @@ class ShimProxyCallback :
ICorDebugFunction *pNewFunction,
ULONG32 oldILOffset);
- COM_METHOD CreateConnection(ICorDebugProcess *pProcess, CONNID dwConnectionId, __in LPWSTR pConnName);
+ COM_METHOD CreateConnection(ICorDebugProcess *pProcess, CONNID dwConnectionId, _In_ LPWSTR pConnName);
COM_METHOD ChangeConnection(ICorDebugProcess *pProcess, CONNID dwConnectionId );
@@ -368,7 +368,7 @@ class ShimProcess
Cordb * pCordb,
ICorDebugRemoteTarget * pRemoteTarget,
LPCWSTR programName,
- __in_z LPWSTR programArgs,
+ _In_z_ LPWSTR programArgs,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
diff --git a/src/coreclr/debug/di/symbolinfo.cpp b/src/coreclr/debug/di/symbolinfo.cpp
index 452adbe71f3a7e..37cff967d02fea 100644
--- a/src/coreclr/debug/di/symbolinfo.cpp
+++ b/src/coreclr/debug/di/symbolinfo.cpp
@@ -231,7 +231,7 @@ STDMETHODIMP_(ULONG) SymbolInfo::Release ()
STDMETHODIMP SymbolInfo::GetTypeDefProps ( // S_OK or error.
mdTypeDef td, // [IN] TypeDef token for inquiry.
- __out_ecount_part_opt(cchTypeDef, pchTypeDef)
+ _Out_writes_to_opt_(cchTypeDef, pchTypeDef)
LPWSTR szTypeDef, // [OUT] Put name here.
ULONG cchTypeDef, // [IN] size of name buffer in wide chars.
ULONG *pchTypeDef, // [OUT] put size of name (wide chars) here.
@@ -278,7 +278,7 @@ STDMETHODIMP SymbolInfo::GetTypeDefProps ( // S_OK or error.
STDMETHODIMP SymbolInfo::GetMethodProps (
mdMethodDef mb, // The method for which to get props.
mdTypeDef *pClass, // Put method's class here.
- __out_ecount_part_opt(cchMethod, *pchMethod)
+ _Out_writes_to_opt_(cchMethod, *pchMethod)
LPWSTR szMethod, // Put method's name here.
ULONG cchMethod, // Size of szMethod buffer in wide chars.
ULONG *pchMethod, // Put actual size here
@@ -419,7 +419,7 @@ STDMETHODIMP SymbolInfo::FindTypeDefByName ( // S_OK or error.
}
STDMETHODIMP SymbolInfo::GetScopeProps ( // S_OK or error.
- __out_ecount_part_opt(cchName, *pchName)
+ _Out_writes_to_opt_(cchName, *pchName)
LPWSTR szName, // [OUT] Put the name here.
ULONG cchName, // [IN] Size of name buffer in wide chars.
ULONG *pchName, // [OUT] Put size of name (wide chars) here.
@@ -449,7 +449,7 @@ STDMETHODIMP SymbolInfo::GetInterfaceImplProps ( // S_OK or error.
STDMETHODIMP SymbolInfo::GetTypeRefProps ( // S_OK or error.
mdTypeRef tr, // [IN] TypeRef token.
mdToken *ptkResolutionScope, // [OUT] Resolution scope, ModuleRef or AssemblyRef.
- __out_ecount_part_opt(cchName, *pchName)
+ _Out_writes_to_opt_(cchName, *pchName)
LPWSTR szName, // [OUT] Name of the TypeRef.
ULONG cchName, // [IN] Size of buffer.
ULONG *pchName) // [OUT] Size of Name.
@@ -629,7 +629,7 @@ STDMETHODIMP SymbolInfo::FindMemberRef (
STDMETHODIMP SymbolInfo::GetMemberRefProps ( // S_OK or error.
mdMemberRef mr, // [IN] given memberref
mdToken *ptk, // [OUT] Put classref or classdef here.
- __out_ecount_part_opt(cchMember, *pchMember)
+ _Out_writes_to_opt_(cchMember, *pchMember)
LPWSTR szMember, // [OUT] buffer to fill for member's name
ULONG cchMember, // [IN] the count of char of szMember
ULONG *pchMember, // [OUT] actual count of char in member name
@@ -752,7 +752,7 @@ STDMETHODIMP SymbolInfo::GetSigFromToken ( // S_OK or error.
STDMETHODIMP SymbolInfo::GetModuleRefProps ( // S_OK or error.
mdModuleRef mur, // [IN] moduleref token.
- __out_ecount_part_opt(cchName, *pchName)
+ _Out_writes_to_opt_(cchName, *pchName)
LPWSTR szName, // [OUT] buffer to fill with the moduleref name.
ULONG cchName, // [IN] size of szName in wide characters.
ULONG *pchName) // [OUT] actual count of characters in the name.
@@ -800,7 +800,7 @@ STDMETHODIMP SymbolInfo::EnumUnresolvedMethods ( // S_OK, S_FALSE, or erro
STDMETHODIMP SymbolInfo::GetUserString ( // S_OK or error.
mdString stk, // [IN] String token.
- __out_ecount_part_opt(cchString, *pchString)
+ _Out_writes_to_opt_(cchString, *pchString)
LPWSTR szString, // [OUT] Copy of string.
ULONG cchString, // [IN] Max chars of room in szString.
ULONG *pchString) // [OUT] How many chars in actual string.
@@ -812,7 +812,7 @@ STDMETHODIMP SymbolInfo::GetUserString ( // S_OK or error.
STDMETHODIMP SymbolInfo::GetPinvokeMap ( // S_OK or error.
mdToken tk, // [IN] FieldDef or MethodDef.
DWORD *pdwMappingFlags, // [OUT] Flags used for mapping.
- __out_ecount_part_opt(cchImportName, *pchImportName)
+ _Out_writes_to_opt_(cchImportName, *pchImportName)
LPWSTR szImportName, // [OUT] Import name.
ULONG cchImportName, // [IN] Size of the name buffer.
ULONG *pchImportName, // [OUT] Actual number of characters stored.
@@ -896,7 +896,7 @@ STDMETHODIMP SymbolInfo::FindTypeRef (
STDMETHODIMP SymbolInfo::GetMemberProps (
mdToken mb, // The member for which to get props.
mdTypeDef *pClass, // Put member's class here.
- __out_ecount_part_opt(cchMember, *pchMember)
+ _Out_writes_to_opt_(cchMember, *pchMember)
LPWSTR szMember, // Put member's name here.
ULONG cchMember, // Size of szMember buffer in wide chars.
ULONG *pchMember, // Put actual size here
@@ -916,7 +916,7 @@ STDMETHODIMP SymbolInfo::GetMemberProps (
STDMETHODIMP SymbolInfo::GetFieldProps (
mdFieldDef mb, // The field for which to get props.
mdTypeDef *pClass, // Put field's class here.
- __out_ecount_part_opt(cchField, *pchField)
+ _Out_writes_to_opt_(cchField, *pchField)
LPWSTR szField, // Put field's name here.
ULONG cchField, // Size of szField buffer in wide chars.
ULONG *pchField, // Put actual size here
@@ -957,7 +957,7 @@ STDMETHODIMP SymbolInfo::GetParamProps ( // S_OK or error.
mdParamDef tk, // [IN]The Parameter.
mdMethodDef *pmd, // [OUT] Parent Method token.
ULONG *pulSequence, // [OUT] Parameter sequence.
- __out_ecount_part_opt(cchName, *pchName)
+ _Out_writes_to_opt_(cchName, *pchName)
LPWSTR szName, // [OUT] Put name here.
ULONG cchName, // [OUT] Size of name buffer.
ULONG *pchName, // [OUT] Put actual size of name here.
diff --git a/src/coreclr/debug/di/symbolinfo.h b/src/coreclr/debug/di/symbolinfo.h
index 22deafaaf5d516..5b1291f4cfe598 100644
--- a/src/coreclr/debug/di/symbolinfo.h
+++ b/src/coreclr/debug/di/symbolinfo.h
@@ -104,7 +104,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
mdTypeDef *ptd); // [OUT] Put the TypeDef token here.
STDMETHOD(GetScopeProps)( // S_OK or error.
- __out_ecount_part_opt(cchName, *pchName)
+ _Out_writes_to_opt_(cchName, *pchName)
LPWSTR szName, // [OUT] Put the name here.
ULONG cchName, // [IN] Size of name buffer in wide chars.
ULONG *pchName, // [OUT] Put size of name (wide chars) here.
@@ -115,7 +115,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
STDMETHOD(GetTypeDefProps)( // S_OK or error.
mdTypeDef td, // [IN] TypeDef token for inquiry.
- __out_ecount_part_opt(cchTypeDef, *pchTypeDef)
+ _Out_writes_to_opt_(cchTypeDef, *pchTypeDef)
LPWSTR szTypeDef, // [OUT] Put name here.
ULONG cchTypeDef, // [IN] size of name buffer in wide chars.
ULONG *pchTypeDef, // [OUT] put size of name (wide chars) here.
@@ -130,7 +130,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
STDMETHOD(GetTypeRefProps)( // S_OK or error.
mdTypeRef tr, // [IN] TypeRef token.
mdToken *ptkResolutionScope, // [OUT] Resolution scope, ModuleRef or AssemblyRef.
- __out_ecount_part_opt(cchName, *pchName)
+ _Out_writes_to_opt_(cchName, *pchName)
LPWSTR szName, // [OUT] Name of the TypeRef.
ULONG cchName, // [IN] Size of buffer.
ULONG *pchName); // [OUT] Size of Name.
@@ -244,7 +244,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
STDMETHOD (GetMethodProps)(
mdMethodDef mb, // The method for which to get props.
mdTypeDef *pClass, // Put method's class here.
- __out_ecount_part_opt(cchMethod, *pchMethod)
+ _Out_writes_to_opt_(cchMethod, *pchMethod)
LPWSTR szMethod, // Put method's name here.
ULONG cchMethod, // Size of szMethod buffer in wide chars.
ULONG *pchMethod, // Put actual size here
@@ -257,7 +257,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
STDMETHOD(GetMemberRefProps)( // S_OK or error.
mdMemberRef mr, // [IN] given memberref
mdToken *ptk, // [OUT] Put classref or classdef here.
- __out_ecount_part_opt(cchMember, *pchMember)
+ _Out_writes_to_opt_(cchMember, *pchMember)
LPWSTR szMember, // [OUT] buffer to fill for member's name
ULONG cchMember, // [IN] the count of char of szMember
ULONG *pchMember, // [OUT] actual count of char in member name
@@ -336,7 +336,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
STDMETHOD(GetModuleRefProps)( // S_OK or error.
mdModuleRef mur, // [IN] moduleref token.
- __out_ecount_part_opt(cchName, *pchName)
+ _Out_writes_to_opt_(cchName, *pchName)
LPWSTR szName, // [OUT] buffer to fill with the moduleref name.
ULONG cchName, // [IN] size of szName in wide characters.
ULONG *pchName); // [OUT] actual count of characters in the name.
@@ -364,7 +364,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
STDMETHOD(GetUserString)( // S_OK or error.
mdString stk, // [IN] String token.
- __out_ecount_part_opt(cchString, *pchString)
+ _Out_writes_to_opt_(cchString, *pchString)
LPWSTR szString, // [OUT] Copy of string.
ULONG cchString, // [IN] Max chars of room in szString.
ULONG *pchString); // [OUT] How many chars in actual string.
@@ -372,7 +372,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
STDMETHOD(GetPinvokeMap)( // S_OK or error.
mdToken tk, // [IN] FieldDef or MethodDef.
DWORD *pdwMappingFlags, // [OUT] Flags used for mapping.
- __out_ecount_part_opt(cchImportName, *pchImportName)
+ _Out_writes_to_opt_(cchImportName, *pchImportName)
LPWSTR szImportName, // [OUT] Import name.
ULONG cchImportName, // [IN] Size of the name buffer.
ULONG *pchImportName, // [OUT] Actual number of characters stored.
@@ -424,7 +424,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
STDMETHOD(GetMemberProps)(
mdToken mb, // The member for which to get props.
mdTypeDef *pClass, // Put member's class here.
- __out_ecount_part_opt(cchMember, *pchMember)
+ _Out_writes_to_opt_(cchMember, *pchMember)
LPWSTR szMember, // Put member's name here.
ULONG cchMember, // Size of szMember buffer in wide chars.
ULONG *pchMember, // Put actual size here
@@ -440,7 +440,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
STDMETHOD(GetFieldProps)(
mdFieldDef mb, // The field for which to get props.
mdTypeDef *pClass, // Put field's class here.
- __out_ecount_part_opt(cchField, *pchField)
+ _Out_writes_to_opt_(cchField, *pchField)
LPWSTR szField, // Put field's name here.
ULONG cchField, // Size of szField buffer in wide chars.
ULONG *pchField, // Put actual size here
@@ -473,7 +473,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
mdParamDef tk, // [IN]The Parameter.
mdMethodDef *pmd, // [OUT] Parent Method token.
ULONG *pulSequence, // [OUT] Parameter sequence.
- __out_ecount_part_opt(cchName, *pchName)
+ _Out_writes_to_opt_(cchName, *pchName)
LPWSTR szName, // [OUT] Put name here.
ULONG cchName, // [OUT] Size of name buffer.
ULONG *pchName, // [OUT] Put actual size of name here.
diff --git a/src/coreclr/debug/ee/debugger.cpp b/src/coreclr/debug/ee/debugger.cpp
index 8e5200d37d5097..1e326e724250b6 100644
--- a/src/coreclr/debug/ee/debugger.cpp
+++ b/src/coreclr/debug/ee/debugger.cpp
@@ -14341,8 +14341,8 @@ void Debugger::SendRawLogMessage(
// the creation/modification of a LogSwitch
void Debugger::SendLogSwitchSetting(int iLevel,
int iReason,
- __in_z LPCWSTR pLogSwitchName,
- __in_z LPCWSTR pParentSwitchName)
+ _In_z_ LPCWSTR pLogSwitchName,
+ _In_z_ LPCWSTR pParentSwitchName)
{
CONTRACTL
{
@@ -15854,7 +15854,7 @@ BOOL Debugger::IsThreadContextInvalid(Thread *pThread, CONTEXT *pCtx)
// notification when a SQL connection begins
-void Debugger::CreateConnection(CONNID dwConnectionId, __in_z WCHAR *wzName)
+void Debugger::CreateConnection(CONNID dwConnectionId, _In_z_ WCHAR *wzName)
{
CONTRACTL
{
diff --git a/src/coreclr/debug/ee/debugger.h b/src/coreclr/debug/ee/debugger.h
index 3fd9edf68f5d86..084f1da6a5c93f 100644
--- a/src/coreclr/debug/ee/debugger.h
+++ b/src/coreclr/debug/ee/debugger.h
@@ -2201,7 +2201,7 @@ class Debugger : public DebugInterface
void SendInterceptExceptionComplete(Thread *thread);
HRESULT AttachDebuggerForBreakpoint(Thread *thread,
- __in_opt WCHAR *wszLaunchReason);
+ _In_opt_ WCHAR *wszLaunchReason);
void ThreadIsSafe(Thread *thread);
@@ -2424,8 +2424,8 @@ class Debugger : public DebugInterface
void SendLogSwitchSetting (int iLevel,
int iReason,
- __in_z LPCWSTR pLogSwitchName,
- __in_z LPCWSTR pParentSwitchName);
+ _In_z_ LPCWSTR pLogSwitchName,
+ _In_z_ LPCWSTR pParentSwitchName);
bool IsLoggingEnabled (void)
{
@@ -2507,7 +2507,7 @@ class Debugger : public DebugInterface
BOOL IsThreadContextInvalid(Thread *pThread, T_CONTEXT *pCtx);
// notification for SQL fiber debugging support
- void CreateConnection(CONNID dwConnectionId, __in_z WCHAR *wzName);
+ void CreateConnection(CONNID dwConnectionId, _In_z_ WCHAR *wzName);
void DestroyConnection(CONNID dwConnectionId);
void ChangeConnection(CONNID dwConnectionId);
@@ -3704,7 +3704,7 @@ void DbgLogHelper(DebuggerIPCEventType event);
// Helpers for cleanup
// These are various utility functions, mainly where we factor out code.
//-----------------------------------------------------------------------------
-void GetPidDecoratedName(__out_ecount(cBufSizeInChars) WCHAR * pBuf,
+void GetPidDecoratedName(_Out_writes_(cBufSizeInChars) WCHAR * pBuf,
int cBufSizeInChars,
const WCHAR * pPrefix);
diff --git a/src/coreclr/debug/ee/rcthread.cpp b/src/coreclr/debug/ee/rcthread.cpp
index 18c840edbb6984..0f48eb2c95e188 100644
--- a/src/coreclr/debug/ee/rcthread.cpp
+++ b/src/coreclr/debug/ee/rcthread.cpp
@@ -116,7 +116,7 @@ void DebuggerRCThread::CloseIPCHandles()
// cBufSizeInChars - the size of the buffer in characters, including the null.
// pPrefx - The undecorated name of the event.
//-----------------------------------------------------------------------------
-void GetPidDecoratedName(__out_ecount(cBufSizeInChars) WCHAR * pBuf,
+void GetPidDecoratedName(_Out_writes_(cBufSizeInChars) WCHAR * pBuf,
int cBufSizeInChars,
const WCHAR * pPrefix)
{
diff --git a/src/coreclr/debug/inc/common.h b/src/coreclr/debug/inc/common.h
index 2baec963e14f2f..cb8474c7373856 100644
--- a/src/coreclr/debug/inc/common.h
+++ b/src/coreclr/debug/inc/common.h
@@ -45,7 +45,7 @@ void InitEventForDebuggerNotification(DEBUG_EVENT * pDebugEvent,
#endif // (FEATURE_DBGIPC_TRANSPORT_DI || FEATURE_DBGIPC_TRANSPORT_VM)
-void GetPidDecoratedName(__out_z __out_ecount(cBufSizeInChars) WCHAR * pBuf,
+void GetPidDecoratedName(_Out_writes_z_(cBufSizeInChars) WCHAR * pBuf,
int cBufSizeInChars,
const WCHAR * pPrefix,
DWORD pid);
diff --git a/src/coreclr/debug/inc/dbgipcevents.h b/src/coreclr/debug/inc/dbgipcevents.h
index db4a00fca1c865..ddef09554cf80d 100644
--- a/src/coreclr/debug/inc/dbgipcevents.h
+++ b/src/coreclr/debug/inc/dbgipcevents.h
@@ -990,7 +990,7 @@ extern const size_t nameCount;
struct MSLAYOUT IPCENames // We use a class/struct so that the function can remain in a shared header file
{
- static DebuggerIPCEventType GetEventType(__in_z char * strEventType)
+ static DebuggerIPCEventType GetEventType(_In_z_ char * strEventType)
{
// pass in the string of event name and find the matching enum value
// This is a linear search which is pretty slow. However, this is only used
diff --git a/src/coreclr/debug/shared/dbgtransportsession.cpp b/src/coreclr/debug/shared/dbgtransportsession.cpp
index 85fb7901b01c1a..6d3ed5b345cf7c 100644
--- a/src/coreclr/debug/shared/dbgtransportsession.cpp
+++ b/src/coreclr/debug/shared/dbgtransportsession.cpp
@@ -1143,7 +1143,7 @@ DbgTransportSession::Message * DbgTransportSession::RemoveMessageFromSendQueue(D
// Check read and optionally write memory access to the specified range of bytes. Used to check
// ReadProcessMemory and WriteProcessMemory requests.
-HRESULT DbgTransportSession::CheckBufferAccess(__in_ecount(cbBuffer) PBYTE pbBuffer, DWORD cbBuffer, bool fWriteAccess)
+HRESULT DbgTransportSession::CheckBufferAccess(_In_reads_(cbBuffer) PBYTE pbBuffer, DWORD cbBuffer, bool fWriteAccess)
{
// check for integer overflow
if ((pbBuffer + cbBuffer) < pbBuffer)
diff --git a/src/coreclr/debug/shared/utils.cpp b/src/coreclr/debug/shared/utils.cpp
index 85f17b50c44e78..be967b1d1b7fa2 100644
--- a/src/coreclr/debug/shared/utils.cpp
+++ b/src/coreclr/debug/shared/utils.cpp
@@ -126,7 +126,7 @@ void InitEventForDebuggerNotification(DEBUG_EVENT * pDebugEvent,
// cBufSizeInChars - the size of the buffer in characters, including the null.
// pPrefx - The undecorated name of the event.
//-----------------------------------------------------------------------------
-void GetPidDecoratedName(__out_z __out_ecount(cBufSizeInChars) WCHAR * pBuf, int cBufSizeInChars, const WCHAR * pPrefix, DWORD pid)
+void GetPidDecoratedName(_Out_writes_z_(cBufSizeInChars) WCHAR * pBuf, int cBufSizeInChars, const WCHAR * pPrefix, DWORD pid)
{
const WCHAR szGlobal[] = W("Global\\");
int szGlobalLen;
diff --git a/src/coreclr/debug/shim/debugshim.cpp b/src/coreclr/debug/shim/debugshim.cpp
index b86c8eb0cfcc3a..3dcfbcc2510785 100644
--- a/src/coreclr/debug/shim/debugshim.cpp
+++ b/src/coreclr/debug/shim/debugshim.cpp
@@ -427,11 +427,11 @@ HRESULT CLRDebuggingImpl::GetCLRInfo(ICorDebugDataTarget* pDataTarget,
CLR_DEBUGGING_VERSION* pVersion,
DWORD* pdwDbiTimeStamp,
DWORD* pdwDbiSizeOfImage,
- __out_z __inout_ecount(dwDbiNameCharCount) WCHAR* pDbiName,
+ _Inout_updates_z_(dwDbiNameCharCount) WCHAR* pDbiName,
DWORD dwDbiNameCharCount,
DWORD* pdwDacTimeStamp,
DWORD* pdwDacSizeOfImage,
- __out_z __inout_ecount(dwDacNameCharCount) WCHAR* pDacName,
+ _Inout_updates_z_(dwDacNameCharCount) WCHAR* pDacName,
DWORD dwDacNameCharCount)
{
#ifdef HOST_WINDOWS
@@ -629,7 +629,7 @@ HRESULT CLRDebuggingImpl::GetCLRInfo(ICorDebugDataTarget* pDataTarget,
}
// Formats the long name for DAC
-HRESULT CLRDebuggingImpl::FormatLongDacModuleName(__out_z __inout_ecount(cchBuffer) WCHAR * pBuffer,
+HRESULT CLRDebuggingImpl::FormatLongDacModuleName(_Inout_updates_z_(cchBuffer) WCHAR * pBuffer,
DWORD cchBuffer,
DWORD targetImageFileMachine,
VS_FIXEDFILEINFO * pVersion)
diff --git a/src/coreclr/debug/shim/debugshim.h b/src/coreclr/debug/shim/debugshim.h
index 5055d5a11b47d1..93df463867feb5 100644
--- a/src/coreclr/debug/shim/debugshim.h
+++ b/src/coreclr/debug/shim/debugshim.h
@@ -69,14 +69,14 @@ class CLRDebuggingImpl : public ICLRDebugging
CLR_DEBUGGING_VERSION * pVersion,
DWORD * pdwDbiTimeStamp,
DWORD * pdwDbiSizeOfImage,
- __out_z __inout_ecount(dwDbiNameCharCount) WCHAR * pDbiName,
+ _Inout_updates_z_(dwDbiNameCharCount) WCHAR * pDbiName,
DWORD dwDbiNameCharCount,
DWORD * pdwDacTimeStamp,
DWORD * pdwDacSizeOfImage,
- __out_z __inout_ecount(dwDacNameCharCount) WCHAR * pDacName,
+ _Inout_updates_z_(dwDacNameCharCount) WCHAR * pDacName,
DWORD dwDacNameCharCount);
- HRESULT FormatLongDacModuleName(__out_z __inout_ecount(cchBuffer) WCHAR * pBuffer,
+ HRESULT FormatLongDacModuleName(_Inout_updates_z_(cchBuffer) WCHAR * pBuffer,
DWORD cchBuffer,
DWORD targetImageFileMachine,
VS_FIXEDFILEINFO * pVersion);
diff --git a/src/coreclr/dlls/dbgshim/dbgshim.cpp b/src/coreclr/dlls/dbgshim/dbgshim.cpp
index ac1e2d7fe189ac..40e4d7dea4bf26 100644
--- a/src/coreclr/dlls/dbgshim/dbgshim.cpp
+++ b/src/coreclr/dlls/dbgshim/dbgshim.cpp
@@ -79,12 +79,12 @@ if it exists, it will:
DLLEXPORT
HRESULT
CreateProcessForLaunch(
- __in LPWSTR lpCommandLine,
- __in BOOL bSuspendProcess,
- __in LPVOID lpEnvironment,
- __in LPCWSTR lpCurrentDirectory,
- __out PDWORD pProcessId,
- __out HANDLE *pResumeHandle)
+ _In_ LPWSTR lpCommandLine,
+ _In_ BOOL bSuspendProcess,
+ _In_ LPVOID lpEnvironment,
+ _In_ LPCWSTR lpCurrentDirectory,
+ _Out_ PDWORD pProcessId,
+ _Out_ HANDLE *pResumeHandle)
{
PUBLIC_CONTRACT;
@@ -140,7 +140,7 @@ CreateProcessForLaunch(
DLLEXPORT
HRESULT
ResumeProcess(
- __in HANDLE hResumeHandle)
+ _In_ HANDLE hResumeHandle)
{
PUBLIC_CONTRACT;
if (ResumeThread(hResumeHandle) == (DWORD)-1)
@@ -159,7 +159,7 @@ ResumeProcess(
DLLEXPORT
HRESULT
CloseResumeHandle(
- __in HANDLE hResumeHandle)
+ _In_ HANDLE hResumeHandle)
{
PUBLIC_CONTRACT;
if (!CloseHandle(hResumeHandle))
@@ -190,7 +190,7 @@ HRESULT
GetContinueStartupEvent(
DWORD debuggeePID,
LPCWSTR szTelestoFullPath,
- __out HANDLE *phContinueStartupEvent);
+ _Out_ HANDLE *phContinueStartupEvent);
#endif // TARGET_UNIX
@@ -697,10 +697,10 @@ StartupHelperThread(LPVOID p)
DLLEXPORT
HRESULT
RegisterForRuntimeStartup(
- __in DWORD dwProcessId,
- __in PSTARTUP_CALLBACK pfnCallback,
- __in PVOID parameter,
- __out PVOID *ppUnregisterToken)
+ _In_ DWORD dwProcessId,
+ _In_ PSTARTUP_CALLBACK pfnCallback,
+ _In_ PVOID parameter,
+ _Out_ PVOID *ppUnregisterToken)
{
return RegisterForRuntimeStartupEx(dwProcessId, NULL, pfnCallback, parameter, ppUnregisterToken);
}
@@ -738,11 +738,11 @@ RegisterForRuntimeStartup(
DLLEXPORT
HRESULT
RegisterForRuntimeStartupEx(
- __in DWORD dwProcessId,
- __in LPCWSTR lpApplicationGroupId,
- __in PSTARTUP_CALLBACK pfnCallback,
- __in PVOID parameter,
- __out PVOID *ppUnregisterToken)
+ _In_ DWORD dwProcessId,
+ _In_ LPCWSTR lpApplicationGroupId,
+ _In_ PSTARTUP_CALLBACK pfnCallback,
+ _In_ PVOID parameter,
+ _Out_ PVOID *ppUnregisterToken)
{
PUBLIC_CONTRACT;
@@ -787,7 +787,7 @@ RegisterForRuntimeStartupEx(
DLLEXPORT
HRESULT
UnregisterForRuntimeStartup(
- __in PVOID pUnregisterToken)
+ _In_ PVOID pUnregisterToken)
{
PUBLIC_CONTRACT;
@@ -824,8 +824,8 @@ const int cchEventNameBufferSize = (sizeof(StartupNotifyEventNamePrefix) + sizeo
DLLEXPORT
HRESULT
GetStartupNotificationEvent(
- __in DWORD debuggeePID,
- __out HANDLE* phStartupEvent)
+ _In_ DWORD debuggeePID,
+ _Out_ HANDLE* phStartupEvent)
{
PUBLIC_CONTRACT;
@@ -1220,9 +1220,9 @@ DLLEXPORT
HRESULT
EnumerateCLRs(
DWORD debuggeePID,
- __out HANDLE** ppHandleArrayOut,
- __out LPWSTR** ppStringArrayOut,
- __out DWORD* pdwArrayLengthOut)
+ _Out_ HANDLE** ppHandleArrayOut,
+ _Out_ LPWSTR** ppStringArrayOut,
+ _Out_ DWORD* pdwArrayLengthOut)
{
PUBLIC_CONTRACT;
@@ -1357,9 +1357,9 @@ EnumerateCLRs(
DLLEXPORT
HRESULT
CloseCLREnumeration(
- __in HANDLE* pHandleArray,
- __in LPWSTR* pStringArray,
- __in DWORD dwArrayLength)
+ _In_ HANDLE* pHandleArray,
+ _In_ LPWSTR* pStringArray,
+ _In_ DWORD dwArrayLength)
{
PUBLIC_CONTRACT;
@@ -1484,11 +1484,11 @@ const WCHAR *c_versionStrFormat = W("%08x;%08x;%p");
DLLEXPORT
HRESULT
CreateVersionStringFromModule(
- __in DWORD pidDebuggee,
- __in LPCWSTR szModuleName,
- __out_ecount_part(cchBuffer, *pdwLength) LPWSTR pBuffer,
- __in DWORD cchBuffer,
- __out DWORD* pdwLength)
+ _In_ DWORD pidDebuggee,
+ _In_ LPCWSTR szModuleName,
+ _Out_writes_to_opt_(cchBuffer, *pdwLength) LPWSTR pBuffer,
+ _In_ DWORD cchBuffer,
+ _Out_ DWORD* pdwLength)
{
PUBLIC_CONTRACT;
@@ -1719,9 +1719,9 @@ CheckDbiAndRuntimeVersion(
DLLEXPORT
HRESULT
CreateDebuggingInterfaceFromVersionEx(
- __in int iDebuggerVersion,
- __in LPCWSTR szDebuggeeVersion,
- __out IUnknown ** ppCordb)
+ _In_ int iDebuggerVersion,
+ _In_ LPCWSTR szDebuggeeVersion,
+ _Out_ IUnknown ** ppCordb)
{
return CreateDebuggingInterfaceFromVersion2(iDebuggerVersion, szDebuggeeVersion, NULL, ppCordb);
}
@@ -1748,10 +1748,10 @@ CreateDebuggingInterfaceFromVersionEx(
DLLEXPORT
HRESULT
CreateDebuggingInterfaceFromVersion2(
- __in int iDebuggerVersion,
- __in LPCWSTR szDebuggeeVersion,
- __in LPCWSTR szApplicationGroupId,
- __out IUnknown ** ppCordb)
+ _In_ int iDebuggerVersion,
+ _In_ LPCWSTR szDebuggeeVersion,
+ _In_ LPCWSTR szApplicationGroupId,
+ _Out_ IUnknown ** ppCordb)
{
PUBLIC_CONTRACT;
@@ -1880,8 +1880,8 @@ CreateDebuggingInterfaceFromVersion2(
DLLEXPORT
HRESULT
CreateDebuggingInterfaceFromVersion(
- __in LPCWSTR szDebuggeeVersion,
- __out IUnknown ** ppCordb
+ _In_ LPCWSTR szDebuggeeVersion,
+ _Out_ IUnknown ** ppCordb
)
{
PUBLIC_CONTRACT;
@@ -1907,7 +1907,7 @@ HRESULT
GetContinueStartupEvent(
DWORD debuggeePID,
LPCWSTR szTelestoFullPath,
- __out HANDLE* phContinueStartupEvent)
+ _Out_ HANDLE* phContinueStartupEvent)
{
if ((phContinueStartupEvent == NULL) || (szTelestoFullPath == NULL))
return E_INVALIDARG;
diff --git a/src/coreclr/dlls/dbgshim/dbgshim.h b/src/coreclr/dlls/dbgshim/dbgshim.h
index 392cd7b9286a85..004fd2a38128f2 100644
--- a/src/coreclr/dlls/dbgshim/dbgshim.h
+++ b/src/coreclr/dlls/dbgshim/dbgshim.h
@@ -11,81 +11,81 @@ typedef VOID (*PSTARTUP_CALLBACK)(IUnknown *pCordb, PVOID parameter, HRESULT hr)
EXTERN_C HRESULT
CreateProcessForLaunch(
- __in LPWSTR lpCommandLine,
- __in BOOL bSuspendProcess,
- __in LPVOID lpEnvironment,
- __in LPCWSTR lpCurrentDirectory,
- __out PDWORD pProcessId,
- __out HANDLE *pResumeHandle);
+ _In_ LPWSTR lpCommandLine,
+ _In_ BOOL bSuspendProcess,
+ _In_ LPVOID lpEnvironment,
+ _In_ LPCWSTR lpCurrentDirectory,
+ _Out_ PDWORD pProcessId,
+ _Out_ HANDLE *pResumeHandle);
EXTERN_C HRESULT
ResumeProcess(
- __in HANDLE hResumeHandle);
+ _In_ HANDLE hResumeHandle);
EXTERN_C HRESULT
CloseResumeHandle(
- __in HANDLE hResumeHandle);
+ _In_ HANDLE hResumeHandle);
EXTERN_C HRESULT
RegisterForRuntimeStartup(
- __in DWORD dwProcessId,
- __in PSTARTUP_CALLBACK pfnCallback,
- __in PVOID parameter,
- __out PVOID *ppUnregisterToken);
+ _In_ DWORD dwProcessId,
+ _In_ PSTARTUP_CALLBACK pfnCallback,
+ _In_ PVOID parameter,
+ _Out_ PVOID *ppUnregisterToken);
EXTERN_C HRESULT
RegisterForRuntimeStartupEx(
- __in DWORD dwProcessId,
- __in LPCWSTR szApplicationGroupId,
- __in PSTARTUP_CALLBACK pfnCallback,
- __in PVOID parameter,
- __out PVOID *ppUnregisterToken);
+ _In_ DWORD dwProcessId,
+ _In_ LPCWSTR szApplicationGroupId,
+ _In_ PSTARTUP_CALLBACK pfnCallback,
+ _In_ PVOID parameter,
+ _Out_ PVOID *ppUnregisterToken);
EXTERN_C HRESULT
UnregisterForRuntimeStartup(
- __in PVOID pUnregisterToken);
+ _In_ PVOID pUnregisterToken);
EXTERN_C HRESULT
GetStartupNotificationEvent(
- __in DWORD debuggeePID,
- __out HANDLE* phStartupEvent);
+ _In_ DWORD debuggeePID,
+ _Out_ HANDLE* phStartupEvent);
EXTERN_C HRESULT
EnumerateCLRs(DWORD debuggeePID,
- __out HANDLE** ppHandleArrayOut,
- __out LPWSTR** ppStringArrayOut,
- __out DWORD* pdwArrayLengthOut);
+ _Out_ HANDLE** ppHandleArrayOut,
+ _Out_ LPWSTR** ppStringArrayOut,
+ _Out_ DWORD* pdwArrayLengthOut);
EXTERN_C HRESULT
CloseCLREnumeration(
- __in HANDLE* pHandleArray,
- __in LPWSTR* pStringArray,
- __in DWORD dwArrayLength);
+ _In_ HANDLE* pHandleArray,
+ _In_ LPWSTR* pStringArray,
+ _In_ DWORD dwArrayLength);
EXTERN_C HRESULT
CreateVersionStringFromModule(
- __in DWORD pidDebuggee,
- __in LPCWSTR szModuleName,
- __out_ecount_part(cchBuffer, *pdwLength) LPWSTR pBuffer,
- __in DWORD cchBuffer,
- __out DWORD* pdwLength);
+ _In_ DWORD pidDebuggee,
+ _In_ LPCWSTR szModuleName,
+ _Out_writes_to_opt_(cchBuffer, *pdwLength) LPWSTR pBuffer,
+ _In_ DWORD cchBuffer,
+ _Out_ DWORD* pdwLength);
EXTERN_C HRESULT
CreateDebuggingInterfaceFromVersionEx(
- __in int iDebuggerVersion,
- __in LPCWSTR szDebuggeeVersion,
- __out IUnknown ** ppCordb);
+ _In_ int iDebuggerVersion,
+ _In_ LPCWSTR szDebuggeeVersion,
+ _Out_ IUnknown ** ppCordb);
EXTERN_C
DLLEXPORT
HRESULT
CreateDebuggingInterfaceFromVersion2(
- __in int iDebuggerVersion,
- __in LPCWSTR szDebuggeeVersion,
- __in LPCWSTR szApplicationGroupId,
- __out IUnknown ** ppCordb);
+ _In_ int iDebuggerVersion,
+ _In_ LPCWSTR szDebuggeeVersion,
+ _In_ LPCWSTR szApplicationGroupId,
+ _Out_ IUnknown ** ppCordb);
EXTERN_C HRESULT
CreateDebuggingInterfaceFromVersion(
- __in LPCWSTR szDebuggeeVersion,
- __out IUnknown ** ppCordb);
+ _In_ LPCWSTR szDebuggeeVersion,
+ _Out_ IUnknown ** ppCordb);
diff --git a/src/coreclr/dlls/mscordac/CMakeLists.txt b/src/coreclr/dlls/mscordac/CMakeLists.txt
index 8d04b34e48aad7..25c2532358774b 100644
--- a/src/coreclr/dlls/mscordac/CMakeLists.txt
+++ b/src/coreclr/dlls/mscordac/CMakeLists.txt
@@ -47,7 +47,7 @@ else(CLR_CMAKE_HOST_WIN32)
set(REDEFINES_FILE_SCRIPT ${CMAKE_SOURCE_DIR}/generateredefinesfile.sh)
- if (CLR_CMAKE_HOST_ARCH_ARM OR CLR_CMAKE_HOST_ARCH_ARM64)
+ if (CLR_CMAKE_HOST_ARCH_ARM OR CLR_CMAKE_HOST_ARCH_ARM64 OR CLR_CMAKE_HOST_ARCH_LOONGARCH64)
set(JUMP_INSTRUCTION b)
else()
set(JUMP_INSTRUCTION jmp)
diff --git a/src/coreclr/dlls/mscordac/mscordac_unixexports.src b/src/coreclr/dlls/mscordac/mscordac_unixexports.src
index 2a529b2f4a779d..a518b2dca2c8c3 100644
--- a/src/coreclr/dlls/mscordac/mscordac_unixexports.src
+++ b/src/coreclr/dlls/mscordac/mscordac_unixexports.src
@@ -65,7 +65,6 @@ nativeStringResourceTable_mscorrc
#PAL_wcsrchr
#PAL_wcscmp
#PAL_wcschr
-#PAL_wcscspn
#PAL_wcscat
#PAL_wcsstr
#PAL__open
diff --git a/src/coreclr/dlls/mscoree/mscoree.cpp b/src/coreclr/dlls/mscoree/mscoree.cpp
index 4e2d87906ad309..c985b88ab30c2e 100644
--- a/src/coreclr/dlls/mscoree/mscoree.cpp
+++ b/src/coreclr/dlls/mscoree/mscoree.cpp
@@ -218,7 +218,7 @@ STDAPI ReOpenMetaDataWithMemoryEx(
static DWORD g_dwSystemDirectory = 0;
static WCHAR * g_pSystemDirectory = NULL;
-HRESULT GetInternalSystemDirectory(__out_ecount_part_opt(*pdwLength,*pdwLength) LPWSTR buffer, __inout DWORD* pdwLength)
+HRESULT GetInternalSystemDirectory(_Out_writes_to_opt_(*pdwLength,*pdwLength) LPWSTR buffer, __inout DWORD* pdwLength)
{
CONTRACTL {
NOTHROW;
@@ -252,7 +252,7 @@ HRESULT GetInternalSystemDirectory(__out_ecount_part_opt(*pdwLength,*pdwLength)
}
-LPCWSTR GetInternalSystemDirectory(__out DWORD* pdwLength)
+LPCWSTR GetInternalSystemDirectory(_Out_ DWORD* pdwLength)
{
LIMITED_METHOD_CONTRACT;
diff --git a/src/coreclr/dlls/mscorpe/ceefilegenwriter.cpp b/src/coreclr/dlls/mscorpe/ceefilegenwriter.cpp
index 6a0ba5a2499475..623f0087d400c0 100644
--- a/src/coreclr/dlls/mscorpe/ceefilegenwriter.cpp
+++ b/src/coreclr/dlls/mscorpe/ceefilegenwriter.cpp
@@ -487,7 +487,7 @@ HRESULT CeeFileGenWriter::generateImage(void **ppImage)
return hr;
} // HRESULT CeeFileGenWriter::generateImage()
-HRESULT CeeFileGenWriter::setOutputFileName(__in LPWSTR fileName)
+HRESULT CeeFileGenWriter::setOutputFileName(_In_ LPWSTR fileName)
{
if (m_outputFileName)
delete[] m_outputFileName;
@@ -498,7 +498,7 @@ HRESULT CeeFileGenWriter::setOutputFileName(__in LPWSTR fileName)
return S_OK;
} // HRESULT CeeFileGenWriter::setOutputFileName()
-HRESULT CeeFileGenWriter::setResourceFileName(__in LPWSTR fileName)
+HRESULT CeeFileGenWriter::setResourceFileName(_In_ LPWSTR fileName)
{
if (m_resourceFileName)
delete[] m_resourceFileName;
@@ -1294,7 +1294,7 @@ HRESULT CeeFileGenWriter::setVTableEntry(ULONG size, ULONG offset)
return setVTableEntry64(size,(void*)(ULONG_PTR)offset);
} // HRESULT CeeFileGenWriter::setVTableEntry()
-HRESULT CeeFileGenWriter::computeSectionOffset(CeeSection §ion, __in char *ptr,
+HRESULT CeeFileGenWriter::computeSectionOffset(CeeSection §ion, _In_ char *ptr,
unsigned *offset)
{
*offset = section.computeOffset(ptr);
@@ -1302,7 +1302,7 @@ HRESULT CeeFileGenWriter::computeSectionOffset(CeeSection §ion, __in char *p
return S_OK;
} // HRESULT CeeFileGenWriter::computeSectionOffset()
-HRESULT CeeFileGenWriter::computeOffset(__in char *ptr,
+HRESULT CeeFileGenWriter::computeOffset(_In_ char *ptr,
CeeSection **pSection, unsigned *offset)
{
TESTANDRETURNPOINTER(pSection);
diff --git a/src/coreclr/dlls/mscorpe/iceefilegen.cpp b/src/coreclr/dlls/mscorpe/iceefilegen.cpp
index 6714d355d0bfc3..6c40d9699fce91 100644
--- a/src/coreclr/dlls/mscorpe/iceefilegen.cpp
+++ b/src/coreclr/dlls/mscorpe/iceefilegen.cpp
@@ -183,7 +183,7 @@ HRESULT ICeeFileGen::AddSectionReloc (HCEESECTION section, ULONG offset, HCEESEC
}
}
-HRESULT ICeeFileGen::SetOutputFileName (HCEEFILE ceeFile, __in LPWSTR outputFileName)
+HRESULT ICeeFileGen::SetOutputFileName (HCEEFILE ceeFile, _In_ LPWSTR outputFileName)
{
TESTANDRETURNPOINTER(ceeFile);
TESTANDRETURNPOINTER(outputFileName);
@@ -192,7 +192,7 @@ HRESULT ICeeFileGen::SetOutputFileName (HCEEFILE ceeFile, __in LPWSTR outputFile
return(gen->setOutputFileName(outputFileName));
}
-__success(return == S_OK) HRESULT ICeeFileGen::GetOutputFileName (HCEEFILE ceeFile, __out LPWSTR *outputFileName)
+__success(return == S_OK) HRESULT ICeeFileGen::GetOutputFileName (HCEEFILE ceeFile, _Out_ LPWSTR *outputFileName)
{
TESTANDRETURNPOINTER(ceeFile);
TESTANDRETURNPOINTER(outputFileName);
@@ -204,7 +204,7 @@ __success(return == S_OK) HRESULT ICeeFileGen::GetOutputFileName (HCEEFILE ceeFi
}
-HRESULT ICeeFileGen::SetResourceFileName (HCEEFILE ceeFile, __in LPWSTR resourceFileName)
+HRESULT ICeeFileGen::SetResourceFileName (HCEEFILE ceeFile, _In_ LPWSTR resourceFileName)
{
TESTANDRETURNPOINTER(ceeFile);
TESTANDRETURNPOINTER(resourceFileName);
@@ -214,7 +214,7 @@ HRESULT ICeeFileGen::SetResourceFileName (HCEEFILE ceeFile, __in LPWSTR resource
}
__success(return == S_OK)
-HRESULT ICeeFileGen::GetResourceFileName (HCEEFILE ceeFile, __out LPWSTR *resourceFileName)
+HRESULT ICeeFileGen::GetResourceFileName (HCEEFILE ceeFile, _Out_ LPWSTR *resourceFileName)
{
TESTANDRETURNPOINTER(ceeFile);
TESTANDRETURNPOINTER(resourceFileName);
@@ -277,7 +277,7 @@ HRESULT ICeeFileGen::GetMethodRVA(HCEEFILE ceeFile, ULONG codeOffset, ULONG *cod
return S_OK;
}
-HRESULT ICeeFileGen::EmitString(HCEEFILE ceeFile, __in LPWSTR strValue, ULONG *strRef)
+HRESULT ICeeFileGen::EmitString(HCEEFILE ceeFile, _In_ LPWSTR strValue, ULONG *strRef)
{
TESTANDRETURNPOINTER(ceeFile);
@@ -429,7 +429,7 @@ HRESULT ICeeFileGen::SetStrongNameEntry(HCEEFILE ceeFile, ULONG size, ULONG offs
return gen->setStrongNameEntry(size, offset);
}
-HRESULT ICeeFileGen::ComputeSectionOffset(HCEESECTION section, __in char *ptr,
+HRESULT ICeeFileGen::ComputeSectionOffset(HCEESECTION section, _In_ char *ptr,
unsigned *offset)
{
TESTANDRETURNPOINTER(section);
@@ -443,7 +443,7 @@ HRESULT ICeeFileGen::ComputeSectionOffset(HCEESECTION section, __in char *ptr,
__success(return == S_OK)
HRESULT ICeeFileGen::ComputeSectionPointer(HCEESECTION section, ULONG offset,
- __out char **ptr)
+ _Out_ char **ptr)
{
TESTANDRETURNPOINTER(section);
@@ -454,7 +454,7 @@ HRESULT ICeeFileGen::ComputeSectionPointer(HCEESECTION section, ULONG offset,
return S_OK;
}
-HRESULT ICeeFileGen::ComputeOffset(HCEEFILE ceeFile, __in char *ptr,
+HRESULT ICeeFileGen::ComputeOffset(HCEEFILE ceeFile, _In_ char *ptr,
HCEESECTION *pSection, unsigned *offset)
{
TESTANDRETURNPOINTER(pSection);
diff --git a/src/coreclr/dlls/mscorpe/pewriter.cpp b/src/coreclr/dlls/mscorpe/pewriter.cpp
index 9add4b56d13b80..b78b00c2853ffb 100644
--- a/src/coreclr/dlls/mscorpe/pewriter.cpp
+++ b/src/coreclr/dlls/mscorpe/pewriter.cpp
@@ -1829,7 +1829,7 @@ HRESULT PEWriter::fixup(CeeGenTokenMapper *pMapper)
return(S_OK); // SUCCESS
}
-HRESULT PEWriter::Open(__in LPCWSTR fileName)
+HRESULT PEWriter::Open(_In_ LPCWSTR fileName)
{
_ASSERTE(m_file == INVALID_HANDLE_VALUE);
HRESULT hr = NOERROR;
@@ -1913,7 +1913,7 @@ HRESULT PEWriter::Close()
}
/******************************************************************/
-HRESULT PEWriter::write(__in LPCWSTR fileName) {
+HRESULT PEWriter::write(_In_ LPCWSTR fileName) {
HRESULT hr;
diff --git a/src/coreclr/dlls/mscorpe/pewriter.h b/src/coreclr/dlls/mscorpe/pewriter.h
index 21817b1d5efc45..84ec61f9275eca 100644
--- a/src/coreclr/dlls/mscorpe/pewriter.h
+++ b/src/coreclr/dlls/mscorpe/pewriter.h
@@ -41,7 +41,7 @@ class PEWriter : public PESectionMan
HRESULT link();
HRESULT fixup(CeeGenTokenMapper *pMapper);
- HRESULT write(__in LPCWSTR fileName);
+ HRESULT write(_In_ LPCWSTR fileName);
HRESULT write(void **ppImage);
// calling these functions is optional
@@ -174,7 +174,7 @@ class PEWriter : public PESectionMan
HRESULT linkPlaceSections(entry * entries, unsigned iEntries);
void setSectionIndex(IMAGE_SECTION_HEADER * h, unsigned sectionIndex);
- HRESULT Open(__in LPCWSTR fileName);
+ HRESULT Open(_In_ LPCWSTR fileName);
HRESULT Write(const void *data, int size);
HRESULT Seek(int offset);
HRESULT Pad(int align);
@@ -257,8 +257,8 @@ class PESeedSection : public PEWriterSection {
int getDirEntry() { _ASSERTE(!"PESeedSection"); return 0; }
HRESULT directoryEntry(unsigned num) { _ASSERTE(!"PESeedSection"); return E_FAIL; }
char * computePointer(unsigned offset) const { _ASSERTE(!"PESeedSection"); return NULL; }
- BOOL containsPointer(__in char *ptr) const { _ASSERTE(!"PESeedSection"); return FALSE; }
- unsigned computeOffset(__in char *ptr) const { _ASSERTE(!"PESeedSection"); return 0; }
+ BOOL containsPointer(_In_ char *ptr) const { _ASSERTE(!"PESeedSection"); return FALSE; }
+ unsigned computeOffset(_In_ char *ptr) const { _ASSERTE(!"PESeedSection"); return 0; }
HRESULT cloneInstance(PESection *destination) { _ASSERTE(!"PESeedSection"); return E_FAIL; }
// PEWriterSection
diff --git a/src/coreclr/dlls/mscorrc/mscorrc.rc b/src/coreclr/dlls/mscorrc/mscorrc.rc
index 2175566c10b610..0e78c99f38d5de 100644
--- a/src/coreclr/dlls/mscorrc/mscorrc.rc
+++ b/src/coreclr/dlls/mscorrc/mscorrc.rc
@@ -580,13 +580,13 @@ BEGIN
IDS_ER_FRAMEWORK_VERSION "CoreCLR Version: "
IDS_ER_UNHANDLEDEXCEPTION "Description: The process was terminated due to an unhandled exception."
IDS_ER_UNHANDLEDEXCEPTIONMSG "Exception Info: "
- IDS_ER_MANAGEDFAILFAST "Description: The application requested process termination through System.Environment.FailFast(string message)."
+ IDS_ER_MANAGEDFAILFAST "Description: The application requested process termination through System.Environment.FailFast."
IDS_ER_MANAGEDFAILFASTMSG "Message: "
IDS_ER_UNMANAGEDFAILFAST "Description: The process was terminated due to an internal error in the .NET Runtime "
IDS_ER_STACK_OVERFLOW "Description: The process was terminated due to stack overflow."
IDS_ER_STACK "Stack:"
IDS_ER_WORDAT "at"
- IDS_ER_UNMANAGEDFAILFASTMSG "at IP %1 (%2) with exit code %3."
+ IDS_ER_UNMANAGEDFAILFASTMSG "at IP 0x%x (0x%x) with exit code 0x%x."
IDS_ER_UNHANDLEDEXCEPTIONINFO "exception code %1, exception address %2"
IDS_ER_MESSAGE_TRUNCATE "The remainder of the message was truncated."
IDS_ER_CODECONTRACT_FAILED "Description: The application encountered a bug. A managed code contract (precondition, postcondition, object invariant, or assert) failed."
diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp
index ace66eac266709..5a2a9c2c2c20e6 100644
--- a/src/coreclr/gc/gc.cpp
+++ b/src/coreclr/gc/gc.cpp
@@ -2522,6 +2522,8 @@ size_t gc_heap::bgc_loh_size_increased = 0;
size_t gc_heap::bgc_poh_size_increased = 0;
+size_t gc_heap::background_soh_size_end_mark = 0;
+
size_t gc_heap::background_soh_alloc_count = 0;
size_t gc_heap::background_uoh_alloc_count = 0;
@@ -28892,6 +28894,14 @@ void gc_heap::plan_phase (int condemned_gen_number)
{
dprintf (2,( "**** Doing Compacting GC ****"));
+#if defined(USE_REGIONS) && defined(BACKGROUND_GC)
+ if (should_update_end_mark_size())
+ {
+ background_soh_size_end_mark += generation_end_seg_allocated (older_gen) -
+ r_older_gen_end_seg_allocated;
+ }
+#endif //USE_REGIONS && BACKGROUND_GC
+
#ifndef USE_REGIONS
if (should_expand)
{
@@ -29396,6 +29406,13 @@ void gc_heap::fix_generation_bounds (int condemned_gen_number,
}
}
#endif //MULTIPLE_HEAPS
+
+#ifdef BACKGROUND_GC
+ if (should_update_end_mark_size())
+ {
+ background_soh_size_end_mark = generation_size (max_generation);
+ }
+#endif //BACKGROUND_GC
#endif //!USE_REGIONS
{
@@ -29614,6 +29631,14 @@ void gc_heap::thread_final_regions (bool compact_p)
generation_final_regions[gen_idx].tail = generation_tail_region (gen);
}
+#ifdef BACKGROUND_GC
+ heap_segment* max_gen_tail_region = 0;
+ if (should_update_end_mark_size())
+ {
+ max_gen_tail_region = generation_final_regions[max_generation].tail;
+ }
+#endif //BACKGROUND_GC
+
// Step 2: for each region in the condemned generations, we thread it onto its planned generation
// in our generation_final_regions array.
for (int gen_idx = condemned_gen_number; gen_idx >= 0; gen_idx--)
@@ -29664,6 +29689,21 @@ void gc_heap::thread_final_regions (bool compact_p)
}
}
+#ifdef BACKGROUND_GC
+ if (max_gen_tail_region)
+ {
+ max_gen_tail_region = heap_segment_next (max_gen_tail_region);
+
+ while (max_gen_tail_region)
+ {
+ background_soh_size_end_mark += heap_segment_allocated (max_gen_tail_region) -
+ heap_segment_mem (max_gen_tail_region);
+
+ max_gen_tail_region = heap_segment_next (max_gen_tail_region);
+ }
+ }
+#endif //BACKGROUND_GC
+
// Step 4: if a generation doesn't have any regions, we need to get a new one for it;
// otherwise we just set the head region as the start region for that generation.
for (int gen_idx = 0; gen_idx <= max_generation; gen_idx++)
@@ -29779,6 +29819,12 @@ heap_segment* gc_heap::allocate_new_region (gc_heap* hp, int gen_num, bool uoh_p
heap_segment* res = make_heap_segment (start, (end - start), hp, gen_num);
dprintf (REGIONS_LOG, ("got a new region %Ix %Ix->%Ix", (size_t)res, start, end));
+
+ if (res == nullptr)
+ {
+ global_region_allocator.delete_region (start);
+ }
+
return res;
}
@@ -32927,6 +32973,11 @@ void gc_heap::decommit_mark_array_by_seg (heap_segment* seg)
}
}
+bool gc_heap::should_update_end_mark_size()
+{
+ return ((settings.condemned_generation == (max_generation - 1)) && (current_c_gc_state == c_gc_state_planning));
+}
+
void gc_heap::background_mark_phase ()
{
verify_mark_array_cleared();
@@ -33001,6 +33052,7 @@ void gc_heap::background_mark_phase ()
bgc_begin_poh_size = total_poh_size;
bgc_loh_size_increased = 0;
bgc_poh_size_increased = 0;
+ background_soh_size_end_mark = 0;
dprintf (GTC_LOG, ("BM: h%d: loh: %Id, soh: %Id, poh: %Id", heap_number, total_loh_size, total_soh_size, total_poh_size));
@@ -33481,6 +33533,8 @@ void gc_heap::background_mark_phase ()
heap_segment_background_allocated (seg) = heap_segment_allocated (seg);
}
+ background_soh_size_end_mark += heap_segment_background_allocated (seg) - heap_segment_mem (seg);
+
dprintf (3333, ("h%d gen%d seg %Ix (%Ix) background allocated is %Ix",
heap_number, i, (size_t)(seg), heap_segment_mem (seg),
heap_segment_background_allocated (seg)));
@@ -45097,11 +45151,11 @@ size_t GCHeap::GetTotalBytesInUse ()
for (int i = 0; i < gc_heap::n_heaps; i++)
{
GCHeap* Hp = gc_heap::g_heaps [i]->vm_heap;
- tot_size += Hp->ApproxTotalBytesInUse (FALSE);
+ tot_size += Hp->ApproxTotalBytesInUse();
}
return tot_size;
#else
- return ApproxTotalBytesInUse ();
+ return ApproxTotalBytesInUse();
#endif //MULTIPLE_HEAPS
}
@@ -45156,58 +45210,58 @@ size_t GCHeap::ApproxTotalBytesInUse(BOOL small_heap_only)
size_t totsize = 0;
enter_spin_lock (&pGenGCHeap->gc_lock);
- // the complication with the following code is that background GC may
- // remove the ephemeral segment while we are iterating
- // if so, we retry a couple times and ultimately may report a slightly wrong result
- for (int tries = 1; tries <= 3; tries++)
+ // For gen0 it's a bit complicated because we are currently allocating in it. We get the fragmentation first
+ // just so that we don't give a negative number for the resulting size.
+ generation* gen = pGenGCHeap->generation_of (0);
+ size_t gen0_frag = generation_free_list_space (gen) + generation_free_obj_space (gen);
+ uint8_t* current_alloc_allocated = pGenGCHeap->alloc_allocated;
+ heap_segment* current_eph_seg = pGenGCHeap->ephemeral_heap_segment;
+ size_t gen0_size = 0;
+#ifdef USE_REGIONS
+ heap_segment* gen0_seg = generation_start_segment (gen);
+ while (gen0_seg)
{
- heap_segment* eph_seg = generation_allocation_segment (pGenGCHeap->generation_of (0));
- // Get small block heap size info
- totsize = (pGenGCHeap->alloc_allocated - heap_segment_mem (eph_seg));
- heap_segment* seg1 = generation_start_segment (pGenGCHeap->generation_of (max_generation));
- while ((seg1 != eph_seg) && (seg1 != nullptr)
-#ifdef BACKGROUND_GC
- && (seg1 != pGenGCHeap->freeable_soh_segment)
-#endif //BACKGROUND_GC
- )
+ uint8_t* end = in_range_for_segment (current_alloc_allocated, gen0_seg) ?
+ current_alloc_allocated : heap_segment_allocated (gen0_seg);
+ gen0_size += end - heap_segment_mem (gen0_seg);
+
+ if (gen0_seg == current_eph_seg)
{
-#ifdef BACKGROUND_GC
- if (!heap_segment_decommitted_p (seg1))
-#endif //BACKGROUND_GC
- {
- totsize += heap_segment_allocated (seg1) -
- heap_segment_mem (seg1);
- }
- seg1 = heap_segment_next (seg1);
- }
- if (seg1 == eph_seg)
break;
+ }
+
+ gen0_seg = heap_segment_next (gen0_seg);
}
+#else //USE_REGIONS
+ // For segments ephemeral seg does not change.
+ gen0_size = current_alloc_allocated - heap_segment_mem (current_eph_seg);
+#endif //USE_REGIONS
- //discount the fragmentation
- for (int i = 0; i <= max_generation; i++)
+ totsize = gen0_size - gen0_frag;
+
+ int stop_gen_index = max_generation;
+
+ if (gc_heap::current_c_gc_state == c_gc_state_planning)
+ {
+ // During BGC sweep since we can be deleting SOH segments, we avoid walking the segment
+ // list.
+ generation* oldest_gen = pGenGCHeap->generation_of (max_generation);
+ totsize = pGenGCHeap->background_soh_size_end_mark - generation_free_list_space (oldest_gen) - generation_free_obj_space (oldest_gen);
+ stop_gen_index--;
+ }
+
+ for (int i = (max_generation - 1); i <= stop_gen_index; i++)
{
generation* gen = pGenGCHeap->generation_of (i);
- totsize -= (generation_free_list_space (gen) + generation_free_obj_space (gen));
+ totsize += pGenGCHeap->generation_size (i) - generation_free_list_space (gen) - generation_free_obj_space (gen);
}
if (!small_heap_only)
{
for (int i = uoh_start_generation; i < total_generation_count; i++)
{
- heap_segment* seg2 = generation_start_segment (pGenGCHeap->generation_of (i));
-
- while (seg2 != 0)
- {
- totsize += heap_segment_allocated (seg2) -
- heap_segment_mem (seg2);
- seg2 = heap_segment_next (seg2);
- }
-
- //discount the fragmentation
- generation* uoh_gen = pGenGCHeap->generation_of (i);
- size_t frag = generation_free_list_space (uoh_gen) + generation_free_obj_space (uoh_gen);
- totsize -= frag;
+ generation* gen = pGenGCHeap->generation_of (i);
+ totsize += pGenGCHeap->generation_size (i) - generation_free_list_space (gen) - generation_free_obj_space (gen);
}
}
leave_spin_lock (&pGenGCHeap->gc_lock);
diff --git a/src/coreclr/gc/gcinterface.dac.h b/src/coreclr/gc/gcinterface.dac.h
index cfffcf1221a811..c7d72c7145baf4 100644
--- a/src/coreclr/gc/gcinterface.dac.h
+++ b/src/coreclr/gc/gcinterface.dac.h
@@ -111,7 +111,7 @@ enum oom_reason
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
/* If you modify failure_get_memory and */
/* oom_reason be sure to make the corresponding */
-/* changes in toolbox\sos\strike\strike.cpp. */
+/* changes in tools\sos\strike\strike.cpp. */
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
enum failure_get_memory
{
diff --git a/src/coreclr/gc/gcpriv.h b/src/coreclr/gc/gcpriv.h
index 081b9a539c073c..14bf3ef2908895 100644
--- a/src/coreclr/gc/gcpriv.h
+++ b/src/coreclr/gc/gcpriv.h
@@ -51,8 +51,8 @@ inline void FATAL_GC_ERROR()
//
// This means any empty regions can be freely used for any generation. For
// Server GC we will balance regions between heaps.
-// For now enable regions by default for only StandAlone GC builds
-#if defined (HOST_64BIT) && defined (BUILD_AS_STANDALONE)
+// For now disable regions StandAlone GC builds
+#if defined (HOST_64BIT) && !defined (BUILD_AS_STANDALONE)
#define USE_REGIONS
#endif //HOST_64BIT && BUILD_AS_STANDALONE
@@ -3440,6 +3440,9 @@ class gc_heap
PER_HEAP
void decommit_mark_array_by_seg (heap_segment* seg);
+ PER_HEAP_ISOLATED
+ bool should_update_end_mark_size();
+
PER_HEAP
void background_mark_phase();
@@ -4268,6 +4271,9 @@ class gc_heap
PER_HEAP
size_t bgc_poh_size_increased;
+ PER_HEAP
+ size_t background_soh_size_end_mark;
+
PER_HEAP
size_t background_soh_alloc_count;
diff --git a/src/coreclr/gc/unix/gcenv.unix.cpp b/src/coreclr/gc/unix/gcenv.unix.cpp
index 895d2afdf395a9..2d979c395610e9 100644
--- a/src/coreclr/gc/unix/gcenv.unix.cpp
+++ b/src/coreclr/gc/unix/gcenv.unix.cpp
@@ -28,6 +28,10 @@
#undef min
#undef max
+#ifndef __has_cpp_attribute
+#define __has_cpp_attribute(x) (0)
+#endif
+
#if __has_cpp_attribute(fallthrough)
#define FALLTHROUGH [[fallthrough]]
#else
@@ -98,7 +102,7 @@ extern "C"
# define __NR_membarrier 389
# elif defined(__aarch64__)
# define __NR_membarrier 283
-# elif
+# else
# error Unknown architecture
# endif
# endif
diff --git a/src/coreclr/hosts/corerun/dotenv.cpp b/src/coreclr/hosts/corerun/dotenv.cpp
index ba22f5004713d0..0e0e37c7919b0a 100644
--- a/src/coreclr/hosts/corerun/dotenv.cpp
+++ b/src/coreclr/hosts/corerun/dotenv.cpp
@@ -4,10 +4,13 @@
#include "dotenv.hpp"
#include
#include
-#include
#include
#include
+#ifdef TARGET_WINDOWS
+#include
+#endif
+
namespace
{
pal::string_t convert_to_string_t(std::string str)
diff --git a/src/coreclr/hosts/coreshim/CoreShim.cpp b/src/coreclr/hosts/coreshim/CoreShim.cpp
index 62ab011df12155..23265e5872b3f6 100644
--- a/src/coreclr/hosts/coreshim/CoreShim.cpp
+++ b/src/coreclr/hosts/coreshim/CoreShim.cpp
@@ -375,7 +375,7 @@ HRESULT coreclr::Initialize(
HMODULE mod = ::GetModuleHandleW(W("CoreRun.exe"));
if (mod != NULL)
{
- using GetCurrentClrDetailsFunc = HRESULT(*)(void **clrInstance, unsigned int *appDomainId);
+ using GetCurrentClrDetailsFunc = HRESULT(__cdecl *)(void **clrInstance, unsigned int *appDomainId);
auto getCurrentClrDetails = (GetCurrentClrDetailsFunc)::GetProcAddress(mod, "GetCurrentClrDetails");
RETURN_IF_FAILED(getCurrentClrDetails(&_clrInst, &_appDomainId));
if (_clrInst != nullptr)
diff --git a/src/coreclr/ilasm/asmman.cpp b/src/coreclr/ilasm/asmman.cpp
index 7b5fd474b65157..447267d0b4d252 100644
--- a/src/coreclr/ilasm/asmman.cpp
+++ b/src/coreclr/ilasm/asmman.cpp
@@ -49,7 +49,7 @@ BinStr* BinStrToUnicode(BinStr* pSource, bool Swap)
return NULL;
}
-AsmManFile* AsmMan::GetFileByName(__in __nullterminated char* szFileName)
+AsmManFile* AsmMan::GetFileByName(_In_ __nullterminated char* szFileName)
{
AsmManFile* ret = NULL;
if(szFileName)
@@ -63,14 +63,14 @@ AsmManFile* AsmMan::GetFileByName(__in __nullterminated char* szFileName
return ret;
}
-mdToken AsmMan::GetFileTokByName(__in __nullterminated char* szFileName)
+mdToken AsmMan::GetFileTokByName(_In_ __nullterminated char* szFileName)
{
AsmManFile* tmp = GetFileByName(szFileName);
return(tmp ? tmp->tkTok : mdFileNil);
}
-AsmManComType* AsmMan::GetComTypeByName(__in_opt __nullterminated char* szComTypeName,
- __in_opt __nullterminated char* szComEnclosingTypeName)
+AsmManComType* AsmMan::GetComTypeByName(_In_opt_z_ char* szComTypeName,
+ _In_opt_z_ char* szComEnclosingTypeName)
{
AsmManComType* ret = NULL;
if(szComTypeName)
@@ -102,14 +102,14 @@ AsmManComType* AsmMan::GetComTypeByName(__in_opt __nullterminated char*
}
mdToken AsmMan::GetComTypeTokByName(
- __in_opt __nullterminated char* szComTypeName,
- __in_opt __nullterminated char* szComEnclosingTypeName)
+ _In_opt_z_ char* szComTypeName,
+ _In_opt_z_ char* szComEnclosingTypeName)
{
AsmManComType* tmp = GetComTypeByName(szComTypeName, szComEnclosingTypeName);
return(tmp ? tmp->tkTok : mdExportedTypeNil);
}
-AsmManAssembly* AsmMan::GetAsmRefByName(__in __nullterminated const char* szAsmRefName)
+AsmManAssembly* AsmMan::GetAsmRefByName(_In_ __nullterminated const char* szAsmRefName)
{
AsmManAssembly* ret = NULL;
if(szAsmRefName)
@@ -124,12 +124,12 @@ AsmManAssembly* AsmMan::GetAsmRefByName(__in __nullterminated const char* sz
}
return ret;
}
-mdToken AsmMan::GetAsmRefTokByName(__in __nullterminated const char* szAsmRefName)
+mdToken AsmMan::GetAsmRefTokByName(_In_ __nullterminated const char* szAsmRefName)
{
AsmManAssembly* tmp = GetAsmRefByName(szAsmRefName);
return(tmp ? tmp->tkTok : mdAssemblyRefNil);
}
-AsmManAssembly* AsmMan::GetAsmRefByAsmName(__in __nullterminated const char* szAsmName)
+AsmManAssembly* AsmMan::GetAsmRefByAsmName(_In_ __nullterminated const char* szAsmName)
{
AsmManAssembly* ret = NULL;
if(szAsmName)
@@ -160,7 +160,7 @@ void AsmMan::SetModuleName(__inout_opt __nullterminated char* szName)
}
//==============================================================================================================
-void AsmMan::AddFile(__in __nullterminated char* szName, DWORD dwAttr, BinStr* pHashBlob)
+void AsmMan::AddFile(_In_ __nullterminated char* szName, DWORD dwAttr, BinStr* pHashBlob)
{
AsmManFile* tmp = GetFileByName(szName);
Assembler* pAsm = (Assembler*)m_pAssembler;
@@ -244,7 +244,7 @@ void AsmMan::EmitFiles()
} //end for(i = 0; tmp=m_FileLst.PEEK(i); i++)
}
-void AsmMan::StartAssembly(__in __nullterminated char* szName, __in_opt __nullterminated char* szAlias, DWORD dwAttr, BOOL isRef)
+void AsmMan::StartAssembly(_In_ __nullterminated char* szName, _In_opt_z_ char* szAlias, DWORD dwAttr, BOOL isRef)
{
if(!isRef && (0==strcmp(szName, "mscorlib"))) ((Assembler*)m_pAssembler)->m_fIsMscorlib = TRUE;
if(!isRef && (m_pAssembly != NULL))
@@ -674,7 +674,7 @@ void AsmMan::SetAssemblyAutodetect()
}
}
-void AsmMan::StartComType(__in __nullterminated char* szName, DWORD dwAttr)
+void AsmMan::StartComType(_In_ __nullterminated char* szName, DWORD dwAttr)
{
if((m_pCurComType = new AsmManComType))
{
@@ -732,7 +732,7 @@ void AsmMan::EndComType()
}
}
-void AsmMan::SetComTypeFile(__in __nullterminated char* szFileName)
+void AsmMan::SetComTypeFile(_In_ __nullterminated char* szFileName)
{
if(m_pCurComType)
{
@@ -740,7 +740,7 @@ void AsmMan::SetComTypeFile(__in __nullterminated char* szFileName)
}
}
-void AsmMan::SetComTypeAsmRef(__in __nullterminated char* szAsmRefName)
+void AsmMan::SetComTypeAsmRef(_In_ __nullterminated char* szAsmRefName)
{
if(m_pCurComType)
{
@@ -748,7 +748,7 @@ void AsmMan::SetComTypeAsmRef(__in __nullterminated char* szAsmRefName)
}
}
-void AsmMan::SetComTypeComType(__in __nullterminated char* szComTypeName)
+void AsmMan::SetComTypeComType(_In_ __nullterminated char* szComTypeName)
{
if(m_pCurComType)
{
@@ -780,7 +780,7 @@ BOOL AsmMan::SetComTypeClassTok(mdToken tkClass)
return FALSE;
}
-void AsmMan::StartManifestRes(__in __nullterminated char* szName, __in __nullterminated char* szAlias, DWORD dwAttr)
+void AsmMan::StartManifestRes(_In_ __nullterminated char* szName, _In_ __nullterminated char* szAlias, DWORD dwAttr)
{
if((m_pCurManRes = new AsmManRes))
{
@@ -808,7 +808,7 @@ void AsmMan::EndManifestRes()
}
-void AsmMan::SetManifestResFile(__in __nullterminated char* szFileName, ULONG ulOffset)
+void AsmMan::SetManifestResFile(_In_ __nullterminated char* szFileName, ULONG ulOffset)
{
if(m_pCurManRes)
{
@@ -817,7 +817,7 @@ void AsmMan::SetManifestResFile(__in __nullterminated char* szFileName, ULONG
}
}
-void AsmMan::SetManifestResAsmRef(__in __nullterminated char* szAsmRefName)
+void AsmMan::SetManifestResAsmRef(_In_ __nullterminated char* szAsmRefName)
{
if(m_pCurManRes)
{
diff --git a/src/coreclr/ilasm/asmman.hpp b/src/coreclr/ilasm/asmman.hpp
index 1290c9b2707c8a..972c8382434f8e 100644
--- a/src/coreclr/ilasm/asmman.hpp
+++ b/src/coreclr/ilasm/asmman.hpp
@@ -193,12 +193,12 @@ class AsmMan
ErrorReporter* report;
void* m_pAssembler;
- AsmManFile* GetFileByName(__in __nullterminated char* szFileName);
- AsmManAssembly* GetAsmRefByName(__in __nullterminated const char* szAsmRefName);
- AsmManComType* GetComTypeByName(__in_opt __nullterminated char* szComTypeName,
- __in_opt __nullterminated char* szComEnclosingTypeName = NULL);
- mdToken GetComTypeTokByName(__in_opt __nullterminated char* szComTypeName,
- __in_opt __nullterminated char* szComEnclosingTypeName = NULL);
+ AsmManFile* GetFileByName(_In_ __nullterminated char* szFileName);
+ AsmManAssembly* GetAsmRefByName(_In_ __nullterminated const char* szAsmRefName);
+ AsmManComType* GetComTypeByName(_In_opt_z_ char* szComTypeName,
+ _In_opt_z_ char* szComEnclosingTypeName = NULL);
+ mdToken GetComTypeTokByName(_In_opt_z_ char* szComTypeName,
+ _In_opt_z_ char* szComEnclosingTypeName = NULL);
IMetaDataEmit* m_pEmitter;
@@ -241,11 +241,11 @@ class AsmMan
void SetModuleName(__inout_opt __nullterminated char* szName);
- void AddFile(__in __nullterminated char* szName, DWORD dwAttr, BinStr* pHashBlob);
+ void AddFile(_In_ __nullterminated char* szName, DWORD dwAttr, BinStr* pHashBlob);
void EmitFiles();
void EmitDebuggableAttribute(mdToken tkOwner);
- void StartAssembly(__in __nullterminated char* szName, __in_opt __nullterminated char* szAlias, DWORD dwAttr, BOOL isRef);
+ void StartAssembly(_In_ __nullterminated char* szName, _In_opt_z_ char* szAlias, DWORD dwAttr, BOOL isRef);
void EndAssembly();
void EmitAssemblyRefs();
void EmitAssembly();
@@ -257,27 +257,27 @@ class AsmMan
void SetAssemblyHashBlob(BinStr* pHashBlob);
void SetAssemblyAutodetect();
- void StartComType(__in __nullterminated char* szName, DWORD dwAttr);
+ void StartComType(_In_ __nullterminated char* szName, DWORD dwAttr);
void EndComType();
- void SetComTypeFile(__in __nullterminated char* szFileName);
- void SetComTypeAsmRef(__in __nullterminated char* szAsmRefName);
- void SetComTypeComType(__in __nullterminated char* szComTypeName);
+ void SetComTypeFile(_In_ __nullterminated char* szFileName);
+ void SetComTypeAsmRef(_In_ __nullterminated char* szAsmRefName);
+ void SetComTypeComType(_In_ __nullterminated char* szComTypeName);
BOOL SetComTypeImplementationTok(mdToken tk);
BOOL SetComTypeClassTok(mdToken tkClass);
- void StartManifestRes(__in __nullterminated char* szName, __in __nullterminated char* szAlias, DWORD dwAttr);
+ void StartManifestRes(_In_ __nullterminated char* szName, _In_ __nullterminated char* szAlias, DWORD dwAttr);
void EndManifestRes();
- void SetManifestResFile(__in __nullterminated char* szFileName, ULONG ulOffset);
- void SetManifestResAsmRef(__in __nullterminated char* szAsmRefName);
+ void SetManifestResFile(_In_ __nullterminated char* szFileName, ULONG ulOffset);
+ void SetManifestResAsmRef(_In_ __nullterminated char* szAsmRefName);
- AsmManAssembly* GetAsmRefByAsmName(__in __nullterminated const char* szAsmName);
+ AsmManAssembly* GetAsmRefByAsmName(_In_ __nullterminated const char* szAsmName);
- mdToken GetFileTokByName(__in __nullterminated char* szFileName);
- mdToken GetAsmRefTokByName(__in __nullterminated const char* szAsmRefName);
- mdToken GetAsmTokByName(__in __nullterminated const char* szAsmName)
+ mdToken GetFileTokByName(_In_ __nullterminated char* szFileName);
+ mdToken GetAsmRefTokByName(_In_ __nullterminated const char* szAsmRefName);
+ mdToken GetAsmTokByName(_In_ __nullterminated const char* szAsmName)
{ return (m_pAssembly && (strcmp(m_pAssembly->szName,szAsmName)==0)) ? m_pAssembly->tkTok : 0; };
- mdToken GetModuleRefTokByName(__in __nullterminated char* szName)
+ mdToken GetModuleRefTokByName(_In_ __nullterminated char* szName)
{
if(szName && *szName)
{
diff --git a/src/coreclr/ilasm/asmparse.h b/src/coreclr/ilasm/asmparse.h
index ef377b5e430d7c..e5479202730033 100644
--- a/src/coreclr/ilasm/asmparse.h
+++ b/src/coreclr/ilasm/asmparse.h
@@ -20,11 +20,11 @@ class ReadStream {
virtual ~ReadStream() = default;
- virtual unsigned getAll(__out char** ppch) = 0;
+ virtual unsigned getAll(_Out_ char** ppch) = 0;
// read at most 'buffLen' bytes into 'buff', Return the
// number of characters read. On EOF return 0
- virtual unsigned read(__out_ecount(buffLen) char* buff, unsigned buffLen) = 0;
+ virtual unsigned read(_Out_writes_(buffLen) char* buff, unsigned buffLen) = 0;
// Return the name of the stream, (for error reporting).
//virtual const char* name() = 0;
@@ -49,12 +49,12 @@ class BinStrStream : public ReadStream {
//if(m_pBS)
// delete m_pBS;
};
- unsigned getAll(__out char **ppbuff)
+ unsigned getAll(_Out_ char **ppbuff)
{
*ppbuff = m_pStart;
return m_pBS->length();
};
- unsigned read(__out_ecount(buffLen) char* buff, unsigned buffLen)
+ unsigned read(_Out_writes_(buffLen) char* buff, unsigned buffLen)
{
_ASSERTE(m_pStart != NULL);
unsigned Remainder = (unsigned)(m_pEnd - m_pCurr);
@@ -95,7 +95,7 @@ class BinStrStream : public ReadStream {
/**************************************************************************/
class MappedFileStream : public ReadStream {
public:
- MappedFileStream(__in __nullterminated WCHAR* wFileName)
+ MappedFileStream(_In_ __nullterminated WCHAR* wFileName)
{
fileNameW = wFileName;
m_hFile = INVALID_HANDLE_VALUE;
@@ -124,12 +124,12 @@ class MappedFileStream : public ReadStream {
fileNameW = NULL;
}
}
- unsigned getAll(__out char** pbuff)
+ unsigned getAll(_Out_ char** pbuff)
{
*pbuff = m_pStart;
return m_FileSize;
}
- unsigned read(__out_ecount(buffLen) char* buff, unsigned buffLen)
+ unsigned read(_Out_writes_(buffLen) char* buff, unsigned buffLen)
{
_ASSERTE(m_pStart != NULL);
unsigned Remainder = (unsigned)(m_pEnd - m_pCurr);
@@ -214,29 +214,29 @@ typedef LIFO ARG_NAME_LIST_STACK;
/*--------------------------------------------------------------------------*/
typedef char*(*PFN_NEXTCHAR)(char*);
-char* nextcharU(__in __nullterminated char* pos);
-char* nextcharW(__in __nullterminated char* pos);
+char* nextcharU(_In_ __nullterminated char* pos);
+char* nextcharW(_In_ __nullterminated char* pos);
/*--------------------------------------------------------------------------*/
typedef unsigned(*PFN_SYM)(char*);
-unsigned SymAU(__in __nullterminated char* curPos);
-unsigned SymW(__in __nullterminated char* curPos);
+unsigned SymAU(_In_ __nullterminated char* curPos);
+unsigned SymW(_In_ __nullterminated char* curPos);
/*--------------------------------------------------------------------------*/
typedef char*(*PFN_NEWSTRFROMTOKEN)(char*,size_t);
-char* NewStrFromTokenAU(__in_ecount(tokLen) char* curTok, size_t tokLen);
-char* NewStrFromTokenW(__in_ecount(tokLen) char* curTok, size_t tokLen);
+char* NewStrFromTokenAU(_In_reads_(tokLen) char* curTok, size_t tokLen);
+char* NewStrFromTokenW(_In_reads_(tokLen) char* curTok, size_t tokLen);
/*--------------------------------------------------------------------------*/
typedef char*(*PFN_NEWSTATICSTRFROMTOKEN)(char*,size_t,char*,size_t);
-char* NewStaticStrFromTokenAU(__in_ecount(tokLen) char* curTok, size_t tokLen, __out_ecount(bufSize) char* staticBuf, size_t bufSize);
-char* NewStaticStrFromTokenW(__in_ecount(tokLen) char* curTok, size_t tokLen, __out_ecount(bufSize) char* staticBuf, size_t bufSize);
+char* NewStaticStrFromTokenAU(_In_reads_(tokLen) char* curTok, size_t tokLen, _Out_writes_(bufSize) char* staticBuf, size_t bufSize);
+char* NewStaticStrFromTokenW(_In_reads_(tokLen) char* curTok, size_t tokLen, _Out_writes_(bufSize) char* staticBuf, size_t bufSize);
/*--------------------------------------------------------------------------*/
typedef unsigned(*PFN_GETDOUBLE)(char*,unsigned,double**);
-unsigned GetDoubleAU(__in __nullterminated char* begNum, unsigned L, double** ppRes);
-unsigned GetDoubleW(__in __nullterminated char* begNum, unsigned L, double** ppRes);
+unsigned GetDoubleAU(_In_ __nullterminated char* begNum, unsigned L, double** ppRes);
+unsigned GetDoubleW(_In_ __nullterminated char* begNum, unsigned L, double** ppRes);
/*--------------------------------------------------------------------------*/
struct PARSING_ENVIRONMENT
{
@@ -284,9 +284,9 @@ class AsmParse : public ErrorReporter
virtual void warn(const char* fmt, ...);
virtual void msg(const char* fmt, ...);
char *getLine(int lineNum) { return penv->in->getLine(lineNum); };
- unsigned getAll(__out char** pbuff) { return penv->in->getAll(pbuff); };
+ unsigned getAll(_Out_ char** pbuff) { return penv->in->getAll(pbuff); };
bool Success() {return success; };
- void SetIncludePath(__in WCHAR* wz) { wzIncludePath = wz; };
+ void SetIncludePath(_In_ WCHAR* wz) { wzIncludePath = wz; };
ARG_NAME_LIST_STACK m_ANSFirst;
ARG_NAME_LIST_STACK m_ANSLast;
@@ -298,20 +298,20 @@ class AsmParse : public ErrorReporter
BinStr* MakeTypeClass(CorElementType kind, mdToken tk);
BinStr* MakeTypeArray(CorElementType kind, BinStr* elemType, BinStr* bounds);
- char* fillBuff(__in_opt __nullterminated char* curPos); // refill the input buffer
+ char* fillBuff(_In_opt_z_ char* curPos); // refill the input buffer
HANDLE hstdout;
HANDLE hstderr;
private:
- friend void yyerror(__in __nullterminated const char* str);
+ friend void yyerror(_In_ __nullterminated const char* str);
friend int parse_literal(unsigned curSym, __inout __nullterminated char* &curPos, BOOL translate_escapes);
friend int yyparse();
friend int yylex();
friend Instr* SetupInstr(unsigned short opcode);
friend int findKeyword(const char* name, size_t nameLen, unsigned short* opcode);
- friend TypeDefDescr* findTypedef(__in_ecount(nameLen) char* name, size_t nameLen);
- friend char* skipBlanks(__in __nullterminated char*,unsigned*);
- friend char* nextBlank(__in __nullterminated char*);
+ friend TypeDefDescr* findTypedef(_In_reads_(nameLen) char* name, size_t nameLen);
+ friend char* skipBlanks(_In_ __nullterminated char*,unsigned*);
+ friend char* nextBlank(_In_ __nullterminated char*);
friend int ProcessEOF();
friend unsigned __int8* skipType(unsigned __int8* ptr, BOOL fFixupType);
friend void FixupConstraints();
diff --git a/src/coreclr/ilasm/assem.cpp b/src/coreclr/ilasm/assem.cpp
index e8044d16ab2b7f..e58b8e569d8d34 100644
--- a/src/coreclr/ilasm/assem.cpp
+++ b/src/coreclr/ilasm/assem.cpp
@@ -1039,7 +1039,7 @@ BOOL Assembler::EmitProp(PropDescriptor* pPD)
return TRUE;
}
-Class *Assembler::FindCreateClass(__in __nullterminated const char *pszFQN)
+Class *Assembler::FindCreateClass(_In_ __nullterminated const char *pszFQN)
{
Class *pSearch = NULL;
@@ -1186,7 +1186,7 @@ BOOL Assembler::DoGlobalFixups()
return TRUE;
}
-state_t Assembler::AddGlobalLabel(__in __nullterminated char *pszName, HCEESECTION section)
+state_t Assembler::AddGlobalLabel(_In_ __nullterminated char *pszName, HCEESECTION section)
{
if (FindGlobalLabel(pszName) != NULL)
{
@@ -1213,7 +1213,7 @@ state_t Assembler::AddGlobalLabel(__in __nullterminated char *pszName, HCEESECTI
return m_State;
}
-void Assembler::AddLabel(DWORD CurPC, __in __nullterminated char *pszName)
+void Assembler::AddLabel(DWORD CurPC, _In_ __nullterminated char *pszName)
{
if (m_pCurMethod->FindLabel(pszName) != NULL)
{
@@ -1478,7 +1478,7 @@ acceptable. Do NOT use for cryptographic purposes.
*/
unsigned hash(
- __in_ecount(length) const BYTE *k, /* the key */
+ _In_reads_(length) const BYTE *k, /* the key */
unsigned length, /* the length of the key */
unsigned initval) /* the previous hash, or an arbitrary value */
{
diff --git a/src/coreclr/ilasm/assembler.cpp b/src/coreclr/ilasm/assembler.cpp
index 48f9487656f7cf..85183bfae7542b 100644
--- a/src/coreclr/ilasm/assembler.cpp
+++ b/src/coreclr/ilasm/assembler.cpp
@@ -15,7 +15,7 @@
#define FAIL_UNLESS(x, y) if (!(x)) { report->error y; return; }
/**************************************************************************/
-void Assembler::StartNameSpace(__in __nullterminated char* name)
+void Assembler::StartNameSpace(_In_ __nullterminated char* name)
{
m_NSstack.PUSH(m_szNamespace);
m_szNamespace = name;
@@ -91,7 +91,7 @@ void Assembler::ClearBoundList(void)
m_TyParList = NULL;
}
/**************************************************************************/
-mdToken Assembler::ResolveClassRef(mdToken tkResScope, __in __nullterminated const char *pszFullClassName, Class** ppClass)
+mdToken Assembler::ResolveClassRef(mdToken tkResScope, _In_ __nullterminated const char *pszFullClassName, Class** ppClass)
{
Class *pClass = NULL;
mdToken tkRet = mdTokenNil;
@@ -239,7 +239,7 @@ mdToken Assembler::ResolveTypeSpec(BinStr* typeSpec)
}
/**************************************************************************/
-mdToken Assembler::GetAsmRef(__in __nullterminated const char* szName)
+mdToken Assembler::GetAsmRef(_In_ __nullterminated const char* szName)
{
mdToken tkResScope = 0;
if(strcmp(szName,"*")==0) tkResScope = mdTokenNil;
@@ -330,7 +330,7 @@ mdToken Assembler::GetInterfaceImpl(mdToken tsClass, mdToken tsInterface)
}
/**************************************************************************/
-mdToken Assembler::GetModRef(__in __nullterminated char* szName)
+mdToken Assembler::GetModRef(_In_ __nullterminated char* szName)
{
mdToken tkResScope = 0;
if(!strcmp(szName,m_szScopeName))
@@ -417,7 +417,7 @@ DWORD Assembler::CheckClassFlagsIfNested(Class* pEncloser, DWORD attr)
/**************************************************************************/
-void Assembler::StartClass(__in __nullterminated char* name, DWORD attr, TyParList *typars)
+void Assembler::StartClass(_In_ __nullterminated char* name, DWORD attr, TyParList *typars)
{
Class *pEnclosingClass = m_pCurClass;
char *szFQN;
@@ -607,7 +607,7 @@ void Assembler::SetPinvoke(BinStr* DllName, int Ordinal, BinStr* Alias, int Attr
}
/**************************************************************************/
-void Assembler::StartMethod(__in __nullterminated char* name, BinStr* sig, CorMethodAttr flags, BinStr* retMarshal, DWORD retAttr, TyParList *typars)
+void Assembler::StartMethod(_In_ __nullterminated char* name, BinStr* sig, CorMethodAttr flags, BinStr* retMarshal, DWORD retAttr, TyParList *typars)
{
if (m_pCurMethod != NULL)
{
@@ -801,7 +801,7 @@ void Assembler::EndMethod()
}
/**************************************************************************/
/* rvaLabel is the optional label that indicates this field points at a particular RVA */
-void Assembler::AddField(__inout_z __inout char* name, BinStr* sig, CorFieldAttr flags, __in __nullterminated char* rvaLabel, BinStr* pVal, ULONG ulOffset)
+void Assembler::AddField(__inout_z __inout char* name, BinStr* sig, CorFieldAttr flags, _In_ __nullterminated char* rvaLabel, BinStr* pVal, ULONG ulOffset)
{
FieldDescriptor* pFD;
ULONG i,n;
@@ -1030,7 +1030,7 @@ void Assembler::NewSEHDescriptor(void) //sets m_SEHD
if(m_SEHD == NULL) report->error("Failed to allocate SEH descriptor\n");
}
/**************************************************************************/
-void Assembler::SetTryLabels(__in __nullterminated char * szFrom, __in __nullterminated char *szTo)
+void Assembler::SetTryLabels(_In_ __nullterminated char * szFrom, _In_ __nullterminated char *szTo)
{
if(!m_SEHD) return;
Label *pLbl = m_pCurMethod->FindLabel(szFrom);
@@ -1043,7 +1043,7 @@ void Assembler::SetTryLabels(__in __nullterminated char * szFrom, __in __nullter
else report->error("Undefined 1st label in 'try
-
+
diff --git a/src/coreclr/nativeaot/Runtime/CommonMacros.h b/src/coreclr/nativeaot/Runtime/CommonMacros.h
index bfa6f2e1e3fc76..271980b5c1ad71 100644
--- a/src/coreclr/nativeaot/Runtime/CommonMacros.h
+++ b/src/coreclr/nativeaot/Runtime/CommonMacros.h
@@ -5,6 +5,7 @@
#define __COMMONMACROS_H__
#include "rhassert.h"
+#include
#define EXTERN_C extern "C"
@@ -33,12 +34,6 @@
#endif // _MSC_VER
-#ifndef COUNTOF
-template
-char (*COUNTOF_helper(_CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray];
-#define COUNTOF(_Array) sizeof(*COUNTOF_helper(_Array))
-#endif // COUNTOF
-
#ifndef offsetof
#define offsetof(s,m) (uintptr_t)( (intptr_t)&reinterpret_cast((((s *)0)->m)) )
#endif // offsetof
diff --git a/src/coreclr/nativeaot/Runtime/EHHelpers.cpp b/src/coreclr/nativeaot/Runtime/EHHelpers.cpp
index b8108dfa379f96..b888d530c4c5f9 100644
--- a/src/coreclr/nativeaot/Runtime/EHHelpers.cpp
+++ b/src/coreclr/nativeaot/Runtime/EHHelpers.cpp
@@ -92,7 +92,7 @@ COOP_PINVOKE_HELPER(int32_t, RhGetModuleFileName, (HANDLE moduleHandle, _Out_ co
COOP_PINVOKE_HELPER(void, RhpCopyContextFromExInfo, (void * pOSContext, int32_t cbOSContext, PAL_LIMITED_CONTEXT * pPalContext))
{
UNREFERENCED_PARAMETER(cbOSContext);
- ASSERT(cbOSContext >= sizeof(CONTEXT));
+ ASSERT((size_t)cbOSContext >= sizeof(CONTEXT));
CONTEXT* pContext = (CONTEXT *)pOSContext;
#if defined(UNIX_AMD64_ABI)
pContext->Rip = pPalContext->IP;
diff --git a/src/coreclr/nativeaot/Runtime/IntrinsicConstants.h b/src/coreclr/nativeaot/Runtime/IntrinsicConstants.h
index d3ea7a17bc0423..8ce413315e81c6 100644
--- a/src/coreclr/nativeaot/Runtime/IntrinsicConstants.h
+++ b/src/coreclr/nativeaot/Runtime/IntrinsicConstants.h
@@ -22,6 +22,7 @@ enum XArchIntrinsicConstants
XArchIntrinsicConstants_Bmi1 = 0x0400,
XArchIntrinsicConstants_Bmi2 = 0x0800,
XArchIntrinsicConstants_Lzcnt = 0x1000,
+ XArchIntrinsicConstants_AvxVnni = 0x2000,
};
#endif //HOST_X86 || HOST_AMD64
diff --git a/src/coreclr/nativeaot/Runtime/MathHelpers.cpp b/src/coreclr/nativeaot/Runtime/MathHelpers.cpp
index dfcd1c194b8576..1209e9c5543629 100644
--- a/src/coreclr/nativeaot/Runtime/MathHelpers.cpp
+++ b/src/coreclr/nativeaot/Runtime/MathHelpers.cpp
@@ -33,7 +33,7 @@ EXTERN_C REDHAWK_API float REDHAWK_CALLCONV RhpFltRem(float dividend, float divi
if (divisor==0 || !std::isfinite(dividend))
{
- return -nanf(0);
+ return -nanf("");
}
else if (!std::isfinite(divisor) && !std::isnan(divisor))
{
@@ -57,7 +57,7 @@ EXTERN_C REDHAWK_API double REDHAWK_CALLCONV RhpDblRem(double dividend, double d
//
if (divisor==0 || !std::isfinite(dividend))
{
- return -nan(0);
+ return -nan("");
}
else if (!std::isfinite(divisor) && !std::isnan(divisor))
{
diff --git a/src/coreclr/nativeaot/Runtime/PalRedhawkFunctions.h b/src/coreclr/nativeaot/Runtime/PalRedhawkFunctions.h
index ff58a8ea0dc08d..99b6b4bdbb8c2b 100644
--- a/src/coreclr/nativeaot/Runtime/PalRedhawkFunctions.h
+++ b/src/coreclr/nativeaot/Runtime/PalRedhawkFunctions.h
@@ -80,16 +80,18 @@ inline HANDLE PalGetCurrentThread()
}
#ifdef UNICODE
-extern "C" uint32_t __stdcall GetEnvironmentVariableW(__in_z_opt LPCWSTR, __out_z_opt LPWSTR, uint32_t);
-inline uint32_t PalGetEnvironmentVariable(__in_z_opt LPCWSTR arg1, __out_z_opt LPWSTR arg2, uint32_t arg3)
+_Success_(return != 0 && return < nSize)
+extern "C" uint32_t __stdcall GetEnvironmentVariableW(_In_opt_ LPCWSTR lpName, _Out_writes_to_opt_(nSize, return + 1) LPWSTR lpBuffer, _In_ uint32_t nSize);
+inline uint32_t PalGetEnvironmentVariable(_In_opt_ LPCWSTR lpName, _Out_writes_to_opt_(nSize, return + 1) LPWSTR lpBuffer, _In_ uint32_t nSize)
{
- return GetEnvironmentVariableW(arg1, arg2, arg3);
+ return GetEnvironmentVariableW(lpName, lpBuffer, nSize);
}
#else
-extern "C" uint32_t __stdcall GetEnvironmentVariableA(__in_z_opt LPCSTR, __out_z_opt LPSTR, uint32_t);
-inline uint32_t PalGetEnvironmentVariable(__in_z_opt LPCSTR arg1, __out_z_opt LPSTR arg2, uint32_t arg3)
+_Success_(return != 0 && return < nSize)
+extern "C" uint32_t __stdcall GetEnvironmentVariableA(_In_opt_ LPCSTR lpName, _Out_writes_to_opt_(nSize, return + 1) LPSTR lpBuffer, _In_ uint32_t nSize);
+inline uint32_t PalGetEnvironmentVariable(_In_opt_ LPCSTR lpName, _Out_writes_to_opt_(nSize, return + 1) LPSTR lpBuffer, _In_ uint32_t nSize)
{
- return GetEnvironmentVariableA(arg1, arg2, arg3);
+ return GetEnvironmentVariableA(lpName, lpBuffer, nSize);
}
#endif
diff --git a/src/coreclr/nativeaot/Runtime/RhConfig.cpp b/src/coreclr/nativeaot/Runtime/RhConfig.cpp
index da618a85930e08..e68dc4eaf5d460 100644
--- a/src/coreclr/nativeaot/Runtime/RhConfig.cpp
+++ b/src/coreclr/nativeaot/Runtime/RhConfig.cpp
@@ -118,7 +118,7 @@ uint32_t RhConfig::GetConfigVariable(_In_z_ const TCHAR* configName, const Confi
uint32_t iValue;
- for (iValue = 0; (iValue < CONFIG_VAL_MAXLEN + 1) && (iValue < (int32_t)cchOutputBuffer); iValue++)
+ for (iValue = 0; (iValue < CONFIG_VAL_MAXLEN + 1) && (iValue < cchOutputBuffer); iValue++)
{
outputBuffer[iValue] = configPairs[iSettings].Value[iValue];
diff --git a/src/coreclr/nativeaot/Runtime/eventtrace.cpp b/src/coreclr/nativeaot/Runtime/eventtrace.cpp
index 9d115b2f264b74..23dd9726b5ed2d 100644
--- a/src/coreclr/nativeaot/Runtime/eventtrace.cpp
+++ b/src/coreclr/nativeaot/Runtime/eventtrace.cpp
@@ -3912,7 +3912,7 @@ void ETW::ExceptionLog::ExceptionThrown(CrawlFrame *pCf, BOOL bIsReThrownExcept
/****************************************************************************/
/* This is called by the runtime when a domain is loaded */
/****************************************************************************/
-void ETW::LoaderLog::DomainLoadReal(BaseDomain *pDomain, __in_opt LPWSTR wszFriendlyName)
+void ETW::LoaderLog::DomainLoadReal(BaseDomain *pDomain, _In_opt_ LPWSTR wszFriendlyName)
{
CONTRACTL {
NOTHROW;
@@ -4342,7 +4342,7 @@ void ETW::MethodLog::MethodTableRestored(MethodTable *pMethodTable)
/****************************************************************************/
/* This is called by the runtime when a Strong Name Verification Starts */
/****************************************************************************/
-void ETW::SecurityLog::StrongNameVerificationStart(DWORD dwInFlags, __in LPWSTR strFullyQualifiedAssemblyName)
+void ETW::SecurityLog::StrongNameVerificationStart(DWORD dwInFlags, _In_ LPWSTR strFullyQualifiedAssemblyName)
{
WRAPPER_NO_CONTRACT;
#ifndef FEATURE_CORECLR
@@ -4362,7 +4362,7 @@ void ETW::SecurityLog::StrongNameVerificationStart(DWORD dwInFlags, __in LPWSTR
/****************************************************************************/
/* This is called by the runtime when a Strong Name Verification Ends */
/****************************************************************************/
-void ETW::SecurityLog::StrongNameVerificationStop(DWORD dwInFlags,ULONG result, __in LPWSTR strFullyQualifiedAssemblyName)
+void ETW::SecurityLog::StrongNameVerificationStop(DWORD dwInFlags,ULONG result, _In_ LPWSTR strFullyQualifiedAssemblyName)
{
WRAPPER_NO_CONTRACT;
#ifndef FEATURE_CORECLR
@@ -4885,8 +4885,8 @@ void ETW::LoaderLog::SendAssemblyEvent(Assembly *pAssembly, DWORD dwEventOptions
ETW_INLINE
ULONG
ETW::LoaderLog::SendModuleRange(
- __in Module *pModule,
- __in DWORD dwEventOptions)
+ _In_ Module *pModule,
+ _In_ DWORD dwEventOptions)
{
ULONG Result = ERROR_SUCCESS;
diff --git a/src/coreclr/nativeaot/Runtime/eventtracebase.h b/src/coreclr/nativeaot/Runtime/eventtracebase.h
index afe833ef597584..79b8fac860612c 100644
--- a/src/coreclr/nativeaot/Runtime/eventtracebase.h
+++ b/src/coreclr/nativeaot/Runtime/eventtracebase.h
@@ -424,9 +424,9 @@ namespace ETW
}LoaderStructs;
- static void DomainLoadReal(BaseDomain *pDomain, __in_opt LPWSTR wszFriendlyName=NULL);
+ static void DomainLoadReal(BaseDomain *pDomain, _In_opt_ LPWSTR wszFriendlyName=NULL);
- static void DomainLoad(BaseDomain *pDomain, __in_opt LPWSTR wszFriendlyName = NULL)
+ static void DomainLoad(BaseDomain *pDomain, _In_opt_ LPWSTR wszFriendlyName = NULL)
{
#ifndef FEATURE_PAL
if (MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context.IsEnabled)
@@ -441,7 +441,7 @@ namespace ETW
static void ModuleLoad(Module *pModule, LONG liReportedSharedModule);
#else
public:
- static void DomainLoad(BaseDomain *pDomain, __in_opt LPWSTR wszFriendlyName=NULL) {};
+ static void DomainLoad(BaseDomain *pDomain, _In_opt_ LPWSTR wszFriendlyName=NULL) {};
static void DomainUnload(AppDomain *pDomain) {};
static void CollectibleLoaderAllocatorUnload(AssemblyLoaderAllocator *pLoaderAllocator) {};
static void ModuleLoad(Module *pModule, LONG liReportedSharedModule) {};
@@ -505,8 +505,8 @@ namespace ETW
{
#ifdef FEATURE_EVENT_TRACE
public:
- static void StrongNameVerificationStart(DWORD dwInFlags, __in LPWSTR strFullyQualifiedAssemblyName);
- static void StrongNameVerificationStop(DWORD dwInFlags,ULONG result, __in LPWSTR strFullyQualifiedAssemblyName);
+ static void StrongNameVerificationStart(DWORD dwInFlags, _In_ LPWSTR strFullyQualifiedAssemblyName);
+ static void StrongNameVerificationStop(DWORD dwInFlags,ULONG result, _In_ LPWSTR strFullyQualifiedAssemblyName);
static void FireFieldTransparencyComputationStart(LPCWSTR wszFieldName,
LPCWSTR wszModuleName,
@@ -742,8 +742,8 @@ extern ETW::CEtwTracer * g_pEtwTracer;
FORCEINLINE
BOOLEAN __stdcall
McGenEventTracingEnabled(
- __in PMCGEN_TRACE_CONTEXT EnableInfo,
- __in PCEVENT_DESCRIPTOR EventDescriptor
+ _In_ PMCGEN_TRACE_CONTEXT EnableInfo,
+ _In_ PCEVENT_DESCRIPTOR EventDescriptor
)
{
@@ -863,9 +863,9 @@ struct CallStackFrame
FORCEINLINE
BOOLEAN __stdcall
McGenEventProviderEnabled(
- __in PMCGEN_TRACE_CONTEXT Context,
- __in UCHAR Level,
- __in ULONGLONG Keyword
+ _In_ PMCGEN_TRACE_CONTEXT Context,
+ _In_ UCHAR Level,
+ _In_ ULONGLONG Keyword
)
{
if(!Context) {
@@ -989,10 +989,10 @@ namespace ETW
ETW_INLINE
ULONG
CoMofTemplate_h(
- __in REGHANDLE RegHandle,
- __in PCEVENT_DESCRIPTOR Descriptor,
- __in_opt LPCGUID EventGuid,
- __in const unsigned short ClrInstanceID
+ _In_ REGHANDLE RegHandle,
+ _In_ PCEVENT_DESCRIPTOR Descriptor,
+ _In_opt_ LPCGUID EventGuid,
+ _In_ const unsigned short ClrInstanceID
)
{
#define ARGUMENT_COUNT_h 1
diff --git a/src/coreclr/nativeaot/Runtime/gcrhenv.cpp b/src/coreclr/nativeaot/Runtime/gcrhenv.cpp
index 7ca20c8ca8d998..2f6f6ea4f7c0c0 100644
--- a/src/coreclr/nativeaot/Runtime/gcrhenv.cpp
+++ b/src/coreclr/nativeaot/Runtime/gcrhenv.cpp
@@ -923,7 +923,7 @@ void GCToEEInterface::DisablePreemptiveGC()
Thread* GCToEEInterface::GetThread()
{
#ifndef DACCESS_COMPILE
- return ThreadStore::GetCurrentThread();
+ return ThreadStore::GetCurrentThreadIfAvailable();
#else
return NULL;
#endif
diff --git a/src/coreclr/nativeaot/Runtime/inc/daccess.h b/src/coreclr/nativeaot/Runtime/inc/daccess.h
index 8ef6bc929e133d..c68597b41b3274 100644
--- a/src/coreclr/nativeaot/Runtime/inc/daccess.h
+++ b/src/coreclr/nativeaot/Runtime/inc/daccess.h
@@ -628,7 +628,7 @@ extern "C" {
// These two functions are largely just for marking code
// that is not fully converted. DacWarning prints a debug
// message, while DacNotImpl throws a not-implemented exception.
-void __cdecl DacWarning(__in __in_z char* format, ...);
+void __cdecl DacWarning(_In_ _In_z_ char* format, ...);
void DacNotImpl(void);
void DacError(HRESULT err);
void __declspec(noreturn) DacError_NoRet(HRESULT err);
diff --git a/src/coreclr/nativeaot/Runtime/rhassert.cpp b/src/coreclr/nativeaot/Runtime/rhassert.cpp
index f69a919450b390..4ff9062578f6d4 100644
--- a/src/coreclr/nativeaot/Runtime/rhassert.cpp
+++ b/src/coreclr/nativeaot/Runtime/rhassert.cpp
@@ -52,7 +52,7 @@ void Assert(const char * expr, const char * file, uint32_t line_num, const char
char buffer[4096];
- sprintf_s(buffer, COUNTOF(buffer),
+ sprintf_s(buffer, ARRAY_SIZE(buffer),
"--------------------------------------------------\n"
"Debug Assertion Violation\n\n"
"%s%s%s"
diff --git a/src/coreclr/nativeaot/Runtime/startup.cpp b/src/coreclr/nativeaot/Runtime/startup.cpp
index af4a025050e479..ada010f8a573e6 100644
--- a/src/coreclr/nativeaot/Runtime/startup.cpp
+++ b/src/coreclr/nativeaot/Runtime/startup.cpp
@@ -198,6 +198,12 @@ bool DetectCPUFeatures()
if ((cpuidInfo[EBX] & (1 << 5)) != 0) // AVX2
{
g_cpuFeatures |= XArchIntrinsicConstants_Avx2;
+
+ __cpuidex(cpuidInfo, 0x00000007, 0x00000001);
+ if ((cpuidInfo[EAX] & (1 << 4)) != 0) // AVX-VNNI
+ {
+ g_cpuFeatures |= XArchIntrinsicConstants_AvxVnni;
+ }
}
}
}
diff --git a/src/coreclr/nativeaot/Runtime/stressLog.cpp b/src/coreclr/nativeaot/Runtime/stressLog.cpp
index 12df357966d78e..2e25b6bcfa7928 100644
--- a/src/coreclr/nativeaot/Runtime/stressLog.cpp
+++ b/src/coreclr/nativeaot/Runtime/stressLog.cpp
@@ -323,7 +323,7 @@ void ThreadStressLog::LogMsg ( uint32_t facility, int cArgs, const char* format,
// Asserts in this function cause infinite loops in the asserting mechanism.
// Just use debug breaks instead.
- ASSERT( cArgs >= 0 && cArgs <= StressMsg::maxArgCnt );
+ ASSERT( cArgs >= 0 && (size_t)cArgs <= StressMsg::maxArgCnt );
size_t offs = ((size_t)format - StressLog::theLog.moduleOffset);
@@ -373,7 +373,7 @@ void ThreadStressLog::Activate (Thread * pThread)
/* static */
void StressLog::LogMsg (unsigned facility, int cArgs, const char* format, ... )
{
- _ASSERTE ( cArgs >= 0 && cArgs <= StressMsg::maxArgCnt );
+ _ASSERTE ( cArgs >= 0 && (size_t)cArgs <= StressMsg::maxArgCnt );
va_list Args;
va_start(Args, format);
diff --git a/src/coreclr/nativeaot/Runtime/thread.cpp b/src/coreclr/nativeaot/Runtime/thread.cpp
index 2b4a6ccb83a9cf..f091318acf641c 100644
--- a/src/coreclr/nativeaot/Runtime/thread.cpp
+++ b/src/coreclr/nativeaot/Runtime/thread.cpp
@@ -607,13 +607,13 @@ static void* GcStressHijackTargets[1] =
// static
bool Thread::IsHijackTarget(void * address)
{
- for (int i = 0; i < COUNTOF(NormalHijackTargets); i++)
+ for (size_t i = 0; i < ARRAY_SIZE(NormalHijackTargets); i++)
{
if (NormalHijackTargets[i] == address)
return true;
}
#ifdef FEATURE_GC_STRESS
- for (int i = 0; i < COUNTOF(GcStressHijackTargets); i++)
+ for (size_t i = 0; i < ARRAY_SIZE(GcStressHijackTargets); i++)
{
if (GcStressHijackTargets[i] == address)
return true;
diff --git a/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp b/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp
index f7b876a6721457..410222948e18cf 100644
--- a/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp
+++ b/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp
@@ -233,7 +233,7 @@ class UnixEvent
TimeSpecAdd(&endTime, milliseconds);
}
#else
-#error Don't know how to perform timed wait on this platform
+#error "Don't know how to perform timed wait on this platform"
#endif
int st = 0;
diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.CoreRT.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.CoreRT.cs
index 788bad4bbc1814..06c7ce9fdc1f55 100644
--- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.CoreRT.cs
+++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.CoreRT.cs
@@ -213,8 +213,6 @@ private unsafe IntPtr AsRuntimeDefined(in Guid riid)
{
return (IntPtr)(Dispatches + i);
}
-
- i++;
}
return IntPtr.Zero;
diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeFieldHandle.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeFieldHandle.cs
index 8e060328d62eaa..3c5745bcc873a6 100644
--- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeFieldHandle.cs
+++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeFieldHandle.cs
@@ -11,7 +11,7 @@
namespace System
{
[StructLayoutAttribute(LayoutKind.Sequential)]
- public struct RuntimeFieldHandle : ISerializable
+ public struct RuntimeFieldHandle : IEquatable, ISerializable
{
private IntPtr _value;
diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeMethodHandle.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeMethodHandle.cs
index cb1b39db71283a..b8d50df26a0f73 100644
--- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeMethodHandle.cs
+++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeMethodHandle.cs
@@ -13,7 +13,7 @@
namespace System
{
[StructLayout(LayoutKind.Sequential)]
- public struct RuntimeMethodHandle : ISerializable
+ public struct RuntimeMethodHandle : IEquatable, ISerializable
{
private IntPtr _value;
diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Thread.CoreRT.Windows.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Thread.CoreRT.Windows.cs
index e9ce1e5590ad70..9f31a0c2c6d9dc 100644
--- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Thread.CoreRT.Windows.cs
+++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Thread.CoreRT.Windows.cs
@@ -200,11 +200,10 @@ private unsafe bool CreateThread(GCHandle thisThreadHandle)
stackSize = AllocationGranularity;
}
- uint threadId;
_osHandle = Interop.Kernel32.CreateThread(IntPtr.Zero, (IntPtr)stackSize,
&ThreadEntryPoint, (IntPtr)thisThreadHandle,
Interop.Kernel32.CREATE_SUSPENDED | Interop.Kernel32.STACK_SIZE_PARAM_IS_A_RESERVATION,
- out threadId);
+ out _);
if (_osHandle.IsInvalid)
{
diff --git a/src/coreclr/nativeaot/System.Private.Interop/src/Internal/Runtime/CompilerHelpers/RuntimeInteropData.CoreRT.cs b/src/coreclr/nativeaot/System.Private.Interop/src/Internal/Runtime/CompilerHelpers/RuntimeInteropData.CoreRT.cs
index 376ee967cd4042..1f6fa5f89c83da 100644
--- a/src/coreclr/nativeaot/System.Private.Interop/src/Internal/Runtime/CompilerHelpers/RuntimeInteropData.CoreRT.cs
+++ b/src/coreclr/nativeaot/System.Private.Interop/src/Internal/Runtime/CompilerHelpers/RuntimeInteropData.CoreRT.cs
@@ -44,10 +44,9 @@ public override bool TryGetStructUnsafeStructSize(RuntimeTypeHandle structureTyp
public override bool TryGetStructFieldOffset(RuntimeTypeHandle structureTypeHandle, string fieldName, out bool structExists, out uint offset)
{
- ExternalReferencesTable externalReferences;
NativeParser entryParser;
structExists = false;
- if (TryGetStructData(structureTypeHandle, out externalReferences, out entryParser))
+ if (TryGetStructData(structureTypeHandle, out _, out entryParser))
{
structExists = true;
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/ActivatorImplementation.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/ActivatorImplementation.cs
index d5ea4c2dd34de2..4370581bd7c6e2 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/ActivatorImplementation.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/ActivatorImplementation.cs
@@ -88,8 +88,7 @@ public static object CreateInstance(
if (binder == null)
binder = Type.DefaultBinder;
- object state = null;
- MethodBase invokeMethod = binder.BindToMethod(bindingAttr, matches.ToArray(), ref args, null, culture, null, out state);
+ MethodBase invokeMethod = binder.BindToMethod(bindingAttr, matches.ToArray(), ref args, null, culture, null, out object state);
if (invokeMethod.GetParametersNoCopy().Length == 0)
{
if (args.Length != 0)
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/Assemblies/NativeFormat/NativeFormatRuntimeAssembly.GetTypeCore.CaseInsensitive.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/Assemblies/NativeFormat/NativeFormatRuntimeAssembly.GetTypeCore.CaseInsensitive.cs
index 266f6cba264005..7c5f1b5a926d95 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/Assemblies/NativeFormat/NativeFormatRuntimeAssembly.GetTypeCore.CaseInsensitive.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/Assemblies/NativeFormat/NativeFormatRuntimeAssembly.GetTypeCore.CaseInsensitive.cs
@@ -99,8 +99,7 @@ private LowLevelDictionary CreateCaseInsensitiveTypeDictionary(
foreach (TypeDefinitionHandle typeDefinitionHandle in namespaceDefinition.TypeDefinitions)
{
string fullName = ns + typeDefinitionHandle.GetTypeDefinition(reader).Name.GetString(reader).ToLowerInvariant();
- QHandle existingValue;
- if (!dict.TryGetValue(fullName, out existingValue))
+ if (!dict.TryGetValue(fullName, out _))
{
dict.Add(fullName, new QHandle(reader, typeDefinitionHandle));
}
@@ -109,8 +108,7 @@ private LowLevelDictionary CreateCaseInsensitiveTypeDictionary(
foreach (TypeForwarderHandle typeForwarderHandle in namespaceDefinition.TypeForwarders)
{
string fullName = ns + typeForwarderHandle.GetTypeForwarder(reader).Name.GetString(reader).ToLowerInvariant();
- QHandle existingValue;
- if (!dict.TryGetValue(fullName, out existingValue))
+ if (!dict.TryGetValue(fullName, out _))
{
dict.Add(fullName, new QHandle(reader, typeForwarderHandle));
}
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/BindingFlagSupport/Shared.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/BindingFlagSupport/Shared.cs
index 1f9d754916f749..4f20819d1d210a 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/BindingFlagSupport/Shared.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/BindingFlagSupport/Shared.cs
@@ -149,11 +149,9 @@ public static bool QualifiesBasedOnParameterCount(this MethodBase methodBase, Bi
public static M GetImplicitlyOverriddenBaseClassMember(this M member) where M : MemberInfo
{
MemberPolicies policies = MemberPolicies.Default;
- MethodAttributes visibility;
- bool isStatic;
bool isVirtual;
bool isNewSlot;
- policies.GetMemberAttributes(member, out visibility, out isStatic, out isVirtual, out isNewSlot);
+ policies.GetMemberAttributes(member, out _, out _, out isVirtual, out isNewSlot);
if (isNewSlot || !isVirtual)
{
return null;
@@ -174,11 +172,8 @@ public static M GetImplicitlyOverriddenBaseClassMember(this M member) where M
{
continue;
}
- MethodAttributes candidateVisibility;
- bool isCandidateStatic;
bool isCandidateVirtual;
- bool isCandidateNewSlot;
- policies.GetMemberAttributes(member, out candidateVisibility, out isCandidateStatic, out isCandidateVirtual, out isCandidateNewSlot);
+ policies.GetMemberAttributes(member, out _, out _, out isCandidateVirtual, out _);
if (!isCandidateVirtual)
{
continue;
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/CustomAttributes/RuntimeCustomAttributeData.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/CustomAttributes/RuntimeCustomAttributeData.cs
index 7db743d5e8143d..555277bed09352 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/CustomAttributes/RuntimeCustomAttributeData.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/CustomAttributes/RuntimeCustomAttributeData.cs
@@ -146,11 +146,10 @@ private static string ComputeTypedArgumentString(CustomAttributeTypedArgument ca
else if (argumentType.IsArray)
{
- string result = null;
IList array = value as IList;
Type elementType = argumentType.GetElementType();
- result = string.Format(@"new {0}[{1}] {{ ", elementType.IsEnum ? elementType.FullName : elementType.Name, array.Count);
+ string result = string.Format(@"new {0}[{1}] {{ ", elementType.IsEnum ? elementType.FullName : elementType.Name, array.Count);
for (int i = 0; i < array.Count; i++)
result += string.Format(i == 0 ? "{0}" : ", {0}", ComputeTypedArgumentString(array[i], elementType != typeof(object)));
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/NamespaceChain.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/NamespaceChain.cs
index e76abd7d0c0265..34b97186d7507e 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/NamespaceChain.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/NamespaceChain.cs
@@ -21,7 +21,7 @@ internal NamespaceChain(MetadataReader reader, NamespaceDefinitionHandle innerMo
{
NamespaceDefinition currentNamespaceDefinition = innerMostNamespaceHandle.GetNamespaceDefinition(reader);
ConstantStringValueHandle currentNameHandle = currentNamespaceDefinition.Name;
- Handle currentNamespaceHandle = innerMostNamespaceHandle.ToHandle(reader);
+ Handle currentNamespaceHandle;
LowLevelList names = new LowLevelList();
for (;;)
{
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/ReflectionCoreCallbacksImplementation.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/ReflectionCoreCallbacksImplementation.cs
index df5587374683db..77272d3ff2c236 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/ReflectionCoreCallbacksImplementation.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/ReflectionCoreCallbacksImplementation.cs
@@ -164,7 +164,6 @@ private FieldInfo GetFieldInfo(RuntimeTypeHandle declaringTypeHandle, FieldHandl
{
RuntimeTypeInfo contextTypeInfo = declaringTypeHandle.GetTypeForRuntimeTypeHandle();
NativeFormatRuntimeNamedTypeInfo definingTypeInfo = contextTypeInfo.AnchoringTypeDefinitionForDeclaredMembers.CastToNativeFormatRuntimeNamedTypeInfo();
- MetadataReader reader = definingTypeInfo.Reader;
// RuntimeFieldHandles always yield FieldInfo's whose ReflectedType equals the DeclaringType.
RuntimeTypeInfo reflectedType = contextTypeInfo;
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/MethodInfos/RuntimePlainConstructorInfo.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/MethodInfos/RuntimePlainConstructorInfo.cs
index 308d09b8efcd5e..7e3825048f340d 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/MethodInfos/RuntimePlainConstructorInfo.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/MethodInfos/RuntimePlainConstructorInfo.cs
@@ -178,8 +178,7 @@ protected sealed override RuntimeParameterInfo[] RuntimeParameters
{
get
{
- RuntimeParameterInfo ignore;
- return _lazyParameters ?? (_lazyParameters = RuntimeMethodHelpers.GetRuntimeParameters(ref _common, this, Array.Empty(), out ignore));
+ return _lazyParameters ??= RuntimeMethodHelpers.GetRuntimeParameters(ref _common, this, Array.Empty(), out _);
}
}
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/ParameterInfos/RuntimeFatMethodParameterInfo.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/ParameterInfos/RuntimeFatMethodParameterInfo.cs
index 8f92256963e18c..8859a0770c4993 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/ParameterInfos/RuntimeFatMethodParameterInfo.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/ParameterInfos/RuntimeFatMethodParameterInfo.cs
@@ -50,7 +50,7 @@ public sealed override object RawDefaultValue
if (rawDefaultValueInfo == null)
{
object rawDefaultValue;
- bool dontCare = GetDefaultValueOrSentinel(raw: true, defaultValue: out rawDefaultValue);
+ GetDefaultValueOrSentinel(raw: true, defaultValue: out rawDefaultValue);
rawDefaultValueInfo = _lazyRawDefaultValueInfo = Tuple.Create(rawDefaultValue);
}
return rawDefaultValueInfo.Item1;
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.InvokeMember.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.InvokeMember.cs
index 40ca73df2b1f4b..77dccda7966be1 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.InvokeMember.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.InvokeMember.cs
@@ -75,7 +75,6 @@ public sealed override object InvokeMember(
if (binder == null)
binder = DefaultBinder;
- bool bDefaultBinder = (binder == DefaultBinder);
#endregion
#region Delegate to Activator.CreateInstance
@@ -320,7 +319,7 @@ public sealed override object InvokeMember(
for (int i = 0; i < semiFinalists.Length; i++)
{
- MethodInfo semiFinalist = null;
+ MethodInfo semiFinalist;
if (isSetProperty)
{
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs b/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs
index 4439bea360a0c5..d086fbd41e9c83 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs
@@ -1038,8 +1038,8 @@ private static FunctionPointersToOffsets ComputeLdftnReverseLookup_InvokeMap(Nat
if (!hasEntrypoint)
continue;
- uint entryMethodHandleOrNameAndSigRaw = entryParser.GetUnsigned();
- uint entryDeclaringTypeRaw = entryParser.GetUnsigned();
+ entryParser.SkipInteger(); // entryMethodHandleOrNameAndSigRaw
+ entryParser.SkipInteger(); // entryDeclaringTypeRaw
IntPtr entryMethodEntrypoint = externalReferences.GetFunctionPointerFromIndex(entryParser.GetUnsigned());
functionPointers.Add(new FunctionPointerOffsetPair(entryMethodEntrypoint, parserOffset));
@@ -1401,8 +1401,7 @@ public unsafe sealed override bool TryGetMethodFromHandle(RuntimeMethodHandle ru
//
public sealed override bool TryGetMethodFromHandleAndType(RuntimeMethodHandle runtimeMethodHandle, RuntimeTypeHandle declaringTypeHandle, out QMethodDefinition methodHandle, out RuntimeTypeHandle[] genericMethodTypeArgumentHandles)
{
- RuntimeTypeHandle dummy;
- return TryGetMethodFromHandle(runtimeMethodHandle, out dummy, out methodHandle, out genericMethodTypeArgumentHandles);
+ return TryGetMethodFromHandle(runtimeMethodHandle, out _, out methodHandle, out genericMethodTypeArgumentHandles);
}
//
@@ -1410,7 +1409,6 @@ public sealed override bool TryGetMethodFromHandleAndType(RuntimeMethodHandle ru
//
public unsafe sealed override bool TryGetFieldFromHandle(RuntimeFieldHandle runtimeFieldHandle, out RuntimeTypeHandle declaringTypeHandle, out FieldHandle fieldHandle)
{
- declaringTypeHandle = default(RuntimeTypeHandle);
fieldHandle = default(FieldHandle);
string fieldName;
@@ -1446,8 +1444,7 @@ public unsafe sealed override bool TryGetFieldFromHandle(RuntimeFieldHandle runt
//
public sealed override bool TryGetFieldFromHandleAndType(RuntimeFieldHandle runtimeFieldHandle, RuntimeTypeHandle declaringTypeHandle, out FieldHandle fieldHandle)
{
- RuntimeTypeHandle dummy;
- return TryGetFieldFromHandle(runtimeFieldHandle, out dummy, out fieldHandle);
+ return TryGetFieldFromHandle(runtimeFieldHandle, out _, out fieldHandle);
}
///
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/PayForPlayExperience/DiagnosticMappingTables.cs b/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/PayForPlayExperience/DiagnosticMappingTables.cs
index 0116d9a4c9e99b..d09662aad9514b 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/PayForPlayExperience/DiagnosticMappingTables.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/PayForPlayExperience/DiagnosticMappingTables.cs
@@ -62,10 +62,8 @@ public static bool TryGetDiagnosticStringForNamedType(RuntimeTypeHandle runtimeT
private static string GetTypeFullNameFromTypeRef(TypeReferenceHandle typeReferenceHandle, MetadataReader reader, List genericParameterOffsets)
{
- string s = "";
-
TypeReference typeReference = typeReferenceHandle.GetTypeReference(reader);
- s = typeReference.TypeName.GetString(reader);
+ string s = typeReference.TypeName.GetString(reader);
Handle parentHandle = typeReference.ParentNamespaceOrType;
HandleType parentHandleType = parentHandle.HandleType;
if (parentHandleType == HandleType.TypeReference)
@@ -135,7 +133,7 @@ public static string ConvertBackTickNameToNameWithReducerInputFormat(string type
private static string GetTypeFullNameFromTypeDef(TypeDefinitionHandle typeDefinitionHandle, MetadataReader reader, List genericParameterOffsets)
{
- string s = "";
+ string s;
TypeDefinition typeDefinition = typeDefinitionHandle.GetTypeDefinition(reader);
s = typeDefinition.Name.GetString(reader);
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/PayForPlayExperience/MissingMetadataExceptionCreator.cs b/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/PayForPlayExperience/MissingMetadataExceptionCreator.cs
index 37adf30ec26464..db347ad0b787ba 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/PayForPlayExperience/MissingMetadataExceptionCreator.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/PayForPlayExperience/MissingMetadataExceptionCreator.cs
@@ -109,7 +109,7 @@ public static string ComputeUsefulPertainantIfPossible(object pertainant)
if (pertainant is MethodBase)
{
MethodBase method = (MethodBase)pertainant;
- bool first = true;
+ bool first;
// write out generic parameters
if (method.IsConstructedGenericMethod)
diff --git a/src/coreclr/nativeaot/System.Private.StackTraceMetadata/src/Internal/StackTraceMetadata/MethodNameFormatter.cs b/src/coreclr/nativeaot/System.Private.StackTraceMetadata/src/Internal/StackTraceMetadata/MethodNameFormatter.cs
index cc5dd065dac28b..ebfbab7a8e2c02 100644
--- a/src/coreclr/nativeaot/System.Private.StackTraceMetadata/src/Internal/StackTraceMetadata/MethodNameFormatter.cs
+++ b/src/coreclr/nativeaot/System.Private.StackTraceMetadata/src/Internal/StackTraceMetadata/MethodNameFormatter.cs
@@ -255,8 +255,12 @@ private void EmitTypeName(Handle typeHandle, bool namespaceQualified)
EmitString(typeHandle.ToGenericParameterHandle(_metadataReader).GetGenericParameter(_metadataReader).Name);
break;
+ case HandleType.FunctionPointerSignature:
+ EmitFunctionPointerTypeName();
+ break;
+
default:
- Debug.Assert(false);
+ Debug.Assert(false, $"Type handle {typeHandle.HandleType} was not handled");
_outputBuilder.Append("???");
break;
}
@@ -407,6 +411,14 @@ private void EmitPointerTypeName(PointerSignatureHandle pointerSigHandle)
_outputBuilder.Append('*');
}
+ ///
+ /// Emit function pointer type.
+ ///
+ private void EmitFunctionPointerTypeName()
+ {
+ _outputBuilder.Append("IntPtr");
+ }
+
///
/// Emit by-reference type.
///
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallConverterThunk.CallConversionParameters.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallConverterThunk.CallConversionParameters.cs
index 475b77b4820458..2d27a3f35893a3 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallConverterThunk.CallConversionParameters.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallConverterThunk.CallConversionParameters.cs
@@ -341,10 +341,8 @@ internal void PrepareNextMulticastDelegateCall(int currentIndex)
Delegate[] delegateArray = (Delegate[])_delegateData._helperObject;
Delegate currentDelegate = delegateArray[currentIndex];
- object helperObject;
- IntPtr extraFunctionPointerOrData;
IntPtr functionPointer;
- RuntimeAugments.GetDelegateData(currentDelegate, out _delegateData._multicastThisPointer, out helperObject, out extraFunctionPointerOrData, out functionPointer);
+ RuntimeAugments.GetDelegateData(currentDelegate, out _delegateData._multicastThisPointer, out _, out _, out functionPointer);
bool forceCalleeHasParamType = UpdateCalleeFunctionPointer(functionPointer);
_calleeArgs.SetHasParamTypeAndReset(forceCalleeHasParamType);
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallConverterThunk.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallConverterThunk.cs
index befeea82355aba..28197a93abd6ee 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallConverterThunk.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallConverterThunk.cs
@@ -259,8 +259,7 @@ public static unsafe IntPtr GetDelegateThunk(Delegate delegateObject, int thunkK
Debug.Assert(RuntimeAugments.IsGenericType(delegateType));
RuntimeTypeHandle[] typeArgs;
- RuntimeTypeHandle genericTypeDefHandle;
- genericTypeDefHandle = RuntimeAugments.GetGenericInstantiation(delegateType, out typeArgs);
+ RuntimeAugments.GetGenericInstantiation(delegateType, out typeArgs);
Debug.Assert(typeArgs != null && typeArgs.Length > 0);
RuntimeSignature invokeMethodSignature;
@@ -303,9 +302,8 @@ public static unsafe IntPtr GetDelegateThunk(Delegate delegateObject, int thunkK
public static unsafe bool TryGetNonUnboxingFunctionPointerFromUnboxingAndInstantiatingStub(IntPtr potentialStub, RuntimeTypeHandle exactType, out IntPtr nonUnboxingMethod)
{
IntPtr callConversionId;
- IntPtr commonStubDataPtr;
object thunkPoolHeap = s_thunkPoolHeap;
- if (thunkPoolHeap == null || !RuntimeAugments.TryGetThunkData(thunkPoolHeap, potentialStub, out callConversionId, out commonStubDataPtr))
+ if (thunkPoolHeap == null || !RuntimeAugments.TryGetThunkData(thunkPoolHeap, potentialStub, out callConversionId, out _))
{
// This isn't a call conversion stub
nonUnboxingMethod = IntPtr.Zero;
@@ -383,9 +381,8 @@ public static unsafe bool TryGetCallConversionTargetPointerAndInstantiatingArg(I
methodTarget = instantiatingArg = IntPtr.Zero;
IntPtr callConversionId;
- IntPtr commonStubDataPtr;
object thunkPoolHeap = s_thunkPoolHeap;
- if (thunkPoolHeap == null || !RuntimeAugments.TryGetThunkData(thunkPoolHeap, potentialStub, out callConversionId, out commonStubDataPtr))
+ if (thunkPoolHeap == null || !RuntimeAugments.TryGetThunkData(thunkPoolHeap, potentialStub, out callConversionId, out _))
{
// This isn't a call conversion stub
return false;
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallingConventions.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallingConventions.cs
index d1b2421957a23e..b4388c891b17ac 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallingConventions.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallingConventions.cs
@@ -67,8 +67,7 @@ public static bool TypeUsesReturnBuffer(RuntimeTypeHandle returnType, bool metho
CorElementType typeReturnType = thReturnType.GetCorElementType();
bool usesReturnBuffer;
- uint fpReturnSizeIgnored;
- ArgIterator.ComputeReturnValueTreatment(typeReturnType, thReturnType, methodWithReturnTypeIsVarArg, out usesReturnBuffer, out fpReturnSizeIgnored);
+ ArgIterator.ComputeReturnValueTreatment(typeReturnType, thReturnType, methodWithReturnTypeIsVarArg, out usesReturnBuffer, out _);
return usesReturnBuffer;
}
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/EETypeCreator.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/EETypeCreator.cs
index aa65aecb53db4d..c1ff399482a52f 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/EETypeCreator.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/EETypeCreator.cs
@@ -1045,7 +1045,7 @@ public static RuntimeTypeHandle CreateEEType(TypeDesc type, TypeBuilderState sta
{
Debug.Assert(type != null && state != null);
- MethodTable* pTemplateEEType = null;
+ MethodTable* pTemplateEEType;
bool requireVtableSlotMapping = false;
if (type is PointerType || type is ByRefType)
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/ModuleList.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/ModuleList.cs
index 7a89589ed6cabf..f6e52ed013dd20 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/ModuleList.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/ModuleList.cs
@@ -673,8 +673,7 @@ public void RegisterNewModules(ModuleType moduleType)
foreach (TypeManagerHandle moduleHandle in loadedModuleHandles)
{
// Skip already registered modules.
- int oldModuleIndex;
- if (_loadedModuleMap.HandleToModuleIndex.TryGetValue(moduleHandle, out oldModuleIndex))
+ if (_loadedModuleMap.HandleToModuleIndex.TryGetValue(moduleHandle, out _))
{
continue;
}
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/NativeLayoutFieldAlgorithm.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/NativeLayoutFieldAlgorithm.cs
index 8d93e08b45b658..7c2d1958a40afb 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/NativeLayoutFieldAlgorithm.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/NativeLayoutFieldAlgorithm.cs
@@ -234,8 +234,7 @@ private static void EnsureFieldLayoutLoadedForNonUniversalType(DefType type)
// Look up the universal template for this type. Only the universal template has field layout
// information, so we have to use it to parse the field layout.
NativeLayoutInfoLoadContext universalLayoutLoadContext;
- NativeLayoutInfo universalLayoutInfo;
- NativeParser typeInfoParser = type.GetOrCreateTypeBuilderState().GetParserForUniversalNativeLayoutInfo(out universalLayoutLoadContext, out universalLayoutInfo);
+ NativeParser typeInfoParser = type.GetOrCreateTypeBuilderState().GetParserForUniversalNativeLayoutInfo(out universalLayoutLoadContext, out _);
if (typeInfoParser.IsNull)
throw new TypeBuilder.MissingTemplateException();
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/NativeLayoutInfoLoadContext.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/NativeLayoutInfoLoadContext.cs
index 9dcbbea70bdaad..887a9b9b062896 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/NativeLayoutInfoLoadContext.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/NativeLayoutInfoLoadContext.cs
@@ -173,7 +173,7 @@ internal MethodDesc GetMethod(ref NativeParser parser, out RuntimeSignature meth
bool unboxingStub = (flags & MethodFlags.IsUnboxingStub) != 0;
- MethodDesc retVal = null;
+ MethodDesc retVal;
if ((flags & MethodFlags.HasInstantiation) != 0)
{
TypeDesc[] typeArguments = GetTypeSequence(ref parser);
@@ -197,9 +197,7 @@ internal MethodDesc GetMethod(ref NativeParser parser, out RuntimeSignature meth
internal MethodDesc GetMethod(ref NativeParser parser)
{
- RuntimeSignature methodSig;
- RuntimeSignature methodNameSig;
- return GetMethod(ref parser, out methodNameSig, out methodSig);
+ return GetMethod(ref parser, out _, out _);
}
internal TypeDesc[] GetTypeSequence(ref NativeParser parser)
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TemplateLocator.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TemplateLocator.cs
index 37752ef347200b..2a3fa2e363eafa 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TemplateLocator.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TemplateLocator.cs
@@ -236,8 +236,7 @@ private InstantiatedMethod TryGetGenericMethodTemplate_Internal(InstantiatedMeth
if (nativeLayoutReader == null)
continue;
- ExternalReferencesTable externalFixupsTable;
- NativeHashtable genericMethodTemplatesHashtable = LoadHashtable(moduleInfo, ReflectionMapBlob.GenericMethodsTemplateMap, out externalFixupsTable);
+ NativeHashtable genericMethodTemplatesHashtable = LoadHashtable(moduleInfo, ReflectionMapBlob.GenericMethodsTemplateMap, out _);
if (genericMethodTemplatesHashtable.IsNull)
continue;
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilder.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilder.cs
index aa1c1b918168b6..d7ba8aabd1ee85 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilder.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilder.cs
@@ -1458,8 +1458,7 @@ private void RegisterGenericTypesAndMethods()
int typesToRegisterCount = 0;
for (int i = 0; i < _typesThatNeedTypeHandles.Count; i++)
{
- DefType typeAsDefType;
- if ((typeAsDefType = _typesThatNeedTypeHandles[i] as DefType) != null)
+ if (_typesThatNeedTypeHandles[i] is DefType)
typesToRegisterCount++;
}
@@ -1637,8 +1636,6 @@ internal void BuildType(TypeDesc type)
internal bool TryComputeFieldOffset(DefType declaringType, uint fieldOrdinal, out int fieldOffset)
{
- fieldOffset = int.MinValue;
-
TypeLoaderLogger.WriteLine("Computing offset of field #" + fieldOrdinal.LowLevelToString() + " on type " + declaringType.ToString());
// Get the computed field offset result
@@ -2217,9 +2214,8 @@ internal static bool TryGetDelegateInvokeMethodSignature(RuntimeTypeHandle deleg
DefType delegateType = (DefType)context.ResolveRuntimeTypeHandle(delegateTypeHandle);
Debug.Assert(delegateType.HasInstantiation);
- NativeLayoutInfoLoadContext loadContext;
NativeLayoutInfo universalLayoutInfo;
- NativeParser parser = delegateType.GetOrCreateTypeBuilderState().GetParserForUniversalNativeLayoutInfo(out loadContext, out universalLayoutInfo);
+ NativeParser parser = delegateType.GetOrCreateTypeBuilderState().GetParserForUniversalNativeLayoutInfo(out _, out universalLayoutInfo);
if (!parser.IsNull)
{
NativeParser sigParser = parser.GetParserForBagElementKind(BagElementKind.DelegateInvokeSignature);
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilderState.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilderState.cs
index 0aa63813f9a8a0..8105f9d1687546 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilderState.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilderState.cs
@@ -155,7 +155,7 @@ private void EnsureNativeLayoutInfoComputed()
if (!_templateComputed)
{
// Attempt to compute native layout through as a non-ReadyToRun template
- object temp = this.TemplateType;
+ object _ = this.TemplateType;
}
if (!_nativeLayoutTokenComputed)
{
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.ConstructedGenericMethodsLookup.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.ConstructedGenericMethodsLookup.cs
index b1f003ed8dab4c..f41f37821909dd 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.ConstructedGenericMethodsLookup.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.ConstructedGenericMethodsLookup.cs
@@ -291,8 +291,6 @@ public bool TryLookupGenericMethodDictionaryForComponents(RuntimeTypeHandle decl
public bool TryGetGenericMethodComponents(IntPtr methodDictionary, out RuntimeTypeHandle declaringType, out MethodNameAndSignature nameAndSignature, out RuntimeTypeHandle[] genericMethodArgumentHandles)
{
- nameAndSignature = null;
-
if (!TryGetDynamicGenericMethodComponents(methodDictionary, out declaringType, out nameAndSignature, out genericMethodArgumentHandles))
if (!TryGetStaticGenericMethodComponents(methodDictionary, out declaringType, out nameAndSignature, out genericMethodArgumentHandles))
return false;
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.FieldAccess.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.FieldAccess.cs
index 97d5c73f6741ed..a0a0854ec2da72 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.FieldAccess.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.FieldAccess.cs
@@ -124,8 +124,6 @@ private static unsafe bool TryGetFieldAccessMetadataFromFieldAccessMap(
ref FieldAccessMetadata fieldAccessMetadata)
{
CanonicallyEquivalentEntryLocator canonWrapper = new CanonicallyEquivalentEntryLocator(declaringTypeHandle, canonFormKind);
- TypeManagerHandle fieldHandleModule = ModuleList.Instance.GetModuleForMetadataReader(metadataReader);
- bool isDynamicType = RuntimeAugments.IsDynamicType(declaringTypeHandle);
string fieldName = null;
RuntimeTypeHandle declaringTypeHandleDefinition = Instance.GetTypeDefinition(declaringTypeHandle);
@@ -190,7 +188,7 @@ private static unsafe bool TryGetFieldAccessMetadataFromFieldAccessMap(
continue;
}
- int fieldOffset = -1;
+ int fieldOffset;
IntPtr fieldAddressCookie = IntPtr.Zero;
if (canonFormKind == CanonicalFormKind.Universal)
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.Metadata.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.Metadata.cs
index 37874b76b74579..820ea6ddb7decd 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.Metadata.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.Metadata.cs
@@ -602,9 +602,7 @@ private IntPtr TryGetDefaultConstructorForTypeViaMetadata_Inner(TypeDesc type)
MethodDesc defaultConstructor = ((MetadataType)defType).GetDefaultConstructor();
if (defaultConstructor != null)
{
- IntPtr dummyUnboxingStub;
- TypeLoaderEnvironment.MethodAddressType foundAddressType;
- TypeLoaderEnvironment.TryGetMethodAddressFromMethodDesc(defaultConstructor, out metadataLookupResult, out dummyUnboxingStub, out foundAddressType);
+ TypeLoaderEnvironment.TryGetMethodAddressFromMethodDesc(defaultConstructor, out metadataLookupResult, out _, out _);
}
}
}
@@ -1605,7 +1603,6 @@ public bool GetMethodEntryPoint(out IntPtr methodEntrypoint, out TDictionaryComp
rawMethodEntrypoint = _methodEntrypoint;
methodEntrypoint = IntPtr.Zero;
- dictionaryComponent = default(TDictionaryComponentType);
if (!GetDictionaryComponent(out dictionaryComponent) || !GetMethodEntryPointComponent(dictionaryComponent, out methodEntrypoint))
return false;
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.MetadataSignatureParsing.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.MetadataSignatureParsing.cs
index cebdf43051c454..181804eb2e2531 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.MetadataSignatureParsing.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.MetadataSignatureParsing.cs
@@ -372,7 +372,7 @@ private bool CompareTypeSigWithType(ref NativeParser parser, TypeManagerHandle m
return false;
}
- RuntimeTypeHandle type1 = default(RuntimeTypeHandle);
+ RuntimeTypeHandle type1;
if (typeSignatureKind == TypeSignatureKind.External)
{
type1 = SigParsing.GetTypeFromNativeLayoutSignature(ref parser, moduleHandle, startOffset);
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.NamedTypeLookup.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.NamedTypeLookup.cs
index 697b6c27214987..8d4eab59061d5b 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.NamedTypeLookup.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.NamedTypeLookup.cs
@@ -292,8 +292,7 @@ public void UnregisterNewNamedTypeRuntimeTypeHandle(QTypeDefinition qTypeDefinit
metadataLookupResult.VersionNumber = -1;
}
- NamedTypeLookupResult runtimeTypeHandleResult;
- if (_runtimeTypeHandleToMetadataHashtable.TryGetValue(runtimeTypeHandle, out runtimeTypeHandleResult))
+ if (_runtimeTypeHandleToMetadataHashtable.TryGetValue(runtimeTypeHandle, out _))
{
metadataLookupResult.GcStaticFields = IntPtr.Zero;
metadataLookupResult.NonGcStaticFields = IntPtr.Zero;
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.SignatureParsing.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.SignatureParsing.cs
index 3820ce7b8cd5d6..e27d2336ffcfbd 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.SignatureParsing.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.SignatureParsing.cs
@@ -123,9 +123,7 @@ public bool TryGetMethodNameAndSignatureFromNativeLayoutSignature(RuntimeSignatu
if (parser.IsNull)
return false;
- RuntimeSignature methodSig;
- RuntimeSignature methodNameSig;
- nameAndSignature = GetMethodNameAndSignature(ref parser, new TypeManagerHandle(signature.ModuleHandle), out methodNameSig, out methodSig);
+ nameAndSignature = GetMethodNameAndSignature(ref parser, new TypeManagerHandle(signature.ModuleHandle), out _, out _);
return true;
}
@@ -141,7 +139,7 @@ public bool TryGetMethodNameAndSignaturePointersFromNativeLayoutSignature(TypeMa
return false;
methodNameSig = RuntimeSignature.CreateFromNativeLayoutSignature(module, parser.Offset);
- string methodName = parser.GetString();
+ parser.SkipString(); // methodName
// Signatures are indirected to through a relative offset so that we don't have to parse them
// when not comparing signatures (parsing them requires resolving types and is tremendously
@@ -161,9 +159,7 @@ public bool TryGetMethodNameAndSignatureFromNativeLayoutOffset(TypeManagerHandle
if (parser.IsNull)
return false;
- RuntimeSignature methodSig;
- RuntimeSignature methodNameSig;
- nameAndSignature = GetMethodNameAndSignature(ref parser, moduleHandle, out methodNameSig, out methodSig);
+ nameAndSignature = GetMethodNameAndSignature(ref parser, moduleHandle, out _, out _);
return true;
}
@@ -295,9 +291,6 @@ internal bool GetCallingConverterDataFromMethodSignature_NativeLayout_Common(
out bool[] parametersWithGenericDependentLayout,
NativeReader nativeReader)
{
- hasThis = false;
- parameters = null;
-
NativeLayoutInfoLoadContext nativeLayoutContext = new NativeLayoutInfoLoadContext();
nativeLayoutContext._module = (NativeFormatModuleInfo)methodSig.GetModuleInfo();
@@ -312,7 +305,10 @@ internal bool GetCallingConverterDataFromMethodSignature_NativeLayout_Common(
MethodCallingConvention callingConvention = (MethodCallingConvention)parser.GetUnsigned();
hasThis = !callingConvention.HasFlag(MethodCallingConvention.Static);
- uint numGenArgs = callingConvention.HasFlag(MethodCallingConvention.Generic) ? parser.GetUnsigned() : 0;
+ if (callingConvention.HasFlag(MethodCallingConvention.Generic))
+ {
+ parser.SkipInteger(); // numGenArgs
+ }
uint parameterCount = parser.GetUnsigned();
parameters = new TypeDesc[parameterCount + 1];
@@ -386,7 +382,10 @@ private bool MethodSignatureHasVarsNeedingCallingConventionConverter_NativeLayou
NativeFormatModuleInfo module = ModuleList.Instance.GetModuleInfoByHandle(new TypeManagerHandle(methodSig.ModuleHandle));
MethodCallingConvention callingConvention = (MethodCallingConvention)parser.GetUnsigned();
- uint numGenArgs = callingConvention.HasFlag(MethodCallingConvention.Generic) ? parser.GetUnsigned() : 0;
+ if (callingConvention.HasFlag(MethodCallingConvention.Generic))
+ {
+ parser.SkipInteger(); // numGenArgs
+ }
uint parameterCount = parser.GetUnsigned();
// Check the return type of the method
@@ -639,7 +638,6 @@ private bool CompareTypeSigs(ref NativeParser parser1, NativeFormatModuleInfo mo
}
uint data2;
- uint startOffset2 = parser2.Offset;
var typeSignatureKind2 = parser2.GetTypeSignatureKind(out data2);
// If parser2 is a lookback type, we need to rewind parser1 to its startOffset1
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.cs
index 9004db49a1397c..361311060cd18d 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.cs
@@ -342,7 +342,7 @@ internal unsafe NativeReader GetNativeLayoutInfoReader(TypeManagerHandle moduleH
if (t_moduleNativeReaders == null)
t_moduleNativeReaders = new LowLevelDictionary();
- NativeReader result = null;
+ NativeReader result;
if (t_moduleNativeReaders.TryGetValue(moduleHandle, out result))
return result;
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/TypeSystem/RuntimeNoMetadataType.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/TypeSystem/RuntimeNoMetadataType.cs
index 86dc00e75efc7c..a78e0a316aa054 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/TypeSystem/RuntimeNoMetadataType.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/TypeSystem/RuntimeNoMetadataType.cs
@@ -318,8 +318,7 @@ public string NamespaceForDiagnostics
{
get
{
- string name, nsName, assemblyName;
- GetTypeNameHelper(out name, out nsName, out assemblyName);
+ GetTypeNameHelper(out _, out string nsName, out _);
return nsName;
}
}
@@ -328,8 +327,7 @@ public string NameForDiagnostics
{
get
{
- string name, nsName, assemblyName;
- GetTypeNameHelper(out name, out nsName, out assemblyName);
+ GetTypeNameHelper(out string name, out _, out _);
return name;
}
}
@@ -338,8 +336,7 @@ public string DiagnosticModuleName
{
get
{
- string name, nsName, assemblyName;
- GetTypeNameHelper(out name, out nsName, out assemblyName);
+ GetTypeNameHelper(out _, out _, out string assemblyName);
return assemblyName;
}
}
diff --git a/src/coreclr/pal/inc/pal.h b/src/coreclr/pal/inc/pal.h
index 237b75275cec96..bc531d43671740 100644
--- a/src/coreclr/pal/inc/pal.h
+++ b/src/coreclr/pal/inc/pal.h
@@ -3934,8 +3934,6 @@ PAL_GetCurrentThreadAffinitySet(SIZE_T size, UINT_PTR* data);
#define wcspbrk PAL_wcspbrk
#define wcscmp PAL_wcscmp
#define wcsncpy PAL_wcsncpy
-#define wcstok PAL_wcstok
-#define wcscspn PAL_wcscspn
#define realloc PAL_realloc
#define fopen PAL_fopen
#define strtok PAL_strtok
@@ -4125,8 +4123,6 @@ PALIMPORT DLLEXPORT const WCHAR * __cdecl PAL_wcschr(const WCHAR *, WCHAR);
PALIMPORT DLLEXPORT const WCHAR * __cdecl PAL_wcsrchr(const WCHAR *, WCHAR);
PALIMPORT WCHAR _WConst_return * __cdecl PAL_wcspbrk(const WCHAR *, const WCHAR *);
PALIMPORT DLLEXPORT WCHAR _WConst_return * __cdecl PAL_wcsstr(const WCHAR *, const WCHAR *);
-PALIMPORT WCHAR * __cdecl PAL_wcstok(WCHAR *, const WCHAR *);
-PALIMPORT DLLEXPORT size_t __cdecl PAL_wcscspn(const WCHAR *, const WCHAR *);
PALIMPORT int __cdecl PAL_swprintf(WCHAR *, const WCHAR *, ...);
PALIMPORT int __cdecl PAL_vswprintf(WCHAR *, const WCHAR *, va_list);
PALIMPORT int __cdecl PAL_swscanf(const WCHAR *, const WCHAR *, ...);
diff --git a/src/coreclr/pal/inc/palprivate.h b/src/coreclr/pal/inc/palprivate.h
index 097229eb64ef4a..f90352b32355e8 100644
--- a/src/coreclr/pal/inc/palprivate.h
+++ b/src/coreclr/pal/inc/palprivate.h
@@ -203,8 +203,6 @@ CompareFileTime(
IN CONST FILETIME *lpFileTime1,
IN CONST FILETIME *lpFileTime2);
-PALIMPORT char * __cdecl _fullpath(char *, const char *, size_t);
-
/* These are from the file in windows.
They are needed for _open_osfhandle.*/
#define _O_RDONLY 0x0000
diff --git a/src/coreclr/pal/inc/rt/sal.h b/src/coreclr/pal/inc/rt/sal.h
index 88991ce4464e43..ef976be402fdc5 100644
--- a/src/coreclr/pal/inc/rt/sal.h
+++ b/src/coreclr/pal/inc/rt/sal.h
@@ -2648,12 +2648,6 @@ buffer, use the table in the buffer annotations section.
-------------------------------------------------------------------------------
*/
-// These macros conflict with c++ headers.
-#ifndef PAL_STDCPP_COMPAT
-#define __in _SAL1_Source_(__in, (), _In_)
-#define __out _SAL1_Source_(__out, (), _Out_)
-#endif // !PAL_STDCPP_COMPAT
-
#define __ecount(size) _SAL1_Source_(__ecount, (size), __notnull __elem_writableTo(size))
#define __bcount(size) _SAL1_Source_(__bcount, (size), __notnull __byte_writableTo(size))
#define __in_ecount(size) _SAL1_Source_(__in_ecount, (size), _In_reads_(size))
@@ -2868,6 +2862,10 @@ of each annotation, see the advanced annotations section.
#define __useHeader _Use_decl_anno_impl_
#define __on_failure(annotes) _On_failure_impl_(annotes _SAL_nop_impl_)
+#ifndef __has_cpp_attribute
+#define __has_cpp_attribute(x) (0)
+#endif
+
#ifndef __fallthrough // [
#if __has_cpp_attribute(fallthrough)
#define __fallthrough [[fallthrough]]
diff --git a/src/coreclr/pal/inc/rt/specstrings.h b/src/coreclr/pal/inc/rt/specstrings.h
index 5f5e6e1cf9a4e6..749b20ff4638f6 100644
--- a/src/coreclr/pal/inc/rt/specstrings.h
+++ b/src/coreclr/pal/inc/rt/specstrings.h
@@ -97,7 +97,7 @@ __ANNOTATION(SAL_failureDefault(enum __SAL_failureKind));
#endif // ]
#define __xcount(size) __notnull __inexpressible_writableTo(size)
-#define __in_xcount(size) __in _Pre_ __inexpressible_readableTo(size)
+#define __in_xcount(size) _In_ _Pre_ __inexpressible_readableTo(size)
#define __out_xcount(size) __xcount(size) _Post_ __valid __refparam
#define __out_xcount_part(size,length) __out_xcount(size) _Post_ __inexpressible_readableTo(length)
#define __out_xcount_full(size) __out_xcount_part(size,size)
@@ -113,7 +113,7 @@ __ANNOTATION(SAL_failureDefault(enum __SAL_failureKind));
#define __inout_xcount_part_opt(size,length) __inout_xcount_part(size,length) __exceptthat __maybenull
#define __inout_xcount_full_opt(size) __inout_xcount_full(size) __exceptthat __maybenull
#define __deref_xcount(size) __ecount(1) _Post_ __elem_readableTo(1) _Post_ __deref __notnull _Post_ __deref __inexpressible_writableTo(size)
-#define __deref_in __in _Pre_ __deref __deref __readonly
+#define __deref_in _In_ _Pre_ __deref __deref __readonly
#define __deref_in_ecount(size) __deref_in _Pre_ __deref __elem_readableTo(size)
#define __deref_in_bcount(size) __deref_in _Pre_ __deref __byte_readableTo(size)
#define __deref_in_xcount(size) __deref_in _Pre_ __deref __inexpressible_readableTo(size)
@@ -125,7 +125,7 @@ __ANNOTATION(SAL_failureDefault(enum __SAL_failureKind));
#define __inout_xcount_part_opt(size,length) __inout_xcount_part(size,length) __exceptthat __maybenull
#define __inout_xcount_full_opt(size) __inout_xcount_full(size) __exceptthat __maybenull
#define __deref_xcount(size) __ecount(1) _Post_ __elem_readableTo(1) _Post_ __deref __notnull _Post_ __deref __inexpressible_writableTo(size)
-#define __deref_in __in _Pre_ __deref __deref __readonly
+#define __deref_in _In_ _Pre_ __deref __deref __readonly
#define __deref_in_ecount(size) __deref_in _Pre_ __deref __elem_readableTo(size)
#define __deref_in_bcount(size) __deref_in _Pre_ __deref __byte_readableTo(size)
#define __deref_in_xcount(size) __deref_in _Pre_ __deref __inexpressible_readableTo(size)
diff --git a/src/coreclr/pal/inc/rt/specstrings_strict.h b/src/coreclr/pal/inc/rt/specstrings_strict.h
index 7aaabd1661c6a0..816ba80298ab5f 100644
--- a/src/coreclr/pal/inc/rt/specstrings_strict.h
+++ b/src/coreclr/pal/inc/rt/specstrings_strict.h
@@ -150,11 +150,11 @@
* LWSTDAPI_(BOOL) StrToIntExA(
* LPCSTR pszString, // No annotation required, const implies __in.
* DWORD dwFlags,
-* __out int *piRet // A pointer whose dereference will be filled in.
+* _Out_ int *piRet // A pointer whose dereference will be filled in.
* );
*
* void MyPaintingFunction(
-* __in HWND hwndControl, // An initialized read-only parameter.
+* _In_ HWND hwndControl, // An initialized read-only parameter.
* __in_opt HDC hdcOptional, // An initialized read-only parameter that
* // might be NULL.
* __inout IPropertyStore *ppsStore // An initialized parameter that
@@ -192,14 +192,12 @@
#define __ecount(size) _SAL_VERSION_CHECK(__ecount)
#define __bcount(size) _SAL_VERSION_CHECK(__bcount)
#define __xcount(size) _SAL_VERSION_CHECK(__xcount)
-#define __in _SAL_VERSION_CHECK(__in)
#define __in_ecount(size) _SAL_VERSION_CHECK(__in_ecount)
#define __in_bcount(size) _SAL_VERSION_CHECK(__in_bcount)
#define __in_xcount(size) _SAL_VERSION_CHECK(__in_xcount)
#define __in_z _SAL_VERSION_CHECK(__in_z)
#define __in_ecount_z(size) _SAL_VERSION_CHECK(__in_ecount_z)
#define __in_bcount_z(size) _SAL_VERSION_CHECK(__in_bcount_z)
-#define __out _SAL_VERSION_CHECK(__out)
#define __out_ecount(size) _SAL_VERSION_CHECK(__out_ecount)
#define __out_bcount(size) _SAL_VERSION_CHECK(__out_bcount)
#define __out_xcount(size) _SAL_VERSION_CHECK(__out_xcount)
@@ -772,14 +770,14 @@
* __field_bcount_full(sz)
* char *buf;
* };
-* void InitBuf(__out struct *buf_s b,int sz) {
+* void InitBuf(_Out_ struct *buf_s b,int sz) {
* b->buf = calloc(sz,sizeof(char));
* b->sz = sz;
* }
-* void WriteBuf(__in FILE *fp,__in struct *buf_s b) {
+* void WriteBuf(_In_ FILE *fp,_In_ struct *buf_s b) {
* fwrite(b->buf,b->sz,sizeof(char),fp);
* }
-* void ReadBuf(__in FILE *fp,__inout struct *buf_s b) {
+* void ReadBuf(_In_ FILE *fp,__inout struct *buf_s b) {
* fread(b->buf,b->sz,sizeof(char),fp);
* }
*
@@ -791,10 +789,10 @@
* __field_bcount(sz)
* char buf[1];
* };
-* void WriteBuf(__in FILE *fp,__in struct *buf_s b) {
+* void WriteBuf(_In_ FILE *fp,_In_ struct *buf_s b) {
* fwrite(&(b->buf),b->sz,sizeof(char),fp);
* }
-* void ReadBuf(__in FILE *fp,__inout struct *buf_s b) {
+* void ReadBuf(_In_ FILE *fp,__inout struct *buf_s b) {
* fread(&(b->buf),b->sz,sizeof(char),fp);
* }
*
@@ -805,10 +803,10 @@
* struct buf_s {
* int sz;
* };
-* void WriteBuf(__in FILE *fp,__in struct *buf_s b) {
+* void WriteBuf(_In_ FILE *fp,_In_ struct *buf_s b) {
* fwrite(&b,b->sz,sizeof(char),fp);
* }
-* void ReadBuf(__in FILE *fp,__inout struct *buf_s b) {
+* void ReadBuf(_In_ FILE *fp,__inout struct *buf_s b) {
* fread(&b,b->sz,sizeof(char),fp);
* }
*
diff --git a/src/coreclr/pal/src/CMakeLists.txt b/src/coreclr/pal/src/CMakeLists.txt
index 4f071b21046b07..afab5e6518455a 100644
--- a/src/coreclr/pal/src/CMakeLists.txt
+++ b/src/coreclr/pal/src/CMakeLists.txt
@@ -123,7 +123,6 @@ set(SOURCES
cruntime/malloc.cpp
cruntime/math.cpp
cruntime/misc.cpp
- cruntime/path.cpp
cruntime/printf.cpp
cruntime/printfcpp.cpp
cruntime/silent_printf.cpp
@@ -131,7 +130,6 @@ set(SOURCES
cruntime/stringtls.cpp
cruntime/thread.cpp
cruntime/wchar.cpp
- cruntime/wchartls.cpp
debug/debug.cpp
exception/seh.cpp
exception/signal.cpp
diff --git a/src/coreclr/pal/src/cruntime/path.cpp b/src/coreclr/pal/src/cruntime/path.cpp
deleted file mode 100644
index c25636771bc616..00000000000000
--- a/src/coreclr/pal/src/cruntime/path.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*++
-
-
-
-Module Name:
-
- path.c
-
-Abstract:
-
- Implementation of path functions part of Windows runtime library.
-
-Revision History:
-
-
-
---*/
-
-#include "pal/palinternal.h"
-#include "pal/dbgmsg.h"
-#include "pal/file.h"
-#include "pal/printfcpp.hpp"
-
-#include
-#include
-#include
-#include
-#include
-
-SET_DEFAULT_DEBUG_CHANNEL(CRT);
-
-/*++
-Function:
- _fullpath
-
-See MSDN doc.
-
---*/
-char *
-__cdecl
-_fullpath(
- char *absPath,
- const char *relPath,
- size_t maxLength)
-{
- char realpath_buf[PATH_MAX+1];
- char path_copy[PATH_MAX+1];
- char *retval = NULL;
- DWORD cPathCopy = sizeof(path_copy)/sizeof(path_copy[0]);
- size_t min_length;
- BOOL fBufAllocated = FALSE;
-
- PERF_ENTRY(_fullpath);
- ENTRY("_fullpath (absPath=%p, relPath=%p (%s), maxLength = %lu)\n",
- absPath, relPath ? relPath:"NULL", relPath ? relPath:"NULL", maxLength);
-
- if (strncpy_s(path_copy, sizeof(path_copy), relPath ? relPath : ".", cPathCopy) != SAFECRT_SUCCESS)
- {
- TRACE("_fullpath: strncpy_s failed!\n");
- goto fullpathExit;
- }
-
- FILEDosToUnixPathA(path_copy);
-
- if(NULL == realpath(path_copy, realpath_buf))
- {
- ERROR("realpath() failed; problem path is '%s'. errno is %d (%s)\n",
- realpath_buf, errno, strerror(errno));
- goto fullpathExit;
- }
-
- TRACE("real path is %s\n", realpath_buf);
- min_length = strlen(realpath_buf)+1; // +1 for the NULL terminator
-
- if(NULL == absPath)
- {
- absPath = static_cast(
- PAL_malloc(_MAX_PATH * sizeof(char)));
- if (!absPath)
- {
- ERROR("PAL_malloc failed with error %d\n", errno);
- goto fullpathExit;
- }
- maxLength = _MAX_PATH;
- fBufAllocated = TRUE;
- }
-
- if(min_length > maxLength)
- {
- ERROR("maxLength is %lu, we need at least %lu\n",
- maxLength, min_length);
- if (fBufAllocated)
- {
- PAL_free(absPath);
- fBufAllocated = FALSE;
- }
- goto fullpathExit;
- }
-
- strcpy_s(absPath, maxLength, realpath_buf);
- retval = absPath;
-
-fullpathExit:
- LOGEXIT("_fullpath returns char * %p\n", retval);
- PERF_EXIT(_fullpath);
- return retval;
-}
-
-
-
diff --git a/src/coreclr/pal/src/cruntime/wchar.cpp b/src/coreclr/pal/src/cruntime/wchar.cpp
index 5c21d7bd015335..3d887aecdb8835 100644
--- a/src/coreclr/pal/src/cruntime/wchar.cpp
+++ b/src/coreclr/pal/src/cruntime/wchar.cpp
@@ -3,8 +3,6 @@
/*++
-
-
Module Name:
wchar.c
@@ -13,11 +11,8 @@ Module Name:
Implementation of wide char string functions.
-
-
--*/
-
#include "pal/palinternal.h"
#include "pal/cruntime.h"
#include "pal/dbgmsg.h"
@@ -25,7 +20,6 @@ Module Name:
#include "pal/thread.hpp"
#include "pal/threadsusp.hpp"
-
#if HAVE_CONFIG_H
#include "config.h"
#endif
@@ -950,46 +944,3 @@ PAL_wcstod( const wchar_16 * nptr, wchar_16 **endptr )
PERF_EXIT(wcstod);
return RetVal;
}
-
-/*++
-Function:
- PAL_wcscspn
-
-Finds the number of consecutive characters from the start of the string
-that are not in the set.
-
-Return value:
-
-The number of characters from the start of the string that are not in
-the set.
-
-Parameters:
-string String
-strCharSet Set of delimiter characters
-
---*/
-size_t
-__cdecl
-PAL_wcscspn(const wchar_16 *string, const wchar_16 *strCharSet)
-{
- const wchar_16 *temp;
- size_t count = 0;
-
- PERF_ENTRY(wcscspn);
-
- while(*string != 0)
- {
- for(temp = strCharSet; *temp != 0; temp++)
- {
- if (*string == *temp)
- {
- PERF_EXIT(wcscspn);
- return count;
- }
- }
- count++;
- string++;
- }
- PERF_EXIT(wcscspn);
- return count;
-}
diff --git a/src/coreclr/pal/src/cruntime/wchartls.cpp b/src/coreclr/pal/src/cruntime/wchartls.cpp
deleted file mode 100644
index 35b73359889a56..00000000000000
--- a/src/coreclr/pal/src/cruntime/wchartls.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*++
-
-
-
-Module Name:
-
- wchartls.c
-
-Abstract:
-
- Implementation of wide char string functions that depend on per-thread data
-
-
-
---*/
-
-#include "pal/palinternal.h"
-#include "pal/thread.hpp"
-#include "pal/dbgmsg.h"
-
-using namespace CorUnix;
-
-
-SET_DEFAULT_DEBUG_CHANNEL(CRT);
-
-/*++
-Function:
- PAL_wcstok
-
-Finds the next token in a wide character string.
-
-Return value:
-
-A pointer to the next token found in strToken. Returns NULL when no more
-tokens are found. Each call modifies strToken by substituting a NULL
-character for each delimiter that is encountered.
-
-Parameters:
-strToken String containing token(s)
-strDelimit Set of delimiter characters
-
---*/
-WCHAR *
-__cdecl
-PAL_wcstok(WCHAR *strToken, const WCHAR *strDelimit)
-{
- CPalThread *pThread = NULL;
- WCHAR *retval = NULL;
- WCHAR *delim_ptr;
- WCHAR *next_context; /* string to save in TLS for future calls */
-
- PERF_ENTRY(wcstok);
- ENTRY("PAL_wcstok (strToken=%p (%S), strDelimit=%p (%S))\n",
- strToken?strToken:W16_NULLSTRING,
- strToken?strToken:W16_NULLSTRING,
- strDelimit?strDelimit:W16_NULLSTRING,
- strDelimit?strDelimit:W16_NULLSTRING);
-
- /* Get the per-thread buffer from the thread structure. */
- pThread = InternalGetCurrentThread();
-
- if(NULL == strDelimit)
- {
- ERROR("delimiter string is NULL\n");
- goto done;
- }
-
- /* get token string from TLS if none is provided */
- if(NULL == strToken)
- {
- TRACE("wcstok() called with NULL string, using previous string\n");
- strToken = pThread->crtInfo.wcstokContext;
- if(NULL == strToken)
- {
- ERROR("wcstok called with NULL string without a previous call\n");
- goto done;
- }
- }
-
- /* first, skip all leading delimiters */
- while ((*strToken != '\0') && (PAL_wcschr(strDelimit,*strToken)))
- {
- strToken++;
- }
-
- /* if there were only delimiters, there's no string */
- if('\0' == strToken[0])
- {
- TRACE("end of string already reached, returning NULL\n");
- goto done;
- }
-
- /* we're now at the beginning of the token; look for the first delimiter */
- delim_ptr = PAL_wcspbrk(strToken,strDelimit);
- if(NULL == delim_ptr)
- {
- TRACE("no delimiters found, this is the last token\n");
- /* place the next context at the end of the string, so that subsequent
- calls will return NULL */
- next_context = strToken+PAL_wcslen(strToken);
- retval = strToken;
- }
- else
- {
- /* null-terminate current token */
- *delim_ptr=0;
-
- /* place the next context right after the delimiter */
- next_context = delim_ptr+1;
- retval = strToken;
-
- TRACE("found delimiter; next token will be %p\n",next_context);
- }
-
- pThread->crtInfo.wcstokContext = next_context;
-
-done:
- LOGEXIT("PAL_wcstok() returns %p (%S)\n", retval?retval:W16_NULLSTRING, retval?retval:W16_NULLSTRING);
- PERF_EXIT(wcstok);
- return(retval);
-}
-
diff --git a/src/coreclr/pal/src/eventprovider/CMakeLists.txt b/src/coreclr/pal/src/eventprovider/CMakeLists.txt
index aaf420458a6bc1..143206b5c34f54 100644
--- a/src/coreclr/pal/src/eventprovider/CMakeLists.txt
+++ b/src/coreclr/pal/src/eventprovider/CMakeLists.txt
@@ -1,6 +1,6 @@
set(EVENT_MANIFEST ${VM_DIR}/ClrEtwAll.man)
-if(CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_FREEBSD)
+if(CLR_CMAKE_HOST_LINUX)
add_subdirectory(lttngprovider)
else()
add_subdirectory(dummyprovider)
diff --git a/src/coreclr/pal/src/exception/remote-unwind.cpp b/src/coreclr/pal/src/exception/remote-unwind.cpp
index af0293ba5bc60c..b27fc9680bbedf 100644
--- a/src/coreclr/pal/src/exception/remote-unwind.cpp
+++ b/src/coreclr/pal/src/exception/remote-unwind.cpp
@@ -57,6 +57,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include
#include
#include "compact_unwind_encoding.h"
+#define MACOS_ARM64_POINTER_AUTH_MASK 0x7fffffffffffull
#endif
// Sub-headers included from the libunwind.h contain an empty struct
@@ -1422,25 +1423,56 @@ StepWithCompactNoEncoding(const libunwindInfo* info)
#if defined(TARGET_ARM64)
-inline static bool
+#define ARM64_SYSCALL_OPCODE 0xD4001001
+#define ARM64_BL_OPCODE_MASK 0xFC000000
+#define ARM64_BL_OPCODE 0x94000000
+#define ARM64_BLR_OPCODE_MASK 0xFFFFFC00
+#define ARM64_BLR_OPCODE 0xD63F0000
+#define ARM64_BLRA_OPCODE_MASK 0xFEFFF800
+#define ARM64_BLRA_OPCODE 0xD63F0800
+
+static bool
+StepWithCompactNoEncoding(const libunwindInfo* info)
+{
+ // Check that the function is a syscall "wrapper" and assume there is no frame and pop the return address.
+ uint32_t opcode;
+ unw_word_t addr = info->Context->Pc - sizeof(opcode);
+ if (!ReadValue32(info, &addr, &opcode)) {
+ ERROR("StepWithCompactNoEncoding: can read opcode %p\n", (void*)addr);
+ return false;
+ }
+ // Is the IP pointing just after a "syscall" opcode?
+ if (opcode != ARM64_SYSCALL_OPCODE) {
+ ERROR("StepWithCompactNoEncoding: not in syscall wrapper function\n");
+ return false;
+ }
+ // Pop the return address from the stack
+ info->Context->Pc = info->Context->Lr;
+ TRACE("StepWithCompactNoEncoding: SUCCESS new pc %p sp %p\n", (void*)info->Context->Pc, (void*)info->Context->Sp);
+ return true;
+}
+
+static bool
ReadCompactEncodingRegister(const libunwindInfo* info, unw_word_t* addr, DWORD64* reg)
{
- *addr -= sizeof(uint64_t);
- if (!ReadValue64(info, addr, (uint64_t*)reg)) {
+ uint64_t value;
+ if (!info->ReadMemory((PVOID)*addr, &value, sizeof(value))) {
return false;
}
+ *reg = VAL64(value);
+ *addr -= sizeof(uint64_t);
return true;
}
-inline static bool
-ReadCompactEncodingRegisterPair(const libunwindInfo* info, unw_word_t* addr, DWORD64*second, DWORD64* first)
+static bool
+ReadCompactEncodingRegisterPair(const libunwindInfo* info, unw_word_t* addr, DWORD64* first, DWORD64* second)
{
// Registers are effectively pushed in pairs
//
+ // *first = **addr
// *addr -= 8
- // **addr = *first
+ // *second= **addr
// *addr -= 8
- // **addr = *second
if (!ReadCompactEncodingRegister(info, addr, first)) {
return false;
}
@@ -1450,8 +1482,8 @@ ReadCompactEncodingRegisterPair(const libunwindInfo* info, unw_word_t* addr, DWO
return true;
}
-inline static bool
-ReadCompactEncodingRegisterPair(const libunwindInfo* info, unw_word_t* addr, NEON128*second, NEON128* first)
+static bool
+ReadCompactEncodingRegisterPair(const libunwindInfo* info, unw_word_t* addr, NEON128* first, NEON128* second)
{
if (!ReadCompactEncodingRegisterPair(info, addr, &first->Low, &second->Low)) {
return false;
@@ -1484,30 +1516,28 @@ static bool
StepWithCompactEncodingArm64(const libunwindInfo* info, compact_unwind_encoding_t compactEncoding, bool hasFrame)
{
CONTEXT* context = info->Context;
+ unw_word_t addr;
- unw_word_t callerSp;
-
- if (hasFrame) {
- // caller Sp is callee Fp plus saved FP and LR
- callerSp = context->Fp + 2 * sizeof(uint64_t);
- } else {
+ if (hasFrame)
+ {
+ context->Sp = context->Fp + 16;
+ addr = context->Fp + 8;
+ if (!ReadCompactEncodingRegisterPair(info, &addr, &context->Lr, &context->Fp)) {
+ return false;
+ }
+ // Strip pointer authentication bits
+ context->Lr &= MACOS_ARM64_POINTER_AUTH_MASK;
+ }
+ else
+ {
// Get the leat significant bit in UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK
uint64_t stackSizeScale = UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK & ~(UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK - 1);
- uint64_t stackSize = (compactEncoding & UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK) / stackSizeScale * 16;
+ uint64_t stackSize = ((compactEncoding & UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK) / stackSizeScale) * 16;
- callerSp = context->Sp + stackSize;
+ addr = context->Sp + stackSize;
}
- context->Sp = callerSp;
-
- unw_word_t addr = callerSp;
-
- if (hasFrame &&
- !ReadCompactEncodingRegisterPair(info, &addr, &context->Lr, &context->Fp)) {
- return false;
- }
-
- // unwound return address is stored in Lr
+ // Unwound return address is stored in Lr
context->Pc = context->Lr;
if (compactEncoding & UNWIND_ARM64_FRAME_X19_X20_PAIR &&
@@ -1546,7 +1576,10 @@ StepWithCompactEncodingArm64(const libunwindInfo* info, compact_unwind_encoding_
!ReadCompactEncodingRegisterPair(info, &addr, &context->V[14], &context->V[15])) {
return false;
}
-
+ if (!hasFrame)
+ {
+ context->Sp = addr;
+ }
TRACE("SUCCESS: compact step encoding %08x pc %p sp %p fp %p lr %p\n",
compactEncoding, (void*)context->Pc, (void*)context->Sp, (void*)context->Fp, (void*)context->Lr);
return true;
@@ -1557,11 +1590,11 @@ StepWithCompactEncodingArm64(const libunwindInfo* info, compact_unwind_encoding_
static bool
StepWithCompactEncoding(const libunwindInfo* info, compact_unwind_encoding_t compactEncoding, unw_word_t functionStart)
{
-#if defined(TARGET_AMD64)
if (compactEncoding == 0)
{
return StepWithCompactNoEncoding(info);
}
+#if defined(TARGET_AMD64)
switch (compactEncoding & UNWIND_X86_64_MODE_MASK)
{
case UNWIND_X86_64_MODE_RBP_FRAME:
@@ -1575,11 +1608,6 @@ StepWithCompactEncoding(const libunwindInfo* info, compact_unwind_encoding_t com
return false;
}
#elif defined(TARGET_ARM64)
- if (compactEncoding == 0)
- {
- TRACE("Compact unwind missing for %p\n", (void*)info->Context->Pc);
- return false;
- }
switch (compactEncoding & UNWIND_ARM64_MODE_MASK)
{
case UNWIND_ARM64_MODE_FRAME:
@@ -1717,6 +1745,12 @@ static void UnwindContextToContext(unw_cursor_t *cursor, CONTEXT *winContext)
unw_get_reg(cursor, UNW_AARCH64_X28, (unw_word_t *) &winContext->X28);
unw_get_reg(cursor, UNW_AARCH64_X29, (unw_word_t *) &winContext->Fp);
unw_get_reg(cursor, UNW_AARCH64_X30, (unw_word_t *) &winContext->Lr);
+#ifdef __APPLE__
+ // Strip pointer authentication bits which seem to be leaking out of libunwind
+ // Seems like ptrauth_strip() / __builtin_ptrauth_strip() should work, but currently
+ // errors with "this target does not support pointer authentication"
+ winContext->Pc = winContext->Pc & MACOS_ARM64_POINTER_AUTH_MASK;
+#endif // __APPLE__
TRACE("sp %p pc %p lr %p fp %p\n", winContext->Sp, winContext->Pc, winContext->Lr, winContext->Fp);
#elif defined(TARGET_S390X)
unw_get_reg(cursor, UNW_REG_IP, (unw_word_t *) &winContext->PSWAddr);
@@ -2126,6 +2160,33 @@ PAL_VirtualUnwindOutOfProc(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *cont
#elif defined(TARGET_ARM64)
TRACE("Unwind: pc %p sp %p fp %p\n", (void*)context->Pc, (void*)context->Sp, (void*)context->Fp);
result = GetProcInfo(context->Pc, &procInfo, &info, &step, false);
+ if (result && step)
+ {
+ // If the PC is at the start of the function, the previous instruction is BL and the unwind encoding is frameless
+ // with nothing on stack (0x02000000), back up PC by 1 to the previous function and get the unwind info for that
+ // function.
+ if ((context->Pc == procInfo.start_ip) &&
+ (procInfo.format & (UNWIND_ARM64_MODE_MASK | UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK)) == UNWIND_ARM64_MODE_FRAMELESS)
+ {
+ uint32_t opcode;
+ unw_word_t addr = context->Pc - sizeof(opcode);
+ if (ReadValue32(&info, &addr, &opcode))
+ {
+ // Is the previous instruction a BL opcode?
+ if ((opcode & ARM64_BL_OPCODE_MASK) == ARM64_BL_OPCODE ||
+ (opcode & ARM64_BLR_OPCODE_MASK) == ARM64_BLR_OPCODE ||
+ (opcode & ARM64_BLRA_OPCODE_MASK) == ARM64_BLRA_OPCODE)
+ {
+ TRACE("Unwind: getting unwind info for PC - 1 opcode %08x\n", opcode);
+ result = GetProcInfo(context->Pc - 1, &procInfo, &info, &step, false);
+ }
+ else
+ {
+ TRACE("Unwind: not BL* opcode %08x\n", opcode);
+ }
+ }
+ }
+ }
#else
#error Unexpected architecture
#endif
diff --git a/src/coreclr/pal/src/exception/seh-unwind.cpp b/src/coreclr/pal/src/exception/seh-unwind.cpp
index 4b149f941b5dc9..750f19109fbaa7 100644
--- a/src/coreclr/pal/src/exception/seh-unwind.cpp
+++ b/src/coreclr/pal/src/exception/seh-unwind.cpp
@@ -699,7 +699,7 @@ PAL_FreeExceptionRecords(IN EXCEPTION_RECORD *exceptionRecord, IN CONTEXT *conte
Note:
The name of this function and the name of the ExceptionRecord
parameter is used in the sos lldb plugin code to read the exception
- record. See coreclr\ToolBox\SOS\lldbplugin\services.cpp.
+ record. See coreclr\tools\SOS\lldbplugin\services.cpp.
This function must not be inlined or optimized so the below PAL_VirtualUnwind
calls end up with RaiseException caller's context and so the above debugger
diff --git a/src/coreclr/pal/src/file/file.cpp b/src/coreclr/pal/src/file/file.cpp
index 59cfd07fbdbdd8..71f35f810bcf19 100644
--- a/src/coreclr/pal/src/file/file.cpp
+++ b/src/coreclr/pal/src/file/file.cpp
@@ -1617,7 +1617,7 @@ GetFileAttributesExW(
attr_data = (LPWIN32_FILE_ATTRIBUTE_DATA)lpFileInformation;
attr_data->dwFileAttributes = GetFileAttributesW(lpFileName);
- /* assume that GetFileAttributes will call SetLastError appropriately */
+ /* assume that GetFileAttributesW will call SetLastError appropriately */
if ( attr_data->dwFileAttributes == (DWORD)-1 )
{
goto done;
@@ -1753,7 +1753,7 @@ SetFileAttributesA(
new_mode = stat_data.st_mode;
TRACE("st_mode is %#x\n", new_mode);
- /* if we can't do GetFileAttributes on it, don't do SetFileAttributes */
+ /* if we can't do GetFileAttributesA on it, don't do SetFileAttributesA */
if ( !(new_mode & S_IFREG) && !(new_mode & S_IFDIR) )
{
ERROR("Not a regular file or directory, S_IFMT is %#x\n",
@@ -3542,10 +3542,10 @@ CopyFileA(
}
/* Need to preserve the file attributes */
- dwSrcFileAttributes = GetFileAttributes(lpExistingFileName);
+ dwSrcFileAttributes = GetFileAttributesA(lpExistingFileName);
if (dwSrcFileAttributes == 0xffffffff)
{
- ERROR("GetFileAttributes failed for %s\n", lpExistingFileName);
+ ERROR("GetFileAttributesA failed for %s\n", lpExistingFileName);
goto done;
}
diff --git a/src/coreclr/pal/src/include/pal/palinternal.h b/src/coreclr/pal/src/include/pal/palinternal.h
index 3a12d789103647..ff3703c6ae4f7f 100644
--- a/src/coreclr/pal/src/include/pal/palinternal.h
+++ b/src/coreclr/pal/src/include/pal/palinternal.h
@@ -526,8 +526,6 @@ function_name() to call the system's implementation
#undef wcsstr
#undef wcscmp
#undef wcsncpy
-#undef wcstok
-#undef wcscspn
#undef iswupper
#undef iswspace
#undef towlower
diff --git a/src/coreclr/pal/src/misc/jitsupport.cpp b/src/coreclr/pal/src/misc/jitsupport.cpp
index 2addd1526e64c8..6dcc535f2aa14c 100644
--- a/src/coreclr/pal/src/misc/jitsupport.cpp
+++ b/src/coreclr/pal/src/misc/jitsupport.cpp
@@ -260,11 +260,26 @@ PAL_GetJitCpuCapabilityFlags(CORJIT_FLAGS *flags)
int64_t valueFromSysctl = 0;
size_t sz = sizeof(valueFromSysctl);
- if ((sysctlbyname("hw.optional.armv8_1_atomics", &valueFromSysctl, &sz, nullptr, 0) == 0) && (valueFromSysctl != 0))
- flags->Set(InstructionSet_Atomics);
+ if ((sysctlbyname("hw.optional.arm.FEAT_AES", &valueFromSysctl, &sz, nullptr, 0) == 0) && (valueFromSysctl != 0))
+ flags->Set(InstructionSet_Aes);
if ((sysctlbyname("hw.optional.armv8_crc32", &valueFromSysctl, &sz, nullptr, 0) == 0) && (valueFromSysctl != 0))
flags->Set(InstructionSet_Crc32);
+
+ if ((sysctlbyname("hw.optional.arm.FEAT_DotProd", &valueFromSysctl, &sz, nullptr, 0) == 0) && (valueFromSysctl != 0))
+ flags->Set(InstructionSet_Dp);
+
+ if ((sysctlbyname("hw.optional.arm.FEAT_RDM", &valueFromSysctl, &sz, nullptr, 0) == 0) && (valueFromSysctl != 0))
+ flags->Set(InstructionSet_Rdm);
+
+ if ((sysctlbyname("hw.optional.arm.FEAT_SHA1", &valueFromSysctl, &sz, nullptr, 0) == 0) && (valueFromSysctl != 0))
+ flags->Set(InstructionSet_Sha1);
+
+ if ((sysctlbyname("hw.optional.arm.FEAT_SHA256", &valueFromSysctl, &sz, nullptr, 0) == 0) && (valueFromSysctl != 0))
+ flags->Set(InstructionSet_Sha256);
+
+ if ((sysctlbyname("hw.optional.armv8_1_atomics", &valueFromSysctl, &sz, nullptr, 0) == 0) && (valueFromSysctl != 0))
+ flags->Set(InstructionSet_Atomics);
#endif // HAVE_SYSCTLBYNAME
// CoreCLR SIMD and FP support is included in ARM64 baseline
// On exceptional basis platforms may leave out support, but CoreCLR does not
diff --git a/src/coreclr/pal/src/safecrt/internal.h b/src/coreclr/pal/src/safecrt/internal.h
index 9537f6f0957700..02f8f80091aa50 100644
--- a/src/coreclr/pal/src/safecrt/internal.h
+++ b/src/coreclr/pal/src/safecrt/internal.h
@@ -264,34 +264,34 @@ extern int _nstream;
extern void **__piob;
FILE * __cdecl _getstream(void);
-FILE * __cdecl _openfile(__in_z const char * _Filename, __in_z const char * _Mode, __in int _ShFlag, __out FILE * _File);
-FILE * __cdecl _wopenfile(__in_z const char16_t * _Filename, __in_z const char16_t * _Mode, __in int _ShFlag, __out FILE * _File);
-void __cdecl _getbuf(__out FILE * _File);
+FILE * __cdecl _openfile(_In_z_ const char * _Filename, _In_z_ const char * _Mode, _In_ int _ShFlag, _Out_ FILE * _File);
+FILE * __cdecl _wopenfile(_In_z_ const char16_t * _Filename, _In_z_ const char16_t * _Mode, _In_ int _ShFlag, _Out_ FILE * _File);
+void __cdecl _getbuf(_Out_ FILE * _File);
int __cdecl _filwbuf (__inout FILE * _File);
-int __cdecl _flswbuf(__in int _Ch, __inout FILE * _File);
+int __cdecl _flswbuf(_In_ int _Ch, __inout FILE * _File);
void __cdecl _freebuf(__inout FILE * _File);
int __cdecl _stbuf(__inout FILE * _File);
void __cdecl _ftbuf(int _Flag, __inout FILE * _File);
#ifdef _SAFECRT_IMPL
-int __cdecl _output(__inout FILE * _File, __in_z __format_string const char *_Format, va_list _ArgList);
-int __cdecl _woutput(__inout FILE * _File, __in_z __format_string const char16_t *_Format, va_list _ArgList);
-int __cdecl _output_s(__inout FILE * _File, __in_z __format_string const char *_Format, va_list _ArgList);
-int __cdecl _output_p(__inout FILE * _File, __in_z __format_string const char *_Format, va_list _ArgList);
-int __cdecl _woutput_s(__inout FILE * _File, __in_z __format_string const char16_t *_Format, va_list _ArgList);
-int __cdecl _woutput_p(__inout FILE * _File, __in_z __format_string const char16_t *_Format, va_list _ArgList);
+int __cdecl _output(__inout FILE * _File, _In_z_ __format_string const char *_Format, va_list _ArgList);
+int __cdecl _woutput(__inout FILE * _File, _In_z_ __format_string const char16_t *_Format, va_list _ArgList);
+int __cdecl _output_s(__inout FILE * _File, _In_z_ __format_string const char *_Format, va_list _ArgList);
+int __cdecl _output_p(__inout FILE * _File, _In_z_ __format_string const char *_Format, va_list _ArgList);
+int __cdecl _woutput_s(__inout FILE * _File, _In_z_ __format_string const char16_t *_Format, va_list _ArgList);
+int __cdecl _woutput_p(__inout FILE * _File, _In_z_ __format_string const char16_t *_Format, va_list _ArgList);
typedef int (*OUTPUTFN)(FILE *, const char *, va_list);
typedef int (*WOUTPUTFN)(FILE *, const char16_t *, va_list);
#else /* _SAFECRT_IMPL */
-int __cdecl _output_l(__inout FILE * _File, __in_z __format_string const char *_Format, __in_opt _locale_t _Locale, va_list _ArgList);
-int __cdecl _woutput_l(__inout FILE * _File, __in_z __format_string const char16_t *_Format, __in_opt _locale_t _Locale, va_list _ArgList);
-int __cdecl _output_s_l(__inout FILE * _File, __in_z __format_string const char *_Format, __in_opt _locale_t _Locale, va_list _ArgList);
-int __cdecl _output_p_l(__inout FILE * _File, __in_z __format_string const char *_Format, __in_opt _locale_t _Locale, va_list _ArgList);
-int __cdecl _woutput_s_l(__inout FILE * _File, __in_z __format_string const char16_t *_Format, __in_opt _locale_t _Locale, va_list _ArgList);
-int __cdecl _woutput_p_l(__inout FILE * _File, __in_z __format_string const char16_t *_Format, __in_opt _locale_t _Locale, va_list _ArgList);
+int __cdecl _output_l(__inout FILE * _File, _In_z_ __format_string const char *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList);
+int __cdecl _woutput_l(__inout FILE * _File, _In_z_ __format_string const char16_t *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList);
+int __cdecl _output_s_l(__inout FILE * _File, _In_z_ __format_string const char *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList);
+int __cdecl _output_p_l(__inout FILE * _File, _In_z_ __format_string const char *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList);
+int __cdecl _woutput_s_l(__inout FILE * _File, _In_z_ __format_string const char16_t *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList);
+int __cdecl _woutput_p_l(__inout FILE * _File, _In_z_ __format_string const char16_t *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList);
typedef int (*OUTPUTFN)(__inout FILE * _File, const char *, _locale_t, va_list);
typedef int (*WOUTPUTFN)(__inout FILE * _File, const char16_t *, _locale_t, va_list);
@@ -299,19 +299,19 @@ typedef int (*WOUTPUTFN)(__inout FILE * _File, const char16_t *, _locale_t, va_l
#ifdef _SAFECRT_IMPL
-int __cdecl _input(__in FILE * _File, __in_z __format_string const unsigned char * _Format, va_list _ArgList);
-int __cdecl _winput(__in FILE * _File, __in_z __format_string const char16_t * _Format, va_list _ArgList);
-int __cdecl _input_s(__in FILE * _File, __in_z __format_string const unsigned char * _Format, va_list _ArgList);
-int __cdecl _winput_s(__in FILE * _File, __in_z __format_string const char16_t * _Format, va_list _ArgList);
+int __cdecl _input(_In_ FILE * _File, _In_z_ __format_string const unsigned char * _Format, va_list _ArgList);
+int __cdecl _winput(_In_ FILE * _File, _In_z_ __format_string const char16_t * _Format, va_list _ArgList);
+int __cdecl _input_s(_In_ FILE * _File, _In_z_ __format_string const unsigned char * _Format, va_list _ArgList);
+int __cdecl _winput_s(_In_ FILE * _File, _In_z_ __format_string const char16_t * _Format, va_list _ArgList);
typedef int (*INPUTFN)(FILE *, const unsigned char *, va_list);
typedef int (*WINPUTFN)(FILE *, const char16_t *, va_list);
#else /* _SAFECRT_IMPL */
-int __cdecl _input_l(__inout FILE * _File, __in_z __format_string const unsigned char *, __in_opt _locale_t _Locale, va_list _ArgList);
-int __cdecl _winput_l(__inout FILE * _File, __in_z __format_string const char16_t *, __in_opt _locale_t _Locale, va_list _ArgList);
-int __cdecl _input_s_l(__inout FILE * _File, __in_z __format_string const unsigned char *, __in_opt _locale_t _Locale, va_list _ArgList);
-int __cdecl _winput_s_l(__inout FILE * _File, __in_z __format_string const char16_t *, __in_opt _locale_t _Locale, va_list _ArgList);
+int __cdecl _input_l(__inout FILE * _File, _In_z_ __format_string const unsigned char *, _In_opt_ _locale_t _Locale, va_list _ArgList);
+int __cdecl _winput_l(__inout FILE * _File, _In_z_ __format_string const char16_t *, _In_opt_ _locale_t _Locale, va_list _ArgList);
+int __cdecl _input_s_l(__inout FILE * _File, _In_z_ __format_string const unsigned char *, _In_opt_ _locale_t _Locale, va_list _ArgList);
+int __cdecl _winput_s_l(__inout FILE * _File, _In_z_ __format_string const char16_t *, _In_opt_ _locale_t _Locale, va_list _ArgList);
typedef int (*INPUTFN)(FILE *, const unsigned char *, _locale_t, va_list);
typedef int (*WINPUTFN)(FILE *, const char16_t *, _locale_t, va_list);
@@ -326,12 +326,12 @@ typedef int (*WINPUTFN)(FILE *, const char16_t *, _locale_t, va_list);
int __cdecl _flush(__inout FILE * _File);
void __cdecl _endstdio(void);
-errno_t __cdecl _sopen_helper(__in_z const char * _Filename,
- __in int _OFlag, __in int _ShFlag, __in int _PMode,
- __out int * _PFileHandle, int _BSecure);
-errno_t __cdecl _wsopen_helper(__in_z const char16_t * _Filename,
- __in int _OFlag, __in int _ShFlag, __in int _PMode,
- __out int * _PFileHandle, int _BSecure);
+errno_t __cdecl _sopen_helper(_In_z_ const char * _Filename,
+ _In_ int _OFlag, _In_ int _ShFlag, _In_ int _PMode,
+ _Out_ int * _PFileHandle, int _BSecure);
+errno_t __cdecl _wsopen_helper(_In_z_ const char16_t * _Filename,
+ _In_ int _OFlag, _In_ int _ShFlag, _In_ int _PMode,
+ _Out_ int * _PFileHandle, int _BSecure);
#ifndef CRTDLL
extern int _cflush;
@@ -349,8 +349,8 @@ extern char _exitflag; /* callable termination flag */
extern int _C_Termination_Done; /* termination done flag */
-char * __cdecl _getpath(__in_z const char * _Src, __out_ecount_z(_SizeInChars) char * _Dst, __in size_t _SizeInChars);
-char16_t * __cdecl _wgetpath(__in_z const char16_t * _Src, __out_ecount_z(_SizeInWords) char16_t * _Dst, __in size_t _SizeInWords);
+char * __cdecl _getpath(_In_z_ const char * _Src, _Out_writes_z_(_SizeInChars) char * _Dst, _In_ size_t _SizeInChars);
+char16_t * __cdecl _wgetpath(_In_z_ const char16_t * _Src, _Out_writes_z_(_SizeInWords) char16_t * _Dst, _In_ size_t _SizeInWords);
extern int _dowildcard; /* flag to enable argv[] wildcard expansion */
@@ -368,7 +368,7 @@ typedef int (__clrcall * __MPNH)( size_t );
/* calls the currently installed new handler */
-int __cdecl _callnewh(__in size_t _Size);
+int __cdecl _callnewh(_In_ size_t _Size);
extern int _newmode; /* malloc new() handler mode */
@@ -460,8 +460,8 @@ _MRTIMP int __cdecl _onexit_app_domain(_CPVFV);
#endif /* MRTDLL */
#ifndef _MANAGED_MAIN
-int __CRTDECL main(__in int _Argc, __in_ecount_z(_Argc) char ** _Argv, __in_z char ** _Env);
-int __CRTDECL wmain(__in int _Argc, __in_ecount_z(_Argc) char16_t ** _Argv, __in_z char16_t ** _Env);
+int __CRTDECL main(_In_ int _Argc, _In_reads_z_(_Argc) char ** _Argv, _In_z_ char ** _Env);
+int __CRTDECL wmain(_In_ int _Argc, _In_reads_z_(_Argc) char16_t ** _Argv, _In_z_ char16_t ** _Env);
#endif /* _MANAGED_MAIN */
/* helper functions for wide/multibyte environment conversion */
@@ -474,8 +474,8 @@ int __cdecl __wtomb_environ (void);
NULL out the incoming char * / char16_t * to ensure there is no
double-free
*/
-int __cdecl __crtsetenv (__deref_inout_opt char ** _POption, __in const int _Primary);
-int __cdecl __crtwsetenv (__deref_inout_opt char16_t ** _POption, __in const int _Primary);
+int __cdecl __crtsetenv(_Outptr_opt_ char ** _POption, _In_ const int _Primary);
+int __cdecl __crtwsetenv(_Outptr_opt_ char16_t ** _POption, _In_ const int _Primary);
#ifndef _M_CEE_PURE
_CRTIMP extern void (__cdecl * _aexit_rtn)(int);
@@ -491,13 +491,13 @@ typedef struct
#define _STARTUP_INFO_DEFINED
#endif /* _STARTUP_INFO_DEFINED */
-_CRTIMP int __cdecl __getmainargs(__out int * _Argc, __deref_out_ecount(*_Argc) char *** _Argv,
- __deref_out_opt char *** _Env, __in int _DoWildCard,
- __in _startupinfo * _StartInfo);
+_CRTIMP int __cdecl __getmainargs(_Out_ int * _Argc, _Outptr_result_buffer_(*_Argc) char *** _Argv,
+ _Outptr_opt_ char *** _Env, _In_ int _DoWildCard,
+ _In_ _startupinfo * _StartInfo);
-_CRTIMP int __cdecl __wgetmainargs(__out int * _Argc, __deref_out_ecount(*_Argc)char16_t *** _Argv,
- __deref_out_opt char16_t *** _Env, __in int _DoWildCard,
- __in _startupinfo * _StartInfo);
+_CRTIMP int __cdecl __wgetmainargs(_Out_ int * _Argc, _Outptr_result_buffer_(*_Argc)char16_t *** _Argv,
+ _Outptr_opt_ char16_t *** _Env, _In_ int _DoWildCard,
+ _In_ _startupinfo * _StartInfo);
#endif /* defined (_DLL) || defined (CRTDLL) */
@@ -610,15 +610,15 @@ extern int __cdecl _get_errno_from_oserr(unsigned long);
* internal routines used by the exec/spawn functions
*/
-extern intptr_t __cdecl _dospawn(__in int _Mode, __in_z_opt const char * _Name, __inout_z char * _Cmd, __in_z_opt char * _Env);
-extern intptr_t __cdecl _wdospawn(__in int _Mode, __in_z_opt const char16_t * _Name, __inout_z char16_t * _Cmd, __in_z_opt char16_t * _Env);
-extern int __cdecl _cenvarg(__in_z const char * const * _Argv, __in_z_opt const char * const * _Env,
- __deref_out_opt char ** _ArgBlk, __deref_out_opt char ** _EnvBlk, __in_z const char *_Name);
-extern int __cdecl _wcenvarg(__in_z const char16_t * const * _Argv, __in_z_opt const char16_t * const * _Env,
- __deref_out_opt char16_t ** _ArgBlk, __deref_out_opt char16_t ** _EnvBlk, __in_z const char16_t * _Name);
+extern intptr_t __cdecl _dospawn(_In_ int _Mode, _In_opt_z_ const char * _Name, __inout_z char * _Cmd, _In_opt_z_ char * _Env);
+extern intptr_t __cdecl _wdospawn(_In_ int _Mode, _In_opt_z_ const char16_t * _Name, __inout_z char16_t * _Cmd, _In_opt_z_ char16_t * _Env);
+extern int __cdecl _cenvarg(_In_z_ const char * const * _Argv, _In_opt_z_ const char * const * _Env,
+ _Outptr_opt_ char ** _ArgBlk, _Outptr_opt_ char ** _EnvBlk, _In_z_ const char *_Name);
+extern int __cdecl _wcenvarg(_In_z_ const char16_t * const * _Argv, _In_opt_z_ const char16_t * const * _Env,
+ _Outptr_opt_ char16_t ** _ArgBlk, _Outptr_opt_ char16_t ** _EnvBlk, _In_z_ const char16_t * _Name);
#ifndef _M_IX86
-extern char ** _capture_argv(__in va_list *, __in_z const char * _FirstArg, __out_ecount_z(_MaxCount) char ** _Static_argv, __in size_t _MaxCount);
-extern char16_t ** _wcapture_argv(__in va_list *, __in_z const char16_t * _FirstArg, __out_ecount_z(_MaxCount) char16_t ** _Static_argv, __in size_t _MaxCount);
+extern char ** _capture_argv(_In_ va_list *, _In_z_ const char * _FirstArg, _Out_writes_z_(_MaxCount) char ** _Static_argv, _In_ size_t _MaxCount);
+extern char16_t ** _wcapture_argv(_In_ va_list *, _In_z_ const char16_t * _FirstArg, _Out_writes_z_(_MaxCount) char16_t ** _Static_argv, _In_ size_t _MaxCount);
#endif /* _M_IX86 */
/*
@@ -680,13 +680,13 @@ extern "C++"
#endif /* !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE) */
_CRTIMP
#endif /* _SAFECRT_IMPL */
-void __cdecl _invalid_parameter(__in_z_opt const char16_t *, __in_z_opt const char16_t *, __in_z_opt const char16_t *, unsigned int, uintptr_t);
+void __cdecl _invalid_parameter(_In_opt_z_ const char16_t *, _In_opt_z_ const char16_t *, _In_opt_z_ const char16_t *, unsigned int, uintptr_t);
#if !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE)
extern "C++"
#endif /* !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE) */
_CRTIMP
-void __cdecl _invoke_watson(__in_z_opt const char16_t *, __in_z_opt const char16_t *, __in_z_opt const char16_t *, unsigned int, uintptr_t);
+void __cdecl _invoke_watson(_In_opt_z_ const char16_t *, _In_opt_z_ const char16_t *, _In_opt_z_ const char16_t *, unsigned int, uintptr_t);
#ifndef _DEBUG
#if !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE)
diff --git a/src/coreclr/pal/src/safecrt/internal_securecrt.h b/src/coreclr/pal/src/safecrt/internal_securecrt.h
index 7d5fd1e25c9b89..741989897af9d9 100644
--- a/src/coreclr/pal/src/safecrt/internal_securecrt.h
+++ b/src/coreclr/pal/src/safecrt/internal_securecrt.h
@@ -23,13 +23,18 @@
#define _INC_INTERNAL_SECURECRT
/* more VS specific goodness */
-#define __out_ecount_z( x )
-#define __out_ecount( x )
-#define __in_opt
-#define __in_z_opt
-#define __out_ecount_z_opt( x )
-#define __in_z
-#define __in
+#define _In_
+#define _In_z_
+#define _In_opt_
+#define _In_opt_z_
+#define _Out_
+#define _Out_opt_
+#define _Out_writes_(size)
+#define _Out_writes_opt_(size)
+#define _Out_writes_bytes_(size)
+#define _Out_writes_bytes_opt_(size)
+#define _Out_writes_z_(size)
+#define _Out_writes_opt_z_(size)
/*
* The original SafeCRT implemention allows runtime control over buffer checking.
diff --git a/src/coreclr/pal/src/safecrt/tmakepath_s.inl b/src/coreclr/pal/src/safecrt/tmakepath_s.inl
index d4b74ef264ad84..53517412f75e9c 100644
--- a/src/coreclr/pal/src/safecrt/tmakepath_s.inl
+++ b/src/coreclr/pal/src/safecrt/tmakepath_s.inl
@@ -12,7 +12,7 @@
*******************************************************************************/
_FUNC_PROLOGUE
-errno_t __cdecl _FUNC_NAME(__out_ecount_z(_SIZE) _CHAR *_DEST, __in_opt size_t _SIZE, __in_z_opt const _CHAR *_Drive, __in_z_opt const _CHAR *_Dir, __in_z_opt const _CHAR *_Filename, __in_z_opt const _CHAR *_Ext)
+errno_t __cdecl _FUNC_NAME(_Out_writes_z_(_SIZE) _CHAR *_DEST, _In_opt_ size_t _SIZE, _In_opt_z_ const _CHAR *_Drive, _In_opt_z_ const _CHAR *_Dir, _In_opt_z_ const _CHAR *_Filename, _In_opt_z_ const _CHAR *_Ext)
{
size_t written;
const _CHAR *p;
diff --git a/src/coreclr/pal/src/safecrt/tsplitpath_s.inl b/src/coreclr/pal/src/safecrt/tsplitpath_s.inl
index 7bbaf26a99c0e9..0884b2fb3f4a17 100644
--- a/src/coreclr/pal/src/safecrt/tsplitpath_s.inl
+++ b/src/coreclr/pal/src/safecrt/tsplitpath_s.inl
@@ -13,11 +13,11 @@
_FUNC_PROLOGUE
errno_t __cdecl _FUNC_NAME(
- __in_z const _CHAR *_Path,
- __out_ecount_z_opt(_DriveSize) _CHAR *_Drive, __in size_t _DriveSize,
- __out_ecount_z_opt(_DirSize) _CHAR *_Dir, __in size_t _DirSize,
- __out_ecount_z_opt(_FilenameSize) _CHAR *_Filename, __in size_t _FilenameSize,
- __out_ecount_z_opt(_ExtSize) _CHAR *_Ext, __in size_t _ExtSize
+ _In_z_ const _CHAR *_Path,
+ _Out_writes_opt_z_(_DriveSize) _CHAR *_Drive, _In_ size_t _DriveSize,
+ _Out_writes_opt_z_(_DirSize) _CHAR *_Dir, _In_ size_t _DirSize,
+ _Out_writes_opt_z_(_FilenameSize) _CHAR *_Filename, _In_ size_t _FilenameSize,
+ _Out_writes_opt_z_(_ExtSize) _CHAR *_Ext, _In_ size_t _ExtSize
)
{
const _CHAR *tmp;
diff --git a/src/coreclr/pal/src/thread/process.cpp b/src/coreclr/pal/src/thread/process.cpp
index 76135d655f9349..cd62cb917635d5 100644
--- a/src/coreclr/pal/src/thread/process.cpp
+++ b/src/coreclr/pal/src/thread/process.cpp
@@ -73,7 +73,7 @@ SET_DEFAULT_DEBUG_CHANNEL(PROCESS); // some headers have code with asserts, so d
# define __NR_membarrier 389
# elif defined(__aarch64__)
# define __NR_membarrier 283
-# elif
+# else
# error Unknown architecture
# endif
# endif
diff --git a/src/coreclr/pal/tests/palsuite/CMakeLists.txt b/src/coreclr/pal/tests/palsuite/CMakeLists.txt
index f58757a1f6d5fc..d7b3faca6b366b 100644
--- a/src/coreclr/pal/tests/palsuite/CMakeLists.txt
+++ b/src/coreclr/pal/tests/palsuite/CMakeLists.txt
@@ -415,7 +415,6 @@ add_executable_clr(paltests
c_runtime/wcsstr/test1/test1.cpp
c_runtime/wcstod/test1/test1.cpp
c_runtime/wcstod/test2/test2.cpp
- c_runtime/wcstok/test1/test1.cpp
c_runtime/wcstoul/test1/test1.cpp
c_runtime/wcstoul/test2/test2.cpp
c_runtime/wcstoul/test3/test3.cpp
diff --git a/src/coreclr/pal/tests/palsuite/c_runtime/wcstok/test1/test1.cpp b/src/coreclr/pal/tests/palsuite/c_runtime/wcstok/test1/test1.cpp
deleted file mode 100644
index 564466c2a4e7f3..00000000000000
--- a/src/coreclr/pal/tests/palsuite/c_runtime/wcstok/test1/test1.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*============================================================================
-**
-** Source: test1.c
-**
-** Purpose:
-** Search for a number of tokens within strings. Check that the return values
-** are what is expected, and also that the strings match up with our expected
-** results.
-**
-**
-**==========================================================================*/
-
-#include
-
-PALTEST(c_runtime_wcstok_test1_paltest_wcstok_test1, "c_runtime/wcstok/test1/paltest_wcstok_test1")
-{
- /* foo bar baz */
- WCHAR str[] = {'f','o','o',' ','b','a','r',' ','b','a','z','\0'};
-
- /* foo \0ar baz */
- WCHAR result1[] = {'f','o','o',' ','\0','a','r',' ','b','a','z','\0'};
-
- /* foo \0a\0 baz */
- WCHAR result2[] = {'f','o','o',' ','\0','a','\0',' ','b','a','z','\0'};
-
- WCHAR* tempString;
- int len = 0;
- WCHAR *ptr;
-
- if (PAL_Initialize(argc, argv))
- {
- return FAIL;
- }
-
- len = (wcslen(str)*sizeof(WCHAR)) + 2;
-
- /* Tokenize 'str'. It will hit the 'b' delimiter first. Check to see
- that the ptr is pointing to the start of the string and do a compare
- to ensure the tokenized string is what we expected.
- */
-
- tempString = convert("bz");
- ptr = wcstok(str, tempString);
- free(tempString);
-
- if (ptr != str)
- {
- Fail("ERROR: Expected wcstok() to return %p, got %p!\n", str, ptr);
- }
-
- if (memcmp(str, result1, len) != 0)
- {
- Fail("ERROR: wcstok altered the string in an unexpected fashion.");
- }
-
- /* If NULL is passed as the first parameter, wcstok will continue
- tokenizing the same string. Test that this works properly.
- */
- tempString = convert("r ");
- ptr = wcstok(NULL, tempString);
- free(tempString);
-
- if (ptr != str + 5)
- {
- Fail("ERROR: Expected wcstok() to return %p, got %p!\n", str+5, ptr);
- }
-
- if (memcmp(str, result2, len) != 0)
- {
- Fail("ERROR: wcstok altered the string in an unexpected fashion.");
- }
-
- /* Continue onward, and search for 'X' now, which won't be found. The
- pointer should point just after the last NULL in the string. And
- the string itself shouldn't have changed.
- */
- tempString = convert("X");
- ptr = wcstok(NULL, tempString);
- free(tempString);
-
- if (ptr != str + 7)
- {
- Fail("ERROR: Expected wcstok() to return %p, got %p!\n", str + 7, ptr);
- }
-
- if (memcmp(str, result2, len) != 0)
- {
- Fail("ERROR: wcstok altered the string in an unexpeced fashion.\n");
- }
-
- /* Call wcstok again. Now the ptr should point to the end of the
- string at NULL. And the string itself shouldn't have changed.
- */
- tempString = convert("X");
- ptr = wcstok(NULL, tempString);
- free(tempString);
-
- if (ptr != NULL)
- {
- Fail("ERROR: Expected wcstok() to return %p, got %p!\n", NULL, ptr);
- }
-
- if (memcmp(str, result2, len) != 0)
- {
- Fail("ERROR: wcstok altered the string in an unexpeced fashion.\n");
- }
-
- PAL_Terminate();
- return PASS;
-}
diff --git a/src/coreclr/pal/tests/palsuite/compilableTests.txt b/src/coreclr/pal/tests/palsuite/compilableTests.txt
index c674de294db452..df727bc277be49 100644
--- a/src/coreclr/pal/tests/palsuite/compilableTests.txt
+++ b/src/coreclr/pal/tests/palsuite/compilableTests.txt
@@ -348,7 +348,6 @@ c_runtime/wcsrchr/test1/paltest_wcsrchr_test1
c_runtime/wcsstr/test1/paltest_wcsstr_test1
c_runtime/wcstod/test1/paltest_wcstod_test1
c_runtime/wcstod/test2/paltest_wcstod_test2
-c_runtime/wcstok/test1/paltest_wcstok_test1
c_runtime/wcstoul/test1/paltest_wcstoul_test1
c_runtime/wcstoul/test2/paltest_wcstoul_test2
c_runtime/wcstoul/test3/paltest_wcstoul_test3
diff --git a/src/coreclr/pal/tests/palsuite/loader/LoadLibraryA/test6/loadlibrarya.cpp b/src/coreclr/pal/tests/palsuite/loader/LoadLibraryA/test6/loadlibrarya.cpp
index d71e0ea85c333e..93363488bc61d2 100644
--- a/src/coreclr/pal/tests/palsuite/loader/LoadLibraryA/test6/loadlibrarya.cpp
+++ b/src/coreclr/pal/tests/palsuite/loader/LoadLibraryA/test6/loadlibrarya.cpp
@@ -7,9 +7,9 @@
**
** Purpose: Positive test the LoadLibrary API. Test will verify
** that it is unable to load the library twice. Once by
-** using the full path name and secondly by using the
+** using the full path name and secondly by using the
** short name.
-**
+**
**
**============================================================*/
@@ -25,14 +25,13 @@ typedef int (*dllfunct)();
#define GETATTACHCOUNTNAME "_GetAttachCount@0"
#endif
-
/* Helper function to test the loaded library.
*/
BOOL PALAPI TestDll(HMODULE hLib)
{
int RetVal;
char FunctName[] = GETATTACHCOUNTNAME;
- FARPROC DllFunc;
+ FARPROC DllFunc;
/* Access a function from the loaded library.
*/
@@ -45,7 +44,7 @@ BOOL PALAPI TestDll(HMODULE hLib)
return (FALSE);
}
- /* Verify that the DLL_PROCESS_ATTACH is only
+ /* Verify that the DLL_PROCESS_ATTACH is only
* accessed once.*/
RetVal = DllFunc();
if (RetVal != 1)
@@ -70,7 +69,7 @@ PALTEST(loader_LoadLibraryA_test6_paltest_loadlibrarya_test6, "loader/LoadLibrar
char fname[_MAX_FNAME];
char ext[_MAX_EXT];
-
+
/* Initialize the PAL. */
if ((PAL_Initialize(argc, argv)) != 0)
@@ -84,15 +83,15 @@ PALTEST(loader_LoadLibraryA_test6_paltest_loadlibrarya_test6, "loader/LoadLibrar
/* Get the full path to the library (DLL).
*/
-
- if (NULL != _fullpath(fullPath,argv[0],_MAX_DIR)) {
-
+
+ if (NULL != realpath(argv[0],fullpath)) {
+
_splitpath(fullPath,drive,dir,fname,ext);
_makepath(fullPath,drive,dir,LibraryName,"");
-
-
+
+
} else {
- Fail("ERROR: conversion from relative path \" %s \" to absolute path failed. _fullpath returned NULL\n",argv[0]);
+ Fail("ERROR: conversion from relative path \" %s \" to absolute path failed. realpath returned NULL\n",argv[0]);
}
/* Call Load library with the short name of
@@ -101,11 +100,11 @@ PALTEST(loader_LoadLibraryA_test6_paltest_loadlibrarya_test6, "loader/LoadLibrar
hShortLib = LoadLibrary(LibraryName);
if(hShortLib == NULL)
{
- Fail("ERROR:%u:Unable to load library %s\n",
- GetLastError(),
+ Fail("ERROR:%u:Unable to load library %s\n",
+ GetLastError(),
LibraryName);
}
-
+
/* Test the loaded library.
*/
if (!TestDll(hShortLib))
@@ -120,8 +119,8 @@ PALTEST(loader_LoadLibraryA_test6_paltest_loadlibrarya_test6, "loader/LoadLibrar
hFullLib = LoadLibrary(fullPath);
if(hFullLib == NULL)
{
- Trace("ERROR:%u:Unable to load library %s\n",
- GetLastError(),
+ Trace("ERROR:%u:Unable to load library %s\n",
+ GetLastError(),
fullPath);
iRetVal = FAIL;
goto cleanUpTwo;
@@ -141,11 +140,11 @@ PALTEST(loader_LoadLibraryA_test6_paltest_loadlibrarya_test6, "loader/LoadLibrar
cleanUpTwo:
- /* Call the FreeLibrary API.
- */
+ /* Call the FreeLibrary API.
+ */
if (!FreeLibrary(hFullLib))
{
- Trace("ERROR:%u: Unable to free library \"%s\"\n",
+ Trace("ERROR:%u: Unable to free library \"%s\"\n",
GetLastError(),
fullPath);
iRetVal = FAIL;
@@ -153,11 +152,11 @@ PALTEST(loader_LoadLibraryA_test6_paltest_loadlibrarya_test6, "loader/LoadLibrar
cleanUpOne:
- /* Call the FreeLibrary API.
- */
+ /* Call the FreeLibrary API.
+ */
if (!FreeLibrary(hShortLib))
{
- Trace("ERROR:%u: Unable to free library \"%s\"\n",
+ Trace("ERROR:%u: Unable to free library \"%s\"\n",
GetLastError(),
LibraryName);
iRetVal = FAIL;
@@ -167,5 +166,4 @@ PALTEST(loader_LoadLibraryA_test6_paltest_loadlibrarya_test6, "loader/LoadLibrar
*/
PAL_TerminateEx(iRetVal);
return iRetVal;
-
}
diff --git a/src/coreclr/pal/tests/palsuite/loader/LoadLibraryA/test8/loadlibrarya.cpp b/src/coreclr/pal/tests/palsuite/loader/LoadLibraryA/test8/loadlibrarya.cpp
index b489ef27f965e7..1bbf9a6d08ad1e 100644
--- a/src/coreclr/pal/tests/palsuite/loader/LoadLibraryA/test8/loadlibrarya.cpp
+++ b/src/coreclr/pal/tests/palsuite/loader/LoadLibraryA/test8/loadlibrarya.cpp
@@ -7,9 +7,9 @@
**
** Purpose: Positive test the LoadLibrary API. Test will verify
** that it is unable to load the library twice. Once by
-** using the full path name and secondly by using the
+** using the full path name and secondly by using the
** short name.
-**
+**
**
**============================================================*/
@@ -25,14 +25,13 @@ typedef int (*dllfunct)();
#define GETATTACHCOUNTNAME "_GetAttachCount@0"
#endif
-
/* Helper function to test the loaded library.
*/
BOOL PALAPI TestDll(HMODULE hLib)
{
int RetVal;
char FunctName[] = GETATTACHCOUNTNAME;
- FARPROC DllFunc;
+ FARPROC DllFunc;
/* Access a function from the loaded library.
*/
@@ -45,7 +44,7 @@ BOOL PALAPI TestDll(HMODULE hLib)
return (FALSE);
}
- /* Verify that the DLL_PROCESS_ATTACH is only
+ /* Verify that the DLL_PROCESS_ATTACH is only
* accessed once.*/
RetVal = DllFunc();
if (RetVal != 1)
@@ -72,7 +71,7 @@ PALTEST(loader_LoadLibraryA_test8_paltest_loadlibrarya_test8, "loader/LoadLibrar
char relTestDir[_MAX_DIR];
char fname[_MAX_FNAME];
char ext[_MAX_EXT];
-
+
BOOL bRc = FALSE;
char relLibPath[_MAX_DIR];
@@ -89,15 +88,15 @@ PALTEST(loader_LoadLibraryA_test8_paltest_loadlibrarya_test8, "loader/LoadLibrar
/* Get the full path to the library (DLL).
*/
-
- if (NULL != _fullpath(fullPath,argv[0],_MAX_DIR)) {
-
+
+ if (NULL != realpath(argv[0],fullpath)) {
+
_splitpath(fullPath,drive,dir,fname,ext);
_makepath(fullPath,drive,dir,LibraryName,"");
-
-
+
+
} else {
- Fail("ERROR: conversion from relative path \" %s \" to absolute path failed. _fullpath returned NULL\n",argv[0]);
+ Fail("ERROR: conversion from relative path \" %s \" to absolute path failed. realpath returned NULL\n",argv[0]);
}
/* Get relative path to the library
@@ -112,11 +111,11 @@ PALTEST(loader_LoadLibraryA_test8_paltest_loadlibrarya_test8, "loader/LoadLibrar
hShortLib = LoadLibrary(LibraryName);
if(hShortLib == NULL)
{
- Fail("ERROR:%u:Short:Unable to load library %s\n",
- GetLastError(),
+ Fail("ERROR:%u:Short:Unable to load library %s\n",
+ GetLastError(),
LibraryName);
}
-
+
/* Test the loaded library.
*/
if (!TestDll(hShortLib))
@@ -131,8 +130,8 @@ PALTEST(loader_LoadLibraryA_test8_paltest_loadlibrarya_test8, "loader/LoadLibrar
hFullLib = LoadLibrary(fullPath);
if(hFullLib == NULL)
{
- Trace("ERROR:%u:Full:Unable to load library %s\n",
- GetLastError(),
+ Trace("ERROR:%u:Full:Unable to load library %s\n",
+ GetLastError(),
fullPath);
iRetVal = FAIL;
goto cleanUpTwo;
@@ -148,14 +147,14 @@ PALTEST(loader_LoadLibraryA_test8_paltest_loadlibrarya_test8, "loader/LoadLibrar
/*
** Call the load library with the relative path
- ** wrt to the directory ./testloadlibrary/..
+ ** wrt to the directory ./testloadlibrary/..
** since we don't want to make any assumptions
** regarding the type of build
*/
hRelLib = LoadLibrary(relLibPath);
if(hRelLib == NULL)
{
- Trace("ERROR:%u:Rel:Unable to load library at %s\n",
+ Trace("ERROR:%u:Rel:Unable to load library at %s\n",
GetLastError(), relLibPath);
iRetVal = FAIL;
goto cleanUpTwo;
@@ -190,12 +189,12 @@ PALTEST(loader_LoadLibraryA_test8_paltest_loadlibrarya_test8, "loader/LoadLibrar
cleanUpThree:
- /* Call the FreeLibrary API.
- */
+ /* Call the FreeLibrary API.
+ */
if (!FreeLibrary(hRelLib))
{
- Trace("ERROR:%u: Unable to free library \"%s\"\n",
+ Trace("ERROR:%u: Unable to free library \"%s\"\n",
GetLastError(),
relLibPath);
iRetVal = FAIL;
@@ -203,11 +202,11 @@ PALTEST(loader_LoadLibraryA_test8_paltest_loadlibrarya_test8, "loader/LoadLibrar
cleanUpTwo:
- /* Call the FreeLibrary API.
- */
+ /* Call the FreeLibrary API.
+ */
if (!FreeLibrary(hFullLib))
{
- Trace("ERROR:%u: Unable to free library \"%s\"\n",
+ Trace("ERROR:%u: Unable to free library \"%s\"\n",
GetLastError(),
fullPath);
iRetVal = FAIL;
@@ -215,20 +214,18 @@ PALTEST(loader_LoadLibraryA_test8_paltest_loadlibrarya_test8, "loader/LoadLibrar
cleanUpOne:
- /* Call the FreeLibrary API.
- */
+ /* Call the FreeLibrary API.
+ */
if (!FreeLibrary(hShortLib))
{
- Trace("ERROR:%u: Unable to free library \"%s\"\n",
+ Trace("ERROR:%u: Unable to free library \"%s\"\n",
GetLastError(),
LibraryName);
iRetVal = FAIL;
}
-
/* Terminate the PAL.
*/
PAL_TerminateEx(iRetVal);
return iRetVal;
-
}
diff --git a/src/coreclr/pal/tests/palsuite/paltestlist.txt b/src/coreclr/pal/tests/palsuite/paltestlist.txt
index 2b9ac7ccd4eb1e..514cd52f1a590c 100644
--- a/src/coreclr/pal/tests/palsuite/paltestlist.txt
+++ b/src/coreclr/pal/tests/palsuite/paltestlist.txt
@@ -333,7 +333,6 @@ c_runtime/wcsrchr/test1/paltest_wcsrchr_test1
c_runtime/wcsstr/test1/paltest_wcsstr_test1
c_runtime/wcstod/test1/paltest_wcstod_test1
c_runtime/wcstod/test2/paltest_wcstod_test2
-c_runtime/wcstok/test1/paltest_wcstok_test1
c_runtime/wcstoul/test1/paltest_wcstoul_test1
c_runtime/wcstoul/test2/paltest_wcstoul_test2
c_runtime/wcstoul/test3/paltest_wcstoul_test3
diff --git a/src/coreclr/pal/tests/palsuite/runpaltests.sh b/src/coreclr/pal/tests/palsuite/runpaltests.sh
index e38f2aaa18840c..c10930e2acc391 100755
--- a/src/coreclr/pal/tests/palsuite/runpaltests.sh
+++ b/src/coreclr/pal/tests/palsuite/runpaltests.sh
@@ -19,26 +19,18 @@ echo "***** Testing PAL *****"
echo
# Store the location of the root of build directory
-BUILD_ROOT_DIR=$1
-if [ -d "$(pwd)/$BUILD_ROOT_DIR" ]; then
- BUILD_ROOT_DIR="$(pwd)/$BUILD_ROOT_DIR"
+if [ ! -e "$1" ]; then
+ echo "Core_Root not found at $1"
+ exit 1
fi
+BUILD_ROOT_DIR="$(cd "$1"; pwd -P)"
# Create path to the compiled PAL tets in the build directory
PAL_TEST_BUILD=$BUILD_ROOT_DIR
echo Running PAL tests from $PAL_TEST_BUILD
-pushd $BUILD_ROOT_DIR
-
export LD_LIBRARY_PATH=$BUILD_ROOT_DIR:$LD_LIBRARY_PATH
-# Create absolute path to the file that contains a list of PAL tests to execute.
-# This file is located next to this script in the source tree
-RELATIVE_PATH_TO_PAL_TESTS=$0
-# Remove the name of this script from the path
-RELATIVE_PATH_TO_PAL_TESTS=${RELATIVE_PATH_TO_PAL_TESTS%/*.*}
-# Change current directory to the location of this script
-cd $RELATIVE_PATH_TO_PAL_TESTS
# Environment variable PWD contains absolute path to the current folder
# so use it to create absolute path to the file with a list of tests.
PAL_TEST_LIST=$BUILD_ROOT_DIR/paltestlist.txt
@@ -79,8 +71,6 @@ then
fi
fi
-cd $PAL_TEST_OUTPUT_DIR
-
echo PAL tests will store their temporary files and output in $PAL_TEST_OUTPUT_DIR.
if [ "$COPY_TO_TEST_OUTPUT_DIR" != "$PAL_TEST_OUTPUT_DIR" ]; then
echo Output files will be copied to $COPY_TO_TEST_OUTPUT_DIR at the end.
@@ -115,7 +105,6 @@ else
COPY_TO_TEST_OUTPUT_DIR=$PAL_TEST_OUTPUT_DIR
fi
fi
-cd $PAL_TEST_OUTPUT_DIR
echo
echo "Running tests..."
@@ -133,7 +122,7 @@ do
# Create a folder with the test name, and use that as the working directory for the test. Many PAL tests don't clean up after
# themselves and may leave files/directories around, but even to handle test failures that result in a dirty state, run each
# test in its own folder.
- TEST_WORKING_DIR=$(basename $TEST_NAME)
+ TEST_WORKING_DIR=$PAL_TEST_OUTPUT_DIR/$(basename $TEST_NAME)
if [ -e $TEST_WORKING_DIR ]; then
rm -f -r $TEST_WORKING_DIR
fi
@@ -233,8 +222,6 @@ if [ "$COPY_TO_TEST_OUTPUT_DIR" != "$PAL_TEST_OUTPUT_DIR" ]; then
echo Copied PAL test output files to $COPY_TO_TEST_OUTPUT_DIR.
fi
-popd
-
# Set exit code to be equal to the number PAL tests that have failed.
# Exit code 0 indicates success.
exit $NUMBER_OF_FAILED_TESTS
diff --git a/src/coreclr/runtime-prereqs.proj b/src/coreclr/runtime-prereqs.proj
index 1127c3df8bdf3b..36ed2ce497be1e 100644
--- a/src/coreclr/runtime-prereqs.proj
+++ b/src/coreclr/runtime-prereqs.proj
@@ -7,7 +7,7 @@
-
+
diff --git a/src/coreclr/scripts/superpmi.md b/src/coreclr/scripts/superpmi.md
index d9404dc32d7406..36e24711637aea 100644
--- a/src/coreclr/scripts/superpmi.md
+++ b/src/coreclr/scripts/superpmi.md
@@ -1,7 +1,7 @@
# Documentation for the superpmi.py tool
SuperPMI is a tool for developing and testing the JIT compiler.
-General information on SuperPMI can be found [here](../ToolBox/superpmi/readme.md).
+General information on SuperPMI can be found [here](../tools/superpmi/readme.md).
## Overview
diff --git a/src/coreclr/scripts/superpmi_benchmarks.py b/src/coreclr/scripts/superpmi_benchmarks.py
index 1c15b9ae803bf9..a72747e77ee6ac 100644
--- a/src/coreclr/scripts/superpmi_benchmarks.py
+++ b/src/coreclr/scripts/superpmi_benchmarks.py
@@ -17,7 +17,7 @@
import stat
from os import path
-from os.path import isfile
+from os.path import isfile, realpath
from shutil import copyfile
from coreclr_arguments import *
from jitutil import run_command, ChangeDir, TempDir
@@ -136,6 +136,9 @@ def build_and_run(coreclr_args, output_mch_name):
project_file = path.join(performance_directory, "src", "benchmarks", "micro", "MicroBenchmarks.csproj")
benchmarks_dll = path.join(artifacts_directory, "MicroBenchmarks.dll")
+ # Workaround https://github.com/dotnet/sdk/issues/23430
+ project_file = realpath(project_file)
+
if is_windows:
shim_name = "%JitName%"
corerun_exe = "CoreRun.exe"
diff --git a/src/coreclr/scripts/superpmi_collect_setup.py b/src/coreclr/scripts/superpmi_collect_setup.py
index ce102ea0910261..9eedadb57e3cfd 100644
--- a/src/coreclr/scripts/superpmi_collect_setup.py
+++ b/src/coreclr/scripts/superpmi_collect_setup.py
@@ -22,12 +22,12 @@
# 4. Lastly, it sets the pipeline variables.
#
# Below are the helix queues it sets depending on the OS/architecture:
-# | Arch | windows | Linux |
-# |-------|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------|
-# | x86 | Windows.10.Amd64.X86.Rt | |
-# | x64 | Windows.10.Amd64.X86.Rt | Ubuntu.1804.Amd64 |
-# | arm | - | (Ubuntu.1804.Arm32)Ubuntu.1804.Armarch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-bfcd90a-20200121150440 |
-# | arm64 | Windows.10.Arm64 | (Ubuntu.1804.Arm64)Ubuntu.1804.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8-20210531091519-97d8652 |
+# | Arch | windows | Linux | macOS |
+# |-------|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------|----------------|
+# | x86 | Windows.10.Amd64.X86.Rt | | - |
+# | x64 | Windows.10.Amd64.X86.Rt | Ubuntu.1804.Amd64 | OSX.1014.Amd64 |
+# | arm | - | (Ubuntu.1804.Arm32)Ubuntu.1804.Armarch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-bfcd90a-20200121150440 | - |
+# | arm64 | Windows.10.Arm64 | (Ubuntu.1804.Arm64)Ubuntu.1804.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8-20210531091519-97d8652 | OSX.1100.ARM64 |
#
################################################################################
################################################################################
@@ -47,6 +47,7 @@
parser.add_argument("-source_directory", help="path to source directory")
parser.add_argument("-core_root_directory", help="path to core_root directory")
parser.add_argument("-arch", help="Architecture")
+parser.add_argument("-platform", help="OS platform")
parser.add_argument("-mch_file_tag", help="Tag to be used to mch files")
parser.add_argument("-collection_name", help="Name of the SPMI collection to be done (e.g., libraries, tests)")
parser.add_argument("-collection_type", help="Type of the SPMI collection to be done (crossgen, crossgen2, pmi)")
@@ -196,6 +197,11 @@ def setup_args(args):
lambda unused: True,
"Unable to set arch")
+ coreclr_args.verify(args,
+ "platform",
+ lambda unused: True,
+ "Unable to set platform")
+
coreclr_args.verify(args,
"mch_file_tag",
lambda unused: True,
@@ -383,28 +389,33 @@ def main(main_args):
superpmi_src_directory = os.path.join(source_directory, 'src', 'coreclr', 'scripts')
superpmi_dst_directory = os.path.join(correlation_payload_directory, "superpmi")
arch = coreclr_args.arch
+ platform_name = coreclr_args.platform.lower()
helix_source_prefix = "official"
creator = ""
ci = True
- if is_windows:
+ if platform_name == "windows":
helix_queue = "Windows.10.Arm64" if arch == "arm64" else "Windows.10.Amd64.X86.Rt"
- else:
+ elif platform_name == "linux":
if arch == "arm":
helix_queue = "(Ubuntu.1804.Arm32)Ubuntu.1804.Armarch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-bfcd90a-20200121150440"
elif arch == "arm64":
helix_queue = "(Ubuntu.1804.Arm64)Ubuntu.1804.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8-20210531091519-97d8652"
else:
helix_queue = "Ubuntu.1804.Amd64"
+ elif platform_name == "osx":
+ helix_queue = "OSX.1100.ARM64" if arch == "arm64" else "OSX.1014.Amd64"
# create superpmi directory
print('Copying {} -> {}'.format(superpmi_src_directory, superpmi_dst_directory))
copy_directory(superpmi_src_directory, superpmi_dst_directory, verbose_output=True, match_func=lambda path: any(path.endswith(extension) for extension in [".py"]))
- if is_windows:
+ if platform_name == "windows":
acceptable_copy = lambda path: any(path.endswith(extension) for extension in [".py", ".dll", ".exe", ".json"])
else:
+ acceptable_extensions = [".py", ".dll", ".json"]
+ acceptable_extensions.append(".so" if platform_name == "linux" else ".dylib")
# Need to accept files without any extension, which is how executable file's names look.
- acceptable_copy = lambda path: (os.path.basename(path).find(".") == -1) or any(path.endswith(extension) for extension in [".py", ".dll", ".so", ".json"])
+ acceptable_copy = lambda path: (os.path.basename(path).find(".") == -1) or any(path.endswith(extension) for extension in acceptable_extensions)
print('Copying {} -> {}'.format(coreclr_args.core_root_directory, superpmi_dst_directory))
copy_directory(coreclr_args.core_root_directory, superpmi_dst_directory, verbose_output=True, match_func=acceptable_copy)
diff --git a/src/coreclr/tools/CMakeLists.txt b/src/coreclr/tools/CMakeLists.txt
index a50b1e6a1afbd9..db59797e26f789 100644
--- a/src/coreclr/tools/CMakeLists.txt
+++ b/src/coreclr/tools/CMakeLists.txt
@@ -1,3 +1,6 @@
+add_subdirectory(SOS)
+add_subdirectory(superpmi)
+
if (CLR_CMAKE_TARGET_WIN32 AND NOT CLR_CMAKE_CROSS_ARCH)
add_subdirectory(GenClrDebugResource)
add_subdirectory(InjectResource)
diff --git a/src/coreclr/tools/Common/Compiler/CompilationBuilder.cs b/src/coreclr/tools/Common/Compiler/CompilationBuilder.cs
index f3c9e7ef8f8f2d..b246a9847f2274 100644
--- a/src/coreclr/tools/Common/Compiler/CompilationBuilder.cs
+++ b/src/coreclr/tools/Common/Compiler/CompilationBuilder.cs
@@ -23,6 +23,7 @@ public abstract partial class CompilationBuilder
private DependencyTrackingLevel _dependencyTrackingLevel = DependencyTrackingLevel.None;
protected IEnumerable _compilationRoots = Array.Empty();
protected OptimizationMode _optimizationMode = OptimizationMode.None;
+ protected int _parallelism = -1;
public CompilationBuilder(CompilerTypeSystemContext context, CompilationModuleGroup compilationGroup, NameMangler nameMangler)
{
@@ -41,6 +42,12 @@ public CompilationBuilder UseLogger(Logger logger)
return this;
}
+ public CompilationBuilder UseParallelism(int parallelism)
+ {
+ _parallelism = parallelism;
+ return this;
+ }
+
public CompilationBuilder UseCompilationUnitPrefix(string prefix)
{
_nameMangler.CompilationUnitPrefix = prefix;
diff --git a/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/Generator/ReaderGen.cs b/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/Generator/ReaderGen.cs
index d068f7d047704a..55b09b37b3431e 100644
--- a/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/Generator/ReaderGen.cs
+++ b/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/Generator/ReaderGen.cs
@@ -20,6 +20,7 @@ public void EmitSource()
WriteLine("#pragma warning disable 649");
WriteLine("#pragma warning disable 169");
WriteLine("#pragma warning disable 282 // There is no defined ordering between fields in multiple declarations of partial class or struct");
+ WriteLine("#pragma warning disable IDE0059");
WriteLine();
WriteLine("using System;");
diff --git a/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/NativeFormatReaderGen.cs b/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/NativeFormatReaderGen.cs
index 523fc0d172d521..1d92be56771488 100644
--- a/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/NativeFormatReaderGen.cs
+++ b/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/NativeFormatReaderGen.cs
@@ -6,6 +6,7 @@
#pragma warning disable 649
#pragma warning disable 169
#pragma warning disable 282 // There is no defined ordering between fields in multiple declarations of partial class or struct
+#pragma warning disable IDE0059
using System;
using System.Reflection;
diff --git a/src/coreclr/tools/Common/Internal/NativeFormat/NativeFormatReader.cs b/src/coreclr/tools/Common/Internal/NativeFormat/NativeFormatReader.cs
index 6063683a7d62e2..845dc7c95a4781 100644
--- a/src/coreclr/tools/Common/Internal/NativeFormat/NativeFormatReader.cs
+++ b/src/coreclr/tools/Common/Internal/NativeFormat/NativeFormatReader.cs
@@ -543,7 +543,7 @@ public NativeParser GetNext()
{
while (_parser.Offset < _endOffset)
{
- byte lowHashcode = _parser.GetUInt8();
+ _parser.GetUInt8();
return _parser.GetParserFromRelativeOffset();
}
diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs b/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs
index f660b55ebe192f..006409bdbb5338 100644
--- a/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs
+++ b/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs
@@ -2200,20 +2200,6 @@ static uint _getFieldThreadLocalStoreID(IntPtr thisHandle, IntPtr* ppException,
}
}
- [UnmanagedCallersOnly]
- static void _setOverride(IntPtr thisHandle, IntPtr* ppException, IntPtr pOverride, CORINFO_METHOD_STRUCT_* currentMethod)
- {
- var _this = GetThis(thisHandle);
- try
- {
- _this.setOverride(pOverride, currentMethod);
- }
- catch (Exception ex)
- {
- *ppException = _this.AllocException(ex);
- }
- }
-
[UnmanagedCallersOnly]
static void _addActiveDependency(IntPtr thisHandle, IntPtr* ppException, CORINFO_MODULE_STRUCT_* moduleFrom, CORINFO_MODULE_STRUCT_* moduleTo)
{
@@ -2566,7 +2552,7 @@ static byte _doesFieldBelongToClass(IntPtr thisHandle, IntPtr* ppException, CORI
static IntPtr GetUnmanagedCallbacks()
{
- void** callbacks = (void**)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 173);
+ void** callbacks = (void**)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 172);
callbacks[0] = (delegate* unmanaged)&_isIntrinsic;
callbacks[1] = (delegate* unmanaged)&_getMethodAttribs;
@@ -2716,31 +2702,30 @@ static IntPtr GetUnmanagedCallbacks()
callbacks[145] = (delegate* unmanaged)&_constructStringLiteral;
callbacks[146] = (delegate* unmanaged)&_emptyStringLiteral;
callbacks[147] = (delegate* unmanaged)&_getFieldThreadLocalStoreID;
- callbacks[148] = (delegate* unmanaged)&_setOverride;
- callbacks[149] = (delegate* unmanaged)&_addActiveDependency;
- callbacks[150] = (delegate* unmanaged)&_GetDelegateCtor;
- callbacks[151] = (delegate* unmanaged)&_MethodCompileComplete;
- callbacks[152] = (delegate* unmanaged)&_getTailCallHelpers;
- callbacks[153] = (delegate* unmanaged)&_convertPInvokeCalliToCall;
- callbacks[154] = (delegate* unmanaged)&_notifyInstructionSetUsage;
- callbacks[155] = (delegate* unmanaged)&_updateEntryPointForTailCall;
- callbacks[156] = (delegate* unmanaged)&_allocMem;
- callbacks[157] = (delegate* unmanaged)&_reserveUnwindInfo;
- callbacks[158] = (delegate* unmanaged)&_allocUnwindInfo;
- callbacks[159] = (delegate* unmanaged)&_allocGCInfo;
- callbacks[160] = (delegate* unmanaged)&_setEHcount;
- callbacks[161] = (delegate* unmanaged)&_setEHinfo;
- callbacks[162] = (delegate* unmanaged)&_logMsg;
- callbacks[163] = (delegate* unmanaged)&_doAssert;
- callbacks[164] = (delegate* unmanaged)&_reportFatalError;
- callbacks[165] = (delegate* unmanaged)&_getPgoInstrumentationResults;
- callbacks[166] = (delegate* unmanaged)&_allocPgoInstrumentationBySchema;
- callbacks[167] = (delegate* unmanaged)&_recordCallSite;
- callbacks[168] = (delegate* unmanaged)&_recordRelocation;
- callbacks[169] = (delegate* unmanaged)&_getRelocTypeHint;
- callbacks[170] = (delegate* unmanaged)&_getExpectedTargetArchitecture;
- callbacks[171] = (delegate* unmanaged)&_getJitFlags;
- callbacks[172] = (delegate* unmanaged)&_doesFieldBelongToClass;
+ callbacks[148] = (delegate* unmanaged)&_addActiveDependency;
+ callbacks[149] = (delegate* unmanaged)&_GetDelegateCtor;
+ callbacks[150] = (delegate* unmanaged)&_MethodCompileComplete;
+ callbacks[151] = (delegate* unmanaged)&_getTailCallHelpers;
+ callbacks[152] = (delegate* unmanaged)&_convertPInvokeCalliToCall;
+ callbacks[153] = (delegate* unmanaged)&_notifyInstructionSetUsage;
+ callbacks[154] = (delegate* unmanaged)&_updateEntryPointForTailCall;
+ callbacks[155] = (delegate* unmanaged)&_allocMem;
+ callbacks[156] = (delegate* unmanaged)&_reserveUnwindInfo;
+ callbacks[157] = (delegate* unmanaged)&_allocUnwindInfo;
+ callbacks[158] = (delegate* unmanaged)&_allocGCInfo;
+ callbacks[159] = (delegate* unmanaged)&_setEHcount;
+ callbacks[160] = (delegate* unmanaged)&_setEHinfo;
+ callbacks[161] = (delegate* unmanaged)&_logMsg;
+ callbacks[162] = (delegate* unmanaged)&_doAssert;
+ callbacks[163] = (delegate* unmanaged)&_reportFatalError;
+ callbacks[164] = (delegate* unmanaged)&_getPgoInstrumentationResults;
+ callbacks[165] = (delegate* unmanaged)&_allocPgoInstrumentationBySchema;
+ callbacks[166] = (delegate* unmanaged)&_recordCallSite;
+ callbacks[167] = (delegate* unmanaged)&_recordRelocation;
+ callbacks[168] = (delegate* unmanaged)&_getRelocTypeHint;
+ callbacks[169] = (delegate* unmanaged)&_getExpectedTargetArchitecture;
+ callbacks[170] = (delegate* unmanaged)&_getJitFlags;
+ callbacks[171] = (delegate* unmanaged)&_doesFieldBelongToClass;
return (IntPtr)callbacks;
}
diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
index f800dadf431591..30189ccc4cb525 100644
--- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
+++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
@@ -3283,8 +3283,6 @@ private InfoAccessType emptyStringLiteral(ref void* ppValue)
private uint getFieldThreadLocalStoreID(CORINFO_FIELD_STRUCT_* field, ref void* ppIndirection)
{ throw new NotImplementedException("getFieldThreadLocalStoreID"); }
- private void setOverride(IntPtr pOverride, CORINFO_METHOD_STRUCT_* currentMethod)
- { throw new NotImplementedException("setOverride"); }
private void addActiveDependency(CORINFO_MODULE_STRUCT_* moduleFrom, CORINFO_MODULE_STRUCT_* moduleTo)
{ throw new NotImplementedException("addActiveDependency"); }
private CORINFO_METHOD_STRUCT_* GetDelegateCtor(CORINFO_METHOD_STRUCT_* methHnd, CORINFO_CLASS_STRUCT_* clsHnd, CORINFO_METHOD_STRUCT_* targetMethodHnd, ref DelegateCtorArgs pCtorData)
diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoInstructionSet.cs b/src/coreclr/tools/Common/JitInterface/CorInfoInstructionSet.cs
index f1ffa0a0cd4ebc..a7b188e0374086 100644
--- a/src/coreclr/tools/Common/JitInterface/CorInfoInstructionSet.cs
+++ b/src/coreclr/tools/Common/JitInterface/CorInfoInstructionSet.cs
@@ -8,6 +8,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Linq;
using System.Runtime.InteropServices;
using Internal.TypeSystem;
@@ -17,105 +18,220 @@ public enum InstructionSet
{
ILLEGAL = 0,
NONE = 63,
- ARM64_ArmBase=1,
- ARM64_AdvSimd=2,
- ARM64_Aes=3,
- ARM64_Crc32=4,
- ARM64_Dp=5,
- ARM64_Rdm=6,
- ARM64_Sha1=7,
- ARM64_Sha256=8,
- ARM64_Atomics=9,
- ARM64_Vector64=10,
- ARM64_Vector128=11,
- ARM64_Dczva=12,
- ARM64_ArmBase_Arm64=13,
- ARM64_AdvSimd_Arm64=14,
- ARM64_Aes_Arm64=15,
- ARM64_Crc32_Arm64=16,
- ARM64_Dp_Arm64=17,
- ARM64_Rdm_Arm64=18,
- ARM64_Sha1_Arm64=19,
- ARM64_Sha256_Arm64=20,
- X64_X86Base=1,
- X64_SSE=2,
- X64_SSE2=3,
- X64_SSE3=4,
- X64_SSSE3=5,
- X64_SSE41=6,
- X64_SSE42=7,
- X64_AVX=8,
- X64_AVX2=9,
- X64_AES=10,
- X64_BMI1=11,
- X64_BMI2=12,
- X64_FMA=13,
- X64_LZCNT=14,
- X64_PCLMULQDQ=15,
- X64_POPCNT=16,
- X64_Vector128=17,
- X64_Vector256=18,
- X64_AVXVNNI=19,
- X64_X86Base_X64=20,
- X64_SSE_X64=21,
- X64_SSE2_X64=22,
- X64_SSE3_X64=23,
- X64_SSSE3_X64=24,
- X64_SSE41_X64=25,
- X64_SSE42_X64=26,
- X64_AVX_X64=27,
- X64_AVX2_X64=28,
- X64_AES_X64=29,
- X64_BMI1_X64=30,
- X64_BMI2_X64=31,
- X64_FMA_X64=32,
- X64_LZCNT_X64=33,
- X64_PCLMULQDQ_X64=34,
- X64_POPCNT_X64=35,
- X64_AVXVNNI_X64=36,
- X86_X86Base=1,
- X86_SSE=2,
- X86_SSE2=3,
- X86_SSE3=4,
- X86_SSSE3=5,
- X86_SSE41=6,
- X86_SSE42=7,
- X86_AVX=8,
- X86_AVX2=9,
- X86_AES=10,
- X86_BMI1=11,
- X86_BMI2=12,
- X86_FMA=13,
- X86_LZCNT=14,
- X86_PCLMULQDQ=15,
- X86_POPCNT=16,
- X86_Vector128=17,
- X86_Vector256=18,
- X86_AVXVNNI=19,
- X86_X86Base_X64=20,
- X86_SSE_X64=21,
- X86_SSE2_X64=22,
- X86_SSE3_X64=23,
- X86_SSSE3_X64=24,
- X86_SSE41_X64=25,
- X86_SSE42_X64=26,
- X86_AVX_X64=27,
- X86_AVX2_X64=28,
- X86_AES_X64=29,
- X86_BMI1_X64=30,
- X86_BMI2_X64=31,
- X86_FMA_X64=32,
- X86_LZCNT_X64=33,
- X86_PCLMULQDQ_X64=34,
- X86_POPCNT_X64=35,
- X86_AVXVNNI_X64=36,
+ ARM64_ArmBase = InstructionSet_ARM64.ArmBase,
+ ARM64_AdvSimd = InstructionSet_ARM64.AdvSimd,
+ ARM64_Aes = InstructionSet_ARM64.Aes,
+ ARM64_Crc32 = InstructionSet_ARM64.Crc32,
+ ARM64_Dp = InstructionSet_ARM64.Dp,
+ ARM64_Rdm = InstructionSet_ARM64.Rdm,
+ ARM64_Sha1 = InstructionSet_ARM64.Sha1,
+ ARM64_Sha256 = InstructionSet_ARM64.Sha256,
+ ARM64_Atomics = InstructionSet_ARM64.Atomics,
+ ARM64_Vector64 = InstructionSet_ARM64.Vector64,
+ ARM64_Vector128 = InstructionSet_ARM64.Vector128,
+ ARM64_Dczva = InstructionSet_ARM64.Dczva,
+ ARM64_ArmBase_Arm64 = InstructionSet_ARM64.ArmBase_Arm64,
+ ARM64_AdvSimd_Arm64 = InstructionSet_ARM64.AdvSimd_Arm64,
+ ARM64_Aes_Arm64 = InstructionSet_ARM64.Aes_Arm64,
+ ARM64_Crc32_Arm64 = InstructionSet_ARM64.Crc32_Arm64,
+ ARM64_Dp_Arm64 = InstructionSet_ARM64.Dp_Arm64,
+ ARM64_Rdm_Arm64 = InstructionSet_ARM64.Rdm_Arm64,
+ ARM64_Sha1_Arm64 = InstructionSet_ARM64.Sha1_Arm64,
+ ARM64_Sha256_Arm64 = InstructionSet_ARM64.Sha256_Arm64,
+ X64_X86Base = InstructionSet_X64.X86Base,
+ X64_SSE = InstructionSet_X64.SSE,
+ X64_SSE2 = InstructionSet_X64.SSE2,
+ X64_SSE3 = InstructionSet_X64.SSE3,
+ X64_SSSE3 = InstructionSet_X64.SSSE3,
+ X64_SSE41 = InstructionSet_X64.SSE41,
+ X64_SSE42 = InstructionSet_X64.SSE42,
+ X64_AVX = InstructionSet_X64.AVX,
+ X64_AVX2 = InstructionSet_X64.AVX2,
+ X64_AES = InstructionSet_X64.AES,
+ X64_BMI1 = InstructionSet_X64.BMI1,
+ X64_BMI2 = InstructionSet_X64.BMI2,
+ X64_FMA = InstructionSet_X64.FMA,
+ X64_LZCNT = InstructionSet_X64.LZCNT,
+ X64_PCLMULQDQ = InstructionSet_X64.PCLMULQDQ,
+ X64_POPCNT = InstructionSet_X64.POPCNT,
+ X64_Vector128 = InstructionSet_X64.Vector128,
+ X64_Vector256 = InstructionSet_X64.Vector256,
+ X64_AVXVNNI = InstructionSet_X64.AVXVNNI,
+ X64_X86Base_X64 = InstructionSet_X64.X86Base_X64,
+ X64_SSE_X64 = InstructionSet_X64.SSE_X64,
+ X64_SSE2_X64 = InstructionSet_X64.SSE2_X64,
+ X64_SSE3_X64 = InstructionSet_X64.SSE3_X64,
+ X64_SSSE3_X64 = InstructionSet_X64.SSSE3_X64,
+ X64_SSE41_X64 = InstructionSet_X64.SSE41_X64,
+ X64_SSE42_X64 = InstructionSet_X64.SSE42_X64,
+ X64_AVX_X64 = InstructionSet_X64.AVX_X64,
+ X64_AVX2_X64 = InstructionSet_X64.AVX2_X64,
+ X64_AES_X64 = InstructionSet_X64.AES_X64,
+ X64_BMI1_X64 = InstructionSet_X64.BMI1_X64,
+ X64_BMI2_X64 = InstructionSet_X64.BMI2_X64,
+ X64_FMA_X64 = InstructionSet_X64.FMA_X64,
+ X64_LZCNT_X64 = InstructionSet_X64.LZCNT_X64,
+ X64_PCLMULQDQ_X64 = InstructionSet_X64.PCLMULQDQ_X64,
+ X64_POPCNT_X64 = InstructionSet_X64.POPCNT_X64,
+ X64_AVXVNNI_X64 = InstructionSet_X64.AVXVNNI_X64,
+ X86_X86Base = InstructionSet_X86.X86Base,
+ X86_SSE = InstructionSet_X86.SSE,
+ X86_SSE2 = InstructionSet_X86.SSE2,
+ X86_SSE3 = InstructionSet_X86.SSE3,
+ X86_SSSE3 = InstructionSet_X86.SSSE3,
+ X86_SSE41 = InstructionSet_X86.SSE41,
+ X86_SSE42 = InstructionSet_X86.SSE42,
+ X86_AVX = InstructionSet_X86.AVX,
+ X86_AVX2 = InstructionSet_X86.AVX2,
+ X86_AES = InstructionSet_X86.AES,
+ X86_BMI1 = InstructionSet_X86.BMI1,
+ X86_BMI2 = InstructionSet_X86.BMI2,
+ X86_FMA = InstructionSet_X86.FMA,
+ X86_LZCNT = InstructionSet_X86.LZCNT,
+ X86_PCLMULQDQ = InstructionSet_X86.PCLMULQDQ,
+ X86_POPCNT = InstructionSet_X86.POPCNT,
+ X86_Vector128 = InstructionSet_X86.Vector128,
+ X86_Vector256 = InstructionSet_X86.Vector256,
+ X86_AVXVNNI = InstructionSet_X86.AVXVNNI,
+ X86_X86Base_X64 = InstructionSet_X86.X86Base_X64,
+ X86_SSE_X64 = InstructionSet_X86.SSE_X64,
+ X86_SSE2_X64 = InstructionSet_X86.SSE2_X64,
+ X86_SSE3_X64 = InstructionSet_X86.SSE3_X64,
+ X86_SSSE3_X64 = InstructionSet_X86.SSSE3_X64,
+ X86_SSE41_X64 = InstructionSet_X86.SSE41_X64,
+ X86_SSE42_X64 = InstructionSet_X86.SSE42_X64,
+ X86_AVX_X64 = InstructionSet_X86.AVX_X64,
+ X86_AVX2_X64 = InstructionSet_X86.AVX2_X64,
+ X86_AES_X64 = InstructionSet_X86.AES_X64,
+ X86_BMI1_X64 = InstructionSet_X86.BMI1_X64,
+ X86_BMI2_X64 = InstructionSet_X86.BMI2_X64,
+ X86_FMA_X64 = InstructionSet_X86.FMA_X64,
+ X86_LZCNT_X64 = InstructionSet_X86.LZCNT_X64,
+ X86_PCLMULQDQ_X64 = InstructionSet_X86.PCLMULQDQ_X64,
+ X86_POPCNT_X64 = InstructionSet_X86.POPCNT_X64,
+ X86_AVXVNNI_X64 = InstructionSet_X86.AVXVNNI_X64,
+ }
+
+ public enum InstructionSet_ARM64
+ {
+ ILLEGAL = InstructionSet.ILLEGAL,
+ NONE = InstructionSet.NONE,
+ ArmBase = 1,
+ AdvSimd = 2,
+ Aes = 3,
+ Crc32 = 4,
+ Dp = 5,
+ Rdm = 6,
+ Sha1 = 7,
+ Sha256 = 8,
+ Atomics = 9,
+ Vector64 = 10,
+ Vector128 = 11,
+ Dczva = 12,
+ ArmBase_Arm64 = 13,
+ AdvSimd_Arm64 = 14,
+ Aes_Arm64 = 15,
+ Crc32_Arm64 = 16,
+ Dp_Arm64 = 17,
+ Rdm_Arm64 = 18,
+ Sha1_Arm64 = 19,
+ Sha256_Arm64 = 20,
+ }
+
+ public enum InstructionSet_X64
+ {
+ ILLEGAL = InstructionSet.ILLEGAL,
+ NONE = InstructionSet.NONE,
+ X86Base = 1,
+ SSE = 2,
+ SSE2 = 3,
+ SSE3 = 4,
+ SSSE3 = 5,
+ SSE41 = 6,
+ SSE42 = 7,
+ AVX = 8,
+ AVX2 = 9,
+ AES = 10,
+ BMI1 = 11,
+ BMI2 = 12,
+ FMA = 13,
+ LZCNT = 14,
+ PCLMULQDQ = 15,
+ POPCNT = 16,
+ Vector128 = 17,
+ Vector256 = 18,
+ AVXVNNI = 19,
+ X86Base_X64 = 20,
+ SSE_X64 = 21,
+ SSE2_X64 = 22,
+ SSE3_X64 = 23,
+ SSSE3_X64 = 24,
+ SSE41_X64 = 25,
+ SSE42_X64 = 26,
+ AVX_X64 = 27,
+ AVX2_X64 = 28,
+ AES_X64 = 29,
+ BMI1_X64 = 30,
+ BMI2_X64 = 31,
+ FMA_X64 = 32,
+ LZCNT_X64 = 33,
+ PCLMULQDQ_X64 = 34,
+ POPCNT_X64 = 35,
+ AVXVNNI_X64 = 36,
+ }
+ public enum InstructionSet_X86
+ {
+ ILLEGAL = InstructionSet.ILLEGAL,
+ NONE = InstructionSet.NONE,
+ X86Base = 1,
+ SSE = 2,
+ SSE2 = 3,
+ SSE3 = 4,
+ SSSE3 = 5,
+ SSE41 = 6,
+ SSE42 = 7,
+ AVX = 8,
+ AVX2 = 9,
+ AES = 10,
+ BMI1 = 11,
+ BMI2 = 12,
+ FMA = 13,
+ LZCNT = 14,
+ PCLMULQDQ = 15,
+ POPCNT = 16,
+ Vector128 = 17,
+ Vector256 = 18,
+ AVXVNNI = 19,
+ X86Base_X64 = 20,
+ SSE_X64 = 21,
+ SSE2_X64 = 22,
+ SSE3_X64 = 23,
+ SSSE3_X64 = 24,
+ SSE41_X64 = 25,
+ SSE42_X64 = 26,
+ AVX_X64 = 27,
+ AVX2_X64 = 28,
+ AES_X64 = 29,
+ BMI1_X64 = 30,
+ BMI2_X64 = 31,
+ FMA_X64 = 32,
+ LZCNT_X64 = 33,
+ PCLMULQDQ_X64 = 34,
+ POPCNT_X64 = 35,
+ AVXVNNI_X64 = 36,
}
public struct InstructionSetFlags : IEnumerable
{
- ulong _flags;
-
+ private ulong _flags;
+
+ public IEnumerable ARM64Flags => this.Select((x) => (InstructionSet_ARM64)x);
+
+ public IEnumerable X64Flags => this.Select((x) => (InstructionSet_X64)x);
+
+ public IEnumerable X86Flags => this.Select((x) => (InstructionSet_X86)x);
+
public void AddInstructionSet(InstructionSet instructionSet)
{
_flags = _flags | (((ulong)1) << (int)instructionSet);
@@ -235,6 +351,10 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target
resultflags.AddInstructionSet(InstructionSet.ARM64_ArmBase);
if (resultflags.HasInstructionSet(InstructionSet.ARM64_Sha256))
resultflags.AddInstructionSet(InstructionSet.ARM64_ArmBase);
+ if (resultflags.HasInstructionSet(InstructionSet.ARM64_Vector64))
+ resultflags.AddInstructionSet(InstructionSet.ARM64_AdvSimd);
+ if (resultflags.HasInstructionSet(InstructionSet.ARM64_Vector128))
+ resultflags.AddInstructionSet(InstructionSet.ARM64_AdvSimd);
break;
case TargetArchitecture.X64:
@@ -330,12 +450,18 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target
resultflags.AddInstructionSet(InstructionSet.X64_AVX);
if (resultflags.HasInstructionSet(InstructionSet.X64_FMA))
resultflags.AddInstructionSet(InstructionSet.X64_AVX);
+ if (resultflags.HasInstructionSet(InstructionSet.X64_LZCNT))
+ resultflags.AddInstructionSet(InstructionSet.X64_X86Base);
if (resultflags.HasInstructionSet(InstructionSet.X64_PCLMULQDQ))
resultflags.AddInstructionSet(InstructionSet.X64_SSE2);
if (resultflags.HasInstructionSet(InstructionSet.X64_POPCNT))
resultflags.AddInstructionSet(InstructionSet.X64_SSE42);
+ if (resultflags.HasInstructionSet(InstructionSet.X64_Vector128))
+ resultflags.AddInstructionSet(InstructionSet.X64_SSE);
if (resultflags.HasInstructionSet(InstructionSet.X64_Vector256))
resultflags.AddInstructionSet(InstructionSet.X64_AVX);
+ if (resultflags.HasInstructionSet(InstructionSet.X64_AVXVNNI))
+ resultflags.AddInstructionSet(InstructionSet.X64_AVX2);
break;
case TargetArchitecture.X86:
@@ -363,16 +489,22 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target
resultflags.AddInstructionSet(InstructionSet.X86_AVX);
if (resultflags.HasInstructionSet(InstructionSet.X86_FMA))
resultflags.AddInstructionSet(InstructionSet.X86_AVX);
+ if (resultflags.HasInstructionSet(InstructionSet.X86_LZCNT))
+ resultflags.AddInstructionSet(InstructionSet.X86_X86Base);
if (resultflags.HasInstructionSet(InstructionSet.X86_PCLMULQDQ))
resultflags.AddInstructionSet(InstructionSet.X86_SSE2);
if (resultflags.HasInstructionSet(InstructionSet.X86_POPCNT))
resultflags.AddInstructionSet(InstructionSet.X86_SSE42);
+ if (resultflags.HasInstructionSet(InstructionSet.X86_Vector128))
+ resultflags.AddInstructionSet(InstructionSet.X86_SSE);
if (resultflags.HasInstructionSet(InstructionSet.X86_Vector256))
resultflags.AddInstructionSet(InstructionSet.X86_AVX);
+ if (resultflags.HasInstructionSet(InstructionSet.X86_AVXVNNI))
+ resultflags.AddInstructionSet(InstructionSet.X86_AVX2);
break;
-
}
} while (!oldflags.Equals(resultflags));
+
return resultflags;
}
@@ -422,6 +554,10 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe
resultflags.AddInstructionSet(InstructionSet.ARM64_Sha1);
if (resultflags.HasInstructionSet(InstructionSet.ARM64_ArmBase))
resultflags.AddInstructionSet(InstructionSet.ARM64_Sha256);
+ if (resultflags.HasInstructionSet(InstructionSet.ARM64_AdvSimd))
+ resultflags.AddInstructionSet(InstructionSet.ARM64_Vector64);
+ if (resultflags.HasInstructionSet(InstructionSet.ARM64_AdvSimd))
+ resultflags.AddInstructionSet(InstructionSet.ARM64_Vector128);
break;
case TargetArchitecture.X64:
@@ -483,12 +619,18 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe
resultflags.AddInstructionSet(InstructionSet.X64_BMI2);
if (resultflags.HasInstructionSet(InstructionSet.X64_AVX))
resultflags.AddInstructionSet(InstructionSet.X64_FMA);
+ if (resultflags.HasInstructionSet(InstructionSet.X64_X86Base))
+ resultflags.AddInstructionSet(InstructionSet.X64_LZCNT);
if (resultflags.HasInstructionSet(InstructionSet.X64_SSE2))
resultflags.AddInstructionSet(InstructionSet.X64_PCLMULQDQ);
if (resultflags.HasInstructionSet(InstructionSet.X64_SSE42))
resultflags.AddInstructionSet(InstructionSet.X64_POPCNT);
+ if (resultflags.HasInstructionSet(InstructionSet.X64_SSE))
+ resultflags.AddInstructionSet(InstructionSet.X64_Vector128);
if (resultflags.HasInstructionSet(InstructionSet.X64_AVX))
resultflags.AddInstructionSet(InstructionSet.X64_Vector256);
+ if (resultflags.HasInstructionSet(InstructionSet.X64_AVX2))
+ resultflags.AddInstructionSet(InstructionSet.X64_AVXVNNI);
break;
case TargetArchitecture.X86:
@@ -516,16 +658,22 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe
resultflags.AddInstructionSet(InstructionSet.X86_BMI2);
if (resultflags.HasInstructionSet(InstructionSet.X86_AVX))
resultflags.AddInstructionSet(InstructionSet.X86_FMA);
+ if (resultflags.HasInstructionSet(InstructionSet.X86_X86Base))
+ resultflags.AddInstructionSet(InstructionSet.X86_LZCNT);
if (resultflags.HasInstructionSet(InstructionSet.X86_SSE2))
resultflags.AddInstructionSet(InstructionSet.X86_PCLMULQDQ);
if (resultflags.HasInstructionSet(InstructionSet.X86_SSE42))
resultflags.AddInstructionSet(InstructionSet.X86_POPCNT);
+ if (resultflags.HasInstructionSet(InstructionSet.X86_SSE))
+ resultflags.AddInstructionSet(InstructionSet.X86_Vector128);
if (resultflags.HasInstructionSet(InstructionSet.X86_AVX))
resultflags.AddInstructionSet(InstructionSet.X86_Vector256);
+ if (resultflags.HasInstructionSet(InstructionSet.X86_AVX2))
+ resultflags.AddInstructionSet(InstructionSet.X86_AVXVNNI);
break;
-
}
} while (!oldflags.Equals(resultflags));
+
return resultflags;
}
@@ -608,7 +756,6 @@ public static IEnumerable ArchitectureToValidInstructionSets
yield return new InstructionSetInfo("Vector256", "", InstructionSet.X86_Vector256, false);
yield return new InstructionSetInfo("avxvnni", "AvxVnni", InstructionSet.X86_AVXVNNI, true);
break;
-
}
}
@@ -675,7 +822,6 @@ public void Set64BitInstructionSetVariants(TargetArchitecture architecture)
case TargetArchitecture.X86:
break;
-
}
}
@@ -734,7 +880,6 @@ public void Set64BitInstructionSetVariantsUnconditionally(TargetArchitecture arc
AddInstructionSet(InstructionSet.X86_POPCNT_X64);
AddInstructionSet(InstructionSet.X86_AVXVNNI_X64);
break;
-
}
}
}
diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt
index 8bfdc9a9d86a75..02586289c003a7 100644
--- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt
+++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt
@@ -1,5 +1,5 @@
; Define the set of instruction sets available on a platform
-; Format is
+; Format is
;
; Add new instruction set
; instructionset,,,,, ,
@@ -72,9 +72,12 @@ implication ,X86 ,AES ,SSE2
implication ,X86 ,BMI1 ,AVX
implication ,X86 ,BMI2 ,AVX
implication ,X86 ,FMA ,AVX
+implication ,X86 ,LZCNT ,X86Base
implication ,X86 ,PCLMULQDQ ,SSE2
implication ,X86 ,POPCNT ,SSE42
+implication ,X86 ,Vector128 ,SSE
implication ,X86 ,Vector256 ,AVX
+implication ,X86 ,AVXVNNI ,AVX2
; Definition of X64 instruction sets
definearch ,X64 ,64Bit ,X64
@@ -113,3 +116,5 @@ implication ,ARM64 ,Dp ,AdvSimd
implication ,ARM64 ,Rdm ,AdvSimd
implication ,ARM64 ,Sha1 ,ArmBase
implication ,ARM64 ,Sha256 ,ArmBase
+implication ,ARM64 ,Vector64 ,AdvSimd
+implication ,ARM64 ,Vector128 ,AdvSimd
diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetGenerator.cs b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetGenerator.cs
index aeece5255661f2..a9e7ee1086e391 100644
--- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetGenerator.cs
+++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetGenerator.cs
@@ -355,6 +355,7 @@ public void WriteManagedJitInstructionSet(TextWriter tr)
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Linq;
using System.Runtime.InteropServices;
using Internal.TypeSystem;
@@ -365,23 +366,51 @@ public enum InstructionSet
ILLEGAL = 0,
NONE = 63,
");
+
foreach (string architecture in _architectures)
{
- int counter = 1;
foreach (var jitName in _architectureJitNames[architecture])
{
- tr.WriteLine($" {architecture}_{jitName}={counter++},");
+ tr.WriteLine($" {architecture}_{jitName} = InstructionSet_{architecture}.{jitName},");
}
}
- tr.Write(@"
- }
+ tr.Write(@" }
+
+");
+
+ foreach (string architecture in _architectures)
+ {
+ tr.WriteLine($" public enum InstructionSet_{architecture}");
+ tr.Write(@" {
+ ILLEGAL = InstructionSet.ILLEGAL,
+ NONE = InstructionSet.NONE,
+");
- public struct InstructionSetFlags : IEnumerable
+ int counter = 1;
+ foreach (var jitName in _architectureJitNames[architecture])
+ {
+ tr.WriteLine($" {jitName} = {counter++},");
+ }
+
+ tr.Write(@" }
+
+");
+ }
+
+ tr.Write(@" public struct InstructionSetFlags : IEnumerable
{
- ulong _flags;
-
- public void AddInstructionSet(InstructionSet instructionSet)
+ private ulong _flags;
+
+");
+
+ foreach (string architecture in _architectures)
+ {
+ tr.WriteLine($" public IEnumerable {architecture}Flags => this.Select((x) => (InstructionSet_{architecture})x);");
+ tr.WriteLine();
+ }
+
+ tr.Write(@" public void AddInstructionSet(InstructionSet instructionSet)
{
_flags = _flags | (((ulong)1) << (int)instructionSet);
}
@@ -475,9 +504,9 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target
tr.WriteLine(" break;");
}
- tr.Write(@"
- }
+ tr.Write(@" }
} while (!oldflags.Equals(resultflags));
+
return resultflags;
}
@@ -515,9 +544,9 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe
tr.WriteLine(" break;");
}
- tr.Write(@"
- }
+ tr.Write(@" }
} while (!oldflags.Equals(resultflags));
+
return resultflags;
}
@@ -559,8 +588,8 @@ public static IEnumerable ArchitectureToValidInstructionSets
}
tr.WriteLine(" break;");
}
- tr.Write(@"
- }
+
+ tr.Write(@" }
}
public void Set64BitInstructionSetVariants(TargetArchitecture architecture)
@@ -586,8 +615,7 @@ public void Set64BitInstructionSetVariants(TargetArchitecture architecture)
tr.WriteLine(" break;");
}
- tr.Write(@"
- }
+ tr.Write(@" }
}
public void Set64BitInstructionSetVariantsUnconditionally(TargetArchitecture architecture)
@@ -610,13 +638,13 @@ public void Set64BitInstructionSetVariantsUnconditionally(TargetArchitecture arc
tr.WriteLine(" break;");
}
- tr.Write(@"
- }
+ tr.Write(@" }
}
}
}
");
return;
+
void AddReverseImplication(string architecture, string jitName, string impliedJitName)
{
AddImplication(architecture, impliedJitName, jitName);
diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt
index dbe775e1e0246e..92bc30aaf2570b 100644
--- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt
+++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt
@@ -301,7 +301,6 @@ FUNCTIONS
InfoAccessType constructStringLiteral(CORINFO_MODULE_HANDLE module, mdToken metaTok, void **ppValue);
InfoAccessType emptyStringLiteral(void **ppValue);
uint32_t getFieldThreadLocalStoreID (CORINFO_FIELD_HANDLE field, void **ppIndirection);
- void setOverride(ICorDynamicInfo *pOverride, CORINFO_METHOD_HANDLE currentMethod);
void addActiveDependency(CORINFO_MODULE_HANDLE moduleFrom, CORINFO_MODULE_HANDLE moduleTo);
CORINFO_METHOD_HANDLE GetDelegateCtor(CORINFO_METHOD_HANDLE methHnd, CORINFO_CLASS_HANDLE clsHnd, CORINFO_METHOD_HANDLE targetMethodHnd, DelegateCtorArgs * pCtorData);
void MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd);
diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.bat b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.bat
index c775755558de9c..69e3367c4e0942 100644
--- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.bat
+++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.bat
@@ -1,4 +1,4 @@
pushd %~dp0
-call ..\..\..\..\..\..\dotnet.cmd run -- ThunkInput.txt ..\CorInfoBase.cs ..\..\..\aot\jitinterface\jitinterface.h ..\..\..\..\jit\ICorJitInfo_API_names.h ..\..\..\..\jit\ICorJitInfo_API_wrapper.hpp ..\..\..\..\inc\icorjitinfoimpl_generated.h ..\..\..\..\ToolBox\superpmi\superpmi-shim-counter\icorjitinfo.cpp ..\..\..\..\ToolBox\superpmi\superpmi-shim-simple\icorjitinfo.cpp
+call ..\..\..\..\..\..\dotnet.cmd run -- ThunkInput.txt ..\CorInfoBase.cs ..\..\..\aot\jitinterface\jitinterface.h ..\..\..\..\jit\ICorJitInfo_API_names.h ..\..\..\..\jit\ICorJitInfo_API_wrapper.hpp ..\..\..\..\inc\icorjitinfoimpl_generated.h ..\..\..\..\tools\superpmi\superpmi-shim-counter\icorjitinfo.cpp ..\..\..\..\tools\superpmi\superpmi-shim-simple\icorjitinfo.cpp
call ..\..\..\..\..\..\dotnet.cmd run -- InstructionSetGenerator InstructionSetDesc.txt ..\..\Internal\Runtime\ReadyToRunInstructionSet.cs ..\..\Internal\Runtime\ReadyToRunInstructionSetHelper.cs ..\CorInfoInstructionSet.cs ..\..\..\..\inc\corinfoinstructionset.h ..\..\..\..\inc\readytoruninstructionset.h
popd
diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh
index 7dc71bd378d854..ca9cdcb52ef11f 100755
--- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh
+++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
cd "$(dirname ${BASH_SOURCE[0]})"
-../../../../../../dotnet.sh run -- ThunkInput.txt ../CorInfoBase.cs ../../../aot/jitinterface/jitinterface.h ../../../../jit/ICorJitInfo_API_names.h ../../../../jit/ICorJitInfo_API_wrapper.hpp ../../../../inc/icorjitinfoimpl_generated.h ../../../../ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp ../../../../ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp
+../../../../../../dotnet.sh run -- ThunkInput.txt ../CorInfoBase.cs ../../../aot/jitinterface/jitinterface.h ../../../../jit/ICorJitInfo_API_names.h ../../../../jit/ICorJitInfo_API_wrapper.hpp ../../../../inc/icorjitinfoimpl_generated.h ../../../../tools/superpmi/superpmi-shim-counter/icorjitinfo.cpp ../../../../tools/superpmi/superpmi-shim-simple/icorjitinfo.cpp
../../../../../../dotnet.sh run -- InstructionSetGenerator InstructionSetDesc.txt ../../Internal/Runtime/ReadyToRunInstructionSet.cs ../../Internal/Runtime/ReadyToRunInstructionSetHelper.cs ../CorInfoInstructionSet.cs ../../../../inc/corinfoinstructionset.h ../../../../inc/readytoruninstructionset.h
diff --git a/src/coreclr/tools/Common/TypeSystem/Aot/TargetDetails.Aot.cs b/src/coreclr/tools/Common/TypeSystem/Aot/TargetDetails.Aot.cs
deleted file mode 100644
index 9e9704555724d4..00000000000000
--- a/src/coreclr/tools/Common/TypeSystem/Aot/TargetDetails.Aot.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-namespace Internal.TypeSystem
-{
- // Extension to TargetDetails related to Aot
- partial class TargetDetails
- {
- ///
- /// Offset by which fat function pointers are shifted to distinguish them
- /// from real function pointers.
- /// WebAssembly uses index tables, not addresses for function pointers, so the lower bits are not free to use.
- ///
- public int FatFunctionPointerOffset => Architecture == TargetArchitecture.Wasm32 ? 1 << 31 : 2;
- }
-}
diff --git a/src/coreclr/tools/Common/TypeSystem/Canon/TypeSystemContext.Canon.cs b/src/coreclr/tools/Common/TypeSystem/Canon/TypeSystemContext.Canon.cs
index 091f26bfda510c..0a35ceeb64d254 100644
--- a/src/coreclr/tools/Common/TypeSystem/Canon/TypeSystemContext.Canon.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Canon/TypeSystemContext.Canon.cs
@@ -69,8 +69,7 @@ public bool IsCanonicalDefinitionType(TypeDesc type, CanonicalFormKind kind)
///
public Instantiation ConvertInstantiationToCanonForm(Instantiation instantiation, CanonicalFormKind kind)
{
- bool changed;
- return ConvertInstantiationToCanonForm(instantiation, kind, out changed);
+ return ConvertInstantiationToCanonForm(instantiation, kind, out _);
}
///
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/ConstructedTypeRewritingHelpers.cs b/src/coreclr/tools/Common/TypeSystem/Common/ConstructedTypeRewritingHelpers.cs
index 73c4dfd43f7b4d..42011765c379d3 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/ConstructedTypeRewritingHelpers.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/ConstructedTypeRewritingHelpers.cs
@@ -155,7 +155,7 @@ public static TypeDesc ReplaceTypesInConstructionOfType(this TypeDesc type, Type
public static MethodDesc ReplaceTypesInConstructionOfMethod(this MethodDesc method, TypeDesc[] typesToReplace, TypeDesc[] replacementTypes)
{
TypeDesc newOwningType = method.OwningType.ReplaceTypesInConstructionOfType(typesToReplace, replacementTypes);
- MethodDesc methodOnOwningType = null;
+ MethodDesc methodOnOwningType;
bool owningTypeChanged = false;
if (newOwningType == method.OwningType)
{
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/GenericParameterDesc.Diagnostic.cs b/src/coreclr/tools/Common/TypeSystem/Common/GenericParameterDesc.Diagnostic.cs
index 8af9193966818b..7e8df4304dfd5c 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/GenericParameterDesc.Diagnostic.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/GenericParameterDesc.Diagnostic.cs
@@ -11,6 +11,12 @@ public abstract partial class GenericParameterDesc
///
/// Gets the name of the generic parameter as defined in the metadata. This must not throw
///
- public abstract string DiagnosticName { get; }
+ public virtual string DiagnosticName
+ {
+ get
+ {
+ return string.Concat("T", Index.ToStringInvariant());
+ }
+ }
}
}
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemHelpers.cs b/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemHelpers.cs
index f062c0daede442..f36f45f00f5cc1 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemHelpers.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemHelpers.cs
@@ -287,7 +287,7 @@ public static MethodDesc ResolveInterfaceMethodTarget(this TypeDesc thisType, Me
{
Debug.Assert(interfaceMethodToResolve.OwningType.IsInterface);
- MethodDesc result = null;
+ MethodDesc result;
TypeDesc currentType = thisType;
do
{
@@ -307,7 +307,7 @@ public static MethodDesc ResolveInterfaceMethodTargetWithVariance(this TypeDesc
{
Debug.Assert(interfaceMethodToResolve.OwningType.IsInterface);
- MethodDesc result = null;
+ MethodDesc result;
TypeDesc currentType = thisType;
do
{
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/GCPointerMap.Algorithm.cs b/src/coreclr/tools/Common/TypeSystem/Common/Utilities/GCPointerMap.Algorithm.cs
index af5938677a4b4d..b4fc577fb7bb6a 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/GCPointerMap.Algorithm.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/Utilities/GCPointerMap.Algorithm.cs
@@ -51,5 +51,73 @@ private static void FromInstanceLayoutHelper(ref GCPointerMapBuilder builder, De
}
}
}
+
+ ///
+ /// Computes the GC pointer map of the GC static region of the type.
+ ///
+ public static GCPointerMap FromStaticLayout(DefType type)
+ {
+ GCPointerMapBuilder builder = new GCPointerMapBuilder(type.GCStaticFieldSize.AsInt, type.Context.Target.PointerSize);
+
+ foreach (FieldDesc field in type.GetFields())
+ {
+ if (!field.IsStatic || field.HasRva || field.IsLiteral
+ || field.IsThreadStatic || !field.HasGCStaticBase)
+ continue;
+
+ TypeDesc fieldType = field.FieldType;
+ if (fieldType.IsGCPointer)
+ {
+ builder.MarkGCPointer(field.Offset.AsInt);
+ }
+ else
+ {
+ Debug.Assert(fieldType.IsValueType);
+ var fieldDefType = (DefType)fieldType;
+ if (fieldDefType.ContainsGCPointers)
+ {
+ GCPointerMapBuilder innerBuilder =
+ builder.GetInnerBuilder(field.Offset.AsInt, fieldDefType.InstanceByteCount.AsInt);
+ FromInstanceLayoutHelper(ref innerBuilder, fieldDefType);
+ }
+ }
+ }
+
+ Debug.Assert(builder.ToGCMap().Size * type.Context.Target.PointerSize >= type.GCStaticFieldSize.AsInt);
+ return builder.ToGCMap();
+ }
+
+ ///
+ /// Computes the GC pointer map of the thread static region of the type.
+ ///
+ public static GCPointerMap FromThreadStaticLayout(DefType type)
+ {
+ GCPointerMapBuilder builder = new GCPointerMapBuilder(type.ThreadGcStaticFieldSize.AsInt, type.Context.Target.PointerSize);
+
+ foreach (FieldDesc field in type.GetFields())
+ {
+ if (!field.IsStatic || field.HasRva || field.IsLiteral || !field.IsThreadStatic || !field.HasGCStaticBase)
+ continue;
+
+ TypeDesc fieldType = field.FieldType;
+ if (fieldType.IsGCPointer)
+ {
+ builder.MarkGCPointer(field.Offset.AsInt);
+ }
+ else if (fieldType.IsValueType)
+ {
+ var fieldDefType = (DefType)fieldType;
+ if (fieldDefType.ContainsGCPointers)
+ {
+ GCPointerMapBuilder innerBuilder =
+ builder.GetInnerBuilder(field.Offset.AsInt, fieldDefType.InstanceByteCount.AsInt);
+ FromInstanceLayoutHelper(ref innerBuilder, fieldDefType);
+ }
+ }
+ }
+
+ Debug.Assert(builder.ToGCMap().Size * type.Context.Target.PointerSize >= type.ThreadGcStaticFieldSize.AsInt);
+ return builder.ToGCMap();
+ }
}
}
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/GCPointerMap.Aot.cs b/src/coreclr/tools/Common/TypeSystem/Common/Utilities/GCPointerMap.Aot.cs
deleted file mode 100644
index 4738cde90c6921..00000000000000
--- a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/GCPointerMap.Aot.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using Debug = System.Diagnostics.Debug;
-
-namespace Internal.TypeSystem
-{
- partial struct GCPointerMap
- {
- ///
- /// Computes the GC pointer map of the GC static region of the type.
- ///
- public static GCPointerMap FromStaticLayout(DefType type)
- {
- GCPointerMapBuilder builder = new GCPointerMapBuilder(type.GCStaticFieldSize.AsInt, type.Context.Target.PointerSize);
-
- foreach (FieldDesc field in type.GetFields())
- {
- if (!field.IsStatic || field.HasRva || field.IsLiteral
- || field.IsThreadStatic || !field.HasGCStaticBase)
- continue;
-
- TypeDesc fieldType = field.FieldType;
- if (fieldType.IsGCPointer)
- {
- builder.MarkGCPointer(field.Offset.AsInt);
- }
- else
- {
- Debug.Assert(fieldType.IsValueType);
- var fieldDefType = (DefType)fieldType;
- if (fieldDefType.ContainsGCPointers)
- {
- GCPointerMapBuilder innerBuilder =
- builder.GetInnerBuilder(field.Offset.AsInt, fieldDefType.InstanceByteCount.AsInt);
- FromInstanceLayoutHelper(ref innerBuilder, fieldDefType);
- }
- }
- }
-
- Debug.Assert(builder.ToGCMap().Size * type.Context.Target.PointerSize >= type.GCStaticFieldSize.AsInt);
- return builder.ToGCMap();
- }
-
- ///
- /// Computes the GC pointer map of the thread static region of the type.
- ///
- public static GCPointerMap FromThreadStaticLayout(DefType type)
- {
- GCPointerMapBuilder builder = new GCPointerMapBuilder(type.ThreadGcStaticFieldSize.AsInt, type.Context.Target.PointerSize);
-
- foreach (FieldDesc field in type.GetFields())
- {
- if (!field.IsStatic || field.HasRva || field.IsLiteral || !field.IsThreadStatic || !field.HasGCStaticBase)
- continue;
-
- TypeDesc fieldType = field.FieldType;
- if (fieldType.IsGCPointer)
- {
- builder.MarkGCPointer(field.Offset.AsInt);
- }
- else if (fieldType.IsValueType)
- {
- var fieldDefType = (DefType)fieldType;
- if (fieldDefType.ContainsGCPointers)
- {
- GCPointerMapBuilder innerBuilder =
- builder.GetInnerBuilder(field.Offset.AsInt, fieldDefType.InstanceByteCount.AsInt);
- FromInstanceLayoutHelper(ref innerBuilder, fieldDefType);
- }
- }
- }
-
- Debug.Assert(builder.ToGCMap().Size * type.Context.Target.PointerSize >= type.ThreadGcStaticFieldSize.AsInt);
- return builder.ToGCMap();
- }
- }
-}
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtable.cs b/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtable.cs
index eee17ccf0cc482..e915f9518ad043 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtable.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtable.cs
@@ -363,8 +363,7 @@ public bool TryAdd(TValue value)
/// Newly added value, or a value which was already present in the hashtable which is equal to it.
public TValue AddOrGetExisting(TValue value)
{
- bool unused;
- return AddOrGetExistingInner(value, out unused);
+ return AddOrGetExistingInner(value, out _);
}
private TValue AddOrGetExistingInner(TValue value, out bool addedValue)
@@ -584,8 +583,7 @@ public TValue GetOrCreateValue(TKey key)
///
public bool Contains(TKey key)
{
- TValue dummyExistingValue;
- return TryGetValue(key, out dummyExistingValue);
+ return TryGetValue(key, out _);
}
///
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtableOfPointers.cs b/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtableOfPointers.cs
index 42b62fc6bb0738..7c03a26c71bc6d 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtableOfPointers.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtableOfPointers.cs
@@ -326,8 +326,7 @@ public bool TryAdd(TValue value)
/// Newly added value, or a value which was already present in the hashtable which is equal to it.
public TValue AddOrGetExisting(TValue value)
{
- bool unused;
- return AddOrGetExistingInner(value, out unused);
+ return AddOrGetExistingInner(value, out _);
}
private TValue AddOrGetExistingInner(TValue value, out bool addedValue)
@@ -525,8 +524,7 @@ public TValue GetOrCreateValue(TKey key)
///
public bool Contains(TKey key)
{
- TValue dummyExistingValue;
- return TryGetValue(key, out dummyExistingValue);
+ return TryGetValue(key, out _);
}
///
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/ILDisassembler.cs b/src/coreclr/tools/Common/TypeSystem/IL/ILDisassembler.cs
index 2d1a626cc633d9..f11ed8cf5db8e1 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/ILDisassembler.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/ILDisassembler.cs
@@ -227,8 +227,7 @@ private unsafe double ReadILDouble()
public static void AppendOffset(StringBuilder sb, int offset)
{
- sb.Append("IL_");
- sb.AppendFormat("{0:X4}", offset);
+ sb.Append($"IL_{offset:X4}");
}
private static void PadForInstructionArgument(StringBuilder sb)
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/AssemblyGetExecutingAssemblyMethodThunk.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/AssemblyGetExecutingAssemblyMethodThunk.cs
index ab0e8eee978581..ce1d69716a7b97 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/AssemblyGetExecutingAssemblyMethodThunk.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/AssemblyGetExecutingAssemblyMethodThunk.cs
@@ -44,6 +44,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return $"GetExecutingAssembly_{ExecutingAssembly.GetName().Name}";
+ }
+ }
+
public override TypeDesc OwningType
{
get;
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.Sorting.cs
index 1c48c00b406078..89be9fa3a7d881 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.Sorting.cs
@@ -8,9 +8,9 @@ namespace Internal.IL.Stubs
// Functionality related to deterministic ordering of methods
partial class CalliMarshallingMethodThunk
{
- protected internal override int ClassCode => 1594107963;
+ protected override int ClassCode => 1594107963;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (CalliMarshallingMethodThunk)other;
return comparer.Compare(_targetSignature, otherMethod._targetSignature);
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.cs
index 73b8645e855947..bdbd7b67998f48 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.cs
@@ -79,6 +79,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "CalliMarshallingMethodThunk";
+ }
+ }
+
public override PInvokeMetadata GetPInvokeMethodMetadata()
{
// Return PInvokeAttributes.PreserveSig to circumvent marshalling required checks
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateMarshallingMethodThunk.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateMarshallingMethodThunk.Sorting.cs
index c0a4887211c179..b38cd1fda8e540 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateMarshallingMethodThunk.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateMarshallingMethodThunk.Sorting.cs
@@ -8,9 +8,9 @@ namespace Internal.IL.Stubs
// Functionality related to deterministic ordering of methods
partial class DelegateMarshallingMethodThunk
{
- protected internal override int ClassCode => 1018037605;
+ protected override int ClassCode => 1018037605;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (DelegateMarshallingMethodThunk)other;
int result = (int)Kind - (int)otherMethod.Kind;
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateMarshallingMethodThunk.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateMarshallingMethodThunk.cs
index a81809c4193030..276f7dc4a42fcb 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateMarshallingMethodThunk.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateMarshallingMethodThunk.cs
@@ -237,6 +237,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return NamePrefix + "__" + DelegateType.DiagnosticName;
+ }
+ }
+
public override MethodIL EmitIL()
{
return PInvokeILEmitter.EmitIL(this, default(PInvokeILEmitterConfiguration), _interopStateManager);
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.Sorting.cs
index a5aece70b22371..1126e01d4020ba 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.Sorting.cs
@@ -8,7 +8,7 @@ namespace Internal.IL.Stubs
// Functionality related to deterministic ordering of types
partial class DelegateThunk
{
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (DelegateThunk)other;
return comparer.Compare(_delegateInfo.Type, otherMethod._delegateInfo.Type);
@@ -17,39 +17,39 @@ protected internal override int CompareToImpl(MethodDesc other, TypeSystemCompar
partial class DelegateInvokeOpenStaticThunk
{
- protected internal override int ClassCode => 386356101;
+ protected override int ClassCode => 386356101;
}
public sealed partial class DelegateInvokeOpenInstanceThunk
{
- protected internal override int ClassCode => -1787190244;
+ protected override int ClassCode => -1787190244;
}
partial class DelegateInvokeClosedStaticThunk
{
- protected internal override int ClassCode => 28195375;
+ protected override int ClassCode => 28195375;
}
partial class DelegateInvokeMulticastThunk
{
- protected internal override int ClassCode => 639863471;
+ protected override int ClassCode => 639863471;
}
partial class DelegateInvokeInstanceClosedOverGenericMethodThunk
{
- protected internal override int ClassCode => -354480633;
+ protected override int ClassCode => -354480633;
}
partial class DelegateInvokeObjectArrayThunk
{
- protected internal override int ClassCode => 1993292344;
+ protected override int ClassCode => 1993292344;
}
partial class DelegateGetThunkMethodOverride
{
- protected internal override int ClassCode => -321263379;
+ protected override int ClassCode => -321263379;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (DelegateGetThunkMethodOverride)other;
return comparer.Compare(_delegateInfo.Type, otherMethod._delegateInfo.Type);
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.cs
index 5725a062a086e2..5e9ed17fbc478b 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.cs
@@ -90,6 +90,14 @@ protected FieldDesc FunctionPointerField
return SystemDelegateType.GetKnownField("m_functionPointer");
}
}
+
+ public sealed override string DiagnosticName
+ {
+ get
+ {
+ return Name;
+ }
+ }
}
///
@@ -718,7 +726,8 @@ public override MethodIL EmitIL()
Debug.Assert(_delegateInfo.Thunks[i] == null);
var sig = new DynamicInvokeMethodSignature(_delegateInfo.Signature);
- MethodDesc thunk = Context.GetDynamicInvokeThunk(sig);
+ // TODO: layering violation. Should move delegate thunk stuff to ILCompiler.Compiler.
+ MethodDesc thunk = ((ILCompiler.CompilerTypeSystemContext)Context).GetDynamicInvokeThunk(sig);
if (thunk.HasInstantiation)
{
@@ -779,5 +788,13 @@ public override string Name
return "GetThunk";
}
}
+
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "GetThunk";
+ }
+ }
}
}
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DynamicInvokeMethodThunk.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DynamicInvokeMethodThunk.Sorting.cs
index 43da587d086346..29976d1a659c4e 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DynamicInvokeMethodThunk.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DynamicInvokeMethodThunk.Sorting.cs
@@ -11,9 +11,9 @@ namespace Internal.IL.Stubs
// Functionality related to determinstic ordering of types
partial class DynamicInvokeMethodThunk
{
- protected internal override int ClassCode => -1980933220;
+ protected override int ClassCode => -1980933220;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
return CompareTo((DynamicInvokeMethodThunk)other);
}
@@ -51,9 +51,9 @@ private int CompareTo(DynamicInvokeMethodThunk otherMethod)
partial class DynamicInvokeThunkGenericParameter
{
- protected internal override int ClassCode => -234393261;
+ protected override int ClassCode => -234393261;
- protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
{
var otherType = (DynamicInvokeThunkGenericParameter)other;
int result = Index - otherType.Index;
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DynamicInvokeMethodThunk.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DynamicInvokeMethodThunk.cs
index 90ce50f8425ca4..de076f3b8cbff8 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DynamicInvokeMethodThunk.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DynamicInvokeMethodThunk.cs
@@ -308,6 +308,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return Name;
+ }
+ }
+
public override MethodIL EmitIL()
{
ILEmitter emitter = new ILEmitter();
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/EnumThunks.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/EnumThunks.Sorting.cs
index d6ae00c139863f..33b07a8e86f109 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/EnumThunks.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/EnumThunks.Sorting.cs
@@ -8,9 +8,9 @@ namespace Internal.IL.Stubs
// Functionality related to deterministic ordering of types
partial class EnumGetHashCodeThunk
{
- protected internal override int ClassCode => 261739662;
+ protected override int ClassCode => 261739662;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (EnumGetHashCodeThunk)other;
return comparer.Compare(_owningType, otherMethod._owningType);
@@ -19,9 +19,9 @@ protected internal override int CompareToImpl(MethodDesc other, TypeSystemCompar
partial class EnumEqualsThunk
{
- protected internal override int ClassCode => -1774524780;
+ protected override int ClassCode => -1774524780;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (EnumEqualsThunk)other;
return comparer.Compare(_owningType, otherMethod._owningType);
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/EnumThunks.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/EnumThunks.cs
index a44161e6fa354b..dc8fba49876afc 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/EnumThunks.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/EnumThunks.cs
@@ -64,6 +64,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "GetHashCode";
+ }
+ }
+
public override bool IsVirtual
{
get
@@ -147,6 +155,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "Equals";
+ }
+ }
+
public override bool IsVirtual
{
get
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ForwardDelegateCreationThunk.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ForwardDelegateCreationThunk.Sorting.cs
index 7bdbbadd0d00fc..66d5142caa2878 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ForwardDelegateCreationThunk.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ForwardDelegateCreationThunk.Sorting.cs
@@ -8,9 +8,9 @@ namespace Internal.IL.Stubs
// Functionality related to deterministic ordering of types
partial class ForwardDelegateCreationThunk
{
- protected internal override int ClassCode => 1026039617;
+ protected override int ClassCode => 1026039617;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (ForwardDelegateCreationThunk)other;
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ForwardDelegateCreationThunk.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ForwardDelegateCreationThunk.cs
index e93d385a0ffcf6..fd1e907f844031 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ForwardDelegateCreationThunk.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ForwardDelegateCreationThunk.cs
@@ -75,6 +75,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "ForwardDelegateCreationStub__" + DelegateType.DiagnosticName;
+ }
+ }
+
///
/// This thunk creates a delegate from a native function pointer
/// by first creating a PInvokeDelegateWrapper from the function pointer
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/MethodBaseGetCurrentMethodThunk.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/MethodBaseGetCurrentMethodThunk.cs
index d75feac0fe9bdc..82a729dc3eb2db 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/MethodBaseGetCurrentMethodThunk.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/MethodBaseGetCurrentMethodThunk.cs
@@ -44,6 +44,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return Method.DiagnosticName;
+ }
+ }
+
public override TypeDesc OwningType
{
get
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/PInvokeLazyFixupField.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/PInvokeLazyFixupField.Sorting.cs
index edfccf89890e67..d3156fbefb2cf4 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/PInvokeLazyFixupField.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/PInvokeLazyFixupField.Sorting.cs
@@ -7,9 +7,9 @@ namespace Internal.IL.Stubs
{
partial class PInvokeLazyFixupField
{
- protected internal override int ClassCode => -1784477702;
+ protected override int ClassCode => -1784477702;
- protected internal override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer)
{
return comparer.Compare(_targetMethod, ((PInvokeLazyFixupField)other)._targetMethod);
}
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/StructMarshallingThunk.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/StructMarshallingThunk.Sorting.cs
index f2eee55f961086..0cbb4f7e7c6c38 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/StructMarshallingThunk.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/StructMarshallingThunk.Sorting.cs
@@ -8,9 +8,9 @@ namespace Internal.IL.Stubs
// Functionality related to deterministic ordering of types
partial class StructMarshallingThunk
{
- protected internal override int ClassCode => 340834018;
+ protected override int ClassCode => 340834018;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (StructMarshallingThunk)other;
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/StructMarshallingThunk.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/StructMarshallingThunk.cs
index cf346c06852173..2751290f0c91ef 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/StructMarshallingThunk.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/StructMarshallingThunk.cs
@@ -126,6 +126,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return NamePrefix + "__" + ManagedType.DiagnosticName;
+ }
+ }
+
private Marshaller[] InitializeMarshallers()
{
Debug.Assert(_interopStateManager != null);
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/TypeGetTypeMethodThunk.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/TypeGetTypeMethodThunk.cs
index be09098c5dab6a..b1a32586bef3f5 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/TypeGetTypeMethodThunk.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/TypeGetTypeMethodThunk.cs
@@ -41,6 +41,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return $"{_helperMethod.DiagnosticName}_{Signature.Length}_{DefaultAssemblyName}";
+ }
+ }
+
public override TypeDesc OwningType
{
get;
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ValueTypeGetFieldHelperMethodOverride.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ValueTypeGetFieldHelperMethodOverride.Sorting.cs
index 882a4419e2e242..e12b3bc41567f9 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ValueTypeGetFieldHelperMethodOverride.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ValueTypeGetFieldHelperMethodOverride.Sorting.cs
@@ -7,9 +7,9 @@ namespace Internal.IL.Stubs
{
partial class ValueTypeGetFieldHelperMethodOverride
{
- protected internal override int ClassCode => 2036839816;
+ protected override int ClassCode => 2036839816;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (ValueTypeGetFieldHelperMethodOverride)other;
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ValueTypeGetFieldHelperMethodOverride.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ValueTypeGetFieldHelperMethodOverride.cs
index a324de7bb222be..a5cfa2db42e5ec 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ValueTypeGetFieldHelperMethodOverride.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ValueTypeGetFieldHelperMethodOverride.cs
@@ -149,5 +149,13 @@ public override string Name
return "__GetFieldHelper";
}
}
+
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "__GetFieldHelper";
+ }
+ }
}
}
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/InlineArrayType.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/InlineArrayType.Sorting.cs
index 2bcee373962bea..c8655241711389 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/InlineArrayType.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/InlineArrayType.Sorting.cs
@@ -6,9 +6,9 @@ namespace Internal.TypeSystem.Interop
// Functionality related to determinstic ordering of types
partial class InlineArrayType
{
- protected internal override int ClassCode => 226817075;
+ protected override int ClassCode => 226817075;
- protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
{
var otherType = (InlineArrayType)other;
int result = (int)Length - (int)otherType.Length;
@@ -20,9 +20,9 @@ protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer
partial class InlineArrayMethod
{
- protected internal override int ClassCode => -1303220581;
+ protected override int ClassCode => -1303220581;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (InlineArrayMethod)other;
@@ -30,19 +30,19 @@ protected internal override int CompareToImpl(MethodDesc other, TypeSystemCompar
if (result != 0)
return result;
- return comparer.CompareWithinClass(OwningType, otherMethod.OwningType);
+ return comparer.Compare(OwningType, otherMethod.OwningType);
}
}
partial class InlineArrayField
{
- protected internal override int ClassCode => 1542668652;
+ protected override int ClassCode => 1542668652;
- protected internal override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer)
{
var otherField = (InlineArrayField)other;
- return comparer.CompareWithinClass(OwningType, otherField.OwningType);
+ return comparer.Compare(OwningType, otherField.OwningType);
}
}
}
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/InlineArrayType.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/InlineArrayType.cs
index 6462c6ee2c59c7..4cf06e8b6bfb4f 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/InlineArrayType.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/InlineArrayType.cs
@@ -35,6 +35,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "_InlineArray__" + ElementType.DiagnosticName + "__" + Length;
+ }
+ }
+
public override string Namespace
{
get
@@ -43,6 +51,14 @@ public override string Namespace
}
}
+ public override string DiagnosticNamespace
+ {
+ get
+ {
+ return Namespace;
+ }
+ }
+
public override Instantiation Instantiation
{
get
@@ -320,6 +336,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return Name;
+ }
+ }
+
public override MethodSignature Signature
{
get
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.cs
index a736d065dd8332..f23a4479634a99 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.cs
@@ -521,7 +521,7 @@ internal static MarshallerKind GetMarshallerKind(
else
return MarshallerKind.Invalid;
}
- else if (type.IsDelegate)
+ else if (type.IsDelegate || InteropTypes.IsSystemDelegate(context, type) || InteropTypes.IsSystemMulticastDelegate(context, type))
{
if (type.HasInstantiation)
{
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs
index 40e316e2834288..ea0494643a14a5 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs
@@ -11,65 +11,12 @@
namespace Internal.TypeSystem.Interop
{
- enum MarshallerKind
- {
- Unknown,
- BlittableValue,
- Array,
- BlittableArray,
- Bool, // 4 byte bool
- CBool, // 1 byte bool
- VariantBool, // Variant bool
- Enum,
- AnsiChar, // Marshal char (Unicode 16bits) for byte (Ansi 8bits)
- UnicodeChar,
- AnsiCharArray,
- ByValArray,
- ByValAnsiCharArray, // Particular case of ByValArray because the conversion between wide Char and Byte need special treatment.
- AnsiString,
- UnicodeString,
- UTF8String,
- AnsiBSTRString,
- BSTRString,
- ByValAnsiString,
- ByValUnicodeString,
- AnsiStringBuilder,
- UnicodeStringBuilder,
- FunctionPointer,
- SafeHandle,
- CriticalHandle,
- HandleRef,
- VoidReturn,
- Variant,
- Object,
- OleDateTime,
- Decimal,
- OleCurrency,
- Guid,
- Struct,
- BlittableStruct,
- BlittableStructPtr, // Additional indirection on top of blittable struct. Used by MarshalAs(LpStruct)
- LayoutClass,
- LayoutClassPtr,
- AsAnyA,
- AsAnyW,
- ComInterface,
- BlittableValueClassWithCopyCtor,
- Invalid
- }
public enum MarshalDirection
{
Forward, // safe-to-unsafe / managed-to-native
Reverse, // unsafe-to-safe / native-to-managed
}
- public enum MarshallerType
- {
- Argument,
- Element,
- Field
- }
-
// Each type of marshaller knows how to generate the marshalling code for the argument it marshals.
// Marshallers contain method related marshalling information (which is common to all the Marshallers)
// and also argument specific marshalling informaiton
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshallerKind.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshallerKind.cs
new file mode 100644
index 00000000000000..37d09857b694ad
--- /dev/null
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshallerKind.cs
@@ -0,0 +1,59 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+namespace Internal.TypeSystem.Interop
+{
+ enum MarshallerKind
+ {
+ Unknown,
+ BlittableValue,
+ Array,
+ BlittableArray,
+ Bool, // 4 byte bool
+ CBool, // 1 byte bool
+ VariantBool, // Variant bool
+ Enum,
+ AnsiChar, // Marshal char (Unicode 16bits) for byte (Ansi 8bits)
+ UnicodeChar,
+ AnsiCharArray,
+ ByValArray,
+ ByValAnsiCharArray, // Particular case of ByValArray because the conversion between wide Char and Byte need special treatment.
+ AnsiString,
+ UnicodeString,
+ UTF8String,
+ AnsiBSTRString,
+ BSTRString,
+ ByValAnsiString,
+ ByValUnicodeString,
+ AnsiStringBuilder,
+ UnicodeStringBuilder,
+ FunctionPointer,
+ SafeHandle,
+ CriticalHandle,
+ HandleRef,
+ VoidReturn,
+ Variant,
+ Object,
+ OleDateTime,
+ Decimal,
+ OleCurrency,
+ Guid,
+ Struct,
+ BlittableStruct,
+ BlittableStructPtr, // Additional indirection on top of blittable struct. Used by MarshalAs(LpStruct)
+ LayoutClass,
+ LayoutClassPtr,
+ AsAnyA,
+ AsAnyW,
+ ComInterface,
+ BlittableValueClassWithCopyCtor,
+ Invalid
+ }
+
+ public enum MarshallerType
+ {
+ Argument,
+ Element,
+ Field
+ }
+}
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/NativeStructType.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/NativeStructType.Sorting.cs
index 0da2d42007d56b..bcd97084e56718 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/NativeStructType.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/NativeStructType.Sorting.cs
@@ -6,18 +6,18 @@ namespace Internal.TypeSystem.Interop
// Functionality related to determinstic ordering of types
partial class NativeStructType
{
- protected internal override int ClassCode => -377751537;
+ protected override int ClassCode => -377751537;
- protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
{
return comparer.Compare(ManagedStructType, ((NativeStructType)other).ManagedStructType);
}
partial class NativeStructField
{
- protected internal override int ClassCode => 1580219745;
+ protected override int ClassCode => 1580219745;
- protected internal override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer)
{
return comparer.Compare(_managedField, ((NativeStructField)other)._managedField);
}
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/NativeStructType.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/NativeStructType.cs
index d20d6fafcc0dc9..bf5e0c6ef3d7ba 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/NativeStructType.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/NativeStructType.cs
@@ -28,6 +28,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "__NativeType__" + ManagedStructType.DiagnosticName;
+ }
+ }
+
public override string Namespace
{
get
@@ -36,6 +44,14 @@ public override string Namespace
}
}
+ public override string DiagnosticNamespace
+ {
+ get
+ {
+ return "Internal.CompilerGenerated";
+ }
+ }
+
public override PInvokeStringFormat PInvokeStringFormat
{
get
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapper.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapper.Sorting.cs
index 6b4f6b9ca06206..72948268466607 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapper.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapper.Sorting.cs
@@ -6,9 +6,9 @@ namespace Internal.TypeSystem.Interop
// Functionality related to determinstic ordering of types
partial class PInvokeDelegateWrapper
{
- protected internal override int ClassCode => -262930217;
+ protected override int ClassCode => -262930217;
- protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
{
return comparer.Compare(DelegateType, ((PInvokeDelegateWrapper)other).DelegateType);
}
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapper.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapper.cs
index 78cbe796e397f1..dcc2fbff41c065 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapper.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapper.cs
@@ -35,6 +35,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "PInvokeDelegateWrapper__" + DelegateType.DiagnosticName;
+ }
+ }
+
public override string Namespace
{
get
@@ -43,6 +51,14 @@ public override string Namespace
}
}
+ public override string DiagnosticNamespace
+ {
+ get
+ {
+ return "Internal.CompilerGenerated";
+ }
+ }
+
public override bool IsExplicitLayout
{
get
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapperConstructor.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapperConstructor.Sorting.cs
index 2509b265ea71e8..5fe9290213b2f6 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapperConstructor.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapperConstructor.Sorting.cs
@@ -6,9 +6,9 @@ namespace Internal.TypeSystem.Interop
// Functionality related to deterministic ordering of methods
partial class PInvokeDelegateWrapperConstructor
{
- protected internal override int ClassCode => 1000342011;
+ protected override int ClassCode => 1000342011;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var owningType = (PInvokeDelegateWrapper)OwningType;
var otherOwningType = (PInvokeDelegateWrapper)other.OwningType;
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapperConstructor.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapperConstructor.cs
index 6917c71f656e42..2e138f6098c7ff 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapperConstructor.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapperConstructor.cs
@@ -33,6 +33,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return ".ctor";
+ }
+ }
+
private MethodSignature _signature;
public override MethodSignature Signature
{
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/InteropTypes.cs b/src/coreclr/tools/Common/TypeSystem/Interop/InteropTypes.cs
index 4007dc756494ee..96ffe8868422d1 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/InteropTypes.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/InteropTypes.cs
@@ -97,6 +97,16 @@ public static bool IsSystemDecimal(TypeSystemContext context, TypeDesc type)
return IsCoreNamedType(context, type, "System", "Decimal");
}
+ public static bool IsSystemDelegate(TypeSystemContext context, TypeDesc type)
+ {
+ return IsCoreNamedType(context, type, "System", "Delegate");
+ }
+
+ public static bool IsSystemMulticastDelegate(TypeSystemContext context, TypeDesc type)
+ {
+ return IsCoreNamedType(context, type, "System", "MulticastDelegate");
+ }
+
public static bool IsSystemGuid(TypeSystemContext context, TypeDesc type)
{
return IsCoreNamedType(context, type, "System", "Guid");
diff --git a/src/coreclr/tools/GenClrDebugResource/GenClrDebugResource.cpp b/src/coreclr/tools/GenClrDebugResource/GenClrDebugResource.cpp
index bc8c6fd978370a..ded0cee406deb4 100644
--- a/src/coreclr/tools/GenClrDebugResource/GenClrDebugResource.cpp
+++ b/src/coreclr/tools/GenClrDebugResource/GenClrDebugResource.cpp
@@ -28,7 +28,7 @@ struct ClrDebugResource
};
BOOL
-GetBinFileData(__in_z char* binFileName, DWORD* pTimeStamp, DWORD* pSizeOfImage)
+GetBinFileData(_In_z_ char* binFileName, DWORD* pTimeStamp, DWORD* pSizeOfImage)
{
HANDLE binFileHandle;
DWORD peHeaderOffset;
@@ -111,7 +111,7 @@ Usage(void)
}
void __cdecl
-main(int argc, __in_z char** argv)
+main(int argc, _In_z_ char** argv)
{
char* outFile = NULL;
char* dacFile = NULL;
diff --git a/src/coreclr/tools/ILVerification/ILVerification.csproj b/src/coreclr/tools/ILVerification/ILVerification.csproj
index a7d028326cfc9f..a7d00d9f304730 100644
--- a/src/coreclr/tools/ILVerification/ILVerification.csproj
+++ b/src/coreclr/tools/ILVerification/ILVerification.csproj
@@ -8,6 +8,8 @@
false
netstandard2.0
AnyCPU
+ true
+ Open
diff --git a/src/coreclr/tools/ILVerification/TypeVerifier.cs b/src/coreclr/tools/ILVerification/TypeVerifier.cs
index 9c760c8dd733fb..94672533bdd21f 100644
--- a/src/coreclr/tools/ILVerification/TypeVerifier.cs
+++ b/src/coreclr/tools/ILVerification/TypeVerifier.cs
@@ -99,7 +99,11 @@ public void VerifyInterfaces()
continue;
}
- MethodDesc resolvedMethod = type.ResolveInterfaceMethodTarget(method);
+ if (type.ResolveInterfaceMethodTarget(method) is not MethodDesc resolvedMethod)
+ {
+ type.ResolveInterfaceMethodToDefaultImplementationOnType(method, out resolvedMethod);
+ }
+
if (resolvedMethod is null)
{
VerificationError(VerifierError.InterfaceMethodNotImplemented, Format(type), Format(implementedInterface.InterfaceType, _module, implementedInterface.InterfaceImplementation), Format(method));
diff --git a/src/coreclr/tools/InjectResource/InjectResource.cpp b/src/coreclr/tools/InjectResource/InjectResource.cpp
index 61f49f5d3c7301..cf5c3917df9d2c 100644
--- a/src/coreclr/tools/InjectResource/InjectResource.cpp
+++ b/src/coreclr/tools/InjectResource/InjectResource.cpp
@@ -12,8 +12,8 @@ char* g_appName;
#define MAX(x,y) ((x) > (y) ? (x) : (y))
void
-AddBinaryResourceToDll(__in_z char* dllName,
- __in_z const char* resName,
+AddBinaryResourceToDll(_In_z_ char* dllName,
+ _In_z_ const char* resName,
PVOID resData,
ULONG resDataSize)
{
@@ -59,7 +59,7 @@ AddBinaryResourceToDll(__in_z char* dllName,
}
void
-GetBinFileData(__in_z char* binFileName, PVOID* binData, PULONG binDataSize)
+GetBinFileData(_In_z_ char* binFileName, PVOID* binData, PULONG binDataSize)
{
HANDLE binFileHandle;
PVOID data;
@@ -108,7 +108,7 @@ Usage(void)
}
void __cdecl
-main(int argc, __in_z char** argv)
+main(int argc, _In_z_ char** argv)
{
char* binFile = NULL;
char* dllFile = NULL;
diff --git a/src/coreclr/ToolBox/SOS/CMakeLists.txt b/src/coreclr/tools/SOS/CMakeLists.txt
similarity index 100%
rename from src/coreclr/ToolBox/SOS/CMakeLists.txt
rename to src/coreclr/tools/SOS/CMakeLists.txt
diff --git a/src/coreclr/ToolBox/SOS/DIALib/DIALib.il b/src/coreclr/tools/SOS/DIALib/DIALib.il
similarity index 100%
rename from src/coreclr/ToolBox/SOS/DIALib/DIALib.il
rename to src/coreclr/tools/SOS/DIALib/DIALib.il
diff --git a/src/coreclr/ToolBox/SOS/DIALib/DIALib.ilproj b/src/coreclr/tools/SOS/DIALib/DIALib.ilproj
similarity index 100%
rename from src/coreclr/ToolBox/SOS/DIALib/DIALib.ilproj
rename to src/coreclr/tools/SOS/DIALib/DIALib.ilproj
diff --git a/src/coreclr/ToolBox/SOS/DacTableGen/DacTableGen.csproj b/src/coreclr/tools/SOS/DacTableGen/DacTableGen.csproj
similarity index 100%
rename from src/coreclr/ToolBox/SOS/DacTableGen/DacTableGen.csproj
rename to src/coreclr/tools/SOS/DacTableGen/DacTableGen.csproj
diff --git a/src/coreclr/ToolBox/SOS/DacTableGen/MapSymbolProvider.cs b/src/coreclr/tools/SOS/DacTableGen/MapSymbolProvider.cs
similarity index 100%
rename from src/coreclr/ToolBox/SOS/DacTableGen/MapSymbolProvider.cs
rename to src/coreclr/tools/SOS/DacTableGen/MapSymbolProvider.cs
diff --git a/src/coreclr/ToolBox/SOS/DacTableGen/cvconst.cs b/src/coreclr/tools/SOS/DacTableGen/cvconst.cs
similarity index 100%
rename from src/coreclr/ToolBox/SOS/DacTableGen/cvconst.cs
rename to src/coreclr/tools/SOS/DacTableGen/cvconst.cs
diff --git a/src/coreclr/ToolBox/SOS/DacTableGen/diautil.cs b/src/coreclr/tools/SOS/DacTableGen/diautil.cs
similarity index 99%
rename from src/coreclr/ToolBox/SOS/DacTableGen/diautil.cs
rename to src/coreclr/tools/SOS/DacTableGen/diautil.cs
index 8da9217b477bc0..28af4119833668 100644
--- a/src/coreclr/ToolBox/SOS/DacTableGen/diautil.cs
+++ b/src/coreclr/tools/SOS/DacTableGen/diautil.cs
@@ -619,7 +619,7 @@ private String GetTypeString(IDiaSymbol s)
else if (tag == SymTagEnum.SymTagBaseType)
{
BasicType bt = (BasicType) s.baseType;
- str.AppendFormat("(base type={0}, len={1:d})", bt.ToString(), s.length);
+ str.Append($"(base type={bt}, len={s.length:d})");
}
else if (tag == SymTagEnum.SymTagArrayType)
{
@@ -677,7 +677,7 @@ private String GetTypeString(IDiaSymbol s)
try
{
succ = true;
- str.AppendFormat("[{0:d}]", s.length/s.type.length );
+ str.Append($"[{s.length/s.type.length:d}]");
}
catch (Exception)
{
diff --git a/src/coreclr/ToolBox/SOS/DacTableGen/main.cs b/src/coreclr/tools/SOS/DacTableGen/main.cs
similarity index 100%
rename from src/coreclr/ToolBox/SOS/DacTableGen/main.cs
rename to src/coreclr/tools/SOS/DacTableGen/main.cs
diff --git a/src/coreclr/ToolBox/SOS/Directory.Build.props b/src/coreclr/tools/SOS/Directory.Build.props
similarity index 100%
rename from src/coreclr/ToolBox/SOS/Directory.Build.props
rename to src/coreclr/tools/SOS/Directory.Build.props
diff --git a/src/coreclr/ToolBox/SOS/SOS_README.md b/src/coreclr/tools/SOS/SOS_README.md
similarity index 100%
rename from src/coreclr/ToolBox/SOS/SOS_README.md
rename to src/coreclr/tools/SOS/SOS_README.md
diff --git a/src/coreclr/tools/StressLogAnalyzer/StressLogDump.cpp b/src/coreclr/tools/StressLogAnalyzer/StressLogDump.cpp
index a0e8c877be52f2..f7f22d310c1b33 100644
--- a/src/coreclr/tools/StressLogAnalyzer/StressLogDump.cpp
+++ b/src/coreclr/tools/StressLogAnalyzer/StressLogDump.cpp
@@ -39,7 +39,7 @@ void GcHistAddLog(LPCSTR msg, StressMsg* stressMsg);
/*********************************************************************************/
-static const WCHAR* getTime(const FILETIME* time, __out_ecount (buffLen) WCHAR* buff, int buffLen)
+static const WCHAR* getTime(const FILETIME* time, _Out_writes_ (buffLen) WCHAR* buff, int buffLen)
{
SYSTEMTIME systemTime;
static const WCHAR badTime[] = W("BAD TIME");
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilationBuilder.Aot.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilationBuilder.Aot.cs
index 25cd0bc9b85a6b..fb4ad5ce51b7f6 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilationBuilder.Aot.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilationBuilder.Aot.cs
@@ -22,7 +22,6 @@ partial class CompilationBuilder
protected MethodImportationErrorProvider _methodImportationErrorProvider = new MethodImportationErrorProvider();
protected IInliningPolicy _inliningPolicy;
protected bool _methodBodyFolding;
- protected bool _singleThreaded;
protected InstructionSetSupport _instructionSetSupport;
protected SecurityMitigationOptions _mitigationOptions;
@@ -92,12 +91,6 @@ public CompilationBuilder UseMethodBodyFolding(bool enable)
return this;
}
- public CompilationBuilder UseSingleThread(bool enable)
- {
- _singleThreaded = enable;
- return this;
- }
-
public CompilationBuilder UsePreinitializationManager(PreinitializationManager manager)
{
_preinitializationManager = manager;
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.Aot.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.Aot.cs
index 33305d2011c876..66e6044d418a1f 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.Aot.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.Aot.cs
@@ -14,12 +14,21 @@ namespace ILCompiler
{
partial class CompilerTypeSystemContext
{
+ // Chosen rather arbitrarily. For the app that I was looking at, cutoff point of 7 compiled
+ // more than 10 minutes on a release build of the compiler, and I lost patience.
+ // Cutoff point of 5 produced an 1.7 GB object file.
+ // Cutoff point of 4 produced an 830 MB object file.
+ // Cutoff point of 3 produced an 470 MB object file.
+ // We want this to be high enough so that it doesn't cut off too early. But also not too
+ // high because things that are recursive often end up expanding laterally as well
+ // through various other generic code the deep code calls into.
+ public const int DefaultGenericCycleCutoffPoint = 4;
+
public SharedGenericsConfiguration GenericsConfig
{
get;
}
- private readonly DelegateFeature _delegateFeatures;
private readonly MetadataFieldLayoutAlgorithm _metadataFieldLayoutAlgorithm = new CompilerMetadataFieldLayoutAlgorithm();
private readonly RuntimeDeterminedFieldLayoutAlgorithm _runtimeDeterminedFieldLayoutAlgorithm = new RuntimeDeterminedFieldLayoutAlgorithm();
private readonly VectorOfTFieldLayoutAlgorithm _vectorOfTFieldLayoutAlgorithm;
@@ -29,7 +38,7 @@ public SharedGenericsConfiguration GenericsConfig
private ArrayOfTRuntimeInterfacesAlgorithm _arrayOfTRuntimeInterfacesAlgorithm;
private MetadataType _arrayOfTType;
- public CompilerTypeSystemContext(TargetDetails details, SharedGenericsMode genericsMode, DelegateFeature delegateFeatures)
+ public CompilerTypeSystemContext(TargetDetails details, SharedGenericsMode genericsMode, DelegateFeature delegateFeatures, int genericCycleCutoffPoint = DefaultGenericCycleCutoffPoint)
: base(details)
{
_genericsMode = genericsMode;
@@ -37,7 +46,9 @@ public CompilerTypeSystemContext(TargetDetails details, SharedGenericsMode gener
_vectorOfTFieldLayoutAlgorithm = new VectorOfTFieldLayoutAlgorithm(_metadataFieldLayoutAlgorithm);
_vectorFieldLayoutAlgorithm = new VectorFieldLayoutAlgorithm(_metadataFieldLayoutAlgorithm);
- _delegateFeatures = delegateFeatures;
+ _delegateInfoHashtable = new DelegateInfoHashtable(delegateFeatures);
+
+ _genericCycleDetector = new LazyGenericsSupport.GenericCycleDetector(genericCycleCutoffPoint);
GenericsConfig = new SharedGenericsConfiguration();
}
@@ -165,11 +176,6 @@ protected virtual IEnumerable GetAllMethodsForDelegate(TypeDesc type
yield return m;
}
- protected override DelegateInfo CreateDelegateInfo(TypeDesc delegateType)
- {
- return new DelegateInfo(delegateType, _delegateFeatures);
- }
-
internal DefType GetClosestDefType(TypeDesc type)
{
if (type.IsArray)
@@ -187,7 +193,7 @@ internal DefType GetClosestDefType(TypeDesc type)
return (DefType)type;
}
- private readonly LazyGenericsSupport.GenericCycleDetector _genericCycleDetector = new LazyGenericsSupport.GenericCycleDetector();
+ private readonly LazyGenericsSupport.GenericCycleDetector _genericCycleDetector;
public void DetectGenericCycles(TypeSystemEntity owner, TypeSystemEntity referent)
{
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.BoxedTypes.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.BoxedTypes.cs
index 8be62c3d9950db..39a6bf3490beb0 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.BoxedTypes.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.BoxedTypes.cs
@@ -259,7 +259,8 @@ private partial class BoxedValueType : MetadataType, INonEmittableType
public override string Name => "Boxed_" + ValueTypeRepresented.Name;
public override string Namespace => ValueTypeRepresented.Namespace;
-
+ public override string DiagnosticName => "Boxed_" + ValueTypeRepresented.DiagnosticName;
+ public override string DiagnosticNamespace => ValueTypeRepresented.DiagnosticNamespace;
public override Instantiation Instantiation => ValueTypeRepresented.Instantiation;
public override PInvokeStringFormat PInvokeStringFormat => PInvokeStringFormat.AutoClass;
public override bool IsExplicitLayout => false;
@@ -411,6 +412,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return _targetMethod.DiagnosticName + "_Unbox";
+ }
+ }
+
public override MethodIL EmitIL()
{
if (_owningType.ValueTypeRepresented.IsByRefLike)
@@ -487,6 +496,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return _targetMethod.DiagnosticName + "_Unbox";
+ }
+ }
+
public override MethodIL EmitIL()
{
if (_owningType.ValueTypeRepresented.IsByRefLike)
@@ -574,6 +591,7 @@ public ValueTypeInstanceMethodWithHiddenParameter(MethodDesc methodRepresented)
public override TypeDesc OwningType => _methodRepresented.OwningType;
public override string Name => _methodRepresented.Name;
+ public override string DiagnosticName => _methodRepresented.DiagnosticName;
public override MethodSignature Signature
{
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.DelegateInfo.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.DelegateInfo.cs
similarity index 67%
rename from src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.DelegateInfo.cs
rename to src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.DelegateInfo.cs
index b9a3a3e1fdbbb2..a021e39691d226 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.DelegateInfo.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.DelegateInfo.cs
@@ -4,13 +4,19 @@
using System;
using Internal.IL;
+using Internal.TypeSystem;
-namespace Internal.TypeSystem
+namespace ILCompiler
{
- public abstract partial class TypeSystemContext
+ partial class CompilerTypeSystemContext
{
private class DelegateInfoHashtable : LockFreeReaderHashtable
{
+ private readonly DelegateFeature _delegateFeatures;
+
+ public DelegateInfoHashtable(DelegateFeature features)
+ => _delegateFeatures = features;
+
protected override int GetKeyHashCode(TypeDesc key)
{
return key.GetHashCode();
@@ -29,24 +35,15 @@ protected override bool CompareValueToValue(DelegateInfo value1, DelegateInfo va
}
protected override DelegateInfo CreateValueFromKey(TypeDesc key)
{
- return key.Context.CreateDelegateInfo(key);
+ return new DelegateInfo(key, _delegateFeatures);
}
}
- private DelegateInfoHashtable _delegateInfoHashtable = new DelegateInfoHashtable();
+ private readonly DelegateInfoHashtable _delegateInfoHashtable;
public DelegateInfo GetDelegateInfo(TypeDesc delegateType)
{
return _delegateInfoHashtable.GetOrCreateValue(delegateType);
}
-
- ///
- /// Creates a for a given delegate type.
- ///
- protected virtual DelegateInfo CreateDelegateInfo(TypeDesc key)
- {
- // Type system contexts that support creating delegate infos need to override.
- throw new NotSupportedException();
- }
}
}
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.DynamicInvoke.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.DynamicInvoke.cs
similarity index 85%
rename from src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.DynamicInvoke.cs
rename to src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.DynamicInvoke.cs
index 290f11dd90a508..0ed3d107b3a396 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.DynamicInvoke.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.DynamicInvoke.cs
@@ -2,12 +2,13 @@
// The .NET Foundation licenses this file to you under the MIT license.
using Internal.IL.Stubs;
+using Internal.TypeSystem;
using Debug = System.Diagnostics.Debug;
-namespace Internal.TypeSystem
+namespace ILCompiler
{
- partial class TypeSystemContext
+ partial class CompilerTypeSystemContext
{
private class DynamicInvokeThunkHashtable : LockFreeReaderHashtable
{
@@ -17,7 +18,7 @@ private class DynamicInvokeThunkHashtable : LockFreeReaderHashtable value.TargetSignature.GetHashCode();
protected override DynamicInvokeMethodThunk CreateValueFromKey(DynamicInvokeMethodSignature key)
{
- return new DynamicInvokeMethodThunk(key.Context.GeneratedAssembly.GetGlobalModuleType(), key);
+ return new DynamicInvokeMethodThunk(((CompilerTypeSystemContext)key.Context).GeneratedAssembly.GetGlobalModuleType(), key);
}
}
DynamicInvokeThunkHashtable _dynamicInvokeThunks = new DynamicInvokeThunkHashtable();
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.EnumMethods.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.EnumMethods.cs
similarity index 97%
rename from src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.EnumMethods.cs
rename to src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.EnumMethods.cs
index 0be009f53c7bb3..b777e28a2d144e 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.EnumMethods.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.EnumMethods.cs
@@ -3,13 +3,14 @@
using System.Collections.Generic;
+using Internal.TypeSystem;
using Internal.IL.Stubs;
using Debug = System.Diagnostics.Debug;
-namespace Internal.TypeSystem
+namespace ILCompiler
{
- public abstract partial class TypeSystemContext
+ partial class CompilerTypeSystemContext
{
private class EnumInfo
{
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.GeneratedAssembly.Sorting.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.GeneratedAssembly.Sorting.cs
similarity index 64%
rename from src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.GeneratedAssembly.Sorting.cs
rename to src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.GeneratedAssembly.Sorting.cs
index a2490a4cb196e7..41254150763cf9 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.GeneratedAssembly.Sorting.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.GeneratedAssembly.Sorting.cs
@@ -3,16 +3,18 @@
using System;
-namespace Internal.TypeSystem
+using Internal.TypeSystem;
+
+namespace ILCompiler
{
- partial class TypeSystemContext
+ partial class CompilerTypeSystemContext
{
// Functionality related to determinstic ordering of types and members
partial class CompilerGeneratedType : MetadataType
{
- protected internal override int ClassCode => -1036681447;
+ protected override int ClassCode => -1036681447;
- protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
{
// Should be a singleton
throw new NotSupportedException();
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.GeneratedAssembly.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.GeneratedAssembly.cs
similarity index 94%
rename from src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.GeneratedAssembly.cs
rename to src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.GeneratedAssembly.cs
index a01beba3cea869..280f2d85684a3b 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.GeneratedAssembly.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.GeneratedAssembly.cs
@@ -4,14 +4,16 @@
using System;
using System.Collections.Generic;
+using Internal.TypeSystem;
+
using TypeHashingAlgorithms = Internal.NativeFormat.TypeHashingAlgorithms;
using Interlocked = System.Threading.Interlocked;
using AssemblyName = System.Reflection.AssemblyName;
using Debug = System.Diagnostics.Debug;
-namespace Internal.TypeSystem
+namespace ILCompiler
{
- partial class TypeSystemContext
+ partial class CompilerTypeSystemContext
{
private ModuleDesc _generatedAssembly;
@@ -89,6 +91,14 @@ public override string Name
get;
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return Name;
+ }
+ }
+
public override string Namespace
{
get
@@ -97,6 +107,14 @@ public override string Namespace
}
}
+ public override string DiagnosticNamespace
+ {
+ get
+ {
+ return "Internal.CompilerGenerated";
+ }
+ }
+
public override int GetHashCode()
{
if (_hashcode != 0)
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.IntefaceThunks.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.IntefaceThunks.cs
index ad558ae43bf51b..adc509298c0bbc 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.IntefaceThunks.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.IntefaceThunks.cs
@@ -149,7 +149,7 @@ protected override bool CompareValueToValue(DefaultInterfaceMethodImplementation
}
protected override DefaultInterfaceMethodImplementationInstantiationThunk CreateValueFromKey(DefaultInterfaceMethodImplementationInstantiationThunkHashtableKey key)
{
- TypeDesc owningTypeOfThunks = key.TargetMethod.Context.GeneratedAssembly.GetGlobalModuleType();
+ TypeDesc owningTypeOfThunks = ((CompilerTypeSystemContext)key.TargetMethod.Context).GeneratedAssembly.GetGlobalModuleType();
return new DefaultInterfaceMethodImplementationInstantiationThunk(owningTypeOfThunks, key.TargetMethod, key.InterfaceIndex);
}
}
@@ -194,6 +194,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return _targetMethod.DiagnosticName;
+ }
+ }
+
public MethodDesc BaseMethod => _targetMethod;
public string Prefix => $"__InstantiatingStub_{_interfaceIndex}_";
@@ -274,6 +282,7 @@ public DefaultInterfaceMethodImplementationWithHiddenParameter(MethodDesc method
public override TypeDesc OwningType => _owningType;
public override string Name => _methodRepresented.Name;
+ public override string DiagnosticName => _methodRepresented.DiagnosticName;
public override MethodSignature Signature
{
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.ValueTypeMethods.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.ValueTypeMethods.cs
similarity index 97%
rename from src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.ValueTypeMethods.cs
rename to src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.ValueTypeMethods.cs
index f44bf4b11cf8e2..738b43554182c8 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.ValueTypeMethods.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.ValueTypeMethods.cs
@@ -3,13 +3,14 @@
using System.Collections.Generic;
+using Internal.TypeSystem;
using Internal.IL.Stubs;
using Debug = System.Diagnostics.Debug;
-namespace Internal.TypeSystem
+namespace ILCompiler
{
- public abstract partial class TypeSystemContext
+ partial class CompilerTypeSystemContext
{
private MethodDesc _objectEqualsMethod;
@@ -154,7 +155,7 @@ private bool ComputeCanCompareValueTypeBits(MetadataType type)
// Would be a suprise if this wasn't a valuetype. We checked ContainsGCPointers above.
Debug.Assert(fieldType.IsValueType);
- MethodDesc objectEqualsMethod = fieldType.Context._objectEqualsMethod;
+ MethodDesc objectEqualsMethod = ((CompilerTypeSystemContext)fieldType.Context)._objectEqualsMethod;
// If the field overrides Equals, we can't use the fast helper because we need to call the method.
if (fieldType.FindVirtualFunctionTargetMethodOnObjectType(objectEqualsMethod).OwningType == fieldType)
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMethodBodyScanner.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMethodBodyScanner.cs
index 981983750de052..06d371cd17aea0 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMethodBodyScanner.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMethodBodyScanner.cs
@@ -2199,7 +2199,9 @@ public override bool HandleCall(MethodIL callingMethodBody, MethodDesc calledMet
if (comDangerousMethod)
{
reflectionContext.AnalyzingPattern();
- reflectionContext.RecordUnrecognizedPattern(2050, $"P/invoke method '{calledMethod.GetDisplayName()}' declares a parameter with COM marshalling. Correctness of COM interop cannot be guaranteed after trimming. Interfaces and interface members might be removed.");
+ reflectionContext.RecordUnrecognizedPattern(
+ (int)DiagnosticId.CorrectnessOfCOMCannotBeGuaranteed,
+ new DiagnosticString(DiagnosticId.CorrectnessOfCOMCannotBeGuaranteed).GetMessage(DiagnosticUtilities.GetMethodSignatureDisplayName(calledMethod)));
}
}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DelegateCreationInfo.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DelegateCreationInfo.cs
index 0195f82d6c3692..dc6cd81fcccf5d 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DelegateCreationInfo.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DelegateCreationInfo.cs
@@ -161,7 +161,7 @@ private DelegateCreationInfo(IMethodNode constructor, MethodDesc targetMethod, T
///
public static DelegateCreationInfo Create(TypeDesc delegateType, MethodDesc targetMethod, NodeFactory factory, bool followVirtualDispatch)
{
- TypeSystemContext context = delegateType.Context;
+ CompilerTypeSystemContext context = factory.TypeSystemContext;
DefType systemDelegate = context.GetWellKnownType(WellKnownType.MulticastDelegate).BaseType;
int paramCountTargetMethod = targetMethod.Signature.Length;
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/CallingConventionConverterKey.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/CallingConventionConverterKey.cs
index 7c94539fb6bb42..40b7281dbba01b 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/CallingConventionConverterKey.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/CallingConventionConverterKey.cs
@@ -78,4 +78,156 @@ public static string GetName(this MethodSignature signature)
return nameBuilder.ToString();
}
}
+
+ public class UniqueTypeNameFormatter : TypeNameFormatter
+ {
+ public static UniqueTypeNameFormatter Instance { get; } = new UniqueTypeNameFormatter();
+
+ public override void AppendName(StringBuilder sb, PointerType type)
+ {
+ AppendName(sb, type.ParameterType);
+ sb.Append('*');
+ }
+
+ public override void AppendName(StringBuilder sb, GenericParameterDesc type)
+ {
+ string prefix = type.Kind == GenericParameterKind.Type ? "!" : "!!";
+ sb.Append(prefix);
+ sb.Append(type.Name);
+ }
+
+ public override void AppendName(StringBuilder sb, SignatureTypeVariable type)
+ {
+ sb.Append("!");
+ sb.Append(type.Index.ToStringInvariant());
+ }
+
+ public override void AppendName(StringBuilder sb, SignatureMethodVariable type)
+ {
+ sb.Append("!!");
+ sb.Append(type.Index.ToStringInvariant());
+ }
+
+ public override void AppendName(StringBuilder sb, FunctionPointerType type)
+ {
+ MethodSignature signature = type.Signature;
+
+ AppendName(sb, signature.ReturnType);
+
+ sb.Append(" (");
+ for (int i = 0; i < signature.Length; i++)
+ {
+ if (i > 0)
+ sb.Append(", ");
+ AppendName(sb, signature[i]);
+ }
+
+ // TODO: Append '...' for vararg methods
+
+ sb.Append(')');
+ }
+
+ public override void AppendName(StringBuilder sb, ByRefType type)
+ {
+ AppendName(sb, type.ParameterType);
+ sb.Append(" ByRef");
+ }
+
+ public override void AppendName(StringBuilder sb, ArrayType type)
+ {
+ AppendName(sb, type.ElementType);
+ sb.Append('[');
+
+ if (type.Rank == 1 && type.IsMdArray)
+ sb.Append('*');
+ sb.Append(',', type.Rank - 1);
+
+ sb.Append(']');
+ }
+
+ protected override void AppendNameForInstantiatedType(StringBuilder sb, DefType type)
+ {
+ AppendName(sb, type.GetTypeDefinition());
+ sb.Append('<');
+
+ for (int i = 0; i < type.Instantiation.Length; i++)
+ {
+ if (i > 0)
+ sb.Append(", ");
+ AppendName(sb, type.Instantiation[i]);
+ }
+
+ sb.Append('>');
+ }
+
+ protected override void AppendNameForNamespaceType(StringBuilder sb, DefType type)
+ {
+ string ns = GetTypeNamespace(type);
+ if (ns.Length > 0)
+ {
+ AppendEscapedIdentifier(sb, ns);
+ sb.Append('.');
+ }
+ AppendEscapedIdentifier(sb, GetTypeName(type));
+
+ if (type is MetadataType)
+ {
+ IAssemblyDesc homeAssembly = ((MetadataType)type).Module as IAssemblyDesc;
+ AppendAssemblyName(sb, homeAssembly);
+ }
+ }
+
+ private void AppendAssemblyName(StringBuilder sb, IAssemblyDesc assembly)
+ {
+ if (assembly == null)
+ return;
+
+ sb.Append(',');
+ AppendEscapedIdentifier(sb, assembly.GetName().Name);
+ }
+
+ protected override void AppendNameForNestedType(StringBuilder sb, DefType nestedType, DefType containingType)
+ {
+ AppendName(sb, containingType);
+
+ sb.Append('+');
+
+ string ns = GetTypeNamespace(nestedType);
+ if (ns.Length > 0)
+ {
+ AppendEscapedIdentifier(sb, ns);
+ sb.Append('.');
+ }
+ AppendEscapedIdentifier(sb, GetTypeName(nestedType));
+ }
+
+ private string GetTypeName(DefType type)
+ {
+ return type.Name;
+ }
+
+ private string GetTypeNamespace(DefType type)
+ {
+ return type.Namespace;
+ }
+
+ private static char[] s_escapedChars = new char[] { ',', '=', '"', ']', '[', '*', '&', '+', '\\' };
+ private void AppendEscapedIdentifier(StringBuilder sb, string identifier)
+ {
+ if (identifier.IndexOfAny(s_escapedChars) < 0)
+ {
+ string escapedIdentifier = identifier;
+ foreach (char escapedChar in s_escapedChars)
+ {
+ string escapedCharString = new string(escapedChar, 1);
+ escapedIdentifier = escapedIdentifier.Replace(escapedCharString, "\\" + escapedCharString);
+ }
+ sb.Append(escapedIdentifier);
+ }
+ else
+ {
+ sb.Append(identifier);
+ }
+ }
+ }
}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FatFunctionPointerNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FatFunctionPointerNode.cs
index 9873fb76c78370..2dd04047e594e0 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FatFunctionPointerNode.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FatFunctionPointerNode.cs
@@ -35,7 +35,7 @@ public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
}
int ISymbolDefinitionNode.Offset => 0;
- int ISymbolNode.Offset => Method.Context.Target.FatFunctionPointerOffset;
+ int ISymbolNode.Offset => Method.Context.Target.Architecture == TargetArchitecture.Wasm32 ? 1 << 31 : 2;
public override bool IsShareable => true;
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericCompositionNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericCompositionNode.cs
index a4388b4eeb4a96..9857c633784db6 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericCompositionNode.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericCompositionNode.cs
@@ -36,6 +36,7 @@ public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
if (_details.Variance != null)
{
+ sb.Append("__Variance__");
for (int i = 0; i < _details.Variance.Length; i++)
{
sb.Append('_');
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/HardwareIntrinsicHelpers.Aot.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/HardwareIntrinsicHelpers.Aot.cs
index 7c12cf6c8a3da5..188d44c3f65fb8 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/HardwareIntrinsicHelpers.Aot.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/HardwareIntrinsicHelpers.Aot.cs
@@ -95,6 +95,7 @@ private static class XArchIntrinsicConstants
public const int Bmi1 = 0x0400;
public const int Bmi2 = 0x0800;
public const int Lzcnt = 0x1000;
+ public const int AvxVnni = 0x2000;
public static int FromHardwareIntrinsicId(string id)
{
@@ -113,6 +114,7 @@ public static int FromHardwareIntrinsicId(string id)
"Bmi1" => Bmi1,
"Bmi2" => Bmi2,
"Lzcnt" => Lzcnt,
+ "AvxVnni" => AvxVnni,
_ => throw new NotSupportedException(),
};
}
@@ -155,6 +157,8 @@ public static int FromInstructionSetFlags(InstructionSetFlags instructionSets)
InstructionSet.X64_BMI2_X64 => Bmi2,
InstructionSet.X64_LZCNT => Lzcnt,
InstructionSet.X64_LZCNT_X64 => Popcnt,
+ InstructionSet.X64_AVXVNNI => AvxVnni,
+ InstructionSet.X64_AVXVNNI_X64 => AvxVnni,
// SSE and SSE2 are baseline ISAs - they're always available
InstructionSet.X64_SSE => 0,
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs
index e10bbe95f07971..ae9e60343dfb42 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs
@@ -4,18 +4,18 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
-using System.Threading;
+using System.Threading.Tasks;
using ILCompiler.DependencyAnalysis;
using ILCompiler.DependencyAnalysisFramework;
using Internal.IL;
using Internal.IL.Stubs;
+using Internal.JitInterface;
using Internal.TypeSystem;
using Internal.ReadyToRunConstants;
using Debug = System.Diagnostics.Debug;
-using Internal.JitInterface;
namespace ILCompiler
{
@@ -26,8 +26,7 @@ namespace ILCompiler
///
internal sealed class ILScanner : Compilation, IILScanner
{
- private CountdownEvent _compilationCountdown;
- private readonly bool _singleThreaded;
+ private readonly int _parallelism;
internal ILScanner(
DependencyAnalyzerBase dependencyGraph,
@@ -36,11 +35,11 @@ internal ILScanner(
ILProvider ilProvider,
DebugInformationProvider debugInformationProvider,
Logger logger,
- bool singleThreaded)
+ int parallelism)
: base(dependencyGraph, nodeFactory, roots, ilProvider, debugInformationProvider, null, nodeFactory.CompilationModuleGroup, logger)
{
_helperCache = new HelperCache(this);
- _singleThreaded = singleThreaded;
+ _parallelism = parallelism;
}
protected override void CompileInternal(string outputFile, ObjectDumper dumper)
@@ -78,7 +77,7 @@ protected override void ComputeDependencyNodeDependencies(List methodsToCompile)
Logger.Writer.WriteLine($"Scanning {methodsToCompile.Count} methods...");
}
- WaitCallback compileSingleMethodDelegate = m => CompileSingleMethod((ScannedMethodNode)m);
-
- using (_compilationCountdown = new CountdownEvent(methodsToCompile.Count))
- {
- foreach (ScannedMethodNode methodCodeNodeNeedingCode in methodsToCompile)
- {
- ThreadPool.QueueUserWorkItem(compileSingleMethodDelegate, methodCodeNodeNeedingCode);
- }
-
- _compilationCountdown.Wait();
- _compilationCountdown = null;
- }
+ Parallel.ForEach(
+ methodsToCompile,
+ new ParallelOptions { MaxDegreeOfParallelism = _parallelism },
+ CompileSingleMethod);
}
private void CompileSingleThreaded(List methodsToCompile)
@@ -142,11 +133,6 @@ private void CompileSingleMethod(ScannedMethodNode methodCodeNodeNeedingCode)
{
throw new CodeGenerationFailedException(method, ex);
}
- finally
- {
- if (_compilationCountdown != null)
- _compilationCountdown.Signal();
- }
}
ILScanResults IILScanner.Scan()
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScannerBuilder.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScannerBuilder.cs
index 27e7e64b6ce193..cf784d458dde24 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScannerBuilder.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScannerBuilder.cs
@@ -27,7 +27,7 @@ public sealed class ILScannerBuilder
private IEnumerable _compilationRoots = Array.Empty();
private MetadataManager _metadataManager;
private InteropStubManager _interopStubManager = new EmptyInteropStubManager();
- private bool _singleThreaded;
+ private int _parallelism = -1;
internal ILScannerBuilder(CompilerTypeSystemContext context, CompilationModuleGroup compilationGroup, NameMangler mangler, ILProvider ilProvider, PreinitializationManager preinitializationManager)
{
@@ -63,9 +63,9 @@ public ILScannerBuilder UseInteropStubManager(InteropStubManager interopStubMana
return this;
}
- public ILScannerBuilder UseSingleThread(bool enable)
+ public ILScannerBuilder UseParallelism(int parallelism)
{
- _singleThreaded = enable;
+ _parallelism = parallelism;
return this;
}
@@ -74,7 +74,7 @@ public IILScanner ToILScanner()
var nodeFactory = new ILScanNodeFactory(_context, _compilationGroup, _metadataManager, _interopStubManager, _nameMangler, _preinitializationManager);
DependencyAnalyzerBase graph = _dependencyTrackingLevel.CreateDependencyGraph(nodeFactory);
- return new ILScanner(graph, nodeFactory, _compilationRoots, _ilProvider, new NullDebugInformationProvider(), _logger, _singleThreaded);
+ return new ILScanner(graph, nodeFactory, _compilationRoots, _ilProvider, new NullDebugInformationProvider(), _logger, _parallelism);
}
}
}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/LazyGenerics/ModuleCycleInfo.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/LazyGenerics/ModuleCycleInfo.cs
index 47b1ce7e1d05c0..378af488af0208 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/LazyGenerics/ModuleCycleInfo.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/LazyGenerics/ModuleCycleInfo.cs
@@ -34,18 +34,69 @@ public bool FormsCycle(TypeSystemEntity owner)
TypeDesc ownerType = (owner as EcmaMethod)?.OwningType;
return _entitiesInCycles.Contains(owner) || (ownerType != null && _entitiesInCycles.Contains(ownerType));
}
+ }
+
+ private class CycleInfoHashtable : LockFreeReaderHashtable
+ {
+ protected override bool CompareKeyToValue(EcmaModule key, ModuleCycleInfo value) => key == value.Module;
+ protected override bool CompareValueToValue(ModuleCycleInfo value1, ModuleCycleInfo value2) => value1.Module == value2.Module;
+ protected override int GetKeyHashCode(EcmaModule key) => key.GetHashCode();
+ protected override int GetValueHashCode(ModuleCycleInfo value) => value.Module.GetHashCode();
+
+ protected override ModuleCycleInfo CreateValueFromKey(EcmaModule key)
+ {
+ GraphBuilder gb = new GraphBuilder(key);
+ Graph graph = gb.Graph;
+
+ var formalsNeedingLazyGenerics = graph.ComputeVerticesInvolvedInAFlaggedCycle();
+ var entitiesNeedingLazyGenerics = new HashSet();
+
+ foreach (EcmaGenericParameter formal in formalsNeedingLazyGenerics)
+ {
+ var formalDefinition = key.MetadataReader.GetGenericParameter(formal.Handle);
+ if (formal.Kind == GenericParameterKind.Type)
+ {
+ entitiesNeedingLazyGenerics.Add(key.GetType(formalDefinition.Parent));
+ }
+ else
+ {
+ entitiesNeedingLazyGenerics.Add(key.GetMethod(formalDefinition.Parent));
+ }
+ }
+
+ return new ModuleCycleInfo(key, entitiesNeedingLazyGenerics);
+ }
+ }
+
+ internal class GenericCycleDetector
+ {
+ private readonly CycleInfoHashtable _hashtable = new CycleInfoHashtable();
+
+ private readonly struct EntityPair : IEquatable
+ {
+ public readonly TypeSystemEntity Owner;
+ public readonly TypeSystemEntity Referent;
+ public EntityPair(TypeSystemEntity owner, TypeSystemEntity referent)
+ => (Owner, Referent) = (owner, referent);
+ public bool Equals(EntityPair other) => Owner == other.Owner && Referent == other.Referent;
+ public override bool Equals(object obj) => obj is EntityPair p && Equals(p);
+ public override int GetHashCode() => HashCode.Combine(Owner.GetHashCode(), Referent.GetHashCode());
+ }
+
+ // This is a set of entities that had actual problems that caused us to abort compilation
+ // somewhere.
+ // Would prefer this to be a ConcurrentHashSet but there isn't any. ModuleCycleInfo can be looked up
+ // from the key, but since this is a key/value pair, might as well use the value too...
+ private readonly ConcurrentDictionary _actualProblems = new ConcurrentDictionary();
+
+ private readonly int _cutoffPoint;
+
+ public GenericCycleDetector(int cutoffPoint)
+ {
+ _cutoffPoint = cutoffPoint;
+ }
- // Chosen rather arbitrarily. For the app that I was looking at, cutoff point of 7 compiled
- // more than 10 minutes on a release build of the compiler, and I lost patience.
- // Cutoff point of 5 produced an 1.7 GB object file.
- // Cutoff point of 4 produced an 830 MB object file.
- // Cutoff point of 3 produced an 470 MB object file.
- // We want this to be high enough so that it doesn't cut off too early. But also not too
- // high because things that are recursive often end up expanding laterally as well
- // through various other generic code the deep code calls into.
- private const int CutoffPoint = 4;
-
- public bool IsDeepPossiblyCyclicInstantiation(TypeSystemEntity entity)
+ private bool IsDeepPossiblyCyclicInstantiation(TypeSystemEntity entity)
{
if (entity is TypeDesc type)
{
@@ -57,7 +108,7 @@ public bool IsDeepPossiblyCyclicInstantiation(TypeSystemEntity entity)
}
}
- public bool IsDeepPossiblyCyclicInstantiation(TypeDesc type, List seenTypes = null)
+ private bool IsDeepPossiblyCyclicInstantiation(TypeDesc type, List seenTypes = null)
{
switch (type.Category)
{
@@ -80,7 +131,7 @@ public bool IsDeepPossiblyCyclicInstantiation(TypeDesc type, List seen
count++;
}
- if (count > CutoffPoint)
+ if (count > _cutoffPoint)
{
return true;
}
@@ -112,60 +163,6 @@ public bool IsDeepPossiblyCyclicInstantiation(MethodDesc method)
{
return IsDeepPossiblyCyclicInstantiation(method.Instantiation) || IsDeepPossiblyCyclicInstantiation(method.OwningType);
}
- }
-
- private class CycleInfoHashtable : LockFreeReaderHashtable
- {
- protected override bool CompareKeyToValue(EcmaModule key, ModuleCycleInfo value) => key == value.Module;
- protected override bool CompareValueToValue(ModuleCycleInfo value1, ModuleCycleInfo value2) => value1.Module == value2.Module;
- protected override int GetKeyHashCode(EcmaModule key) => key.GetHashCode();
- protected override int GetValueHashCode(ModuleCycleInfo value) => value.Module.GetHashCode();
-
- protected override ModuleCycleInfo CreateValueFromKey(EcmaModule key)
- {
- GraphBuilder gb = new GraphBuilder(key);
- Graph graph = gb.Graph;
-
- var formalsNeedingLazyGenerics = graph.ComputeVerticesInvolvedInAFlaggedCycle();
- var entitiesNeedingLazyGenerics = new HashSet();
-
- foreach (EcmaGenericParameter formal in formalsNeedingLazyGenerics)
- {
- var formalDefinition = key.MetadataReader.GetGenericParameter(formal.Handle);
- if (formal.Kind == GenericParameterKind.Type)
- {
- entitiesNeedingLazyGenerics.Add(key.GetType(formalDefinition.Parent));
- }
- else
- {
- entitiesNeedingLazyGenerics.Add(key.GetMethod(formalDefinition.Parent));
- }
- }
-
- return new ModuleCycleInfo(key, entitiesNeedingLazyGenerics);
- }
- }
-
- internal class GenericCycleDetector
- {
- private readonly CycleInfoHashtable _hashtable = new CycleInfoHashtable();
-
- private readonly struct EntityPair : IEquatable
- {
- public readonly TypeSystemEntity Owner;
- public readonly TypeSystemEntity Referent;
- public EntityPair(TypeSystemEntity owner, TypeSystemEntity referent)
- => (Owner, Referent) = (owner, referent);
- public bool Equals(EntityPair other) => Owner == other.Owner && Referent == other.Referent;
- public override bool Equals(object obj) => obj is EntityPair p && Equals(p);
- public override int GetHashCode() => HashCode.Combine(Owner.GetHashCode(), Referent.GetHashCode());
- }
-
- // This is a set of entities that had actual problems that caused us to abort compilation
- // somewhere.
- // Would prefer this to be a ConcurrentHashSet but there isn't any. ModuleCycleInfo can be looked up
- // from the key, but since this is a key/value pair, might as well use the value too...
- private readonly ConcurrentDictionary _actualProblems = new ConcurrentDictionary();
public void DetectCycle(TypeSystemEntity owner, TypeSystemEntity referent)
{
@@ -196,7 +193,7 @@ public void DetectCycle(TypeSystemEntity owner, TypeSystemEntity referent)
{
// Just the presence of a cycle is not a problem, but once we start getting too deep,
// we need to cut our losses.
- if (cycleInfo.IsDeepPossiblyCyclicInstantiation(referent))
+ if (IsDeepPossiblyCyclicInstantiation(referent))
{
_actualProblems.TryAdd(new EntityPair(owner, referent), cycleInfo);
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/MultiFileCompilationModuleGroup.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/MultiFileCompilationModuleGroup.cs
index 9f93ae3ea87a13..a7c4b27afd274f 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/MultiFileCompilationModuleGroup.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/MultiFileCompilationModuleGroup.cs
@@ -15,7 +15,7 @@ public abstract class MultiFileCompilationModuleGroup : CompilationModuleGroup
{
private HashSet _compilationModuleSet;
- public MultiFileCompilationModuleGroup(TypeSystemContext context, IEnumerable compilationModuleSet)
+ public MultiFileCompilationModuleGroup(CompilerTypeSystemContext context, IEnumerable compilationModuleSet)
{
_compilationModuleSet = new HashSet(compilationModuleSet);
@@ -94,7 +94,7 @@ public override bool CanHaveReferenceThroughImportTable
///
public class MultiFileSharedCompilationModuleGroup : MultiFileCompilationModuleGroup
{
- public MultiFileSharedCompilationModuleGroup(TypeSystemContext context, IEnumerable compilationModuleSet)
+ public MultiFileSharedCompilationModuleGroup(CompilerTypeSystemContext context, IEnumerable compilationModuleSet)
: base(context, compilationModuleSet)
{
}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedInteropStubManager.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedInteropStubManager.cs
index 9aa675ca738fc0..a1e931e1725394 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedInteropStubManager.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedInteropStubManager.cs
@@ -5,7 +5,9 @@
using Internal.TypeSystem;
using Internal.TypeSystem.Interop;
+using ILCompiler.Dataflow;
using ILCompiler.DependencyAnalysis;
+using ILLink.Shared;
using Debug = System.Diagnostics.Debug;
using DependencyList = ILCompiler.DependencyAnalysisFramework.DependencyNodeCore.DependencyList;
@@ -18,9 +20,12 @@ namespace ILCompiler
///
public class UsageBasedInteropStubManager : CompilerGeneratedInteropStubManager
{
- public UsageBasedInteropStubManager(InteropStateManager interopStateManager, PInvokeILEmitterConfiguration pInvokeILEmitterConfiguration)
+ private Logger _logger;
+
+ public UsageBasedInteropStubManager(InteropStateManager interopStateManager, PInvokeILEmitterConfiguration pInvokeILEmitterConfiguration, Logger logger)
: base(interopStateManager, pInvokeILEmitterConfiguration)
{
+ _logger = logger;
}
public override void AddDependeciesDueToPInvoke(ref DependencyList dependencies, NodeFactory factory, MethodDesc method)
@@ -30,11 +35,11 @@ public override void AddDependeciesDueToPInvoke(ref DependencyList dependencies,
dependencies = dependencies ?? new DependencyList();
MethodSignature methodSig = method.Signature;
- AddParameterMarshallingDependencies(ref dependencies, factory, methodSig.ReturnType);
+ AddParameterMarshallingDependencies(ref dependencies, factory, method, methodSig.ReturnType);
for (int i = 0; i < methodSig.Length; i++)
{
- AddParameterMarshallingDependencies(ref dependencies, factory, methodSig[i]);
+ AddParameterMarshallingDependencies(ref dependencies, factory, method, methodSig[i]);
}
}
@@ -45,13 +50,25 @@ public override void AddDependeciesDueToPInvoke(ref DependencyList dependencies,
}
}
- private static void AddParameterMarshallingDependencies(ref DependencyList dependencies, NodeFactory factory, TypeDesc type)
+ private void AddParameterMarshallingDependencies(ref DependencyList dependencies, NodeFactory factory, MethodDesc method, TypeDesc type)
{
if (type.IsDelegate)
{
dependencies.Add(factory.DelegateMarshallingData((DefType)type), "Delegate marshaling");
}
+ TypeSystemContext context = type.Context;
+ if ((type.IsWellKnownType(WellKnownType.MulticastDelegate)
+ || type == context.GetWellKnownType(WellKnownType.MulticastDelegate).BaseType))
+ {
+ var message = new DiagnosticString(DiagnosticId.CorrectnessOfAbstractDelegatesCannotBeGuaranteed).GetMessage(DiagnosticUtilities.GetMethodSignatureDisplayName(method));
+ _logger.LogWarning(
+ message,
+ (int)DiagnosticId.CorrectnessOfAbstractDelegatesCannotBeGuaranteed,
+ method,
+ MessageSubCategory.AotAnalysis);
+ }
+
// struct may contain delegate fields, hence we need to add dependencies for it
if (type.IsByRef)
type = ((ParameterizedType)type).ParameterType;
@@ -63,7 +80,7 @@ private static void AddParameterMarshallingDependencies(ref DependencyList depen
if (field.IsStatic)
continue;
- AddParameterMarshallingDependencies(ref dependencies, factory, field.FieldType);
+ AddParameterMarshallingDependencies(ref dependencies, factory, method, field.FieldType);
}
}
}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/AppContextInitializerMethod.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/AppContextInitializerMethod.cs
index d4b53340b55301..ed40a5f6fcc75c 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/AppContextInitializerMethod.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/AppContextInitializerMethod.cs
@@ -54,6 +54,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "SetAppContextSwitches";
+ }
+ }
+
public override MethodIL EmitIL()
{
ILEmitter emitter = new ILEmitter();
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/NativeLibraryStartupMethod.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/NativeLibraryStartupMethod.cs
index 7138804bb23138..4240af2427d154 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/NativeLibraryStartupMethod.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/NativeLibraryStartupMethod.cs
@@ -48,6 +48,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "NativeLibraryStartup";
+ }
+ }
+
public override MethodIL EmitIL()
{
ILEmitter emitter = new ILEmitter();
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/StartupCodeMainMethod.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/StartupCodeMainMethod.cs
index b18b9435491343..2c91f888c4dc05 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/StartupCodeMainMethod.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/StartupCodeMainMethod.cs
@@ -53,6 +53,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "StartupCodeMain";
+ }
+ }
+
public override MethodIL EmitIL()
{
ILEmitter emitter = new ILEmitter();
@@ -229,6 +237,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "MainMethodWrapper";
+ }
+ }
+
public override MethodSignature Signature
{
get
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/ILCompiler.Compiler.csproj b/src/coreclr/tools/aot/ILCompiler.Compiler/ILCompiler.Compiler.csproj
index 3273d2cc58f567..3420564b0715ef 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/ILCompiler.Compiler.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/ILCompiler.Compiler.csproj
@@ -23,6 +23,147 @@
+
+ IL\DelegateInfo.cs
+
+
+ IL\Stubs\DelegateThunks.Sorting.cs
+
+
+ IL\Stubs\DynamicInvokeMethodThunk.cs
+
+
+ IL\Stubs\DynamicInvokeMethodThunk.Sorting.cs
+
+
+ IL\Stubs\EnumThunks.cs
+
+
+ IL\Stubs\EnumThunks.Sorting.cs
+
+
+ IL\Stubs\PInvokeLazyFixupField.cs
+
+
+ IL\Stubs\PInvokeLazyFixupField.Sorting.cs
+
+
+ IL\Stubs\StructMarshallingThunk.Sorting.cs
+
+
+ IL\Stubs\ValueTypeGetFieldHelperMethodOverride.cs
+
+
+ IL\Stubs\ValueTypeGetFieldHelperMethodOverride.Sorting.cs
+
+
+ TypeSystem\Interop\IL\InlineArrayType.Sorting.cs
+
+
+ Interop\IL\MarshalHelpers.cs
+
+
+ Interop\IL\MarshalHelpers.Aot.cs
+
+
+ Interop\IL\MarshalUtils.cs
+
+
+ Interop\IL\Marshaller.cs
+
+
+ Interop\IL\Marshaller.Aot.cs
+
+
+ Interop\IL\MarshallerKind.cs
+
+
+ TypeSystem\Interop\IL\NativeStructType.Sorting.cs
+
+
+ Interop\IL\PInvokeILEmitterConfiguration.cs
+
+
+ IL\Stubs\PInvokeILEmitter.cs
+
+
+ IL\Stubs\PInvokeILCodeStreams.cs
+
+
+ IL\Stubs\DebuggerSteppingHelpers.cs
+
+
+ IL\Stubs\CalliMarshallingMethodThunk.cs
+
+
+ IL\Stubs\CalliMarshallingMethodThunk.Mangling.cs
+
+
+ IL\Stubs\CalliMarshallingMethodThunk.Sorting.cs
+
+
+ IL\Stubs\DelegateMarshallingMethodThunk.cs
+
+
+ IL\Stubs\DelegateMarshallingMethodThunk.Mangling.cs
+
+
+ IL\Stubs\DelegateMarshallingMethodThunk.Sorting.cs
+
+
+ IL\Stubs\ForwardDelegateCreationThunk.cs
+
+
+ IL\Stubs\ForwardDelegateCreationThunk.Mangling.cs
+
+
+ IL\Stubs\ForwardDelegateCreationThunk.Sorting.cs
+
+
+ IL\Stubs\DelegateThunks.cs
+
+
+ IL\Stubs\StructMarshallingThunk.cs
+
+
+ IL\Stubs\StructMarshallingThunk.Mangling.cs
+
+
+ TypeSystem\Interop\IL\NativeStructType.cs
+
+
+ TypeSystem\Interop\IL\NativeStructType.Mangling.cs
+
+
+ TypeSystem\Interop\IL\PInvokeDelegateWrapper.cs
+
+
+ TypeSystem\Interop\IL\PInvokeDelegateWrapper.Mangling.cs
+
+
+ TypeSystem\Interop\IL\PInvokeDelegateWrapper.Sorting.cs
+
+
+ TypeSystem\Interop\IL\PInvokeDelegateWrapperConstructor.cs
+
+
+ TypeSystem\Interop\IL\PInvokeDelegateWrapperConstructor.Sorting.cs
+
+
+ TypeSystem\Interop\IL\InlineArrayType.cs
+
+
+ TypeSystem\Interop\InteropTypes.cs
+
+
+ TypeSystem\Interop\InteropStateManager.cs
+
+
+ TypeSystem\CodeGen\INonEmittableType.cs
+
+
+ TypeSystem\CodeGen\NativeStructType.CodeGen.cs
+
Compiler\Logging\CompilerGeneratedState.cs
@@ -179,6 +320,12 @@
+
+
+
+
+
+
diff --git a/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/EventSourceLogStrategy.cs b/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/EventSourceLogStrategy.cs
index 4595d0ab07e53d..e7615ad545fbfa 100644
--- a/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/EventSourceLogStrategy.cs
+++ b/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/EventSourceLogStrategy.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System;
+using System.Diagnostics.CodeAnalysis;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -28,10 +29,16 @@ public class Keywords
// with the name of the event (method name) as well as the names and types of all the parameters.
[Event(1, Keywords = Keywords.Graph, Level = EventLevel.Informational)]
public void Graph(int id, string name) { WriteEvent(1, id, name); }
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = "Parameters to this method are primitive and are trimmer safe")]
[Event(2, Keywords = Keywords.Graph, Level = EventLevel.Informational)]
public void Node(int id, int index, string name) { WriteEvent(2, id, index, name); }
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = "Parameters to this method are primitive and are trimmer safe")]
[Event(3, Keywords = Keywords.Graph, Level = EventLevel.Informational)]
public void Edge(int id, int dependentIndex, int dependencyIndex, string reason) { WriteEvent(3, id, dependentIndex, dependencyIndex, reason); }
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = "Parameters to this method are primitive and are trimmer safe")]
[Event(4, Keywords = Keywords.Graph, Level = EventLevel.Informational)]
public void ConditionalEdge(int id, int dependentIndex1, int dependentIndex2, int dependencyIndex, string reason) { WriteEvent(4, id, dependentIndex1, dependentIndex2, dependencyIndex, reason); }
diff --git a/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/ILCompiler.DependencyAnalysisFramework.csproj b/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/ILCompiler.DependencyAnalysisFramework.csproj
index c98ffb07608364..17f44699ea3cb6 100644
--- a/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/ILCompiler.DependencyAnalysisFramework.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/ILCompiler.DependencyAnalysisFramework.csproj
@@ -3,7 +3,7 @@
Library
ILCompiler.DependencyAnalysisFramework
ILCompiler.DependencyAnalysisFramework
- netstandard2.0
+ net5.0
false
x64;x86
AnyCPU
diff --git a/src/coreclr/tools/aot/ILCompiler.Diagnostics/ILCompiler.Diagnostics.csproj b/src/coreclr/tools/aot/ILCompiler.Diagnostics/ILCompiler.Diagnostics.csproj
index 8fe3bd1982d475..97c97bb7de720d 100644
--- a/src/coreclr/tools/aot/ILCompiler.Diagnostics/ILCompiler.Diagnostics.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.Diagnostics/ILCompiler.Diagnostics.csproj
@@ -18,7 +18,7 @@
-
+
diff --git a/src/coreclr/tools/aot/ILCompiler.MetadataTransform/ILCompiler.MetadataTransform.csproj b/src/coreclr/tools/aot/ILCompiler.MetadataTransform/ILCompiler.MetadataTransform.csproj
index ca6174b66dab13..83ab3456fb5e31 100644
--- a/src/coreclr/tools/aot/ILCompiler.MetadataTransform/ILCompiler.MetadataTransform.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.MetadataTransform/ILCompiler.MetadataTransform.csproj
@@ -2,7 +2,7 @@
Library
ILCompiler.MetadataTransform
- netstandard2.0
+ net5.0
true
$(DefineConstants);NATIVEFORMAT_PUBLICWRITER;NETFX_45
false
diff --git a/src/coreclr/tools/aot/ILCompiler.MetadataTransform/Internal/Metadata/NativeFormat/Writer/NativeMetadataWriter.cs b/src/coreclr/tools/aot/ILCompiler.MetadataTransform/Internal/Metadata/NativeFormat/Writer/NativeMetadataWriter.cs
index 01bef848d2b36b..c31437d0dd2c45 100644
--- a/src/coreclr/tools/aot/ILCompiler.MetadataTransform/Internal/Metadata/NativeFormat/Writer/NativeMetadataWriter.cs
+++ b/src/coreclr/tools/aot/ILCompiler.MetadataTransform/Internal/Metadata/NativeFormat/Writer/NativeMetadataWriter.cs
@@ -965,18 +965,14 @@ public override string ToString()
public static class EnumHelpers
{
- public static string FlagsToString(this T value) where T : IConvertible
+ public static string FlagsToString(this T value) where T : struct, Enum, IConvertible
{
- if (!(value is Enum))
- throw new ArgumentException();
-
- var eType = value.GetType();
- var flags = ((T[])Enum.GetValues(eType)).Where(
+ var flags = Enum.GetValues().Where(
eVal => (((IConvertible)eVal).ToInt32(null) != 0) && ((((IConvertible)value).ToInt32(null) & ((IConvertible)eVal).ToInt32(null)) == ((IConvertible)eVal).ToInt32(null)));
if (flags.Count() == 0)
return "";
else
- return "[" + String.Join(" | ", flags.Select(eVal => Enum.GetName(eType, eVal))) + "] ";
+ return "[" + String.Join(" | ", flags.Select(eVal => Enum.GetName(eVal))) + "] ";
}
}
diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ArgIterator.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ArgIterator.cs
index b9671aa4850223..28d10f23a28f06 100644
--- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ArgIterator.cs
+++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ArgIterator.cs
@@ -1606,9 +1606,8 @@ private void ForceSigWalk()
int byteArgSize = GetArgSize();
- // Composites greater than 16bytes are passed by reference
- TypeHandle dummy;
- if (GetArgType(out dummy) == CorElementType.ELEMENT_TYPE_VALUETYPE && GetArgSize() > _transitionBlock.EnregisteredParamTypeMaxSize)
+ // On ARM64 some composites are implicitly passed by reference.
+ if (IsArgPassedByRef())
{
byteArgSize = _transitionBlock.PointerSize;
}
diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs
index 34aced76b44b01..8f468f78b39771 100644
--- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs
+++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs
@@ -33,7 +33,6 @@ public sealed class ReadyToRunCodegenCompilationBuilder : CompilationBuilder
private string _perfMapPath;
private int _perfMapFormatVersion;
private bool _generateProfileFile;
- private int _parallelism;
Func _printReproInstructions;
private InstructionSetSupport _instructionSetSupport;
private ProfileDataManager _profileData;
@@ -170,12 +169,6 @@ public ReadyToRunCodegenCompilationBuilder UseProfileFile(bool generateProfileFi
return this;
}
- public ReadyToRunCodegenCompilationBuilder UseParallelism(int parallelism)
- {
- _parallelism = parallelism;
- return this;
- }
-
public ReadyToRunCodegenCompilationBuilder UsePrintReproInstructions(Func printReproInstructions)
{
_printReproInstructions = printReproInstructions;
diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj
index 40f19bfefc78a5..5154db358a8b8e 100644
--- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj
@@ -20,7 +20,7 @@
-
+
@@ -44,6 +44,7 @@
+
diff --git a/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/ILCompiler.Reflection.ReadyToRun.csproj b/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/ILCompiler.Reflection.ReadyToRun.csproj
index 86644068f3c172..b57b5be6d076bb 100644
--- a/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/ILCompiler.Reflection.ReadyToRun.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/ILCompiler.Reflection.ReadyToRun.csproj
@@ -31,6 +31,6 @@
-
+
diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs
index e794bdd1a94790..0d8b11c51f82e2 100644
--- a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs
+++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs
@@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading;
+using System.Threading.Tasks;
using ILCompiler.DependencyAnalysis;
using ILCompiler.DependencyAnalysisFramework;
@@ -21,10 +22,10 @@ public sealed class RyuJitCompilation : Compilation
private readonly ConditionalWeakTable _corinfos = new ConditionalWeakTable();
internal readonly RyuJitCompilationOptions _compilationOptions;
private readonly ExternSymbolMappedField _hardwareIntrinsicFlags;
- private CountdownEvent _compilationCountdown;
private readonly Dictionary _instructionSetMap;
private readonly ProfileDataManager _profileDataManager;
private readonly MethodImportationErrorProvider _methodImportationErrorProvider;
+ private readonly int _parallelism;
public InstructionSetSupport InstructionSetSupport { get; }
@@ -40,7 +41,8 @@ internal RyuJitCompilation(
InstructionSetSupport instructionSetSupport,
ProfileDataManager profileDataManager,
MethodImportationErrorProvider errorProvider,
- RyuJitCompilationOptions options)
+ RyuJitCompilationOptions options,
+ int parallelism)
: base(dependencyGraph, nodeFactory, roots, ilProvider, debugInformationProvider, devirtualizationManager, inliningPolicy, logger)
{
_compilationOptions = options;
@@ -59,6 +61,8 @@ internal RyuJitCompilation(
_profileDataManager = profileDataManager;
_methodImportationErrorProvider = errorProvider;
+
+ _parallelism = parallelism;
}
public ProfileDataManager ProfileData => _profileDataManager;
@@ -125,7 +129,7 @@ protected override void ComputeDependencyNodeDependencies(List methodsToCompile)
Logger.Writer.WriteLine($"Compiling {methodsToCompile.Count} methods...");
}
- WaitCallback compileSingleMethodDelegate = m =>
- {
- CorInfoImpl corInfo = _corinfos.GetValue(Thread.CurrentThread, thread => new CorInfoImpl(this));
- CompileSingleMethod(corInfo, (MethodCodeNode)m);
- };
-
- using (_compilationCountdown = new CountdownEvent(methodsToCompile.Count))
- {
-
- foreach (MethodCodeNode methodCodeNodeNeedingCode in methodsToCompile)
- {
- ThreadPool.QueueUserWorkItem(compileSingleMethodDelegate, methodCodeNodeNeedingCode);
- }
-
- _compilationCountdown.Wait();
- _compilationCountdown = null;
- }
+ Parallel.ForEach(
+ methodsToCompile,
+ new ParallelOptions { MaxDegreeOfParallelism = _parallelism },
+ CompileSingleMethod);
}
@@ -176,52 +167,50 @@ private void CompileSingleThreaded(List methodsToCompile)
}
}
+ private void CompileSingleMethod(MethodCodeNode methodCodeNodeNeedingCode)
+ {
+ CorInfoImpl corInfo = _corinfos.GetValue(Thread.CurrentThread, thread => new CorInfoImpl(this));
+ CompileSingleMethod(corInfo, methodCodeNodeNeedingCode);
+ }
+
private void CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeNodeNeedingCode)
{
- try
- {
- MethodDesc method = methodCodeNodeNeedingCode.Method;
+ MethodDesc method = methodCodeNodeNeedingCode.Method;
- TypeSystemException exception = _methodImportationErrorProvider.GetCompilationError(method);
+ TypeSystemException exception = _methodImportationErrorProvider.GetCompilationError(method);
- // If we previously failed to import the method, do not try to import it again and go
- // directly to the error path.
- if (exception == null)
+ // If we previously failed to import the method, do not try to import it again and go
+ // directly to the error path.
+ if (exception == null)
+ {
+ try
{
- try
- {
- corInfo.CompileMethod(methodCodeNodeNeedingCode);
- }
- catch (TypeSystemException ex)
- {
- exception = ex;
- }
+ corInfo.CompileMethod(methodCodeNodeNeedingCode);
}
-
- if (exception != null)
+ catch (TypeSystemException ex)
{
- // TODO: fail compilation if a switch was passed
-
- // Try to compile the method again, but with a throwing method body this time.
- MethodIL throwingIL = TypeSystemThrowingILEmitter.EmitIL(method, exception);
- corInfo.CompileMethod(methodCodeNodeNeedingCode, throwingIL);
-
- if (exception is TypeSystemException.InvalidProgramException
- && method.OwningType is MetadataType mdOwningType
- && mdOwningType.HasCustomAttribute("System.Runtime.InteropServices", "ClassInterfaceAttribute"))
- {
- Logger.LogWarning("COM interop is not supported with full ahead of time compilation", 3052, method, MessageSubCategory.AotAnalysis);
- }
- else
- {
- Logger.LogWarning($"Method will always throw because: {exception.Message}", 1005, method, MessageSubCategory.AotAnalysis);
- }
+ exception = ex;
}
}
- finally
+
+ if (exception != null)
{
- if (_compilationCountdown != null)
- _compilationCountdown.Signal();
+ // TODO: fail compilation if a switch was passed
+
+ // Try to compile the method again, but with a throwing method body this time.
+ MethodIL throwingIL = TypeSystemThrowingILEmitter.EmitIL(method, exception);
+ corInfo.CompileMethod(methodCodeNodeNeedingCode, throwingIL);
+
+ if (exception is TypeSystemException.InvalidProgramException
+ && method.OwningType is MetadataType mdOwningType
+ && mdOwningType.HasCustomAttribute("System.Runtime.InteropServices", "ClassInterfaceAttribute"))
+ {
+ Logger.LogWarning("COM interop is not supported with full ahead of time compilation", 3052, method, MessageSubCategory.AotAnalysis);
+ }
+ else
+ {
+ Logger.LogWarning($"Method will always throw because: {exception.Message}", 1005, method, MessageSubCategory.AotAnalysis);
+ }
}
}
@@ -252,7 +241,6 @@ public override MethodIL GetMethodIL(MethodDesc method)
public enum RyuJitCompilationOptions
{
MethodBodyFolding = 0x1,
- SingleThreadedCompilation = 0x2,
- ControlFlowGuardAnnotations = 0x4,
+ ControlFlowGuardAnnotations = 0x2,
}
}
diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilationBuilder.cs b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilationBuilder.cs
index 162f1a39e86bbc..8b753c71039942 100644
--- a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilationBuilder.cs
+++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilationBuilder.cs
@@ -107,9 +107,6 @@ public override ICompilation ToCompilation()
if (_methodBodyFolding)
options |= RyuJitCompilationOptions.MethodBodyFolding;
- if (_singleThreaded)
- options |= RyuJitCompilationOptions.SingleThreadedCompilation;
-
if ((_mitigationOptions & SecurityMitigationOptions.ControlFlowGuardAnnotations) != 0)
options |= RyuJitCompilationOptions.ControlFlowGuardAnnotations;
@@ -117,7 +114,7 @@ public override ICompilation ToCompilation()
JitConfigProvider.Initialize(_context.Target, jitFlagBuilder.ToArray(), _ryujitOptions);
DependencyAnalyzerBase graph = CreateDependencyGraph(factory, new ObjectNode.ObjectNodeComparer(new CompilerComparer()));
- return new RyuJitCompilation(graph, factory, _compilationRoots, _ilProvider, _debugInformationProvider, _logger, _devirtualizationManager, _inliningPolicy ?? _compilationGroup, _instructionSetSupport, _profileDataManager, _methodImportationErrorProvider, options);
+ return new RyuJitCompilation(graph, factory, _compilationRoots, _ilProvider, _debugInformationProvider, _logger, _devirtualizationManager, _inliningPolicy ?? _compilationGroup, _instructionSetSupport, _profileDataManager, _methodImportationErrorProvider, options, _parallelism);
}
}
}
diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/ILCompiler.RyuJit.csproj b/src/coreclr/tools/aot/ILCompiler.RyuJit/ILCompiler.RyuJit.csproj
index efff02a77708c0..cecc90d6da81b0 100644
--- a/src/coreclr/tools/aot/ILCompiler.RyuJit/ILCompiler.RyuJit.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/ILCompiler.RyuJit.csproj
@@ -3,7 +3,7 @@
Library
ILCompiler
ILCompiler.RyuJit
- net5.0
+ net6.0
true
false
x64;x86
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun/ILCompiler.TypeSystem.ReadyToRun.csproj b/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun/ILCompiler.TypeSystem.ReadyToRun.csproj
deleted file mode 100644
index 86b9c06a6cf0d2..00000000000000
--- a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun/ILCompiler.TypeSystem.ReadyToRun.csproj
+++ /dev/null
@@ -1,647 +0,0 @@
-
-
- Library
- Internal.TypeSystem
- ILCompiler.TypeSystem.ReadyToRun
- true
- netstandard2.0
- false
- x64;x86
- AnyCPU
- false
- true
- $(DefineConstants);DISABLE_UNMANAGED_PDB_SYMBOLS
-
-
- false
- Debug;Release;Checked
-
-
-
-
- Internal.TypeSystem.Strings.resources
-
-
-
-
-
- $(SystemReflectionMetadataVersion)
-
-
- 1.3.0
-
-
-
-
- TypeSystem\Common\ArrayMethod.Diagnostic.cs
-
-
- TypeSystem\Canon\ArrayType.Canon.cs
-
-
- TypeSystem\Canon\ByRefType.Canon.cs
-
-
- TypeSystem\Canon\CanonTypes.cs
-
-
- TypeSystem\Canon\CanonTypes.Diagnostic.cs
-
-
- TypeSystem\Canon\CanonTypes.Interop.cs
-
-
- TypeSystem\Canon\CanonTypes.Sorting.cs
-
-
- TypeSystem\Canon\FunctionPointerType.Canon.cs
-
-
- TypeSystem\Canon\GenericParameterDesc.Canon.cs
-
-
- TypeSystem\Canon\StandardCanonicalizationAlgorithm.cs
-
-
- TypeSystem\Canon\DefType.Canon.cs
-
-
- TypeSystem\Canon\InstantiatedMethod.Canon.cs
-
-
- TypeSystem\Canon\InstantiatedType.Canon.cs
-
-
- TypeSystem\Canon\MetadataType.Canon.cs
-
-
- TypeSystem\Canon\MethodDelegator.Canon.cs
-
-
- TypeSystem\Canon\MethodDesc.Canon.cs
-
-
- TypeSystem\Canon\MethodForInstantiatedType.Canon.cs
-
-
- TypeSystem\Canon\ParameterizedType.Canon.cs
-
-
- TypeSystem\Canon\PointerType.Canon.cs
-
-
- TypeSystem\Canon\SignatureVariable.Canon.cs
-
-
- TypeSystem\Canon\TypeDesc.Canon.cs
-
-
- TypeSystem\Canon\TypeSystemContext.Canon.cs
-
-
- TypeSystem\CodeGen\FieldDesc.CodeGen.cs
-
-
- TypeSystem\CodeGen\MethodDelegator.CodeGen.cs
-
-
- TypeSystem\CodeGen\MethodDesc.CodeGen.cs
-
-
- TypeSystem\CodeGen\TargetDetails.CodeGen.cs
-
-
- TypeSystem\CodeGen\TypeDesc.CodeGen.cs
-
-
- Utilities\AlignmentHelper.cs
-
-
- Utilities\ArrayOfTRuntimeInterfacesAlgorithm.cs
-
-
- TypeSystem\Common\CastingHelper.cs
-
-
- TypeSystem\Common\ConstructedTypeRewritingHelpers.cs
-
-
- TypeSystem\Common\ExplicitLayoutValidator.cs
-
-
- TypeSystem\Common\FunctionPointerType.cs
-
-
- TypeSystem\Common\IAssemblyDesc.cs
-
-
- TypeSystem\Common\IModuleResolver.cs
-
-
- TypeSystem\Common\Instantiation.cs
-
-
- TypeSystem\Common\ModuleDesc.cs
-
-
- TypeSystem\Common\NotFoundBehavior.cs
-
-
- TypeSystem\Common\ResolutionFailure.cs
-
-
- TypeSystem\Common\TypeSystemEntity.cs
-
-
- TypeSystem\Common\TypeSystemException.cs
-
-
- TypeSystem\Common\TypeSystemException.Resources.cs
-
-
- TypeSystem\Common\ThrowHelper.cs
-
-
- TypeSystem\Common\ThrowHelper.Common.cs
-
-
- TypeSystem\Common\UniversalCanonLayoutAlgorithm.cs
-
-
- Utilities\CustomAttributeTypeNameFormatter.cs
-
-
- Utilities\CustomAttributeTypeNameParser.cs
-
-
- Utilities\GCPointerMap.Algorithm.cs
-
-
- Utilities\GCPointerMap.cs
-
-
- Utilities\DebugNameFormatter.cs
-
-
- Utilities\LockFreeReaderHashtable.cs
-
-
- TypeSystem\Common\ArrayType.cs
-
-
- TypeSystem\Common\BaseTypeRuntimeInterfacesAlgorithm.cs
-
-
- TypeSystem\Common\ByRefType.cs
-
-
- TypeSystem\Common\GenericParameterDesc.cs
-
-
- TypeSystem\Common\GenericParameterDesc.Diagnostic.cs
-
-
- TypeSystem\Common\ExceptionStringID.cs
-
-
- TypeSystem\Common\FieldForInstantiatedType.cs
-
-
- TypeSystem\Common\FieldDesc.cs
-
-
- TypeSystem\Common\FieldDesc.ToString.cs
-
-
- TypeSystem\Common\FieldDesc.FieldLayout.cs
-
-
- TypeSystem\Common\FieldLayoutAlgorithm.cs
-
-
- TypeSystem\Common\InstantiatedMethod.cs
-
-
- TypeSystem\Common\InstantiatedMethod.Diagnostic.cs
-
-
- TypeSystem\Common\InstantiatedType.cs
-
-
- TypeSystem\Common\InstantiatedType.Diagnostic.cs
-
-
- TypeSystem\Common\InstantiatedType.Interfaces.cs
-
-
- TypeSystem\Common\InstantiatedType.MethodImpls.cs
-
-
- TypeSystem\Common\LayoutInt.cs
-
-
- TypeSystem\Common\LinqPoison.cs
-
-
- TypeSystem\Common\MetadataType.cs
-
-
- TypeSystem\Common\DefType.Diagnostic.cs
-
-
- TypeSystem\Common\MetadataType.Interfaces.cs
-
-
- TypeSystem\Common\MetadataType.MethodImpls.cs
-
-
- TypeSystem\Common\MetadataFieldLayoutAlgorithm.cs
-
-
- TypeSystem\Common\MetadataRuntimeInterfacesAlgorithm.cs
-
-
- TypeSystem\Common\MetadataTypeSystemContext.cs
-
-
- TypeSystem\Common\MethodForInstantiatedType.cs
-
-
- TypeSystem\Common\MethodForInstantiatedType.Diagnostic.cs
-
-
- TypeSystem\Common\ParameterizedType.cs
-
-
- TypeSystem\Common\PointerType.cs
-
-
- TypeSystem\Common\PropertySignature.cs
-
-
- TypeSystem\Common\SignatureVariable.cs
-
-
- TypeSystem\Common\TargetArchitecture.cs
-
-
- TypeSystem\Common\TargetDetails.cs
-
-
- TypeSystem\Common\TargetDetails.ToString.cs
-
-
- TypeSystem\Common\ThreadSafeFlags.cs
-
-
- TypeSystem\Common\TypeFlags.cs
-
-
- TypeSystem\Common\TypeHashingAlgorithms.cs
-
-
- TypeSystem\Common\TypeSystemConstraintsHelpers.cs
-
-
- TypeSystem\Common\TypeSystemContext.cs
-
-
- TypeSystem\Common\TypeSystemHelpers.cs
-
-
- Utilities\ExceptionTypeNameFormatter.cs
-
-
- Utilities\ExceptionTypeNameFormatter.Metadata.cs
-
-
- Utilities\TypeNameFormatter.cs
-
-
- TypeSystem\Common\WellKnownType.cs
-
-
- TypeSystem\Common\VirtualMethodAlgorithm.cs
-
-
- TypeSystem\Common\MethodDelegator.cs
-
-
- TypeSystem\Common\MethodDelegator.Diagnostic.cs
-
-
- TypeSystem\Common\MethodDesc.cs
-
-
- TypeSystem\Common\MethodDesc.Diagnostic.cs
-
-
- TypeSystem\Common\MethodDesc.ToString.cs
-
-
- TypeSystem\Common\StandardVirtualMethodAlgorithm.cs
-
-
- TypeSystem\Common\TypeDesc.cs
-
-
- TypeSystem\Common\TypeDesc.ToString.cs
-
-
- TypeSystem\Common\TypeDesc.Interfaces.cs
-
-
- TypeSystem\Common\DefType.cs
-
-
- TypeSystem\Common\DefType.FieldLayout.cs
-
-
- TypeSystem\Common\RuntimeInterfacesAlgorithm.cs
-
-
- Ecma\CustomAttributeTypeProvider.cs
-
-
- Ecma\EcmaAssembly.cs
-
-
- Ecma\EcmaAssembly.Symbols.cs
-
-
- Ecma\EcmaField.Sorting.cs
-
-
- Ecma\EcmaField.CodeGen.cs
-
-
- Ecma\EcmaField.Serialization.cs
-
-
- Ecma\EcmaGenericParameter.Sorting.cs
-
-
- Ecma\EcmaMethod.Sorting.cs
-
-
- Ecma\EcmaModule.Sorting.cs
-
-
- Ecma\EcmaType.Serialization.cs
-
-
- Ecma\EcmaType.Sorting.cs
-
-
- Ecma\PrimitiveTypeProvider.cs
-
-
- Ecma\EcmaModule.Symbols.cs
-
-
- Ecma\SymbolReader\PdbSymbolReader.cs
-
-
- Ecma\SymbolReader\PortablePdbSymbolReader.cs
-
-
- Ecma\SymbolReader\UnmanagedPdbSymbolReader.cs
-
-
- Ecma\EcmaField.cs
-
-
- Ecma\EcmaGenericParameter.cs
-
-
- Ecma\EcmaGenericParameter.Diagnostic.cs
-
-
- Ecma\EcmaMethod.cs
-
-
- Ecma\EcmaMethod.cs
-
-
- Ecma\EcmaModule.cs
-
-
- Ecma\EcmaSignatureParser.cs
-
-
- Ecma\EcmaType.cs
-
-
- Ecma\EcmaType.Diagnostic.cs
-
-
- Ecma\EcmaType.MethodImpls.cs
-
-
- Ecma\EcmaType.Interfaces.cs
-
-
- Ecma\MetadataExtensions.cs
-
-
- Ecma\IMetadataStringDecoderProvider.cs
-
-
- Ecma\CachingMetadataStringDecoder.cs
-
-
- IL\EcmaMethodIL.cs
-
-
- IL\EcmaMethodIL.Symbols.cs
-
-
- IL\MethodIL.cs
-
-
- IL\MethodIL.Symbols.cs
-
-
- IL\MethodILDebugView.cs
-
-
- IL\ILDisassembler.cs
-
-
- IL\InstantiatedMethodIL.cs
-
-
- IL\ILStackHelper.cs
-
-
- IL\ILOpcode.cs
-
-
- IL\ILOpcodeHelper.cs
-
-
- IL\Stubs\ILEmitter.cs
-
-
- IL\Stubs\PInvokeTargetNativeMethod.cs
-
-
- IL\Stubs\PInvokeTargetNativeMethod.Diagnostic.cs
-
-
- IL\Stubs\PInvokeTargetNativeMethod.Mangling.cs
-
-
- IL\Stubs\PInvokeTargetNativeMethod.Sorting.cs
-
-
- TypeSystem\CodeGen\FieldDesc.Serialization.cs
-
-
- TypeSystem\CodeGen\TypeDesc.Serialization.cs
-
-
- TypeSystem\Sorting\FieldDesc.Sorting.cs
-
-
- TypeSystem\Sorting\FieldForInstantiatedType.Sorting.cs
-
-
- TypeSystem\Sorting\InstantiatedMethod.Sorting.cs
-
-
- TypeSystem\Sorting\MethodDesc.Sorting.cs
-
-
- TypeSystem\Sorting\MethodForInstantiatedType.Sorting.cs
-
-
- TypeSystem\Interop\FieldDesc.Interop.cs
-
-
- TypeSystem\Interop\InstantiatedType.Interop.cs
-
-
- TypeSystem\Interop\MetadataType.Interop.cs
-
-
- TypeSystem\Interop\MethodDelegator.Interop.cs
-
-
- TypeSystem\Interop\MethodDesc.Interop.cs
-
-
- TypeSystem\Interop\MarshalAsDescriptor.cs
-
-
- TypeSystem\Mangling\IPrefixMangledMethod.cs
-
-
- TypeSystem\Mangling\IPrefixMangledType.cs
-
-
- TypeSystem\Mangling\IPrefixMangledSignature.cs
-
-
- Utilities\ArrayBuilder.cs
-
-
- TypeSystem\Common\LocalVariableDefinition.cs
-
-
- TypeSystem\RuntimeDetermined\ArrayType.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\ByRefType.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\FieldDesc.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\FunctionPointerType.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\MethodDesc.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\PointerType.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\MethodForRuntimeDeterminedType.cs
-
-
- TypeSystem\RuntimeDetermined\MethodForRuntimeDeterminedType.cs
-
-
- TypeSystem\RuntimeDetermined\MethodForRuntimeDeterminedType.Sorting.cs
-
-
- TypeSystem\RuntimeDetermined\RuntimeDeterminedCanonicalizationAlgorithm.cs
-
-
- TypeSystem\RuntimeDetermined\RuntimeDeterminedFieldLayoutAlgorithm.cs
-
-
- TypeSystem\RuntimeDetermined\DefType.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\GenericParameterDesc.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\ParameterizedType.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\RuntimeDeterminedType.cs
-
-
- TypeSystem\RuntimeDetermined\RuntimeDeterminedType.Diagnostic.cs
-
-
- TypeSystem\RuntimeDetermined\RuntimeDeterminedType.Sorting.cs
-
-
- TypeSystem\RuntimeDetermined\RuntimeDeterminedTypeUtilities.cs
-
-
- TypeSystem\RuntimeDetermined\SignatureVariable.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\TypeDesc.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\TypeSystemContext.RuntimeDetermined.cs
-
-
- Common\System\FormattingHelpers.cs
-
-
- TypeSystem\Sorting\ArrayType.Sorting.cs
-
-
- TypeSystem\Sorting\ByRefType.Sorting.cs
-
-
- TypeSystem\Sorting\FunctionPointerType.Sorting.cs
-
-
- TypeSystem\Sorting\InstantiatedType.Sorting.cs
-
-
- TypeSystem\Sorting\MethodSignature.Sorting.cs
-
-
- TypeSystem\Sorting\PointerType.Sorting.cs
-
-
- TypeSystem\Sorting\SignatureVariable.Sorting.cs
-
-
- TypeSystem\Sorting\TypeDesc.Sorting.cs
-
-
- TypeSystem\Sorting\TypeSystemComparer.cs
-
-
-
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ArchitectureSpecificFieldLayoutTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ArchitectureSpecificFieldLayoutTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ArchitectureSpecificFieldLayoutTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ArchitectureSpecificFieldLayoutTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CanonicalizationTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CanonicalizationTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CanonicalizationTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CanonicalizationTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CastingTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CastingTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CastingTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CastingTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ConstraintsValidationTest.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ConstraintsValidationTest.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ConstraintsValidationTest.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ConstraintsValidationTest.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Canonicalization.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Canonicalization.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Canonicalization.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Canonicalization.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Casting.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Casting.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Casting.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Casting.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/CoreTestAssembly.csproj b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/CoreTestAssembly.csproj
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/CoreTestAssembly.csproj
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/CoreTestAssembly.csproj
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/GCPointerMap.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/GCPointerMap.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/GCPointerMap.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/GCPointerMap.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/GenericConstraints.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/GenericConstraints.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/GenericConstraints.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/GenericConstraints.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/GenericTypes.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/GenericTypes.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/GenericTypes.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/GenericTypes.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Hashcode.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Hashcode.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Hashcode.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Hashcode.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/InstanceFieldLayout.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/InstanceFieldLayout.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/InstanceFieldLayout.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/InstanceFieldLayout.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/InterfaceArrangements.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/InterfaceArrangements.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/InterfaceArrangements.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/InterfaceArrangements.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Marshalling.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Marshalling.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Marshalling.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Marshalling.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Platform.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Platform.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Platform.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Platform.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/StaticFieldLayout.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/StaticFieldLayout.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/StaticFieldLayout.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/StaticFieldLayout.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/SyntheticVirtualOverride.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/SyntheticVirtualOverride.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/SyntheticVirtualOverride.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/SyntheticVirtualOverride.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/TypeNameParsing.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/TypeNameParsing.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/TypeNameParsing.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/TypeNameParsing.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/ValueTypeShapeCharacteristics.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/ValueTypeShapeCharacteristics.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/ValueTypeShapeCharacteristics.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/ValueTypeShapeCharacteristics.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/VirtualFunctionOverride.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/VirtualFunctionOverride.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/VirtualFunctionOverride.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/VirtualFunctionOverride.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/DefType.FieldLayoutTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/DefType.FieldLayoutTests.cs
similarity index 98%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/DefType.FieldLayoutTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/DefType.FieldLayoutTests.cs
index c82f6c21a85be8..f41f4a7ea63068 100644
--- a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/DefType.FieldLayoutTests.cs
+++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/DefType.FieldLayoutTests.cs
@@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
using Internal.TypeSystem;
-using Internal.TypeSystem.Interop;
using Xunit;
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ExceptionStringTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ExceptionStringTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ExceptionStringTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ExceptionStringTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/GCPointerMapTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/GCPointerMapTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/GCPointerMapTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/GCPointerMapTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/GenericTypeAndMethodTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/GenericTypeAndMethodTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/GenericTypeAndMethodTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/GenericTypeAndMethodTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/HashcodeTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/HashcodeTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/HashcodeTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/HashcodeTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILCompiler.TypeSystem.ReadyToRun.Tests.csproj b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILCompiler.TypeSystem.Tests.csproj
similarity index 78%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILCompiler.TypeSystem.ReadyToRun.Tests.csproj
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILCompiler.TypeSystem.Tests.csproj
index 558daa29f76b70..767680f651aacd 100644
--- a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILCompiler.TypeSystem.ReadyToRun.Tests.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILCompiler.TypeSystem.Tests.csproj
@@ -1,6 +1,6 @@
- ILCompiler.TypeSystem.ReadyToRun.Tests
+ ILCompiler.TypeSystem.Tests
$(NetCoreAppToolCurrent)
Debug;Release;Checked
@@ -14,6 +14,9 @@
AnyCPU;x64
AnyCPU
true
+
+
+ READYTORUN;$(DefineConstants)
@@ -23,8 +26,7 @@
-
-
+
false
@@ -40,6 +42,11 @@
+
+
+
+
+
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILDisassemblerTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILDisassemblerTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILDisassemblerTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILDisassemblerTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/ILDisassembler.il b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/ILDisassembler.il
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/ILDisassembler.il
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/ILDisassembler.il
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/ILTestAssembly.ilproj b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/ILTestAssembly.ilproj
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/ILTestAssembly.ilproj
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/ILTestAssembly.ilproj
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/InstanceFieldLayout.il b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/InstanceFieldLayout.il
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/InstanceFieldLayout.il
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/InstanceFieldLayout.il
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/MDArrayFunctionResolution.il b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/MDArrayFunctionResolution.il
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/MDArrayFunctionResolution.il
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/MDArrayFunctionResolution.il
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/Main.il b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/Main.il
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/Main.il
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/Main.il
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/MethodImplOverride1.il b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/MethodImplOverride1.il
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/MethodImplOverride1.il
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/MethodImplOverride1.il
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/Signature.il b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/Signature.il
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/Signature.il
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/Signature.il
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/StaticFieldLayout.il b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/StaticFieldLayout.il
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/StaticFieldLayout.il
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/StaticFieldLayout.il
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/VirtualFunctionOverride.il b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/VirtualFunctionOverride.il
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/VirtualFunctionOverride.il
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/VirtualFunctionOverride.il
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/InstanceFieldLayoutTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/InstanceFieldLayoutTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/InstanceFieldLayoutTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/InstanceFieldLayoutTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/InterfacesTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/InterfacesTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/InterfacesTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/InterfacesTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/MarshalUtilsTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/MarshalUtilsTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/MarshalUtilsTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/MarshalUtilsTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/RuntimeDeterminedTypesTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/RuntimeDeterminedTypesTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/RuntimeDeterminedTypesTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/RuntimeDeterminedTypesTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/SignatureTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/SignatureTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/SignatureTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/SignatureTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/StaticFieldLayoutTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/StaticFieldLayoutTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/StaticFieldLayoutTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/StaticFieldLayoutTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/SyntheticVirtualOverrideTests.DiagnosticName.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/SyntheticVirtualOverrideTests.DiagnosticName.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/SyntheticVirtualOverrideTests.DiagnosticName.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/SyntheticVirtualOverrideTests.DiagnosticName.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/SyntheticVirtualOverrideTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/SyntheticVirtualOverrideTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/SyntheticVirtualOverrideTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/SyntheticVirtualOverrideTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/TestMetadataFieldLayoutAlgorithm.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TestMetadataFieldLayoutAlgorithm.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/TestMetadataFieldLayoutAlgorithm.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TestMetadataFieldLayoutAlgorithm.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/TestTypeSystemContext.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TestTypeSystemContext.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/TestTypeSystemContext.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TestTypeSystemContext.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/TypeNameParsingTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TypeNameParsingTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/TypeNameParsingTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TypeNameParsingTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/UniversalGenericFieldLayoutTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/UniversalGenericFieldLayoutTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/UniversalGenericFieldLayoutTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/UniversalGenericFieldLayoutTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ValueTypeShapeCharacteristicsTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ValueTypeShapeCharacteristicsTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ValueTypeShapeCharacteristicsTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ValueTypeShapeCharacteristicsTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/VirtualFunctionOverrideTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/VirtualFunctionOverrideTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/VirtualFunctionOverrideTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/VirtualFunctionOverrideTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/WellKnownTypeTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/WellKnownTypeTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/WellKnownTypeTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/WellKnownTypeTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem/ILCompiler.TypeSystem.csproj b/src/coreclr/tools/aot/ILCompiler.TypeSystem/ILCompiler.TypeSystem.csproj
index 4aa53fd19c5e11..bf9a6275d972b7 100644
--- a/src/coreclr/tools/aot/ILCompiler.TypeSystem/ILCompiler.TypeSystem.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem/ILCompiler.TypeSystem.csproj
@@ -9,6 +9,8 @@
x64;x86
AnyCPU
false
+ true
+ $(DefineConstants);DISABLE_UNMANAGED_PDB_SYMBOLS
- win-$(TargetArchitecture)
- linux-$(TargetArchitecture)
- osx-$(TargetArchitecture)
+ $(ToolsRID)
diff --git a/src/coreclr/tools/aot/ILCompiler/Program.cs b/src/coreclr/tools/aot/ILCompiler/Program.cs
index 007c3787df15f5..e973c05b08c2c6 100644
--- a/src/coreclr/tools/aot/ILCompiler/Program.cs
+++ b/src/coreclr/tools/aot/ILCompiler/Program.cs
@@ -57,9 +57,10 @@ internal class Program
private bool _reflectedOnly;
private bool _scanReflection;
private bool _methodBodyFolding;
- private bool _singleThreaded;
+ private int _parallelism = Environment.ProcessorCount;
private string _instructionSet;
private string _guard;
+ private int _maxGenericCycle = CompilerTypeSystemContext.DefaultGenericCycleCutoffPoint;
private string _singleMethodTypeName;
private string _singleMethodName;
@@ -205,7 +206,7 @@ private ArgumentSyntax ParseCommandLine(string[] args)
syntax.DefineOptionList("appcontextswitch", ref _appContextSwitches, "System.AppContext switches to set (format: 'Key=Value')");
syntax.DefineOptionList("feature", ref _featureSwitches, "Feature switches to apply (format: 'Namespace.Name=[true|false]'");
syntax.DefineOptionList("runtimeopt", ref _runtimeOptions, "Runtime options to set");
- syntax.DefineOption("singlethreaded", ref _singleThreaded, "Run compilation on a single thread");
+ syntax.DefineOption("parallelism", ref _parallelism, "Maximum number of threads to use during compilation");
syntax.DefineOption("instructionset", ref _instructionSet, "Instruction set to allow or disallow");
syntax.DefineOption("guard", ref _guard, "Enable mitigations. Options: 'cf': CFG (Control Flow Guard, Windows only)");
syntax.DefineOption("preinitstatics", ref _preinitStatics, "Interpret static constructors at compile time if possible (implied by -O)");
@@ -216,7 +217,7 @@ private ArgumentSyntax ParseCommandLine(string[] args)
syntax.DefineOptionList("nosinglewarnassembly", ref _singleWarnDisabledAssemblies, "Expand AOT/trimming warnings for given assembly");
syntax.DefineOptionList("directpinvoke", ref _directPInvokes, "PInvoke to call directly");
syntax.DefineOptionList("directpinvokelist", ref _directPInvokeLists, "File with list of PInvokes to call directly");
-
+ syntax.DefineOption("maxgenericcycle", ref _maxGenericCycle, "Max depth of generic cycle");
syntax.DefineOptionList("root", ref _rootedAssemblies, "Fully generate given assembly");
syntax.DefineOptionList("conditionalroot", ref _conditionallyRootedAssemblies, "Fully generate given assembly if it's used");
syntax.DefineOptionList("trim", ref _trimmedAssemblies, "Trim the specified assembly");
@@ -270,7 +271,7 @@ private ArgumentSyntax ParseCommandLine(string[] args)
return argSyntax;
}
- private IReadOnlyCollection CreateInitializerList(TypeSystemContext context)
+ private IReadOnlyCollection CreateInitializerList(CompilerTypeSystemContext context)
{
List assembliesWithInitalizers = new List();
@@ -278,7 +279,7 @@ private IReadOnlyCollection CreateInitializerList(TypeSystemContext
// any user code runs.
foreach (string initAssemblyName in _initAssemblies)
{
- ModuleDesc assembly = context.ResolveAssembly(new AssemblyName(initAssemblyName));
+ ModuleDesc assembly = context.ResolveAssembly(new AssemblyName(initAssemblyName), throwIfNotFound: true);
assembliesWithInitalizers.Add(assembly);
}
@@ -419,13 +420,14 @@ private int Run(string[] args)
optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("popcnt");
optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("lzcnt");
- // If AVX was enabled, we can opportunistically enable FMA/BMI
+ // If AVX was enabled, we can opportunistically enable FMA/BMI/VNNI
Debug.Assert(InstructionSet.X64_AVX == InstructionSet.X86_AVX);
if (supportedInstructionSet.HasInstructionSet(InstructionSet.X64_AVX))
{
optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("fma");
optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("bmi");
optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("bmi2");
+ optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("avxvnni");
}
}
else if (_targetArchitecture == TargetArchitecture.ARM64)
@@ -460,7 +462,7 @@ private int Run(string[] args)
var targetAbi = TargetAbi.CoreRT;
var targetDetails = new TargetDetails(_targetArchitecture, _targetOS, targetAbi, simdVectorLength);
CompilerTypeSystemContext typeSystemContext =
- new CompilerTypeSystemContext(targetDetails, genericsMode, supportsReflection ? DelegateFeature.All : 0);
+ new CompilerTypeSystemContext(targetDetails, genericsMode, supportsReflection ? DelegateFeature.All : 0, _maxGenericCycle);
//
// TODO: To support our pre-compiled test tree, allow input files that aren't managed assemblies since
@@ -703,7 +705,7 @@ static string ILLinkify(string rootedAssembly)
_trimmedAssemblies);
InteropStateManager interopStateManager = new InteropStateManager(typeSystemContext.GeneratedAssembly);
- InteropStubManager interopStubManager = new UsageBasedInteropStubManager(interopStateManager, pinvokePolicy);
+ InteropStubManager interopStubManager = new UsageBasedInteropStubManager(interopStateManager, pinvokePolicy, logger);
// Unless explicitly opted in at the command line, we enable scanner for retail builds by default.
// We also don't do this for multifile because scanner doesn't simulate inlining (this would be
@@ -730,7 +732,7 @@ static string ILLinkify(string rootedAssembly)
ILScannerBuilder scannerBuilder = builder.GetILScannerBuilder()
.UseCompilationRoots(compilationRoots)
.UseMetadataManager(metadataManager)
- .UseSingleThread(enable: _singleThreaded)
+ .UseParallelism(_parallelism)
.UseInteropStubManager(interopStubManager);
if (_scanDgmlLogFileName != null)
@@ -759,7 +761,7 @@ static string ILLinkify(string rootedAssembly)
.UseInstructionSetSupport(instructionSetSupport)
.UseBackendOptions(_codegenOptions)
.UseMethodBodyFolding(enable: _methodBodyFolding)
- .UseSingleThread(enable: _singleThreaded)
+ .UseParallelism(_parallelism)
.UseMetadataManager(metadataManager)
.UseInteropStubManager(interopStubManager)
.UseLogger(logger)
diff --git a/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj b/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj
index 0194a7f6e43201..c0df3bfd2c6ee3 100644
--- a/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj
+++ b/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj
@@ -9,6 +9,7 @@
linux-x64;win-x64;osx-x64
Debug;Release;Checked
true
+ false
P/invoke method '{0}' declares a parameter with COM marshalling. Correctness of COM interop cannot be guaranteed after trimming. Interfaces and interface members might be removed.
+
+ P/invoke method '{0}' declares a parameter with an abstract delegate. Correctness of interop for abstract delegates cannot be guaranteed after native compilation: the marshalling code for the delegate might not be available. Use a non-abstract delegate type or ensure any delegate instance passed as parameter is marked with `UnmanagedFunctionPointerAttribute`.
+
diff --git a/src/coreclr/tools/aot/crossgen2.sln b/src/coreclr/tools/aot/crossgen2.sln
index 4727feaef44e4f..ee4d3a0973f014 100644
--- a/src/coreclr/tools/aot/crossgen2.sln
+++ b/src/coreclr/tools/aot/crossgen2.sln
@@ -8,14 +8,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.DependencyAnalys
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.ReadyToRun", "ILCompiler.ReadyToRun\ILCompiler.ReadyToRun.csproj", "{83A832DE-BF4A-44C4-B361-90F5F88B979B}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.TypeSystem.ReadyToRun", "ILCompiler.TypeSystem.ReadyToRun\ILCompiler.TypeSystem.ReadyToRun.csproj", "{751583CD-E880-49E1-B3E2-8B1990114CAC}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.TypeSystem.ReadyToRun.Tests", "ILCompiler.TypeSystem.ReadyToRun.Tests\ILCompiler.TypeSystem.ReadyToRun.Tests.csproj", "{1043373D-8C14-4224-9E2B-75F0DE645E7E}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.Diagnostics", "ILCompiler.Diagnostics\ILCompiler.Diagnostics.csproj", "{3EACD929-4725-4173-A845-734936BBDF87}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.Reflection.ReadyToRun", "ILCompiler.Reflection.ReadyToRun\ILCompiler.Reflection.ReadyToRun.csproj", "{0BB34BA1-1B3A-445C-9C04-0D710D1983F0}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.TypeSystem", "ILCompiler.TypeSystem\ILCompiler.TypeSystem.csproj", "{C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.TypeSystem.Tests", "ILCompiler.TypeSystem.Tests\ILCompiler.TypeSystem.Tests.csproj", "{9E65EC58-B500-4C4A-B57D-BF242129A3C6}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Checked|Any CPU = Checked|Any CPU
@@ -74,39 +74,6 @@ Global
{83A832DE-BF4A-44C4-B361-90F5F88B979B}.Release|x64.Build.0 = Release|x64
{83A832DE-BF4A-44C4-B361-90F5F88B979B}.Release|x86.ActiveCfg = Release|x86
{83A832DE-BF4A-44C4-B361-90F5F88B979B}.Release|x86.Build.0 = Release|x86
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Checked|Any CPU.ActiveCfg = Checked|x86
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Checked|x64.ActiveCfg = Checked|x64
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Checked|x64.Build.0 = Checked|x64
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Checked|x86.ActiveCfg = Checked|x86
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Checked|x86.Build.0 = Checked|x86
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Debug|Any CPU.ActiveCfg = Debug|x86
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Debug|x64.ActiveCfg = Debug|x64
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Debug|x64.Build.0 = Debug|x64
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Debug|x86.ActiveCfg = Debug|x86
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Debug|x86.Build.0 = Debug|x86
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Release|Any CPU.ActiveCfg = Release|x86
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Release|x64.ActiveCfg = Release|x64
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Release|x64.Build.0 = Release|x64
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Release|x86.ActiveCfg = Release|x86
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Release|x86.Build.0 = Release|x86
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Checked|Any CPU.ActiveCfg = Checked|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Checked|Any CPU.Build.0 = Checked|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Checked|x64.ActiveCfg = Checked|x64
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Checked|x64.Build.0 = Checked|x64
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Checked|x86.ActiveCfg = Checked|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Checked|x86.Build.0 = Checked|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Debug|x64.ActiveCfg = Debug|x64
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Debug|x64.Build.0 = Debug|x64
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Debug|x86.ActiveCfg = Debug|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Debug|x86.Build.0 = Debug|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Release|Any CPU.Build.0 = Release|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Release|x64.ActiveCfg = Release|x64
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Release|x64.Build.0 = Release|x64
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Release|x86.ActiveCfg = Release|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Release|x86.Build.0 = Release|Any CPU
{3EACD929-4725-4173-A845-734936BBDF87}.Checked|Any CPU.ActiveCfg = Debug|x86
{3EACD929-4725-4173-A845-734936BBDF87}.Checked|x64.ActiveCfg = Debug|x64
{3EACD929-4725-4173-A845-734936BBDF87}.Checked|x64.Build.0 = Debug|x64
@@ -142,6 +109,42 @@ Global
{0BB34BA1-1B3A-445C-9C04-0D710D1983F0}.Release|x64.Build.0 = Release|x64
{0BB34BA1-1B3A-445C-9C04-0D710D1983F0}.Release|x86.ActiveCfg = Release|Any CPU
{0BB34BA1-1B3A-445C-9C04-0D710D1983F0}.Release|x86.Build.0 = Release|Any CPU
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Checked|Any CPU.ActiveCfg = Checked|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Checked|Any CPU.Build.0 = Checked|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Checked|x64.ActiveCfg = Checked|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Checked|x64.Build.0 = Checked|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Checked|x86.ActiveCfg = Checked|x86
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Checked|x86.Build.0 = Checked|x86
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Debug|Any CPU.ActiveCfg = Debug|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Debug|Any CPU.Build.0 = Debug|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Debug|x64.ActiveCfg = Debug|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Debug|x64.Build.0 = Debug|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Debug|x86.ActiveCfg = Debug|x86
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Debug|x86.Build.0 = Debug|x86
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Release|Any CPU.ActiveCfg = Release|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Release|Any CPU.Build.0 = Release|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Release|x64.ActiveCfg = Release|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Release|x64.Build.0 = Release|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Release|x86.ActiveCfg = Release|x86
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Release|x86.Build.0 = Release|x86
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Checked|Any CPU.ActiveCfg = Checked|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Checked|Any CPU.Build.0 = Checked|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Checked|x64.ActiveCfg = Checked|x64
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Checked|x64.Build.0 = Checked|x64
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Checked|x86.ActiveCfg = Checked|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Checked|x86.Build.0 = Checked|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Debug|x64.ActiveCfg = Debug|x64
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Debug|x64.Build.0 = Debug|x64
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Debug|x86.Build.0 = Debug|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Release|x64.ActiveCfg = Release|x64
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Release|x64.Build.0 = Release|x64
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Release|x86.ActiveCfg = Release|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/coreclr/tools/aot/crossgen2/Program.cs b/src/coreclr/tools/aot/crossgen2/Program.cs
index d4c693805f5e20..ff538c05fd64c4 100644
--- a/src/coreclr/tools/aot/crossgen2/Program.cs
+++ b/src/coreclr/tools/aot/crossgen2/Program.cs
@@ -736,7 +736,6 @@ private void RunSingleCompilation(Dictionary inFilePaths, Instru
.UsePdbFile(_commandLineOptions.Pdb, _commandLineOptions.PdbPath)
.UsePerfMapFile(_commandLineOptions.PerfMap, _commandLineOptions.PerfMapPath, _commandLineOptions.PerfMapFormatVersion)
.UseProfileFile(jsonProfile != null)
- .UseParallelism(_commandLineOptions.Parallelism)
.UseProfileData(profileDataManager)
.FileLayoutAlgorithms(_methodLayout, _fileLayout)
.UseCompositeImageSettings(compositeImageSettings)
@@ -748,6 +747,7 @@ private void RunSingleCompilation(Dictionary inFilePaths, Instru
.UseILProvider(ilProvider)
.UseBackendOptions(_commandLineOptions.CodegenOptions)
.UseLogger(logger)
+ .UseParallelism(_commandLineOptions.Parallelism)
.UseDependencyTracking(trackingLevel)
.UseCompilationRoots(compilationRoots)
.UseOptimizationMode(optimizationMode);
diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2.props b/src/coreclr/tools/aot/crossgen2/crossgen2.props
index e69b66ceecb3e2..2d6e9dff4072d9 100644
--- a/src/coreclr/tools/aot/crossgen2/crossgen2.props
+++ b/src/coreclr/tools/aot/crossgen2/crossgen2.props
@@ -29,7 +29,7 @@
-
+
diff --git a/src/coreclr/tools/aot/ilc.sln b/src/coreclr/tools/aot/ilc.sln
index be90b9bc202d73..b1c7181908a26d 100644
--- a/src/coreclr/tools/aot/ilc.sln
+++ b/src/coreclr/tools/aot/ilc.sln
@@ -20,6 +20,8 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ILLink.Shared", "ILLink.Sha
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.Compiler.Tests", "ILCompiler.Compiler.Tests\ILCompiler.Compiler.Tests.csproj", "{24CBA9C6-EDBA-47D6-A0B5-04417BDE5FE3}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.TypeSystem.Tests", "ILCompiler.TypeSystem.Tests\ILCompiler.TypeSystem.Tests.csproj", "{740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}"
+EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
ILLink.Shared\ILLink.Shared.projitems*{ff598e93-8e9e-4091-9f50-61a7572663ae}*SharedItemsImports = 13
@@ -160,6 +162,24 @@ Global
{24CBA9C6-EDBA-47D6-A0B5-04417BDE5FE3}.Release|x64.Build.0 = Release|x64
{24CBA9C6-EDBA-47D6-A0B5-04417BDE5FE3}.Release|x86.ActiveCfg = Release|x86
{24CBA9C6-EDBA-47D6-A0B5-04417BDE5FE3}.Release|x86.Build.0 = Release|x86
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Checked|Any CPU.ActiveCfg = Checked|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Checked|Any CPU.Build.0 = Checked|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Checked|x64.ActiveCfg = Checked|x64
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Checked|x64.Build.0 = Checked|x64
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Checked|x86.ActiveCfg = Checked|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Checked|x86.Build.0 = Checked|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Debug|x64.ActiveCfg = Debug|x64
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Debug|x64.Build.0 = Debug|x64
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Debug|x86.Build.0 = Debug|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Release|x64.ActiveCfg = Release|x64
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Release|x64.Build.0 = Release|x64
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Release|x86.ActiveCfg = Release|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/coreclr/tools/aot/jitinterface/jitinterface.h b/src/coreclr/tools/aot/jitinterface/jitinterface.h
index f0158199fea1a3..14286588063b23 100644
--- a/src/coreclr/tools/aot/jitinterface/jitinterface.h
+++ b/src/coreclr/tools/aot/jitinterface/jitinterface.h
@@ -159,7 +159,6 @@ struct JitInterfaceCallbacks
InfoAccessType (* constructStringLiteral)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_MODULE_HANDLE module, unsigned int metaTok, void** ppValue);
InfoAccessType (* emptyStringLiteral)(void * thisHandle, CorInfoExceptionClass** ppException, void** ppValue);
uint32_t (* getFieldThreadLocalStoreID)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_FIELD_HANDLE field, void** ppIndirection);
- void (* setOverride)(void * thisHandle, CorInfoExceptionClass** ppException, ICorDynamicInfo* pOverride, CORINFO_METHOD_HANDLE currentMethod);
void (* addActiveDependency)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_MODULE_HANDLE moduleFrom, CORINFO_MODULE_HANDLE moduleTo);
CORINFO_METHOD_HANDLE (* GetDelegateCtor)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE methHnd, CORINFO_CLASS_HANDLE clsHnd, CORINFO_METHOD_HANDLE targetMethodHnd, DelegateCtorArgs* pCtorData);
void (* MethodCompileComplete)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE methHnd);
@@ -1617,15 +1616,6 @@ class JitInterfaceWrapper : public ICorJitInfo
return temp;
}
- virtual void setOverride(
- ICorDynamicInfo* pOverride,
- CORINFO_METHOD_HANDLE currentMethod)
-{
- CorInfoExceptionClass* pException = nullptr;
- _callbacks->setOverride(_thisHandle, &pException, pOverride, currentMethod);
- if (pException != nullptr) throw pException;
-}
-
virtual void addActiveDependency(
CORINFO_MODULE_HANDLE moduleFrom,
CORINFO_MODULE_HANDLE moduleTo)
diff --git a/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj b/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj
index c957bcd1b8a9e5..5e27eb6011b4cd 100644
--- a/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj
+++ b/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj
@@ -56,7 +56,7 @@
-
+
diff --git a/src/coreclr/tools/dotnet-pgo/dotnet-pgo.sln b/src/coreclr/tools/dotnet-pgo/dotnet-pgo.sln
index 3d5a6f3b1ad1d7..45bc67bf401400 100644
--- a/src/coreclr/tools/dotnet-pgo/dotnet-pgo.sln
+++ b/src/coreclr/tools/dotnet-pgo/dotnet-pgo.sln
@@ -1,13 +1,13 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.30114.105
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.32014.148
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-pgo", "dotnet-pgo.csproj", "{7DA4CC22-F01D-4505-845F-57C06E5C3F9F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.Reflection.ReadyToRun", "..\aot\ILCompiler.Reflection.ReadyToRun\ILCompiler.Reflection.ReadyToRun.csproj", "{ED3FE303-74EB-43D1-BEA1-14484A14B22E}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.TypeSystem.ReadyToRun", "..\aot\ILCompiler.TypeSystem.ReadyToRun\ILCompiler.TypeSystem.ReadyToRun.csproj", "{D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.TypeSystem", "..\aot\ILCompiler.TypeSystem\ILCompiler.TypeSystem.csproj", "{8A811180-D605-469B-9693-EC3915B3E0DC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -58,21 +58,24 @@ Global
{ED3FE303-74EB-43D1-BEA1-14484A14B22E}.Release|x64.Build.0 = Release|x64
{ED3FE303-74EB-43D1-BEA1-14484A14B22E}.Release|x86.ActiveCfg = Release|Any CPU
{ED3FE303-74EB-43D1-BEA1-14484A14B22E}.Release|x86.Build.0 = Release|Any CPU
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Checked|Any CPU.ActiveCfg = Checked|x86
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Checked|x64.ActiveCfg = Checked|x64
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Checked|x64.Build.0 = Checked|x64
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Checked|x86.ActiveCfg = Checked|x86
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Checked|x86.Build.0 = Checked|x86
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Debug|Any CPU.ActiveCfg = Debug|x86
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Debug|x64.ActiveCfg = Debug|x64
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Debug|x64.Build.0 = Debug|x64
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Debug|x86.ActiveCfg = Debug|x86
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Debug|x86.Build.0 = Debug|x86
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Release|Any CPU.ActiveCfg = Release|x86
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Release|x64.ActiveCfg = Release|x64
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Release|x64.Build.0 = Release|x64
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Release|x86.ActiveCfg = Release|x86
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Release|x86.Build.0 = Release|x86
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Checked|Any CPU.ActiveCfg = Checked|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Checked|Any CPU.Build.0 = Checked|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Checked|x64.ActiveCfg = Checked|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Checked|x64.Build.0 = Checked|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Checked|x86.ActiveCfg = Checked|x86
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Checked|x86.Build.0 = Checked|x86
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Debug|Any CPU.ActiveCfg = Debug|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Debug|Any CPU.Build.0 = Debug|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Debug|x64.ActiveCfg = Debug|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Debug|x64.Build.0 = Debug|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Debug|x86.ActiveCfg = Debug|x86
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Debug|x86.Build.0 = Debug|x86
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Release|Any CPU.ActiveCfg = Release|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Release|Any CPU.Build.0 = Release|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Release|x64.ActiveCfg = Release|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Release|x64.Build.0 = Release|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Release|x86.ActiveCfg = Release|x86
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/coreclr/tools/metainfo/mdinfo.cpp b/src/coreclr/tools/metainfo/mdinfo.cpp
index 24c782b4076d9e..8351b8de24bf1b 100644
--- a/src/coreclr/tools/metainfo/mdinfo.cpp
+++ b/src/coreclr/tools/metainfo/mdinfo.cpp
@@ -204,7 +204,7 @@ void MDInfo::InitSigBuffer()
// helper to append a string into the signature buffer. If size of signature buffer is not big enough,
// we will grow it.
-HRESULT MDInfo::AddToSigBuffer(__in_z __in const char *string)
+HRESULT MDInfo::AddToSigBuffer(_In_z_ const char *string)
{
HRESULT hr;
size_t LL = strlen((LPSTR)m_sigBuf.Ptr()) + strlen(string) + 1;
@@ -368,7 +368,7 @@ void MDInfo::DisplayMD()
WriteLine("===========================================================");
} // MDVEHandlerClass()
-int MDInfo::WriteLine(__in_z __in const char *str)
+int MDInfo::WriteLine(_In_z_ const char *str)
{
ULONG32 count = (ULONG32) strlen(str);
@@ -377,7 +377,7 @@ int MDInfo::WriteLine(__in_z __in const char *str)
return count;
} // int MDInfo::WriteLine()
-int MDInfo::Write(__in_z __in const char *str)
+int MDInfo::Write(_In_z_ const char *str)
{
ULONG32 count = (ULONG32) strlen(str);
@@ -385,7 +385,7 @@ int MDInfo::Write(__in_z __in const char *str)
return count;
} // int MDInfo::Write()
-int MDInfo::VWriteLine(__in_z __in const char *str, ...)
+int MDInfo::VWriteLine(_In_z_ const char *str, ...)
{
va_list marker;
int count;
@@ -397,7 +397,7 @@ int MDInfo::VWriteLine(__in_z __in const char *str, ...)
return count;
} // int MDInfo::VWriteLine()
-int MDInfo::VWrite(__in_z __in const char *str, ...)
+int MDInfo::VWrite(_In_z_ const char *str, ...)
{
va_list marker;
int count;
@@ -408,7 +408,7 @@ int MDInfo::VWrite(__in_z __in const char *str, ...)
return count;
} // int MDInfo::VWrite()
-int MDInfo::VWriteMarker(__in_z __in const char *str, va_list marker)
+int MDInfo::VWriteMarker(_In_z_ const char *str, va_list marker)
{
HRESULT hr;
int count = -1;
@@ -561,7 +561,7 @@ const char *MDInfo::TokenTypeName(mdToken inToken)
// Prints out name of the given memberref
//
-LPCWSTR MDInfo::MemberRefName(mdMemberRef inMemRef, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen)
+LPCWSTR MDInfo::MemberRefName(mdMemberRef inMemRef, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen)
{
HRESULT hr;
@@ -829,7 +829,7 @@ void MDInfo::DisplaySignatureInfo(mdSignature inSignature)
// member in wide characters
//
-LPCWSTR MDInfo::MemberName(mdToken inToken, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen)
+LPCWSTR MDInfo::MemberName(mdToken inToken, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen)
{
HRESULT hr;
@@ -1312,7 +1312,7 @@ void MDInfo::DisplayGenericParamInfo(mdGenericParam tkParam, const char *prefix)
DisplayCustomAttributes(tkParam, newprefix);
}
-LPCWSTR MDInfo::TokenName(mdToken inToken, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen)
+LPCWSTR MDInfo::TokenName(mdToken inToken, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen)
{
LPCUTF8 pName; // Token name in UTF8.
@@ -1329,7 +1329,7 @@ LPCWSTR MDInfo::TokenName(mdToken inToken, __out_ecount(bufLen) LPWSTR buffer, U
// prints out name of typeref or typedef
//
-LPCWSTR MDInfo::TypeDeforRefName(mdToken inToken, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen)
+LPCWSTR MDInfo::TypeDeforRefName(mdToken inToken, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen)
{
if (RidFromToken(inToken))
{
@@ -1346,7 +1346,7 @@ LPCWSTR MDInfo::TypeDeforRefName(mdToken inToken, __out_ecount(bufLen) LPWSTR bu
return W("");
} // LPCWSTR MDInfo::TypeDeforRefName()
-LPCWSTR MDInfo::MemberDeforRefName(mdToken inToken, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen)
+LPCWSTR MDInfo::MemberDeforRefName(mdToken inToken, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen)
{
if (RidFromToken(inToken))
{
@@ -1365,7 +1365,7 @@ LPCWSTR MDInfo::MemberDeforRefName(mdToken inToken, __out_ecount(bufLen) LPWSTR
//
//
-LPCWSTR MDInfo::TypeDefName(mdTypeDef inTypeDef, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen)
+LPCWSTR MDInfo::TypeDefName(mdTypeDef inTypeDef, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen)
{
HRESULT hr;
@@ -1439,7 +1439,7 @@ void MDInfo::DisplayTypeDefProps(mdTypeDef inTypeDef)
// Prints out the name of the given TypeRef
//
-LPCWSTR MDInfo::TypeRefName(mdTypeRef tr, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen)
+LPCWSTR MDInfo::TypeRefName(mdTypeRef tr, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen)
{
HRESULT hr;
@@ -1543,7 +1543,7 @@ void MDInfo::DisplayMethodSpecInfo(mdMethodSpec ms, const char *preFix)
// associated with the class.
//
-char *MDInfo::ClassFlags(DWORD flags, __out_ecount(STRING_BUFFER_LEN) char *sFlags)
+char *MDInfo::ClassFlags(DWORD flags, _Out_writes_(STRING_BUFFER_LEN) char *sFlags)
{
sFlags[0] = 0;
ISFLAG(Td, NotPublic);
@@ -2169,7 +2169,7 @@ void MDInfo::DisplayPermissionInfo(mdPermission inPermission, const char *preFix
// simply prints out the given GUID in standard form
-LPWSTR MDInfo::GUIDAsString(GUID inGuid, __out_ecount(bufLen) LPWSTR guidString, ULONG bufLen)
+LPWSTR MDInfo::GUIDAsString(GUID inGuid, _Out_writes_(bufLen) LPWSTR guidString, ULONG bufLen)
{
StringFromGUID2(inGuid, guidString, bufLen);
return guidString;
diff --git a/src/coreclr/tools/metainfo/mdinfo.h b/src/coreclr/tools/metainfo/mdinfo.h
index 04002fdb267ffb..ff60b31ae3c492 100644
--- a/src/coreclr/tools/metainfo/mdinfo.h
+++ b/src/coreclr/tools/metainfo/mdinfo.h
@@ -67,20 +67,20 @@ class MDInfo {
void DisplaySignatures(void);
void DisplaySignatureInfo(mdSignature inSignature);
- LPCWSTR TokenName(mdToken inToken, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen);
+ LPCWSTR TokenName(mdToken inToken, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen);
- LPCWSTR TypeDeforRefName(mdToken inToken, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen);
- LPCWSTR TypeDefName(mdTypeDef inTypeDef, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen);
- LPCWSTR TypeRefName(mdTypeRef tr, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen);
+ LPCWSTR TypeDeforRefName(mdToken inToken, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen);
+ LPCWSTR TypeDefName(mdTypeDef inTypeDef, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen);
+ LPCWSTR TypeRefName(mdTypeRef tr, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen);
- LPCWSTR MemberDeforRefName(mdToken inToken, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen);
- LPCWSTR MemberRefName(mdToken inMemRef, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen);
- LPCWSTR MemberName(mdToken inMember, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen);
+ LPCWSTR MemberDeforRefName(mdToken inToken, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen);
+ LPCWSTR MemberRefName(mdToken inMemRef, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen);
+ LPCWSTR MemberName(mdToken inMember, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen);
- LPCWSTR MethodName(mdMethodDef inToken, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen);
- LPCWSTR FieldName(mdFieldDef inToken, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen);
+ LPCWSTR MethodName(mdMethodDef inToken, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen);
+ LPCWSTR FieldName(mdFieldDef inToken, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen);
- char *ClassFlags(DWORD flags, __out_ecount(STRING_BUFFER_LEN) char *sFlags);
+ char *ClassFlags(DWORD flags, _Out_writes_(STRING_BUFFER_LEN) char *sFlags);
void DisplayTypeRefs(void);
void DisplayTypeRefInfo(mdTypeRef tr);
@@ -96,7 +96,7 @@ class MDInfo {
void DisplayInterfaceImpls(mdTypeDef inTypeDef);
void DisplayInterfaceImplInfo(mdInterfaceImpl inImpl);
- LPWSTR GUIDAsString(GUID inGuid, __out_ecount(bufLen) LPWSTR guidString, ULONG bufLen);
+ LPWSTR GUIDAsString(GUID inGuid, _Out_writes_(bufLen) LPWSTR guidString, ULONG bufLen);
const char *TokenTypeName(mdToken inToken);
@@ -170,15 +170,15 @@ class MDInfo {
int DumpHex(const char *szPrefix, const void *pvData, ULONG cbData, int bText=true, ULONG nLine=16);
- int Write(__in_z __in const char *str);
- int WriteLine(__in_z __in const char *str);
+ int Write(_In_z_ const char *str);
+ int WriteLine(_In_z_ const char *str);
- int VWrite(__in_z __in const char *str, ...);
- int VWriteLine(__in_z __in const char *str, ...);
- int VWriteMarker(__in_z __in const char *str, va_list marker);
+ int VWrite(_In_z_ const char *str, ...);
+ int VWriteLine(_In_z_ const char *str, ...);
+ int VWriteMarker(_In_z_ const char *str, va_list marker);
void InitSigBuffer();
- HRESULT AddToSigBuffer(__in_z __in const char *string);
+ HRESULT AddToSigBuffer(_In_z_ const char *string);
IMetaDataImport2 *m_pRegImport;
IMetaDataImport2 *m_pImport;
diff --git a/src/coreclr/tools/metainfo/mdobj.cpp b/src/coreclr/tools/metainfo/mdobj.cpp
index c8851a85228fd7..5bb4689410bb04 100644
--- a/src/coreclr/tools/metainfo/mdobj.cpp
+++ b/src/coreclr/tools/metainfo/mdobj.cpp
@@ -57,7 +57,7 @@ static HRESULT FindObjMetaData(PVOID pImage, PVOID *ppMetaData, long *pcbMetaDat
// This function returns the address to the MapView of file and file size.
-void GetMapViewOfFile(__in WCHAR *szFile, PBYTE *ppbMap, DWORD *pdwFileSize)
+void GetMapViewOfFile(_In_ WCHAR *szFile, PBYTE *ppbMap, DWORD *pdwFileSize)
{
HANDLE hMapFile;
DWORD dwHighSize;
@@ -161,7 +161,7 @@ char *GetNameOfObj(PBYTE pbLongNames, PIMAGE_ARCHIVE_MEMBER_HEADER pMemHdr, char
//
// Opens the .LIB file, and displays the metadata in the specified object files.
-void DisplayArchive(__in_z __in WCHAR* szFile, ULONG DumpFilter, __in_z __in_opt WCHAR* szObjName, strPassBackFn pDisplayString)
+void DisplayArchive(_In_z_ WCHAR* szFile, ULONG DumpFilter, _In_opt_z_ WCHAR* szObjName, strPassBackFn pDisplayString)
{
PBYTE pbMapAddress;
PBYTE pbStartAddress;
@@ -249,7 +249,7 @@ void DisplayArchive(__in_z __in WCHAR* szFile, ULONG DumpFilter, __in_z __in_opt
// Opens the meta data content of a .EXE, .CLB, .CLASS, .TLB, .DLL or .LIB file, and
// calls RawDisplay()
-void DisplayFile(__in_z __in WCHAR* szFile, BOOL isFile, ULONG DumpFilter, __in_z __in_opt WCHAR* szObjName, strPassBackFn pDisplayString)
+void DisplayFile(_In_z_ WCHAR* szFile, BOOL isFile, ULONG DumpFilter, _In_opt_z_ WCHAR* szObjName, strPassBackFn pDisplayString)
{
// Open the emit scope
diff --git a/src/coreclr/tools/r2rdump/CoreDisTools.cs b/src/coreclr/tools/r2rdump/CoreDisTools.cs
index 75029e04a163c9..8c917662014141 100644
--- a/src/coreclr/tools/r2rdump/CoreDisTools.cs
+++ b/src/coreclr/tools/r2rdump/CoreDisTools.cs
@@ -396,17 +396,17 @@ private void ProbeX64Quirks(RuntimeFunction rtf, int imageOffset, int rtfOffset,
{
if (targetName != null)
{
- translated.AppendFormat("[{0}]", targetName);
+ translated.Append($"[{targetName}]");
}
else
{
- translated.AppendFormat("[0x{0:x4}]", target);
+ translated.Append($"[0x{target:x4}]");
}
translated.Append(instruction, rightBracketPlusOne, instruction.Length - rightBracketPlusOne);
}
else
{
- translated.AppendFormat("[0x{0:x4}]", target);
+ translated.Append($"[0x{target:x4}]");
translated.Append(instruction, rightBracketPlusOne, instruction.Length - rightBracketPlusOne);
if (targetName != null)
{
@@ -449,17 +449,17 @@ private void ProbeX86Quirks(RuntimeFunction rtf, int imageOffset, int rtfOffset,
{
if (targetName != null)
{
- translated.AppendFormat("[{0}]", targetName);
+ translated.Append($"[{targetName}]");
}
else
{
- translated.AppendFormat("[0x{0:x4}]", target);
+ translated.Append($"[0x{target:x4}]");
}
translated.Append(instruction, rightBracketPlusOne, instruction.Length - rightBracketPlusOne);
}
else
{
- translated.AppendFormat("[0x{0:x4}]", target);
+ translated.Append($"[0x{target:x4}]");
translated.Append(instruction, rightBracketPlusOne, instruction.Length - rightBracketPlusOne);
if (targetName != null)
{
@@ -818,7 +818,7 @@ private void ProbeArm64Quirks(RuntimeFunction rtf, int imageOffset, int rtfOffse
}
else
{
- translated.AppendFormat("#0x{0:x4}", targetPage);
+ translated.Append($"#0x{targetPage:x4}");
}
instruction = translated.ToString();
@@ -843,7 +843,7 @@ private void ProbeArm64Quirks(RuntimeFunction rtf, int imageOffset, int rtfOffse
}
else
{
- translated.AppendFormat("#0x{0:x}", target & 0xfff);
+ translated.Append($"#0x{target & 0xfff:x}");
if (targetName != null)
{
AppendComment(translated, "import{" + targetName + "}");
diff --git a/src/coreclr/tools/r2rdump/R2RDiff.cs b/src/coreclr/tools/r2rdump/R2RDiff.cs
index 91962d3ee929af..9bea8d860f202d 100644
--- a/src/coreclr/tools/r2rdump/R2RDiff.cs
+++ b/src/coreclr/tools/r2rdump/R2RDiff.cs
@@ -281,7 +281,7 @@ private void ShowDiff(Dictionary leftObjects, Dictionary leftObjects, Dictionary leftObjects, Dictionarycr->AddCall("GetErrorMessage");
return original_ICorJitInfo->GetErrorMessage(buffer, bufferLength);
@@ -1367,7 +1367,7 @@ unsigned interceptor_ICJI::getMethodHash(CORINFO_METHOD_HANDLE ftn /* IN */
// this function is for debugging only.
size_t interceptor_ICJI::findNameOfToken(CORINFO_MODULE_HANDLE module, /* IN */
mdToken metaTOK, /* IN */
- __out_ecount(FQNameCapacity) char* szFQName, /* OUT */
+ _Out_writes_(FQNameCapacity) char* szFQName, /* OUT */
size_t FQNameCapacity /* IN */
)
{
@@ -1716,13 +1716,6 @@ uint32_t interceptor_ICJI::getFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field
return temp;
}
-// Sets another object to intercept calls to "self" and current method being compiled
-void interceptor_ICJI::setOverride(ICorDynamicInfo* pOverride, CORINFO_METHOD_HANDLE currentMethod)
-{
- mc->cr->AddCall("setOverride");
- original_ICorJitInfo->setOverride(pOverride, currentMethod);
-}
-
// Adds an active dependency from the context method's module to the given module
// This is internal callback for the EE. JIT should not call it directly.
void interceptor_ICJI::addActiveDependency(CORINFO_MODULE_HANDLE moduleFrom, CORINFO_MODULE_HANDLE moduleTo)
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.h b/src/coreclr/tools/superpmi/superpmi-shim-collector/icorjitinfo.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.h
rename to src/coreclr/tools/superpmi/superpmi-shim-collector/icorjitinfo.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/jithost.cpp b/src/coreclr/tools/superpmi/superpmi-shim-collector/jithost.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-collector/jithost.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-collector/jithost.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/jithost.h b/src/coreclr/tools/superpmi/superpmi-shim-collector/jithost.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-collector/jithost.h
rename to src/coreclr/tools/superpmi/superpmi-shim-collector/jithost.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp b/src/coreclr/tools/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.def b/src/coreclr/tools/superpmi/superpmi-shim-collector/superpmi-shim-collector.def
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.def
rename to src/coreclr/tools/superpmi/superpmi-shim-collector/superpmi-shim-collector.def
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.h b/src/coreclr/tools/superpmi/superpmi-shim-collector/superpmi-shim-collector.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.h
rename to src/coreclr/tools/superpmi/superpmi-shim-collector/superpmi-shim-collector.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt b/src/coreclr/tools/superpmi/superpmi-shim-counter/CMakeLists.txt
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/CMakeLists.txt
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.cpp b/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitcompiler.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitcompiler.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.h b/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitcompiler.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.h
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitcompiler.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp b/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo.cpp
similarity index 99%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo.cpp
index 88e0e03e42d989..657575cce71fe3 100644
--- a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp
+++ b/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo.cpp
@@ -1184,14 +1184,6 @@ uint32_t interceptor_ICJI::getFieldThreadLocalStoreID(
return original_ICorJitInfo->getFieldThreadLocalStoreID(field, ppIndirection);
}
-void interceptor_ICJI::setOverride(
- ICorDynamicInfo* pOverride,
- CORINFO_METHOD_HANDLE currentMethod)
-{
- mcs->AddCall("setOverride");
- original_ICorJitInfo->setOverride(pOverride, currentMethod);
-}
-
void interceptor_ICJI::addActiveDependency(
CORINFO_MODULE_HANDLE moduleFrom,
CORINFO_MODULE_HANDLE moduleTo)
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.h b/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.h
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/jithost.cpp b/src/coreclr/tools/superpmi/superpmi-shim-counter/jithost.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/jithost.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/jithost.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/jithost.h b/src/coreclr/tools/superpmi/superpmi-shim-counter/jithost.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/jithost.h
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/jithost.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.cpp b/src/coreclr/tools/superpmi/superpmi-shim-counter/methodcallsummarizer.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/methodcallsummarizer.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.h b/src/coreclr/tools/superpmi/superpmi-shim-counter/methodcallsummarizer.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.h
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/methodcallsummarizer.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp b/src/coreclr/tools/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.def b/src/coreclr/tools/superpmi/superpmi-shim-counter/superpmi-shim-counter.def
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.def
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/superpmi-shim-counter.def
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.h b/src/coreclr/tools/superpmi/superpmi-shim-counter/superpmi-shim-counter.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.h
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/superpmi-shim-counter.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt b/src/coreclr/tools/superpmi/superpmi-shim-simple/CMakeLists.txt
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/CMakeLists.txt
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.cpp b/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitcompiler.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitcompiler.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.h b/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitcompiler.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.h
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitcompiler.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp b/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo.cpp
similarity index 99%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo.cpp
index 16926858871788..294750ccde5c1a 100644
--- a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp
+++ b/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo.cpp
@@ -1036,13 +1036,6 @@ uint32_t interceptor_ICJI::getFieldThreadLocalStoreID(
return original_ICorJitInfo->getFieldThreadLocalStoreID(field, ppIndirection);
}
-void interceptor_ICJI::setOverride(
- ICorDynamicInfo* pOverride,
- CORINFO_METHOD_HANDLE currentMethod)
-{
- original_ICorJitInfo->setOverride(pOverride, currentMethod);
-}
-
void interceptor_ICJI::addActiveDependency(
CORINFO_MODULE_HANDLE moduleFrom,
CORINFO_MODULE_HANDLE moduleTo)
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.h b/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.h
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/jithost.cpp b/src/coreclr/tools/superpmi/superpmi-shim-simple/jithost.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/jithost.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/jithost.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/jithost.h b/src/coreclr/tools/superpmi/superpmi-shim-simple/jithost.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/jithost.h
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/jithost.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp b/src/coreclr/tools/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.def b/src/coreclr/tools/superpmi/superpmi-shim-simple/superpmi-shim-simple.def
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.def
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/superpmi-shim-simple.def
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.h b/src/coreclr/tools/superpmi/superpmi-shim-simple/superpmi-shim-simple.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.h
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/superpmi-shim-simple.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/CMakeLists.txt b/src/coreclr/tools/superpmi/superpmi/CMakeLists.txt
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/CMakeLists.txt
rename to src/coreclr/tools/superpmi/superpmi/CMakeLists.txt
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/commandline.cpp b/src/coreclr/tools/superpmi/superpmi/commandline.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/commandline.cpp
rename to src/coreclr/tools/superpmi/superpmi/commandline.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/commandline.h b/src/coreclr/tools/superpmi/superpmi/commandline.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/commandline.h
rename to src/coreclr/tools/superpmi/superpmi/commandline.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/cycletimer.cpp b/src/coreclr/tools/superpmi/superpmi/cycletimer.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/cycletimer.cpp
rename to src/coreclr/tools/superpmi/superpmi/cycletimer.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/cycletimer.h b/src/coreclr/tools/superpmi/superpmi/cycletimer.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/cycletimer.h
rename to src/coreclr/tools/superpmi/superpmi/cycletimer.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp b/src/coreclr/tools/superpmi/superpmi/icorjitinfo.cpp
similarity index 99%
rename from src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp
rename to src/coreclr/tools/superpmi/superpmi/icorjitinfo.cpp
index 3ff21d07fb59f0..16c66a6a398476 100644
--- a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp
+++ b/src/coreclr/tools/superpmi/superpmi/icorjitinfo.cpp
@@ -426,7 +426,7 @@ CORINFO_CLASS_HANDLE MyICJI::getTypeInstantiationArgument(CORINFO_CLASS_HANDLE c
// If fFullInst=TRUE (regardless of fNamespace and fAssembly), include namespace and assembly for any type parameters
// If fAssembly=TRUE, suffix with a comma and the full assembly qualification
// return size of representation
-int MyICJI::appendClassName(__deref_inout_ecount(*pnBufLen) char16_t** ppBuf,
+int MyICJI::appendClassName(_Outptr_result_buffer_(*pnBufLen) char16_t** ppBuf,
int* pnBufLen,
CORINFO_CLASS_HANDLE cls,
bool fNamespace,
@@ -1099,7 +1099,7 @@ HRESULT MyICJI::GetErrorHRESULT(struct _EXCEPTION_POINTERS* pExceptionPointers)
// Fetches the message of the current exception
// Returns the size of the message (including terminating null). This can be
// greater than bufferLength if the buffer is insufficient.
-uint32_t MyICJI::GetErrorMessage(__inout_ecount(bufferLength) char16_t* buffer, uint32_t bufferLength)
+uint32_t MyICJI::GetErrorMessage(_Inout_updates_(bufferLength) char16_t* buffer, uint32_t bufferLength)
{
jitInstance->mc->cr->AddCall("GetErrorMessage");
LogError("Hit unimplemented GetErrorMessage");
@@ -1214,7 +1214,7 @@ unsigned MyICJI::getMethodHash(CORINFO_METHOD_HANDLE ftn /* IN */
// this function is for debugging only.
size_t MyICJI::findNameOfToken(CORINFO_MODULE_HANDLE module, /* IN */
mdToken metaTOK, /* IN */
- __out_ecount(FQNameCapacity) char* szFQName, /* OUT */
+ _Out_writes_(FQNameCapacity) char* szFQName, /* OUT */
size_t FQNameCapacity /* IN */
)
{
@@ -1490,14 +1490,6 @@ uint32_t MyICJI::getFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void** p
return jitInstance->mc->repGetFieldThreadLocalStoreID(field, ppIndirection);
}
-// Sets another object to intercept calls to "self" and current method being compiled
-void MyICJI::setOverride(ICorDynamicInfo* pOverride, CORINFO_METHOD_HANDLE currentMethod)
-{
- jitInstance->mc->cr->AddCall("setOverride");
- LogError("Hit unimplemented setOverride");
- DebugBreakorAV(115);
-}
-
// Adds an active dependency from the context method's module to the given module
// This is internal callback for the EE. JIT should not call it directly.
void MyICJI::addActiveDependency(CORINFO_MODULE_HANDLE moduleFrom, CORINFO_MODULE_HANDLE moduleTo)
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.h b/src/coreclr/tools/superpmi/superpmi/icorjitinfo.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.h
rename to src/coreclr/tools/superpmi/superpmi/icorjitinfo.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/jitdebugger.cpp b/src/coreclr/tools/superpmi/superpmi/jitdebugger.cpp
similarity index 98%
rename from src/coreclr/ToolBox/superpmi/superpmi/jitdebugger.cpp
rename to src/coreclr/tools/superpmi/superpmi/jitdebugger.cpp
index 169d0a268483b7..242771fe796c85 100644
--- a/src/coreclr/ToolBox/superpmi/superpmi/jitdebugger.cpp
+++ b/src/coreclr/tools/superpmi/superpmi/jitdebugger.cpp
@@ -134,7 +134,7 @@ BOOL GetRegistryLongValue(HKEY hKeyParent, LPCWSTR szKey, LPCWSTR szName, long*
// Note:
//
//----------------------------------------------------------------------------
-HRESULT GetCurrentModuleFileName(__out_ecount(*pcchBuffer) LPWSTR pBuffer, __inout DWORD* pcchBuffer)
+HRESULT GetCurrentModuleFileName(_Out_writes_(*pcchBuffer) LPWSTR pBuffer, __inout DWORD* pcchBuffer)
{
LIMITED_METHOD_CONTRACT;
@@ -252,7 +252,7 @@ void GetDebuggerSettingInfo(LPWSTR wszDebuggerString, DWORD cchDebuggerString, B
// * wszDebuggerString can be NULL. When wszDebuggerString is NULL, pcchDebuggerString should
// * point to a DWORD of zero. pcchDebuggerString cannot be NULL, and the DWORD pointed by
// * pcchDebuggerString will store the used or required string buffer size in characters.
-HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString, *pcchDebuggerString)
+HRESULT GetDebuggerSettingInfoWorker(_Out_writes_to_opt_(*pcchDebuggerString, *pcchDebuggerString)
LPWSTR wszDebuggerString,
DWORD* pcchDebuggerString,
BOOL* pfAuto)
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/jitdebugger.h b/src/coreclr/tools/superpmi/superpmi/jitdebugger.h
similarity index 87%
rename from src/coreclr/ToolBox/superpmi/superpmi/jitdebugger.h
rename to src/coreclr/tools/superpmi/superpmi/jitdebugger.h
index f941151b2e5493..a7f1eec42765de 100644
--- a/src/coreclr/ToolBox/superpmi/superpmi/jitdebugger.h
+++ b/src/coreclr/tools/superpmi/superpmi/jitdebugger.h
@@ -14,14 +14,14 @@ BOOL GetRegistryLongValue(HKEY hKeyParent, // Parent key.
long* pValue, // Put value here, if found.
BOOL fReadNonVirtualizedKey); // Whether to read 64-bit hive on WOW64
-HRESULT GetCurrentModuleFileName(__out_ecount(*pcchBuffer) LPWSTR pBuffer, __inout DWORD* pcchBuffer);
+HRESULT GetCurrentModuleFileName(_Out_writes_(*pcchBuffer) LPWSTR pBuffer, __inout DWORD* pcchBuffer);
#ifndef _WIN64
BOOL RunningInWow64();
#endif
BOOL IsCurrentModuleFileNameInAutoExclusionList();
-HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString, *pcchDebuggerString)
+HRESULT GetDebuggerSettingInfoWorker(_Out_writes_to_opt_(*pcchDebuggerString, *pcchDebuggerString)
LPWSTR wszDebuggerString,
DWORD* pcchDebuggerString,
BOOL* pfAuto);
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/jithost.cpp b/src/coreclr/tools/superpmi/superpmi/jithost.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/jithost.cpp
rename to src/coreclr/tools/superpmi/superpmi/jithost.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/jithost.h b/src/coreclr/tools/superpmi/superpmi/jithost.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/jithost.h
rename to src/coreclr/tools/superpmi/superpmi/jithost.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/jitinstance.cpp b/src/coreclr/tools/superpmi/superpmi/jitinstance.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/jitinstance.cpp
rename to src/coreclr/tools/superpmi/superpmi/jitinstance.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/jitinstance.h b/src/coreclr/tools/superpmi/superpmi/jitinstance.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/jitinstance.h
rename to src/coreclr/tools/superpmi/superpmi/jitinstance.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/methodstatsemitter.cpp b/src/coreclr/tools/superpmi/superpmi/methodstatsemitter.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/methodstatsemitter.cpp
rename to src/coreclr/tools/superpmi/superpmi/methodstatsemitter.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/methodstatsemitter.h b/src/coreclr/tools/superpmi/superpmi/methodstatsemitter.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/methodstatsemitter.h
rename to src/coreclr/tools/superpmi/superpmi/methodstatsemitter.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/metricssummary.cpp b/src/coreclr/tools/superpmi/superpmi/metricssummary.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/metricssummary.cpp
rename to src/coreclr/tools/superpmi/superpmi/metricssummary.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/metricssummary.h b/src/coreclr/tools/superpmi/superpmi/metricssummary.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/metricssummary.h
rename to src/coreclr/tools/superpmi/superpmi/metricssummary.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/neardiffer.cpp b/src/coreclr/tools/superpmi/superpmi/neardiffer.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/neardiffer.cpp
rename to src/coreclr/tools/superpmi/superpmi/neardiffer.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/neardiffer.h b/src/coreclr/tools/superpmi/superpmi/neardiffer.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/neardiffer.h
rename to src/coreclr/tools/superpmi/superpmi/neardiffer.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp b/src/coreclr/tools/superpmi/superpmi/parallelsuperpmi.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp
rename to src/coreclr/tools/superpmi/superpmi/parallelsuperpmi.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/superpmi.cpp b/src/coreclr/tools/superpmi/superpmi/superpmi.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/superpmi.cpp
rename to src/coreclr/tools/superpmi/superpmi/superpmi.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/superpmi.h b/src/coreclr/tools/superpmi/superpmi/superpmi.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/superpmi.h
rename to src/coreclr/tools/superpmi/superpmi/superpmi.h
diff --git a/src/coreclr/tools/util/consoleargs.cpp b/src/coreclr/tools/util/consoleargs.cpp
index 510d86c966a788..6fba56ad69c2d8 100644
--- a/src/coreclr/tools/util/consoleargs.cpp
+++ b/src/coreclr/tools/util/consoleargs.cpp
@@ -335,7 +335,7 @@ void ConsoleArgs::CleanUpArgs()
}
}
-bool ConsoleArgs::GetFullFileName(LPCWSTR szSource, __out_ecount(cchFilenameBuffer) LPWSTR filenameBuffer, DWORD cchFilenameBuffer, bool fOutputFilename)
+bool ConsoleArgs::GetFullFileName(LPCWSTR szSource, _Out_writes_(cchFilenameBuffer) LPWSTR filenameBuffer, DWORD cchFilenameBuffer, bool fOutputFilename)
{
#ifdef TARGET_UNIX
WCHAR tempBuffer[MAX_LONGPATH];
@@ -365,7 +365,7 @@ bool ConsoleArgs::GetFullFileName(LPCWSTR szSource, __out_ecount(cchFilenameBuff
// Clear previous error message if any and set the new one by copying into m_lastErrorMessage.
// We are responsible for freeing the memory destruction.
//
-void ConsoleArgs::SetErrorMessage(__in LPCWSTR pwzMessage)
+void ConsoleArgs::SetErrorMessage(_In_ LPCWSTR pwzMessage)
{
if (m_lastErrorMessage != nullptr)
{
@@ -680,7 +680,7 @@ void ConsoleArgs::TextToArgs(LPCWSTR szText, WStrList ** listReplace)
// We expand any response files that may be contained in the args and return a new
// set of args, pargc2 and pppargv2 that contain the full flat command line.
//
-bool ConsoleArgs::ExpandResponseFiles(__in int argc, __deref_in_ecount(argc) const LPCWSTR * argv, int * pargc2, __deref_out_ecount(*pargc2) LPWSTR ** pppargv2)
+bool ConsoleArgs::ExpandResponseFiles(_In_ int argc, _In_reads_(argc) const LPCWSTR * argv, int * pargc2, _Outptr_result_buffer_(*pargc2) LPWSTR ** pppargv2)
{
*pargc2 = 0;
*pppargv2 = NULL;
@@ -751,7 +751,7 @@ bool ConsoleArgs::ExpandResponseFiles(__in int argc, __deref_in_ecount(argc) con
// Read file to end, converting to unicode
// ppwzTextBuffer is allocated. Caller is responsible for freeing
//
-bool ConsoleArgs::ReadTextFile(LPCWSTR pwzFilename, __deref_out LPWSTR *ppwzTextBuffer)
+bool ConsoleArgs::ReadTextFile(LPCWSTR pwzFilename, _Outptr_ LPWSTR *ppwzTextBuffer)
{
bool success = false;
char *bufA = nullptr;
diff --git a/src/coreclr/tools/util/consoleargs.h b/src/coreclr/tools/util/consoleargs.h
index 10cc1e40b3612f..f82291d61e9d31 100644
--- a/src/coreclr/tools/util/consoleargs.h
+++ b/src/coreclr/tools/util/consoleargs.h
@@ -19,7 +19,7 @@ class ConsoleArgs
{
public:
// Place the fully-qualified filename in the given output buffer
- bool GetFullFileName(LPCWSTR szSource, __out_ecount(cbFilenameBuffer) LPWSTR filenameBuffer, DWORD cbFilenameBuffer, bool fOutputFilename);
+ bool GetFullFileName(LPCWSTR szSource, _Out_writes_(cbFilenameBuffer) LPWSTR filenameBuffer, DWORD cbFilenameBuffer, bool fOutputFilename);
ConsoleArgs() :
m_rgArgs(NULL),
@@ -35,7 +35,7 @@ class ConsoleArgs
};
// returns false if there are errors
- bool ExpandResponseFiles(__in int argc, __deref_in_ecount(argc) const LPCWSTR * argv, int * pargc2, __deref_out_ecount(*pargc2) LPWSTR ** pppargv2);
+ bool ExpandResponseFiles(_In_ int argc, _In_reads_(argc) const LPCWSTR * argv, int * pargc2, _Outptr_result_buffer_(*pargc2) LPWSTR ** pppargv2);
// Frees all memory used by the arg list and the argv/argc array
void CleanUpArgs();
@@ -53,12 +53,12 @@ class ConsoleArgs
}
private:
- void SetErrorMessage(__in LPCWSTR pwzMessage);
+ void SetErrorMessage(_In_ LPCWSTR pwzMessage);
b_tree * MakeLeaf( LPCWSTR szText);
void CleanupTree( b_tree * root);
HRESULT TreeAdd( b_tree ** root, LPCWSTR szAdd);
void TextToArgs( LPCWSTR szText, WStrList ** listReplace);
- bool ReadTextFile(LPCWSTR pwzFilename, __deref_out LPWSTR *ppwzTextBuffer);
+ bool ReadTextFile(LPCWSTR pwzFilename, _Outptr_ LPWSTR *ppwzTextBuffer);
void ProcessResponseArgs();
LPWSTR * m_rgArgs;
diff --git a/src/coreclr/unwinder/amd64/dbs_stack_x64.cpp b/src/coreclr/unwinder/amd64/dbs_stack_x64.cpp
index e6714209b9392b..71b53610035a7f 100644
--- a/src/coreclr/unwinder/amd64/dbs_stack_x64.cpp
+++ b/src/coreclr/unwinder/amd64/dbs_stack_x64.cpp
@@ -63,10 +63,10 @@ DbsX64StackUnwinder::s_UnwindOpSlotTable[] =
HRESULT
DbsX64StackUnwinder::UnwindPrologue(
- __in ULONG64 ImageBase,
- __in ULONG64 ControlPc,
- __in ULONG64 FrameBase,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc,
+ _In_ ULONG64 FrameBase,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PAMD64_CONTEXT ContextRecord
)
@@ -520,11 +520,11 @@ Routine Description:
HRESULT
DbsX64StackUnwinder::VirtualUnwind(
- __in ULONG64 ImageBase,
- __in ULONG64 ControlPc,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PAMD64_CONTEXT ContextRecord,
- __out PULONG64 EstablisherFrame
+ _Out_ PULONG64 EstablisherFrame
)
/*++
@@ -1033,9 +1033,9 @@ Routine Description:
ULONG64
DbsX64StackUnwinder::LookupPrimaryUnwindInfo(
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in ULONG64 ImageBase,
- __out _PIMAGE_RUNTIME_FUNCTION_ENTRY PrimaryEntry
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ ULONG64 ImageBase,
+ _Out_ _PIMAGE_RUNTIME_FUNCTION_ENTRY PrimaryEntry
)
/*++
@@ -1114,10 +1114,10 @@ Return Value:
_PIMAGE_RUNTIME_FUNCTION_ENTRY
DbsX64StackUnwinder::SameFunction(
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in ULONG64 ImageBase,
- __in ULONG64 ControlPc,
- __out _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionReturnBuffer
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc,
+ _Out_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionReturnBuffer
)
/*++
@@ -1213,7 +1213,7 @@ Return Value:
(((_DbhFrame)->Reserved[2]) & ~DBHX64_IS_RESTART_FLAG) | \
((_IsRestart) ? DBHX64_IS_RESTART_FLAG : 0))
-DbsX64StackUnwinder::DbsX64StackUnwinder(__in_opt DbsStackServices* Services)
+DbsX64StackUnwinder::DbsX64StackUnwinder(_In_opt_ DbsStackServices* Services)
: DbsStackUnwinder(Services, "x64", IMAGE_FILE_MACHINE_AMD64,
sizeof(m_Context),
sizeof(_IMAGE_RUNTIME_FUNCTION_ENTRY),
@@ -1265,7 +1265,7 @@ DbsX64StackUnwinder::Unwind(void)
DWORD
DbsX64StackUnwinder::
-GetFullUnwindInfoSize(__in PVOID InfoHeader)
+GetFullUnwindInfoSize(_In_ PVOID InfoHeader)
{
PAMD64_UNWIND_INFO UnwindInfo = (PAMD64_UNWIND_INFO)InfoHeader;
@@ -1289,9 +1289,9 @@ GetFullUnwindInfoSize(__in PVOID InfoHeader)
HRESULT
DbsX64StackUnwinder::DbhStart(__inout LPSTACKFRAME64 StackFrame,
- __in DWORD DbhVersion,
- __in_bcount(DbhStorageBytes) PVOID DbhStorage,
- __in DWORD DbhStorageBytes,
+ _In_ DWORD DbhVersion,
+ _In_reads_bytes_(DbhStorageBytes) PVOID DbhStorage,
+ _In_ DWORD DbhStorageBytes,
__inout PVOID Context)
{
HRESULT Status;
@@ -1343,9 +1343,9 @@ DbsX64StackUnwinder::DbhStart(__inout LPSTACKFRAME64 StackFrame,
HRESULT
DbsX64StackUnwinder::
DbhContinue(__inout LPSTACKFRAME64 StackFrame,
- __in DWORD DbhVersion,
- __in_bcount(DbhStorageBytes) PVOID DbhStorage,
- __in DWORD DbhStorageBytes,
+ _In_ DWORD DbhVersion,
+ _In_reads_bytes_(DbhStorageBytes) PVOID DbhStorage,
+ _In_ DWORD DbhStorageBytes,
__inout PVOID Context)
{
HRESULT Status;
@@ -1385,7 +1385,7 @@ DbsX64StackUnwinder::DbhUpdatePreUnwind(__inout LPSTACKFRAME64 StackFrame)
HRESULT
DbsX64StackUnwinder::DbhUpdatePostUnwind(__inout LPSTACKFRAME64 StackFrame,
- __in HRESULT UnwindStatus)
+ _In_ HRESULT UnwindStatus)
{
HRESULT Status;
diff --git a/src/coreclr/unwinder/amd64/unwinder_amd64.cpp b/src/coreclr/unwinder/amd64/unwinder_amd64.cpp
index ef1c5e0b5b54bb..fc3c746d875260 100644
--- a/src/coreclr/unwinder/amd64/unwinder_amd64.cpp
+++ b/src/coreclr/unwinder/amd64/unwinder_amd64.cpp
@@ -321,13 +321,13 @@ UNWIND_INFO * OOPStackUnwinderAMD64::GetUnwindInfo(TADDR taUnwindInfo)
// returned.
//
PEXCEPTION_ROUTINE RtlVirtualUnwind_Unsafe(
- __in ULONG HandlerType,
- __in ULONG64 ImageBase,
- __in ULONG64 ControlPc,
- __in PT_RUNTIME_FUNCTION FunctionEntry,
- __in OUT PCONTEXT ContextRecord,
- __out PVOID *HandlerData,
- __out PULONG64 EstablisherFrame,
+ _In_ ULONG HandlerType,
+ _In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc,
+ _In_ PT_RUNTIME_FUNCTION FunctionEntry,
+ _In_ OUT PCONTEXT ContextRecord,
+ _Out_ PVOID *HandlerData,
+ _Out_ PULONG64 EstablisherFrame,
__inout_opt PKNONVOLATILE_CONTEXT_POINTERS ContextPointers
)
{
@@ -395,10 +395,10 @@ PEXCEPTION_ROUTINE RtlVirtualUnwind_Unsafe(
HRESULT
OOPStackUnwinderAMD64::UnwindEpilogue(
- __in ULONG64 ImageBase,
- __in ULONG64 ControlPc,
- __in ULONG EpilogueOffset,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc,
+ _In_ ULONG EpilogueOffset,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PCONTEXT ContextRecord,
__inout_opt PKNONVOLATILE_CONTEXT_POINTERS ContextPointers
)
@@ -634,13 +634,13 @@ HRESULT.
HRESULT
OOPStackUnwinderAMD64::UnwindPrologue(
- __in ULONG64 ImageBase,
- __in ULONG64 ControlPc,
- __in ULONG64 FrameBase,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc,
+ _In_ ULONG64 FrameBase,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PCONTEXT ContextRecord,
__inout_opt PKNONVOLATILE_CONTEXT_POINTERS ContextPointers,
- __deref_out _PIMAGE_RUNTIME_FUNCTION_ENTRY *FinalFunctionEntry
+ _Outptr_ _PIMAGE_RUNTIME_FUNCTION_ENTRY *FinalFunctionEntry
)
/*++
@@ -1012,15 +1012,15 @@ Return Value:
HRESULT
OOPStackUnwinderAMD64::VirtualUnwind(
- __in DWORD HandlerType,
- __in ULONG64 ImageBase,
- __in ULONG64 ControlPc,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ DWORD HandlerType,
+ _In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PCONTEXT ContextRecord,
- __out PVOID *HandlerData,
- __out PULONG64 EstablisherFrame,
+ _Out_ PVOID *HandlerData,
+ _Out_ PULONG64 EstablisherFrame,
__inout_opt PKNONVOLATILE_CONTEXT_POINTERS ContextPointers,
- __deref_opt_out_opt PEXCEPTION_ROUTINE *HandlerRoutine
+ _Outptr_opt_result_maybenull_ PEXCEPTION_ROUTINE *HandlerRoutine
)
/*++
@@ -1663,8 +1663,8 @@ Routine Description:
_PIMAGE_RUNTIME_FUNCTION_ENTRY
OOPStackUnwinderAMD64::LookupPrimaryFunctionEntry(
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in ULONG64 ImageBase
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ ULONG64 ImageBase
)
@@ -1732,9 +1732,9 @@ Return Value:
_PIMAGE_RUNTIME_FUNCTION_ENTRY
OOPStackUnwinderAMD64::SameFunction(
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in ULONG64 ImageBase,
- __in ULONG64 ControlPc
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc
)
/*++
@@ -1812,7 +1812,7 @@ Return Value:
}
}
-ULONG OOPStackUnwinderAMD64::UnwindOpSlots(__in UNWIND_CODE UnwindCode)
+ULONG OOPStackUnwinderAMD64::UnwindOpSlots(_In_ UNWIND_CODE UnwindCode)
/*++
Routine Description:
diff --git a/src/coreclr/unwinder/amd64/unwinder_amd64.h b/src/coreclr/unwinder/amd64/unwinder_amd64.h
index 48e67f6702187c..c7a7683813ac09 100644
--- a/src/coreclr/unwinder/amd64/unwinder_amd64.h
+++ b/src/coreclr/unwinder/amd64/unwinder_amd64.h
@@ -24,43 +24,43 @@ class OOPStackUnwinderAMD64 : public OOPStackUnwinder
// Everything below comes from dbghelp.dll.
//
- static HRESULT VirtualUnwind(__in DWORD HandlerType,
- __in DWORD64 ImageBase,
- __in DWORD64 ControlPc,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ static HRESULT VirtualUnwind(_In_ DWORD HandlerType,
+ _In_ DWORD64 ImageBase,
+ _In_ DWORD64 ControlPc,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PCONTEXT ContextRecord,
- __out PVOID *HandlerData,
- __out PDWORD64 EstablisherFrame,
+ _Out_ PVOID *HandlerData,
+ _Out_ PDWORD64 EstablisherFrame,
__inout_opt PKNONVOLATILE_CONTEXT_POINTERS ContextPointers,
- __deref_opt_out_opt PEXCEPTION_ROUTINE *HandlerRoutine);
+ _Outptr_opt_result_maybenull_ PEXCEPTION_ROUTINE *HandlerRoutine);
protected:
- static ULONG UnwindOpSlots(__in UNWIND_CODE UnwindCode);
+ static ULONG UnwindOpSlots(_In_ UNWIND_CODE UnwindCode);
- static HRESULT UnwindEpilogue(__in ULONG64 ImageBase,
- __in ULONG64 ControlPc,
- __in ULONG EpilogueOffset,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ static HRESULT UnwindEpilogue(_In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc,
+ _In_ ULONG EpilogueOffset,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PCONTEXT ContextRecord,
__inout_opt PKNONVOLATILE_CONTEXT_POINTERS ContextPointers);
- static HRESULT UnwindPrologue(__in DWORD64 ImageBase,
- __in DWORD64 ControlPc,
- __in DWORD64 FrameBase,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ static HRESULT UnwindPrologue(_In_ DWORD64 ImageBase,
+ _In_ DWORD64 ControlPc,
+ _In_ DWORD64 FrameBase,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PCONTEXT ContextRecord,
__inout_opt PKNONVOLATILE_CONTEXT_POINTERS ContextPointers,
- __deref_out _PIMAGE_RUNTIME_FUNCTION_ENTRY *FinalFunctionEntry);
+ _Outptr_ _PIMAGE_RUNTIME_FUNCTION_ENTRY *FinalFunctionEntry);
static _PIMAGE_RUNTIME_FUNCTION_ENTRY LookupPrimaryFunctionEntry
- (__in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in DWORD64 ImageBase);
+ (_In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ DWORD64 ImageBase);
static _PIMAGE_RUNTIME_FUNCTION_ENTRY SameFunction
- (__in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in DWORD64 ImageBase,
- __in DWORD64 ControlPc);
+ (_In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ DWORD64 ImageBase,
+ _In_ DWORD64 ControlPc);
static UNWIND_INFO * GetUnwindInfo(TADDR taUnwindInfo);
};
diff --git a/src/coreclr/unwinder/arm/unwinder_arm.cpp b/src/coreclr/unwinder/arm/unwinder_arm.cpp
index 5c8de353422680..2ad5d3de94a7a7 100644
--- a/src/coreclr/unwinder/arm/unwinder_arm.cpp
+++ b/src/coreclr/unwinder/arm/unwinder_arm.cpp
@@ -258,8 +258,8 @@ static const ULONG RegisterMaskLookup[1 << 6] =
NTSTATUS
RtlpUnwindCustom(
__inout PT_CONTEXT ContextRecord,
- __in BYTE Opcode,
- __in PARM_UNWIND_PARAMS UnwindParams
+ _In_ BYTE Opcode,
+ _In_ PARM_UNWIND_PARAMS UnwindParams
)
/*++
@@ -385,9 +385,9 @@ Return Value:
NTSTATUS
RtlpPopVfpRegisterRange(
__inout PT_CONTEXT ContextRecord,
- __in ULONG RegStart,
- __in ULONG RegStop,
- __in PARM_UNWIND_PARAMS UnwindParams
+ _In_ ULONG RegStart,
+ _In_ ULONG RegStop,
+ _In_ PARM_UNWIND_PARAMS UnwindParams
)
/*++
@@ -445,9 +445,9 @@ Return Value:
FORCEINLINE
WORD
RtlpRangeToMask(
- __in ULONG Start,
- __in ULONG Stop,
- __in ULONG Lr
+ _In_ ULONG Start,
+ _In_ ULONG Stop,
+ _In_ ULONG Lr
)
/*++
@@ -485,8 +485,8 @@ Return Value:
NTSTATUS
RtlpPopRegisterMask(
__inout PT_CONTEXT ContextRecord,
- __in WORD RegMask,
- __in PARM_UNWIND_PARAMS UnwindParams
+ _In_ WORD RegMask,
+ _In_ PARM_UNWIND_PARAMS UnwindParams
)
/*++
@@ -556,8 +556,8 @@ Return Value:
FORCEINLINE
BOOLEAN
RtlpCheckCondition(
- __in PT_CONTEXT ContextRecord,
- __in ULONG Condition
+ _In_ PT_CONTEXT ContextRecord,
+ _In_ ULONG Condition
)
/*++
@@ -585,10 +585,10 @@ Return Value:
ULONG
RtlpComputeScopeSize(
- __in ULONG UnwindCodePtr,
- __in ULONG UnwindCodesEndPtr,
- __in BOOLEAN IsEpilog,
- __in PVOID UnwindParams
+ _In_ ULONG UnwindCodePtr,
+ _In_ ULONG UnwindCodesEndPtr,
+ _In_ BOOLEAN IsEpilog,
+ _In_ PVOID UnwindParams
)
/*++
@@ -647,13 +647,13 @@ Return Value:
HRESULT
RtlpUnwindFunctionCompact(
- __in ULONG ControlPcRva,
- __in PT_RUNTIME_FUNCTION FunctionEntry,
+ _In_ ULONG ControlPcRva,
+ _In_ PT_RUNTIME_FUNCTION FunctionEntry,
__inout PT_CONTEXT ContextRecord,
- __out PULONG EstablisherFrame,
- __deref_opt_out_opt PEXCEPTION_ROUTINE *HandlerRoutine,
- __out PVOID *HandlerData,
- __in PARM_UNWIND_PARAMS UnwindParams
+ _Out_ PULONG EstablisherFrame,
+ _Outptr_opt_result_maybenull_ PEXCEPTION_ROUTINE *HandlerRoutine,
+ _Out_ PVOID *HandlerData,
+ _In_ PARM_UNWIND_PARAMS UnwindParams
)
{
ULONG CBit;
@@ -916,14 +916,14 @@ RtlpUnwindFunctionCompact(
HRESULT
RtlpUnwindFunctionFull(
- __in ULONG ControlPcRva,
- __in ULONG ImageBase,
- __in PT_RUNTIME_FUNCTION FunctionEntry,
+ _In_ ULONG ControlPcRva,
+ _In_ ULONG ImageBase,
+ _In_ PT_RUNTIME_FUNCTION FunctionEntry,
__inout PT_CONTEXT ContextRecord,
- __out PULONG EstablisherFrame,
- __deref_opt_out_opt PEXCEPTION_ROUTINE *HandlerRoutine,
- __out PVOID *HandlerData,
- __in PARM_UNWIND_PARAMS UnwindParams
+ _Out_ PULONG EstablisherFrame,
+ _Outptr_opt_result_maybenull_ PEXCEPTION_ROUTINE *HandlerRoutine,
+ _Out_ PVOID *HandlerData,
+ _In_ PARM_UNWIND_PARAMS UnwindParams
)
/*++
@@ -1499,13 +1499,13 @@ BOOL DacUnwindStackFrame(T_CONTEXT *pContext, T_KNONVOLATILE_CONTEXT_POINTERS* p
#if defined(HOST_UNIX)
PEXCEPTION_ROUTINE RtlVirtualUnwind(
- __in ULONG HandlerType,
- __in ULONG ImageBase,
- __in ULONG ControlPc,
- __in PT_RUNTIME_FUNCTION FunctionEntry,
- __in OUT PCONTEXT ContextRecord,
- __out PVOID *HandlerData,
- __out PULONG EstablisherFrame,
+ _In_ ULONG HandlerType,
+ _In_ ULONG ImageBase,
+ _In_ ULONG ControlPc,
+ _In_ PT_RUNTIME_FUNCTION FunctionEntry,
+ _In_ OUT PCONTEXT ContextRecord,
+ _Out_ PVOID *HandlerData,
+ _Out_ PULONG EstablisherFrame,
__inout_opt PT_KNONVOLATILE_CONTEXT_POINTERS ContextPointers
)
{
diff --git a/src/coreclr/unwinder/arm/unwinder_arm.h b/src/coreclr/unwinder/arm/unwinder_arm.h
index 1a8e52fa9a3df3..cb73307448c019 100644
--- a/src/coreclr/unwinder/arm/unwinder_arm.h
+++ b/src/coreclr/unwinder/arm/unwinder_arm.h
@@ -25,28 +25,28 @@ class OOPStackUnwinderArm : public OOPStackUnwinder
//
protected:
- HRESULT UnwindPrologue(__in DWORD64 ImageBase,
- __in DWORD64 ControlPc,
- __in DWORD64 FrameBase,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ HRESULT UnwindPrologue(_In_ DWORD64 ImageBase,
+ _In_ DWORD64 ControlPc,
+ _In_ DWORD64 FrameBase,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PT_CONTEXT ContextRecord);
- HRESULT VirtualUnwind(__in DWORD64 ImageBase,
- __in DWORD64 ControlPc,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ HRESULT VirtualUnwind(_In_ DWORD64 ImageBase,
+ _In_ DWORD64 ControlPc,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PT_CONTEXT ContextRecord,
- __out PDWORD64 EstablisherFrame);
+ _Out_ PDWORD64 EstablisherFrame);
DWORD64 LookupPrimaryUnwindInfo
- (__in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in DWORD64 ImageBase,
- __out _PIMAGE_RUNTIME_FUNCTION_ENTRY PrimaryEntry);
+ (_In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ DWORD64 ImageBase,
+ _Out_ _PIMAGE_RUNTIME_FUNCTION_ENTRY PrimaryEntry);
_PIMAGE_RUNTIME_FUNCTION_ENTRY SameFunction
- (__in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in DWORD64 ImageBase,
- __in DWORD64 ControlPc,
- __out _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionReturnBuffer);
+ (_In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ DWORD64 ImageBase,
+ _In_ DWORD64 ControlPc,
+ _Out_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionReturnBuffer);
};
#endif // __unwinder_arm__
diff --git a/src/coreclr/unwinder/arm64/unwinder_arm64.cpp b/src/coreclr/unwinder/arm64/unwinder_arm64.cpp
index 5740c3cfcab80c..d812e7be3f17bf 100644
--- a/src/coreclr/unwinder/arm64/unwinder_arm64.cpp
+++ b/src/coreclr/unwinder/arm64/unwinder_arm64.cpp
@@ -167,8 +167,8 @@ static const BYTE UnwindCodeSizeTable[256] =
NTSTATUS
RtlpUnwindCustom(
__inout PT_CONTEXT ContextRecord,
- __in BYTE Opcode,
- __in PARM64_UNWIND_PARAMS UnwindParams
+ _In_ BYTE Opcode,
+ _In_ PARM64_UNWIND_PARAMS UnwindParams
)
/*++
@@ -374,10 +374,10 @@ Return Value:
ULONG
RtlpComputeScopeSize(
- __in ULONG_PTR UnwindCodePtr,
- __in ULONG_PTR UnwindCodesEndPtr,
- __in BOOLEAN IsEpilog,
- __in PARM64_UNWIND_PARAMS UnwindParams
+ _In_ ULONG_PTR UnwindCodePtr,
+ _In_ ULONG_PTR UnwindCodesEndPtr,
+ _In_ BOOLEAN IsEpilog,
+ _In_ PARM64_UNWIND_PARAMS UnwindParams
)
/*++
@@ -441,10 +441,10 @@ Return Value:
NTSTATUS
RtlpUnwindRestoreRegisterRange(
__inout PT_CONTEXT ContextRecord,
- __in LONG SpOffset,
- __in ULONG FirstRegister,
- __in ULONG RegisterCount,
- __in PARM64_UNWIND_PARAMS UnwindParams
+ _In_ LONG SpOffset,
+ _In_ ULONG FirstRegister,
+ _In_ ULONG RegisterCount,
+ _In_ PARM64_UNWIND_PARAMS UnwindParams
)
/*++
@@ -517,10 +517,10 @@ Return Value:
NTSTATUS
RtlpUnwindRestoreFpRegisterRange(
__inout PT_CONTEXT ContextRecord,
- __in LONG SpOffset,
- __in ULONG FirstRegister,
- __in ULONG RegisterCount,
- __in PARM64_UNWIND_PARAMS UnwindParams
+ _In_ LONG SpOffset,
+ _In_ ULONG FirstRegister,
+ _In_ ULONG RegisterCount,
+ _In_ PARM64_UNWIND_PARAMS UnwindParams
)
/*++
@@ -588,14 +588,14 @@ Return Value:
NTSTATUS
RtlpUnwindFunctionFull(
- __in DWORD64 ControlPcRva,
- __in ULONG_PTR ImageBase,
- __in PT_RUNTIME_FUNCTION FunctionEntry,
+ _In_ DWORD64 ControlPcRva,
+ _In_ ULONG_PTR ImageBase,
+ _In_ PT_RUNTIME_FUNCTION FunctionEntry,
__inout T_CONTEXT *ContextRecord,
- __out PDWORD64 EstablisherFrame,
- __deref_opt_out_opt PEXCEPTION_ROUTINE *HandlerRoutine,
- __out PVOID *HandlerData,
- __in PARM64_UNWIND_PARAMS UnwindParams
+ _Out_ PDWORD64 EstablisherFrame,
+ _Outptr_opt_result_maybenull_ PEXCEPTION_ROUTINE *HandlerRoutine,
+ _Out_ PVOID *HandlerData,
+ _In_ PARM64_UNWIND_PARAMS UnwindParams
)
/*++
@@ -1223,13 +1223,13 @@ Return Value:
NTSTATUS
RtlpUnwindFunctionCompact(
- __in DWORD64 ControlPcRva,
- __in PT_RUNTIME_FUNCTION FunctionEntry,
+ _In_ DWORD64 ControlPcRva,
+ _In_ PT_RUNTIME_FUNCTION FunctionEntry,
__inout T_CONTEXT *ContextRecord,
- __out PDWORD64 EstablisherFrame,
- __deref_opt_out_opt PEXCEPTION_ROUTINE *HandlerRoutine,
- __out PVOID *HandlerData,
- __in PARM64_UNWIND_PARAMS UnwindParams
+ _Out_ PDWORD64 EstablisherFrame,
+ _Outptr_opt_result_maybenull_ PEXCEPTION_ROUTINE *HandlerRoutine,
+ _Out_ PVOID *HandlerData,
+ _In_ PARM64_UNWIND_PARAMS UnwindParams
)
/*++
diff --git a/src/coreclr/unwinder/arm64/unwinder_arm64.h b/src/coreclr/unwinder/arm64/unwinder_arm64.h
index f0767d2c315b31..701a3e4f1eb18e 100644
--- a/src/coreclr/unwinder/arm64/unwinder_arm64.h
+++ b/src/coreclr/unwinder/arm64/unwinder_arm64.h
@@ -25,28 +25,28 @@ class OOPStackUnwinderArm64 : public OOPStackUnwinder
//
protected:
- HRESULT UnwindPrologue(__in DWORD64 ImageBase,
- __in DWORD64 ControlPc,
- __in DWORD64 FrameBase,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ HRESULT UnwindPrologue(_In_ DWORD64 ImageBase,
+ _In_ DWORD64 ControlPc,
+ _In_ DWORD64 FrameBase,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PT_CONTEXT ContextRecord);
- HRESULT VirtualUnwind(__in DWORD64 ImageBase,
- __in DWORD64 ControlPc,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ HRESULT VirtualUnwind(_In_ DWORD64 ImageBase,
+ _In_ DWORD64 ControlPc,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PT_CONTEXT ContextRecord,
- __out PDWORD64 EstablisherFrame);
+ _Out_ PDWORD64 EstablisherFrame);
DWORD64 LookupPrimaryUnwindInfo
- (__in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in DWORD64 ImageBase,
- __out _PIMAGE_RUNTIME_FUNCTION_ENTRY PrimaryEntry);
+ (_In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ DWORD64 ImageBase,
+ _Out_ _PIMAGE_RUNTIME_FUNCTION_ENTRY PrimaryEntry);
_PIMAGE_RUNTIME_FUNCTION_ENTRY SameFunction
- (__in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in DWORD64 ImageBase,
- __in DWORD64 ControlPc,
- __out _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionReturnBuffer);
+ (_In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ DWORD64 ImageBase,
+ _In_ DWORD64 ControlPc,
+ _Out_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionReturnBuffer);
};
#endif // __unwinder_arm64__
diff --git a/src/coreclr/unwinder/i386/unwinder_i386.cpp b/src/coreclr/unwinder/i386/unwinder_i386.cpp
index 958d0afcf45e20..e1294c8afbd1ea 100644
--- a/src/coreclr/unwinder/i386/unwinder_i386.cpp
+++ b/src/coreclr/unwinder/i386/unwinder_i386.cpp
@@ -98,15 +98,15 @@ Routine Description:
--*/
HRESULT
OOPStackUnwinderX86::VirtualUnwind(
- __in DWORD HandlerType,
- __in DWORD ImageBase,
- __in DWORD ControlPc,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ DWORD HandlerType,
+ _In_ DWORD ImageBase,
+ _In_ DWORD ControlPc,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PCONTEXT ContextRecord,
- __out PVOID *HandlerData,
- __out PDWORD EstablisherFrame,
+ _Out_ PVOID *HandlerData,
+ _Out_ PDWORD EstablisherFrame,
__inout_opt PKNONVOLATILE_CONTEXT_POINTERS ContextPointers,
- __deref_opt_out_opt PEXCEPTION_ROUTINE *HandlerRoutine
+ _Outptr_opt_result_maybenull_ PEXCEPTION_ROUTINE *HandlerRoutine
)
{
if (HandlerRoutine != NULL)
@@ -190,13 +190,13 @@ NTSYSAPI
PEXCEPTION_ROUTINE
NTAPI
RtlVirtualUnwind (
- __in DWORD HandlerType,
- __in DWORD ImageBase,
- __in DWORD ControlPc,
- __in PRUNTIME_FUNCTION FunctionEntry,
+ _In_ DWORD HandlerType,
+ _In_ DWORD ImageBase,
+ _In_ DWORD ControlPc,
+ _In_ PRUNTIME_FUNCTION FunctionEntry,
__inout PT_CONTEXT ContextRecord,
- __out PVOID *HandlerData,
- __out PDWORD EstablisherFrame,
+ _Out_ PVOID *HandlerData,
+ _Out_ PDWORD EstablisherFrame,
__inout_opt PT_KNONVOLATILE_CONTEXT_POINTERS ContextPointers
)
{
diff --git a/src/coreclr/unwinder/i386/unwinder_i386.h b/src/coreclr/unwinder/i386/unwinder_i386.h
index 6a6c3896ee6af4..904ec80dea9813 100644
--- a/src/coreclr/unwinder/i386/unwinder_i386.h
+++ b/src/coreclr/unwinder/i386/unwinder_i386.h
@@ -19,15 +19,15 @@ class OOPStackUnwinderX86 : public OOPStackUnwinder
public:
static BOOL Unwind(T_CONTEXT* pContextRecord, T_KNONVOLATILE_CONTEXT_POINTERS* pContextPointers);
- static HRESULT VirtualUnwind(__in DWORD HandlerType,
- __in DWORD ImageBase,
- __in DWORD ControlPc,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ static HRESULT VirtualUnwind(_In_ DWORD HandlerType,
+ _In_ DWORD ImageBase,
+ _In_ DWORD ControlPc,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PCONTEXT ContextRecord,
- __out PVOID *HandlerData,
- __out PDWORD EstablisherFrame,
+ _Out_ PVOID *HandlerData,
+ _Out_ PDWORD EstablisherFrame,
__inout_opt PKNONVOLATILE_CONTEXT_POINTERS ContextPointers,
- __deref_opt_out_opt PEXCEPTION_ROUTINE *HandlerRoutine);
+ _Outptr_opt_result_maybenull_ PEXCEPTION_ROUTINE *HandlerRoutine);
};
#endif // FEATURE_EH_FUNCLETS
diff --git a/src/coreclr/unwinder/unwinder.cpp b/src/coreclr/unwinder/unwinder.cpp
index 98245fef445c09..08829fa4cd513b 100644
--- a/src/coreclr/unwinder/unwinder.cpp
+++ b/src/coreclr/unwinder/unwinder.cpp
@@ -25,7 +25,7 @@ EXTERN_C void GetRuntimeStackWalkInfo(IN ULONG64 ControlPc,
//
HRESULT OOPStackUnwinder::GetModuleBase( DWORD64 address,
- __out PDWORD64 pdwBase)
+ _Out_ PDWORD64 pdwBase)
{
GetRuntimeStackWalkInfo(address, reinterpret_cast(pdwBase), NULL);
return ((*pdwBase == NULL) ? E_FAIL : S_OK);
@@ -47,7 +47,7 @@ HRESULT OOPStackUnwinder::GetModuleBase( DWORD64 address,
//
HRESULT OOPStackUnwinder::GetFunctionEntry( DWORD64 address,
- __out_ecount(cbBuffer) PVOID pBuffer,
+ _Out_writes_(cbBuffer) PVOID pBuffer,
DWORD cbBuffer)
{
if (cbBuffer < sizeof(T_RUNTIME_FUNCTION))
diff --git a/src/coreclr/unwinder/unwinder.h b/src/coreclr/unwinder/unwinder.h
index 0c4838f1ed5ccb..241dc8a7ddfb30 100644
--- a/src/coreclr/unwinder/unwinder.h
+++ b/src/coreclr/unwinder/unwinder.h
@@ -29,11 +29,11 @@ class OOPStackUnwinder
// Given a control PC, return the base of the module it is in. For jitted managed code, this is the
// start of the code heap.
static HRESULT GetModuleBase( DWORD64 address,
- __out PDWORD64 pdwBase);
+ _Out_ PDWORD64 pdwBase);
// Given a control PC, return the function entry of the functoin it is in.
static HRESULT GetFunctionEntry( DWORD64 address,
- __out_ecount(cbBuffer) PVOID pBuffer,
+ _Out_writes_(cbBuffer) PVOID pBuffer,
DWORD cbBuffer);
};
diff --git a/src/coreclr/utilcode/ccomprc.cpp b/src/coreclr/utilcode/ccomprc.cpp
index 21d13a5e5d791a..761d966763f6ca 100644
--- a/src/coreclr/utilcode/ccomprc.cpp
+++ b/src/coreclr/utilcode/ccomprc.cpp
@@ -461,7 +461,7 @@ HRESULT CCompRC::GetLibrary(LocaleID langId, HRESOURCEDLL* phInst)
// We load the localized libraries and cache the handle for future use.
// Mutliple threads may call this, so the cache structure is thread safe.
//*****************************************************************************
-HRESULT CCompRC::LoadString(ResourceCategory eCategory, UINT iResourceID, __out_ecount(iMax) LPWSTR szBuffer, int iMax, int *pcwchUsed)
+HRESULT CCompRC::LoadString(ResourceCategory eCategory, UINT iResourceID, _Out_writes_(iMax) LPWSTR szBuffer, int iMax, int *pcwchUsed)
{
WRAPPER_NO_CONTRACT;
LocaleIDValue langIdValue;
@@ -487,7 +487,7 @@ HRESULT CCompRC::LoadString(ResourceCategory eCategory, UINT iResourceID, __out_
return LoadString(eCategory, langId, iResourceID, szBuffer, iMax, pcwchUsed);
}
-HRESULT CCompRC::LoadString(ResourceCategory eCategory, LocaleID langId, UINT iResourceID, __out_ecount(iMax) LPWSTR szBuffer, int iMax, int *pcwchUsed)
+HRESULT CCompRC::LoadString(ResourceCategory eCategory, LocaleID langId, UINT iResourceID, _Out_writes_(iMax) LPWSTR szBuffer, int iMax, int *pcwchUsed)
{
#ifdef DBI_COMPONENT_MONO
return E_NOTIMPL;
diff --git a/src/coreclr/utilcode/clrconfig.cpp b/src/coreclr/utilcode/clrconfig.cpp
index d4f6ec2adabafb..caad3b594a6eaf 100644
--- a/src/coreclr/utilcode/clrconfig.cpp
+++ b/src/coreclr/utilcode/clrconfig.cpp
@@ -228,7 +228,7 @@ namespace
HRESULT GetConfigDWORD(
LPCWSTR name,
DWORD defValue,
- __out DWORD *result,
+ _Out_ DWORD *result,
LookupOptions options)
{
CONTRACTL
@@ -312,7 +312,7 @@ namespace
// Return Value:
// HRESULT indicating success or failure.
//
- HRESULT TrimWhiteSpace(LPCWSTR wszOrig, __deref_out_z LPWSTR * pwszTrimmed)
+ HRESULT TrimWhiteSpace(LPCWSTR wszOrig, _Outptr_result_z_ LPWSTR * pwszTrimmed)
{
CONTRACTL
{
@@ -537,7 +537,7 @@ LPWSTR CLRConfig::GetConfigValue(const ConfigStringInfo & info)
// not found.
//
// static
-HRESULT CLRConfig::GetConfigValue(const ConfigStringInfo & info, __deref_out_z LPWSTR * outVal)
+HRESULT CLRConfig::GetConfigValue(const ConfigStringInfo & info, _Outptr_result_z_ LPWSTR * outVal)
{
CONTRACT(HRESULT) {
NOTHROW;
@@ -609,7 +609,7 @@ BOOL CLRConfig::IsConfigOptionSpecified(LPCWSTR name)
// Deallocation function for code:CLRConfig::FreeConfigString
//
// static
-void CLRConfig::FreeConfigString(__in_z LPWSTR str)
+void CLRConfig::FreeConfigString(_In_z_ LPWSTR str)
{
LIMITED_METHOD_CONTRACT;
diff --git a/src/coreclr/utilcode/clrhost_nodependencies.cpp b/src/coreclr/utilcode/clrhost_nodependencies.cpp
index 48747e031101ba..7d2fceb3005e1a 100644
--- a/src/coreclr/utilcode/clrhost_nodependencies.cpp
+++ b/src/coreclr/utilcode/clrhost_nodependencies.cpp
@@ -44,8 +44,8 @@ void DisableThrowCheck()
#define CLRThrowsExceptionWorker() RealCLRThrowsExceptionWorker(__FUNCTION__, __FILE__, __LINE__)
-static void RealCLRThrowsExceptionWorker(__in_z const char *szFunction,
- __in_z const char *szFile,
+static void RealCLRThrowsExceptionWorker(_In_z_ const char *szFunction,
+ _In_z_ const char *szFile,
int lineNum)
{
WRAPPER_NO_CONTRACT;
diff --git a/src/coreclr/utilcode/fstring.cpp b/src/coreclr/utilcode/fstring.cpp
index 0f4360e9ffe0b9..9bcd12d1fffc6c 100644
--- a/src/coreclr/utilcode/fstring.cpp
+++ b/src/coreclr/utilcode/fstring.cpp
@@ -23,7 +23,7 @@ namespace FString
#define MAX_LENGTH 0x1fffff00
-HRESULT Unicode_Utf8_Length(__in_z LPCWSTR pString, __out bool * pAllAscii, __out DWORD * pLength)
+HRESULT Unicode_Utf8_Length(_In_z_ LPCWSTR pString, _Out_ bool * pAllAscii, _Out_ DWORD * pLength)
{
CONTRACTL
{
@@ -86,7 +86,7 @@ HRESULT Unicode_Utf8_Length(__in_z LPCWSTR pString, __out bool * pAllAscii, __ou
// UNICODE to UTF8
-HRESULT Unicode_Utf8(__in_z LPCWSTR pString, bool allAscii, __out_z LPSTR pBuffer, DWORD length)
+HRESULT Unicode_Utf8(_In_z_ LPCWSTR pString, bool allAscii, _Out_writes_bytes_(length) LPSTR pBuffer, DWORD length)
{
CONTRACTL
{
@@ -143,7 +143,7 @@ HRESULT Unicode_Utf8(__in_z LPCWSTR pString, bool allAscii, __out_z LPSTR pBuffe
}
-HRESULT Utf8_Unicode_Length(__in_z LPCSTR pString, __out bool * pAllAscii, __out DWORD * pLength)
+HRESULT Utf8_Unicode_Length(_In_z_ LPCSTR pString, _Out_ bool * pAllAscii, _Out_ DWORD * pLength)
{
CONTRACTL
{
@@ -207,7 +207,7 @@ HRESULT Utf8_Unicode_Length(__in_z LPCSTR pString, __out bool * pAllAscii, __out
// UTF8 to Unicode
-HRESULT Utf8_Unicode(__in_z LPCSTR pString, bool allAscii, __out_z LPWSTR pBuffer, DWORD length)
+HRESULT Utf8_Unicode(_In_z_ LPCSTR pString, bool allAscii, _Out_writes_bytes_(length) LPWSTR pBuffer, DWORD length)
{
CONTRACTL
{
@@ -264,7 +264,7 @@ HRESULT Utf8_Unicode(__in_z LPCSTR pString, bool allAscii, __out_z LPWSTR pBuffe
}
-HRESULT ConvertUnicode_Utf8(__in_z LPCWSTR pString, __out_z LPSTR * pBuffer)
+HRESULT ConvertUnicode_Utf8(_In_z_ LPCWSTR pString, _Outptr_result_z_ LPSTR * pBuffer)
{
bool allAscii;
DWORD length;
@@ -289,7 +289,7 @@ HRESULT ConvertUnicode_Utf8(__in_z LPCWSTR pString, __out_z LPSTR * pBuffer)
}
-HRESULT ConvertUtf8_Unicode(__in_z LPCSTR pString, __out_z LPWSTR * pBuffer)
+HRESULT ConvertUtf8_Unicode(_In_z_ LPCSTR pString, _Outptr_result_z_ LPWSTR * pBuffer)
{
bool allAscii;
DWORD length;
diff --git a/src/coreclr/utilcode/loaderheap.cpp b/src/coreclr/utilcode/loaderheap.cpp
index bc377c683ba52d..51e39de70ecf92 100644
--- a/src/coreclr/utilcode/loaderheap.cpp
+++ b/src/coreclr/utilcode/loaderheap.cpp
@@ -502,9 +502,9 @@ class LoaderHeapSniffer
static VOID RecordEvent(UnlockedLoaderHeap *pHeap,
AllocationType allocationType,
- __in const char *szFile,
+ _In_ const char *szFile,
int lineNum,
- __in const char *szAllocFile,
+ _In_ const char *szAllocFile,
int allocLineNum,
void *pMem,
size_t dwRequestedSize,
@@ -1248,7 +1248,7 @@ BOOL UnlockedLoaderHeap::GetMoreCommittedPages(size_t dwMinSize)
}
void *UnlockedLoaderHeap::UnlockedAllocMem(size_t dwSize
- COMMA_INDEBUG(__in const char *szFile)
+ COMMA_INDEBUG(_In_ const char *szFile)
COMMA_INDEBUG(int lineNum))
{
CONTRACT(void*)
@@ -1300,7 +1300,7 @@ static DWORD ShouldInjectFault()
#endif
void *UnlockedLoaderHeap::UnlockedAllocMem_NoThrow(size_t dwSize
- COMMA_INDEBUG(__in const char *szFile)
+ COMMA_INDEBUG(_In_ const char *szFile)
COMMA_INDEBUG(int lineNum))
{
CONTRACT(void*)
@@ -1404,9 +1404,9 @@ void *UnlockedLoaderHeap::UnlockedAllocMem_NoThrow(size_t dwSize
void UnlockedLoaderHeap::UnlockedBackoutMem(void *pMem,
size_t dwRequestedSize
- COMMA_INDEBUG(__in const char *szFile)
+ COMMA_INDEBUG(_In_ const char *szFile)
COMMA_INDEBUG(int lineNum)
- COMMA_INDEBUG(__in const char *szAllocFile)
+ COMMA_INDEBUG(_In_ const char *szAllocFile)
COMMA_INDEBUG(int allocLineNum))
{
CONTRACTL
@@ -1576,7 +1576,7 @@ void UnlockedLoaderHeap::UnlockedBackoutMem(void *pMem,
void *UnlockedLoaderHeap::UnlockedAllocAlignedMem_NoThrow(size_t dwRequestedSize,
size_t alignment,
size_t *pdwExtra
- COMMA_INDEBUG(__in const char *szFile)
+ COMMA_INDEBUG(_In_ const char *szFile)
COMMA_INDEBUG(int lineNum))
{
CONTRACT(void*)
@@ -1713,7 +1713,7 @@ void *UnlockedLoaderHeap::UnlockedAllocAlignedMem_NoThrow(size_t dwRequestedSiz
void *UnlockedLoaderHeap::UnlockedAllocAlignedMem(size_t dwRequestedSize,
size_t dwAlignment,
size_t *pdwExtra
- COMMA_INDEBUG(__in const char *szFile)
+ COMMA_INDEBUG(_In_ const char *szFile)
COMMA_INDEBUG(int lineNum))
{
CONTRACTL
@@ -1908,9 +1908,9 @@ void UnlockedLoaderHeap::UnlockedPrintEvents()
/*static*/ VOID LoaderHeapSniffer::RecordEvent(UnlockedLoaderHeap *pHeap,
AllocationType allocationType,
- __in const char *szFile,
+ _In_ const char *szFile,
int lineNum,
- __in const char *szAllocFile,
+ _In_ const char *szAllocFile,
int allocLineNum,
void *pMem,
size_t dwRequestedSize,
diff --git a/src/coreclr/utilcode/log.cpp b/src/coreclr/utilcode/log.cpp
index b4a73f2cb6bafc..b889c7d341ce3a 100644
--- a/src/coreclr/utilcode/log.cpp
+++ b/src/coreclr/utilcode/log.cpp
@@ -76,7 +76,7 @@ VOID InitLogging()
if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_LogWithPid))
{
WCHAR szPid[20];
- swprintf_s(szPid, COUNTOF(szPid), W(".%d"), GetCurrentProcessId());
+ swprintf_s(szPid, ARRAY_SIZE(szPid), W(".%d"), GetCurrentProcessId());
wcscat_s(szLogFileName.Ptr(), szLogFileName.Size(), szPid);
}
@@ -323,7 +323,7 @@ VOID LogSpewAlwaysValist(const char *fmt, va_list args)
static bool needsPrefix = true;
if (needsPrefix)
- buflen = sprintf_s(pBuffer, COUNTOF(rgchBuffer), "TID %04x: ", GetCurrentThreadId());
+ buflen = sprintf_s(pBuffer, ARRAY_SIZE(rgchBuffer), "TID %04x: ", GetCurrentThreadId());
needsPrefix = (fmt[strlen(fmt)-1] == '\n');
diff --git a/src/coreclr/utilcode/makepath.cpp b/src/coreclr/utilcode/makepath.cpp
index 4bf8787242a1b2..161e859455327d 100644
--- a/src/coreclr/utilcode/makepath.cpp
+++ b/src/coreclr/utilcode/makepath.cpp
@@ -39,11 +39,11 @@
*******************************************************************************/
void MakePath (
- __out CQuickWSTR &szPath,
- __in LPCWSTR drive,
- __in LPCWSTR dir,
- __in LPCWSTR fname,
- __in LPCWSTR ext
+ _Out_ CQuickWSTR &szPath,
+ _In_ LPCWSTR drive,
+ _In_ LPCWSTR dir,
+ _In_ LPCWSTR fname,
+ _In_ LPCWSTR ext
)
{
CONTRACTL
diff --git a/src/coreclr/utilcode/namespaceutil.cpp b/src/coreclr/utilcode/namespaceutil.cpp
index 3731d0399fcdf1..5b6d3d9f95bee8 100644
--- a/src/coreclr/utilcode/namespaceutil.cpp
+++ b/src/coreclr/utilcode/namespaceutil.cpp
@@ -196,9 +196,9 @@ void ns::SplitInline(
//*****************************************************************************
int ns::SplitPath( // true ok, false trunction.
const WCHAR *szPath, // Path to split.
- __out_ecount(cchNameSpace) WCHAR *szNameSpace, // Output for namespace value.
+ _Out_writes_(cchNameSpace) WCHAR *szNameSpace, // Output for namespace value.
int cchNameSpace, // Max chars for output.
- __out_ecount(cchName) WCHAR *szName, // Output for name.
+ _Out_writes_(cchName) WCHAR *szName, // Output for name.
int cchName) // Max chars for output.
{
STATIC_CONTRACT_NOTHROW;
@@ -243,9 +243,9 @@ int ns::SplitPath( // true ok, false trunction.
int ns::SplitPath( // true ok, false trunction.
LPCUTF8 szPath, // Path to split.
- __out_ecount_opt (cchNameSpace) LPUTF8 szNameSpace, // Output for namespace value.
+ _Out_writes_opt_ (cchNameSpace) LPUTF8 szNameSpace, // Output for namespace value.
int cchNameSpace, // Max chars for output.
- __out_ecount_opt (cchName) LPUTF8 szName, // Output for name.
+ _Out_writes_opt_ (cchName) LPUTF8 szName, // Output for name.
int cchName) // Max chars for output.
{
STATIC_CONTRACT_NOTHROW;
@@ -293,7 +293,7 @@ int ns::SplitPath( // true ok, false trunction.
// correct separator.
//*****************************************************************************
int ns::MakePath( // true ok, false truncation.
- __out_ecount(cchChars) WCHAR *szOut, // output path for name.
+ _Out_writes_(cchChars) WCHAR *szOut, // output path for name.
int cchChars, // max chars for output path.
const WCHAR *szNameSpace, // Namespace.
const WCHAR *szName) // Name.
@@ -335,7 +335,7 @@ int ns::MakePath( // true ok, false truncation.
} // int ns::MakePath()
int ns::MakePath( // true ok, false truncation.
- __out_ecount(cchChars) LPUTF8 szOut, // output path for name.
+ _Out_writes_(cchChars) LPUTF8 szOut, // output path for name.
int cchChars, // max chars for output path.
LPCUTF8 szNameSpace, // Namespace.
LPCUTF8 szName) // Name.
@@ -378,7 +378,7 @@ int ns::MakePath( // true ok, false truncation.
} // int ns::MakePath()
int ns::MakePath( // true ok, false truncation.
- __out_ecount(cchChars) WCHAR *szOut, // output path for name.
+ _Out_writes_(cchChars) WCHAR *szOut, // output path for name.
int cchChars, // max chars for output path.
LPCUTF8 szNamespace, // Namespace.
LPCUTF8 szName) // Name.
@@ -513,7 +513,7 @@ void ns::MakePath( // throws on out of memory
}
bool ns::MakeAssemblyQualifiedName( // true ok, false truncation
- __out_ecount(dwBuffer) WCHAR* pBuffer, // Buffer to receive the results
+ _Out_writes_(dwBuffer) WCHAR* pBuffer, // Buffer to receive the results
int dwBuffer, // Number of characters total in buffer
const WCHAR *szTypeName, // Namespace for name.
int dwTypeName, // Number of characters (not including null)
@@ -621,7 +621,7 @@ int ns::MakeNestedTypeName( // true ok, false out of memory
} // int ns::MakeNestedTypeName()
int ns::MakeNestedTypeName( // true ok, false truncation.
- __out_ecount (cchChars) LPUTF8 szOut, // output path for name.
+ _Out_writes_ (cchChars) LPUTF8 szOut, // output path for name.
int cchChars, // max chars for output path.
LPCUTF8 szEnclosingName, // Full name for enclosing type
LPCUTF8 szNestedName) // Full name for nested type
diff --git a/src/coreclr/utilcode/posterror.cpp b/src/coreclr/utilcode/posterror.cpp
index 13cc9960990334..a39367477e0523 100644
--- a/src/coreclr/utilcode/posterror.cpp
+++ b/src/coreclr/utilcode/posterror.cpp
@@ -54,7 +54,7 @@ void SetResourceCultureCallbacks(
//*****************************************************************************
STDAPI UtilLoadStringRC(
UINT iResourceID,
- __out_ecount(iMax) LPWSTR szBuffer,
+ _Out_writes_(iMax) LPWSTR szBuffer,
int iMax,
int bQuiet
)
@@ -63,7 +63,7 @@ STDAPI UtilLoadStringRC(
return UtilLoadResourceString(bQuiet? CCompRC::Optional : CCompRC::Required,iResourceID, szBuffer, iMax);
}
-HRESULT UtilLoadResourceString(CCompRC::ResourceCategory eCategory, UINT iResourceID, __out_ecount (iMax) LPWSTR szBuffer, int iMax)
+HRESULT UtilLoadResourceString(CCompRC::ResourceCategory eCategory, UINT iResourceID, _Out_writes_ (iMax) LPWSTR szBuffer, int iMax)
{
CONTRACTL
{
@@ -98,7 +98,7 @@ HRESULT UtilLoadResourceString(CCompRC::ResourceCategory eCategory, UINT iResour
// Format a Runtime Error message.
//*****************************************************************************
HRESULT __cdecl FormatRuntimeErrorVa(
- __inout_ecount(cchMsg) WCHAR *rcMsg, // Buffer into which to format.
+ _Inout_updates_(cchMsg) WCHAR *rcMsg, // Buffer into which to format.
ULONG cchMsg, // Size of buffer, characters.
HRESULT hrRpt, // The HR to report.
va_list marker) // Optional args.
@@ -158,7 +158,7 @@ HRESULT __cdecl FormatRuntimeErrorVa(
// Format a Runtime Error message, varargs.
//*****************************************************************************
HRESULT __cdecl FormatRuntimeError(
- __out_ecount(cchMsg) WCHAR *rcMsg, // Buffer into which to format.
+ _Out_writes_(cchMsg) WCHAR *rcMsg, // Buffer into which to format.
ULONG cchMsg, // Size of buffer, characters.
HRESULT hrRpt, // The HR to report.
...) // Optional args.
diff --git a/src/coreclr/utilcode/splitpath.cpp b/src/coreclr/utilcode/splitpath.cpp
index b087e6cd3d1259..f5100ef72d3271 100644
--- a/src/coreclr/utilcode/splitpath.cpp
+++ b/src/coreclr/utilcode/splitpath.cpp
@@ -75,11 +75,11 @@ void SplitPath(
// A much more sensible version that just points to each section of the string.
//*******************************************************************************
void SplitPathInterior(
- __in LPCWSTR wszPath,
- __out_opt LPCWSTR *pwszDrive, __out_opt size_t *pcchDrive,
- __out_opt LPCWSTR *pwszDir, __out_opt size_t *pcchDir,
- __out_opt LPCWSTR *pwszFileName, __out_opt size_t *pcchFileName,
- __out_opt LPCWSTR *pwszExt, __out_opt size_t *pcchExt)
+ _In_ LPCWSTR wszPath,
+ _Out_opt_ LPCWSTR *pwszDrive, _Out_opt_ size_t *pcchDrive,
+ _Out_opt_ LPCWSTR *pwszDir, _Out_opt_ size_t *pcchDir,
+ _Out_opt_ LPCWSTR *pwszFileName, _Out_opt_ size_t *pcchFileName,
+ _Out_opt_ LPCWSTR *pwszExt, _Out_opt_ size_t *pcchExt)
{
LIMITED_METHOD_CONTRACT;
@@ -228,7 +228,7 @@ void SplitPathInterior(
*
*******************************************************************************/
-void SplitPath(__in SString const &path,
+void SplitPath(_In_ SString const &path,
__inout_opt SString *drive,
__inout_opt SString *dir,
__inout_opt SString *fname,
diff --git a/src/coreclr/utilcode/sstring.cpp b/src/coreclr/utilcode/sstring.cpp
index a0017a5a003fb4..6b5f7af901ac11 100644
--- a/src/coreclr/utilcode/sstring.cpp
+++ b/src/coreclr/utilcode/sstring.cpp
@@ -2708,7 +2708,7 @@ const WCHAR * SString::DacGetRawUnicode() const
// false if unsuccessful.
//
bool SString::DacGetUnicode(COUNT_T cBufChars,
- __out_z __inout_ecount(cBufChars) WCHAR * pBuffer,
+ _Inout_updates_z_(cBufChars) WCHAR * pBuffer,
COUNT_T * pcNeedChars) const
{
SUPPORTS_DAC;
diff --git a/src/coreclr/utilcode/stacktrace.cpp b/src/coreclr/utilcode/stacktrace.cpp
index dfa07a6d36b479..67126bcdc57d95 100644
--- a/src/coreclr/utilcode/stacktrace.cpp
+++ b/src/coreclr/utilcode/stacktrace.cpp
@@ -905,7 +905,7 @@ CONTEXT * pContext // @parm Context to start the stack trace at; null for curre
void GetStringFromAddr
(
DWORD_PTR dwAddr,
-__out_ecount(cchMaxAssertStackLevelStringLen) LPSTR szString // Place to put string.
+_Out_writes_(cchMaxAssertStackLevelStringLen) LPSTR szString // Place to put string.
// Buffer must hold at least cchMaxAssertStackLevelStringLen.
)
{
@@ -956,7 +956,7 @@ void MagicDeinit(void)
* support this, so we need it for CoreCLR 4, if we require Win2K support
****************************************************************************/
extern "C" __declspec(naked) void __stdcall
-ClrCaptureContext(__out PCONTEXT ctx)
+ClrCaptureContext(_Out_ PCONTEXT ctx)
{
__asm {
push ebx;
diff --git a/src/coreclr/utilcode/stgpoolreadonly.cpp b/src/coreclr/utilcode/stgpoolreadonly.cpp
index 439e9ca42d266a..3c9008bcf470a1 100644
--- a/src/coreclr/utilcode/stgpoolreadonly.cpp
+++ b/src/coreclr/utilcode/stgpoolreadonly.cpp
@@ -89,7 +89,7 @@ void StgPoolReadOnly::Uninit()
//*****************************************************************************
HRESULT StgPoolReadOnly::GetStringW( // Return code.
ULONG iOffset, // Offset of string in pool.
- __out_ecount(cchBuffer) LPWSTR szOut, // Output buffer for string.
+ _Out_writes_(cchBuffer) LPWSTR szOut, // Output buffer for string.
int cchBuffer) // Size of output buffer.
{
STATIC_CONTRACT_NOTHROW;
diff --git a/src/coreclr/utilcode/util.cpp b/src/coreclr/utilcode/util.cpp
index 5d1cdbca61fca6..afc0c057d3ee51 100644
--- a/src/coreclr/utilcode/util.cpp
+++ b/src/coreclr/utilcode/util.cpp
@@ -1338,7 +1338,7 @@ void ConfigString::init(const CLRConfig::ConfigStringInfo & info)
// MyAssembly;mscorlib;System
// MyAssembly;mscorlib System
-AssemblyNamesList::AssemblyNamesList(__in LPWSTR list)
+AssemblyNamesList::AssemblyNamesList(_In_ LPWSTR list)
{
CONTRACTL {
THROWS;
@@ -1430,7 +1430,7 @@ bool AssemblyNamesList::IsInList(LPCUTF8 assemblyName)
// "MyClass:foo2 MyClass:*" will match under _DEBUG
//
-void MethodNamesListBase::Insert(__in_z LPWSTR str)
+void MethodNamesListBase::Insert(_In_z_ LPWSTR str)
{
CONTRACTL {
THROWS;
@@ -3083,7 +3083,7 @@ namespace Reg
}
}
- HRESULT ReadStringValue(HKEY hKey, LPCWSTR wszSubKey, LPCWSTR wszName, __deref_out __deref_out_z LPWSTR* pwszValue)
+ HRESULT ReadStringValue(HKEY hKey, LPCWSTR wszSubKey, LPCWSTR wszName, _Outptr_ _Outptr_result_z_ LPWSTR* pwszValue)
{
CONTRACTL {
NOTHROW;
diff --git a/src/coreclr/utilcode/util_nodependencies.cpp b/src/coreclr/utilcode/util_nodependencies.cpp
index 9dae13a57d3118..650751af0d7e4f 100644
--- a/src/coreclr/utilcode/util_nodependencies.cpp
+++ b/src/coreclr/utilcode/util_nodependencies.cpp
@@ -341,7 +341,7 @@ void GetDebuggerSettingInfo(SString &ssDebuggerString, BOOL *pfAuto)
// * wszDebuggerString can be NULL. When wszDebuggerString is NULL, pcchDebuggerString should
// * point to a DWORD of zero. pcchDebuggerString cannot be NULL, and the DWORD pointed by
// * pcchDebuggerString will store the used or required string buffer size in characters.
-HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString, *pcchDebuggerString) LPWSTR wszDebuggerString, DWORD * pcchDebuggerString, BOOL * pfAuto)
+HRESULT GetDebuggerSettingInfoWorker(_Out_writes_to_opt_(*pcchDebuggerString, *pcchDebuggerString) LPWSTR wszDebuggerString, DWORD * pcchDebuggerString, BOOL * pfAuto)
{
CONTRACTL
{
@@ -478,7 +478,7 @@ HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString,
//*****************************************************************************
HRESULT GetStr(
DWORD hHexNum,
- __out_ecount((cbHexNum * 2)) LPWSTR szHexNum,
+ _Out_writes_((cbHexNum * 2)) LPWSTR szHexNum,
DWORD cbHexNum)
{
CONTRACTL
@@ -512,7 +512,7 @@ HRESULT GetStr(
int
GuidToLPWSTR(
GUID Guid, // The GUID to convert.
- __out_ecount(cchGuid) LPWSTR szGuid, // String into which the GUID is stored
+ _Out_writes_(cchGuid) LPWSTR szGuid, // String into which the GUID is stored
DWORD cchGuid) // Count in wchars
{
CONTRACTL
@@ -579,7 +579,7 @@ GuidToLPWSTR(
//*****************************************************************************
HRESULT GetHex(
DWORD * phHexNum,
- __in_ecount((cbHexNum * 2)) LPCWSTR szHexNum,
+ _In_reads_((cbHexNum * 2)) LPCWSTR szHexNum,
DWORD cbHexNum)
{
CONTRACTL
@@ -624,7 +624,7 @@ HRESULT GetHex(
BOOL
LPWSTRToGuid(
GUID * Guid, // [OUT] The GUID to fill in
- __in_ecount(cchGuid) LPCWSTR szGuid, // [IN] String to parse
+ _In_reads_(cchGuid) LPCWSTR szGuid, // [IN] String to parse
DWORD cchGuid) // [IN] Count in wchars in string
{
CONTRACTL
@@ -742,7 +742,7 @@ void ConfigDWORD::init(const CLRConfig::ConfigDWORDInfo & info)
// terminator); [out] Points to length in chars of trimmed substring (not
// counting null terminator)
//
-void TrimWhiteSpace(__deref_inout_ecount(*pcch) LPCWSTR *pwsz, __inout LPDWORD pcch)
+void TrimWhiteSpace(_Outptr_result_buffer_(*pcch) LPCWSTR *pwsz, __inout LPDWORD pcch)
{
LIMITED_METHOD_DAC_CONTRACT;
diff --git a/src/coreclr/vm/CMakeLists.txt b/src/coreclr/vm/CMakeLists.txt
index bbc411c324cde4..2f34d2c0ceaa17 100644
--- a/src/coreclr/vm/CMakeLists.txt
+++ b/src/coreclr/vm/CMakeLists.txt
@@ -617,7 +617,6 @@ if(CLR_CMAKE_TARGET_WIN32)
dispatchinfo.cpp
dispparammarshaler.cpp
mngstdinterfaces.cpp
- notifyexternals.cpp
olecontexthelpers.cpp
runtimecallablewrapper.cpp
stdinterfaces.cpp
@@ -634,7 +633,6 @@ if(CLR_CMAKE_TARGET_WIN32)
dispatchinfo.h
dispparammarshaler.h
mngstdinterfaces.h
- notifyexternals.h
olecontexthelpers.h
runtimecallablewrapper.h
stdinterfaces.h
diff --git a/src/coreclr/vm/amd64/cgencpu.h b/src/coreclr/vm/amd64/cgencpu.h
index 29b9dddfb7de44..33589c27bae392 100644
--- a/src/coreclr/vm/amd64/cgencpu.h
+++ b/src/coreclr/vm/amd64/cgencpu.h
@@ -415,8 +415,6 @@ extern "C" void setFPReturn(int fpSize, INT64 retVal);
extern "C" void getFPReturn(int fpSize, INT64 *retval);
-struct ComToManagedExRecord; // defined in cgencpu.cpp
-
#include
struct DECLSPEC_ALIGN(8) UMEntryThunkCode
{
diff --git a/src/coreclr/vm/arm64/asmhelpers.S b/src/coreclr/vm/arm64/asmhelpers.S
index 7d8b3c7dd88b23..e7725cd16e63b6 100644
--- a/src/coreclr/vm/arm64/asmhelpers.S
+++ b/src/coreclr/vm/arm64/asmhelpers.S
@@ -551,152 +551,6 @@ LOCAL_LABEL(LNullThis):
LEAF_END SinglecastDelegateInvokeStub, _TEXT
-#ifdef FEATURE_COMINTEROP
-
-#define ComCallPreStub_FrameSize (SIZEOF__GSCookie + SIZEOF__ComMethodFrame)
-#define ComCallPreStub_FirstStackAdjust (8 + SIZEOF__ArgumentRegisters + 2 * 8) // x8, reg args , fp & lr already pushed
-#define ComCallPreStub_StackAlloc0 (ComCallPreStub_FrameSize - ComCallPreStub_FirstStackAdjust)
-#define ComCallPreStub_StackAlloc1 (ComCallPreStub_StackAlloc0 + SIZEOF__FloatArgumentRegisters + 8)// 8 for ErrorReturn
-#define ComCallPreStub_StackAlloc (ComCallPreStub_StackAlloc1 + (ComCallPreStub_StackAlloc1 & 8))
-
-#define ComCallPreStub_FrameOffset (ComCallPreStub_StackAlloc - (SIZEOF__ComMethodFrame - ComCallPreStub_FirstStackAdjust))
-#define ComCallPreStub_ErrorReturnOffset0 SIZEOF__FloatArgumentRegisters
-
-#define ComCallPreStub_FirstStackAdjust (ComCallPreStub_ErrorReturnOffset0 + (ComCallPreStub_ErrorReturnOffset0 & 8))
-
-// ------------------------------------------------------------------
-// COM to CLR stub called the first time a particular method is invoked.//
-//
-// On entry:
-// x12 : ComCallMethodDesc* provided by prepad thunk
-// plus user arguments in registers and on the stack
-//
-// On exit:
-// tail calls to real method
-//
-NESTED_ENTRY ComCallPreStub, _TEXT, NoHandler
-
- // Save arguments and return address
- PROLOG_SAVE_REG_PAIR fp, lr, -ComCallPreStub_FirstStackAdjust!
- PROLOG_STACK_ALLOC ComCallPreStub_StackAlloc
-
- SAVE_ARGUMENT_REGISTERS sp, (16+ComCallPreStub_StackAlloc)
-
- SAVE_FLOAT_ARGUMENT_REGISTERS sp, 0
-
- str x12, [sp, #(ComCallPreStub_FrameOffset + UnmanagedToManagedFrame__m_pvDatum)]
- add x0, sp, #(ComCallPreStub_FrameOffset)
- add x1, sp, #(ComCallPreStub_ErrorReturnOffset)
- bl C_FUNC(ComPreStubWorker)
-
- cbz x0, LOCAL_LABEL(ComCallPreStub_ErrorExit)
-
- mov x12, x0
-
- // pop the stack and restore original register state
- RESTORE_FLOAT_ARGUMENT_REGISTERS sp, 0
- RESTORE_ARGUMENT_REGISTERS sp, (16+ComCallPreStub_StackAlloc)
-
- EPILOG_STACK_FREE ComCallPreStub_StackAlloc
- EPILOG_RESTORE_REG_PAIR fp, lr, ComCallPreStub_FirstStackAdjust!
-
- // and tailcall to the actual method
- EPILOG_BRANCH_REG x12
-
-ComCallPreStub_ErrorExit
- ldr x0, [sp, #(ComCallPreStub_ErrorReturnOffset)] // ErrorReturn
-
- // pop the stack
- EPILOG_STACK_FREE ComCallPreStub_StackAlloc
- EPILOG_RESTORE_REG_PAIR fp, lr, ComCallPreStub_FirstStackAdjust!
-
- EPILOG_RETURN
-
-NESTED_END ComCallPreStub, _TEXT
-
-// ------------------------------------------------------------------
-// COM to CLR stub which sets up a ComMethodFrame and calls COMToCLRWorker.
-//
-// On entry:
-// x12 : ComCallMethodDesc* provided by prepad thunk
-// plus user arguments in registers and on the stack
-//
-// On exit:
-// Result in x0/d0 as per the real method being called
-//
- NESTED_ENTRY GenericComCallStub, _TEXT, NoHandler
-
- // Save arguments and return address
- PROLOG_SAVE_REG_PAIR fp, lr, -GenericComCallStub_FirstStackAdjust!
- PROLOG_STACK_ALLOC GenericComCallStub_StackAlloc
-
- SAVE_ARGUMENT_REGISTERS sp, (16+GenericComCallStub_StackAlloc)
- SAVE_FLOAT_ARGUMENT_REGISTERS sp, 0
-
- str x12, [sp, #(GenericComCallStub_FrameOffset + UnmanagedToManagedFrame__m_pvDatum)]
- add x1, sp, #GenericComCallStub_FrameOffset
- bl C_FUNC(COMToCLRWorker)
-
- // pop the stack
- EPILOG_STACK_FREE GenericComCallStub_StackAlloc
- EPILOG_RESTORE_REG_PAIR fp, lr, GenericComCallStub_FirstStackAdjust!
-
- EPILOG_RETURN
-
- NESTED_END GenericComCallStub, _TEXT
-
-// ------------------------------------------------------------------
-// COM to CLR stub called from COMToCLRWorker that actually dispatches to the real managed method.
-//
-// On entry:
-// x0 : dwStackSlots, count of argument stack slots to copy
-// x1 : pFrame, ComMethodFrame pushed by GenericComCallStub above
-// x2 : pTarget, address of code to call
-// x3 : pSecretArg, hidden argument passed to target above in x12
-// x4 : pDangerousThis, managed 'this' reference
-//
-// On exit:
-// Result in x0/d0 as per the real method being called
-//
- NESTED_ENTRY COMToCLRDispatchHelper, _TEXT,CallDescrWorkerUnwindFrameChainHandler
-
- PROLOG_SAVE_REG_PAIR fp, lr, -16!
-
- cbz x0, LOCAL_LABEL(COMToCLRDispatchHelper_RegSetup)
-
- add x9, x1, #SIZEOF__ComMethodFrame
- add x9, x9, x0, LSL #3
-COMToCLRDispatchHelper_StackLoop
- ldr x8, [x9, #-8]!
- str x8, [sp, #-8]!
- sub x0, x0, #1
- cbnz x0, LOCAL_LABEL(COMToCLRDispatchHelper_StackLoop)
-
-COMToCLRDispatchHelper_RegSetup
-
- RESTORE_FLOAT_ARGUMENT_REGISTERS x1, -1 * GenericComCallStub_FrameOffset
-
- mov lr, x2
- mov x12, x3
-
- mov x0, x4
-
- ldp x2, x3, [x1, #(SIZEOF__ComMethodFrame - SIZEOF__ArgumentRegisters + 16)]
- ldp x4, x5, [x1, #(SIZEOF__ComMethodFrame - SIZEOF__ArgumentRegisters + 32)]
- ldp x6, x7, [x1, #(SIZEOF__ComMethodFrame - SIZEOF__ArgumentRegisters + 48)]
- ldr x8, [x1, #(SIZEOF__ComMethodFrame - SIZEOF__ArgumentRegisters - 8)]
-
- ldr x1, [x1, #(SIZEOF__ComMethodFrame - SIZEOF__ArgumentRegisters + 8)]
-
- blr lr
-
- EPILOG_STACK_RESTORE
- EPILOG_RESTORE_REG_PAIR fp, lr, 16!
- EPILOG_RETURN
-
- NESTED_END COMToCLRDispatchHelper, _TEXT
-
-#endif // FEATURE_COMINTEROP
//
// x12 = UMEntryThunk*
//
@@ -1039,39 +893,6 @@ DynamicHelper DynamicHelperFrameFlags_ObjectArg, _Obj
DynamicHelper DynamicHelperFrameFlags_ObjectArg | DynamicHelperFrameFlags_ObjectArg2, _ObjObj
#endif
-#ifdef FEATURE_COMINTEROP
-
-// Function used by COM interop to get floating point return value (since it's not in the same
-// register(s) as non-floating point values).
-//
-// On entry//
-// x0 : size of the FP result (4 or 8 bytes)
-// x1 : pointer to 64-bit buffer to receive result
-//
-// On exit:
-// buffer pointed to by x1 on entry contains the float or double argument as appropriate
-//
-LEAF_ENTRY getFPReturn, _TEXT
- str d0, [x1]
-LEAF_END getFPReturn, _TEXT
-
-// ------------------------------------------------------------------
-// Function used by COM interop to set floating point return value (since it's not in the same
-// register(s) as non-floating point values).
-//
-// On entry:
-// x0 : size of the FP result (4 or 8 bytes)
-// x1 : 32-bit or 64-bit FP result
-//
-// On exit:
-// s0 : float result if x0 == 4
-// d0 : double result if x0 == 8
-//
-LEAF_ENTRY setFPReturn, _TEXT
- fmov d0, x1
-LEAF_END setFPReturn, _TEXT
-#endif
-
//
// JIT Static access helpers when coreclr host specifies single appdomain flag
//
diff --git a/src/coreclr/vm/array.cpp b/src/coreclr/vm/array.cpp
index a8494c45d8ed6b..1088bacb6275b4 100644
--- a/src/coreclr/vm/array.cpp
+++ b/src/coreclr/vm/array.cpp
@@ -981,7 +981,7 @@ Stub *GenerateArrayOpStub(ArrayMethodDesc* pMD)
static const ILStubTypes stubTypes[3] = { ILSTUB_ARRAYOP_GET, ILSTUB_ARRAYOP_SET, ILSTUB_ARRAYOP_ADDRESS };
- _ASSERTE(pMD->GetArrayFuncIndex() <= COUNTOF(stubTypes));
+ _ASSERTE(pMD->GetArrayFuncIndex() <= ARRAY_SIZE(stubTypes));
NDirectStubFlags arrayOpStubFlag = (NDirectStubFlags)stubTypes[pMD->GetArrayFuncIndex()];
MethodDesc * pStubMD = ILStubCache::CreateAndLinkNewILStubMethodDesc(pMD->GetLoaderAllocator(),
diff --git a/src/coreclr/vm/callingconvention.h b/src/coreclr/vm/callingconvention.h
index 00cc47e9661d0c..1fe96fde98922f 100644
--- a/src/coreclr/vm/callingconvention.h
+++ b/src/coreclr/vm/callingconvention.h
@@ -694,9 +694,8 @@ class ArgIteratorTemplate : public ARGITERATOR_BASE
unsigned byteArgSize = GetArgSize();
- // Question: why do not arm and x86 have similar checks?
- // Composites greater than 16 bytes are passed by reference
- if ((GetArgType() == ELEMENT_TYPE_VALUETYPE) && (byteArgSize > ENREGISTERED_PARAMTYPE_MAXSIZE))
+ // On ARM64 some composites are implicitly passed by reference.
+ if (IsArgPassedByRef())
{
byteArgSize = TARGET_POINTER_SIZE;
}
diff --git a/src/coreclr/vm/ceeload.cpp b/src/coreclr/vm/ceeload.cpp
index e41efa704c72fd..72a2e1152210b8 100644
--- a/src/coreclr/vm/ceeload.cpp
+++ b/src/coreclr/vm/ceeload.cpp
@@ -3857,7 +3857,7 @@ MethodDesc *Module::FindMethod(mdToken pMethod)
#ifdef _DEBUG
CONTRACT_VIOLATION(ThrowsViolation);
char szMethodName [MAX_CLASSNAME_LENGTH];
- CEEInfo::findNameOfToken(this, pMethod, szMethodName, COUNTOF (szMethodName));
+ CEEInfo::findNameOfToken(this, pMethod, szMethodName, ARRAY_SIZE(szMethodName));
// This used to be IJW, but changed to LW_INTEROP to reclaim a bit in our log facilities
LOG((LF_INTEROP, LL_INFO10, "Failed to find Method: %s for Vtable Fixup\n", szMethodName));
#endif // _DEBUG
@@ -5765,7 +5765,7 @@ ExternalMethodBlobEntry::ExternalMethodBlobEntry(mdToken _nestedClass,
return static_cast(pEntry);
}
-static bool GetBasename(LPCWSTR _src, __out_ecount(dstlen) __out_z LPWSTR _dst, int dstlen)
+static bool GetBasename(LPCWSTR _src, _Out_writes_z_(dstlen) LPWSTR _dst, int dstlen)
{
LIMITED_METHOD_CONTRACT;
LPCWSTR src = _src;
diff --git a/src/coreclr/vm/ceemain.cpp b/src/coreclr/vm/ceemain.cpp
index 593b8ff3a83d60..93ea7df27ed8c8 100644
--- a/src/coreclr/vm/ceemain.cpp
+++ b/src/coreclr/vm/ceemain.cpp
@@ -185,7 +185,6 @@
#ifdef FEATURE_COMINTEROP
#include "runtimecallablewrapper.h"
-#include "notifyexternals.h"
#include "mngstdinterfaces.h"
#include "interoplibinterface.h"
#endif // FEATURE_COMINTEROP
@@ -221,7 +220,7 @@
#include "genanalysis.h"
-static int GetThreadUICultureId(__out LocaleIDValue* pLocale); // TODO: This shouldn't use the LCID. We should rely on name instead
+static int GetThreadUICultureId(_Out_ LocaleIDValue* pLocale); // TODO: This shouldn't use the LCID. We should rely on name instead
static HRESULT GetThreadUICultureNames(__inout StringArrayList* pCultureNames);
@@ -2136,7 +2135,7 @@ INT32 GetLatchedExitCode (void)
// Impl for UtilLoadStringRC Callback: In VM, we let the thread decide culture
// Return an int uniquely describing which language this thread is using for ui.
// ---------------------------------------------------------------------------
-static int GetThreadUICultureId(__out LocaleIDValue* pLocale)
+static int GetThreadUICultureId(_Out_ LocaleIDValue* pLocale)
{
CONTRACTL{
NOTHROW;
diff --git a/src/coreclr/vm/classhash.cpp b/src/coreclr/vm/classhash.cpp
index 1974e7c3a26db1..28c636f7c9aadd 100644
--- a/src/coreclr/vm/classhash.cpp
+++ b/src/coreclr/vm/classhash.cpp
@@ -348,7 +348,7 @@ EEClassHashEntry_t *EEClassHashTable::InsertValue(LPCUTF8 pszNamespace, LPCUTF8
class ConstructKeyCallbackValidate : public EEClassHashTable::ConstructKeyCallback
{
public:
- virtual void UseKeys(__in_ecount(2) LPUTF8 *Key)
+ virtual void UseKeys(_In_reads_(2) LPUTF8 *Key)
{
LIMITED_METHOD_CONTRACT;
STATIC_CONTRACT_DEBUG_ONLY;
@@ -693,7 +693,7 @@ EEClassHashEntry_t * EEClassHashTable::GetValue(const NameHandle* pName, PTR_VOI
class ConstructKeyCallbackCompare : public EEClassHashTable::ConstructKeyCallback
{
public:
- virtual void UseKeys(__in_ecount(2) LPUTF8 *pKey1)
+ virtual void UseKeys(_In_reads_(2) LPUTF8 *pKey1)
{
LIMITED_METHOD_CONTRACT;
SUPPORTS_DAC;
@@ -757,7 +757,7 @@ BOOL EEClassHashTable::CompareKeys(PTR_EEClassHashEntry pEntry, LPCUTF8 * pKey2)
class ConstructKeyCallbackCaseInsensitive : public EEClassHashTable::ConstructKeyCallback
{
public:
- virtual void UseKeys(__in_ecount(2) LPUTF8 *key)
+ virtual void UseKeys(_In_reads_(2) LPUTF8 *key)
{
WRAPPER_NO_CONTRACT;
diff --git a/src/coreclr/vm/classhash.h b/src/coreclr/vm/classhash.h
index 4d8da2e7c22c61..4fd943165b4787 100644
--- a/src/coreclr/vm/classhash.h
+++ b/src/coreclr/vm/classhash.h
@@ -86,7 +86,7 @@ class EEClassHashTable : public DacEnumerableHashTable::GrowTable()
template
DWORD DacEnumerableHashTable::NextLargestPrime(DWORD dwNumber)
{
- for (DWORD i = 0; i < COUNTOF(g_rgPrimes); i++)
+ for (DWORD i = 0; i < ARRAY_SIZE(g_rgPrimes); i++)
if (g_rgPrimes[i] >= dwNumber)
{
dwNumber = g_rgPrimes[i];
@@ -400,8 +400,8 @@ namespace HashTableDetail
{
// Use the C++ detection idiom (https://isocpp.org/blog/2017/09/detection-idiom-a-stopgap-for-concepts-simon-brand) to call the
// derived table's EnumMemoryRegionsForEntry method if it defines one.
- template
- using void_t = void;
+ template struct make_void { using type = void; };
+ template using void_t = typename make_void::type;
template
struct negation : std::integral_constant { };
diff --git a/src/coreclr/vm/dbginterface.h b/src/coreclr/vm/dbginterface.h
index 0a3e7d0520ce00..51b2c3bf36358f 100644
--- a/src/coreclr/vm/dbginterface.h
+++ b/src/coreclr/vm/dbginterface.h
@@ -263,8 +263,8 @@ class DebugInterface
virtual void SendLogSwitchSetting (int iLevel,
int iReason,
- __in_z LPCWSTR pLogSwitchName,
- __in_z LPCWSTR pParentSwitchName) = 0;
+ _In_z_ LPCWSTR pLogSwitchName,
+ _In_z_ LPCWSTR pParentSwitchName) = 0;
virtual bool IsLoggingEnabled (void) = 0;
@@ -374,7 +374,7 @@ class DebugInterface
virtual DWORD* GetJMCFlagAddr(Module * pModule) = 0;
// notification for SQL fiber debugging support
- virtual void CreateConnection(CONNID dwConnectionId, __in_z WCHAR *wzName) = 0;
+ virtual void CreateConnection(CONNID dwConnectionId, _In_z_ WCHAR *wzName) = 0;
virtual void DestroyConnection(CONNID dwConnectionId) = 0;
virtual void ChangeConnection(CONNID dwConnectionId) = 0;
diff --git a/src/coreclr/vm/debughelp.cpp b/src/coreclr/vm/debughelp.cpp
index 17e62fcdf7208b..822ee4a233fb40 100644
--- a/src/coreclr/vm/debughelp.cpp
+++ b/src/coreclr/vm/debughelp.cpp
@@ -337,7 +337,7 @@ MethodDesc* AsMethodDesc(size_t addr)
/*******************************************************************/
WCHAR* formatMethodTable(MethodTable* pMT,
- __out_z __inout_ecount(bufSize) WCHAR* buff,
+ _Inout_updates_z_(bufSize) WCHAR* buff,
DWORD bufSize)
{
CONTRACTL
@@ -377,7 +377,7 @@ WCHAR* formatMethodTable(MethodTable* pMT,
/*******************************************************************/
WCHAR* formatMethodDesc(MethodDesc* pMD,
- __out_z __inout_ecount(bufSize) WCHAR* buff,
+ _Inout_updates_z_(bufSize) WCHAR* buff,
DWORD bufSize)
{
CONTRACTL
@@ -1015,7 +1015,7 @@ void printfToDbgOut(const char* fmt, ...)
va_start(args, fmt);
char buffer[4096];
- _vsnprintf_s(buffer, COUNTOF(buffer), _TRUNCATE, fmt, args);
+ _vsnprintf_s(buffer, ARRAY_SIZE(buffer), _TRUNCATE, fmt, args);
va_end(args);
OutputDebugStringA( buffer );
diff --git a/src/coreclr/vm/dispatchinfo.cpp b/src/coreclr/vm/dispatchinfo.cpp
index 3b231c3882baa2..b026040ce0b201 100644
--- a/src/coreclr/vm/dispatchinfo.cpp
+++ b/src/coreclr/vm/dispatchinfo.cpp
@@ -197,7 +197,7 @@ void DispatchMemberInfo::Init()
EX_END_CATCH(RethrowTerminalExceptions);
}
-HRESULT DispatchMemberInfo::GetIDsOfParameters(__in_ecount(NumNames) WCHAR **astrNames, int NumNames, DISPID *aDispIds, BOOL bCaseSensitive)
+HRESULT DispatchMemberInfo::GetIDsOfParameters(_In_reads_(NumNames) WCHAR **astrNames, int NumNames, DISPID *aDispIds, BOOL bCaseSensitive)
{
CONTRACTL
{
diff --git a/src/coreclr/vm/dispatchinfo.h b/src/coreclr/vm/dispatchinfo.h
index c109741eea6dda..623a56c7ab0c5e 100644
--- a/src/coreclr/vm/dispatchinfo.h
+++ b/src/coreclr/vm/dispatchinfo.h
@@ -68,7 +68,7 @@ struct DispatchMemberInfo
}
// This method retrieves the ID's of the specified names.
- HRESULT GetIDsOfParameters(__in_ecount(NumNames) WCHAR **astrNames, int NumNames, DISPID *aDispIds, BOOL bCaseSensitive);
+ HRESULT GetIDsOfParameters(_In_reads_(NumNames) WCHAR **astrNames, int NumNames, DISPID *aDispIds, BOOL bCaseSensitive);
// Accessors.
PTRARRAYREF GetParameters();
diff --git a/src/coreclr/vm/dllimportcallback.cpp b/src/coreclr/vm/dllimportcallback.cpp
index 455d33813eec03..65d2afd7d05128 100644
--- a/src/coreclr/vm/dllimportcallback.cpp
+++ b/src/coreclr/vm/dllimportcallback.cpp
@@ -195,37 +195,6 @@ extern "C" VOID STDCALL ReversePInvokeBadTransition()
);
}
-// Disable from a place that is calling into managed code via a UMEntryThunk.
-extern "C" VOID STDCALL UMThunkStubRareDisableWorker(Thread *pThread, UMEntryThunk *pUMEntryThunk)
-{
- STATIC_CONTRACT_THROWS;
- STATIC_CONTRACT_GC_TRIGGERS;
-
- // Do not add a CONTRACT here. We haven't set up SEH.
-
- // WARNING!!!!
- // when we start executing here, we are actually in cooperative mode. But we
- // haven't synchronized with the barrier to reentry yet. So we are in a highly
- // dangerous mode. If we call managed code, we will potentially be active in
- // the GC heap, even as GC's are occuring!
-
- // We must do the following in this order, because otherwise we would be constructing
- // the exception for the abort without synchronizing with the GC. Also, we have no
- // CLR SEH set up, despite the fact that we may throw a ThreadAbortException.
- pThread->RareDisablePreemptiveGC();
- pThread->HandleThreadAbort();
-
-#ifdef DEBUGGING_SUPPORTED
- // If the debugger is attached, we use this opportunity to see if
- // we're disabling preemptive GC on the way into the runtime from
- // unmanaged code. We end up here because
- // Increment/DecrementTraceCallCount() will bump
- // g_TrapReturningThreads for us.
- if (CORDebuggerTraceCall())
- g_pDebugInterface->TraceCall((const BYTE *)pUMEntryThunk->GetManagedTarget());
-#endif // DEBUGGING_SUPPORTED
-}
-
PCODE TheUMEntryPrestubWorker(UMEntryThunk * pUMEntryThunk)
{
STATIC_CONTRACT_THROWS;
@@ -234,39 +203,13 @@ PCODE TheUMEntryPrestubWorker(UMEntryThunk * pUMEntryThunk)
Thread * pThread = GetThreadNULLOk();
if (pThread == NULL)
- pThread = CreateThreadBlockThrow();
-
- GCX_COOP_THREAD_EXISTS(pThread);
-
- if (pThread->IsAbortRequested())
- pThread->HandleThreadAbort();
-
- UMEntryThunk::DoRunTimeInit(pUMEntryThunk);
-
- return (PCODE)pUMEntryThunk->GetCode();
-}
-
-void RunTimeInit_Wrapper(LPVOID /* UMThunkMarshInfo * */ ptr)
-{
- WRAPPER_NO_CONTRACT;
-
- UMEntryThunk::DoRunTimeInit((UMEntryThunk*)ptr);
-}
-
-
-// asm entrypoint
-void STDCALL UMEntryThunk::DoRunTimeInit(UMEntryThunk* pUMEntryThunk)
-{
-
- CONTRACTL
{
- THROWS;
- GC_TRIGGERS;
- MODE_COOPERATIVE;
- ENTRY_POINT;
- PRECONDITION(CheckPointer(pUMEntryThunk));
+ CREATETHREAD_IF_NULL_FAILFAST(pThread, W("Failed to setup new thread during reverse P/Invoke"));
}
- CONTRACTL_END;
+
+ // Verify the current thread isn't in COOP mode.
+ if (pThread->PreemptiveGCDisabled())
+ ReversePInvokeBadTransition();
INSTALL_MANAGED_EXCEPTION_DISPATCHER;
// this method is called by stubs which are called by managed code,
@@ -274,15 +217,13 @@ void STDCALL UMEntryThunk::DoRunTimeInit(UMEntryThunk* pUMEntryThunk)
// exceptions don't leak out into managed code.
INSTALL_UNWIND_AND_CONTINUE_HANDLER;
- {
- GCX_PREEMP();
-
- ExecutableWriterHolder uMEntryThunkWriterHolder(pUMEntryThunk, sizeof(UMEntryThunk));
- uMEntryThunkWriterHolder.GetRW()->RunTimeInit(pUMEntryThunk);
- }
+ ExecutableWriterHolder uMEntryThunkWriterHolder(pUMEntryThunk, sizeof(UMEntryThunk));
+ uMEntryThunkWriterHolder.GetRW()->RunTimeInit(pUMEntryThunk);
UNINSTALL_UNWIND_AND_CONTINUE_HANDLER;
UNINSTALL_MANAGED_EXCEPTION_DISPATCHER;
+
+ return (PCODE)pUMEntryThunk->GetCode();
}
UMEntryThunk* UMEntryThunk::CreateUMEntryThunk()
diff --git a/src/coreclr/vm/dllimportcallback.h b/src/coreclr/vm/dllimportcallback.h
index 14b7db5704824f..fb2214a8c18d5a 100644
--- a/src/coreclr/vm/dllimportcallback.h
+++ b/src/coreclr/vm/dllimportcallback.h
@@ -16,6 +16,12 @@
#include "class.h"
#include "dllimport.h"
+class UMThunkMarshInfo;
+typedef DPTR(class UMThunkMarshInfo) PTR_UMThunkMarshInfo;
+
+class UMEntryThunk;
+typedef DPTR(class UMEntryThunk) PTR_UMEntryThunk;
+
//----------------------------------------------------------------------
// This structure collects all information needed to marshal an
// unmanaged->managed thunk. The only information missing is the
@@ -189,9 +195,6 @@ class UMEntryThunk
#endif // _DEBUG
}
- // asm entrypoint
- static VOID STDCALL DoRunTimeInit(UMEntryThunk* pThis);
-
PCODE GetManagedTarget() const
{
CONTRACT (PCODE)
@@ -396,14 +399,7 @@ class UMEntryThunkCache
};
#if defined(TARGET_X86) && !defined(FEATURE_STUBS_AS_IL)
-//-------------------------------------------------------------------------
-// One-time creation of special prestub to initialize UMEntryThunks.
-//-------------------------------------------------------------------------
-Stub *GenerateUMThunkPrestub();
-
EXCEPTION_HANDLER_DECL(FastNExportExceptHandler);
-EXCEPTION_HANDLER_DECL(UMThunkPrestubHandler);
-
#endif // TARGET_X86 && !FEATURE_STUBS_AS_IL
extern "C" void TheUMEntryPrestub(void);
diff --git a/src/coreclr/vm/dwbucketmanager.hpp b/src/coreclr/vm/dwbucketmanager.hpp
index 9731b2081c92d6..2524f706c7ef3f 100644
--- a/src/coreclr/vm/dwbucketmanager.hpp
+++ b/src/coreclr/vm/dwbucketmanager.hpp
@@ -156,7 +156,7 @@ class BytesToBase32
WCHAR GetNextChar();
BOOL MoreChars() { LIMITED_METHOD_CONTRACT; return pData < pEnd; }
- int Convert(__inout_ecount(nOut) LPWSTR pOut, int nOut);
+ int Convert(_Inout_updates_(nOut) LPWSTR pOut, int nOut);
};
// This table tells how to pick out 5-bits at a time (8 times) from 5-bytes of data.
@@ -265,7 +265,7 @@ WCHAR BytesToBase32::GetNextChar()
//
//------------------------------------------------------------------------------
int BytesToBase32::Convert(
- __inout_ecount(nOut) LPWSTR pOut,
+ _Inout_updates_(nOut) LPWSTR pOut,
int nOut)
{
WRAPPER_NO_CONTRACT;
@@ -304,32 +304,32 @@ class BaseBucketParamsManager
bool IsCodeContractsFrame(MethodDesc* pMD);
OBJECTREF GetRealExceptionObject();
WCHAR* GetParamBufferForIndex(BucketParameterIndex paramIndex);
- void LogParam(__in_z LPCWSTR paramValue, BucketParameterIndex paramIndex);
+ void LogParam(_In_z_ LPCWSTR paramValue, BucketParameterIndex paramIndex);
protected:
~BaseBucketParamsManager();
- typedef void (BaseBucketParamsManager::*DataPopulatorFunction)(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
+ typedef void (BaseBucketParamsManager::*DataPopulatorFunction)(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
void PopulateBucketParameter(BucketParameterIndex paramIndex, DataPopulatorFunction pFnDataPopulator, int maxLength);
void PopulateEventName(LPCWSTR eventTypeName);
// functions for retrieving data to go into various bucket parameters
- void GetAppName(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetAppVersion(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetAppTimeStamp(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetModuleName(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetModuleVersion(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetModuleTimeStamp(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetMethodDef(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetIlOffset(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetExceptionName(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetPackageMoniker(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetPRAID(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetIlRva(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
+ void GetAppName(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetAppVersion(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetAppTimeStamp(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetModuleName(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetModuleVersion(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetModuleTimeStamp(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetMethodDef(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetIlOffset(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetExceptionName(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetPackageMoniker(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetPRAID(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetIlRva(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
public:
BaseBucketParamsManager(GenericModeBlock* pGenericModeBlock, TypeOfReportedError typeOfError, PCODE initialFaultingPc, Thread* pFaultingThread, OBJECTREF* pThrownException);
- static int CopyStringToBucket(__out_ecount(targetMaxLength) LPWSTR pTargetParam, int targetMaxLength, __in_z LPCWSTR pSource, bool cannonicalize = false);
+ static int CopyStringToBucket(_Out_writes_(targetMaxLength) LPWSTR pTargetParam, int targetMaxLength, _In_z_ LPCWSTR pSource, bool cannonicalize = false);
// function that consumers should call to populate the GMB
virtual void PopulateBucketParameters() = 0;
};
@@ -441,7 +441,7 @@ void BaseBucketParamsManager::PopulateBucketParameter(BucketParameterIndex param
LogParam(targetParam, paramIndex);
}
-void BaseBucketParamsManager::GetAppName(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetAppName(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -465,7 +465,7 @@ void BaseBucketParamsManager::GetAppName(__out_ecount(maxLength) WCHAR* targetPa
}
}
-void BaseBucketParamsManager::GetAppVersion(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetAppVersion(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -500,7 +500,7 @@ void BaseBucketParamsManager::GetAppVersion(__out_ecount(maxLength) WCHAR* targe
}
}
-void BaseBucketParamsManager::GetAppTimeStamp(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetAppTimeStamp(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -532,7 +532,7 @@ void BaseBucketParamsManager::GetAppTimeStamp(__out_ecount(maxLength) WCHAR* tar
EX_END_CATCH(SwallowAllExceptions)
}
-void BaseBucketParamsManager::GetModuleName(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetModuleName(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -622,7 +622,7 @@ void BaseBucketParamsManager::GetModuleName(__out_ecount(maxLength) WCHAR* targe
}
}
-void BaseBucketParamsManager::GetModuleVersion(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetModuleVersion(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -678,7 +678,7 @@ void BaseBucketParamsManager::GetModuleVersion(__out_ecount(maxLength) WCHAR* ta
}
}
-void BaseBucketParamsManager::GetModuleTimeStamp(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetModuleTimeStamp(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -731,7 +731,7 @@ void BaseBucketParamsManager::GetModuleTimeStamp(__out_ecount(maxLength) WCHAR*
}
}
-void BaseBucketParamsManager::GetMethodDef(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetMethodDef(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -756,7 +756,7 @@ void BaseBucketParamsManager::GetMethodDef(__out_ecount(maxLength) WCHAR* target
}
}
-void BaseBucketParamsManager::GetIlOffset(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetIlOffset(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -775,7 +775,7 @@ void BaseBucketParamsManager::GetIlOffset(__out_ecount(maxLength) WCHAR* targetP
ilOffset);
}
-void BaseBucketParamsManager::GetExceptionName(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetExceptionName(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -845,7 +845,7 @@ void BaseBucketParamsManager::GetExceptionName(__out_ecount(maxLength) WCHAR* ta
}
}
-void BaseBucketParamsManager::GetPackageMoniker(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetPackageMoniker(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -858,7 +858,7 @@ void BaseBucketParamsManager::GetPackageMoniker(__out_ecount(maxLength) WCHAR* t
_ASSERTE(!"AppX support NYI for CoreCLR");
}
-void BaseBucketParamsManager::GetPRAID(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetPRAID(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -871,7 +871,7 @@ void BaseBucketParamsManager::GetPRAID(__out_ecount(maxLength) WCHAR* targetPara
_ASSERTE(!"PRAID support NYI for CoreCLR");
}
-void BaseBucketParamsManager::GetIlRva(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetIlRva(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -1070,7 +1070,7 @@ OBJECTREF BaseBucketParamsManager::GetRealExceptionObject()
// because that is what a SHA1 hash coded in base32 will require.
// - the maxlen does not include the terminating nul.
//------------------------------------------------------------------------------
-int BaseBucketParamsManager::CopyStringToBucket(__out_ecount(targetMaxLength) LPWSTR pTargetParam, int targetMaxLength, __in_z LPCWSTR pSource, bool cannonicalize)
+int BaseBucketParamsManager::CopyStringToBucket(_Out_writes_(targetMaxLength) LPWSTR pTargetParam, int targetMaxLength, _In_z_ LPCWSTR pSource, bool cannonicalize)
{
CONTRACTL
{
@@ -1142,7 +1142,7 @@ int BaseBucketParamsManager::CopyStringToBucket(__out_ecount(targetMaxLength) LP
return targLen;
}
-void BaseBucketParamsManager::LogParam(__in_z LPCWSTR paramValue, BucketParameterIndex paramIndex)
+void BaseBucketParamsManager::LogParam(_In_z_ LPCWSTR paramValue, BucketParameterIndex paramIndex)
{
#ifdef _DEBUG
LIMITED_METHOD_CONTRACT;
diff --git a/src/coreclr/vm/dwreport.cpp b/src/coreclr/vm/dwreport.cpp
index 228e1d029cd5ea..1032725eb854b3 100644
--- a/src/coreclr/vm/dwreport.cpp
+++ b/src/coreclr/vm/dwreport.cpp
@@ -179,7 +179,7 @@ BOOL RegisterOutOfProcessWatsonCallbacks()
//------------------------------------------------------------------------------
// Description
HRESULT DwGetFileVersionInfo(
- __in_z LPCWSTR wszFilePath,
+ _In_z_ LPCWSTR wszFilePath,
USHORT& major,
USHORT& minor,
USHORT& build,
@@ -222,7 +222,7 @@ HRESULT DwGetFileVersionInfo(
// None
//------------------------------------------------------------------------------
int DwGetAppDescription( // Number of characters written.
- __in_z LPCWSTR wszFilePath, // Path to the executable.
+ _In_z_ LPCWSTR wszFilePath, // Path to the executable.
SString& pBuf // Put description here.
) // Size of buf, wide chars.
{
@@ -354,8 +354,8 @@ int DwGetAppDescription( // Number of characters written.
// None
//------------------------------------------------------------------------------
int DwGetAssemblyVersion( // Number of characters written.
- __in_z LPCWSTR wszFilePath, // Path to the executable.
- __inout_ecount(cchBuf) WCHAR *pBuf, // Put description here.
+ _In_z_ LPCWSTR wszFilePath, // Path to the executable.
+ _Inout_updates_(cchBuf) WCHAR *pBuf, // Put description here.
int cchBuf) // Size of buf, wide chars.
{
CONTRACTL
@@ -551,7 +551,7 @@ UINT_PTR GetIPOfThrowSite(
// false -- otherwise.
//
//------------------------------------------------------------------------------
-BOOL ContainsUnicodeChars(__in_z LPCWSTR wsz)
+BOOL ContainsUnicodeChars(_In_z_ LPCWSTR wsz)
{
LIMITED_METHOD_CONTRACT;
@@ -888,19 +888,19 @@ HRESULT GetBucketParametersForCurrentException(
if (hr == S_OK)
{
// Event type name.
- wcsncpy_s(pParams->pszEventTypeName, COUNTOF(pParams->pszEventTypeName), gmb.wzEventTypeName, _TRUNCATE);
+ wcsncpy_s(pParams->pszEventTypeName, ARRAY_SIZE(pParams->pszEventTypeName), gmb.wzEventTypeName, _TRUNCATE);
// Buckets. Mind the 1-based vs 0-based.
- wcsncpy_s(pParams->pszParams[0], COUNTOF(pParams->pszParams[0]), gmb.wzP1, _TRUNCATE);
- wcsncpy_s(pParams->pszParams[1], COUNTOF(pParams->pszParams[1]), gmb.wzP2, _TRUNCATE);
- wcsncpy_s(pParams->pszParams[2], COUNTOF(pParams->pszParams[2]), gmb.wzP3, _TRUNCATE);
- wcsncpy_s(pParams->pszParams[3], COUNTOF(pParams->pszParams[3]), gmb.wzP4, _TRUNCATE);
- wcsncpy_s(pParams->pszParams[4], COUNTOF(pParams->pszParams[4]), gmb.wzP5, _TRUNCATE);
- wcsncpy_s(pParams->pszParams[5], COUNTOF(pParams->pszParams[5]), gmb.wzP6, _TRUNCATE);
- wcsncpy_s(pParams->pszParams[6], COUNTOF(pParams->pszParams[6]), gmb.wzP7, _TRUNCATE);
- wcsncpy_s(pParams->pszParams[7], COUNTOF(pParams->pszParams[7]), gmb.wzP8, _TRUNCATE);
- wcsncpy_s(pParams->pszParams[8], COUNTOF(pParams->pszParams[8]), gmb.wzP9, _TRUNCATE);
- wcsncpy_s(pParams->pszParams[9], COUNTOF(pParams->pszParams[9]), gmb.wzP10, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[0], ARRAY_SIZE(pParams->pszParams[0]), gmb.wzP1, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[1], ARRAY_SIZE(pParams->pszParams[1]), gmb.wzP2, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[2], ARRAY_SIZE(pParams->pszParams[2]), gmb.wzP3, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[3], ARRAY_SIZE(pParams->pszParams[3]), gmb.wzP4, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[4], ARRAY_SIZE(pParams->pszParams[4]), gmb.wzP5, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[5], ARRAY_SIZE(pParams->pszParams[5]), gmb.wzP6, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[6], ARRAY_SIZE(pParams->pszParams[6]), gmb.wzP7, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[7], ARRAY_SIZE(pParams->pszParams[7]), gmb.wzP8, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[8], ARRAY_SIZE(pParams->pszParams[8]), gmb.wzP9, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[9], ARRAY_SIZE(pParams->pszParams[9]), gmb.wzP10, _TRUNCATE);
// All good.
pParams->fInited = TRUE;
diff --git a/src/coreclr/vm/dwreport.h b/src/coreclr/vm/dwreport.h
index 485eb7cfdf9152..821213ec9df565 100644
--- a/src/coreclr/vm/dwreport.h
+++ b/src/coreclr/vm/dwreport.h
@@ -55,18 +55,18 @@ BOOL IsWatsonEnabled();
BOOL RegisterOutOfProcessWatsonCallbacks();
int DwGetAssemblyVersion( // Number of characters written.
- __in_z LPCWSTR wszFilePath, // Path to the executable.
- __inout_ecount(cchBuf) WCHAR *pBuf, // Put description here.
+ _In_z_ LPCWSTR wszFilePath, // Path to the executable.
+ _Inout_updates_(cchBuf) WCHAR *pBuf, // Put description here.
int cchBuf);
HRESULT DwGetFileVersionInfo( // S_OK or error
- __in_z LPCWSTR wszFilePath, // Path to the executable.
+ _In_z_ LPCWSTR wszFilePath, // Path to the executable.
USHORT& major,
USHORT& minor,
USHORT& build,
USHORT& revision);
-BOOL ContainsUnicodeChars(__in_z LPCWSTR wsz);
+BOOL ContainsUnicodeChars(_In_z_ LPCWSTR wsz);
// Proxy parameters for Resetting Watson buckets
struct ResetWatsonBucketsParams
diff --git a/src/coreclr/vm/eeconfig.cpp b/src/coreclr/vm/eeconfig.cpp
index 17ecf961879bf3..43378f1700d4e5 100644
--- a/src/coreclr/vm/eeconfig.cpp
+++ b/src/coreclr/vm/eeconfig.cpp
@@ -818,7 +818,7 @@ bool EEConfig::ExcludeReadyToRun(LPCUTF8 assemblyName) const
// Ownership of the string buffer passes to ParseMethList
/* static */
-HRESULT EEConfig::ParseMethList(__in_z LPWSTR str, MethodNamesList** out) {
+HRESULT EEConfig::ParseMethList(_In_z_ LPWSTR str, MethodNamesList** out) {
CONTRACTL {
NOTHROW;
GC_NOTRIGGER;
@@ -899,7 +899,7 @@ bool EEConfig::IsInMethList(MethodNamesList* list, MethodDesc* pMD)
// Ownership of the string buffer passes to ParseTypeList
/* static */
-HRESULT EEConfig::ParseTypeList(__in_z LPWSTR str, TypeNamesList** out)
+HRESULT EEConfig::ParseTypeList(_In_z_ LPWSTR str, TypeNamesList** out)
{
CONTRACTL {
NOTHROW;
@@ -980,7 +980,7 @@ bool EEConfig::RegexOrExactMatch(LPCUTF8 regex, LPCUTF8 input)
return strcmp(regex, input) == 0;
}
-HRESULT TypeNamesList::Init(__in_z LPCWSTR str)
+HRESULT TypeNamesList::Init(_In_z_ LPCWSTR str)
{
CONTRACTL {
NOTHROW;
diff --git a/src/coreclr/vm/eeconfig.h b/src/coreclr/vm/eeconfig.h
index 05eb839c241738..d06e592eaff858 100644
--- a/src/coreclr/vm/eeconfig.h
+++ b/src/coreclr/vm/eeconfig.h
@@ -35,7 +35,7 @@ class TypeNamesList
TypeNamesList();
~TypeNamesList();
- HRESULT Init(__in_z LPCWSTR str);
+ HRESULT Init(_In_z_ LPCWSTR str);
bool IsInList(LPCUTF8 typeName);
};
#endif
@@ -244,7 +244,7 @@ class EEConfig
} CONTRACTL_END
return RegexOrExactMatch(pszBreakOnStructMarshalSetup, className);
}
- static HRESULT ParseTypeList(__in_z LPWSTR str, TypeNamesList** out);
+ static HRESULT ParseTypeList(_In_z_ LPWSTR str, TypeNamesList** out);
static void DestroyTypeList(TypeNamesList* list);
inline bool ShouldGcCoverageOnMethod(LPCUTF8 methodName) const
@@ -491,7 +491,7 @@ class EEConfig
bool m_fInteropLogArguments; // Log all pinned arguments passed to an interop call
#ifdef _DEBUG
- static HRESULT ParseMethList(__in_z LPWSTR str, MethodNamesList* * out);
+ static HRESULT ParseMethList(_In_z_ LPWSTR str, MethodNamesList* * out);
static void DestroyMethList(MethodNamesList* list);
static bool IsInMethList(MethodNamesList* list, MethodDesc* pMD);
diff --git a/src/coreclr/vm/eecontract.cpp b/src/coreclr/vm/eecontract.cpp
index c0b6830b2ba21f..a6e9972fb4e523 100644
--- a/src/coreclr/vm/eecontract.cpp
+++ b/src/coreclr/vm/eecontract.cpp
@@ -22,7 +22,7 @@ void EEContract::Disable()
BaseContract::Disable();
}
-void EEContract::DoChecks(UINT testmask, __in_z const char *szFunction, __in_z const char *szFile, int lineNum)
+void EEContract::DoChecks(UINT testmask, _In_z_ const char *szFunction, _In_z_ const char *szFile, int lineNum)
{
SCAN_IGNORE_THROW; // Tell the static contract analyzer to ignore contract violations
SCAN_IGNORE_FAULT; // due to the contract checking logic itself.
diff --git a/src/coreclr/vm/eecontract.h b/src/coreclr/vm/eecontract.h
index 61adea1dc80ba3..4df0c6f8fcaf5b 100644
--- a/src/coreclr/vm/eecontract.h
+++ b/src/coreclr/vm/eecontract.h
@@ -40,7 +40,7 @@ class EEContract : public BaseContract
}
void Disable();
- void DoChecks(UINT testmask, __in_z const char *szFunction, __in_z const char *szFile, int lineNum);
+ void DoChecks(UINT testmask, _In_z_ const char *szFunction, _In_z_ const char *szFile, int lineNum);
};
diff --git a/src/coreclr/vm/eepolicy.cpp b/src/coreclr/vm/eepolicy.cpp
index b9084568144076..c085315499253b 100644
--- a/src/coreclr/vm/eepolicy.cpp
+++ b/src/coreclr/vm/eepolicy.cpp
@@ -185,8 +185,8 @@ void EEPolicy::HandleExitProcess(ShutdownCompleteAction sca)
//---------------------------------------------------------------------------------------
// This class is responsible for displaying a stack trace. It uses a condensed way for
// stack overflow stack traces where there are possibly many repeated frames.
-// It displays a count and a repeated sequence of frames at the top of the stack in
-// such a case, instead of displaying possibly thousands of lines with the same
+// It displays a count and a repeated sequence of frames at the top of the stack in
+// such a case, instead of displaying possibly thousands of lines with the same
// method.
//---------------------------------------------------------------------------------------
class CallStackLogger
@@ -291,7 +291,7 @@ class CallStackLogger
for (int i = m_largestCommonStartLength * m_largestCommonStartRepeat; i < m_frames.Count(); i++)
{
PrintFrame(i, pWordAt);
- }
+ }
}
};
@@ -412,7 +412,7 @@ void LogInfoForFatalError(UINT exitCode, LPCWSTR pszMessage, LPCWSTR errorSource
{
}
EX_END_CATCH(SwallowAllExceptions)
-
+
InterlockedCompareExchangeT(&s_pCrashingThread, FatalErrorLoggingFinished, pThread);
}
@@ -484,7 +484,7 @@ void EEPolicy::LogFatalError(UINT exitCode, UINT_PTR address, LPCWSTR pszMessage
InlineSString<80> ssMessage;
InlineSString<80> ssErrorFormat;
if(!ssErrorFormat.LoadResource(CCompRC::Optional, IDS_ER_UNMANAGEDFAILFASTMSG ))
- ssErrorFormat.Set(W("at IP %1 (%2) with exit code %3."));
+ ssErrorFormat.Set(W("at IP 0x%x (0x%x) with exit code 0x%x."));
SmallStackSString addressString;
addressString.Printf(W("%p"), pExceptionInfo? (UINT_PTR)pExceptionInfo->ExceptionRecord->ExceptionAddress : address);
diff --git a/src/coreclr/vm/eetoprofinterfaceimpl.cpp b/src/coreclr/vm/eetoprofinterfaceimpl.cpp
index cfe62645dcbd26..0944ce115d21b9 100644
--- a/src/coreclr/vm/eetoprofinterfaceimpl.cpp
+++ b/src/coreclr/vm/eetoprofinterfaceimpl.cpp
@@ -254,8 +254,8 @@ inline void SetProfilerCallbacksAllowedForThread(Thread * pThread, BOOL fValue)
static HRESULT CoCreateProfiler(
const CLSID * pClsid,
- __in_z LPCWSTR wszClsid,
- __in_z LPCWSTR wszProfileDLL,
+ _In_z_ LPCWSTR wszClsid,
+ _In_z_ LPCWSTR wszProfileDLL,
ICorProfilerCallback2 ** ppCallback,
HMODULE * phmodProfilerDLL)
{
@@ -500,8 +500,8 @@ EEToProfInterfaceImpl::EEToProfInterfaceImpl() :
HRESULT EEToProfInterfaceImpl::Init(
ProfToEEInterfaceImpl * pProfToEE,
const CLSID * pClsid,
- __in_z LPCWSTR wszClsid,
- __in_z LPCWSTR wszProfileDLL,
+ _In_z_ LPCWSTR wszClsid,
+ _In_z_ LPCWSTR wszProfileDLL,
BOOL fLoadedViaAttach,
DWORD dwConcurrentGCWaitTimeoutInMs)
{
@@ -644,8 +644,8 @@ void EEToProfInterfaceImpl::SetProfilerInfo(ProfilerInfo *pProfilerInfo)
HRESULT EEToProfInterfaceImpl::CreateProfiler(
const CLSID * pClsid,
- __in_z LPCWSTR wszClsid,
- __in_z LPCWSTR wszProfileDLL)
+ _In_z_ LPCWSTR wszClsid,
+ _In_z_ LPCWSTR wszProfileDLL)
{
CONTRACTL
{
@@ -3034,7 +3034,7 @@ HRESULT EEToProfInterfaceImpl::ThreadAssignedToOSThread(ThreadID managedThreadId
HRESULT EEToProfInterfaceImpl::ThreadNameChanged(ThreadID managedThreadId,
ULONG cchName,
- __in_ecount_opt(cchName) WCHAR name[])
+ _In_reads_bytes_opt_(cchName) WCHAR name[])
{
CONTRACTL
{
diff --git a/src/coreclr/vm/eetoprofinterfaceimpl.h b/src/coreclr/vm/eetoprofinterfaceimpl.h
index e1259c6c7d7e1a..dd11a48abedb0c 100644
--- a/src/coreclr/vm/eetoprofinterfaceimpl.h
+++ b/src/coreclr/vm/eetoprofinterfaceimpl.h
@@ -49,7 +49,7 @@ class EEToProfInterfaceImpl
ProfToEEInterfaceImpl * pProfToEE,
const CLSID * pClsid,
__inout_z LPCWSTR wszClsid,
- __in_z LPCWSTR wszProfileDLL,
+ _In_z_ LPCWSTR wszProfileDLL,
BOOL fLoadedViaAttach,
DWORD dwConcurrentGCWaitTimeoutInMs);
@@ -144,7 +144,7 @@ class EEToProfInterfaceImpl
HRESULT ThreadNameChanged(ThreadID managedThreadId,
ULONG cchName,
- __in_ecount_opt(cchName) WCHAR name[]);
+ _In_reads_bytes_opt_(cchName) WCHAR name[]);
//
// Startup/Shutdown Events
@@ -611,8 +611,8 @@ class EEToProfInterfaceImpl
HRESULT CreateProfiler(
const CLSID * pClsid,
- __in_z LPCWSTR wszClsid,
- __in_z LPCWSTR wszProfileDLL);
+ _In_z_ LPCWSTR wszClsid,
+ _In_z_ LPCWSTR wszProfileDLL);
HRESULT DetermineAndSetEnterLeaveFunctionHooksForJit();
diff --git a/src/coreclr/vm/eventpipeinternal.cpp b/src/coreclr/vm/eventpipeinternal.cpp
index d759a1e0f1accc..e3debbf276649a 100644
--- a/src/coreclr/vm/eventpipeinternal.cpp
+++ b/src/coreclr/vm/eventpipeinternal.cpp
@@ -12,7 +12,7 @@
#ifdef FEATURE_PERFTRACING
extern "C" UINT64 QCALLTYPE EventPipeInternal_Enable(
- __in_z LPCWSTR outputFile,
+ _In_z_ LPCWSTR outputFile,
EventPipeSerializationFormat format,
UINT32 circularBufferSizeInMB,
/* COR_PRF_EVENTPIPE_PROVIDER_CONFIG */ LPCVOID pProviders,
@@ -84,7 +84,7 @@ extern "C" bool QCALLTYPE EventPipeInternal_GetSessionInfo(UINT64 sessionID, Eve
}
extern "C" INT_PTR QCALLTYPE EventPipeInternal_CreateProvider(
- __in_z LPCWSTR providerName,
+ _In_z_ LPCWSTR providerName,
EventPipeCallback pCallbackFunc)
{
QCALL_CONTRACT;
@@ -125,7 +125,7 @@ extern "C" INT_PTR QCALLTYPE EventPipeInternal_DefineEvent(
return reinterpret_cast(pEvent);
}
-extern "C" INT_PTR QCALLTYPE EventPipeInternal_GetProvider(__in_z LPCWSTR providerName)
+extern "C" INT_PTR QCALLTYPE EventPipeInternal_GetProvider(_In_z_ LPCWSTR providerName)
{
QCALL_CONTRACT;
diff --git a/src/coreclr/vm/eventpipeinternal.h b/src/coreclr/vm/eventpipeinternal.h
index 33fdc0e64cd238..bf57fed8b5acf3 100644
--- a/src/coreclr/vm/eventpipeinternal.h
+++ b/src/coreclr/vm/eventpipeinternal.h
@@ -40,7 +40,7 @@ struct EventPipeSessionInfo
//! Sets the sampling rate and enables the event pipe for the specified configuration.
//!
extern "C" UINT64 QCALLTYPE EventPipeInternal_Enable(
- __in_z LPCWSTR outputFile,
+ _In_z_ LPCWSTR outputFile,
EventPipeSerializationFormat format,
UINT32 circularBufferSizeInMB,
/* COR_PRF_EVENTPIPE_PROVIDER_CONFIG */ LPCVOID pProviders,
@@ -54,7 +54,7 @@ extern "C" void QCALLTYPE EventPipeInternal_Disable(UINT64 sessionID);
extern "C" bool QCALLTYPE EventPipeInternal_GetSessionInfo(UINT64 sessionID, EventPipeSessionInfo *pSessionInfo);
extern "C" INT_PTR QCALLTYPE EventPipeInternal_CreateProvider(
- __in_z LPCWSTR providerName,
+ _In_z_ LPCWSTR providerName,
EventPipeCallback pCallbackFunc);
extern "C" INT_PTR QCALLTYPE EventPipeInternal_DefineEvent(
@@ -67,7 +67,7 @@ extern "C" INT_PTR QCALLTYPE EventPipeInternal_DefineEvent(
UINT32 metadataLength);
extern "C" INT_PTR QCALLTYPE EventPipeInternal_GetProvider(
- __in_z LPCWSTR providerName);
+ _In_z_ LPCWSTR providerName);
extern "C" void QCALLTYPE EventPipeInternal_DeleteProvider(
INT_PTR provHandle);
diff --git a/src/coreclr/vm/eventreporter.cpp b/src/coreclr/vm/eventreporter.cpp
index 318cc21320f622..e865549052464a 100644
--- a/src/coreclr/vm/eventreporter.cpp
+++ b/src/coreclr/vm/eventreporter.cpp
@@ -110,7 +110,7 @@ EventReporter::EventReporter(EventReporterType type)
case ERT_ManagedFailFast:
if(!ssMessage.LoadResource(CCompRC::Optional, IDS_ER_MANAGEDFAILFAST))
- m_Description.Append(W("Description: The application requested process termination through Environment.FailFast."));
+ m_Description.Append(W("Description: The application requested process termination through System.Environment.FailFast."));
else
{
m_Description.Append(ssMessage);
@@ -120,7 +120,7 @@ EventReporter::EventReporter(EventReporterType type)
case ERT_UnmanagedFailFast:
if(!ssMessage.LoadResource(CCompRC::Optional, IDS_ER_UNMANAGEDFAILFAST))
- m_Description.Append(W("Description: The process was terminated due to an internal error in the .NET Runtime."));
+ m_Description.Append(W("Description: The process was terminated due to an internal error in the .NET Runtime "));
else
{
m_Description.Append(ssMessage);
@@ -165,7 +165,7 @@ EventReporter::EventReporter(EventReporterType type)
// Return Value:
// None.
//
-void EventReporter::AddDescription(__in WCHAR *pString)
+void EventReporter::AddDescription(_In_ WCHAR *pString)
{
CONTRACTL
{
diff --git a/src/coreclr/vm/eventreporter.h b/src/coreclr/vm/eventreporter.h
index ac74acb76a1019..9b600e76cd4aea 100644
--- a/src/coreclr/vm/eventreporter.h
+++ b/src/coreclr/vm/eventreporter.h
@@ -52,7 +52,7 @@ class EventReporter
// Construct
EventReporter(EventReporterType type);
// Add extra info into description part of the log
- void AddDescription(__in WCHAR *pString);
+ void AddDescription(_In_ WCHAR *pString);
void AddDescription(SString& s);
// Start callstack record
void BeginStackTrace();
diff --git a/src/coreclr/vm/eventtrace.cpp b/src/coreclr/vm/eventtrace.cpp
index a9a33e50efc145..e5473b11041775 100644
--- a/src/coreclr/vm/eventtrace.cpp
+++ b/src/coreclr/vm/eventtrace.cpp
@@ -4961,7 +4961,7 @@ VOID ETW::ExceptionLog::ExceptionFilterEnd()
/****************************************************************************/
/* This is called by the runtime when a domain is loaded */
/****************************************************************************/
-VOID ETW::LoaderLog::DomainLoadReal(BaseDomain *pDomain, __in_opt LPWSTR wszFriendlyName)
+VOID ETW::LoaderLog::DomainLoadReal(BaseDomain *pDomain, _In_opt_ LPWSTR wszFriendlyName)
{
CONTRACTL {
NOTHROW;
@@ -5671,7 +5671,7 @@ VOID ETW::MethodLog::MethodTableRestored(MethodTable *pMethodTable)
/****************************************************************************/
/* This is called by the runtime when a Strong Name Verification Starts */
/****************************************************************************/
-VOID ETW::SecurityLog::StrongNameVerificationStart(DWORD dwInFlags, __in LPWSTR strFullyQualifiedAssemblyName)
+VOID ETW::SecurityLog::StrongNameVerificationStart(DWORD dwInFlags, _In_ LPWSTR strFullyQualifiedAssemblyName)
{
WRAPPER_NO_CONTRACT;
}
@@ -5680,7 +5680,7 @@ VOID ETW::SecurityLog::StrongNameVerificationStart(DWORD dwInFlags, __in LPWSTR
/****************************************************************************/
/* This is called by the runtime when a Strong Name Verification Ends */
/****************************************************************************/
-VOID ETW::SecurityLog::StrongNameVerificationStop(DWORD dwInFlags,ULONG result, __in LPWSTR strFullyQualifiedAssemblyName)
+VOID ETW::SecurityLog::StrongNameVerificationStop(DWORD dwInFlags,ULONG result, _In_ LPWSTR strFullyQualifiedAssemblyName)
{
WRAPPER_NO_CONTRACT;
}
@@ -6091,8 +6091,8 @@ VOID ETW::LoaderLog::SendAssemblyEvent(Assembly *pAssembly, DWORD dwEventOptions
ETW_INLINE
ULONG
ETW::LoaderLog::SendModuleRange(
- __in Module *pModule,
- __in DWORD dwEventOptions)
+ _In_ Module *pModule,
+ _In_ DWORD dwEventOptions)
{
ULONG Result = ERROR_SUCCESS;
diff --git a/src/coreclr/vm/excep.cpp b/src/coreclr/vm/excep.cpp
index df71d0e0e06c8e..fa2b8ffc7dfe38 100644
--- a/src/coreclr/vm/excep.cpp
+++ b/src/coreclr/vm/excep.cpp
@@ -190,7 +190,7 @@ BOOL ExceptionIsOfRightType(TypeHandle clauseType, TypeHandle thrownType)
// Gets the message text from an exception
//===========================================================================
ULONG GetExceptionMessage(OBJECTREF throwable,
- __inout_ecount(bufferLength) LPWSTR buffer,
+ _Inout_updates_(bufferLength) LPWSTR buffer,
ULONG bufferLength)
{
CONTRACTL
@@ -5162,7 +5162,7 @@ static SString GetExceptionMessageWrapper(Thread* pThread, OBJECTREF throwable)
void STDMETHODCALLTYPE
DefaultCatchHandlerExceptionMessageWorker(Thread* pThread,
OBJECTREF throwable,
- __inout_ecount(buf_size) WCHAR *buf,
+ _Inout_updates_(buf_size) WCHAR *buf,
const int buf_size,
BOOL sendWindowsEventLog)
{
@@ -11476,7 +11476,7 @@ void ResetThreadAbortState(PTR_Thread pThread, CrawlFrame *pCf, StackFrame sfCur
// Note: The "cond" argument is there to tide us over during the transition from
// BAD_FORMAT_ASSERT to THROW_BAD_FORMAT. It will go away soon.
//---------------------------------------------------------------------------------
-VOID ThrowBadFormatWorker(UINT resID, LPCWSTR imageName DEBUGARG(__in_z const char *cond))
+VOID ThrowBadFormatWorker(UINT resID, LPCWSTR imageName DEBUGARG(_In_z_ const char *cond))
{
CONTRACTL
{
@@ -11906,8 +11906,8 @@ VOID DECLSPEC_NORETURN ThrowFieldLayoutError(mdTypeDef cl, // cl
}
CHAR offsetBuf[16];
- sprintf_s(offsetBuf, COUNTOF(offsetBuf), "%d", dwOffset);
- offsetBuf[COUNTOF(offsetBuf) - 1] = '\0';
+ sprintf_s(offsetBuf, ARRAY_SIZE(offsetBuf), "%d", dwOffset);
+ offsetBuf[ARRAY_SIZE(offsetBuf) - 1] = '\0';
pModule->GetAssembly()->ThrowTypeLoadException(pszNamespace,
pszName,
diff --git a/src/coreclr/vm/excep.h b/src/coreclr/vm/excep.h
index f95a8b6784ea97..b76839bdcffdd7 100644
--- a/src/coreclr/vm/excep.h
+++ b/src/coreclr/vm/excep.h
@@ -347,7 +347,7 @@ void CreateTypeInitializationExceptionObject(LPCWSTR pTypeThatFailed,
//==========================================================================
ULONG GetExceptionMessage(OBJECTREF throwable,
- __inout_ecount(bufferLength) LPWSTR buffer,
+ _Inout_updates_(bufferLength) LPWSTR buffer,
ULONG bufferLength);
void GetExceptionMessage(OBJECTREF throwable, SString &result);
STRINGREF GetExceptionMessage(OBJECTREF throwable);
diff --git a/src/coreclr/vm/exceptionhandling.cpp b/src/coreclr/vm/exceptionhandling.cpp
index 4af702fab14996..dcd6681a1b08c1 100644
--- a/src/coreclr/vm/exceptionhandling.cpp
+++ b/src/coreclr/vm/exceptionhandling.cpp
@@ -117,7 +117,7 @@ inline void RestoreNonvolatileRegisterPointers(PT_KNONVOLATILE_CONTEXT_POINTERS
//
#ifdef _DEBUG
void DumpClauses(IJitManager* pJitMan, const METHODTOKEN& MethToken, UINT_PTR uMethodStartPC, UINT_PTR dwControlPc);
-static void DoEHLog(DWORD lvl, __in_z const char *fmt, ...);
+static void DoEHLog(DWORD lvl, _In_z_ const char *fmt, ...);
#define EH_LOG(expr) { DoEHLog expr ; }
#else
#define EH_LOG(expr)
@@ -2035,7 +2035,7 @@ CLRUnwindStatus ExceptionTracker::ProcessOSExceptionNotification(
}
// static
-void ExceptionTracker::DebugLogTrackerRanges(__in_z const char *pszTag)
+void ExceptionTracker::DebugLogTrackerRanges(_In_z_ const char *pszTag)
{
#ifdef _DEBUG
CONTRACTL
@@ -4277,7 +4277,7 @@ void DumpClauses(IJitManager* pJitMan, const METHODTOKEN& MethToken, UINT_PTR uM
static void DoEHLog(
DWORD lvl,
- __in_z const char *fmt,
+ _In_z_ const char *fmt,
...
)
{
diff --git a/src/coreclr/vm/exceptionhandling.h b/src/coreclr/vm/exceptionhandling.h
index 50dd756fa7e89c..c3237de6b67b0b 100644
--- a/src/coreclr/vm/exceptionhandling.h
+++ b/src/coreclr/vm/exceptionhandling.h
@@ -360,7 +360,7 @@ class ExceptionTracker
void EnumMemoryRegions(CLRDataEnumMemoryFlags flags);
#endif // DACCESS_COMPILE
- static void DebugLogTrackerRanges(__in_z const char *pszTag);
+ static void DebugLogTrackerRanges(_In_z_ const char *pszTag);
bool IsStackOverflowException();
diff --git a/src/coreclr/vm/exceptmacros.h b/src/coreclr/vm/exceptmacros.h
index 70e1fe0871e0d7..4967da497b5097 100644
--- a/src/coreclr/vm/exceptmacros.h
+++ b/src/coreclr/vm/exceptmacros.h
@@ -502,11 +502,11 @@ LPCWSTR GetPathForErrorMessagesT(T *pImgObj)
}
}
-VOID ThrowBadFormatWorker(UINT resID, LPCWSTR imageName DEBUGARG(__in_z const char *cond));
+VOID ThrowBadFormatWorker(UINT resID, LPCWSTR imageName DEBUGARG(_In_z_ const char *cond));
template
NOINLINE
-VOID ThrowBadFormatWorkerT(UINT resID, T * pImgObj DEBUGARG(__in_z const char *cond))
+VOID ThrowBadFormatWorkerT(UINT resID, T * pImgObj DEBUGARG(_In_z_ const char *cond))
{
#ifdef DACCESS_COMPILE
ThrowBadFormatWorker(resID, nullptr DEBUGARG(cond));
diff --git a/src/coreclr/vm/frames.cpp b/src/coreclr/vm/frames.cpp
index 77bcb178bb49c2..9377b4ec028b72 100644
--- a/src/coreclr/vm/frames.cpp
+++ b/src/coreclr/vm/frames.cpp
@@ -63,24 +63,15 @@ void Frame::Log() {
MethodDesc* method = GetFunction();
-#ifdef TARGET_X86
- if (GetVTablePtr() == UMThkCallFrame::GetMethodFrameVPtr())
- method = ((UMThkCallFrame*) this)->GetUMEntryThunk()->GetMethod();
-#endif
-
STRESS_LOG3(LF_STUBS, LL_INFO1000000, "STUBS: In Stub with Frame %p assoc Method %pM FrameType = %pV\n", this, method, *((void**) this));
char buff[64];
const char* frameType;
if (GetVTablePtr() == PrestubMethodFrame::GetMethodFrameVPtr())
frameType = "PreStub";
-#ifdef TARGET_X86
- else if (GetVTablePtr() == UMThkCallFrame::GetMethodFrameVPtr())
- frameType = "UMThkCallFrame";
-#endif
else if (GetVTablePtr() == PInvokeCalliFrame::GetMethodFrameVPtr())
{
- sprintf_s(buff, COUNTOF(buff), "PInvoke CALLI target" FMT_ADDR,
+ sprintf_s(buff, ARRAY_SIZE(buff), "PInvoke CALLI target" FMT_ADDR,
DBG_ADDR(((PInvokeCalliFrame*)this)->GetPInvokeCalliTarget()));
frameType = buff;
}
@@ -257,7 +248,7 @@ void Frame::LogFrame(
{
_ASSERTE(!"New Frame type needs to be added to FrameTypeName()");
// Pointer is up to 17chars + vtbl@ = 22 chars
- sprintf_s(buf, COUNTOF(buf), "vtbl@%p", (VOID *)GetVTablePtr());
+ sprintf_s(buf, ARRAY_SIZE(buf), "vtbl@%p", (VOID *)GetVTablePtr());
pFrameType = buf;
}
@@ -1603,32 +1594,6 @@ void ComMethodFrame::DoSecondPassHandlerCleanup(Frame * pCurFrame)
#endif // FEATURE_COMINTEROP
-
-#ifdef TARGET_X86
-
-PTR_UMEntryThunk UMThkCallFrame::GetUMEntryThunk()
-{
- LIMITED_METHOD_DAC_CONTRACT;
- return dac_cast(GetDatum());
-}
-
-#ifdef DACCESS_COMPILE
-void UMThkCallFrame::EnumMemoryRegions(CLRDataEnumMemoryFlags flags)
-{
- WRAPPER_NO_CONTRACT;
- UnmanagedToManagedFrame::EnumMemoryRegions(flags);
-
- // Pieces of the UMEntryThunk need to be saved.
- UMEntryThunk *pThunk = GetUMEntryThunk();
- DacEnumMemoryRegion(dac_cast(pThunk), sizeof(UMEntryThunk));
-
- UMThunkMarshInfo *pMarshInfo = pThunk->GetUMThunkMarshInfo();
- DacEnumMemoryRegion(dac_cast(pMarshInfo), sizeof(UMThunkMarshInfo));
-}
-#endif
-
-#endif // TARGET_X86
-
#ifndef DACCESS_COMPILE
#if defined(_MSC_VER) && defined(TARGET_X86)
@@ -1952,16 +1917,18 @@ VOID InlinedCallFrame::Init()
}
-
+#ifdef FEATURE_COMINTEROP
void UnmanagedToManagedFrame::ExceptionUnwind()
{
WRAPPER_NO_CONTRACT;
AppDomain::ExceptionUnwind(this);
}
+#endif // FEATURE_COMINTEROP
#endif // !DACCESS_COMPILE
+#ifdef FEATURE_COMINTEROP
PCODE UnmanagedToManagedFrame::GetReturnAddress()
{
WRAPPER_NO_CONTRACT;
@@ -1980,6 +1947,7 @@ PCODE UnmanagedToManagedFrame::GetReturnAddress()
return pRetAddr;
}
}
+#endif // FEATURE_COMINTEROP
#ifndef DACCESS_COMPILE
//=================================================================================
diff --git a/src/coreclr/vm/frames.h b/src/coreclr/vm/frames.h
index c2946ced0b2f66..82e57cbbb04017 100644
--- a/src/coreclr/vm/frames.h
+++ b/src/coreclr/vm/frames.h
@@ -90,23 +90,18 @@
// | |
// | +-TPMethodFrame - for calls on transparent proxy
// |
+#ifdef FEATURE_COMINTEROP
// +-UnmanagedToManagedFrame - this frame represents a transition from
// | | unmanaged code back to managed code. It's
// | | main functions are to stop COM+ exception
// | | propagation and to expose unmanaged parameters.
// | |
-#ifdef FEATURE_COMINTEROP
-// | |
// | +-ComMethodFrame - this frame represents a transition from
// | | com to com+
// | |
// | +-ComPrestubMethodFrame - prestub frame for calls from COM to CLR
// |
#endif //FEATURE_COMINTEROP
-#ifdef TARGET_X86
-// | +-UMThkCallFrame - this frame represents an unmanaged->managed
-// | transition through N/Direct
-#endif
#if defined(TARGET_X86) && !defined(UNIX_X86_ABI)
// +-TailCallFrame - padding for tailcalls
// |
@@ -172,16 +167,9 @@ Delegate over a native function pointer:
Reverse P/Invoke (used for C++ exports & fixups as well as delegates
obtained from function pointers):
Normal stub:
- x86: The stub is generated by UMEntryThunk::CompileUMThunkWorker
- (in DllImportCallback.cpp) and it is frameless. It calls directly
- the managed target or to IL stub if marshaling is required.
- non-x86: The stub exists statically as UMThunkStub and calls to IL stub.
+ The stub exists statically as UMThunkStub and calls to IL stub.
Prestub:
- The prestub is generated by GenerateUMThunkPrestub (x86) or exists statically
- as TheUMEntryPrestub (64-bit), and it erects an UMThkCallFrame frame.
-
-Reverse P/Invoke AppDomain selector stub:
- The asm helper is IJWNOADThunkJumpTarget (in asmhelpers.asm) and it is frameless.
+ The prestub exists statically as TheUMEntryPrestub.
//------------------------------------------------------------------------
#endif // 0
@@ -212,8 +200,8 @@ FRAME_TYPE_NAME(HelperMethodFrame_3OBJ)
FRAME_TYPE_NAME(HelperMethodFrame_PROTECTOBJ)
FRAME_ABSTRACT_TYPE_NAME(FramedMethodFrame)
FRAME_TYPE_NAME(MulticastFrame)
-FRAME_ABSTRACT_TYPE_NAME(UnmanagedToManagedFrame)
#ifdef FEATURE_COMINTEROP
+FRAME_ABSTRACT_TYPE_NAME(UnmanagedToManagedFrame)
FRAME_TYPE_NAME(ComMethodFrame)
FRAME_TYPE_NAME(ComPlusMethodFrame)
FRAME_TYPE_NAME(ComPrestubMethodFrame)
@@ -238,9 +226,6 @@ FRAME_TYPE_NAME(DebuggerClassInitMarkFrame)
FRAME_TYPE_NAME(DebuggerSecurityCodeMarkFrame)
FRAME_TYPE_NAME(DebuggerExitFrame)
FRAME_TYPE_NAME(DebuggerU2MCatchHandlerFrame)
-#ifdef TARGET_X86
-FRAME_TYPE_NAME(UMThkCallFrame)
-#endif
FRAME_TYPE_NAME(InlinedCallFrame)
#if defined(TARGET_X86) && !defined(UNIX_X86_ABI)
FRAME_TYPE_NAME(TailCallFrame)
@@ -281,9 +266,6 @@ class Frame;
class FramedMethodFrame;
typedef VPTR(class FramedMethodFrame) PTR_FramedMethodFrame;
struct HijackArgs;
-class UMEntryThunk;
-class UMThunkMarshInfo;
-class Marshaler;
struct ResolveCacheElem;
#if defined(DACCESS_COMPILE)
class DacDbiInterfaceImpl;
@@ -1814,6 +1796,8 @@ class MulticastFrame : public TransitionFrame
};
+#ifdef FEATURE_COMINTEROP
+
//-----------------------------------------------------------------------
// Transition frame from unmanaged to managed
//-----------------------------------------------------------------------
@@ -1922,8 +1906,6 @@ class UnmanagedToManagedFrame : public Frame
#endif
};
-#ifdef FEATURE_COMINTEROP
-
//------------------------------------------------------------------------
// This frame represents a transition from COM to COM+
//------------------------------------------------------------------------
@@ -2774,43 +2756,6 @@ class DebuggerU2MCatchHandlerFrame : public Frame
DEFINE_VTABLE_GETTER_AND_DTOR(DebuggerU2MCatchHandlerFrame)
};
-
-class UMThunkMarshInfo;
-typedef DPTR(class UMThunkMarshInfo) PTR_UMThunkMarshInfo;
-
-class UMEntryThunk;
-typedef DPTR(class UMEntryThunk) PTR_UMEntryThunk;
-
-#if defined(TARGET_X86)
-//------------------------------------------------------------------------
-// This frame guards an unmanaged->managed transition thru a UMThk
-//------------------------------------------------------------------------
-
-class UMThkCallFrame : public UnmanagedToManagedFrame
-{
- VPTR_VTABLE_CLASS(UMThkCallFrame, UnmanagedToManagedFrame)
-
-public:
-
-#ifdef DACCESS_COMPILE
- virtual void EnumMemoryRegions(CLRDataEnumMemoryFlags flags);
-#endif
-
- PTR_UMEntryThunk GetUMEntryThunk();
-
- static int GetOffsetOfUMEntryThunk()
- {
- WRAPPER_NO_CONTRACT;
- return GetOffsetOfDatum();
- }
-
-protected:
-
- // Keep as last entry in class
- DEFINE_VTABLE_GETTER_AND_CTOR_AND_DTOR(UMThkCallFrame)
-};
-#endif // TARGET_X86 && !TARGET_UNIX
-
// Frame for the Reverse PInvoke (i.e. UnmanagedCallersOnlyAttribute).
struct ReversePInvokeFrame
{
@@ -2821,29 +2766,6 @@ struct ReversePInvokeFrame
#endif
};
-#if defined(TARGET_X86) && defined(FEATURE_COMINTEROP)
-//-------------------------------------------------------------------------
-// Exception handler for COM to managed frame
-// and the layout of the exception registration record structure in the stack
-// the layout is similar to the NT's EXCEPTIONREGISTRATION record
-// followed by the UnmanagedToManagedFrame specific info
-
-struct ComToManagedExRecord
-{
- EXCEPTION_REGISTRATION_RECORD m_ExReg;
- ArgumentRegisters m_argRegs;
- GSCookie m_gsCookie;
- UMThkCallFrame m_frame;
-
- UnmanagedToManagedFrame * GetCurrFrame()
- {
- LIMITED_METHOD_CONTRACT;
- return &m_frame;
- }
-};
-#endif // TARGET_X86 && FEATURE_COMINTEROP
-
-
//------------------------------------------------------------------------
// This frame is pushed by any JIT'ted method that contains one or more
// inlined N/Direct calls. Note that the JIT'ted method keeps it pushed
diff --git a/src/coreclr/vm/h2inc.pl b/src/coreclr/vm/h2inc.pl
deleted file mode 100644
index 6d2e0c3e03dcf1..00000000000000
--- a/src/coreclr/vm/h2inc.pl
+++ /dev/null
@@ -1,61 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-
-# C to MASM include file translator
-# This is replacement for the deprecated h2inc tool that used to be part of VS.
-
-use File::Basename;
-
-sub ProcessFile($) {
- my ($input_file) = @_;
-
- local *INPUT_FILE;
- if (!open(INPUT_FILE, $input_file))
- {
- print "#error: File can not be opened: $input_file\n";
- return;
- }
-
- print ("// File start: $input_file\n");
-
- while() {
- # Skip all pragmas
- if (m/^\s*#\s*pragma/) {
- next;
- }
-
- # Expand includes.
- if (m/\s*#\s*include\s*\"(.+)\"/) {
- ProcessFile(dirname($input_file) . "/" . $1);
- next;
- }
-
- # Augment #defines with their MASM equivalent
- if (m/^\s*#\s*define\s+(\S+)\s+(.*)/) {
- my $name = $1;
- my $value = $2;
-
- # Note that we do not handle multiline constants
-
- # Strip comments from value
- $value =~ s/\/\/.*//;
- $value =~ s/\/\*.*\*\///g;
-
- # Strip whitespaces from value
- $value =~ s/\s+$//;
-
- # ignore #defines with arguments
- if (!($name =~ m/\(/)) {
- my $number = 0;
- $number |= ($value =~ s/\b0x(\w+)\b/0\1h/g); # Convert hex constants
- $number |= ($value =~ s/(-?\b\d+\b)/\1t/g); # Convert dec constants
- print $number ? "$name EQU $value\n" : "$name TEXTEQU <$value>\n";
- }
- }
- print;
- }
-
- print ("// File end: $input_file\n");
-}
-
-ProcessFile($ARGV[0]);
diff --git a/src/coreclr/vm/h2inc.ps1 b/src/coreclr/vm/h2inc.ps1
deleted file mode 100644
index f2c2c07f26582b..00000000000000
--- a/src/coreclr/vm/h2inc.ps1
+++ /dev/null
@@ -1,69 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-
-# C to MASM include file translator
-# This is replacement for the deprecated h2inc tool that used to be part of VS.
-
-#
-# The use of [console]::WriteLine (instead of Write-Output) is intentional.
-# PowerShell 2.0 (installed by default on Windows 7) wraps lines written with
-# Write-Output at whatever column width is being used by the current terminal,
-# even when output is being redirected to a file. We can't have this behavior
-# because it will cause the generated file to be malformed.
-#
-
-Function ProcessFile($filePath) {
-
- [console]::WriteLine("// File start: $filePath")
-
- Get-Content $filePath | ForEach-Object {
-
- if ($_ -match "^\s*#\spragma") {
- # Ignore pragmas
- return
- }
-
- if ($_ -match "^\s*#\s*include\s*`"(.*)`"")
- {
- # Expand includes.
- ProcessFile(Join-Path (Split-Path -Parent $filePath) $Matches[1])
- return
- }
-
- if ($_ -match "^\s*#define\s+(\S+)\s*(.*)")
- {
- # Augment #defines with their MASM equivalent
- $name = $Matches[1]
- $value = $Matches[2]
-
- # Note that we do not handle multiline constants
-
- # Strip comments from value
- $value = $value -replace "//.*", ""
- $value = $value -replace "/\*.*\*/", ""
-
- # Strip whitespaces from value
- $value = $value -replace "\s+$", ""
-
- # ignore #defines with arguments
- if ($name -notmatch "\(") {
- $HEX_NUMBER_PATTERN = "\b0x(\w+)\b"
- $DECIMAL_NUMBER_PATTERN = "(-?\b\d+\b)"
-
- if ($value -match $HEX_NUMBER_PATTERN -or $value -match $DECIMAL_NUMBER_PATTERN) {
- $value = $value -replace $HEX_NUMBER_PATTERN, "0`$1h" # Convert hex constants
- $value = $value -replace $DECIMAL_NUMBER_PATTERN, "`$1t" # Convert dec constants
- [console]::WriteLine("$name EQU $value")
- } else {
- [console]::WriteLine("$name TEXTEQU <$value>")
- }
- }
- }
-
- [console]::WriteLine("$_")
- }
-
- [console]::WriteLine("// File end: $filePath")
-}
-
-ProcessFile $args[0]
diff --git a/src/coreclr/vm/i386/asmhelpers.asm b/src/coreclr/vm/i386/asmhelpers.asm
index d3eb78da472562..896c249822c552 100644
--- a/src/coreclr/vm/i386/asmhelpers.asm
+++ b/src/coreclr/vm/i386/asmhelpers.asm
@@ -43,7 +43,6 @@ EXTERN _COMPlusFrameHandlerRevCom:PROC
endif ; FEATURE_COMINTEROP
EXTERN __alloca_probe:PROC
EXTERN _NDirectImportWorker@4:PROC
-EXTERN _UMThunkStubRareDisableWorker@8:PROC
EXTERN _VarargPInvokeStubWorker@12:PROC
EXTERN _GenericPInvokeCalliStubWorker@12:PROC
@@ -53,6 +52,7 @@ EXTERN _CopyCtorCallStubWorker@4:PROC
endif
EXTERN _PreStubWorker@8:PROC
+EXTERN _TheUMEntryPrestubWorker@4:PROC
ifdef FEATURE_COMINTEROP
EXTERN _CLRToCOMWorker@8:PROC
@@ -255,9 +255,6 @@ COMPlusNestedExceptionHandler proto c
FastNExportExceptHandler proto c
.safeseh FastNExportExceptHandler
-UMThunkPrestubHandler proto c
-.safeseh UMThunkPrestubHandler
-
ifdef FEATURE_COMINTEROP
COMPlusFrameHandlerRevCom proto c
.safeseh COMPlusFrameHandlerRevCom
@@ -872,23 +869,6 @@ getFPReturn4:
retn 8
_getFPReturn@8 endp
-; VOID __cdecl UMThunkStubRareDisable()
-;
-; @todo: this is very similar to StubRareDisable
-;
-_UMThunkStubRareDisable proc public
- push eax
- push ecx
-
- push eax ; Push the UMEntryThunk
- push ecx ; Push thread
- call _UMThunkStubRareDisableWorker@8
-
- pop ecx
- pop eax
- retn
-_UMThunkStubRareDisable endp
-
; void __stdcall JIT_ProfilerEnterLeaveTailcallStub(UINT_PTR ProfilerHandle)
_JIT_ProfilerEnterLeaveTailcallStub@4 proc public
@@ -1432,6 +1412,22 @@ public _ThePreStubPatchLabel@0
ret
_ThePreStubPatch@0 endp
+_TheUMEntryPrestub@0 proc public
+ ; push argument registers
+ push ecx
+ push edx
+
+ push eax ; UMEntryThunk*
+ call _TheUMEntryPrestubWorker@4
+
+ ; pop argument registers
+ pop edx
+ pop ecx
+
+ ; eax = PCODE
+ jmp eax ; Tail Jmp
+_TheUMEntryPrestub@0 endp
+
ifdef FEATURE_COMINTEROP
;==========================================================================
; CLR -> COM generic or late-bound call
diff --git a/src/coreclr/vm/i386/cgenx86.cpp b/src/coreclr/vm/i386/cgenx86.cpp
index f0a81d6daeea16..d2d5d1676e95c8 100644
--- a/src/coreclr/vm/i386/cgenx86.cpp
+++ b/src/coreclr/vm/i386/cgenx86.cpp
@@ -931,58 +931,6 @@ WORD GetUnpatchedCodeData(LPCBYTE pAddr)
#ifndef DACCESS_COMPILE
-#if defined(TARGET_X86) && !defined(FEATURE_STUBS_AS_IL)
-//-------------------------------------------------------------------------
-// One-time creation of special prestub to initialize UMEntryThunks.
-//-------------------------------------------------------------------------
-Stub *GenerateUMThunkPrestub()
-{
- CONTRACT(Stub*)
- {
- STANDARD_VM_CHECK;
- POSTCONDITION(CheckPointer(RETVAL));
- }
- CONTRACT_END;
-
- CPUSTUBLINKER sl;
- CPUSTUBLINKER *psl = &sl;
-
- CodeLabel* rgRareLabels[] = { psl->NewCodeLabel(),
- psl->NewCodeLabel(),
- psl->NewCodeLabel()
- };
-
-
- CodeLabel* rgRejoinLabels[] = { psl->NewCodeLabel(),
- psl->NewCodeLabel(),
- psl->NewCodeLabel()
- };
-
- // emit the initial prolog
- psl->EmitComMethodStubProlog(UMThkCallFrame::GetMethodFrameVPtr(), rgRareLabels, rgRejoinLabels, FALSE /*Don't profile*/);
-
- // mov ecx, [esi+UMThkCallFrame.pUMEntryThunk]
- psl->X86EmitIndexRegLoad(kECX, kESI, UMThkCallFrame::GetOffsetOfUMEntryThunk());
-
- // The call conv is a __stdcall
- psl->X86EmitPushReg(kECX);
-
- // call UMEntryThunk::DoRunTimeInit
- psl->X86EmitCall(psl->NewExternalCodeLabel((LPVOID)UMEntryThunk::DoRunTimeInit), 4);
-
- // mov ecx, [esi+UMThkCallFrame.pUMEntryThunk]
- psl->X86EmitIndexRegLoad(kEAX, kESI, UMThkCallFrame::GetOffsetOfUMEntryThunk());
-
- // lea eax, [eax + UMEntryThunk.m_code] // point to fixedup UMEntryThunk
- psl->X86EmitOp(0x8d, kEAX, kEAX,
- UMEntryThunk::GetCodeOffset() + UMEntryThunkCode::GetEntryPointOffset());
-
- psl->EmitComMethodStubEpilog(UMThkCallFrame::GetMethodFrameVPtr(), rgRareLabels, rgRejoinLabels, FALSE /*Don't profile*/);
-
- RETURN psl->Link(SystemDomain::GetGlobalLoaderAllocator()->GetExecutableHeap());
-}
-#endif // TARGET_X86 && !FEATURE_STUBS_AS_IL
-
Stub *GenerateInitPInvokeFrameHelper()
{
CONTRACT(Stub*)
diff --git a/src/coreclr/vm/i386/excepx86.cpp b/src/coreclr/vm/i386/excepx86.cpp
index 3d2e0e4dddeca0..15dd0667dd6c4f 100644
--- a/src/coreclr/vm/i386/excepx86.cpp
+++ b/src/coreclr/vm/i386/excepx86.cpp
@@ -113,17 +113,6 @@ static void RtlUnwindCallback()
_ASSERTE(!"Should never get here");
}
-BOOL NExportSEH(EXCEPTION_REGISTRATION_RECORD* pEHR)
-{
- LIMITED_METHOD_CONTRACT;
-
- if ((LPVOID)pEHR->Handler == (LPVOID)UMThunkPrestubHandler)
- {
- return TRUE;
- }
- return FALSE;
-}
-
BOOL FastNExportSEH(EXCEPTION_REGISTRATION_RECORD* pEHR)
{
LIMITED_METHOD_CONTRACT;
@@ -156,9 +145,8 @@ BOOL IsUnmanagedToManagedSEHHandler(EXCEPTION_REGISTRATION_RECORD *pEstablisherF
//
// ComPlusFrameSEH() is for COMPlusFrameHandler & COMPlusNestedExceptionHandler.
// FastNExportSEH() is for FastNExportExceptHandler.
- // NExportSEH() is for UMThunkPrestubHandler.
//
- return (ComPlusFrameSEH(pEstablisherFrame) || FastNExportSEH(pEstablisherFrame) || NExportSEH(pEstablisherFrame) || ReverseCOMSEH(pEstablisherFrame));
+ return (ComPlusFrameSEH(pEstablisherFrame) || FastNExportSEH(pEstablisherFrame) || ReverseCOMSEH(pEstablisherFrame));
}
Frame *GetCurrFrame(EXCEPTION_REGISTRATION_RECORD *pEstablisherFrame)
@@ -166,10 +154,7 @@ Frame *GetCurrFrame(EXCEPTION_REGISTRATION_RECORD *pEstablisherFrame)
Frame *pFrame;
WRAPPER_NO_CONTRACT;
_ASSERTE(IsUnmanagedToManagedSEHHandler(pEstablisherFrame));
- if (NExportSEH(pEstablisherFrame))
- pFrame = ((ComToManagedExRecord *)pEstablisherFrame)->GetCurrFrame();
- else
- pFrame = ((FrameHandlerExRecord *)pEstablisherFrame)->GetCurrFrame();
+ pFrame = ((FrameHandlerExRecord *)pEstablisherFrame)->GetCurrFrame();
// Assert that the exception frame is on the thread or that the exception frame is the top frame.
_ASSERTE(GetThreadNULLOk() == NULL || GetThread()->GetFrame() == (Frame*)-1 || GetThread()->GetFrame() <= pFrame);
@@ -3384,52 +3369,6 @@ EXCEPTION_HANDLER_IMPL(FastNExportExceptHandler)
return retval;
}
-
-// Just like a regular NExport handler -- except it pops an extra frame on unwind. A handler
-// like this is needed by the COMMethodStubProlog code. It first pushes a frame -- and then
-// pushes a handler. When we unwind, we need to pop the extra frame to avoid corrupting the
-// frame chain in the event of an unmanaged catcher.
-//
-EXCEPTION_HANDLER_IMPL(UMThunkPrestubHandler)
-{
- // @todo: we'd like to have a dynamic contract here, but there's a problem. (Bug 129180) Enter on the CRST used
- // in HandleManagedFault leaves the no-trigger count incremented. The destructor of this contract will restore
- // it to zero, then when we leave the CRST in LinkFrameAndThrow, we assert because we're trying to decrement the
- // gc-trigger count down past zero. The solution is to fix what we're doing with this CRST.
- STATIC_CONTRACT_THROWS; // COMPlusFrameHandler throws
- STATIC_CONTRACT_GC_TRIGGERS;
- STATIC_CONTRACT_MODE_ANY;
-
- EXCEPTION_DISPOSITION retval = ExceptionContinueSearch;
-
- // We must forward to the COMPlusFrameHandler. This will unwind the Frame Chain up to here, and also leave the
- // preemptive GC mode set correctly.
- retval = EXCEPTION_HANDLER_FWD(COMPlusFrameHandler);
-
-#ifdef _DEBUG
- // If the exception is escaping the last CLR personality routine on the stack,
- // then state a flag on the thread to indicate so.
- if (retval == ExceptionContinueSearch)
- {
- SetReversePInvokeEscapingUnhandledExceptionStatus(IS_UNWINDING(pExceptionRecord->ExceptionFlags), pEstablisherFrame);
- }
-#endif // _DEBUG
-
- if (IS_UNWINDING(pExceptionRecord->ExceptionFlags))
- {
- // Pops an extra frame on unwind.
-
- GCX_COOP(); // Must be cooperative to modify frame chain.
-
- Thread *pThread = GetThread();
- Frame *pFrame = pThread->GetFrame();
- pFrame->ExceptionUnwind();
- pFrame->Pop(pThread);
- }
-
- return retval;
-}
-
#ifdef FEATURE_COMINTEROP
// The reverse COM interop path needs to be sure to pop the ComMethodFrame that is pushed, but we do not want
// to have an additional FS:0 handler between the COM callsite and the call into managed. So we push this
diff --git a/src/coreclr/vm/i386/stublinkerx86.cpp b/src/coreclr/vm/i386/stublinkerx86.cpp
index 685883dd1ae808..74d55fd4544db3 100644
--- a/src/coreclr/vm/i386/stublinkerx86.cpp
+++ b/src/coreclr/vm/i386/stublinkerx86.cpp
@@ -37,7 +37,6 @@
#include "runtimecallablewrapper.h"
#include "comcache.h"
#include "olevariant.h"
-#include "notifyexternals.h"
#endif // FEATURE_COMINTEROP
#if defined(_DEBUG) && defined(STUBLINKER_GENERATES_UNWIND_INFO)
@@ -2446,44 +2445,21 @@ VOID StubLinkerCPU::X86EmitCurrentThreadFetch(X86Reg dstreg, unsigned preservedR
#endif // TARGET_UNIX
}
-#if defined(TARGET_X86)
+#if defined(FEATURE_COMINTEROP) && defined(TARGET_X86)
-#if defined(PROFILING_SUPPORTED) && !defined(FEATURE_STUBS_AS_IL)
+#if defined(PROFILING_SUPPORTED)
VOID StubLinkerCPU::EmitProfilerComCallProlog(TADDR pFrameVptr, X86Reg regFrame)
{
STANDARD_VM_CONTRACT;
- if (pFrameVptr == UMThkCallFrame::GetMethodFrameVPtr())
- {
- // Load the methoddesc into ECX (UMThkCallFrame->m_pvDatum->m_pMD)
- X86EmitIndexRegLoad(kECX, regFrame, UMThkCallFrame::GetOffsetOfDatum());
- X86EmitIndexRegLoad(kECX, kECX, UMEntryThunk::GetOffsetOfMethodDesc());
-
- // Push arguments and notify profiler
- X86EmitPushImm32(COR_PRF_TRANSITION_CALL); // Reason
- X86EmitPushReg(kECX); // MethodDesc*
- X86EmitCall(NewExternalCodeLabel((LPVOID) ProfilerUnmanagedToManagedTransitionMD), 2*sizeof(void*));
- }
+ // Load the methoddesc into ECX (Frame->m_pvDatum->m_pMD)
+ X86EmitIndexRegLoad(kECX, regFrame, ComMethodFrame::GetOffsetOfDatum());
+ X86EmitIndexRegLoad(kECX, kECX, ComCallMethodDesc::GetOffsetOfMethodDesc());
-#ifdef FEATURE_COMINTEROP
- else if (pFrameVptr == ComMethodFrame::GetMethodFrameVPtr())
- {
- // Load the methoddesc into ECX (Frame->m_pvDatum->m_pMD)
- X86EmitIndexRegLoad(kECX, regFrame, ComMethodFrame::GetOffsetOfDatum());
- X86EmitIndexRegLoad(kECX, kECX, ComCallMethodDesc::GetOffsetOfMethodDesc());
-
- // Push arguments and notify profiler
- X86EmitPushImm32(COR_PRF_TRANSITION_CALL); // Reason
- X86EmitPushReg(kECX); // MethodDesc*
- X86EmitCall(NewExternalCodeLabel((LPVOID) ProfilerUnmanagedToManagedTransitionMD), 2*sizeof(void*));
- }
-#endif // FEATURE_COMINTEROP
-
- // Unrecognized frame vtbl
- else
- {
- _ASSERTE(!"Unrecognized vtble passed to EmitComMethodStubProlog with profiling turned on.");
- }
+ // Push arguments and notify profiler
+ X86EmitPushImm32(COR_PRF_TRANSITION_CALL); // Reason
+ X86EmitPushReg(kECX); // MethodDesc*
+ X86EmitCall(NewExternalCodeLabel((LPVOID) ProfilerUnmanagedToManagedTransitionMD), 2*sizeof(void*));
}
@@ -2492,50 +2468,21 @@ VOID StubLinkerCPU::EmitProfilerComCallEpilog(TADDR pFrameVptr, X86Reg regFrame)
CONTRACTL
{
STANDARD_VM_CHECK;
-#ifdef FEATURE_COMINTEROP
- PRECONDITION(pFrameVptr == UMThkCallFrame::GetMethodFrameVPtr() || pFrameVptr == ComMethodFrame::GetMethodFrameVPtr());
-#else
- PRECONDITION(pFrameVptr == UMThkCallFrame::GetMethodFrameVPtr());
-#endif // FEATURE_COMINTEROP
+ PRECONDITION(pFrameVptr == ComMethodFrame::GetMethodFrameVPtr());
}
CONTRACTL_END;
- if (pFrameVptr == UMThkCallFrame::GetMethodFrameVPtr())
- {
- // Load the methoddesc into ECX (UMThkCallFrame->m_pvDatum->m_pMD)
- X86EmitIndexRegLoad(kECX, regFrame, UMThkCallFrame::GetOffsetOfDatum());
- X86EmitIndexRegLoad(kECX, kECX, UMEntryThunk::GetOffsetOfMethodDesc());
-
- // Push arguments and notify profiler
- X86EmitPushImm32(COR_PRF_TRANSITION_RETURN); // Reason
- X86EmitPushReg(kECX); // MethodDesc*
- X86EmitCall(NewExternalCodeLabel((LPVOID) ProfilerManagedToUnmanagedTransitionMD), 2*sizeof(void*));
- }
-
-#ifdef FEATURE_COMINTEROP
- else if (pFrameVptr == ComMethodFrame::GetMethodFrameVPtr())
- {
- // Load the methoddesc into ECX (Frame->m_pvDatum->m_pMD)
- X86EmitIndexRegLoad(kECX, regFrame, ComMethodFrame::GetOffsetOfDatum());
- X86EmitIndexRegLoad(kECX, kECX, ComCallMethodDesc::GetOffsetOfMethodDesc());
-
- // Push arguments and notify profiler
- X86EmitPushImm32(COR_PRF_TRANSITION_RETURN); // Reason
- X86EmitPushReg(kECX); // MethodDesc*
- X86EmitCall(NewExternalCodeLabel((LPVOID) ProfilerManagedToUnmanagedTransitionMD), 2*sizeof(void*));
- }
-#endif // FEATURE_COMINTEROP
+ // Load the methoddesc into ECX (Frame->m_pvDatum->m_pMD)
+ X86EmitIndexRegLoad(kECX, regFrame, ComMethodFrame::GetOffsetOfDatum());
+ X86EmitIndexRegLoad(kECX, kECX, ComCallMethodDesc::GetOffsetOfMethodDesc());
- // Unrecognized frame vtbl
- else
- {
- _ASSERTE(!"Unrecognized vtble passed to EmitComMethodStubEpilog with profiling turned on.");
- }
+ // Push arguments and notify profiler
+ X86EmitPushImm32(COR_PRF_TRANSITION_RETURN); // Reason
+ X86EmitPushReg(kECX); // MethodDesc*
+ X86EmitCall(NewExternalCodeLabel((LPVOID) ProfilerManagedToUnmanagedTransitionMD), 2*sizeof(void*));
}
-#endif // PROFILING_SUPPORTED && !FEATURE_STUBS_AS_IL
-
+#endif // PROFILING_SUPPORTED
-#ifndef FEATURE_STUBS_AS_IL
//========================================================================
// Prolog for entering managed code from COM
// pushes the appropriate frame ptr
@@ -2585,13 +2532,6 @@ void StubLinkerCPU::EmitComMethodStubProlog(TADDR pFrameVptr,
// lea esi, [esp+4] ;; set ESI -> new frame
X86EmitEspOffset(0x8d, kESI, 4); // lea ESI, [ESP+4]
- if (pFrameVptr == UMThkCallFrame::GetMethodFrameVPtr())
- {
- // Preserve argument registers for thiscall/fastcall
- X86EmitPushReg(kECX);
- X86EmitPushReg(kEDX);
- }
-
// Emit Setup thread
EmitSetup(rgRareLabels[0]); // rareLabel for rare setup
EmitLabel(rgRejoinLabels[0]); // rejoin label for rare setup
@@ -2640,23 +2580,6 @@ void StubLinkerCPU::EmitComMethodStubProlog(TADDR pFrameVptr,
// mov [ebx + Thread.GetFrame()], esi
X86EmitIndexRegStore(kEBX, Thread::GetOffsetOfCurrentFrame(), kESI);
- if (pFrameVptr == UMThkCallFrame::GetMethodFrameVPtr())
- {
- // push UnmanagedToManagedExceptHandler
- X86EmitPushImmPtr((LPVOID)UMThunkPrestubHandler);
-
- // mov eax, fs:[0]
- static const BYTE codeSEH1[] = { 0x64, 0xA1, 0x0, 0x0, 0x0, 0x0};
- EmitBytes(codeSEH1, sizeof(codeSEH1));
-
- // push eax
- X86EmitPushReg(kEAX);
-
- // mov dword ptr fs:[0], esp
- static const BYTE codeSEH2[] = { 0x64, 0x89, 0x25, 0x0, 0x0, 0x0, 0x0};
- EmitBytes(codeSEH2, sizeof(codeSEH2));
- }
-
#if _DEBUG
if (Frame::ShouldLogTransitions())
{
@@ -2693,19 +2616,6 @@ void StubLinkerCPU::EmitComMethodStubEpilog(TADDR pFrameVptr,
EmitCheckGSCookie(kESI, UnmanagedToManagedFrame::GetOffsetOfGSCookie());
- if (pFrameVptr == UMThkCallFrame::GetMethodFrameVPtr())
- {
- // if we are using exceptions, unlink the SEH
- // mov ecx,[esp] ;;pointer to the next exception record
- X86EmitEspOffset(0x8b, kECX, 0);
-
- // mov dword ptr fs:[0], ecx
- static const BYTE codeSEH[] = { 0x64, 0x89, 0x0D, 0x0, 0x0, 0x0, 0x0 };
- EmitBytes(codeSEH, sizeof(codeSEH));
-
- X86EmitAddEsp(sizeof(EXCEPTION_REGISTRATION_RECORD));
- }
-
// mov [ebx + Thread.GetFrame()], edi ;; restore previous frame
X86EmitIndexRegStore(kEBX, Thread::GetOffsetOfCurrentFrame(), kEDI);
@@ -2715,13 +2625,6 @@ void StubLinkerCPU::EmitComMethodStubEpilog(TADDR pFrameVptr,
EmitEnable(rgRareLabels[2]); // rare gc
EmitLabel(rgRejoinLabels[2]); // rejoin for rare gc
- if (pFrameVptr == UMThkCallFrame::GetMethodFrameVPtr())
- {
- // Restore argument registers for thiscall/fastcall
- X86EmitPopReg(kEDX);
- X86EmitPopReg(kECX);
- }
-
// add esp, popstack
X86EmitAddEsp(sizeof(GSCookie) + UnmanagedToManagedFrame::GetOffsetOfCalleeSavedRegisters());
@@ -2762,7 +2665,6 @@ void StubLinkerCPU::EmitComMethodStubEpilog(TADDR pFrameVptr,
EmitLabel(rgRareLabels[0]); // label for rare setup thread
EmitRareSetup(rgRejoinLabels[0], /*fThrow*/ TRUE); // emit rare setup thread
}
-#endif // !FEATURE_STUBS_AS_IL
//---------------------------------------------------------------
// Emit code to store the setup current Thread structure in eax.
@@ -2793,16 +2695,12 @@ VOID StubLinkerCPU::EmitRareSetup(CodeLabel *pRejoinPoint, BOOL fThrow)
{
STANDARD_VM_CONTRACT;
-#ifndef FEATURE_COMINTEROP
- _ASSERTE(fThrow);
-#else // !FEATURE_COMINTEROP
if (!fThrow)
{
X86EmitPushReg(kESI);
X86EmitCall(NewExternalCodeLabel((LPVOID) CreateThreadBlockReturnHr), sizeof(void*));
}
else
-#endif // !FEATURE_COMINTEROP
{
X86EmitCall(NewExternalCodeLabel((LPVOID) CreateThreadBlockThrow), 0);
}
@@ -2812,10 +2710,6 @@ VOID StubLinkerCPU::EmitRareSetup(CodeLabel *pRejoinPoint, BOOL fThrow)
X86EmitNearJump(pRejoinPoint);
}
-//========================================================================
-#endif // TARGET_X86
-//========================================================================
-#if defined(FEATURE_COMINTEROP) && defined(TARGET_X86)
//========================================================================
// Epilog for stubs that enter managed code from COM
//
@@ -2921,9 +2815,9 @@ void StubLinkerCPU::EmitSharedComMethodStubEpilog(TADDR pFrameVptr,
EmitRareSetup(rgRejoinLabels[0],/*fThrow*/ FALSE); // emit rare setup thread
}
-//========================================================================
#endif // defined(FEATURE_COMINTEROP) && defined(TARGET_X86)
+
#if !defined(FEATURE_STUBS_AS_IL) && defined(TARGET_X86)
/*==============================================================================
Pushes a TransitionFrame on the stack
@@ -3438,7 +3332,7 @@ VOID StubLinkerCPU::EmitUnwindInfoCheckSubfunction()
#endif // defined(_DEBUG) && defined(STUBLINKER_GENERATES_UNWIND_INFO)
-#ifdef TARGET_X86
+#if defined(FEATURE_COMINTEROP) && defined(TARGET_X86)
//-----------------------------------------------------------------------
// Generates the inline portion of the code to enable preemptive GC. Hopefully,
@@ -3547,49 +3441,6 @@ VOID StubLinkerCPU::EmitDisable(CodeLabel *pForwardRef, BOOL fCallIn, X86Reg Thr
// jnz RarePath
X86EmitCondJump(pForwardRef, X86CondCode::kJNZ);
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORESYSTEM)
- // If we are checking whether the current thread holds the loader lock, vector
- // such cases to the rare disable pathway, where we can check again.
- if (fCallIn && ShouldCheckLoaderLock())
- {
- X86EmitPushReg(kEAX);
- X86EmitPushReg(kEDX);
-
- if (ThreadReg == kECX)
- X86EmitPushReg(kECX);
-
- // BOOL AuxUlibIsDLLSynchronizationHeld(BOOL *IsHeld)
- //
- // So we need to be sure that both the return value and the passed BOOL are both TRUE.
- // If either is FALSE, then the call failed or the lock is not held. Either way, the
- // probe should not fire.
-
- X86EmitPushReg(kEDX); // BOOL temp
- Emit8(0x54); // push ESP because arg is &temp
- X86EmitCall(NewExternalCodeLabel((LPVOID) AuxUlibIsDLLSynchronizationHeld), 0);
-
- // callee has popped.
- X86EmitPopReg(kEDX); // recover temp
-
- CodeLabel *pPopLabel = NewCodeLabel();
-
- Emit16(0xc085); // test eax, eax
- X86EmitCondJump(pPopLabel, X86CondCode::kJZ);
-
- Emit16(0xd285); // test edx, edx
-
- EmitLabel(pPopLabel); // retain the conditional flags across the pops
-
- if (ThreadReg == kECX)
- X86EmitPopReg(kECX);
-
- X86EmitPopReg(kEDX);
- X86EmitPopReg(kEAX);
-
- X86EmitCondJump(pForwardRef, X86CondCode::kJNZ);
- }
-#endif
-
#ifdef _DEBUG
if (ThreadReg != kECX)
X86EmitDebugTrashReg(kECX);
@@ -3623,7 +3474,6 @@ VOID StubLinkerCPU::EmitRareDisable(CodeLabel *pRejoinPoint)
X86EmitNearJump(pRejoinPoint);
}
-#ifdef FEATURE_COMINTEROP
//-----------------------------------------------------------------------
// Generates the out-of-line portion of the code to disable preemptive GC.
// After the work is done, the code normally jumps back to the "pRejoinPoint"
@@ -3655,10 +3505,8 @@ VOID StubLinkerCPU::EmitRareDisableHRESULT(CodeLabel *pRejoinPoint, CodeLabel *p
X86EmitNearJump(pExitPoint);
}
-#endif // FEATURE_COMINTEROP
-
-#endif // TARGET_X86
+#endif // defined(FEATURE_COMINTEROP) && defined(TARGET_X86)
VOID StubLinkerCPU::EmitShuffleThunk(ShuffleEntry *pShuffleEntryArray)
diff --git a/src/coreclr/vm/i386/stublinkerx86.h b/src/coreclr/vm/i386/stublinkerx86.h
index 02ab6e9d253ea7..c719057e97ea39 100644
--- a/src/coreclr/vm/i386/stublinkerx86.h
+++ b/src/coreclr/vm/i386/stublinkerx86.h
@@ -250,17 +250,6 @@ class StubLinkerCPU : public StubLinker
);
VOID X86EmitPushEBPframe();
-#if defined(TARGET_X86)
-#if defined(PROFILING_SUPPORTED) && !defined(FEATURE_STUBS_AS_IL)
- // These are used to emit calls to notify the profiler of transitions in and out of
- // managed code through COM->COM+ interop or N/Direct
- VOID EmitProfilerComCallProlog(TADDR pFrameVptr, X86Reg regFrame);
- VOID EmitProfilerComCallEpilog(TADDR pFrameVptr, X86Reg regFrame);
-#endif // PROFILING_SUPPORTED && !FEATURE_STUBS_AS_IL
-#endif // TARGET_X86
-
-
-
// Emits the most efficient form of the operation:
//
// opcode altreg, [basereg + scaledreg*scale + ofs]
@@ -340,6 +329,7 @@ class StubLinkerCPU : public StubLinker
#endif
}
+#if defined(FEATURE_COMINTEROP) && defined(TARGET_X86)
VOID EmitEnable(CodeLabel *pForwardRef);
VOID EmitRareEnable(CodeLabel *pRejoinPoint);
@@ -349,20 +339,13 @@ class StubLinkerCPU : public StubLinker
VOID EmitSetup(CodeLabel *pForwardRef);
VOID EmitRareSetup(CodeLabel* pRejoinPoint, BOOL fThrow);
+#endif // FEATURE_COMINTEROP && TARGET_X86
#ifndef FEATURE_STUBS_AS_IL
VOID EmitMethodStubProlog(TADDR pFrameVptr, int transitionBlockOffset);
VOID EmitMethodStubEpilog(WORD numArgBytes, int transitionBlockOffset);
VOID EmitCheckGSCookie(X86Reg frameReg, int gsCookieOffset);
-
-#ifdef TARGET_X86
- void EmitComMethodStubProlog(TADDR pFrameVptr, CodeLabel** rgRareLabels,
- CodeLabel** rgRejoinLabels, BOOL bShouldProfile);
-
- void EmitComMethodStubEpilog(TADDR pFrameVptr, CodeLabel** rgRareLabels,
- CodeLabel** rgRejoinLabels, BOOL bShouldProfile);
-#endif // TARGET_X86
#endif // !FEATURE_STUBS_AS_IL
#ifdef TARGET_X86
@@ -379,6 +362,20 @@ class StubLinkerCPU : public StubLinker
VOID EmitComputedInstantiatingMethodStub(MethodDesc* pSharedMD, struct ShuffleEntry *pShuffleEntryArray, void* extraArg);
#if defined(FEATURE_COMINTEROP) && defined(TARGET_X86)
+
+#if defined(PROFILING_SUPPORTED)
+ // These are used to emit calls to notify the profiler of transitions in and out of
+ // managed code through COM->COM+ interop or N/Direct
+ VOID EmitProfilerComCallProlog(TADDR pFrameVptr, X86Reg regFrame);
+ VOID EmitProfilerComCallEpilog(TADDR pFrameVptr, X86Reg regFrame);
+#endif // PROFILING_SUPPORTED
+
+ void EmitComMethodStubProlog(TADDR pFrameVptr, CodeLabel** rgRareLabels,
+ CodeLabel** rgRejoinLabels, BOOL bShouldProfile);
+
+ void EmitComMethodStubEpilog(TADDR pFrameVptr, CodeLabel** rgRareLabels,
+ CodeLabel** rgRejoinLabels, BOOL bShouldProfile);
+
//========================================================================
// shared Epilog for stubs that enter managed code from COM
// uses a return thunk within the method desc
diff --git a/src/coreclr/vm/ilmarshalers.cpp b/src/coreclr/vm/ilmarshalers.cpp
index 4782df6281b128..b6cb70ccf56c7a 100644
--- a/src/coreclr/vm/ilmarshalers.cpp
+++ b/src/coreclr/vm/ilmarshalers.cpp
@@ -4922,8 +4922,8 @@ FCIMPL3(void, MngdSafeArrayMarshaler::ConvertSpaceToManaged, MngdSafeArrayMarsha
{
WCHAR strExpectedRank[64];
WCHAR strActualRank[64];
- _ltow_s(pThis->m_iRank, strExpectedRank, COUNTOF(strExpectedRank), 10);
- _ltow_s(iSafeArrayRank, strActualRank, COUNTOF(strActualRank), 10);
+ _ltow_s(pThis->m_iRank, strExpectedRank, ARRAY_SIZE(strExpectedRank), 10);
+ _ltow_s(iSafeArrayRank, strActualRank, ARRAY_SIZE(strActualRank), 10);
COMPlusThrow(kSafeArrayRankMismatchException, IDS_EE_SAFEARRAYRANKMISMATCH, strActualRank, strExpectedRank);
}
}
diff --git a/src/coreclr/vm/interoputil.cpp b/src/coreclr/vm/interoputil.cpp
index 610c3418ae530f..3bf1abcfcfbee9 100644
--- a/src/coreclr/vm/interoputil.cpp
+++ b/src/coreclr/vm/interoputil.cpp
@@ -43,7 +43,6 @@
#include "commtmemberinfomap.h"
#include "olevariant.h"
#include "stdinterfaces.h"
-#include "notifyexternals.h"
#include "typeparse.h"
#include "interoputil.inl"
#include "typestring.h"
@@ -920,7 +919,7 @@ ReadBestFitCustomAttribute(Module* pModule, mdTypeDef cl, BOOL* BestFit, BOOL* T
}
-int InternalWideToAnsi(__in_ecount(iNumWideChars) LPCWSTR szWideString, int iNumWideChars, __out_ecount_opt(cbAnsiBufferSize) LPSTR szAnsiString, int cbAnsiBufferSize, BOOL fBestFit, BOOL fThrowOnUnmappableChar)
+int InternalWideToAnsi(_In_reads_(iNumWideChars) LPCWSTR szWideString, int iNumWideChars, _Out_writes_bytes_opt_(cbAnsiBufferSize) LPSTR szAnsiString, int cbAnsiBufferSize, BOOL fBestFit, BOOL fThrowOnUnmappableChar)
{
CONTRACTL
{
@@ -2784,7 +2783,7 @@ BOOL IsComTargetValidForType(REFLECTCLASSBASEREF* pRefClassObj, OBJECTREF* pTarg
return FALSE;
}
-DISPID ExtractStandardDispId(__in_z LPWSTR strStdDispIdMemberName)
+DISPID ExtractStandardDispId(_In_z_ LPWSTR strStdDispIdMemberName)
{
CONTRACTL
{
@@ -3316,7 +3315,7 @@ void IUInvokeDispMethod(
vDispIDElement.pMT = pInvokedMT;
vDispIDElement.strNameLength = strNameLength;
vDispIDElement.lcid = lcid;
- wcscpy_s(vDispIDElement.strName, COUNTOF(vDispIDElement.strName), aNamesToConvert[0]);
+ wcscpy_s(vDispIDElement.strName, ARRAY_SIZE(vDispIDElement.strName), aNamesToConvert[0]);
// Only look up if the cache has already been created.
DispIDCache* pDispIDCache = GetAppDomain()->GetRefDispIDCache();
@@ -3782,13 +3781,13 @@ VOID IntializeInteropLogging()
g_TraceCount = g_pConfig->GetTraceWrapper();
}
-VOID LogInterop(__in_z LPCSTR szMsg)
+VOID LogInterop(_In_z_ LPCSTR szMsg)
{
LIMITED_METHOD_CONTRACT;
LOG( (LF_INTEROP, LL_INFO10, "%s\n",szMsg) );
}
-VOID LogInterop(__in_z LPCWSTR wszMsg)
+VOID LogInterop(_In_z_ LPCWSTR wszMsg)
{
LIMITED_METHOD_CONTRACT;
LOG( (LF_INTEROP, LL_INFO10, "%S\n", wszMsg) );
@@ -3964,7 +3963,7 @@ VOID LogInteropLeak(IUnknown* pItf)
//-------------------------------------------------------------------
// VOID LogInteropQI(IUnknown* pItf, REFIID iid, HRESULT hr, LPCSTR szMsg)
//-------------------------------------------------------------------
-VOID LogInteropQI(IUnknown* pItf, REFIID iid, HRESULT hrArg, __in_z LPCSTR szMsg)
+VOID LogInteropQI(IUnknown* pItf, REFIID iid, HRESULT hrArg, _In_z_ LPCSTR szMsg)
{
if (!LoggingOn(LF_INTEROP, LL_ALWAYS))
return;
@@ -4013,7 +4012,7 @@ VOID LogInteropQI(IUnknown* pItf, REFIID iid, HRESULT hrArg, __in_z LPCSTR szMsg
//-------------------------------------------------------------------
// VOID LogInteropAddRef(IUnknown* pItf, ULONG cbRef, LPCSTR szMsg)
//-------------------------------------------------------------------
-VOID LogInteropAddRef(IUnknown* pItf, ULONG cbRef, __in_z LPCSTR szMsg)
+VOID LogInteropAddRef(IUnknown* pItf, ULONG cbRef, _In_z_ LPCSTR szMsg)
{
if (!LoggingOn(LF_INTEROP, LL_ALWAYS))
return;
@@ -4046,7 +4045,7 @@ VOID LogInteropAddRef(IUnknown* pItf, ULONG cbRef, __in_z LPCSTR szMsg)
//-------------------------------------------------------------------
// VOID LogInteropRelease(IUnknown* pItf, ULONG cbRef, LPCSTR szMsg)
//-------------------------------------------------------------------
-VOID LogInteropRelease(IUnknown* pItf, ULONG cbRef, __in_z LPCSTR szMsg)
+VOID LogInteropRelease(IUnknown* pItf, ULONG cbRef, _In_z_ LPCSTR szMsg)
{
if (!LoggingOn(LF_INTEROP, LL_ALWAYS))
return;
diff --git a/src/coreclr/vm/interoputil.h b/src/coreclr/vm/interoputil.h
index f9706d88079983..eec7e378a561c4 100644
--- a/src/coreclr/vm/interoputil.h
+++ b/src/coreclr/vm/interoputil.h
@@ -92,7 +92,7 @@ BOOL IsComObjectClass(TypeHandle type);
//---------------------------------------------------------
VOID ReadBestFitCustomAttribute(MethodDesc* pMD, BOOL* BestFit, BOOL* ThrowOnUnmappableChar);
VOID ReadBestFitCustomAttribute(Module* pModule, mdTypeDef cl, BOOL* BestFit, BOOL* ThrowOnUnmappableChar);
-int InternalWideToAnsi(__in_ecount(iNumWideChars) LPCWSTR szWideString, int iNumWideChars, __out_ecount_opt(cbAnsiBufferSize) LPSTR szAnsiString, int cbAnsiBufferSize, BOOL fBestFit, BOOL fThrowOnUnmappableChar);
+int InternalWideToAnsi(_In_reads_(iNumWideChars) LPCWSTR szWideString, int iNumWideChars, _Out_writes_bytes_opt_(cbAnsiBufferSize) LPSTR szAnsiString, int cbAnsiBufferSize, BOOL fBestFit, BOOL fThrowOnUnmappableChar);
//---------------------------------------------------------
// Read the ClassInterfaceType custom attribute info from
@@ -358,14 +358,14 @@ ClassFactoryBase *GetComClassFactory(MethodTable* pClassMT);
#ifdef _DEBUG
-VOID LogInterop(__in_z LPCSTR szMsg);
-VOID LogInterop(__in_z LPCWSTR szMsg);
+VOID LogInterop(_In_z_ LPCSTR szMsg);
+VOID LogInterop(_In_z_ LPCWSTR szMsg);
VOID LogInteropLeak(IUnkEntry * pEntry);
VOID LogInteropLeak(IUnknown* pItf);
-VOID LogInteropQI(IUnknown* pItf, REFIID riid, HRESULT hr, __in_z LPCSTR szMsg);
-VOID LogInteropAddRef(IUnknown* pItf, ULONG cbRef, __in_z LPCSTR szMsg);
-VOID LogInteropRelease(IUnknown* pItf, ULONG cbRef, __in_z LPCSTR szMsg);
+VOID LogInteropQI(IUnknown* pItf, REFIID riid, HRESULT hr, _In_z_ LPCSTR szMsg);
+VOID LogInteropAddRef(IUnknown* pItf, ULONG cbRef, _In_z_ LPCSTR szMsg);
+VOID LogInteropRelease(IUnknown* pItf, ULONG cbRef, _In_z_ LPCSTR szMsg);
VOID LogRCWCreate(RCW* pWrap, IUnknown* pUnk);
VOID LogRCWMinorCleanup(RCW* pWrap);
diff --git a/src/coreclr/vm/interpreter.cpp b/src/coreclr/vm/interpreter.cpp
index 6ca5bb6935a622..ac8037cb5a835d 100644
--- a/src/coreclr/vm/interpreter.cpp
+++ b/src/coreclr/vm/interpreter.cpp
@@ -1628,7 +1628,7 @@ size_t Interpreter::GetFrameSize(InterpreterMethodInfo* interpMethInfo)
}
// static
-ARG_SLOT Interpreter::ExecuteMethodWrapper(struct InterpreterMethodInfo* interpMethInfo, bool directCall, BYTE* ilArgs, void* stubContext, __out bool* pDoJmpCall, CORINFO_RESOLVED_TOKEN* pResolvedToken)
+ARG_SLOT Interpreter::ExecuteMethodWrapper(struct InterpreterMethodInfo* interpMethInfo, bool directCall, BYTE* ilArgs, void* stubContext, _Out_ bool* pDoJmpCall, CORINFO_RESOLVED_TOKEN* pResolvedToken)
{
#define INTERP_DYNAMIC_CONTRACTS 1
#if INTERP_DYNAMIC_CONTRACTS
@@ -1995,7 +1995,7 @@ void Interpreter::DoMonitorExitWork()
}
-void Interpreter::ExecuteMethod(ARG_SLOT* retVal, __out bool* pDoJmpCall, __out unsigned* pJmpCallToken)
+void Interpreter::ExecuteMethod(ARG_SLOT* retVal, _Out_ bool* pDoJmpCall, _Out_ unsigned* pJmpCallToken)
{
#if INTERP_DYNAMIC_CONTRACTS
CONTRACTL {
diff --git a/src/coreclr/vm/interpreter.h b/src/coreclr/vm/interpreter.h
index a6346cebc4ccfa..041484855c4dc8 100644
--- a/src/coreclr/vm/interpreter.h
+++ b/src/coreclr/vm/interpreter.h
@@ -722,7 +722,7 @@ class InterpreterCEEInfo: public CEEInfo
{
CEEJitInfo m_jitInfo;
public:
- InterpreterCEEInfo(CORINFO_METHOD_HANDLE meth): CEEInfo((MethodDesc*)meth), m_jitInfo((MethodDesc*)meth, NULL, NULL, CORJIT_FLAGS::CORJIT_FLAG_SPEED_OPT) { m_pOverride = this; }
+ InterpreterCEEInfo(CORINFO_METHOD_HANDLE meth): CEEInfo((MethodDesc*)meth), m_jitInfo((MethodDesc*)meth, NULL, NULL, CORJIT_FLAGS::CORJIT_FLAG_SPEED_OPT) { }
// Certain methods are unimplemented by CEEInfo (they hit an assert). They are implemented by CEEJitInfo, yet
// don't seem to require any of the CEEJitInfo state we can't provide. For those case, delegate to the "partial"
diff --git a/src/coreclr/vm/jithelpers.cpp b/src/coreclr/vm/jithelpers.cpp
index 3e92144dca122b..109f98ceecfe13 100644
--- a/src/coreclr/vm/jithelpers.cpp
+++ b/src/coreclr/vm/jithelpers.cpp
@@ -5950,7 +5950,7 @@ void InitJitHelperLogging()
else
{
_ASSERTE(((size_t)hlpFunc->pfnHelper - 1) >= 0 &&
- ((size_t)hlpFunc->pfnHelper - 1) < COUNTOF(hlpDynamicFuncTable));
+ ((size_t)hlpFunc->pfnHelper - 1) < ARRAY_SIZE(hlpDynamicFuncTable));
VMHELPDEF* dynamicHlpFunc = &hlpDynamicFuncTable[((size_t)hlpFunc->pfnHelper - 1)];
// While we're here initialize the table of VMHELPCOUNTDEF
diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp
index df4e985fda1e6a..e28434acabe56e 100644
--- a/src/coreclr/vm/jitinterface.cpp
+++ b/src/coreclr/vm/jitinterface.cpp
@@ -190,16 +190,6 @@ BOOL ModifyCheckForDynamicMethod(DynamicResolver *pResolver,
/*****************************************************************************/
-void CEEInfo::setOverride(ICorDynamicInfo *pOverride, CORINFO_METHOD_HANDLE currentMethod)
-{
- LIMITED_METHOD_CONTRACT;
- m_pOverride = pOverride;
- m_pMethodBeingCompiled = (MethodDesc *)currentMethod; // method being compiled
-
- m_hMethodForSecurity_Key = NULL;
- m_pMethodForSecurity_Value = NULL;
-}
-
// Initialize from data we passed across to the JIT
void CEEInfo::GetTypeContext(const CORINFO_SIG_INST *info, SigTypeContext *pTypeContext)
{
@@ -573,7 +563,7 @@ CORINFO_CLASS_HANDLE CEEInfo::getTokenTypeAsHandle (CORINFO_RESOLVED_TOKEN * pRe
size_t CEEInfo::findNameOfToken (
CORINFO_MODULE_HANDLE scopeHnd,
mdToken metaTOK,
- __out_ecount (FQNameCapacity) char * szFQName,
+ _Out_writes_ (FQNameCapacity) char * szFQName,
size_t FQNameCapacity)
{
CONTRACTL {
@@ -716,7 +706,7 @@ const char16_t* CEEInfo::getStringLiteral (
/* static */
size_t CEEInfo::findNameOfToken (Module* module,
mdToken metaTOK,
- __out_ecount (FQNameCapacity) char * szFQName,
+ _Out_writes_ (FQNameCapacity) char * szFQName,
size_t FQNameCapacity)
{
CONTRACTL {
@@ -1470,8 +1460,7 @@ void CEEInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken,
fieldAccessor = intrinsicAccessor;
}
else
- if (IsCompilingForNGen() ||
- // Static fields are not pinned in collectible types. We will always access
+ if (// Static fields are not pinned in collectible types. We will always access
// them using a helper since the address cannot be embeded into the code.
pFieldMT->Collectible() ||
// We always treat accessing thread statics as if we are in domain neutral code.
@@ -1633,13 +1622,6 @@ void CEEInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken,
pResult->accessCalloutHelper.args[0].Set(CORINFO_METHOD_HANDLE(pCallerForSecurity));
pResult->accessCalloutHelper.args[1].Set(CORINFO_FIELD_HANDLE(pField));
-
- if (IsCompilingForNGen())
- {
- //see code:CEEInfo::getCallInfo for more information.
- if (pCallerForSecurity->ContainsGenericVariables())
- COMPlusThrowNonLocalized(kNotSupportedException, W("Cannot embed generic MethodDesc"));
- }
}
}
}
@@ -2603,7 +2585,7 @@ void CEEInfo::ScanForModuleDependencies(Module* pModule, SigPointer psig)
if (!pTypeDefModule->IsSystem() && (pModule != pTypeDefModule))
{
- m_pOverride->addActiveDependency((CORINFO_MODULE_HANDLE)pModule, (CORINFO_MODULE_HANDLE)pTypeDefModule);
+ addActiveDependency((CORINFO_MODULE_HANDLE)pModule, (CORINFO_MODULE_HANDLE)pTypeDefModule);
}
}
break;
@@ -2683,7 +2665,7 @@ void CEEInfo::ScanInstantiation(Module * pModule, Instantiation inst)
if (!pDefModule->IsSystem() && (pModule != pDefModule))
{
- m_pOverride->addActiveDependency((CORINFO_MODULE_HANDLE)pModule, (CORINFO_MODULE_HANDLE)pDefModule);
+ addActiveDependency((CORINFO_MODULE_HANDLE)pModule, (CORINFO_MODULE_HANDLE)pDefModule);
}
if (pMT->HasInstantiation())
@@ -2765,7 +2747,7 @@ void CEEInfo::ScanToken(Module * pModule, CORINFO_RESOLVED_TOKEN * pResolvedToke
if (pModule != pDefModule)
{
- m_pOverride->addActiveDependency((CORINFO_MODULE_HANDLE)pModule, (CORINFO_MODULE_HANDLE)pDefModule);
+ addActiveDependency((CORINFO_MODULE_HANDLE)pModule, (CORINFO_MODULE_HANDLE)pDefModule);
}
MethodTable * pParentMT = pMT->GetParentMethodTable();
@@ -3374,7 +3356,7 @@ const char* CEEInfo::getHelperName (CorInfoHelpFunc ftnNum)
/*********************************************************************/
-int CEEInfo::appendClassName(__deref_inout_ecount(*pnBufLen) char16_t** ppBuf,
+int CEEInfo::appendClassName(_Outptr_result_buffer_(*pnBufLen) char16_t** ppBuf,
int* pnBufLen,
CORINFO_CLASS_HANDLE clsHnd,
bool fNamespace,
@@ -3725,27 +3707,13 @@ CorInfoInitClassResult CEEInfo::initClass(
MethodDesc *methodBeingCompiled = m_pMethodBeingCompiled;
- BOOL fMethodZappedOrNGen = IsCompilingForNGen();
-
MethodTable *pTypeToInitMT = typeToInitTH.AsMethodTable();
- // This should be the most common early-out case.
- if (fMethodZappedOrNGen)
- {
- if (pTypeToInitMT->IsClassPreInited())
- {
- result = CORINFO_INITCLASS_NOT_REQUIRED;
- goto exit;
- }
- }
- else
+ if (pTypeToInitMT->IsClassInited())
{
- if (pTypeToInitMT->IsClassInited())
- {
- // If the type is initialized there really is nothing to do.
- result = CORINFO_INITCLASS_INITIALIZED;
- goto exit;
- }
+ // If the type is initialized there really is nothing to do.
+ result = CORINFO_INITCLASS_INITIALIZED;
+ goto exit;
}
if (pTypeToInitMT->IsGlobalClass())
@@ -3848,14 +3816,6 @@ CorInfoInitClassResult CEEInfo::initClass(
}
}
- if (fMethodZappedOrNGen)
- {
- // Well, because of code sharing we can't do anything at coge generation time.
- // We have to do it at runtime.
- result = CORINFO_INITCLASS_USE_HELPER;
- goto exit;
- }
-
//
// Optimizations for domain specific code
//
@@ -4830,13 +4790,6 @@ CorInfoIsAccessAllowedResult CEEInfo::canAccessClass(
pAccessHelper->args[0].Set(CORINFO_METHOD_HANDLE(pCallerForSecurity));
pAccessHelper->args[1].Set(CORINFO_CLASS_HANDLE(pCalleeForSecurity.AsPtr()));
-
- if (IsCompilingForNGen())
- {
- //see code:CEEInfo::getCallInfo for more information.
- if (pCallerForSecurity->ContainsGenericVariables() || pCalleeForSecurity.ContainsGenericVariables())
- COMPlusThrowNonLocalized(kNotSupportedException, W("Cannot embed generic TypeHandle"));
- }
}
EE_TO_JIT_TRANSITION();
@@ -5413,19 +5366,6 @@ void CEEInfo::getCallInfo(
pResult->callsiteCalloutHelper.args[0].Set(CORINFO_METHOD_HANDLE(pCallerForSecurity));
pResult->callsiteCalloutHelper.args[1].Set(CORINFO_METHOD_HANDLE(pCalleeForSecurity));
-
- //We now embed open instantiations in a few places for security callouts (since you can only
- //do the security check on the open instantiation). We throw these methods out in
- //TriageMethodForZap. In addition, NGen has problems referencing them properly. Just throw out the whole
- //method and rejit at runtime.
- if (IsCompilingForNGen())
- {
- if (pCallerForSecurity->ContainsGenericVariables()
- || pCalleeForSecurity->ContainsGenericVariables())
- {
- COMPlusThrowNonLocalized(kNotSupportedException, W("Cannot embed generic MethodDesc"));
- }
- }
}
}
}
@@ -5895,8 +5835,8 @@ CorInfoHelpFunc CEEInfo::getCastingHelper(CORINFO_RESOLVED_TOKEN * pResolvedToke
bool fClassMustBeRestored;
result = getCastingHelperStatic(TypeHandle(pResolvedToken->hClass), fThrowing, &fClassMustBeRestored);
- if (fClassMustBeRestored && m_pOverride != NULL)
- m_pOverride->classMustBeLoadedBeforeCodeIsRun(pResolvedToken->hClass);
+ if (fClassMustBeRestored)
+ classMustBeLoadedBeforeCodeIsRun(pResolvedToken->hClass);
EE_TO_JIT_TRANSITION();
@@ -6019,8 +5959,7 @@ CorInfoHelpFunc CEEInfo::getUnBoxHelper(CORINFO_CLASS_HANDLE clsHnd)
{
LIMITED_METHOD_CONTRACT;
- if (m_pOverride != NULL)
- m_pOverride->classMustBeLoadedBeforeCodeIsRun(clsHnd);
+ classMustBeLoadedBeforeCodeIsRun(clsHnd);
TypeHandle VMClsHnd(clsHnd);
if (Nullable::IsNullableType(VMClsHnd))
@@ -9359,7 +9298,7 @@ CorInfoTypeWithMod CEEInfo::getArgType (
TypeHandle thPtr = ptr.GetTypeHandleNT(pModule, &typeContext);
if(!thPtr.IsNull())
{
- m_pOverride->classMustBeLoadedBeforeCodeIsRun(CORINFO_CLASS_HANDLE(thPtr.AsPtr()));
+ classMustBeLoadedBeforeCodeIsRun(CORINFO_CLASS_HANDLE(thPtr.AsPtr()));
}
}
break;
@@ -10033,7 +9972,7 @@ HRESULT CEEInfo::GetErrorHRESULT(struct _EXCEPTION_POINTERS *pExceptionPointers)
}
-uint32_t CEEInfo::GetErrorMessage(__inout_ecount(bufferLength) char16_t* buffer, uint32_t bufferLength)
+uint32_t CEEInfo::GetErrorMessage(_Inout_updates_(bufferLength) char16_t* buffer, uint32_t bufferLength)
{
CONTRACTL {
THROWS;
@@ -10416,7 +10355,7 @@ bool CEEInfo::runWithErrorTrap(void (*function)(void*), void* param)
#if !defined(TARGET_UNIX)
RunWithErrorTrapFilterParam trapParam;
- trapParam.m_corInfo = m_pOverride == nullptr ? this : m_pOverride;
+ trapParam.m_corInfo = this;
trapParam.m_function = function;
trapParam.m_param = param;
diff --git a/src/coreclr/vm/jitinterface.h b/src/coreclr/vm/jitinterface.h
index 43b9040b7c3363..1afac1ba80201a 100644
--- a/src/coreclr/vm/jitinterface.h
+++ b/src/coreclr/vm/jitinterface.h
@@ -425,7 +425,7 @@ class CEEInfo : public ICorJitInfo
static CorInfoHelpFunc getSharedStaticsHelper(FieldDesc * pField, MethodTable * pFieldMT);
static size_t findNameOfToken (Module* module, mdToken metaTOK,
- __out_ecount (FQNameCapacity) char * szFQName, size_t FQNameCapacity);
+ _Out_writes_ (FQNameCapacity) char * szFQName, size_t FQNameCapacity);
DWORD getMethodAttribsInternal (CORINFO_METHOD_HANDLE ftnHnd);
@@ -475,14 +475,6 @@ class CEEInfo : public ICorJitInfo
CORINFO_GET_TAILCALL_HELPERS_FLAGS flags,
CORINFO_TAILCALL_HELPERS* pResult);
- // Returns whether we are generating code for NGen image.
- bool IsCompilingForNGen()
- {
- LIMITED_METHOD_CONTRACT;
- // NGen is the only place where we set the override
- return this != m_pOverride;
- }
-
// This normalizes EE type information into the form expected by the JIT.
//
// If typeHnd contains exact type information, then *clsRet will contain
@@ -492,7 +484,6 @@ class CEEInfo : public ICorJitInfo
CORINFO_CLASS_HANDLE *clsRet = NULL /* optional out */ );
CEEInfo(MethodDesc * fd = NULL, bool fVerifyOnly = false, bool fAllowInlining = true) :
- m_pOverride(NULL),
m_pMethodBeingCompiled(fd),
m_fVerifyOnly(fVerifyOnly),
m_pThread(GetThreadNULLOk()),
@@ -569,13 +560,6 @@ class CEEInfo : public ICorJitInfo
#endif
protected:
- // NGen provides its own modifications to EE-JIT interface. From technical reason it cannot simply inherit
- // from code:CEEInfo class (because it has dependencies on VM that NGen does not want).
- // Therefore the "normal" EE-JIT interface has code:m_pOverride hook that is set either to
- // * 'this' (code:CEEInfo) at runtime, or to
- // * code:ZapInfo - the NGen specific implementation of the interface.
- ICorDynamicInfo * m_pOverride;
-
MethodDesc* m_pMethodBeingCompiled; // Top-level method being compiled
bool m_fVerifyOnly;
Thread * m_pThread; // Cached current thread for faster JIT-EE transitions
@@ -847,8 +831,6 @@ class CEEJitInfo : public CEEInfo
GC_NOTRIGGER;
MODE_ANY;
} CONTRACTL_END;
-
- m_pOverride = this;
}
~CEEJitInfo()
diff --git a/src/coreclr/vm/method.cpp b/src/coreclr/vm/method.cpp
index 6e20c4d28f51c0..4309978b132346 100644
--- a/src/coreclr/vm/method.cpp
+++ b/src/coreclr/vm/method.cpp
@@ -1656,6 +1656,13 @@ UINT MethodDesc::CbStackPop()
SUPPORTS_DAC;
MetaSig msig(this);
ArgIterator argit(&msig);
+
+ bool fCtorOfVariableSizedObject = msig.HasThis() && (GetMethodTable() == g_pStringClass) && IsCtor();
+ if (fCtorOfVariableSizedObject)
+ {
+ msig.ClearHasThis();
+ }
+
return argit.CbStackPop();
}
#endif // TARGET_X86
diff --git a/src/coreclr/vm/mlinfo.cpp b/src/coreclr/vm/mlinfo.cpp
index 1dcc726213640f..c5731840122845 100644
--- a/src/coreclr/vm/mlinfo.cpp
+++ b/src/coreclr/vm/mlinfo.cpp
@@ -1130,27 +1130,27 @@ MarshalInfo::MarshalInfo(Module* pModule,
CHAR achDbgContext[DEBUG_CONTEXT_STR_LEN] = "";
if (!pDebugName)
{
- strncpy_s(achDbgContext, COUNTOF(achDbgContext), "", _TRUNCATE);
+ strncpy_s(achDbgContext, ARRAY_SIZE(achDbgContext), "", _TRUNCATE);
}
else
{
- strncat_s(achDbgContext, COUNTOF(achDbgContext), pDebugClassName, _TRUNCATE);
- strncat_s(achDbgContext, COUNTOF(achDbgContext), NAMESPACE_SEPARATOR_STR, _TRUNCATE);
- strncat_s(achDbgContext, COUNTOF(achDbgContext), pDebugName, _TRUNCATE);
- strncat_s(achDbgContext, COUNTOF(achDbgContext), " ", _TRUNCATE);
+ strncat_s(achDbgContext, ARRAY_SIZE(achDbgContext), pDebugClassName, _TRUNCATE);
+ strncat_s(achDbgContext, ARRAY_SIZE(achDbgContext), NAMESPACE_SEPARATOR_STR, _TRUNCATE);
+ strncat_s(achDbgContext, ARRAY_SIZE(achDbgContext), pDebugName, _TRUNCATE);
+ strncat_s(achDbgContext, ARRAY_SIZE(achDbgContext), " ", _TRUNCATE);
switch (argidx)
{
case (UINT)-1:
- strncat_s(achDbgContext, COUNTOF(achDbgContext), "field", _TRUNCATE);
+ strncat_s(achDbgContext, ARRAY_SIZE(achDbgContext), "field", _TRUNCATE);
break;
case 0:
- strncat_s(achDbgContext, COUNTOF(achDbgContext), "return value", _TRUNCATE);
+ strncat_s(achDbgContext, ARRAY_SIZE(achDbgContext), "return value", _TRUNCATE);
break;
default:
{
char buf[30];
- sprintf_s(buf, COUNTOF(buf), "param #%lu", (ULONG)argidx);
- strncat_s(achDbgContext, COUNTOF(achDbgContext), buf, _TRUNCATE);
+ sprintf_s(buf, ARRAY_SIZE(buf), "param #%lu", (ULONG)argidx);
+ strncat_s(achDbgContext, ARRAY_SIZE(achDbgContext), buf, _TRUNCATE);
}
}
}
@@ -2896,7 +2896,7 @@ UINT16 MarshalInfo::GetNativeSize(MarshalType mtype)
#include "mtypes.h"
};
- _ASSERTE((SIZE_T)mtype < COUNTOF(nativeSizes));
+ _ASSERTE((SIZE_T)mtype < ARRAY_SIZE(nativeSizes));
BYTE nativeSize = nativeSizes[mtype];
if (nativeSize == VARIABLESIZE)
@@ -2959,7 +2959,7 @@ OVERRIDEPROC MarshalInfo::GetArgumentOverrideProc(MarshalType mtype)
#include "mtypes.h"
};
- _ASSERTE((SIZE_T)mtype < COUNTOF(ILArgumentOverrideProcs));
+ _ASSERTE((SIZE_T)mtype < ARRAY_SIZE(ILArgumentOverrideProcs));
return ILArgumentOverrideProcs[mtype];
}
@@ -2979,7 +2979,7 @@ RETURNOVERRIDEPROC MarshalInfo::GetReturnOverrideProc(MarshalType mtype)
#include "mtypes.h"
};
- _ASSERTE((SIZE_T)mtype < COUNTOF(ILReturnOverrideProcs));
+ _ASSERTE((SIZE_T)mtype < ARRAY_SIZE(ILReturnOverrideProcs));
return ILReturnOverrideProcs[mtype];
}
@@ -3172,7 +3172,7 @@ VOID MarshalInfo::DumpMarshalInfo(Module* pModule, SigPointer sig, const SigType
while (cbNativeType--)
{
char num[100];
- sprintf_s(num, COUNTOF(num), "0x%lx ", (ULONG)*pvNativeType);
+ sprintf_s(num, ARRAY_SIZE(num), "0x%lx ", (ULONG)*pvNativeType);
logbuf.AppendASCII(num);
switch (*(pvNativeType++))
{
@@ -3314,7 +3314,7 @@ VOID MarshalInfo::DumpMarshalInfo(Module* pModule, SigPointer sig, const SigType
logbuf.AppendASCII("MarshalType : ");
{
char num[100];
- sprintf_s(num, COUNTOF(num), "0x%lx ", (ULONG)m_type);
+ sprintf_s(num, ARRAY_SIZE(num), "0x%lx ", (ULONG)m_type);
logbuf.AppendASCII(num);
}
switch (m_type)
diff --git a/src/coreclr/vm/multicorejit.cpp b/src/coreclr/vm/multicorejit.cpp
index 2ad518bf9f7361..b747608a184783 100644
--- a/src/coreclr/vm/multicorejit.cpp
+++ b/src/coreclr/vm/multicorejit.cpp
@@ -1551,7 +1551,7 @@ DWORD MulticoreJitManager::EncodeModuleHelper(void * pModuleContext, Module * pR
// wszProfile - profile name
// ptrNativeAssemblyBinder - the binding context
//
-extern "C" void QCALLTYPE MultiCoreJIT_InternalStartProfile(__in_z LPCWSTR wszProfile, INT_PTR ptrNativeAssemblyBinder)
+extern "C" void QCALLTYPE MultiCoreJIT_InternalStartProfile(_In_z_ LPCWSTR wszProfile, INT_PTR ptrNativeAssemblyBinder)
{
QCALL_CONTRACT;
@@ -1570,7 +1570,7 @@ extern "C" void QCALLTYPE MultiCoreJIT_InternalStartProfile(__in_z LPCWSTR wszPr
}
-extern "C" void QCALLTYPE MultiCoreJIT_InternalSetProfileRoot(__in_z LPCWSTR wszProfilePath)
+extern "C" void QCALLTYPE MultiCoreJIT_InternalSetProfileRoot(_In_z_ LPCWSTR wszProfilePath)
{
QCALL_CONTRACT;
diff --git a/src/coreclr/vm/multicorejit.h b/src/coreclr/vm/multicorejit.h
index 7faff54d9485c7..f4e38c6dc0953b 100644
--- a/src/coreclr/vm/multicorejit.h
+++ b/src/coreclr/vm/multicorejit.h
@@ -313,7 +313,7 @@ class MulticoreJitManager
// For qcallentrypoints.cpp
-extern "C" void QCALLTYPE MultiCoreJIT_InternalSetProfileRoot(__in_z LPCWSTR directoryPath);
-extern "C" void QCALLTYPE MultiCoreJIT_InternalStartProfile(__in_z LPCWSTR wszProfile, INT_PTR ptrNativeAssemblyBinder);
+extern "C" void QCALLTYPE MultiCoreJIT_InternalSetProfileRoot(_In_z_ LPCWSTR directoryPath);
+extern "C" void QCALLTYPE MultiCoreJIT_InternalStartProfile(_In_z_ LPCWSTR wszProfile, INT_PTR ptrNativeAssemblyBinder);
#endif // __MULTICORE_JIT_H__
diff --git a/src/coreclr/vm/nativeeventsource.cpp b/src/coreclr/vm/nativeeventsource.cpp
index 45550259079ee0..751e8e625aad78 100644
--- a/src/coreclr/vm/nativeeventsource.cpp
+++ b/src/coreclr/vm/nativeeventsource.cpp
@@ -13,7 +13,7 @@
#if defined(FEATURE_EVENTSOURCE_XPLAT)
-extern "C" void QCALLTYPE LogEventSource(__in_z int eventID, __in_z LPCWSTR eventName, __in_z LPCWSTR eventSourceName, __in_z LPCWSTR payload)
+extern "C" void QCALLTYPE LogEventSource(_In_z_ int eventID, _In_z_ LPCWSTR eventName, _In_z_ LPCWSTR eventSourceName, _In_z_ LPCWSTR payload)
{
QCALL_CONTRACT;
BEGIN_QCALL;
@@ -44,7 +44,7 @@ extern "C" BOOL QCALLTYPE IsEventSourceLoggingEnabled()
// change genRuntimeEventSources.py script to not emit the body that throws NotImplementedException for the event that
// want to be fired from managed code.
// See https://github.com/dotnet/runtime/pull/47829 for an example of how to do this.
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStart(__in_z uint activeWorkerThreadCount, __in_z uint retiredWorkerThreadCount, __in_z short clrInstanceID)
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStart(_In_z_ uint activeWorkerThreadCount, _In_z_ uint retiredWorkerThreadCount, _In_z_ short clrInstanceID)
{
QCALL_CONTRACT;
BEGIN_QCALL;
@@ -54,7 +54,7 @@ extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStart(__in_z uint activeWorke
END_QCALL;
}
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStop(__in_z uint activeWorkerThreadCount, __in_z uint retiredWorkerThreadCount, __in_z short clrInstanceID)
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStop(_In_z_ uint activeWorkerThreadCount, _In_z_ uint retiredWorkerThreadCount, _In_z_ short clrInstanceID)
{
QCALL_CONTRACT;
BEGIN_QCALL;
@@ -64,7 +64,7 @@ extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStop(__in_z uint activeWorker
END_QCALL;
}
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadWait(__in_z uint activeWorkerThreadCount, __in_z uint retiredWorkerThreadCount, __in_z short clrInstanceID)
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadWait(_In_z_ uint activeWorkerThreadCount, _In_z_ uint retiredWorkerThreadCount, _In_z_ short clrInstanceID)
{
QCALL_CONTRACT;
BEGIN_QCALL;
@@ -74,7 +74,7 @@ extern "C" void QCALLTYPE LogThreadPoolWorkerThreadWait(__in_z uint activeWorker
END_QCALL;
}
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentSample(__in_z double throughput, __in_z short clrInstanceID)
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentSample(_In_z_ double throughput, _In_z_ short clrInstanceID)
{
QCALL_CONTRACT;
BEGIN_QCALL;
@@ -84,7 +84,7 @@ extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentSample(__in_z doubl
END_QCALL;
}
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentAdjustment(__in_z double averageThroughput, __in_z uint newWorkerThreadCount, __in_z uint reason, __in_z short clrInstanceID)
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentAdjustment(_In_z_ double averageThroughput, _In_z_ uint newWorkerThreadCount, _In_z_ uint reason, _In_z_ short clrInstanceID)
{
QCALL_CONTRACT;
BEGIN_QCALL;
@@ -94,7 +94,7 @@ extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentAdjustment(__in_z d
END_QCALL;
}
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentStats(__in_z double duration, __in_z double throughput, __in_z double threadWave, __in_z double throughputWave, __in_z double throughputErrorEstimate, __in_z double AverageThroughputErrorEstimate, __in_z double ThroughputRatio, __in_z double confidence, __in_z double newControlSetting, __in_z short newThreadWaveMagnitude, __in_z short ClrInstanceID)
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentStats(_In_z_ double duration, _In_z_ double throughput, _In_z_ double threadWave, _In_z_ double throughputWave, _In_z_ double throughputErrorEstimate, _In_z_ double AverageThroughputErrorEstimate, _In_z_ double ThroughputRatio, _In_z_ double confidence, _In_z_ double newControlSetting, _In_z_ short newThreadWaveMagnitude, _In_z_ short ClrInstanceID)
{
QCALL_CONTRACT;
BEGIN_QCALL;
@@ -104,7 +104,7 @@ extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentStats(__in_z double
END_QCALL;
}
-extern "C" void QCALLTYPE LogThreadPoolIOEnqueue(__in_z void* nativeOverlapped, __in_z void* overlapped, __in_z bool multiDequeues, __in_z short ClrInstanceID)
+extern "C" void QCALLTYPE LogThreadPoolIOEnqueue(_In_z_ void* nativeOverlapped, _In_z_ void* overlapped, _In_z_ bool multiDequeues, _In_z_ short ClrInstanceID)
{
QCALL_CONTRACT;
BEGIN_QCALL;
@@ -114,7 +114,7 @@ extern "C" void QCALLTYPE LogThreadPoolIOEnqueue(__in_z void* nativeOverlapped,
END_QCALL;
}
-extern "C" void QCALLTYPE LogThreadPoolIODequeue(__in_z void* nativeOverlapped, __in_z void* overlapped, __in_z short ClrInstanceID)
+extern "C" void QCALLTYPE LogThreadPoolIODequeue(_In_z_ void* nativeOverlapped, _In_z_ void* overlapped, _In_z_ short ClrInstanceID)
{
QCALL_CONTRACT;
BEGIN_QCALL;
@@ -124,7 +124,7 @@ extern "C" void QCALLTYPE LogThreadPoolIODequeue(__in_z void* nativeOverlapped,
END_QCALL;
}
-extern "C" void QCALLTYPE LogThreadPoolWorkingThreadCount(__in_z uint count, __in_z short ClrInstanceID)
+extern "C" void QCALLTYPE LogThreadPoolWorkingThreadCount(_In_z_ uint count, _In_z_ short ClrInstanceID)
{
QCALL_CONTRACT;
BEGIN_QCALL;
diff --git a/src/coreclr/vm/nativeeventsource.h b/src/coreclr/vm/nativeeventsource.h
index 34313b04bcc6e1..9dbb751261de68 100644
--- a/src/coreclr/vm/nativeeventsource.h
+++ b/src/coreclr/vm/nativeeventsource.h
@@ -15,17 +15,17 @@
#include "qcall.h"
#if defined(FEATURE_PERFTRACING)
-extern "C" void QCALLTYPE LogEventSource(__in_z int eventID, __in_z LPCWSTR eventName, __in_z LPCWSTR eventSourceName, __in_z LPCWSTR payload);
+extern "C" void QCALLTYPE LogEventSource(_In_z_ int eventID, _In_z_ LPCWSTR eventName, _In_z_ LPCWSTR eventSourceName, _In_z_ LPCWSTR payload);
extern "C" BOOL QCALLTYPE IsEventSourceLoggingEnabled();
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStart(__in_z uint activeWorkerThreadCount, __in_z uint retiredWorkerThreadCount, __in_z short clrInstanceID);
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStop(__in_z uint activeWorkerThreadCount, __in_z uint retiredWorkerThreadCount, __in_z short clrInstanceID);
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadWait(__in_z uint activeWorkerThreadCount, __in_z uint retiredWorkerThreadCount, __in_z short clrInstanceID);
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentSample(__in_z double throughput, __in_z short clrInstanceID);
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentAdjustment(__in_z double averageThroughput, __in_z uint newWorkerThreadCount, __in_z uint reason, __in_z short clrInstanceID);
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentStats(__in_z double duration, __in_z double throughput, __in_z double threadWave, __in_z double throughputWave, __in_z double throughputErrorEstimate, __in_z double AverageThroughputErrorEstimate, __in_z double ThroughputRatio, __in_z double confidence, __in_z double newControlSetting, __in_z short newThreadWaveMagnitude, __in_z short ClrInstanceID);
-extern "C" void QCALLTYPE LogThreadPoolIOEnqueue(__in_z void* nativeOverlapped, __in_z void* overlapped, __in_z bool multiDequeues, __in_z short ClrInstanceID);
-extern "C" void QCALLTYPE LogThreadPoolIODequeue(__in_z void* nativeOverlapped, __in_z void* overlapped, __in_z short ClrInstanceID);
-extern "C" void QCALLTYPE LogThreadPoolWorkingThreadCount(__in_z uint count, __in_z short ClrInstanceID);
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStart(_In_z_ uint activeWorkerThreadCount, _In_z_ uint retiredWorkerThreadCount, _In_z_ short clrInstanceID);
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStop(_In_z_ uint activeWorkerThreadCount, _In_z_ uint retiredWorkerThreadCount, _In_z_ short clrInstanceID);
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadWait(_In_z_ uint activeWorkerThreadCount, _In_z_ uint retiredWorkerThreadCount, _In_z_ short clrInstanceID);
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentSample(_In_z_ double throughput, _In_z_ short clrInstanceID);
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentAdjustment(_In_z_ double averageThroughput, _In_z_ uint newWorkerThreadCount, _In_z_ uint reason, _In_z_ short clrInstanceID);
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentStats(_In_z_ double duration, _In_z_ double throughput, _In_z_ double threadWave, _In_z_ double throughputWave, _In_z_ double throughputErrorEstimate, _In_z_ double AverageThroughputErrorEstimate, _In_z_ double ThroughputRatio, _In_z_ double confidence, _In_z_ double newControlSetting, _In_z_ short newThreadWaveMagnitude, _In_z_ short ClrInstanceID);
+extern "C" void QCALLTYPE LogThreadPoolIOEnqueue(_In_z_ void* nativeOverlapped, _In_z_ void* overlapped, _In_z_ bool multiDequeues, _In_z_ short ClrInstanceID);
+extern "C" void QCALLTYPE LogThreadPoolIODequeue(_In_z_ void* nativeOverlapped, _In_z_ void* overlapped, _In_z_ short ClrInstanceID);
+extern "C" void QCALLTYPE LogThreadPoolWorkingThreadCount(_In_z_ uint count, _In_z_ short ClrInstanceID);
#endif // defined(FEATURE_PERFTRACING)
#endif //_NATIVEEVENTSOURCE_H_
diff --git a/src/coreclr/vm/nativelibrary.cpp b/src/coreclr/vm/nativelibrary.cpp
index 9ec47c423311fd..d5a91b4863c2fc 100644
--- a/src/coreclr/vm/nativelibrary.cpp
+++ b/src/coreclr/vm/nativelibrary.cpp
@@ -526,7 +526,7 @@ namespace
SString::CIterator it = libName.Begin();
if (libName.Find(it, PLATFORM_SHARED_LIB_SUFFIX_W))
{
- it += COUNTOF(PLATFORM_SHARED_LIB_SUFFIX_W);
+ it += ARRAY_SIZE(PLATFORM_SHARED_LIB_SUFFIX_W);
containsSuffix = it == libName.End() || *it == (WCHAR)'.';
}
@@ -648,7 +648,7 @@ namespace
// (both of these are typically done to smooth over cross-platform differences).
// We try to dlopen with such variations on the original.
const WCHAR* prefixSuffixCombinations[MaxVariationCount] = {};
- int numberOfVariations = COUNTOF(prefixSuffixCombinations);
+ int numberOfVariations = ARRAY_SIZE(prefixSuffixCombinations);
DetermineLibNameVariations(prefixSuffixCombinations, &numberOfVariations, wszLibName, libNameIsRelativePath);
for (int i = 0; i < numberOfVariations; i++)
{
diff --git a/src/coreclr/vm/notifyexternals.cpp b/src/coreclr/vm/notifyexternals.cpp
deleted file mode 100644
index 49c2443da3bcb3..00000000000000
--- a/src/coreclr/vm/notifyexternals.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// ===========================================================================
-// File: notifyexternals.cpp
-//
-
-// ===========================================================================
-
-
-#include "common.h"
-
-#include "excep.h"
-#include "interoputil.h"
-#include "comcache.h"
-
-#include "notifyexternals.h"
-
-// On some platforms, we can detect whether the current thread holds the loader
-// lock. It is unsafe to execute managed code when this is the case
-BOOL ShouldCheckLoaderLock()
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- }
- CONTRACTL_END;
-
-#ifdef FEATURE_CORESYSTEM
- // CoreSystem does not support this.
- return FALSE;
-#else
- // Because of how C++ generates code, we must use default initialization to
- // 0 here. Any explicit initialization will result in thread-safety problems.
- static BOOL fInited;
- static BOOL fShouldCheck;
-
- if (VolatileLoad(&fInited) == FALSE)
- {
- fShouldCheck = AuxUlibInitialize(); // may fail
-
- VolatileStore(&fInited, TRUE);
- }
- return (fShouldCheck);
-#endif // FEATURE_CORESYSTEM
-}
diff --git a/src/coreclr/vm/notifyexternals.h b/src/coreclr/vm/notifyexternals.h
deleted file mode 100644
index 8d204d1a7881ef..00000000000000
--- a/src/coreclr/vm/notifyexternals.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-////////////////////////////////////////////////////////////////////////////////
-
-
-#ifndef _NOTIFY_EXTERNALS_H
-#define _NOTIFY_EXTERNALS_H
-
-#ifndef FEATURE_COMINTEROP
-#error FEATURE_COMINTEROP is required for this file
-#endif // FEATURE_COMINTEROP
-
-extern BOOL g_fComStarted;
-
-BOOL ShouldCheckLoaderLock(BOOL fForMDA = TRUE);
-
-#include "aux_ulib.h"
-
-#endif
diff --git a/src/coreclr/vm/object.cpp b/src/coreclr/vm/object.cpp
index 6b64f72e5e2805..4a0ac960e9ace9 100644
--- a/src/coreclr/vm/object.cpp
+++ b/src/coreclr/vm/object.cpp
@@ -852,7 +852,7 @@ STRINGREF* StringObject::InitEmptyStringRefPtr() {
// strAChars must be null-terminated, with an appropriate aLength
// strBChars must be null-terminated, with an appropriate bLength OR bLength == -1
// If bLength == -1, we stop on the first null character in strBChars
-BOOL StringObject::CaseInsensitiveCompHelper(__in_ecount(aLength) WCHAR *strAChars, __in_z INT8 *strBChars, INT32 aLength, INT32 bLength, INT32 *result) {
+BOOL StringObject::CaseInsensitiveCompHelper(_In_reads_(aLength) WCHAR *strAChars, _In_z_ INT8 *strBChars, INT32 aLength, INT32 bLength, INT32 *result) {
CONTRACTL {
NOTHROW;
GC_NOTRIGGER;
diff --git a/src/coreclr/vm/object.h b/src/coreclr/vm/object.h
index a47adb8c7985c8..0f4033f45b507b 100644
--- a/src/coreclr/vm/object.h
+++ b/src/coreclr/vm/object.h
@@ -444,7 +444,7 @@ class Object
// we must zero out the lowest 2 bits on 32-bit and 3 bits on 64-bit.
#ifdef TARGET_64BIT
return dac_cast((dac_cast(m_pMethTab)) & ~((UINT_PTR)7));
-#else
+#else
return dac_cast((dac_cast(m_pMethTab)) & ~((UINT_PTR)3));
#endif //TARGET_64BIT
}
@@ -935,7 +935,7 @@ class StringObject : public Object
BOOL HasTrailByte();
BOOL GetTrailByte(BYTE *bTrailByte);
BOOL SetTrailByte(BYTE bTrailByte);
- static BOOL CaseInsensitiveCompHelper(__in_ecount(aLength) WCHAR * strA, __in_z INT8 * strB, int aLength, int bLength, int *result);
+ static BOOL CaseInsensitiveCompHelper(_In_reads_(aLength) WCHAR * strA, _In_z_ INT8 * strB, int aLength, int bLength, int *result);
/*=================RefInterpretGetStringValuesDangerousForGC======================
**N.B.: This perfoms no range checking and relies on the caller to have done this.
@@ -948,7 +948,7 @@ class StringObject : public Object
// !!!! If you use this function, you have to be careful because chars is a pointer
// !!!! to the data buffer of ref. If GC happens after this call, you need to make
// !!!! sure that you have a pin handle on ref, or use GCPROTECT_BEGINPINNING on ref.
- void RefInterpretGetStringValuesDangerousForGC(__deref_out_ecount(*length + 1) WCHAR **chars, int *length) {
+ void RefInterpretGetStringValuesDangerousForGC(_Outptr_result_buffer_(*length + 1) WCHAR **chars, int *length) {
WRAPPER_NO_CONTRACT;
_ASSERTE(GetGCSafeMethodTable() == g_pStringClass);
diff --git a/src/coreclr/vm/peimage.cpp b/src/coreclr/vm/peimage.cpp
index 4c517a1bd3e5f4..1b72b89106df65 100644
--- a/src/coreclr/vm/peimage.cpp
+++ b/src/coreclr/vm/peimage.cpp
@@ -18,7 +18,6 @@
#ifndef DACCESS_COMPILE
-
CrstStatic PEImage::s_hashLock;
PtrHashMap *PEImage::s_Images = NULL;
CrstStatic PEImage::s_ijwHashLock;
@@ -95,7 +94,7 @@ PEImage::~PEImage()
if(m_hFile!=INVALID_HANDLE_VALUE)
CloseHandle(m_hFile);
- for (unsigned int i=0;iRelease();
@@ -754,7 +753,7 @@ PEImage::PEImage():
MODE_ANY;
}
CONTRACTL_END;
- for (DWORD i=0;iGetEntryPoint();
-#endif // TARGET_X86 && !FEATURE_STUBS_AS_IL
-
ThePreStubManager::Init();
}
@@ -2297,11 +2289,7 @@ PCODE TheUMThunkPreStub()
{
LIMITED_METHOD_CONTRACT;
-#if defined(TARGET_X86) && !defined(FEATURE_STUBS_AS_IL)
- return g_UMThunkPreStub;
-#else // TARGET_X86 && !FEATURE_STUBS_AS_IL
return GetEEFuncEntryPoint(TheUMEntryPrestub);
-#endif // TARGET_X86 && !FEATURE_STUBS_AS_IL
}
PCODE TheVarargNDirectStub(BOOL hasRetBuffArg)
diff --git a/src/coreclr/vm/proftoeeinterfaceimpl.cpp b/src/coreclr/vm/proftoeeinterfaceimpl.cpp
index 2f742d05638a55..749fa73126b084 100644
--- a/src/coreclr/vm/proftoeeinterfaceimpl.cpp
+++ b/src/coreclr/vm/proftoeeinterfaceimpl.cpp
@@ -2820,8 +2820,8 @@ HRESULT ProfToEEInterfaceImpl::GetArrayObjectInfo(ObjectID objectId,
HRESULT ProfToEEInterfaceImpl::GetArrayObjectInfoHelper(Object * pObj,
ULONG32 cDimensionSizes,
- __out_ecount(cDimensionSizes) ULONG32 pDimensionSizes[],
- __out_ecount(cDimensionSizes) int pDimensionLowerBounds[],
+ _Out_writes_(cDimensionSizes) ULONG32 pDimensionSizes[],
+ _Out_writes_(cDimensionSizes) int pDimensionLowerBounds[],
BYTE **ppData)
{
CONTRACTL
@@ -3907,7 +3907,7 @@ HRESULT ProfToEEInterfaceImpl::GetModuleInfo(ModuleID moduleId,
LPCBYTE * ppBaseLoadAddress,
ULONG cchName,
ULONG * pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR wszName[],
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR wszName[],
AssemblyID * pAssemblyId)
{
CONTRACTL
@@ -4027,7 +4027,7 @@ HRESULT ProfToEEInterfaceImpl::GetModuleInfo2(ModuleID moduleId,
LPCBYTE * ppBaseLoadAddress,
ULONG cchName,
ULONG * pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR wszName[],
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR wszName[],
AssemblyID * pAssemblyId,
DWORD * pdwModuleFlags)
{
@@ -5532,7 +5532,7 @@ HRESULT ProfToEEInterfaceImpl::GetFunctionFromTokenAndTypeArgs(ModuleID moduleID
HRESULT ProfToEEInterfaceImpl::GetAppDomainInfo(AppDomainID appDomainId,
ULONG cchName,
ULONG *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[],
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[],
ProcessID *pProcessId)
{
CONTRACTL
@@ -5640,7 +5640,7 @@ HRESULT ProfToEEInterfaceImpl::GetAppDomainInfo(AppDomainID appDomainId,
HRESULT ProfToEEInterfaceImpl::GetAssemblyInfo(AssemblyID assemblyId,
ULONG cchName,
ULONG *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[],
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[],
AppDomainID *pAppDomainId,
ModuleID *pModuleId)
{
@@ -6391,7 +6391,7 @@ HRESULT ProfToEEInterfaceImpl::GetDynamicFunctionInfo(FunctionID functionId,
ULONG* pbSig,
ULONG cchName,
ULONG *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR wszName[])
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR wszName[])
{
CONTRACTL
{
@@ -6992,7 +6992,7 @@ HRESULT ProfToEEInterfaceImpl::GetEnvironmentVariable(
const WCHAR *szName,
ULONG cchValue,
ULONG *pcchValue,
- __out_ecount_part_opt(cchValue, *pcchValue) WCHAR szValue[])
+ _Out_writes_to_opt_(cchValue, *pcchValue) WCHAR szValue[])
{
CONTRACTL
{
@@ -9408,7 +9408,7 @@ HRESULT ProfToEEInterfaceImpl::GetRuntimeInformation(USHORT * pClrInstanceId,
USHORT * pQFEVersion,
ULONG cchVersionString,
ULONG * pcchVersionString,
- __out_ecount_part_opt(cchVersionString, *pcchVersionString) WCHAR szVersionString[])
+ _Out_writes_to_opt_(cchVersionString, *pcchVersionString) WCHAR szVersionString[])
{
CONTRACTL
{
diff --git a/src/coreclr/vm/proftoeeinterfaceimpl.h b/src/coreclr/vm/proftoeeinterfaceimpl.h
index 5ece684c3b39ab..645b23da037672 100644
--- a/src/coreclr/vm/proftoeeinterfaceimpl.h
+++ b/src/coreclr/vm/proftoeeinterfaceimpl.h
@@ -213,7 +213,7 @@ class ProfToEEInterfaceImpl : public ICorProfilerInfo12
LPCBYTE * ppBaseLoadAddress,
ULONG cchName,
ULONG * pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[],
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[],
AssemblyID * pAssemblyId);
COM_METHOD GetModuleMetaData(
@@ -274,14 +274,14 @@ class ProfToEEInterfaceImpl : public ICorProfilerInfo12
AppDomainID appDomainId,
ULONG cchName,
ULONG * pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[],
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[],
ProcessID * pProcessId);
COM_METHOD GetAssemblyInfo(
AssemblyID assemblyId,
ULONG cchName,
ULONG * pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[],
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[],
AppDomainID * pAppDomainId,
ModuleID * pModuleId);
@@ -472,7 +472,7 @@ class ProfToEEInterfaceImpl : public ICorProfilerInfo12
USHORT * pQFEVersion, // out
ULONG cchVersionString, // in
ULONG * pcchVersionString, // out
- __out_ecount_part_opt(cchVersionString, *pcchVersionString) WCHAR szVersionString[]); // out
+ _Out_writes_to_opt_(cchVersionString, *pcchVersionString) WCHAR szVersionString[]); // out
COM_METHOD GetThreadStaticAddress2(ClassID classId, // in
mdFieldDef fieldToken, // in
@@ -490,7 +490,7 @@ class ProfToEEInterfaceImpl : public ICorProfilerInfo12
LPCBYTE * ppBaseLoadAddress,
ULONG cchName,
ULONG * pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[],
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[],
AssemblyID * pAssemblyId,
DWORD * pdwModuleFlags);
@@ -652,7 +652,7 @@ class ProfToEEInterfaceImpl : public ICorProfilerInfo12
const WCHAR *szName,
ULONG cchValue,
ULONG *pcchValue,
- __out_ecount_part_opt(cchValue, *pcchValue) WCHAR szValue[]);
+ _Out_writes_to_opt_(cchValue, *pcchValue) WCHAR szValue[]);
COM_METHOD SetEnvironmentVariable(
const WCHAR *szName,
@@ -736,8 +736,8 @@ class ProfToEEInterfaceImpl : public ICorProfilerInfo12
HRESULT GetArrayObjectInfoHelper(Object * pObj,
ULONG32 cDimensionSizes,
- __out_ecount(cDimensionSizes) ULONG32 pDimensionSizes[],
- __out_ecount(cDimensionSizes) int pDimensionLowerBounds[],
+ _Out_writes_(cDimensionSizes) ULONG32 pDimensionSizes[],
+ _Out_writes_(cDimensionSizes) int pDimensionLowerBounds[],
BYTE ** ppData);
DWORD GetModuleFlags(Module * pModule);
diff --git a/src/coreclr/vm/runtimecallablewrapper.cpp b/src/coreclr/vm/runtimecallablewrapper.cpp
index 10e859c0f04469..fca8708ec1edcf 100644
--- a/src/coreclr/vm/runtimecallablewrapper.cpp
+++ b/src/coreclr/vm/runtimecallablewrapper.cpp
@@ -31,7 +31,6 @@ class Object;
#include "eeconfig.h"
#include "comdelegate.h"
#include "comcache.h"
-#include "notifyexternals.h"
#include "../md/compiler/custattr.h"
#include "olevariant.h"
#include "interopconverter.h"
@@ -585,7 +584,7 @@ OBJECTREF ComClassFactory::CreateInstance(MethodTable* pMTClass, BOOL ForManaged
//--------------------------------------------------------------
// Init the ComClassFactory.
-void ComClassFactory::Init(__in_opt PCWSTR wszServer, MethodTable* pClassMT)
+void ComClassFactory::Init(_In_opt_ PCWSTR wszServer, MethodTable* pClassMT)
{
LIMITED_METHOD_CONTRACT;
diff --git a/src/coreclr/vm/runtimecallablewrapper.h b/src/coreclr/vm/runtimecallablewrapper.h
index bebcde6e6c262d..57dc8530524acb 100644
--- a/src/coreclr/vm/runtimecallablewrapper.h
+++ b/src/coreclr/vm/runtimecallablewrapper.h
@@ -727,7 +727,7 @@ class ComClassFactory : public ClassFactoryBase
//--------------------------------------------------------------
// Init the ComClassFactory
- void Init(__in_opt PCWSTR wszServer, MethodTable* pClassMT);
+ void Init(_In_opt_ PCWSTR wszServer, MethodTable* pClassMT);
//-------------------------------------------------------------
// create instance, calls IClassFactory::CreateInstance
diff --git a/src/coreclr/vm/sigformat.cpp b/src/coreclr/vm/sigformat.cpp
index f506eedf2032b9..2225be54cd7bd5 100644
--- a/src/coreclr/vm/sigformat.cpp
+++ b/src/coreclr/vm/sigformat.cpp
@@ -235,7 +235,7 @@ void SigFormat::AddTypeString(Module* pModule, SigPointer sig, const SigTypeCont
else
{
char smallbuf[20];
- sprintf_s(smallbuf, COUNTOF(smallbuf), "!!%d", ix);
+ sprintf_s(smallbuf, ARRAY_SIZE(smallbuf), "!!%d", ix);
AddString(smallbuf);
}
}
@@ -253,7 +253,7 @@ void SigFormat::AddTypeString(Module* pModule, SigPointer sig, const SigTypeCont
else
{
char smallbuf[20];
- sprintf_s(smallbuf, COUNTOF(smallbuf), "!%d", ix);
+ sprintf_s(smallbuf, ARRAY_SIZE(smallbuf), "!%d", ix);
AddString(smallbuf);
}
}
diff --git a/src/coreclr/vm/siginfo.cpp b/src/coreclr/vm/siginfo.cpp
index f10acff25522e3..a197fbc87cabd9 100644
--- a/src/coreclr/vm/siginfo.cpp
+++ b/src/coreclr/vm/siginfo.cpp
@@ -2553,7 +2553,7 @@ UINT MetaSig::GetElemSize(CorElementType etype, TypeHandle thValueType)
}
CONTRACTL_END
- if ((UINT)etype >= COUNTOF(gElementTypeInfo))
+ if ((UINT)etype >= ARRAY_SIZE(gElementTypeInfo))
ThrowHR(COR_E_BADIMAGEFORMAT, BFA_BAD_COMPLUS_SIG);
int cbsize = gElementTypeInfo[(UINT)etype].m_cbSize;
diff --git a/src/coreclr/vm/sourceline.cpp b/src/coreclr/vm/sourceline.cpp
index d9adddf230c200..305358484aee0e 100644
--- a/src/coreclr/vm/sourceline.cpp
+++ b/src/coreclr/vm/sourceline.cpp
@@ -127,7 +127,7 @@ class CCallback : public IDiaLoadCallback
//////////////////////////////////////////////////////////////////
-bool SourceLine::LoadDataFromPdb( __in_z LPWSTR wszFilename )
+bool SourceLine::LoadDataFromPdb( _In_z_ LPWSTR wszFilename )
{
CONTRACTL {
THROWS;
@@ -172,7 +172,7 @@ bool SourceLine::LoadDataFromPdb( __in_z LPWSTR wszFilename )
//////////////////////////////////////////////////////////////////
-SourceLine::SourceLine( __in_z LPWSTR pszFileName )
+SourceLine::SourceLine( _In_z_ LPWSTR pszFileName )
{
WRAPPER_NO_CONTRACT;
if (LoadDataFromPdb(pszFileName)) {
@@ -185,7 +185,7 @@ SourceLine::SourceLine( __in_z LPWSTR pszFileName )
//////////////////////////////////////////////////////////////////
-HRESULT SourceLine::GetSourceLine( DWORD dwFunctionToken, DWORD dwOffset, __out_ecount(dwFileNameMaxLen) __out_z LPWSTR pszFileName, DWORD dwFileNameMaxLen, PDWORD pdwLineNumber )
+HRESULT SourceLine::GetSourceLine( DWORD dwFunctionToken, DWORD dwOffset, _Out_writes_z_(dwFileNameMaxLen) LPWSTR pszFileName, DWORD dwFileNameMaxLen, PDWORD pdwLineNumber )
{
CONTRACTL {
THROWS;
@@ -242,7 +242,7 @@ HRESULT SourceLine::GetSourceLine( DWORD dwFunctionToken, DWORD dwOffset, __out_
//////////////////////////////////////////////////////////////////
-HRESULT SourceLine::GetLocalName( DWORD dwFunctionToken, DWORD dwSlot, __out_ecount(dwNameMaxLen) __out_z LPWSTR pszName, DWORD dwNameMaxLen )
+HRESULT SourceLine::GetLocalName( DWORD dwFunctionToken, DWORD dwSlot, _Out_writes_z_(dwNameMaxLen) LPWSTR pszName, DWORD dwNameMaxLen )
{
CONTRACTL {
THROWS;
@@ -307,19 +307,19 @@ HRESULT SourceLine::GetLocalName( DWORD dwFunctionToken, DWORD dwSlot, __out_eco
}
#else // !ENABLE_DIAGNOSTIC_SYMBOL_READING
-SourceLine::SourceLine( __in_z LPWSTR pszFileName )
+SourceLine::SourceLine( _In_z_ LPWSTR pszFileName )
{
LIMITED_METHOD_CONTRACT;
initialized_ = false;
}
-HRESULT SourceLine::GetSourceLine( DWORD dwFunctionToken, DWORD dwOffset, __out_ecount(dwFileNameMaxLen) __out_z LPWSTR pszFileName, DWORD dwFileNameMaxLen, PDWORD pdwLineNumber )
+HRESULT SourceLine::GetSourceLine( DWORD dwFunctionToken, DWORD dwOffset, _Out_writes_z_(dwFileNameMaxLen) LPWSTR pszFileName, DWORD dwFileNameMaxLen, PDWORD pdwLineNumber )
{
LIMITED_METHOD_CONTRACT;
return E_NOTIMPL;
}
-HRESULT SourceLine::GetLocalName( DWORD dwFunctionToken, DWORD dwSlot, __out_ecount(dwNameMaxLen) __out_z LPWSTR pszName, DWORD dwNameMaxLen )
+HRESULT SourceLine::GetLocalName( DWORD dwFunctionToken, DWORD dwSlot, _Out_writes_z_(dwNameMaxLen) LPWSTR pszName, DWORD dwNameMaxLen )
{
LIMITED_METHOD_CONTRACT;
return E_NOTIMPL;
diff --git a/src/coreclr/vm/sourceline.h b/src/coreclr/vm/sourceline.h
index 2ab99344b9f31e..3c241d4328a00b 100644
--- a/src/coreclr/vm/sourceline.h
+++ b/src/coreclr/vm/sourceline.h
@@ -21,23 +21,23 @@ class SourceLine
CComPtr(IDiaSymbol) pGlobal_;
CComPtr(IDiaSession) pSession_;
- bool LoadDataFromPdb( __in_z LPWSTR wszFilename );
+ bool LoadDataFromPdb( _In_z_ LPWSTR wszFilename );
#endif // ENABLE_DIAGNOSTIC_SYMBOL_READING
public:
- SourceLine( __in_z LPWSTR pszFileName );
+ SourceLine( _In_z_ LPWSTR pszFileName );
bool IsInitialized() { return initialized_; }
//
// Given function token (methoddef) and offset, return filename and line number
//
- HRESULT GetSourceLine( DWORD dwFunctionToken, DWORD dwOffset, __out_ecount(dwFileNameMaxLen) __out_z LPWSTR wszFileName, DWORD dwFileNameMaxLen, PDWORD pdwLineNumber );
+ HRESULT GetSourceLine( DWORD dwFunctionToken, DWORD dwOffset, _Out_writes_z_(dwFileNameMaxLen) LPWSTR wszFileName, DWORD dwFileNameMaxLen, PDWORD pdwLineNumber );
//
// Given function token (methoddef) and slot, return name of the local variable
//
- HRESULT GetLocalName( DWORD dwFunctionToken, DWORD dwSlot, __out_ecount(dwNameMaxLen) __out_z LPWSTR wszName, DWORD dwNameMaxLen );
+ HRESULT GetLocalName( DWORD dwFunctionToken, DWORD dwSlot, _Out_writes_z_(dwNameMaxLen) LPWSTR wszName, DWORD dwNameMaxLen );
};
#endif // __SOURCELINE_H__
diff --git a/src/coreclr/vm/stackwalk.cpp b/src/coreclr/vm/stackwalk.cpp
index 45bdf3088db074..18345aec77ac24 100644
--- a/src/coreclr/vm/stackwalk.cpp
+++ b/src/coreclr/vm/stackwalk.cpp
@@ -755,7 +755,7 @@ UINT_PTR Thread::VirtualUnwindToFirstManagedCallFrame(T_CONTEXT* pContext)
#endif // FEATURE_EH_FUNCLETS
#ifdef _DEBUG
-void Thread::DebugLogStackWalkInfo(CrawlFrame* pCF, __in_z LPCSTR pszTag, UINT32 uFramesProcessed)
+void Thread::DebugLogStackWalkInfo(CrawlFrame* pCF, _In_z_ LPCSTR pszTag, UINT32 uFramesProcessed)
{
LIMITED_METHOD_CONTRACT;
SUPPORTS_DAC;
diff --git a/src/coreclr/vm/stdinterfaces.cpp b/src/coreclr/vm/stdinterfaces.cpp
index 094b5ab407b187..4ccee10d1a634e 100644
--- a/src/coreclr/vm/stdinterfaces.cpp
+++ b/src/coreclr/vm/stdinterfaces.cpp
@@ -1152,7 +1152,7 @@ Dispatch_GetTypeInfo(IDispatch* pDisp, unsigned int itinfo, LCID lcid, ITypeInfo
}
HRESULT __stdcall
-Dispatch_GetIDsOfNames(IDispatch* pDisp, REFIID riid, __in_ecount(cNames) OLECHAR **rgszNames, unsigned int cNames, LCID lcid, DISPID *rgdispid)
+Dispatch_GetIDsOfNames(IDispatch* pDisp, REFIID riid, _In_reads_(cNames) OLECHAR **rgszNames, unsigned int cNames, LCID lcid, DISPID *rgdispid)
{
CONTRACTL
{
@@ -1231,7 +1231,7 @@ OleAutDispatchImpl_GetIDsOfNames
(
IDispatch* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid
@@ -1334,7 +1334,7 @@ HRESULT __stdcall
InternalDispatchImpl_GetIDsOfNames (
IDispatch* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid)
@@ -1560,7 +1560,7 @@ HRESULT __stdcall DispatchEx_GetTypeInfo (
HRESULT __stdcall DispatchEx_GetIDsOfNames (
IDispatchEx* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid
diff --git a/src/coreclr/vm/stdinterfaces.h b/src/coreclr/vm/stdinterfaces.h
index db04fd93b08afd..fb3871f4434f76 100644
--- a/src/coreclr/vm/stdinterfaces.h
+++ b/src/coreclr/vm/stdinterfaces.h
@@ -168,7 +168,7 @@ HRESULT __stdcall Dispatch_GetTypeInfo_Wrapper (
HRESULT __stdcall Dispatch_GetIDsOfNames_Wrapper (
IDispatch* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid);
@@ -190,7 +190,7 @@ HRESULT __stdcall Dispatch_Invoke_Wrapper (
HRESULT __stdcall InternalDispatchImpl_GetIDsOfNames_Wrapper (
IDispatch* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid);
@@ -229,7 +229,7 @@ HRESULT __stdcall DispatchEx_GetTypeInfo_Wrapper (
HRESULT __stdcall DispatchEx_GetIDsOfNames_Wrapper (
IDispatchEx* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid);
@@ -384,7 +384,7 @@ HRESULT __stdcall
InternalDispatchImpl_GetIDsOfNames (
IDispatch* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid);
diff --git a/src/coreclr/vm/stdinterfaces_internal.h b/src/coreclr/vm/stdinterfaces_internal.h
index acabf15be1d842..bd1b7b336a2a0b 100644
--- a/src/coreclr/vm/stdinterfaces_internal.h
+++ b/src/coreclr/vm/stdinterfaces_internal.h
@@ -76,7 +76,7 @@ HRESULT __stdcall Dispatch_GetTypeInfo (
HRESULT __stdcall Dispatch_GetIDsOfNames (
IDispatch* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid);
@@ -102,7 +102,7 @@ HRESULT __stdcall Dispatch_Invoke (
HRESULT __stdcall OleAutDispatchImpl_GetIDsOfNames (
IDispatch* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid);
@@ -129,7 +129,7 @@ HRESULT __stdcall OleAutDispatchImpl_Invoke (
HRESULT __stdcall InternalDispatchImpl_GetIDsOfNames (
IDispatch* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid);
@@ -168,7 +168,7 @@ HRESULT __stdcall DispatchEx_GetTypeInfo (
HRESULT __stdcall DispatchEx_GetIDsOfNames (
IDispatchEx* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid);
diff --git a/src/coreclr/vm/stdinterfaces_wrapper.cpp b/src/coreclr/vm/stdinterfaces_wrapper.cpp
index 91fc46651952b9..400d90405e7e52 100644
--- a/src/coreclr/vm/stdinterfaces_wrapper.cpp
+++ b/src/coreclr/vm/stdinterfaces_wrapper.cpp
@@ -1016,7 +1016,7 @@ VOID __stdcall Dispatch_GetIDsOfNames_CallBack(LPVOID ptr)
}
}
-HRESULT __stdcall Dispatch_GetIDsOfNames_Wrapper(IDispatch* pDisp, REFIID riid, __in_ecount(cNames) OLECHAR **rgszNames,
+HRESULT __stdcall Dispatch_GetIDsOfNames_Wrapper(IDispatch* pDisp, REFIID riid, _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames, LCID lcid, DISPID *rgdispid)
{
SetupForComCallHR();
@@ -1062,7 +1062,7 @@ VOID __stdcall InternalDispatchImpl_GetIDsOfNames_CallBack(LPVOID ptr)
}
}
-HRESULT __stdcall InternalDispatchImpl_GetIDsOfNames_Wrapper(IDispatch* pDisp, REFIID riid, __in_ecount(cNames) OLECHAR **rgszNames,
+HRESULT __stdcall InternalDispatchImpl_GetIDsOfNames_Wrapper(IDispatch* pDisp, REFIID riid, _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames, LCID lcid, DISPID *rgdispid)
{
SetupForComCallHR();
@@ -1341,7 +1341,7 @@ VOID __stdcall DispatchEx_GetIDsOfNames_CallBack(LPVOID ptr)
}
}
-HRESULT __stdcall DispatchEx_GetIDsOfNames_Wrapper(IDispatchEx* pDisp, REFIID riid, __in_ecount(cNames) OLECHAR **rgszNames,
+HRESULT __stdcall DispatchEx_GetIDsOfNames_Wrapper(IDispatchEx* pDisp, REFIID riid, _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames, LCID lcid, DISPID *rgdispid)
{
SetupForComCallHR();
diff --git a/src/coreclr/vm/stringliteralmap.cpp b/src/coreclr/vm/stringliteralmap.cpp
index ca1d80f6867924..17e0d5fa3e031a 100644
--- a/src/coreclr/vm/stringliteralmap.cpp
+++ b/src/coreclr/vm/stringliteralmap.cpp
@@ -428,7 +428,7 @@ StringLiteralEntry *GlobalStringLiteralMap::GetInternedString(STRINGREF *pString
}
#ifdef LOGGING
-static void LogStringLiteral(__in_z const char* action, EEStringData *pStringData)
+static void LogStringLiteral(_In_z_ const char* action, EEStringData *pStringData)
{
STATIC_CONTRACT_NOTHROW;
STATIC_CONTRACT_GC_NOTRIGGER;
diff --git a/src/coreclr/vm/syncblk.cpp b/src/coreclr/vm/syncblk.cpp
index 96aa9c701b916f..9dfdfafc050f5d 100644
--- a/src/coreclr/vm/syncblk.cpp
+++ b/src/coreclr/vm/syncblk.cpp
@@ -1491,7 +1491,7 @@ void DumpSyncBlockCache()
param.descrip = descrip;
param.oref = oref;
param.buffer2 = buffer2;
- param.cch2 = COUNTOF(buffer2);
+ param.cch2 = ARRAY_SIZE(buffer2);
param.isString = isString;
PAL_TRY(Param *, pParam, ¶m)
@@ -1514,7 +1514,7 @@ void DumpSyncBlockCache()
descrip = param.descrip;
isString = param.isString;
}
- sprintf_s(buffer, COUNTOF(buffer), "%s", descrip);
+ sprintf_s(buffer, ARRAY_SIZE(buffer), "%s", descrip);
descrip = buffer;
}
if (dumpSBStyle < 2)
diff --git a/src/coreclr/vm/threads.h b/src/coreclr/vm/threads.h
index f7b7479f586d73..1bfccb85e10d6f 100644
--- a/src/coreclr/vm/threads.h
+++ b/src/coreclr/vm/threads.h
@@ -2819,7 +2819,7 @@ class Thread
StackWalkAction MakeStackwalkerCallback(CrawlFrame* pCF, PSTACKWALKFRAMESCALLBACK pCallback, VOID* pData DEBUG_ARG(UINT32 uLoopIteration));
#ifdef _DEBUG
- void DebugLogStackWalkInfo(CrawlFrame* pCF, __in_z LPCSTR pszTag, UINT32 uLoopIteration);
+ void DebugLogStackWalkInfo(CrawlFrame* pCF, _In_z_ LPCSTR pszTag, UINT32 uLoopIteration);
#endif // _DEBUG
public:
diff --git a/src/coreclr/vm/threadsuspend.cpp b/src/coreclr/vm/threadsuspend.cpp
index c4fc869e893ec8..b65cd74270b23e 100644
--- a/src/coreclr/vm/threadsuspend.cpp
+++ b/src/coreclr/vm/threadsuspend.cpp
@@ -3591,12 +3591,12 @@ void ThreadSuspend::SuspendRuntime(ThreadSuspend::SUSPEND_REASON reason)
DWORD id = (DWORD) thread->m_OSThreadId;
if (id == 0xbaadf00d)
{
- sprintf_s (message, COUNTOF(message), "Thread CLR ID=%x cannot be suspended",
+ sprintf_s (message, ARRAY_SIZE(message), "Thread CLR ID=%x cannot be suspended",
thread->GetThreadId());
}
else
{
- sprintf_s (message, COUNTOF(message), "Thread OS ID=%x cannot be suspended",
+ sprintf_s (message, ARRAY_SIZE(message), "Thread OS ID=%x cannot be suspended",
id);
}
DbgAssertDialog(__FILE__, __LINE__, message);
@@ -6255,7 +6255,7 @@ void SuspendStatistics::DisplayAndUpdate()
const char* const str_timeUnit[] = { "usec", "msec", "sec" };
const int timeUnitFactor[] = { 1, 1000, 1000000 };
-void MinMaxTot::DisplayAndUpdate(FILE* logFile, __in_z const char *pName, MinMaxTot *pLastOne, int fullCount, int priorCount, timeUnit unit /* = usec */)
+void MinMaxTot::DisplayAndUpdate(FILE* logFile, _In_z_ const char *pName, MinMaxTot *pLastOne, int fullCount, int priorCount, timeUnit unit /* = usec */)
{
LIMITED_METHOD_CONTRACT;
diff --git a/src/coreclr/vm/threadsuspend.h b/src/coreclr/vm/threadsuspend.h
index 9274327682a6b9..a600d090eef82b 100644
--- a/src/coreclr/vm/threadsuspend.h
+++ b/src/coreclr/vm/threadsuspend.h
@@ -36,7 +36,7 @@ struct MinMaxTot
minVal = maxVal = 0;
}
- void DisplayAndUpdate(FILE* logFile, __in_z const char *pName, MinMaxTot *pLastOne, int fullCount, int priorCount, timeUnit=usec);
+ void DisplayAndUpdate(FILE* logFile, _In_z_ const char *pName, MinMaxTot *pLastOne, int fullCount, int priorCount, timeUnit=usec);
};
// A note about timings. We use QueryPerformanceCounter to measure all timings in units. During
diff --git a/src/coreclr/vm/typeparse.cpp b/src/coreclr/vm/typeparse.cpp
index 6abed5799f3009..524a9e595bc245 100644
--- a/src/coreclr/vm/typeparse.cpp
+++ b/src/coreclr/vm/typeparse.cpp
@@ -981,58 +981,6 @@ TypeHandle TypeName::GetTypeUsingCASearchRules(LPCWSTR szTypeName, Assembly *pRe
-//-------------------------------------------------------------------------------------------
-// Retrieves a type from an assembly. It requires the caller to know which assembly
-// the type is in.
-//-------------------------------------------------------------------------------------------
-/* public static */ TypeHandle TypeName::GetTypeFromAssembly(LPCWSTR szTypeName, Assembly *pAssembly, BOOL bThrowIfNotFound /*= TRUE*/)
-{
- STATIC_CONTRACT_THROWS;
- STATIC_CONTRACT_GC_TRIGGERS;
- STATIC_CONTRACT_FAULT;
-
- _ASSERTE(szTypeName != NULL);
- _ASSERTE(pAssembly != NULL);
-
- if (!*szTypeName)
- COMPlusThrow(kArgumentException, W("Format_StringZeroLength"));
-
- DWORD error = (DWORD)-1;
-
-#ifdef __GNUC__
- // When compiling under GCC we have to use the -fstack-check option to ensure we always spot stack
- // overflow. But this option is intolerant of locals growing too large, so we have to cut back a bit
- // on what we can allocate inline here. Leave the Windows versions alone to retain the perf benefits
- // since we don't have the same constraints.
- NewHolder pTypeName = new TypeName(szTypeName, &error);
-#else // __GNUC__
- TypeName typeName(szTypeName, &error);
- TypeName *pTypeName = &typeName;
-#endif // __GNUC__
-
- if (error != (DWORD)-1)
- {
- StackSString buf;
- StackSString msg(W("typeName@"));
- COUNT_T size = buf.GetUnicodeAllocation();
- _itow_s(error,buf.OpenUnicodeBuffer(size),size,10);
- buf.CloseBuffer();
- msg.Append(buf);
- COMPlusThrowArgumentException(msg.GetUnicode(), NULL);
- }
-
- // Because the typename can come from untrusted input, we will throw an exception rather than assert.
- // (This also assures that the shipping build does the right thing.)
- if (!(pTypeName->GetAssembly()->IsEmpty()))
- {
- COMPlusThrow(kArgumentException, IDS_EE_CANNOT_HAVE_ASSEMBLY_SPEC);
- }
-
- return pTypeName->GetTypeWorker(bThrowIfNotFound, /*bIgnoreCase = */FALSE, pAssembly, /*fEnableCASearchRules = */FALSE, FALSE, NULL,
- nullptr, // pPrivHostBinder
- NULL /* cannot find a collectible type unless it is in assembly */);
-}
-
//-------------------------------------------------------------------------------------------
// Retrieves a type. Will assert if the name is not fully qualified.
//-------------------------------------------------------------------------------------------
diff --git a/src/coreclr/vm/typeparse.h b/src/coreclr/vm/typeparse.h
index 5a19c980ad5e1b..2f1854da236dcf 100644
--- a/src/coreclr/vm/typeparse.h
+++ b/src/coreclr/vm/typeparse.h
@@ -269,12 +269,6 @@ class TypeName
virtual ~TypeName();
public:
- //-------------------------------------------------------------------------------------------
- // Retrieves a type from an assembly. It requires the caller to know which assembly
- // the type is in.
- //-------------------------------------------------------------------------------------------
- static TypeHandle GetTypeFromAssembly(LPCWSTR szTypeName, Assembly *pAssembly, BOOL bThrowIfNotFound = TRUE);
-
TypeHandle GetTypeFromAsm();
//-------------------------------------------------------------------------------------------
diff --git a/src/coreclr/vm/virtualcallstub.cpp b/src/coreclr/vm/virtualcallstub.cpp
index 05df034829ba9a..fd85071676e94c 100644
--- a/src/coreclr/vm/virtualcallstub.cpp
+++ b/src/coreclr/vm/virtualcallstub.cpp
@@ -187,142 +187,142 @@ void VirtualCallStubManager::LoggingDump()
if(g_hStubLogFile)
{
#ifdef STUB_LOGGING
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\nstub tuning parameters\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\nstub tuning parameters\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\t%-30s %3d (0x%02x)\r\n", "STUB_MISS_COUNT_VALUE",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\t%-30s %3d (0x%02x)\r\n", "STUB_MISS_COUNT_VALUE",
STUB_MISS_COUNT_VALUE, STUB_MISS_COUNT_VALUE);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "STUB_COLLIDE_WRITE_PCT",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "STUB_COLLIDE_WRITE_PCT",
STUB_COLLIDE_WRITE_PCT, STUB_COLLIDE_WRITE_PCT);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "STUB_COLLIDE_MONO_PCT",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "STUB_COLLIDE_MONO_PCT",
STUB_COLLIDE_MONO_PCT, STUB_COLLIDE_MONO_PCT);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "DumpLogCounter",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "DumpLogCounter",
g_dumpLogCounter, g_dumpLogCounter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "DumpLogIncr",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "DumpLogIncr",
g_dumpLogCounter, g_dumpLogIncr);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "ResetCacheCounter",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "ResetCacheCounter",
g_resetCacheCounter, g_resetCacheCounter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "ResetCacheIncr",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "ResetCacheIncr",
g_resetCacheCounter, g_resetCacheIncr);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
#endif // STUB_LOGGING
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\nsite data\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\nsite data\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
//output counters
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "site_counter", g_site_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "site_counter", g_site_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "site_write", g_site_write);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "site_write", g_site_write);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "site_write_mono", g_site_write_mono);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "site_write_mono", g_site_write_mono);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "site_write_poly", g_site_write_poly);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "site_write_poly", g_site_write_poly);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\n%-30s %d\r\n", "reclaim_counter", g_reclaim_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\n%-30s %d\r\n", "reclaim_counter", g_reclaim_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\nstub data\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\nstub data\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "stub_lookup_counter", g_stub_lookup_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "stub_lookup_counter", g_stub_lookup_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "stub_mono_counter", g_stub_mono_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "stub_mono_counter", g_stub_mono_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "stub_poly_counter", g_stub_poly_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "stub_poly_counter", g_stub_poly_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "stub_vtable_counter", g_stub_vtable_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "stub_vtable_counter", g_stub_vtable_counter);
WriteFile(g_hStubLogFile, szPrintStr, (DWORD)strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "stub_space", g_stub_space);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "stub_space", g_stub_space);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
#ifdef STUB_LOGGING
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\nlookup stub data\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\nlookup stub data\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
UINT32 total_calls = g_mono_call_counter + g_poly_call_counter;
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "lookup_call_counter", g_call_lookup_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "lookup_call_counter", g_call_lookup_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\n%-30s %d\r\n", "total stub dispatch calls", total_calls);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\n%-30s %d\r\n", "total stub dispatch calls", total_calls);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\n%-30s %#5.2f%%\r\n", "mono stub data",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\n%-30s %#5.2f%%\r\n", "mono stub data",
100.0 * double(g_mono_call_counter)/double(total_calls));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "mono_call_counter", g_mono_call_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "mono_call_counter", g_mono_call_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "mono_miss_counter", g_mono_miss_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "mono_miss_counter", g_mono_miss_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_PCT, "miss percent",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_PCT, "miss percent",
100.0 * double(g_mono_miss_counter)/double(g_mono_call_counter));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\n%-30s %#5.2f%%\r\n", "poly stub data",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\n%-30s %#5.2f%%\r\n", "poly stub data",
100.0 * double(g_poly_call_counter)/double(total_calls));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "poly_call_counter", g_poly_call_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "poly_call_counter", g_poly_call_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "poly_miss_counter", g_poly_miss_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "poly_miss_counter", g_poly_miss_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_PCT, "miss percent",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_PCT, "miss percent",
100.0 * double(g_poly_miss_counter)/double(g_poly_call_counter));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
#endif // STUB_LOGGING
#ifdef CHAIN_LOOKUP
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\nchain lookup data\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\nchain lookup data\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
#ifdef STUB_LOGGING
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "chained_lookup_call_counter", g_chained_lookup_call_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "chained_lookup_call_counter", g_chained_lookup_call_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "chained_lookup_miss_counter", g_chained_lookup_miss_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "chained_lookup_miss_counter", g_chained_lookup_miss_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_PCT, "miss percent",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_PCT, "miss percent",
100.0 * double(g_chained_lookup_miss_counter)/double(g_chained_lookup_call_counter));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "chained_lookup_external_call_counter", g_chained_lookup_external_call_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "chained_lookup_external_call_counter", g_chained_lookup_external_call_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "chained_lookup_external_miss_counter", g_chained_lookup_external_miss_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "chained_lookup_external_miss_counter", g_chained_lookup_external_miss_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_PCT, "miss percent",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_PCT, "miss percent",
100.0 * double(g_chained_lookup_external_miss_counter)/double(g_chained_lookup_external_call_counter));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
#endif // STUB_LOGGING
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "chained_entry_promoted", g_chained_entry_promoted);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "chained_entry_promoted", g_chained_entry_promoted);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
#endif // CHAIN_LOOKUP
#ifdef STUB_LOGGING
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\n%-30s %#5.2f%%\r\n", "worker (slow resolver) data",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\n%-30s %#5.2f%%\r\n", "worker (slow resolver) data",
100.0 * double(g_worker_call)/double(total_calls));
#else // !STUB_LOGGING
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\nworker (slow resolver) data\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\nworker (slow resolver) data\r\n");
#endif // !STUB_LOGGING
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "worker_call", g_worker_call);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "worker_call", g_worker_call);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "worker_call_no_patch", g_worker_call_no_patch);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "worker_call_no_patch", g_worker_call_no_patch);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "external_call", g_external_call);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "external_call", g_external_call);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "external_call_no_patch", g_external_call_no_patch);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "external_call_no_patch", g_external_call_no_patch);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "worker_collide_to_mono", g_worker_collide_to_mono);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "worker_collide_to_mono", g_worker_collide_to_mono);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
UINT32 total_inserts = g_insert_cache_external
@@ -330,74 +330,74 @@ void VirtualCallStubManager::LoggingDump()
+ g_insert_cache_dispatch
+ g_insert_cache_resolve;
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\n%-30s %d\r\n", "insert cache data", total_inserts);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\n%-30s %d\r\n", "insert cache data", total_inserts);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_external", g_insert_cache_external,
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_external", g_insert_cache_external,
100.0 * double(g_insert_cache_external)/double(total_inserts));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_shared", g_insert_cache_shared,
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_shared", g_insert_cache_shared,
100.0 * double(g_insert_cache_shared)/double(total_inserts));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_dispatch", g_insert_cache_dispatch,
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_dispatch", g_insert_cache_dispatch,
100.0 * double(g_insert_cache_dispatch)/double(total_inserts));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_resolve", g_insert_cache_resolve,
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_resolve", g_insert_cache_resolve,
100.0 * double(g_insert_cache_resolve)/double(total_inserts));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_hit", g_insert_cache_hit,
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_hit", g_insert_cache_hit,
100.0 * double(g_insert_cache_hit)/double(total_inserts));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_miss", g_insert_cache_miss,
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_miss", g_insert_cache_miss,
100.0 * double(g_insert_cache_miss)/double(total_inserts));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_collide", g_insert_cache_collide,
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_collide", g_insert_cache_collide,
100.0 * double(g_insert_cache_collide)/double(total_inserts));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_write", g_insert_cache_write,
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_write", g_insert_cache_write,
100.0 * double(g_insert_cache_write)/double(total_inserts));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\ncache data\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\ncache data\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
size_t total, used;
g_resolveCache->GetLoadFactor(&total, &used);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_SIZE, "cache_entry_used", used);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_SIZE, "cache_entry_used", used);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "cache_entry_counter", g_cache_entry_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "cache_entry_counter", g_cache_entry_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "cache_entry_space", g_cache_entry_space);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "cache_entry_space", g_cache_entry_space);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\nstub hash table data\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\nstub hash table data\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "bucket_space", g_bucket_space);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "bucket_space", g_bucket_space);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "bucket_space_dead", g_bucket_space_dead);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "bucket_space_dead", g_bucket_space_dead);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\ncache_load:\t%zu used, %zu total, utilization %#5.2f%%\r\n",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\ncache_load:\t%zu used, %zu total, utilization %#5.2f%%\r\n",
used, total, 100.0 * double(used) / double(total));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
#ifdef STUB_LOGGING
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\ncache entry write counts\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\ncache entry write counts\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
DispatchCache::CacheEntryData *rgCacheData = g_resolveCache->cacheData;
for (UINT16 i = 0; i < CALL_STUB_CACHE_SIZE; i++)
{
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), " %4d", rgCacheData[i]);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), " %4d", rgCacheData[i]);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
if (i % 16 == 15)
{
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
}
}
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
#endif // STUB_LOGGING
@@ -406,7 +406,7 @@ void VirtualCallStubManager::LoggingDump()
{
if (ContractImplMap::deltasDescs[i] != 0)
{
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "deltasDescs[%d]\t%d\r\n", i, ContractImplMap::deltasDescs[i]);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "deltasDescs[%d]\t%d\r\n", i, ContractImplMap::deltasDescs[i]);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
}
}
@@ -414,19 +414,19 @@ void VirtualCallStubManager::LoggingDump()
{
if (ContractImplMap::deltasSlots[i] != 0)
{
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "deltasSlots[%d]\t%d\r\n", i, ContractImplMap::deltasSlots[i]);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "deltasSlots[%d]\t%d\r\n", i, ContractImplMap::deltasSlots[i]);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
}
}
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "cout of maps:\t%d\r\n", ContractImplMap::countMaps);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "cout of maps:\t%d\r\n", ContractImplMap::countMaps);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "count of interfaces:\t%d\r\n", ContractImplMap::countInterfaces);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "count of interfaces:\t%d\r\n", ContractImplMap::countInterfaces);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "count of deltas:\t%d\r\n", ContractImplMap::countDelta);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "count of deltas:\t%d\r\n", ContractImplMap::countDelta);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "total delta for descs:\t%d\r\n", ContractImplMap::totalDeltaDescs);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "total delta for descs:\t%d\r\n", ContractImplMap::totalDeltaDescs);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "total delta for slots:\t%d\r\n", ContractImplMap::totalDeltaSlots);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "total delta for slots:\t%d\r\n", ContractImplMap::totalDeltaSlots);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
#endif // 0
@@ -2972,38 +2972,38 @@ void VirtualCallStubManager::LogStats()
if (g_hStubLogFile && (stats.site_write != 0))
{
//output counters
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "site_counter", stats.site_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "site_counter", stats.site_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "site_write", stats.site_write);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "site_write", stats.site_write);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "site_write_mono", stats.site_write_mono);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "site_write_mono", stats.site_write_mono);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "site_write_poly", stats.site_write_poly);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "site_write_poly", stats.site_write_poly);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\nstub data\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\nstub data\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "stub_lookup_counter", stats.stub_lookup_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "stub_lookup_counter", stats.stub_lookup_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "stub_mono_counter", stats.stub_mono_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "stub_mono_counter", stats.stub_mono_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "stub_poly_counter", stats.stub_poly_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "stub_poly_counter", stats.stub_poly_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "stub_space", stats.stub_space);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "stub_space", stats.stub_space);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
size_t total, used;
g_resolveCache->GetLoadFactor(&total, &used);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_SIZE, "cache_entry_used", used);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_SIZE, "cache_entry_used", used);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "cache_entry_counter", stats.cache_entry_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "cache_entry_counter", stats.cache_entry_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "cache_entry_space", stats.cache_entry_space);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "cache_entry_space", stats.cache_entry_space);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\ncache_load:\t%zu used, %zu total, utilization %#5.2f%%\r\n",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\ncache_load:\t%zu used, %zu total, utilization %#5.2f%%\r\n",
used, total, 100.0 * double(used) / double(total));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
}
diff --git a/src/coreclr/vm/wks/CMakeLists.txt b/src/coreclr/vm/wks/CMakeLists.txt
index cb7ba8ca2cc997..b0113575c1e05e 100644
--- a/src/coreclr/vm/wks/CMakeLists.txt
+++ b/src/coreclr/vm/wks/CMakeLists.txt
@@ -26,7 +26,6 @@ add_dependencies(cee_wks_obj eventing_headers)
add_dependencies(cee_wks_mergeable_obj eventing_headers)
if (CLR_CMAKE_TARGET_WIN32)
-
if(NOT CLR_CMAKE_HOST_ARCH_ARM AND NOT CLR_CMAKE_HOST_ARCH_ARM64)
if (CLR_CMAKE_HOST_ARCH_I386)
@@ -34,33 +33,16 @@ if (CLR_CMAKE_TARGET_WIN32)
endif (CLR_CMAKE_HOST_ARCH_I386)
# Convert AsmConstants.h into AsmConstants.inc
- find_program(POWERSHELL powershell)
- if (POWERSHELL STREQUAL "POWERSHELL-NOTFOUND")
- message(FATAL_ERROR "POWERSHELL not found")
- endif()
-
- # Get the current list of definitions
- get_compile_definitions(DEFINITIONS)
- add_custom_command(
- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc"
- DEPENDS ${VM_DIR}/${ARCH_SOURCES_DIR}/asmconstants.h
- COMMAND ${POWERSHELL} -NoProfile -ExecutionPolicy Bypass -NonInteractive \"& \"\"${VM_DIR}/h2inc.ps1\"\"\" \"\"\"${VM_DIR}/${ARCH_SOURCES_DIR}/asmconstants.h\"\"\" >"${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.tmp"
- COMMAND ${CMAKE_CXX_COMPILER} ${DEFINITIONS} /EP "${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.tmp" >"${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc"
- )
+ h2inc("${VM_DIR}/${ARCH_SOURCES_DIR}/asmconstants.h" "${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.tmp")
+ preprocess_file("${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.tmp" "${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc")
- set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc PROPERTIES GENERATED TRUE)
-
- add_custom_target(
- asmconstants_inc
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc
- )
+ add_custom_target(asmconstants_inc DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc)
add_dependencies(cee_wks_core asmconstants_inc)
add_dependencies(cee_wks_obj asmconstants_inc)
add_dependencies(cee_wks_mergeable_obj asmconstants_inc)
endif(NOT CLR_CMAKE_HOST_ARCH_ARM AND NOT CLR_CMAKE_HOST_ARCH_ARM64)
-
endif (CLR_CMAKE_TARGET_WIN32)
add_custom_target(precompiled_asm DEPENDS ${VM_WKS_ARCH_ASM_OBJECTS})
diff --git a/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Ssl.cs b/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Ssl.cs
index f1200eabdd2a7c..9ae88238278c11 100644
--- a/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Ssl.cs
+++ b/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Ssl.cs
@@ -233,8 +233,7 @@ private static partial void SSLStreamGetPeerCertificates(
internal static IntPtr[]? SSLStreamGetPeerCertificates(SafeSslHandle ssl)
{
IntPtr[]? ptrs;
- int count;
- Interop.AndroidCrypto.SSLStreamGetPeerCertificates(ssl, out ptrs, out count);
+ Interop.AndroidCrypto.SSLStreamGetPeerCertificates(ssl, out ptrs, out _);
return ptrs;
}
diff --git a/src/libraries/Common/src/Interop/FreeBSD/Interop.Process.cs b/src/libraries/Common/src/Interop/FreeBSD/Interop.Process.cs
index 3d18ead32d116d..f7549adf6a9c32 100644
--- a/src/libraries/Common/src/Interop/FreeBSD/Interop.Process.cs
+++ b/src/libraries/Common/src/Interop/FreeBSD/Interop.Process.cs
@@ -74,7 +74,7 @@ internal static unsafe int[] ListAllPids()
/// Gets executable name for process given it's PID
///
/// The PID of the process
- public static unsafe string? GetProcPath(int pid)
+ public static unsafe string GetProcPath(int pid)
{
Span sysctlName = stackalloc int[] { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, pid };
byte* pBuffer = null;
@@ -83,7 +83,7 @@ internal static unsafe int[] ListAllPids()
try
{
Interop.Sys.Sysctl(sysctlName, ref pBuffer, ref bytesLength);
- return System.Text.Encoding.UTF8.GetString(pBuffer, (int)bytesLength - 1);
+ return System.Text.Encoding.UTF8.GetString(pBuffer, bytesLength - 1);
}
finally
{
diff --git a/src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs b/src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
index 8be9f32cbedee3..0f2287ce4164bd 100644
--- a/src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
+++ b/src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
@@ -61,10 +61,8 @@ private static ProcessModuleCollection ParseMapsModulesCore(IEnumerable
// Not a continuation, commit any current modules and create a new one.
CommitCurrentModule();
- module = new ProcessModule
+ module = new ProcessModule(parsedLine.Path, Path.GetFileName(parsedLine.Path))
{
- FileName = parsedLine.Path,
- ModuleName = Path.GetFileName(parsedLine.Path),
ModuleMemorySize = parsedLine.Size,
EntryPointAddress = IntPtr.Zero // unknown
};
diff --git a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Ssl.cs b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Ssl.cs
index 2e6e72c9418b44..af6596efd51da6 100644
--- a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Ssl.cs
+++ b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Ssl.cs
@@ -46,6 +46,7 @@ internal enum PAL_TlsHandshakeState
WouldBlock,
ServerAuthCompleted,
ClientAuthCompleted,
+ ClientCertRequested,
}
internal enum PAL_TlsIo
@@ -99,6 +100,12 @@ private static partial int AppleCryptoNative_SslSetBreakOnClientAuth(
int setBreak,
out int pOSStatus);
+ [GeneratedDllImport(Interop.Libraries.AppleCryptoNative)]
+ private static partial int AppleCryptoNative_SslSetBreakOnCertRequested(
+ SafeSslHandle sslHandle,
+ int setBreak,
+ out int pOSStatus);
+
[GeneratedDllImport(Interop.Libraries.AppleCryptoNative)]
private static partial int AppleCryptoNative_SslSetCertificate(
SafeSslHandle sslHandle,
@@ -266,6 +273,25 @@ internal static void SslBreakOnClientAuth(SafeSslHandle sslHandle, bool setBreak
throw new SslException();
}
+ internal static void SslBreakOnCertRequested(SafeSslHandle sslHandle, bool setBreak)
+ {
+ int osStatus;
+ int result = AppleCryptoNative_SslSetBreakOnCertRequested(sslHandle, setBreak ? 1 : 0, out osStatus);
+
+ if (result == 1)
+ {
+ return;
+ }
+
+ if (result == 0)
+ {
+ throw CreateExceptionForOSStatus(osStatus);
+ }
+
+ Debug.Fail($"AppleCryptoNative_SslSetBreakOnCertRequested returned {result}");
+ throw new SslException();
+ }
+
internal static void SslSetCertificate(SafeSslHandle sslHandle, IntPtr[] certChainPtrs)
{
using (SafeCreateHandle cfCertRefs = CoreFoundation.CFArrayCreate(certChainPtrs, (UIntPtr)certChainPtrs.Length))
diff --git a/src/libraries/Common/src/Interop/Unix/Interop.Libraries.cs b/src/libraries/Common/src/Interop/Unix/Interop.Libraries.cs
index 8e2d9046af8987..1a0114cca21895 100644
--- a/src/libraries/Common/src/Interop/Unix/Interop.Libraries.cs
+++ b/src/libraries/Common/src/Interop/Unix/Interop.Libraries.cs
@@ -5,6 +5,8 @@ internal static partial class Interop
{
internal static partial class Libraries
{
+ internal const string Libc = "libc";
+
// Shims
internal const string SystemNative = "libSystem.Native";
internal const string NetSecurityNative = "libSystem.Net.Security.Native";
diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.LChflags.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.LChflags.cs
index 1353fbc3acec63..a5bc36dfa3d2fc 100644
--- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.LChflags.cs
+++ b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.LChflags.cs
@@ -22,5 +22,11 @@ internal enum UserFlags : uint
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LChflagsCanSetHiddenFlag")]
[SuppressGCTransition]
private static partial int LChflagsCanSetHiddenFlag();
+
+ internal static readonly bool SupportsHiddenFlag = (CanGetHiddenFlag() != 0);
+
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_CanGetHiddenFlag")]
+ [SuppressGCTransition]
+ private static partial int CanGetHiddenFlag();
}
}
diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EvpPkey.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EvpPkey.cs
index 593c6f4e593f6d..95e9ab89fc5054 100644
--- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EvpPkey.cs
+++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EvpPkey.cs
@@ -105,18 +105,28 @@ internal static unsafe SafeEvpPKeyHandle DecodePkcs8PrivateKey(
}
[GeneratedDllImport(Libraries.CryptoNative)]
- private static partial int CryptoNative_GetPkcs8PrivateKeySize(IntPtr pkey);
+ private static partial int CryptoNative_GetPkcs8PrivateKeySize(IntPtr pkey, out int p8size);
private static int GetPkcs8PrivateKeySize(IntPtr pkey)
{
- int ret = CryptoNative_GetPkcs8PrivateKeySize(pkey);
+ const int Success = 1;
+ const int Error = -1;
+ const int MissingPrivateKey = -2;
- if (ret < 0)
+ int ret = CryptoNative_GetPkcs8PrivateKeySize(pkey, out int p8size);
+
+ switch (ret)
{
- throw CreateOpenSslCryptographicException();
+ case Success:
+ return p8size;
+ case Error:
+ throw CreateOpenSslCryptographicException();
+ case MissingPrivateKey:
+ throw new CryptographicException(SR.Cryptography_CSP_NoPrivateKey);
+ default:
+ Debug.Fail($"Unexpected return '{ret}' value from {nameof(CryptoNative_GetPkcs8PrivateKeySize)}.");
+ throw new CryptographicException();
}
-
- return ret;
}
[GeneratedDllImport(Libraries.CryptoNative)]
diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs
index 828af2acfac0ee..d403daac342ad1 100644
--- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs
+++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs
@@ -78,9 +78,11 @@ private static bool DisableTlsResume
// This is helper function to adjust requested protocols based on CipherSuitePolicy and system capability.
private static SslProtocols CalculateEffectiveProtocols(SslAuthenticationOptions sslAuthenticationOptions)
{
- SslProtocols protocols = sslAuthenticationOptions.EnabledSslProtocols;
+ // make sure low bit is not set since we use it in context dictionary to distinguish use with ALPN
+ Debug.Assert(((int)sslAuthenticationOptions.EnabledSslProtocols & 1) == 0);
+ SslProtocols protocols = sslAuthenticationOptions.EnabledSslProtocols & ~((SslProtocols)1);
- if (!Interop.Ssl.Tls13Supported)
+ if (!Interop.Ssl.Capabilities.Tls13Supported)
{
if (protocols != SslProtocols.None &&
CipherSuitesPolicyPal.WantsTls13(protocols))
@@ -122,7 +124,7 @@ private static SslProtocols CalculateEffectiveProtocols(SslAuthenticationOptions
}
// This essentially wraps SSL_CTX* aka SSL_CTX_new + setting
- internal static SafeSslContextHandle AllocateSslContext(SafeFreeSslCredentials credential, SslAuthenticationOptions sslAuthenticationOptions, SslProtocols protocols)
+ internal static SafeSslContextHandle AllocateSslContext(SafeFreeSslCredentials credential, SslAuthenticationOptions sslAuthenticationOptions, SslProtocols protocols, bool enableResume)
{
SafeX509Handle? certHandle = credential.CertHandle;
SafeEvpPKeyHandle? certKeyHandle = credential.CertKeyHandle;
@@ -181,6 +183,8 @@ internal static SafeSslContextHandle AllocateSslContext(SafeFreeSslCredentials c
// https://www.openssl.org/docs/manmaster/ssl/SSL_shutdown.html
Ssl.SslCtxSetQuietShutdown(sslCtx);
+ Ssl.SslCtxSetCaching(sslCtx, enableResume ? 1 : 0);
+
if (sslAuthenticationOptions.IsServer && sslAuthenticationOptions.ApplicationProtocols != null && sslAuthenticationOptions.ApplicationProtocols.Count != 0)
{
unsafe
@@ -215,6 +219,45 @@ internal static SafeSslContextHandle AllocateSslContext(SafeFreeSslCredentials c
return sslCtx;
}
+ internal static void UpdateClientCertiticate(SafeSslHandle ssl, SslAuthenticationOptions sslAuthenticationOptions)
+ {
+ // Disable certificate selection callback. We either got certificate or we will try to proceed without it.
+ Interop.Ssl.SslSetClientCertCallback(ssl, 0);
+
+ if (sslAuthenticationOptions.CertificateContext == null)
+ {
+ return;
+ }
+
+ var credential = new SafeFreeSslCredentials(sslAuthenticationOptions.CertificateContext, sslAuthenticationOptions.EnabledSslProtocols, sslAuthenticationOptions.EncryptionPolicy, sslAuthenticationOptions.IsServer);
+ SafeX509Handle? certHandle = credential.CertHandle;
+ SafeEvpPKeyHandle? certKeyHandle = credential.CertKeyHandle;
+
+ Debug.Assert(certHandle != null);
+ Debug.Assert(certKeyHandle != null);
+
+ int retVal = Ssl.SslUseCertificate(ssl, certHandle);
+ if (1 != retVal)
+ {
+ throw CreateSslException(SR.net_ssl_use_cert_failed);
+ }
+
+ retVal = Ssl.SslUsePrivateKey(ssl, certKeyHandle);
+ if (1 != retVal)
+ {
+ throw CreateSslException(SR.net_ssl_use_private_key_failed);
+ }
+
+ if (sslAuthenticationOptions.CertificateContext.IntermediateCertificates.Length > 0)
+ {
+ if (!Ssl.AddExtraChainCertificates(ssl, sslAuthenticationOptions.CertificateContext.IntermediateCertificates))
+ {
+ throw CreateSslException(SR.net_ssl_use_cert_failed);
+ }
+ }
+
+ }
+
// This essentially wraps SSL* SSL_new()
internal static SafeSslHandle AllocateSslHandle(SafeFreeSslCredentials credential, SslAuthenticationOptions sslAuthenticationOptions)
{
@@ -222,24 +265,24 @@ internal static SafeSslHandle AllocateSslHandle(SafeFreeSslCredentials credentia
SafeSslContextHandle? sslCtxHandle = null;
SafeSslContextHandle? newCtxHandle = null;
SslProtocols protocols = CalculateEffectiveProtocols(sslAuthenticationOptions);
+ bool hasAlpn = sslAuthenticationOptions.ApplicationProtocols != null && sslAuthenticationOptions.ApplicationProtocols.Count != 0;
bool cacheSslContext = !DisableTlsResume && sslAuthenticationOptions.EncryptionPolicy == EncryptionPolicy.RequireEncryption &&
+ sslAuthenticationOptions.IsServer &&
sslAuthenticationOptions.CertificateContext != null &&
sslAuthenticationOptions.CertificateContext.SslContexts != null &&
- sslAuthenticationOptions.CipherSuitesPolicy == null &&
- (!sslAuthenticationOptions.IsServer ||
- (sslAuthenticationOptions.ApplicationProtocols != null && sslAuthenticationOptions.ApplicationProtocols.Count != 0));
+ sslAuthenticationOptions.CipherSuitesPolicy == null;
if (cacheSslContext)
{
- sslAuthenticationOptions.CertificateContext!.SslContexts!.TryGetValue(protocols, out sslCtxHandle);
+ sslAuthenticationOptions.CertificateContext!.SslContexts!.TryGetValue(protocols | (SslProtocols)(hasAlpn ? 1 : 0), out sslCtxHandle);
}
if (sslCtxHandle == null)
{
// We did not get SslContext from cache
- sslCtxHandle = newCtxHandle = AllocateSslContext(credential, sslAuthenticationOptions, protocols);
+ sslCtxHandle = newCtxHandle = AllocateSslContext(credential, sslAuthenticationOptions, protocols, cacheSslContext);
- if (cacheSslContext && sslAuthenticationOptions.CertificateContext!.SslContexts!.TryAdd(protocols, newCtxHandle))
+ if (cacheSslContext && sslAuthenticationOptions.CertificateContext!.SslContexts!.TryAdd(protocols | (SslProtocols)(hasAlpn ? 1 : 0), newCtxHandle))
{
newCtxHandle = null;
}
@@ -283,6 +326,13 @@ internal static SafeSslHandle AllocateSslHandle(SafeFreeSslCredentials credentia
{
Crypto.ErrClearError();
}
+
+ if (sslAuthenticationOptions.CertSelectionDelegate != null && sslAuthenticationOptions.CertificateContext == null)
+ {
+ // We don't have certificate but we have callback. We should wait for remote certificate and
+ // possible trusted issuer list.
+ Interop.Ssl.SslSetClientCertCallback(sslHandle, 1);
+ }
}
if (sslAuthenticationOptions.IsServer && sslAuthenticationOptions.RemoteCertRequired)
@@ -320,7 +370,7 @@ internal static SecurityStatusPal SslRenegotiate(SafeSslHandle sslContext, out b
return new SecurityStatusPal(SecurityStatusPalErrorCode.OK);
}
- internal static bool DoSslHandshake(SafeSslHandle context, ReadOnlySpan input, out byte[]? sendBuf, out int sendCount)
+ internal static SecurityStatusPalErrorCode DoSslHandshake(SafeSslHandle context, ReadOnlySpan input, out byte[]? sendBuf, out int sendCount)
{
sendBuf = null;
sendCount = 0;
@@ -341,6 +391,11 @@ internal static bool DoSslHandshake(SafeSslHandle context, ReadOnlySpan in
Exception? innerError;
Ssl.SslErrorCode error = GetSslError(context, retVal, out innerError);
+ if (error == Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP)
+ {
+ return SecurityStatusPalErrorCode.CredentialsNeeded;
+ }
+
if ((retVal != -1) || (error != Ssl.SslErrorCode.SSL_ERROR_WANT_READ))
{
// Handshake failed, but even if the handshake does not need to read, there may be an Alert going out.
@@ -385,7 +440,8 @@ internal static bool DoSslHandshake(SafeSslHandle context, ReadOnlySpan in
{
context.MarkHandshakeCompleted();
}
- return stateOk;
+
+ return stateOk ? SecurityStatusPalErrorCode.OK : SecurityStatusPalErrorCode.ContinueNeeded;
}
internal static int Encrypt(SafeSslHandle context, ReadOnlySpan input, ref byte[] output, out Ssl.SslErrorCode errorCode)
diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs
index 1db80064b2c80c..c01b829cd189d2 100644
--- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs
+++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs
@@ -6,6 +6,7 @@
using System.Diagnostics;
using System.Net.Security;
using System.Runtime.InteropServices;
+using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Win32.SafeHandles;
@@ -149,6 +150,24 @@ internal static partial class Ssl
[GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslSetData")]
internal static partial int SslSetData(IntPtr ssl, IntPtr data);
+ [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslUseCertificate")]
+ internal static extern int SslUseCertificate(SafeSslHandle ssl, SafeX509Handle certPtr);
+
+ [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslUsePrivateKey")]
+ internal static extern int SslUsePrivateKey(SafeSslHandle ssl, SafeEvpPKeyHandle keyPtr);
+
+ [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslSetClientCertCallback")]
+ internal static extern unsafe void SslSetClientCertCallback(SafeSslHandle ssl, int set);
+
+ [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_Tls13Supported")]
+ private static partial int Tls13SupportedImpl();
+
+ internal static class Capabilities
+ {
+ // needs separate type (separate static cctor) to be sure OpenSSL is initialized.
+ internal static readonly bool Tls13Supported = Tls13SupportedImpl() != 0;
+ }
+
internal static unsafe int SslSetAlpnProtos(SafeSslHandle ssl, List protocols)
{
byte[] buffer = ConvertAlpnProtocolListToByteArray(protocols);
@@ -183,6 +202,28 @@ internal static byte[] ConvertAlpnProtocolListToByteArray(List callback, IntPtr arg);
+ [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslCtxSetCaching")]
+ internal static unsafe partial void SslCtxSetCaching(SafeSslContextHandle ctx, int mode);
+
internal static bool AddExtraChainCertificates(SafeSslContextHandle ctx, X509Certificate2[] chain)
{
// send pre-computed list of intermediates.
diff --git a/src/libraries/Common/src/Interop/Unix/libc/Interop.GetParentPid.cs b/src/libraries/Common/src/Interop/Unix/libc/Interop.GetParentPid.cs
new file mode 100644
index 00000000000000..95b27abf158287
--- /dev/null
+++ b/src/libraries/Common/src/Interop/Unix/libc/Interop.GetParentPid.cs
@@ -0,0 +1,13 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ internal static partial class libc
+ {
+ [GeneratedDllImport(Libraries.Libc, EntryPoint = "getppid")]
+ internal static partial int GetParentPid();
+ }
+}
diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextPropertyString.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextPropertyString.cs
index 8f942403261ac6..ed60c1730e54e9 100644
--- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextPropertyString.cs
+++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextPropertyString.cs
@@ -9,6 +9,6 @@ internal static partial class Interop
internal static partial class Crypt32
{
[GeneratedDllImport(Libraries.Crypt32, EntryPoint = "CertGetCertificateContextProperty", CharSet = CharSet.Unicode, SetLastError = true)]
- internal static unsafe partial bool CertGetCertificateContextPropertyString(SafeCertContextHandle pCertContext, CertContextPropId dwPropId, byte* pvData, ref int pcbData);
+ internal static unsafe partial bool CertGetCertificateContextPropertyString(SafeCertContextHandle pCertContext, CertContextPropId dwPropId, byte* pvData, ref uint pcbData);
}
}
diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetConsoleMode.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetConsoleMode.cs
index 6eb46b1f4b6d90..8275904b8286b6 100644
--- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetConsoleMode.cs
+++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetConsoleMode.cs
@@ -13,8 +13,7 @@ internal static partial class Kernel32
internal static bool IsGetConsoleModeCallSuccessful(IntPtr handle)
{
- int mode;
- return GetConsoleMode(handle, out mode);
+ return GetConsoleMode(handle, out _);
}
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
diff --git a/src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs b/src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs
index 43b718524d1ca9..8c3b6d815c169f 100644
--- a/src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs
+++ b/src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs
@@ -49,9 +49,7 @@ internal void Set(IntPtr value)
internal static int EnumeratePackages(out int pkgnum, out SafeFreeContextBuffer pkgArray)
{
- int res = -1;
- SafeFreeContextBuffer_SECURITY? pkgArray_SECURITY = null;
- res = Interop.SspiCli.EnumerateSecurityPackagesW(out pkgnum, out pkgArray_SECURITY);
+ int res = Interop.SspiCli.EnumerateSecurityPackagesW(out pkgnum, out SafeFreeContextBuffer_SECURITY? pkgArray_SECURITY);
pkgArray = pkgArray_SECURITY;
if (res != 0)
@@ -230,11 +228,8 @@ public static unsafe int AcquireCredentialsHandle(
ref SafeSspiAuthDataHandle authdata,
out SafeFreeCredentials outCredential)
{
- int errorCode = -1;
- long timeStamp;
-
outCredential = new SafeFreeCredential_SECURITY();
- errorCode = Interop.SspiCli.AcquireCredentialsHandleW(
+ int errorCode = Interop.SspiCli.AcquireCredentialsHandleW(
null,
package,
(int)intent,
@@ -243,7 +238,7 @@ public static unsafe int AcquireCredentialsHandle(
null,
null,
ref outCredential._handle,
- out timeStamp);
+ out _);
if (errorCode != 0)
{
@@ -260,7 +255,6 @@ public static unsafe int AcquireCredentialsHandle(
out SafeFreeCredentials outCredential)
{
int errorCode = -1;
- long timeStamp;
outCredential = new SafeFreeCredential_SECURITY();
@@ -273,7 +267,7 @@ public static unsafe int AcquireCredentialsHandle(
null,
null,
ref outCredential._handle,
- out timeStamp);
+ out _);
if (NetEventSource.Log.IsEnabled()) NetEventSource.Verbose(null, $"{nameof(Interop.SspiCli.AcquireCredentialsHandleW)} returns 0x{errorCode:x}, handle = {outCredential}");
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.cs
index 2ab6998096704e..253e0548dea9d9 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.cs
@@ -54,8 +54,7 @@ public override bool IsInvalid
protected override bool ReleaseHandle()
{
- Interop.NetSecurityNative.Status minorStatus;
- Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ReleaseName(out minorStatus, ref handle);
+ Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ReleaseName(out _, ref handle);
SetHandle(IntPtr.Zero);
return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE;
}
@@ -75,7 +74,7 @@ internal sealed class SafeGssCredHandle : SafeHandle
public static SafeGssCredHandle CreateAcceptor()
{
- SafeGssCredHandle? retHandle = null;
+ SafeGssCredHandle? retHandle;
Interop.NetSecurityNative.Status status;
Interop.NetSecurityNative.Status minorStatus;
@@ -143,8 +142,7 @@ public override bool IsInvalid
protected override bool ReleaseHandle()
{
- Interop.NetSecurityNative.Status minorStatus;
- Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ReleaseCred(out minorStatus, ref handle);
+ Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ReleaseCred(out _, ref handle);
SetHandle(IntPtr.Zero);
return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE;
}
@@ -169,8 +167,7 @@ public override bool IsInvalid
protected override unsafe bool ReleaseHandle()
{
- Interop.NetSecurityNative.Status minorStatus;
- Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.DeleteSecContext(out minorStatus, ref handle);
+ Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.DeleteSecContext(out _, ref handle);
SetHandle(IntPtr.Zero);
return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE;
}
diff --git a/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionFactory.cs b/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionFactory.cs
index 5418b4ff8bba76..d329db38dd0317 100644
--- a/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionFactory.cs
+++ b/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionFactory.cs
@@ -386,23 +386,13 @@ internal DbMetaDataFactory GetMetaDataFactory(DbConnectionPoolGroup connectionPo
// if two threads happen to hit this at the same time. One will be GC'd
if (metaDataFactory == null)
{
- bool allowCache = false;
- metaDataFactory = CreateMetaDataFactory(internalConnection, out allowCache);
- if (allowCache)
- {
- connectionPoolGroup.MetaDataFactory = metaDataFactory;
- }
+ metaDataFactory = CreateMetaDataFactory(internalConnection);
+ connectionPoolGroup.MetaDataFactory = metaDataFactory;
}
return metaDataFactory;
}
- protected virtual DbMetaDataFactory CreateMetaDataFactory(DbConnectionInternal internalConnection, out bool cacheMetaDataFactory)
- {
- // providers that support GetSchema must override this with a method that creates a meta data
- // factory appropriate for them.
- cacheMetaDataFactory = false;
- throw ADP.NotSupported();
- }
+ protected abstract DbMetaDataFactory CreateMetaDataFactory(DbConnectionInternal internalConnection);
protected abstract DbConnectionInternal CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, object poolGroupProviderInfo, DbConnectionPool? pool, DbConnection? owningConnection);
diff --git a/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionInternal.cs b/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionInternal.cs
index 5c1c4c0034cd95..1103b6488733bc 100644
--- a/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionInternal.cs
+++ b/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionInternal.cs
@@ -319,7 +319,7 @@ protected bool TryOpenConnectionInternal(DbConnection outerConnection, DbConnect
// ?->Connecting: prevent set_ConnectionString during Open
if (connectionFactory.SetInnerConnectionFrom(outerConnection, DbConnectionClosedConnecting.SingletonInstance, this))
{
- DbConnectionInternal? openConnection = null;
+ DbConnectionInternal? openConnection;
try
{
connectionFactory.PermissionDemand(outerConnection);
diff --git a/src/libraries/Common/src/System/Data/ProviderBase/DbMetaDataFactory.cs b/src/libraries/Common/src/System/Data/ProviderBase/DbMetaDataFactory.cs
index e2727c92b6bdfa..61f4cfcb9ce08c 100644
--- a/src/libraries/Common/src/System/Data/ProviderBase/DbMetaDataFactory.cs
+++ b/src/libraries/Common/src/System/Data/ProviderBase/DbMetaDataFactory.cs
@@ -109,8 +109,8 @@ private DataTable ExecuteCommand(DataRow requestedCollectionRow, string?[]? rest
DataColumn collectionNameColumn = metaDataCollectionsTable.Columns[_collectionName]!;
DataTable? resultTable = null;
- DbCommand? command = null;
- DataTable? schemaTable = null;
+ DbCommand? command;
+ DataTable? schemaTable;
Debug.Assert(requestedCollectionRow != null);
string sqlCommand = (requestedCollectionRow[populationStringColumn, DataRowVersion.Current] as string)!;
@@ -185,7 +185,6 @@ private DataTable ExecuteCommand(DataRow requestedCollectionRow, string?[]? rest
if (reader != null)
{
reader.Dispose();
- reader = null;
}
}
return resultTable;
@@ -341,8 +340,8 @@ private void FixUpVersion(DataTable dataSourceInfoTable)
private string GetParameterName(string neededCollectionName, int neededRestrictionNumber)
{
- DataTable? restrictionsTable = null;
- DataColumnCollection? restrictionColumns = null;
+ DataTable? restrictionsTable;
+ DataColumnCollection? restrictionColumns;
DataColumn? collectionName = null;
DataColumn? parameterName = null;
DataColumn? restrictionName = null;
@@ -396,10 +395,10 @@ public virtual DataTable GetSchema(DbConnection connection, string collectionNam
DataTable metaDataCollectionsTable = _metaDataCollectionsDataSet.Tables[DbMetaDataCollectionNames.MetaDataCollections]!;
DataColumn populationMechanismColumn = metaDataCollectionsTable.Columns[_populationMechanism]!;
DataColumn collectionNameColumn = metaDataCollectionsTable.Columns[DbMetaDataColumnNames.CollectionName]!;
- DataRow? requestedCollectionRow = null;
- DataTable? requestedSchema = null;
+ DataRow? requestedCollectionRow;
+ DataTable? requestedSchema;
string[]? hiddenColumns;
- string? exactCollectionName = null;
+ string? exactCollectionName;
requestedCollectionRow = FindMetaDataCollectionRow(collectionName);
exactCollectionName = (requestedCollectionRow[collectionNameColumn, DataRowVersion.Current] as string)!;
diff --git a/src/libraries/Common/src/System/Diagnostics/NetFrameworkUtils.cs b/src/libraries/Common/src/System/Diagnostics/NetFrameworkUtils.cs
index 4bab9a4590c358..d8ec150103d9b4 100644
--- a/src/libraries/Common/src/System/Diagnostics/NetFrameworkUtils.cs
+++ b/src/libraries/Common/src/System/Diagnostics/NetFrameworkUtils.cs
@@ -19,9 +19,7 @@ internal static void EnterMutex(string name, ref Mutex mutex)
internal static void EnterMutexWithoutGlobal(string mutexName, ref Mutex mutex)
{
- bool createdNew;
-
- Mutex tmpMutex = new Mutex(false, mutexName, out createdNew);
+ Mutex tmpMutex = new Mutex(false, mutexName, out _);
SafeWaitForMutex(tmpMutex, ref mutex);
}
diff --git a/src/libraries/Common/src/System/IO/FileSystem.Attributes.Windows.cs b/src/libraries/Common/src/System/IO/FileSystem.Attributes.Windows.cs
index 7e7afcec97a726..dab4cf7a8f6c5c 100644
--- a/src/libraries/Common/src/System/IO/FileSystem.Attributes.Windows.cs
+++ b/src/libraries/Common/src/System/IO/FileSystem.Attributes.Windows.cs
@@ -15,7 +15,7 @@ internal static partial class FileSystem
{
public static bool DirectoryExists(string? fullPath)
{
- return DirectoryExists(fullPath, out int lastError);
+ return DirectoryExists(fullPath, out _);
}
private static bool DirectoryExists(string? path, out int lastError)
diff --git a/src/libraries/Common/src/System/IO/TempFileCollection.cs b/src/libraries/Common/src/System/IO/TempFileCollection.cs
index 4c29dc0e70c389..95ca600bf2fab7 100644
--- a/src/libraries/Common/src/System/IO/TempFileCollection.cs
+++ b/src/libraries/Common/src/System/IO/TempFileCollection.cs
@@ -116,8 +116,8 @@ private void EnsureTempNameCreated()
{
if (_basePath == null)
{
- string tempFileName = null;
- bool uniqueFile = false;
+ string tempFileName;
+ bool uniqueFile;
int retryCount = 5000;
do
{
diff --git a/src/libraries/Common/src/System/Net/NTAuthentication.Common.cs b/src/libraries/Common/src/System/Net/NTAuthentication.Common.cs
index 148d1dc9a0700c..a46e7314c9f507 100644
--- a/src/libraries/Common/src/System/Net/NTAuthentication.Common.cs
+++ b/src/libraries/Common/src/System/Net/NTAuthentication.Common.cs
@@ -179,8 +179,7 @@ internal int MakeSignature(byte[] buffer, int offset, int count, [AllowNull] ref
}
else
{
- SecurityStatusPal statusCode;
- decodedOutgoingBlob = GetOutgoingBlob(decodedIncomingBlob, true, out statusCode);
+ decodedOutgoingBlob = GetOutgoingBlob(decodedIncomingBlob, true);
}
string? outgoingBlob = null;
@@ -199,8 +198,7 @@ internal int MakeSignature(byte[] buffer, int offset, int count, [AllowNull] ref
internal byte[]? GetOutgoingBlob(byte[]? incomingBlob, bool thrownOnError)
{
- SecurityStatusPal statusCode;
- return GetOutgoingBlob(incomingBlob, thrownOnError, out statusCode);
+ return GetOutgoingBlob(incomingBlob, thrownOnError, out _);
}
// Accepts an incoming binary security blob and returns an outgoing binary security blob.
diff --git a/src/libraries/Common/src/System/Net/SocketProtocolSupportPal.Unix.cs b/src/libraries/Common/src/System/Net/SocketProtocolSupportPal.Unix.cs
index 8de1e2a0f4ce31..c755c16517c77a 100644
--- a/src/libraries/Common/src/System/Net/SocketProtocolSupportPal.Unix.cs
+++ b/src/libraries/Common/src/System/Net/SocketProtocolSupportPal.Unix.cs
@@ -15,7 +15,9 @@ private static unsafe bool IsSupported(AddressFamily af)
IntPtr socket = invalid;
try
{
- return Interop.Sys.Socket(af, SocketType.Dgram, 0, &socket) != Interop.Error.EAFNOSUPPORT;
+ Interop.Error result = Interop.Sys.Socket(af, SocketType.Dgram, 0, &socket);
+ // we get EAFNOSUPPORT when family is not supported by Kernel, EPROTONOSUPPORT may come from policy enforcement like FreeBSD jail()
+ return result != Interop.Error.EAFNOSUPPORT && result != Interop.Error.EPROTONOSUPPORT;
}
finally
{
diff --git a/src/libraries/Common/src/System/Resources/ResourceWriter.cs b/src/libraries/Common/src/System/Resources/ResourceWriter.cs
index 71697a29e04bbe..b9184070fbc8be 100644
--- a/src/libraries/Common/src/System/Resources/ResourceWriter.cs
+++ b/src/libraries/Common/src/System/Resources/ResourceWriter.cs
@@ -595,7 +595,7 @@ private void WriteValue(ResourceTypeCode typeCode, object? value, BinaryWriter w
s.Position = 0;
writer.Write((int)s.Length);
byte[] buffer = new byte[4096];
- int read = 0;
+ int read;
while ((read = s.Read(buffer, 0, buffer.Length)) != 0)
{
writer.Write(buffer, 0, read);
diff --git a/src/libraries/Common/src/System/Runtime/InteropServices/ArrayMarshaller.cs b/src/libraries/Common/src/System/Runtime/InteropServices/ArrayMarshaller.cs
index dc11f7efd42157..a1b99ab9223774 100644
--- a/src/libraries/Common/src/System/Runtime/InteropServices/ArrayMarshaller.cs
+++ b/src/libraries/Common/src/System/Runtime/InteropServices/ArrayMarshaller.cs
@@ -67,7 +67,8 @@ public ArrayMarshaller(T[]? managed, Span stackSpace, int sizeOfNativeElem
/// Number kept small to ensure that P/Invokes with a lot of array parameters doesn't
/// blow the stack since this is a new optimization in the code-generated interop.
///
- public const int StackBufferSize = 0x200;
+ public const int BufferSize = 0x200;
+ public const bool RequiresStackBuffer = true;
public Span ManagedValues => _managedArray;
@@ -160,7 +161,8 @@ public PtrArrayMarshaller(T*[]? managed, Span stackSpace, int sizeOfNative
/// Number kept small to ensure that P/Invokes with a lot of array parameters doesn't
/// blow the stack since this is a new optimization in the code-generated interop.
///
- public const int StackBufferSize = 0x200;
+ public const int BufferSize = 0x200;
+ public const bool RequiresStackBuffer = true;
public Span ManagedValues => Unsafe.As(_managedArray);
diff --git a/src/libraries/Common/src/System/Security/Cryptography/EccSecurityTransforms.macOS.cs b/src/libraries/Common/src/System/Security/Cryptography/EccSecurityTransforms.macOS.cs
index af0bdd21d7dc95..8e9c3f8790acd4 100644
--- a/src/libraries/Common/src/System/Security/Cryptography/EccSecurityTransforms.macOS.cs
+++ b/src/libraries/Common/src/System/Security/Cryptography/EccSecurityTransforms.macOS.cs
@@ -29,7 +29,7 @@ private static ECParameters ExportParametersFromLegacyKey(SecKeyPair keys, bool
{
EccKeyFormatHelper.ReadSubjectPublicKeyInfo(
keyBlob,
- out int localRead,
+ out _,
out ECParameters key);
return key;
}
@@ -38,7 +38,7 @@ private static ECParameters ExportParametersFromLegacyKey(SecKeyPair keys, bool
EccKeyFormatHelper.ReadEncryptedPkcs8(
keyBlob,
ExportPassword,
- out int localRead,
+ out _,
out ECParameters key);
return key;
}
diff --git a/src/libraries/Common/src/System/Security/Cryptography/RSAAndroid.cs b/src/libraries/Common/src/System/Security/Cryptography/RSAAndroid.cs
index fcd2d846a265cb..c78de735480356 100644
--- a/src/libraries/Common/src/System/Security/Cryptography/RSAAndroid.cs
+++ b/src/libraries/Common/src/System/Security/Cryptography/RSAAndroid.cs
@@ -690,7 +690,7 @@ public override byte[] SignHash(byte[] hash, HashAlgorithmName hashAlgorithm, RS
Span.Empty,
hashAlgorithm, padding,
true,
- out int bytesWritten,
+ out _,
out byte[]? signature))
{
Debug.Fail("TrySignHash should not return false in allocation mode");
diff --git a/src/libraries/Common/src/System/Security/Cryptography/RSAOpenSsl.cs b/src/libraries/Common/src/System/Security/Cryptography/RSAOpenSsl.cs
index f80a641a98f019..149e240893039b 100644
--- a/src/libraries/Common/src/System/Security/Cryptography/RSAOpenSsl.cs
+++ b/src/libraries/Common/src/System/Security/Cryptography/RSAOpenSsl.cs
@@ -762,7 +762,7 @@ public override byte[] SignHash(byte[] hash, HashAlgorithmName hashAlgorithm, RS
Span.Empty,
hashAlgorithm, padding,
true,
- out int bytesWritten,
+ out _,
out byte[]? signature))
{
Debug.Fail("TrySignHash should not return false in allocation mode");
diff --git a/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.cs b/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.cs
index 29ce858255e768..7bce2648d443a9 100644
--- a/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.cs
+++ b/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.cs
@@ -564,7 +564,7 @@ public override bool VerifyHash(ReadOnlySpan hash, ReadOnlySpan sign
if (padding == RSASignaturePadding.Pkcs1)
{
Interop.AppleCrypto.PAL_HashAlgorithm palAlgId =
- PalAlgorithmFromAlgorithmName(hashAlgorithm, out int expectedSize);
+ PalAlgorithmFromAlgorithmName(hashAlgorithm, out _);
return Interop.AppleCrypto.VerifySignature(
GetKeys().PublicKey,
hash,
diff --git a/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.macOS.cs b/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.macOS.cs
index 8496d3ab2fc0e0..2a99e40a129df2 100644
--- a/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.macOS.cs
+++ b/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.macOS.cs
@@ -62,7 +62,7 @@ private static RSAParameters ExportParametersFromLegacyKey(SecKeyPair keys, bool
RSAKeyFormatHelper.ReadEncryptedPkcs8(
keyBlob,
ExportPassword,
- out int localRead,
+ out _,
out RSAParameters key);
return key;
}
diff --git a/src/libraries/Common/tests/SourceGenerators/LiveReferencePack.cs b/src/libraries/Common/tests/SourceGenerators/LiveReferencePack.cs
new file mode 100644
index 00000000000000..7d04c4b278145c
--- /dev/null
+++ b/src/libraries/Common/tests/SourceGenerators/LiveReferencePack.cs
@@ -0,0 +1,31 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Collections.Immutable;
+using System.IO;
+using System.Linq;
+
+using Microsoft.CodeAnalysis;
+
+namespace SourceGenerators.Tests
+{
+ internal static class LiveReferencePack
+ {
+ ///
+ /// Get the metadata references for the reference assemblies from the live build.
+ ///
+ /// The metadata references
+ ///
+ /// This function assumes the references are in a live-ref-pack subfolder next to the
+ /// containing assembly. Test projects can set TestRunRequiresLiveRefPack to copy the
+ /// live references to a live-ref-pack subfolder in their output directory.
+ ///
+ public static ImmutableArray GetMetadataReferences()
+ {
+ string testDirectory = Path.GetDirectoryName(typeof(LiveReferencePack).Assembly.Location)!;
+ return Directory.EnumerateFiles(Path.Combine(testDirectory, "live-ref-pack"))
+ .Select(f => MetadataReference.CreateFromFile(f))
+ .ToImmutableArray();
+ }
+ }
+}
diff --git a/src/libraries/Common/tests/System/Collections/DebugView.Tests.cs b/src/libraries/Common/tests/System/Collections/DebugView.Tests.cs
index 35e6b16b654158..d363af3479c3bb 100644
--- a/src/libraries/Common/tests/System/Collections/DebugView.Tests.cs
+++ b/src/libraries/Common/tests/System/Collections/DebugView.Tests.cs
@@ -60,7 +60,7 @@ public static IEnumerable
+
+
+
+
+
diff --git a/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdHelpers.cs b/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdHelpers.cs
index 244e41c69e179d..b582580c9e97fe 100644
--- a/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdHelpers.cs
+++ b/src/libraries/Microsoft.Extensions.Hosting.Systemd/src/SystemdHelpers.cs
@@ -4,7 +4,6 @@
using System;
using System.Globalization;
using System.IO;
-using System.Runtime.InteropServices;
using System.Text;
namespace Microsoft.Extensions.Hosting.Systemd
@@ -34,7 +33,7 @@ private static bool CheckParentIsSystemd()
try
{
// Check whether our direct parent is 'systemd'.
- int parentPid = GetParentPid();
+ int parentPid = Interop.libc.GetParentPid();
string ppidString = parentPid.ToString(NumberFormatInfo.InvariantInfo);
byte[] comm = File.ReadAllBytes("/proc/" + ppidString + "/comm");
return comm.AsSpan().SequenceEqual(Encoding.ASCII.GetBytes("systemd\n"));
@@ -45,8 +44,5 @@ private static bool CheckParentIsSystemd()
return false;
}
-
- [GeneratedDllImport("libc", EntryPoint = "getppid")]
- private static partial int GetParentPid();
}
}
diff --git a/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs b/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs
index 3827761382a135..5f0ad5f68d5244 100644
--- a/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs
+++ b/src/libraries/Microsoft.Extensions.Hosting/src/HostBuilder.cs
@@ -121,6 +121,7 @@ public IHostBuilder ConfigureContainer(Action
/// An initialized
+ /// Adds basic services to the host such as application lifetime, host environment, and logging.
public IHost Build()
{
if (_hostBuilt)
diff --git a/src/libraries/Microsoft.Extensions.Http/src/Logging/LoggingHttpMessageHandler.cs b/src/libraries/Microsoft.Extensions.Http/src/Logging/LoggingHttpMessageHandler.cs
index b2bee46b3a3d60..cca20cbca1a1ed 100644
--- a/src/libraries/Microsoft.Extensions.Http/src/Logging/LoggingHttpMessageHandler.cs
+++ b/src/libraries/Microsoft.Extensions.Http/src/Logging/LoggingHttpMessageHandler.cs
@@ -90,10 +90,13 @@ public static class EventIds
public static readonly EventId ResponseHeader = new EventId(103, "ResponseHeader");
}
- private static readonly Action _requestStart = LoggerMessage.Define(
+ private static readonly LogDefineOptions _skipEnabledCheckLogDefineOptions = new LogDefineOptions() { SkipEnabledCheck = true };
+
+ private static readonly Action _requestStart = LoggerMessage.Define(
LogLevel.Information,
EventIds.RequestStart,
- "Sending HTTP request {HttpMethod} {Uri}");
+ "Sending HTTP request {HttpMethod} {Uri}",
+ _skipEnabledCheckLogDefineOptions);
private static readonly Action _requestEnd = LoggerMessage.Define(
LogLevel.Information,
@@ -102,7 +105,11 @@ public static class EventIds
public static void RequestStart(ILogger logger, HttpRequestMessage request, Func shouldRedactHeaderValue)
{
- _requestStart(logger, request.Method, request.RequestUri, null);
+ // We check here to avoid allocating in the GetUriString call unnecessarily
+ if (logger.IsEnabled(LogLevel.Information))
+ {
+ _requestStart(logger, request.Method, GetUriString(request.RequestUri), null);
+ }
if (logger.IsEnabled(LogLevel.Trace))
{
@@ -129,6 +136,13 @@ public static void RequestEnd(ILogger logger, HttpResponseMessage response, Time
(state, ex) => state.ToString());
}
}
+
+ private static string? GetUriString(Uri? requestUri)
+ {
+ return requestUri?.IsAbsoluteUri == true
+ ? requestUri.AbsoluteUri
+ : requestUri?.ToString();
+ }
}
}
}
diff --git a/src/libraries/Microsoft.Extensions.Http/src/Logging/LoggingScopeHttpMessageHandler.cs b/src/libraries/Microsoft.Extensions.Http/src/Logging/LoggingScopeHttpMessageHandler.cs
index 8ac16482c5e1ad..92fab8b7d06f34 100644
--- a/src/libraries/Microsoft.Extensions.Http/src/Logging/LoggingScopeHttpMessageHandler.cs
+++ b/src/libraries/Microsoft.Extensions.Http/src/Logging/LoggingScopeHttpMessageHandler.cs
@@ -92,9 +92,9 @@ public static class EventIds
public static readonly EventId ResponseHeader = new EventId(103, "RequestPipelineResponseHeader");
}
- private static readonly Func _beginRequestPipelineScope = LoggerMessage.DefineScope("HTTP {HttpMethod} {Uri}");
+ private static readonly Func _beginRequestPipelineScope = LoggerMessage.DefineScope("HTTP {HttpMethod} {Uri}");
- private static readonly Action _requestPipelineStart = LoggerMessage.Define(
+ private static readonly Action _requestPipelineStart = LoggerMessage.Define(
LogLevel.Information,
EventIds.PipelineStart,
"Start processing HTTP request {HttpMethod} {Uri}");
@@ -106,12 +106,12 @@ public static class EventIds
public static IDisposable BeginRequestPipelineScope(ILogger logger, HttpRequestMessage request)
{
- return _beginRequestPipelineScope(logger, request.Method, request.RequestUri);
+ return _beginRequestPipelineScope(logger, request.Method, GetUriString(request.RequestUri));
}
public static void RequestPipelineStart(ILogger logger, HttpRequestMessage request, Func shouldRedactHeaderValue)
{
- _requestPipelineStart(logger, request.Method, request.RequestUri, null);
+ _requestPipelineStart(logger, request.Method, GetUriString(request.RequestUri), null);
if (logger.IsEnabled(LogLevel.Trace))
{
@@ -138,6 +138,13 @@ public static void RequestPipelineEnd(ILogger logger, HttpResponseMessage respon
(state, ex) => state.ToString());
}
}
+
+ private static string? GetUriString(Uri? requestUri)
+ {
+ return requestUri?.IsAbsoluteUri == true
+ ? requestUri.AbsoluteUri
+ : requestUri?.ToString();
+ }
}
}
}
diff --git a/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/LoggingUriOutputTests.cs b/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/LoggingUriOutputTests.cs
new file mode 100644
index 00000000000000..9f5588a3f61051
--- /dev/null
+++ b/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/LoggingUriOutputTests.cs
@@ -0,0 +1,103 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Linq;
+using System.Net.Http;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Http.Logging;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Logging.Testing;
+using Xunit;
+
+namespace Microsoft.Extensions.Http.Tests.Logging
+{
+ public class LoggingUriOutputTests
+ {
+ [Fact]
+ public async Task LoggingHttpMessageHandler_LogsAbsoluteUri()
+ {
+ // Arrange
+ var sink = new TestSink();
+
+ var serviceCollection = new ServiceCollection();
+ serviceCollection.AddLogging();
+ serviceCollection.AddSingleton(new TestLoggerFactory(sink, enabled: true));
+
+ serviceCollection
+ .AddHttpClient("test")
+ .ConfigurePrimaryHttpMessageHandler(() => new TestMessageHandler());
+
+ var services = serviceCollection.BuildServiceProvider();
+
+ var client = services.GetRequiredService().CreateClient("test");
+
+
+ // Act
+ var request = new HttpRequestMessage(HttpMethod.Get, "http://api.example.com/search?term=Western%20Australia");
+
+ await client.SendAsync(request);
+
+ // Assert
+ var messages = sink.Writes.ToArray();
+
+ var message = Assert.Single(messages.Where(m =>
+ {
+ return
+ m.EventId == LoggingHttpMessageHandler.Log.EventIds.RequestStart &&
+ m.LoggerName == "System.Net.Http.HttpClient.test.ClientHandler";
+ }));
+
+ Assert.Equal("Sending HTTP request GET http://api.example.com/search?term=Western%20Australia", message.Message);
+ }
+
+ [Fact]
+ public async Task LoggingScopeHttpMessageHandler_LogsAbsoluteUri()
+ {
+ // Arrange
+ var sink = new TestSink();
+
+ var serviceCollection = new ServiceCollection();
+ serviceCollection.AddLogging();
+ serviceCollection.AddSingleton(new TestLoggerFactory(sink, enabled: true));
+
+ serviceCollection
+ .AddHttpClient("test")
+ .ConfigurePrimaryHttpMessageHandler(() => new TestMessageHandler());
+
+ var services = serviceCollection.BuildServiceProvider();
+
+ var client = services.GetRequiredService().CreateClient("test");
+
+
+ // Act
+ var request = new HttpRequestMessage(HttpMethod.Get, "http://api.example.com/search?term=Western%20Australia");
+
+ await client.SendAsync(request);
+
+ // Assert
+ var messages = sink.Writes.ToArray();
+
+ var message = Assert.Single(messages.Where(m =>
+ {
+ return
+ m.EventId == LoggingScopeHttpMessageHandler.Log.EventIds.PipelineStart &&
+ m.LoggerName == "System.Net.Http.HttpClient.test.LogicalHandler";
+ }));
+
+ Assert.Equal("Start processing HTTP request GET http://api.example.com/search?term=Western%20Australia", message.Message);
+ Assert.Equal("HTTP GET http://api.example.com/search?term=Western%20Australia", message.Scope.ToString());
+ }
+
+ private class TestMessageHandler : HttpClientHandler
+ {
+ protected override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
+ {
+ var response = new HttpResponseMessage();
+
+ return Task.FromResult(response);
+ }
+ }
+ }
+}
diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/AssemblyResolver.cs b/src/libraries/Microsoft.NETCore.Platforms/src/AssemblyResolver.cs
index 9427028aa5fe32..81cbce457a734e 100644
--- a/src/libraries/Microsoft.NETCore.Platforms/src/AssemblyResolver.cs
+++ b/src/libraries/Microsoft.NETCore.Platforms/src/AssemblyResolver.cs
@@ -36,9 +36,9 @@ private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEven
AssemblyName referenceName = new AssemblyName(AppDomain.CurrentDomain.ApplyPolicy(args.Name));
string fileName = referenceName.Name + ".dll";
- string assemblyPath = null;
- string probingPath = null;
- Assembly assm = null;
+ string assemblyPath;
+ string probingPath;
+ Assembly assm;
// look next to requesting assembly
assemblyPath = args.RequestingAssembly?.Location;
diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/Extensions.cs b/src/libraries/Microsoft.NETCore.Platforms/src/Extensions.cs
index 128b56082e1fec..2456407d682e7d 100644
--- a/src/libraries/Microsoft.NETCore.Platforms/src/Extensions.cs
+++ b/src/libraries/Microsoft.NETCore.Platforms/src/Extensions.cs
@@ -17,7 +17,7 @@ public static string GetString(this ITaskItem taskItem, string metadataName)
public static bool GetBoolean(this ITaskItem taskItem, string metadataName, bool defaultValue = false)
{
- bool result = false;
+ bool result;
var metadataValue = taskItem.GetMetadata(metadataName);
if (!bool.TryParse(metadataValue, out result))
{
diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/GenerateRuntimeGraph.cs b/src/libraries/Microsoft.NETCore.Platforms/src/GenerateRuntimeGraph.cs
index 1421200ead56ae..f60a4f26ff83cc 100644
--- a/src/libraries/Microsoft.NETCore.Platforms/src/GenerateRuntimeGraph.cs
+++ b/src/libraries/Microsoft.NETCore.Platforms/src/GenerateRuntimeGraph.cs
@@ -405,8 +405,6 @@ private static void WriteRuntimeGraph(RuntimeGraph graph, string dependencyGraph
doc.Root.Add(nodesElement);
doc.Root.Add(linksElement);
- var nodeIds = new HashSet(StringComparer.OrdinalIgnoreCase);
-
foreach (var runtimeDescription in graph.Runtimes.Values)
{
nodesElement.Add(new XElement(s_dgmlns + "Node",
diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/RID.cs b/src/libraries/Microsoft.NETCore.Platforms/src/RID.cs
index 6f08d1a510e567..6457fd29cadf0e 100644
--- a/src/libraries/Microsoft.NETCore.Platforms/src/RID.cs
+++ b/src/libraries/Microsoft.NETCore.Platforms/src/RID.cs
@@ -62,7 +62,7 @@ public static RID Parse(string runtimeIdentifier)
bool omitVersionDelimiter = true;
RIDPart parseState = RIDPart.Base;
- int partStart = 0, partLength = 0;
+ int partStart = 0, partLength;
// qualifier is indistinguishable from arch so we cannot distinguish it for parsing purposes
Debug.Assert(ArchitectureDelimiter == QualifierDelimiter);
diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json
index 8d9a5386431a9c..cbc3d322a87a9b 100644
--- a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json
+++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json
@@ -508,6 +508,120 @@
"any",
"base"
],
+ "alpine.3.15": [
+ "alpine.3.15",
+ "alpine.3.14",
+ "alpine.3.13",
+ "alpine.3.12",
+ "alpine.3.11",
+ "alpine.3.10",
+ "alpine.3.9",
+ "alpine.3.8",
+ "alpine.3.7",
+ "alpine.3.6",
+ "alpine",
+ "linux-musl",
+ "linux",
+ "unix",
+ "any",
+ "base"
+ ],
+ "alpine.3.15-arm": [
+ "alpine.3.15-arm",
+ "alpine.3.15",
+ "alpine.3.14-arm",
+ "alpine.3.14",
+ "alpine.3.13-arm",
+ "alpine.3.13",
+ "alpine.3.12-arm",
+ "alpine.3.12",
+ "alpine.3.11-arm",
+ "alpine.3.11",
+ "alpine.3.10-arm",
+ "alpine.3.10",
+ "alpine.3.9-arm",
+ "alpine.3.9",
+ "alpine.3.8-arm",
+ "alpine.3.8",
+ "alpine.3.7-arm",
+ "alpine.3.7",
+ "alpine.3.6-arm",
+ "alpine.3.6",
+ "alpine-arm",
+ "alpine",
+ "linux-musl-arm",
+ "linux-musl",
+ "linux-arm",
+ "linux",
+ "unix-arm",
+ "unix",
+ "any",
+ "base"
+ ],
+ "alpine.3.15-arm64": [
+ "alpine.3.15-arm64",
+ "alpine.3.15",
+ "alpine.3.14-arm64",
+ "alpine.3.14",
+ "alpine.3.13-arm64",
+ "alpine.3.13",
+ "alpine.3.12-arm64",
+ "alpine.3.12",
+ "alpine.3.11-arm64",
+ "alpine.3.11",
+ "alpine.3.10-arm64",
+ "alpine.3.10",
+ "alpine.3.9-arm64",
+ "alpine.3.9",
+ "alpine.3.8-arm64",
+ "alpine.3.8",
+ "alpine.3.7-arm64",
+ "alpine.3.7",
+ "alpine.3.6-arm64",
+ "alpine.3.6",
+ "alpine-arm64",
+ "alpine",
+ "linux-musl-arm64",
+ "linux-musl",
+ "linux-arm64",
+ "linux",
+ "unix-arm64",
+ "unix",
+ "any",
+ "base"
+ ],
+ "alpine.3.15-x64": [
+ "alpine.3.15-x64",
+ "alpine.3.15",
+ "alpine.3.14-x64",
+ "alpine.3.14",
+ "alpine.3.13-x64",
+ "alpine.3.13",
+ "alpine.3.12-x64",
+ "alpine.3.12",
+ "alpine.3.11-x64",
+ "alpine.3.11",
+ "alpine.3.10-x64",
+ "alpine.3.10",
+ "alpine.3.9-x64",
+ "alpine.3.9",
+ "alpine.3.8-x64",
+ "alpine.3.8",
+ "alpine.3.7-x64",
+ "alpine.3.7",
+ "alpine.3.6-x64",
+ "alpine.3.6",
+ "alpine-x64",
+ "alpine",
+ "linux-musl-x64",
+ "linux-musl",
+ "linux-x64",
+ "linux",
+ "unix-x64",
+ "unix",
+ "any",
+ "base"
+ ],
"alpine.3.6": [
"alpine.3.6",
"alpine",
@@ -3638,6 +3752,14 @@
"any",
"base"
],
+ "linux-loongarch64": [
+ "linux-loongarch64",
+ "linux",
+ "unix-loongarch64",
+ "unix",
+ "any",
+ "base"
+ ],
"linux-mips64": [
"linux-mips64",
"linux",
@@ -8100,6 +8222,12 @@
"any",
"base"
],
+ "unix-loongarch64": [
+ "unix-loongarch64",
+ "unix",
+ "any",
+ "base"
+ ],
"unix-mips64": [
"unix-mips64",
"unix",
@@ -8754,4 +8882,4 @@
"any",
"base"
]
-}
+}
\ No newline at end of file
diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json
index 39ca7bdb933c3e..b2070efde5b7cf 100644
--- a/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json
+++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json
@@ -138,6 +138,29 @@
"alpine.3.13-x64"
]
},
+ "alpine.3.15": {
+ "#import": [
+ "alpine.3.14"
+ ]
+ },
+ "alpine.3.15-arm": {
+ "#import": [
+ "alpine.3.15",
+ "alpine.3.14-arm"
+ ]
+ },
+ "alpine.3.15-arm64": {
+ "#import": [
+ "alpine.3.15",
+ "alpine.3.14-arm64"
+ ]
+ },
+ "alpine.3.15-x64": {
+ "#import": [
+ "alpine.3.15",
+ "alpine.3.14-x64"
+ ]
+ },
"alpine.3.6": {
"#import": [
"alpine"
@@ -1475,6 +1498,12 @@
"unix-armel"
]
},
+ "linux-loongarch64": {
+ "#import": [
+ "linux",
+ "unix-loongarch64"
+ ]
+ },
"linux-mips64": {
"#import": [
"linux",
@@ -3399,6 +3428,11 @@
"unix"
]
},
+ "unix-loongarch64": {
+ "#import": [
+ "unix"
+ ]
+ },
"unix-mips64": {
"#import": [
"unix"
@@ -3743,4 +3777,4 @@
]
}
}
-}
+}
\ No newline at end of file
diff --git a/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props b/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props
index bc7832c33b61fc..b66931b24edf8b 100644
--- a/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props
+++ b/src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props
@@ -3,11 +3,11 @@
any
- x64;x86;arm;armel;arm64;mips64;s390x
+ x64;x86;arm;armel;arm64;loongarch64;mips64;s390x
unix
- x64;x86;arm;armel;arm64;mips64;s390x
+ x64;x86;arm;armel;arm64;loongarch64;mips64;s390x
linux
@@ -17,7 +17,7 @@
linux-musl
x64;arm;arm64
- 3.6;3.7;3.8;3.9;3.10;3.11;3.12;3.13;3.14
+ 3.6;3.7;3.8;3.9;3.10;3.11;3.12;3.13;3.14;3.15
diff --git a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.Windows.cs b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.Windows.cs
index 7e9998e9516cf7..20dcbb887140bf 100644
--- a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.Windows.cs
+++ b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.Windows.cs
@@ -588,7 +588,7 @@ private unsafe string[] GetValueNamesCore(int values)
case Interop.Advapi32.RegistryValues.REG_BINARY:
{
byte[] blob = new byte[datasize];
- ret = Interop.Advapi32.RegQueryValueEx(_hkey, name, null, ref type, blob, ref datasize);
+ Interop.Advapi32.RegQueryValueEx(_hkey, name, null, ref type, blob, ref datasize);
data = blob;
}
break;
@@ -602,7 +602,7 @@ private unsafe string[] GetValueNamesCore(int values)
long blob = 0;
Debug.Assert(datasize == 8, "datasize==8");
// Here, datasize must be 8 when calling this
- ret = Interop.Advapi32.RegQueryValueEx(_hkey, name, null, ref type, ref blob, ref datasize);
+ Interop.Advapi32.RegQueryValueEx(_hkey, name, null, ref type, ref blob, ref datasize);
data = blob;
}
@@ -617,7 +617,7 @@ private unsafe string[] GetValueNamesCore(int values)
int blob = 0;
Debug.Assert(datasize == 4, "datasize==4");
// Here, datasize must be four when calling this
- ret = Interop.Advapi32.RegQueryValueEx(_hkey, name, null, ref type, ref blob, ref datasize);
+ Interop.Advapi32.RegQueryValueEx(_hkey, name, null, ref type, ref blob, ref datasize);
data = blob;
}
@@ -639,7 +639,7 @@ private unsafe string[] GetValueNamesCore(int values)
}
char[] blob = new char[datasize / 2];
- ret = Interop.Advapi32.RegQueryValueEx(_hkey, name, null, ref type, blob, ref datasize);
+ Interop.Advapi32.RegQueryValueEx(_hkey, name, null, ref type, blob, ref datasize);
if (blob.Length > 0 && blob[blob.Length - 1] == (char)0)
{
data = new string(blob, 0, blob.Length - 1);
@@ -669,7 +669,7 @@ private unsafe string[] GetValueNamesCore(int values)
}
char[] blob = new char[datasize / 2];
- ret = Interop.Advapi32.RegQueryValueEx(_hkey, name, null, ref type, blob, ref datasize);
+ Interop.Advapi32.RegQueryValueEx(_hkey, name, null, ref type, blob, ref datasize);
if (blob.Length > 0 && blob[blob.Length - 1] == (char)0)
{
diff --git a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.cs b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.cs
index ea5a83315216de..c82feafee9f0c6 100644
--- a/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.cs
+++ b/src/libraries/Microsoft.Win32.Registry/src/Microsoft/Win32/RegistryKey.cs
@@ -728,16 +728,16 @@ private static void ValidateKeyName(string name)
throw new ArgumentNullException(nameof(name));
}
- int nextSlash = name.IndexOf("\\", StringComparison.OrdinalIgnoreCase);
+ int nextSlash = name.IndexOf('\\');
int current = 0;
- while (nextSlash != -1)
+ while (nextSlash >= 0)
{
if ((nextSlash - current) > MaxKeyLength)
{
throw new ArgumentException(SR.Arg_RegKeyStrLenBug, nameof(name));
}
current = nextSlash + 1;
- nextSlash = name.IndexOf("\\", current, StringComparison.OrdinalIgnoreCase);
+ nextSlash = name.IndexOf('\\', current);
}
if ((name.Length - current) > MaxKeyLength)
diff --git a/src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft/Win32/SystemEvents.cs b/src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft/Win32/SystemEvents.cs
index 2192c517f81bac..0f659249417e57 100644
--- a/src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft/Win32/SystemEvents.cs
+++ b/src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft/Win32/SystemEvents.cs
@@ -905,7 +905,7 @@ private void OnSessionEnded(IntPtr wParam, IntPtr lParam)
///
private int OnSessionEnding(IntPtr lParam)
{
- int endOk = 1;
+ int endOk;
SessionEndReasons reason = SessionEndReasons.SystemShutdown;
diff --git a/src/libraries/Microsoft.XmlSerializer.Generator/src/Sgen.cs b/src/libraries/Microsoft.XmlSerializer.Generator/src/Sgen.cs
index 5d126cfc9c7159..e62a31e4d28c6d 100644
--- a/src/libraries/Microsoft.XmlSerializer.Generator/src/Sgen.cs
+++ b/src/libraries/Microsoft.XmlSerializer.Generator/src/Sgen.cs
@@ -444,7 +444,7 @@ private bool ShortNameArgumentMatch(string arg, string shortName)
private void ImportType(Type type, string defaultNamespace, List mappings, List importedTypes, bool verbose, XmlReflectionImporter importer, bool parsableerrors)
{
- XmlTypeMapping xmlTypeMapping = null;
+ XmlTypeMapping xmlTypeMapping;
var localImporter = new XmlReflectionImporter(defaultNamespace);
try
{
@@ -475,7 +475,7 @@ private void ImportType(Type type, string defaultNamespace, List map
private static Assembly LoadAssembly(string assemblyName, bool throwOnFail)
{
- Assembly assembly = null;
+ Assembly assembly;
string path = Path.IsPathRooted(assemblyName) ? assemblyName : Path.GetFullPath(assemblyName);
assembly = Assembly.LoadFile(path);
if (assembly == null)
diff --git a/src/libraries/System.CodeDom/src/System/CodeDom/Compiler/CodeCompiler.cs b/src/libraries/System.CodeDom/src/System/CodeDom/Compiler/CodeCompiler.cs
index cbd5b6e30c1072..9e24a113117c8a 100644
--- a/src/libraries/System.CodeDom/src/System/CodeDom/Compiler/CodeCompiler.cs
+++ b/src/libraries/System.CodeDom/src/System/CodeDom/Compiler/CodeCompiler.cs
@@ -253,7 +253,6 @@ protected virtual CompilerResults FromSourceBatch(CompilerParameters options, st
var filenames = new string[sources.Length];
- CompilerResults results = null;
for (int i = 0; i < sources.Length; i++)
{
string name = options.TempFiles.AddExtension(i + FileExtension);
@@ -265,7 +264,7 @@ protected virtual CompilerResults FromSourceBatch(CompilerParameters options, st
}
filenames[i] = name;
}
- return results = FromFileBatch(options, filenames);
+ return FromFileBatch(options, filenames);
}
protected static string JoinStringArray(string[] sa, string separator)
diff --git a/src/libraries/System.CodeDom/src/System/Collections/Specialized/FixedStringLookup.cs b/src/libraries/System.CodeDom/src/System/Collections/Specialized/FixedStringLookup.cs
index 2899e28bdb2b77..58473bdcd9225c 100644
--- a/src/libraries/System.CodeDom/src/System/Collections/Specialized/FixedStringLookup.cs
+++ b/src/libraries/System.CodeDom/src/System/Collections/Specialized/FixedStringLookup.cs
@@ -75,7 +75,7 @@ private static bool Contains(string[] array, string value, bool ignoreCase)
// Do a binary search on the character array at the specific position and constrict the ranges appropriately.
private static bool FindCharacter(string[] array, char value, int pos, ref int min, ref int max)
{
- int index = min;
+ int index;
while (min < max)
{
index = (min + max) / 2;
diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableDictionary_2.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableDictionary_2.cs
index f08db43239b185..0fb3c5dba3cc30 100644
--- a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableDictionary_2.cs
+++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableDictionary_2.cs
@@ -876,8 +876,7 @@ private static bool ContainsKey(TKey key, MutationInput origin)
HashBucket bucket;
if (origin.Root.TryGetValue(hashCode, out bucket))
{
- TValue value;
- return bucket.TryGetValue(key, origin.Comparers, out value!);
+ return bucket.TryGetValue(key, origin.Comparers, out _);
}
return false;
@@ -1000,15 +999,13 @@ private static MutationResult Remove(TKey key, MutationInput origin)
///
private static SortedInt32KeyNode UpdateRoot(SortedInt32KeyNode root, int hashCode, HashBucket newBucket, IEqualityComparer hashBucketComparer)
{
- bool mutated;
if (newBucket.IsEmpty)
{
- return root.Remove(hashCode, out mutated);
+ return root.Remove(hashCode, out _);
}
else
{
- bool replacedExistingValue;
- return root.SetItem(hashCode, newBucket, hashBucketComparer, out replacedExistingValue, out mutated);
+ return root.SetItem(hashCode, newBucket, hashBucketComparer, out _, out _);
}
}
diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableExtensions.Minimal.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableExtensions.Minimal.cs
index 93efe0f90f1727..90ac49138da809 100644
--- a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableExtensions.Minimal.cs
+++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableExtensions.Minimal.cs
@@ -103,7 +103,7 @@ internal static bool TryCopyTo(this IEnumerable sequence, T[] array, int a
Debug.Assert(arrayIndex >= 0 && arrayIndex <= array.Length);
// IList is the GCD of what the following types implement.
- if (sequence is IList listInterface)
+ if (sequence is IList)
{
if (sequence is List list)
{
diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableHashSet_1.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableHashSet_1.cs
index bfcae53cf8083c..c29ccc50cb47d9 100644
--- a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableHashSet_1.cs
+++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableHashSet_1.cs
@@ -747,14 +747,13 @@ private static bool SetEquals(IEnumerable other, MutationInput origin)
///
private static SortedInt32KeyNode UpdateRoot(SortedInt32KeyNode root, int hashCode, IEqualityComparer hashBucketEqualityComparer, HashBucket newBucket)
{
- bool mutated;
if (newBucket.IsEmpty)
{
- return root.Remove(hashCode, out mutated);
+ return root.Remove(hashCode, out _);
}
else
{
- return root.SetItem(hashCode, newBucket, hashBucketEqualityComparer, out bool replacedExistingValue, out mutated);
+ return root.SetItem(hashCode, newBucket, hashBucketEqualityComparer, out _, out _);
}
}
diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.Node.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.Node.cs
index 78480e7d044f26..061e5cd06fbdb2 100644
--- a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.Node.cs
+++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableList_1.Node.cs
@@ -384,7 +384,7 @@ internal Node RemoveAt(int index)
Requires.Range(index >= 0 && index < this.Count, nameof(index));
Debug.Assert(_left != null && _right != null);
- Node result = this;
+ Node result;
if (index == _left._count)
{
// We have a match. If this is a leaf, just remove it
@@ -484,7 +484,7 @@ internal Node ReplaceAt(int index, T value)
Requires.Range(index >= 0 && index < this.Count, nameof(index));
Debug.Assert(!this.IsEmpty);
- Node result = this;
+ Node result;
if (index == _left!._count)
{
// We have a match.
diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.Node.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.Node.cs
index 26daa6ef73ffdc..06d52aa52f32be 100644
--- a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.Node.cs
+++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.Node.cs
@@ -290,8 +290,7 @@ internal Node Add(TKey key, TValue value, IComparer keyComparer, IEquality
Requires.NotNull(keyComparer, nameof(keyComparer));
Requires.NotNull(valueComparer, nameof(valueComparer));
- bool dummy;
- return this.SetOrAdd(key, value, keyComparer, valueComparer, false, out dummy, out mutated);
+ return this.SetOrAdd(key, value, keyComparer, valueComparer, false, out _, out mutated);
}
///
@@ -761,8 +760,7 @@ private Node RemoveRecursive(TKey key, IComparer keyComparer, out bool mut
successor = successor._left;
}
- bool dummyMutated;
- var newRight = _right.Remove(successor._key, keyComparer, out dummyMutated);
+ var newRight = _right.Remove(successor._key, keyComparer, out _);
result = successor.Mutate(left: _left, right: newRight);
}
}
diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.cs
index c720eb275e5380..2648014f16236d 100644
--- a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.cs
+++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.cs
@@ -253,8 +253,7 @@ public Builder ToBuilder()
public ImmutableSortedDictionary Add(TKey key, TValue value)
{
Requires.NotNullAllowStructs(key, nameof(key));
- bool mutated;
- var result = _root.Add(key, value, _keyComparer, _valueComparer, out mutated);
+ var result = _root.Add(key, value, _keyComparer, _valueComparer, out _);
return this.Wrap(result, _count + 1);
}
@@ -264,8 +263,8 @@ public ImmutableSortedDictionary Add(TKey key, TValue value)
public ImmutableSortedDictionary SetItem(TKey key, TValue value)
{
Requires.NotNullAllowStructs(key, nameof(key));
- bool replacedExistingValue, mutated;
- var result = _root.SetItem(key, value, _keyComparer, _valueComparer, out replacedExistingValue, out mutated);
+ bool replacedExistingValue;
+ var result = _root.SetItem(key, value, _keyComparer, _valueComparer, out replacedExistingValue, out _);
return this.Wrap(result, replacedExistingValue ? _count : _count + 1);
}
@@ -297,8 +296,7 @@ public ImmutableSortedDictionary AddRange(IEnumerable Remove(TKey value)
{
Requires.NotNullAllowStructs(value, nameof(value));
- bool mutated;
- var result = _root.Remove(value, _keyComparer, out mutated);
+ var result = _root.Remove(value, _keyComparer, out _);
return this.Wrap(result, _count - 1);
}
diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.Builder.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.Builder.cs
index 4290f5c2ddeed8..7b868bbabdef3e 100644
--- a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.Builder.cs
+++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.Builder.cs
@@ -226,8 +226,7 @@ public void ExceptWith(IEnumerable other)
foreach (T item in other)
{
- bool mutated;
- this.Root = this.Root.Remove(item, _comparer, out mutated);
+ this.Root = this.Root.Remove(item, _comparer, out _);
}
}
@@ -331,8 +330,7 @@ public void UnionWith(IEnumerable other)
foreach (T item in other)
{
- bool mutated;
- this.Root = this.Root.Add(item, _comparer, out mutated);
+ this.Root = this.Root.Add(item, _comparer, out _);
}
}
diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.Node.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.Node.cs
index c1c53978e4b8cb..e72c7cd019d45e 100644
--- a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.Node.cs
+++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.Node.cs
@@ -458,8 +458,7 @@ internal Node Remove(T key, IComparer comparer, out bool mutated)
successor = successor._left;
}
- bool dummyMutated;
- var newRight = _right.Remove(successor._key, comparer, out dummyMutated);
+ var newRight = _right.Remove(successor._key, comparer, out _);
result = successor.Mutate(left: _left, right: newRight);
}
}
diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.cs
index c0e69a79ec782d..8e635472f43d40 100644
--- a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.cs
+++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedSet_1.cs
@@ -189,8 +189,7 @@ public Builder ToBuilder()
///
public ImmutableSortedSet Add(T value)
{
- bool mutated;
- return this.Wrap(_root.Add(value, _comparer, out mutated));
+ return this.Wrap(_root.Add(value, _comparer, out _));
}
///
@@ -198,8 +197,7 @@ public ImmutableSortedSet Add(T value)
///
public ImmutableSortedSet Remove(T value)
{
- bool mutated;
- return this.Wrap(_root.Remove(value, _comparer, out mutated));
+ return this.Wrap(_root.Remove(value, _comparer, out _));
}
///
diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/SortedInt32KeyNode.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/SortedInt32KeyNode.cs
index 25cc0638f62f6a..4231e04e78dee0 100644
--- a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/SortedInt32KeyNode.cs
+++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/SortedInt32KeyNode.cs
@@ -518,8 +518,7 @@ private SortedInt32KeyNode RemoveRecursive(int key, out bool mutated)
successor = successor._left;
}
- bool dummyMutated;
- var newRight = _right.Remove(successor._key, out dummyMutated);
+ var newRight = _right.Remove(successor._key, out _);
result = successor.Mutate(left: _left, right: newRight);
}
}
diff --git a/src/libraries/System.Collections/src/System/Collections/Generic/SortedSet.cs b/src/libraries/System.Collections/src/System/Collections/Generic/SortedSet.cs
index 6829f94dec62e1..a0de9bd1dc8f04 100644
--- a/src/libraries/System.Collections/src/System/Collections/Generic/SortedSet.cs
+++ b/src/libraries/System.Collections/src/System/Collections/Generic/SortedSet.cs
@@ -466,7 +466,6 @@ internal virtual bool DoRemove(T item)
{
parentOfMatch = newGrandParent;
}
- grandParent = newGrandParent;
}
}
}
@@ -823,7 +822,7 @@ internal static bool SortedSetEquals(SortedSet? set1, SortedSet? set2, ICo
return set1.Count == set2.Count && set1.SetEquals(set2);
}
- bool found = false;
+ bool found;
foreach (T item1 in set1)
{
found = false;
@@ -1923,7 +1922,7 @@ private void Initialize()
{
_current = null;
Node? node = _tree.root;
- Node? next = null, other = null;
+ Node? next, other;
while (node != null)
{
next = (_reverse ? node.Right : node.Left);
@@ -1962,7 +1961,7 @@ public bool MoveNext()
_current = _stack.Pop();
Node? node = (_reverse ? _current.Left : _current.Right);
- Node? next = null, other = null;
+ Node? next, other;
while (node != null)
{
next = (_reverse ? node.Right : node.Left);
diff --git a/src/libraries/System.Collections/tests/Generic/Comparers/Comparer.Tests.cs b/src/libraries/System.Collections/tests/Generic/Comparers/Comparer.Tests.cs
index bcc8df17559443..4b95f488db1c9c 100644
--- a/src/libraries/System.Collections/tests/Generic/Comparers/Comparer.Tests.cs
+++ b/src/libraries/System.Collections/tests/Generic/Comparers/Comparer.Tests.cs
@@ -235,7 +235,7 @@ public void ComparerDefaultShouldAttemptToUseTheGenericIComparableInterfaceFirst
[Theory]
[MemberData(nameof(NullableOfInt32ComparisonsData))]
[MemberData(nameof(NullableOfInt32EnumComparisonsData))]
- [ActiveIssue("https://github.com/dotnet/runtime/issues/58933", TestPlatforms.iOS | TestPlatforms.tvOS)]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/58933", TestPlatforms.iOS | TestPlatforms.tvOS)]
public void NullableComparisons(T leftValue, bool leftHasValue, T rightValue, bool rightHasValue, int expected) where T : struct
{
// Comparer is specialized (for perf reasons) when T : U? where U : IComparable
diff --git a/src/libraries/System.Collections/tests/System.Collections.Tests.csproj b/src/libraries/System.Collections/tests/System.Collections.Tests.csproj
index 66f5dee8d5ba6d..d681aafe746bd2 100644
--- a/src/libraries/System.Collections/tests/System.Collections.Tests.csproj
+++ b/src/libraries/System.Collections/tests/System.Collections.Tests.csproj
@@ -4,6 +4,9 @@
true
true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationAttributeStore.cs b/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationAttributeStore.cs
index f7a26800f39fcc..650a114e5af50d 100644
--- a/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationAttributeStore.cs
+++ b/src/libraries/System.ComponentModel.Annotations/src/System/ComponentModel/DataAnnotations/ValidationAttributeStore.cs
@@ -106,8 +106,7 @@ internal bool IsPropertyContext(ValidationContext validationContext)
{
EnsureValidationContext(validationContext);
var typeItem = GetTypeStoreItem(validationContext.ObjectType);
- PropertyStoreItem? item;
- return typeItem.TryGetPropertyStoreItem(validationContext.MemberName!, out item);
+ return typeItem.TryGetPropertyStoreItem(validationContext.MemberName!, out _);
}
///
diff --git a/src/libraries/System.ComponentModel.Composition.Registration/src/System/ComponentModel/Composition/Registration/PartBuilder.cs b/src/libraries/System.ComponentModel.Composition.Registration/src/System/ComponentModel/Composition/Registration/PartBuilder.cs
index c7296f9543e596..2d9b046570ecbc 100644
--- a/src/libraries/System.ComponentModel.Composition.Registration/src/System/ComponentModel/Composition/Registration/PartBuilder.cs
+++ b/src/libraries/System.ComponentModel.Composition.Registration/src/System/ComponentModel/Composition/Registration/PartBuilder.cs
@@ -219,7 +219,7 @@ private static bool MemberHasExportMetadata(MemberInfo member)
{
foreach (Attribute attr in member.GetCustomAttributes(typeof(Attribute), false))
{
- if (attr is ExportMetadataAttribute provider)
+ if (attr is ExportMetadataAttribute)
{
return true;
}
diff --git a/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/CatalogExportProvider.ScopeFactoryExport.cs b/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/CatalogExportProvider.ScopeFactoryExport.cs
index 5f49441b566af3..8c81e19816946b 100644
--- a/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/CatalogExportProvider.ScopeFactoryExport.cs
+++ b/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/CatalogExportProvider.ScopeFactoryExport.cs
@@ -78,7 +78,7 @@ public override ExportDefinition Definition
public void Dispose()
{
CompositionContainer? childContainer = null;
- Export? export = null;
+ Export? export;
if (_export != null)
{
diff --git a/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/DirectoryCatalog.cs b/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/DirectoryCatalog.cs
index 6ee624abab6ec7..e89a4e9eac7a39 100644
--- a/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/DirectoryCatalog.cs
+++ b/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/DirectoryCatalog.cs
@@ -671,7 +671,7 @@ public override string ToString()
private AssemblyCatalog? CreateAssemblyCatalogGuarded(string assemblyFilePath)
{
- Exception? exception = null;
+ Exception? exception;
try
{
diff --git a/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Primitives/PrimitivesServices.cs b/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Primitives/PrimitivesServices.cs
index 3154a585f0db9a..2b0ce5d8e71829 100644
--- a/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Primitives/PrimitivesServices.cs
+++ b/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Primitives/PrimitivesServices.cs
@@ -53,7 +53,7 @@ internal static bool IsImportDependentOnPart(this ImportDefinition import, Compo
import = import.GetProductImportDefinition();
if (expandGenerics)
{
- return part.TryGetExports(import, out Tuple? singleMatch, out IEnumerable>? multipleMatches);
+ return part.TryGetExports(import, out _, out _);
}
else
{
diff --git a/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfo.cs b/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfo.cs
index cbfc3cdda8afa0..480e339c4080f5 100644
--- a/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfo.cs
+++ b/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfo.cs
@@ -108,9 +108,12 @@ public override int GetHashCode()
public override bool Equals(object? obj)
{
- LazyMemberInfo that = (LazyMemberInfo)obj!;
+ if (obj is not LazyMemberInfo that)
+ {
+ return false;
+ }
- // Difefrent member types mean different members
+ // Different member types mean different members
if (_memberType != that._memberType)
{
return false;
diff --git a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfoTests.cs b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfoTests.cs
index 3216f9ad528d65..e1780c1a1c3e90 100644
--- a/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfoTests.cs
+++ b/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfoTests.cs
@@ -175,6 +175,12 @@ public void Constructor_PassNullAccessorCreators()
});
}
+ [Fact]
+ public void Equals_PassNullReturnsFalse()
+ {
+ Assert.False(new LazyMemberInfo().Equals(null));
+ }
+
private static IEnumerable>> GetMembersAndAccessors(Type type)
{
yield return new Tuple>(
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ComponentResourceManager.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ComponentResourceManager.cs
index fdfc8a3c3eea6b..945a723d1b6e7b 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ComponentResourceManager.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ComponentResourceManager.cs
@@ -94,7 +94,7 @@ public virtual void ApplyResources(object value, string objectName, CultureInfo?
if (_resourceSets == null)
{
_resourceSets = new Hashtable();
- resources = FillResources(culture, out ResourceSet? dummy);
+ resources = FillResources(culture, out _);
_resourceSets[culture] = resources;
}
else
@@ -102,7 +102,7 @@ public virtual void ApplyResources(object value, string objectName, CultureInfo?
resources = (SortedList?)_resourceSets[culture];
if (resources == null || (resources.Comparer.Equals(StringComparer.OrdinalIgnoreCase) != IgnoreCase))
{
- resources = FillResources(culture, out ResourceSet? dummy);
+ resources = FillResources(culture, out _);
_resourceSets[culture] = resources;
}
}
@@ -165,7 +165,7 @@ public virtual void ApplyResources(object value, string objectName, CultureInfo?
}
else
{
- PropertyInfo? prop = null;
+ PropertyInfo? prop;
try
{
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/DateTimeOffsetConverter.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/DateTimeOffsetConverter.cs
index 37d2a6f635c0ff..5aa11c3004c5f1 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/DateTimeOffsetConverter.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/DateTimeOffsetConverter.cs
@@ -94,7 +94,7 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destina
culture = CultureInfo.CurrentCulture;
}
- DateTimeFormatInfo? formatInfo = null;
+ DateTimeFormatInfo? formatInfo;
formatInfo = (DateTimeFormatInfo?)culture.GetFormat(typeof(DateTimeFormatInfo));
string format;
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/PropertyTabAttribute.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/PropertyTabAttribute.cs
index 92ee6a87a46d42..c4dc526139e4ce 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/PropertyTabAttribute.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/PropertyTabAttribute.cs
@@ -104,7 +104,7 @@ private void InitializeTabClasses()
for (int i = 0; i < _tabClassNames.Length; i++)
{
int commaIndex = _tabClassNames[i].IndexOf(',');
- string? className = null;
+ string? className;
string? assemblyName = null;
if (commaIndex != -1)
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs
index 31556e2ce55a51..54beae053cebd0 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseManager.cs
@@ -207,11 +207,7 @@ public static bool IsLicensed(Type type)
{
Debug.Assert(type != null, "IsValid Type cannot ever be null");
bool value = ValidateInternal(type, null, false, out License? license);
- if (license != null)
- {
- license.Dispose();
- license = null;
- }
+ license?.Dispose();
return value;
}
@@ -222,11 +218,7 @@ public static bool IsValid(Type type)
{
Debug.Assert(type != null, "IsValid Type cannot ever be null");
bool value = ValidateInternal(type, null, false, out License? license);
- if (license != null)
- {
- license.Dispose();
- license = null;
- }
+ license?.Dispose();
return value;
}
@@ -273,7 +265,7 @@ private static bool ValidateInternal(Type type, object? instance, bool allowExce
instance,
allowExceptions,
out license,
- out string? licenseKey);
+ out _);
}
@@ -329,10 +321,11 @@ private static bool ValidateInternalRecursive(LicenseContext context, Type type,
if (license != null)
{
license.Dispose();
+#pragma warning disable IDE0059 // ValidateInternalRecursive does not null licence all the time (https://github.com/dotnet/roslyn/issues/42761)
license = null;
+#pragma warning restore IDE0059
}
- string? temp;
- isValid = ValidateInternalRecursive(context, baseType, null, allowExceptions, out license, out temp);
+ isValid = ValidateInternalRecursive(context, baseType, null, allowExceptions, out license, out _);
if (license != null)
{
license.Dispose();
@@ -355,11 +348,7 @@ public static void Validate(Type type)
throw new LicenseException(type);
}
- if (lic != null)
- {
- lic.Dispose();
- lic = null;
- }
+ lic?.Dispose();
}
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/MaskedTextProvider.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/MaskedTextProvider.cs
index 77a965c66482b5..16ebdaf6ab3008 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/MaskedTextProvider.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/MaskedTextProvider.cs
@@ -826,9 +826,7 @@ public char this[int index]
///
public bool Add(char input)
{
- int dummyVar;
- MaskedTextResultHint dummyVar2;
- return Add(input, out dummyVar, out dummyVar2);
+ return Add(input, out _, out _);
}
///
@@ -876,9 +874,7 @@ public bool Add(char input, out int testPosition, out MaskedTextResultHint resul
///
public bool Add(string input)
{
- int dummyVar;
- MaskedTextResultHint dummyVar2;
- return Add(input, out dummyVar, out dummyVar2);
+ return Add(input, out _, out _);
}
///
@@ -913,8 +909,7 @@ public bool Add(string input, out int testPosition, out MaskedTextResultHint res
///
public void Clear()
{
- MaskedTextResultHint dummyHint;
- Clear(out dummyHint);
+ Clear(out _);
}
///
@@ -1255,9 +1250,7 @@ public bool InsertAt(char input, int position, out int testPosition, out MaskedT
///
public bool InsertAt(string input, int position)
{
- int dummyVar;
- MaskedTextResultHint dummyVar2;
- return InsertAt(input, position, out dummyVar, out dummyVar2);
+ return InsertAt(input, position, out _, out _);
}
///
@@ -1516,9 +1509,7 @@ public static bool IsValidPasswordChar(char c)
///
public bool Remove()
{
- int dummyVar;
- MaskedTextResultHint dummyVar2;
- return Remove(out dummyVar, out dummyVar2);
+ return Remove(out _, out _);
}
///
@@ -1564,9 +1555,7 @@ public bool RemoveAt(int position)
///
public bool RemoveAt(int startPosition, int endPosition)
{
- int dummyVar;
- MaskedTextResultHint dummyVar2;
- return RemoveAt(startPosition, endPosition, out dummyVar, out dummyVar2);
+ return RemoveAt(startPosition, endPosition, out _, out _);
}
///
@@ -1730,9 +1719,7 @@ private bool RemoveAtInt(int startPosition, int endPosition, out int testPositio
///
public bool Replace(char input, int position)
{
- int dummyVar;
- MaskedTextResultHint dummyVar2;
- return Replace(input, position, out dummyVar, out dummyVar2);
+ return Replace(input, position, out _, out _);
}
///
@@ -1823,9 +1810,7 @@ public bool Replace(char input, int startPosition, int endPosition, out int test
///
public bool Replace(string input, int position)
{
- int dummyVar;
- MaskedTextResultHint dummyVar2;
- return Replace(input, position, out dummyVar, out dummyVar2);
+ return Replace(input, position, out _, out _);
}
///
@@ -2051,10 +2036,7 @@ private void ResetString(int startPosition, int endPosition)
///
public bool Set(string input)
{
- int dummyVar;
- MaskedTextResultHint dummyVar2;
-
- return Set(input, out dummyVar, out dummyVar2);
+ return Set(input, out _, out _);
}
///
@@ -2072,7 +2054,6 @@ public bool Set(string input, out int testPosition, out MaskedTextResultHint res
throw new ArgumentNullException(nameof(input));
}
- resultHint = MaskedTextResultHint.Unknown;
testPosition = 0;
if (input.Length == 0) // Clearing the input text.
@@ -2511,7 +2492,7 @@ private bool TestString(string input, int position, out int testPosition, out Ma
// If any char is actually accepted, then the hint is success, otherwise whatever the last character result is.
// Need a temp variable for
- MaskedTextResultHint tempHint = resultHint;
+ MaskedTextResultHint tempHint;
foreach (char ch in input)
{
@@ -2753,8 +2734,6 @@ public string ToString(bool ignorePasswordChar, bool includePrompt, bool include
///
public bool VerifyChar(char input, int position, out MaskedTextResultHint hint)
{
- hint = MaskedTextResultHint.NoEffect;
-
if (position < 0 || position >= _testString.Length)
{
hint = MaskedTextResultHint.PositionOutOfRange;
@@ -2782,9 +2761,7 @@ public bool VerifyEscapeChar(char input, int position)
///
public bool VerifyString(string input)
{
- int dummyVar;
- MaskedTextResultHint dummyVar2;
- return VerifyString(input, out dummyVar, out dummyVar2);
+ return VerifyString(input, out _, out _);
}
///
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/MemberDescriptor.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/MemberDescriptor.cs
index 615f8d70157b51..3d419bf44a7ac2 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/MemberDescriptor.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/MemberDescriptor.cs
@@ -358,7 +358,7 @@ private void FilterAttributesIfNeeded()
for (int i = 0; i < list.Count;)
{
- int savedIndex = -1;
+ int savedIndex;
object? typeId = list[i]?.TypeId;
if (typeId == null)
{
@@ -417,7 +417,7 @@ private void FilterAttributesIfNeeded()
throw new ArgumentNullException(nameof(componentClass));
}
- MethodInfo? result = null;
+ MethodInfo? result;
if (publicOnly)
{
result = componentClass.GetMethod(name, args);
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectPropertyDescriptor.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectPropertyDescriptor.cs
index 096fef344ad07e..ec1987b77bb451 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectPropertyDescriptor.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectPropertyDescriptor.cs
@@ -791,7 +791,7 @@ protected override void FillAttributes(IList attributes)
while (currentReflectType != null && currentReflectType != typeof(object))
{
- MemberInfo? memberInfo = null;
+ MemberInfo? memberInfo;
BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly;
// Fill in our member info so we can get at the custom attributes.
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectTypeDescriptionProvider.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectTypeDescriptionProvider.cs
index dacc0ea3aba45d..2e694467f8465f 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectTypeDescriptionProvider.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/ReflectTypeDescriptionProvider.cs
@@ -262,7 +262,7 @@ internal static void AddEditorTable(Type editorBaseType, Hashtable table)
{
Debug.Assert(objectType != null, "Should have arg-checked before coming in here");
- object? obj = null;
+ object? obj;
if (argTypes != null)
{
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs
index f1b36ef296ab94..ded2068999cc5c 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs
@@ -511,7 +511,7 @@ public static PropertyDescriptor CreateProperty(
oldPropertyDescriptor.Attributes[
typeof(ExtenderProvidedPropertyAttribute)]!;
- if (attr.ExtenderProperty is ReflectPropertyDescriptor reflectDesc)
+ if (attr.ExtenderProperty is ReflectPropertyDescriptor)
{
return new ExtendedPropertyDescriptor(oldPropertyDescriptor, attributes);
}
@@ -2824,7 +2824,7 @@ internal AttributeTypeDescriptor(Attribute[] attrs, ICustomTypeDescriptor? paren
///
public override AttributeCollection GetAttributes()
{
- Attribute[]? finalAttr = null;
+ Attribute[]? finalAttr;
AttributeCollection existing = base.GetAttributes();
Attribute[] newAttrs = _attributeArray;
Attribute[] newArray = new Attribute[existing.Count + newAttrs.Length];
@@ -3922,7 +3922,7 @@ PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[]? at
// custom type descriptor
TypeDescriptionProvider p = _node.Provider;
object? owner;
- if (p is ReflectTypeDescriptionProvider rp)
+ if (p is ReflectTypeDescriptionProvider)
{
owner = ReflectTypeDescriptionProvider.GetPropertyOwner(_objectType, _instance!, pd);
}
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/UriTypeConverter.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/UriTypeConverter.cs
index 6324f57626cebd..b11bf810aafd59 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/UriTypeConverter.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/UriTypeConverter.cs
@@ -95,7 +95,7 @@ public override bool IsValid(ITypeDescriptorContext? context, object? value)
{
if (value is string text)
{
- return Uri.TryCreate(text, UriKind.RelativeOrAbsolute, out Uri? uri);
+ return Uri.TryCreate(text, UriKind.RelativeOrAbsolute, out _);
}
return value is Uri;
}
diff --git a/src/libraries/System.ComponentModel.TypeConverter/src/System/Drawing/ColorConverter.cs b/src/libraries/System.ComponentModel.TypeConverter/src/System/Drawing/ColorConverter.cs
index 1c5629e4643a12..c3c83605400e0e 100644
--- a/src/libraries/System.ComponentModel.TypeConverter/src/System/Drawing/ColorConverter.cs
+++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/Drawing/ColorConverter.cs
@@ -101,7 +101,7 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destina
}
else if (destinationType == typeof(InstanceDescriptor))
{
- MemberInfo? member = null;
+ MemberInfo? member;
object[]? args = null;
if (c.IsEmpty)
diff --git a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/BaseConfigurationRecord.cs b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/BaseConfigurationRecord.cs
index d798088fe9d416..545880685ccbe0 100644
--- a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/BaseConfigurationRecord.cs
+++ b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/BaseConfigurationRecord.cs
@@ -748,7 +748,6 @@ private void RefreshFactoryRecord(string configKey)
private object GetSection(string configKey, bool getLkg, bool checkPermission)
{
- object result;
object resultRuntimeObject;
// Note that GetSectionRecursive may invalidate this record,
@@ -759,7 +758,7 @@ private object GetSection(string configKey, bool getLkg, bool checkPermission)
checkPermission,
getRuntimeObject: true,
requestIsHere: true,
- result: out result,
+ result: out _,
resultRuntimeObject: out resultRuntimeObject);
return resultRuntimeObject;
@@ -1688,8 +1687,7 @@ internal FactoryRecord FindFactoryRecord(string configKey, bool permitErrors,
internal FactoryRecord FindFactoryRecord(string configKey, bool permitErrors)
{
- BaseConfigurationRecord dummy;
- return FindFactoryRecord(configKey, permitErrors, out dummy);
+ return FindFactoryRecord(configKey, permitErrors, out _);
}
// - Find the nearest factory record
@@ -2287,8 +2285,7 @@ private OverrideMode ResolveOverrideModeFromParent(string configKey, out Overrid
protected OverrideMode GetSectionLockedMode(string configKey)
{
- OverrideMode dummy;
- return GetSectionLockedMode(configKey, out dummy);
+ return GetSectionLockedMode(configKey, out _);
}
// Return the current lock mode for a section
diff --git a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationElement.cs b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationElement.cs
index c9203656dea95a..0cc7649687c80c 100644
--- a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationElement.cs
+++ b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationElement.cs
@@ -192,7 +192,7 @@ protected internal virtual ConfigurationPropertyCollection Properties
{
get
{
- ConfigurationPropertyCollection result = null;
+ ConfigurationPropertyCollection result;
if (PropertiesFromType(GetType(), out result))
ApplyValidatorsRecursive(this);
@@ -789,8 +789,7 @@ private static ConfigurationProperty CreateConfigurationPropertyFromAttributes(P
// Handle some special cases of property types
if ((result != null) && typeof(ConfigurationElement).IsAssignableFrom(result.Type))
{
- ConfigurationPropertyCollection unused;
- PropertiesFromType(result.Type, out unused);
+ PropertiesFromType(result.Type, out _);
}
return result;
diff --git a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationManager.cs b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationManager.cs
index ae5f976f1de937..f0da80518597ae 100644
--- a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationManager.cs
+++ b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ConfigurationManager.cs
@@ -224,7 +224,7 @@ private static void PreloadConfiguration(Configuration configuration)
if (null == configuration) return;
// Preload root-level sections.
- foreach (ConfigurationSection section in configuration.Sections) { }
+ foreach (ConfigurationSection _ in configuration.Sections) { }
// Recursively preload all section groups and sections.
foreach (ConfigurationSectionGroup sectionGroup in configuration.SectionGroups)
@@ -236,7 +236,7 @@ private static void PreloadConfigurationSectionGroup(ConfigurationSectionGroup s
if (null == sectionGroup) return;
// Preload sections just by iterating.
- foreach (ConfigurationSection section in sectionGroup.Sections) { }
+ foreach (ConfigurationSection _ in sectionGroup.Sections) { }
// Load child section groups.
foreach (ConfigurationSectionGroup childSectionGroup in sectionGroup.SectionGroups)
diff --git a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/MgmtConfigurationRecord.cs b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/MgmtConfigurationRecord.cs
index 90b743d3956987..85031c95e5fc1b 100644
--- a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/MgmtConfigurationRecord.cs
+++ b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/MgmtConfigurationRecord.cs
@@ -237,8 +237,7 @@ internal ConfigurationSectionGroup GetSectionGroup(string configKey)
ConfigurationSectionGroup configSectionGroup = LookupSectionGroup(configKey);
if (configSectionGroup != null) return configSectionGroup;
- BaseConfigurationRecord configRecord;
- FactoryRecord factoryRecord = FindFactoryRecord(configKey, false, out configRecord);
+ FactoryRecord factoryRecord = FindFactoryRecord(configKey, false, out _);
if (factoryRecord == null) return null;
if (!factoryRecord.IsGroup) throw ExceptionUtil.ParameterInvalid("sectionGroupName");
@@ -359,9 +358,8 @@ internal ConfigurationSection FindImmediateParentSection(ConfigurationSection se
FactoryRecord factoryRecord = GetFactoryRecord(configKey, false);
object resultObject;
- object resultRuntimeObject;
CreateSectionDefault(configKey, false, factoryRecord, null, out resultObject,
- out resultRuntimeObject);
+ out _);
result = (ConfigurationSection)resultObject;
}
else
diff --git a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/NameValueFileSectionHandler.cs b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/NameValueFileSectionHandler.cs
index d434bd577a2e7d..11abcd0076ce74 100644
--- a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/NameValueFileSectionHandler.cs
+++ b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/NameValueFileSectionHandler.cs
@@ -28,7 +28,7 @@ public object Create(object parent, object configContext, XmlNode section)
if (fileAttribute != null && fileAttribute.Value.Length != 0)
{
- string filename = null;
+ string filename;
filename = fileAttribute.Value;
IConfigErrorInfo configXmlNode = fileAttribute as IConfigErrorInfo;
if (configXmlNode == null)
diff --git a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/SectionUpdates.cs b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/SectionUpdates.cs
index d56275b403756d..d67be0bafaa62c 100644
--- a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/SectionUpdates.cs
+++ b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/SectionUpdates.cs
@@ -29,10 +29,10 @@ internal SectionUpdates(string name)
// Find the SectionUpdates for a configKey, and create it if it does not exist.
private SectionUpdates FindSectionUpdates(string configKey, bool isGroup)
{
- string group, dummy;
+ string group;
if (isGroup) group = configKey;
- else BaseConfigurationRecord.SplitConfigKey(configKey, out group, out dummy);
+ else BaseConfigurationRecord.SplitConfigKey(configKey, out group, out _);
Debug.Assert(string.IsNullOrEmpty(_name), "FindSectionUpdates assumes search is from root record");
SectionUpdates sectionUpdates = this;
diff --git a/src/libraries/System.Console/src/System/ConsolePal.Unix.cs b/src/libraries/System.Console/src/System/ConsolePal.Unix.cs
index 2b55bf8c578381..46194297336690 100644
--- a/src/libraries/System.Console/src/System/ConsolePal.Unix.cs
+++ b/src/libraries/System.Console/src/System/ConsolePal.Unix.cs
@@ -342,7 +342,7 @@ public static int WindowWidth
{
get
{
- GetWindowSize(out int width, out int height);
+ GetWindowSize(out int width, out _);
return width;
}
set { throw new PlatformNotSupportedException(); }
@@ -352,7 +352,7 @@ public static int WindowHeight
{
get
{
- GetWindowSize(out int width, out int height);
+ GetWindowSize(out _, out int height);
return height;
}
set { throw new PlatformNotSupportedException(); }
diff --git a/src/libraries/System.Console/src/System/ConsolePal.Windows.cs b/src/libraries/System.Console/src/System/ConsolePal.Windows.cs
index 9542a6ea15345e..32cb7659d51932 100644
--- a/src/libraries/System.Console/src/System/ConsolePal.Windows.cs
+++ b/src/libraries/System.Console/src/System/ConsolePal.Windows.cs
@@ -93,9 +93,8 @@ private static unsafe bool ConsoleHandleIsWritable(IntPtr outErrHandle)
// stdin, stdout and stderr, but they may not be readable or
// writable. Verify this by calling WriteFile in the
// appropriate modes. This must handle console-less Windows apps.
- int bytesWritten;
byte junkByte = 0x41;
- int r = Interop.Kernel32.WriteFile(outErrHandle, &junkByte, 0, out bytesWritten, IntPtr.Zero);
+ int r = Interop.Kernel32.WriteFile(outErrHandle, &junkByte, 0, out _, IntPtr.Zero);
return r != 0; // In Win32 apps w/ no console, bResult should be 0 for failure.
}
@@ -273,11 +272,9 @@ public static bool KeyAvailable
if (_cachedInputRecord.eventType == Interop.KEY_EVENT)
return true;
- Interop.InputRecord ir = default;
- int numEventsRead = 0;
while (true)
{
- bool r = Interop.Kernel32.PeekConsoleInput(InputHandle, out ir, 1, out numEventsRead);
+ bool r = Interop.Kernel32.PeekConsoleInput(InputHandle, out Interop.InputRecord ir, 1, out int numEventsRead);
if (!r)
{
int errorCode = Marshal.GetLastPInvokeError();
@@ -292,7 +289,7 @@ public static bool KeyAvailable
// Skip non key-down && mod key events.
if (!IsKeyDownEvent(ir) || IsModKey(ir))
{
- r = Interop.Kernel32.ReadConsoleInput(InputHandle, out ir, 1, out numEventsRead);
+ r = Interop.Kernel32.ReadConsoleInput(InputHandle, out _, 1, out _);
if (!r)
throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError());
@@ -310,7 +307,6 @@ public static bool KeyAvailable
public static ConsoleKeyInfo ReadKey(bool intercept)
{
Interop.InputRecord ir;
- int numEventsRead = -1;
bool r;
lock (s_readKeySyncObject)
@@ -334,7 +330,7 @@ public static ConsoleKeyInfo ReadKey(bool intercept)
while (true)
{
- r = Interop.Kernel32.ReadConsoleInput(InputHandle, out ir, 1, out numEventsRead);
+ r = Interop.Kernel32.ReadConsoleInput(InputHandle, out ir, 1, out int numEventsRead);
if (!r || numEventsRead == 0)
{
// This will fail when stdin is redirected from a file or pipe.
@@ -411,8 +407,7 @@ public static bool TreatControlCAsInput
if (handle == InvalidHandleValue)
throw new IOException(SR.IO_NoConsole);
- int mode = 0;
- if (!Interop.Kernel32.GetConsoleMode(handle, out mode))
+ if (!Interop.Kernel32.GetConsoleMode(handle, out int mode))
throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError());
return (mode & Interop.Kernel32.ENABLE_PROCESSED_INPUT) == 0;
@@ -423,8 +418,7 @@ public static bool TreatControlCAsInput
if (handle == InvalidHandleValue)
throw new IOException(SR.IO_NoConsole);
- int mode = 0;
- if (!Interop.Kernel32.GetConsoleMode(handle, out mode))
+ if (!Interop.Kernel32.GetConsoleMode(handle, out int mode))
throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError());
if (value)
@@ -767,17 +761,15 @@ public static void Clear()
// fill the entire screen with blanks
- int numCellsWritten = 0;
success = Interop.Kernel32.FillConsoleOutputCharacter(hConsole, ' ',
- conSize, coordScreen, out numCellsWritten);
+ conSize, coordScreen, out _);
if (!success)
throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError());
// now set the buffer's attributes accordingly
- numCellsWritten = 0;
success = Interop.Kernel32.FillConsoleOutputAttribute(hConsole, csbi.wAttributes,
- conSize, coordScreen, out numCellsWritten);
+ conSize, coordScreen, out _);
if (!success)
throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastPInvokeError());
@@ -1042,8 +1034,7 @@ private static ConsoleColor ColorAttributeToConsoleColor(Interop.Kernel32.Color
private static Interop.Kernel32.CONSOLE_SCREEN_BUFFER_INFO GetBufferInfo()
{
- bool unused;
- return GetBufferInfo(true, out unused);
+ return GetBufferInfo(true, out _);
}
// For apps that don't have a console (like Windows apps), they might
diff --git a/src/libraries/System.Console/src/System/IO/StdInReader.cs b/src/libraries/System.Console/src/System/IO/StdInReader.cs
index fe0ab79f4fb7b6..c5ba73ff740b3d 100644
--- a/src/libraries/System.Console/src/System/IO/StdInReader.cs
+++ b/src/libraries/System.Console/src/System/IO/StdInReader.cs
@@ -391,12 +391,11 @@ internal bool MapBufferToConsoleKey(out ConsoleKey key, out char ch, out bool is
}
// Check if we can match Esc + combination and guess if alt was pressed.
- isAlt = isCtrl = isShift = false;
if (_unprocessedBufferToBeRead[_startIndex] == (char)0x1B && // Alt is send as an escape character
_endIndex - _startIndex >= 2) // We have at least two characters to read
{
_startIndex++;
- if (MapBufferToConsoleKey(out key, out ch, out isShift, out isAlt, out isCtrl))
+ if (MapBufferToConsoleKey(out key, out ch, out isShift, out _, out isCtrl))
{
isAlt = true;
return true;
@@ -416,7 +415,7 @@ internal bool MapBufferToConsoleKey(out ConsoleKey key, out char ch, out bool is
// Try reading the first char in the buffer and interpret it as a key.
ch = _unprocessedBufferToBeRead[_startIndex++];
key = GetKeyFromCharValue(ch, out isShift, out isCtrl);
-
+ isAlt = false;
return key != default(ConsoleKey);
}
diff --git a/src/libraries/System.Console/tests/ConsoleKeyInfoTests.cs b/src/libraries/System.Console/tests/ConsoleKeyInfoTests.cs
index da3720a43d0159..c4410457e8850f 100644
--- a/src/libraries/System.Console/tests/ConsoleKeyInfoTests.cs
+++ b/src/libraries/System.Console/tests/ConsoleKeyInfoTests.cs
@@ -33,6 +33,7 @@ public void Ctor_ValueCtor_ValuesPassedToProperties(bool shift, bool alt, bool c
[Theory]
[MemberData(nameof(SampleConsoleKeyInfos))]
+ [SkipOnCoreClr("https://github.com/dotnet/runtime/issues/60240", RuntimeTestModes.JitStressRegs)]
public void Equals_SameData(ConsoleKeyInfo cki)
{
ConsoleKeyInfo other = cki; // otherwise compiler warns about comparing the instance with itself
diff --git a/src/libraries/System.Data.Common/src/System/Data/Common/DataRecordInternal.cs b/src/libraries/System.Data.Common/src/System/Data/Common/DataRecordInternal.cs
index ba0a44032fc694..046366210dc550 100644
--- a/src/libraries/System.Data.Common/src/System/Data/Common/DataRecordInternal.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/Common/DataRecordInternal.cs
@@ -104,7 +104,7 @@ public override byte GetByte(int i)
public override long GetBytes(int i, long dataIndex, byte[]? buffer, int bufferIndex, int length)
{
- int cbytes = 0;
+ int cbytes;
int ndataIndex;
byte[] data = (byte[])_values[i];
diff --git a/src/libraries/System.Data.Common/src/System/Data/Common/DbConnectionStringBuilder.cs b/src/libraries/System.Data.Common/src/System/Data/Common/DbConnectionStringBuilder.cs
index 13552bc01785ef..c25c75a80c877d 100644
--- a/src/libraries/System.Data.Common/src/System/Data/Common/DbConnectionStringBuilder.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/Common/DbConnectionStringBuilder.cs
@@ -88,7 +88,7 @@ public virtual object this[string keyword]
set
{
ADP.CheckArgumentNull(keyword, nameof(keyword));
- bool flag = false;
+ bool flag;
if (null != value)
{
string keyvalue = DbConnectionStringBuilderUtil.ConvertToString(value);
@@ -431,7 +431,7 @@ protected virtual void GetProperties(Hashtable propertyDescriptors)
{
// Below call is necessary to tell the trimmer that it should mark derived types appropriately.
// We cannot use overload which takes type because the result might differ if derived class implements ICustomTypeDescriptor.
- Type thisType = GetType();
+ GetType();
// show all strongly typed properties (not already added)
// except ConnectionString iff BrowsableConnectionString
@@ -587,7 +587,7 @@ private PropertyDescriptorCollection GetProperties(Attribute[]? attributes)
{
// Below call is necessary to tell the trimmer that it should mark derived types appropriately.
// We cannot use overload which takes type because the result might differ if derived class implements ICustomTypeDescriptor.
- Type thisType = GetType();
+ GetType();
return TypeDescriptor.GetClassName(this, true);
}
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
@@ -596,7 +596,7 @@ private PropertyDescriptorCollection GetProperties(Attribute[]? attributes)
{
// Below call is necessary to tell the trimmer that it should mark derived types appropriately.
// We cannot use overload which takes type because the result might differ if derived class implements ICustomTypeDescriptor.
- Type thisType = GetType();
+ GetType();
return TypeDescriptor.GetComponentName(this, true);
}
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode",
@@ -641,7 +641,7 @@ EventDescriptorCollection ICustomTypeDescriptor.GetEvents()
{
// Below call is necessary to tell the trimmer that it should mark derived types appropriately.
// We cannot use overload which takes type because the result might differ if derived class implements ICustomTypeDescriptor.
- Type thisType = GetType();
+ GetType();
return TypeDescriptor.GetEvents(this, true);
}
[RequiresUnreferencedCode("The public parameterless constructor or the 'Default' static field may be trimmed from the Attribute's Type.")]
diff --git a/src/libraries/System.Data.Common/src/System/Data/Common/DbDataAdapter.cs b/src/libraries/System.Data.Common/src/System/Data/Common/DbDataAdapter.cs
index 0dbff5981b22df..1c202420c6fa0d 100644
--- a/src/libraries/System.Data.Common/src/System/Data/Common/DbDataAdapter.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/Common/DbDataAdapter.cs
@@ -1598,7 +1598,7 @@ private void UpdateRowExecute(RowUpdatedEventArgs rowUpdatedEvent, IDbCommand da
private int UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, int commandCount)
{
Debug.Assert(null != rowUpdatedEvent, "null rowUpdatedEvent");
- int cumulativeDataRowsAffected = 0;
+ int cumulativeDataRowsAffected;
switch (rowUpdatedEvent.Status)
{
case UpdateStatus.Continue:
diff --git a/src/libraries/System.Data.Common/src/System/Data/Common/ObjectStorage.cs b/src/libraries/System.Data.Common/src/System/Data/Common/ObjectStorage.cs
index 7489652d9ba155..0aa98075f37648 100644
--- a/src/libraries/System.Data.Common/src/System/Data/Common/ObjectStorage.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/Common/ObjectStorage.cs
@@ -351,7 +351,7 @@ public override object ConvertXmlToObject(string s)
[RequiresUnreferencedCode(DataSet.RequiresUnreferencedCodeMessage)]
public override object ConvertXmlToObject(XmlReader xmlReader, XmlRootAttribute? xmlAttrib)
{
- object? retValue = null;
+ object? retValue;
bool isBaseCLRType = false;
bool legacyUDT = false; // in 1.0 and 1.1 we used to call ToString on CDT obj. so if we have the same case
// we need to handle the case when we have column type as object.
diff --git a/src/libraries/System.Data.Common/src/System/Data/ConstraintCollection.cs b/src/libraries/System.Data.Common/src/System/Data/ConstraintCollection.cs
index a9d8ac3f1f0218..275c652b3ee82f 100644
--- a/src/libraries/System.Data.Common/src/System/Data/ConstraintCollection.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/ConstraintCollection.cs
@@ -624,11 +624,10 @@ internal int InternalIndexOf(string? constraintName)
if ((null != constraintName) && (0 < constraintName.Length))
{
int constraintCount = List.Count;
- int result = 0;
for (int i = 0; i < constraintCount; i++)
{
Constraint constraint = (Constraint)List[i]!;
- result = NamesEqual(constraint.ConstraintName, constraintName, false, _table.Locale);
+ int result = NamesEqual(constraint.ConstraintName, constraintName, false, _table.Locale);
if (result == 1)
return i;
diff --git a/src/libraries/System.Data.Common/src/System/Data/DataColumnCollection.cs b/src/libraries/System.Data.Common/src/System/Data/DataColumnCollection.cs
index cfe21932b0a1ea..252b84fa2efaab 100644
--- a/src/libraries/System.Data.Common/src/System/Data/DataColumnCollection.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/DataColumnCollection.cs
@@ -566,7 +566,7 @@ internal bool CanRemove(DataColumn? column, bool fThrowException)
// while index events are suspended else the indexes won't be properly maintained.
// However, all the above checks should catch those participating columns.
// except when a column is in a DataView RowFilter or Sort clause
- foreach (Index index in _table.LiveIndexes) { }
+ foreach (Index _ in _table.LiveIndexes) { }
return true;
}
@@ -723,10 +723,9 @@ internal int IndexOfCaseInsensitive(string name)
{
int hashcode = _table.GetSpecialHashCode(name);
int cachedI = -1;
- DataColumn? column = null;
for (int i = 0; i < Count; i++)
{
- column = (DataColumn)_list[i]!;
+ DataColumn column = (DataColumn)_list[i]!;
if ((hashcode == 0 || column._hashCode == 0 || column._hashCode == hashcode) &&
NamesEqual(column.ColumnName, name, false, _table.Locale) != 0)
{
diff --git a/src/libraries/System.Data.Common/src/System/Data/DataRelationCollection.cs b/src/libraries/System.Data.Common/src/System/Data/DataRelationCollection.cs
index 1bec593c84971e..7738305236ee7f 100644
--- a/src/libraries/System.Data.Common/src/System/Data/DataRelationCollection.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/DataRelationCollection.cs
@@ -336,11 +336,10 @@ internal int InternalIndexOf(string? name)
if ((null != name) && (0 < name.Length))
{
int count = List.Count;
- int result = 0;
for (int i = 0; i < count; i++)
{
DataRelation relation = (DataRelation)List[i]!;
- result = NamesEqual(relation.RelationName, name, false, GetDataSet().Locale);
+ int result = NamesEqual(relation.RelationName, name, false, GetDataSet().Locale);
if (result == 1)
{
return i;
diff --git a/src/libraries/System.Data.Common/src/System/Data/DataRow.cs b/src/libraries/System.Data.Common/src/System/Data/DataRow.cs
index 19b725110bb143..b9f35e9a651890 100644
--- a/src/libraries/System.Data.Common/src/System/Data/DataRow.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/DataRow.cs
@@ -1204,7 +1204,7 @@ public void RejectChanges()
}
foreach (DataColumn dc in _columns.ColumnsImplementingIChangeTracking)
{
- object? value = null;
+ object? value;
if (RowState != DataRowState.Deleted)
value = this[dc];
else
@@ -1426,7 +1426,6 @@ internal int CopyValuesIntoStore(ArrayList storeList, ArrayList nullbitList, int
_columns[i].CopyValueIntoStore(_tempRecord, storeList[i]!, (BitArray)nullbitList[i]!, storeIndex);
}
recordCount++;
- storeIndex++;
}
return recordCount;
diff --git a/src/libraries/System.Data.Common/src/System/Data/DataSet.cs b/src/libraries/System.Data.Common/src/System/Data/DataSet.cs
index b2a85e44b382eb..7778e96c3b5a7b 100644
--- a/src/libraries/System.Data.Common/src/System/Data/DataSet.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/DataSet.cs
@@ -357,15 +357,13 @@ private void SerializeDataSet(SerializationInfo info, StreamingContext context,
// old behaviour
string strSchema = GetXmlSchemaForRemoting(null);
- string? strData = null;
info.AddValue(KEY_XMLSCHEMA, strSchema);
StringBuilder strBuilder = new StringBuilder(EstimatedXmlStringSize() * 2);
StringWriter strWriter = new StringWriter(strBuilder, CultureInfo.InvariantCulture);
XmlTextWriter w = new XmlTextWriter(strWriter);
WriteXml(w, XmlWriteMode.DiffGram);
- strData = strWriter.ToString();
- info.AddValue(KEY_XMLDIFFGRAM, strData);
+ info.AddValue(KEY_XMLDIFFGRAM, strWriter.ToString());
}
}
@@ -1978,7 +1976,7 @@ private void WriteXmlSchema(XmlWriter? writer, SchemaFormat schemaFormat, Conver
// Generate SchemaTree and write it out
if (writer != null)
{
- XmlTreeGen? treeGen = null;
+ XmlTreeGen treeGen;
if (schemaFormat == SchemaFormat.WebService &&
SchemaSerializationMode == SchemaSerializationMode.ExcludeSchema &&
writer.WriteState == WriteState.Element)
@@ -2804,7 +2802,7 @@ public XmlReadMode ReadXml(TextReader? reader, XmlReadMode mode)
[RequiresUnreferencedCode(RequiresUnreferencedCodeMessage)]
public XmlReadMode ReadXml(string fileName, XmlReadMode mode)
{
- XmlTextReader? xr = null;
+ XmlTextReader xr;
if (mode == XmlReadMode.Fragment)
{
FileStream stream = new FileStream(fileName, FileMode.Open);
@@ -3262,8 +3260,8 @@ internal bool ValidateCaseConstraint()
}
}
- ForeignKeyConstraint? constraint = null;
- ConstraintCollection? constraints = null;
+ ForeignKeyConstraint? constraint;
+ ConstraintCollection? constraints;
for (int i = 0; i < Tables.Count; i++)
{
constraints = Tables[i].Constraints;
@@ -3302,8 +3300,8 @@ internal bool ValidateLocaleConstraint()
}
}
- ForeignKeyConstraint? constraint = null;
- ConstraintCollection? constraints = null;
+ ForeignKeyConstraint? constraint;
+ ConstraintCollection? constraints;
for (int i = 0; i < Tables.Count; i++)
{
constraints = Tables[i].Constraints;
diff --git a/src/libraries/System.Data.Common/src/System/Data/DataTable.cs b/src/libraries/System.Data.Common/src/System/Data/DataTable.cs
index 3759b0a04ddd0a..be4c83ae79967c 100644
--- a/src/libraries/System.Data.Common/src/System/Data/DataTable.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/DataTable.cs
@@ -1622,7 +1622,7 @@ public DataColumn[] PrimaryKey
set
{
UniqueConstraint? key = null;
- UniqueConstraint? existingKey = null;
+ UniqueConstraint? existingKey;
// Loading with persisted property
if (fInitInProgress && value != null)
@@ -2176,7 +2176,7 @@ internal DataRow MergeRow(DataRow row, DataRow? targetRow, bool preserveChanges,
try
{
DataRowState saveRowState = targetRow.RowState;
- int saveIdxRecord = (saveRowState == DataRowState.Added) ? targetRow._newRecord : saveIdxRecord = targetRow._oldRecord;
+ int saveIdxRecord = (saveRowState == DataRowState.Added) ? targetRow._newRecord : targetRow._oldRecord;
int newRecord;
int oldRecord;
if (targetRow.RowState == DataRowState.Unchanged && row.RowState == DataRowState.Unchanged)
@@ -2737,7 +2737,7 @@ internal DataRow AddRecords(int oldRecord, int newRecord)
internal void InsertRow(DataRow row, long proposedID, int pos, bool fireEvent)
{
- Exception? deferredException = null;
+ Exception? deferredException;
if (row == null)
{
@@ -3920,7 +3920,7 @@ internal void SilentlySetValue(DataRow dr, DataColumn dc, DataRowVersion version
// get record for version
int record = dr.GetRecordFromVersion(version);
- bool equalValues = false;
+ bool equalValues;
if (DataStorage.IsTypeCustomType(dc.DataType) && newValue != dc[record])
{
// if UDT storage, need to check if reference changed.
@@ -4245,7 +4245,7 @@ public DataRow[] Select(string? filterExpression, string? sort, DataViewRowState
internal void SetNewRecord(DataRow row, int proposedRecord, DataRowAction action = DataRowAction.Change, bool isInMerge = false, bool fireEvent = true, bool suppressEnsurePropertyChanged = false)
{
- Exception? deferredException = null;
+ Exception? deferredException;
SetNewRecordWorker(row, proposedRecord, action, isInMerge, suppressEnsurePropertyChanged, -1, fireEvent, out deferredException); // we are going to call below overload from insert
if (deferredException != null)
{
diff --git a/src/libraries/System.Data.Common/src/System/Data/DataTableCollection.cs b/src/libraries/System.Data.Common/src/System/Data/DataTableCollection.cs
index e4dd6960869569..0dc5aa0510d6d4 100644
--- a/src/libraries/System.Data.Common/src/System/Data/DataTableCollection.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/DataTableCollection.cs
@@ -259,7 +259,7 @@ public event CollectionChangeEventHandler? CollectionChanging
///
internal string AssignName()
{
- string? newName = null;
+ string newName;
while (Contains(newName = MakeName(_defaultNameIndex)))
{
_defaultNameIndex++;
@@ -631,7 +631,7 @@ internal int InternalIndexOf(string? tableName)
if ((null != tableName) && (0 < tableName.Length))
{
int count = _list.Count;
- int result = 0;
+ int result;
for (int i = 0; i < count; i++)
{
DataTable table = (DataTable)_list[i]!;
@@ -668,7 +668,7 @@ internal int InternalIndexOf(string? tableName, string tableNamespace)
if ((null != tableName) && (0 < tableName.Length))
{
int count = _list.Count;
- int result = 0;
+ int result;
for (int i = 0; i < count; i++)
{
DataTable table = (DataTable)_list[i]!;
diff --git a/src/libraries/System.Data.Common/src/System/Data/Filter/BinaryNode.cs b/src/libraries/System.Data.Common/src/System/Data/Filter/BinaryNode.cs
index 03c7c208352086..0919dc0361394a 100644
--- a/src/libraries/System.Data.Common/src/System/Data/Filter/BinaryNode.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/Filter/BinaryNode.cs
@@ -1437,7 +1437,7 @@ internal StorageType ResultSqlType(StorageType left, StorageType right, bool lc,
DataTypePrecedence higherPrec = (DataTypePrecedence)Math.Max(leftPrecedence, rightPrecedence);
- StorageType result = GetPrecedenceType(higherPrec);
+ StorageType result;
// if we have at least one Sql type, the intermediate result should be Sql type
result = GetPrecedenceType((DataTypePrecedence)SqlResultType((int)higherPrec));
@@ -1598,7 +1598,7 @@ internal string AnalyzePattern(string pat)
char[] patchars = new char[length + 1];
pat.CopyTo(0, patchars, 0, length);
patchars[length] = (char)0;
- string? substring = null;
+ string? substring;
char[] constchars = new char[length + 1];
int newLength = 0;
diff --git a/src/libraries/System.Data.Common/src/System/Data/Filter/ExpressionParser.cs b/src/libraries/System.Data.Common/src/System/Data/Filter/ExpressionParser.cs
index 83a5066a4261c5..5972b3d3c4357b 100644
--- a/src/libraries/System.Data.Common/src/System/Data/Filter/ExpressionParser.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/Filter/ExpressionParser.cs
@@ -207,7 +207,7 @@ internal ExpressionNode Parse()
case Tokens.StringConst:
case Tokens.Date:
ExpressionNode? node = null;
- string? str = null;
+ string? str;
/* Constants and identifiers: create leaf node */
@@ -264,7 +264,6 @@ internal ExpressionNode Parse()
ScanToken(Tokens.Name);
colname = NameNode.ParseName(_text, _start, _pos);
- opInfo = _ops[_topOperator - 1];
node = new LookupNode(_table, colname, relname);
break;
@@ -272,7 +271,6 @@ internal ExpressionNode Parse()
case Tokens.Name:
/* Qualify name now for nice error checking */
- opInfo = _ops[_topOperator - 1];
/* Create tree element - */
// CONSIDER: Check for reserved proc names here
@@ -655,7 +653,7 @@ private void NodePush(ExpressionNode node)
private void BuildExpression(int pri)
{
- ExpressionNode? expr = null;
+ ExpressionNode? expr;
Debug.Assert(pri > Operators.priStart && pri <= Operators.priMax, "Invalid priority value");
diff --git a/src/libraries/System.Data.Common/src/System/Data/Filter/UnaryNode.cs b/src/libraries/System.Data.Common/src/System/Data/Filter/UnaryNode.cs
index 5e0fcb37424479..a7a32ed98825be 100644
--- a/src/libraries/System.Data.Common/src/System/Data/Filter/UnaryNode.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/Filter/UnaryNode.cs
@@ -47,7 +47,7 @@ internal override object Eval(int[] recordNos)
private object EvalUnaryOp(int op, object vl)
{
- object value = DBNull.Value;
+ object value;
if (DataExpression.IsUnknown(vl))
return DBNull.Value;
diff --git a/src/libraries/System.Data.Common/src/System/Data/ForeignKeyConstraint.cs b/src/libraries/System.Data.Common/src/System/Data/ForeignKeyConstraint.cs
index 39d130e4ff0f48..1513b767d212b0 100644
--- a/src/libraries/System.Data.Common/src/System/Data/ForeignKeyConstraint.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/ForeignKeyConstraint.cs
@@ -599,7 +599,7 @@ internal override void CheckConstraint(DataRow childRow, DataRowAction action)
// could be self-join constraint
if (_childKey.Table == _parentKey.Table && childRow._tempRecord != -1)
{
- int lo = 0;
+ int lo;
for (lo = 0; lo < childValues.Length; lo++)
{
DataColumn column = _parentKey.ColumnsReference[lo];
@@ -761,12 +761,10 @@ internal override bool ContainsColumn(DataColumn column) =>
DataColumn[] columns = new DataColumn[keys];
DataColumn[] relatedColumns = new DataColumn[keys];
- int iDest = 0;
-
for (int i = 0; i < keys; i++)
{
DataColumn src = Columns[i];
- iDest = destination.Columns.IndexOf(src.ColumnName);
+ int iDest = destination.Columns.IndexOf(src.ColumnName);
if (iDest < 0)
{
return null;
diff --git a/src/libraries/System.Data.Common/src/System/Data/Merger.cs b/src/libraries/System.Data.Common/src/System/Data/Merger.cs
index 616acba1372b0a..109e2119790d89 100644
--- a/src/libraries/System.Data.Common/src/System/Data/Merger.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/Merger.cs
@@ -285,7 +285,6 @@ internal void MergeRows(DataRow[] rows)
if (null != ndxSearch)
{
ndxSearch.RemoveRef();
- ndxSearch = null;
}
ndxSearch = new Index(dst, dst._primaryKey!.Key.GetIndexDesc(), DataViewRowState.OriginalRows | DataViewRowState.Added, null);
ndxSearch.AddRef(); // need to addref twice, otherwise it will be collected
@@ -314,7 +313,6 @@ internal void MergeRows(DataRow[] rows)
if (null != ndxSearch)
{
ndxSearch.RemoveRef();
- ndxSearch = null;
}
_dataSet.EnforceConstraints = fEnforce;
diff --git a/src/libraries/System.Data.Common/src/System/Data/RbTree.cs b/src/libraries/System.Data.Common/src/System/Data/RbTree.cs
index a5f75b089899bc..a7892bdf9816a9 100644
--- a/src/libraries/System.Data.Common/src/System/Data/RbTree.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/RbTree.cs
@@ -342,7 +342,7 @@ public bool HasDuplicates
private int GetNewNode(K? key)
{
// find page with free slots, if none, allocate a new page
- TreePage? page = null;
+ TreePage? page;
int freePageIndex = GetIndexOfPageWithFreeSlot(true);
if (freePageIndex != -1)
@@ -1479,7 +1479,7 @@ private int ComputeNodeByIndex(int index, out int satelliteRootId)
satelliteRootId = NIL;
int x_id = root;
- int rank = -1;
+ int rank;
while (x_id != NIL && !(((rank = SubTreeSize(Left(x_id)) + 1) == index) && Next(x_id) == NIL))
{
if (index < rank)
@@ -1972,8 +1972,8 @@ internal TreePage(int size)
*/
internal int AllocSlot(RBTree tree)
{
- int segmentPos = 0; // index into _SlotMap
- int freeSlot = 0; // Uint, slot offset within the segment
+ int segmentPos; // index into _SlotMap
+ int freeSlot; // Uint, slot offset within the segment
int freeSlotId = -1; // 0 based slot position
if (_inUseCount < _slots.Length)
@@ -1983,7 +1983,6 @@ internal int AllocSlot(RBTree tree)
{
if (unchecked((uint)_slotMap[segmentPos]) < 0xFFFFFFFF)
{
- freeSlotId = 0;
freeSlot = (~(_slotMap[segmentPos])) & unchecked(_slotMap[segmentPos] + 1);
// avoid string concat to allow debug code to run faster
diff --git a/src/libraries/System.Data.Common/src/System/Data/RelationshipConverter.cs b/src/libraries/System.Data.Common/src/System/Data/RelationshipConverter.cs
index 94450f9c80d57e..c768b3c5e89451 100644
--- a/src/libraries/System.Data.Common/src/System/Data/RelationshipConverter.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/RelationshipConverter.cs
@@ -41,8 +41,8 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destina
throw new ArgumentNullException(nameof(destinationType));
}
- System.Reflection.ConstructorInfo? ctor = null;
- object[]? values = null;
+ System.Reflection.ConstructorInfo? ctor;
+ object[]? values;
if (destinationType == typeof(InstanceDescriptor) && value is DataRelation)
{
diff --git a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLBytes.cs b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLBytes.cs
index b04d39205ba3da..9045b9a1c352da 100644
--- a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLBytes.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLBytes.cs
@@ -660,7 +660,7 @@ public override long Seek(long offset, SeekOrigin origin)
{
CheckIfStreamClosed();
- long lPosition = 0;
+ long lPosition;
switch (origin)
{
diff --git a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLChars.cs b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLChars.cs
index dfb18b73ab6529..7719da00f1b3d7 100644
--- a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLChars.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLChars.cs
@@ -494,7 +494,7 @@ private void SetBuffer(char[] buffer)
void IXmlSerializable.ReadXml(XmlReader r)
{
- char[]? value = null;
+ char[]? value;
string? isNull = r.GetAttribute("nil", XmlSchema.InstanceNamespace);
@@ -615,7 +615,7 @@ public long Seek(long offset, SeekOrigin origin)
{
CheckIfStreamClosed();
- long lPosition = 0;
+ long lPosition;
switch (origin)
{
diff --git a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLDecimal.cs b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLDecimal.cs
index 64e7815e2945c4..784d50d2bb1cfc 100644
--- a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLDecimal.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLDecimal.cs
@@ -703,7 +703,6 @@ public SqlDecimal(double dVal) : this(false)
{
dVal = Math.Floor(dInt / s_DUINT_BASE);
_data4 = (uint)(dInt - dVal * s_DUINT_BASE);
- dInt = dVal;
_bLen++;
}
}
@@ -1123,7 +1122,7 @@ public double ToDouble()
if (IsNull)
throw new SqlNullValueException();
- double dRet = 0.0;
+ double dRet;
dRet = _data4;
dRet = dRet * s_lInt32Base + _data3;
@@ -2729,9 +2728,8 @@ out int ciulR // Out | # of digits in R
// D8. Unnormalize: Divide D and R to get result
if (D1 > 1)
{
- uint ret;
- MpDiv1(rgulD, ref ciulD, D1, out ret);
- MpDiv1(rgulR, ref ciulR, D1, out ret);
+ MpDiv1(rgulD, ref ciulD, D1, out _);
+ MpDiv1(rgulR, ref ciulR, D1, out _);
}
}
}
diff --git a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLString.cs b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLString.cs
index 9cd3c54c860003..cac4122feba684 100644
--- a/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLString.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLString.cs
@@ -409,7 +409,7 @@ private static SqlBoolean Compare(SqlString x, SqlString y, EComparison ecExpect
int iCmpResult = StringCompare(x, y);
- bool fResult = false;
+ bool fResult;
switch (ecExpectedResult)
{
diff --git a/src/libraries/System.Data.Common/src/System/Data/Select.cs b/src/libraries/System.Data.Common/src/System/Data/Select.cs
index 79c273c1d5dc94..06f22adc9765a8 100644
--- a/src/libraries/System.Data.Common/src/System/Data/Select.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/Select.cs
@@ -691,7 +691,7 @@ private int Eval(BinaryNode expr, DataRow row, DataRowVersion version)
// use InvariantCulture instead of DataTable.Locale because in the Danish related cultures
// sorting a Guid as a string has different results than in Invariant and English related cultures.
// This fix is restricted to DataTable.Select("GuidColumn = 'string literal'") types of queries
- NameNode? namedNode = null;
+ NameNode? namedNode;
System.Globalization.CompareInfo? comparer =
((isLConst && !isRConst && (leftType == StorageType.String) && (rightType == StorageType.Guid) && (null != (namedNode = expr._right as NameNode)) && (namedNode._column!.DataType == typeof(Guid))) ||
(isRConst && !isLConst && (rightType == StorageType.String) && (leftType == StorageType.Guid) && (null != (namedNode = expr._left as NameNode)) && (namedNode._column!.DataType == typeof(Guid))))
diff --git a/src/libraries/System.Data.Common/src/System/Data/XDRSchema.cs b/src/libraries/System.Data.Common/src/System/Data/XDRSchema.cs
index a025c3f7f2beaf..37cd34e6f79e34 100644
--- a/src/libraries/System.Data.Common/src/System/Data/XDRSchema.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/XDRSchema.cs
@@ -383,7 +383,7 @@ internal void HandleColumn(XmlElement node, DataTable table)
}
else
{
- strName = instanceName = string.Empty;
+ instanceName = string.Empty;
}
// Now get the type
@@ -443,8 +443,6 @@ internal void HandleColumn(XmlElement node, DataTable table)
GetMinMax(node, isAttribute, ref minOccurs, ref maxOccurs);
- strDefault = null;
-
// Does XDR has default?
strDefault = node.GetAttribute(Keywords.DEFAULT);
diff --git a/src/libraries/System.Data.Common/src/System/Data/XMLDiffLoader.cs b/src/libraries/System.Data.Common/src/System/Data/XMLDiffLoader.cs
index df87d51e94541c..2ab54d821686eb 100644
--- a/src/libraries/System.Data.Common/src/System/Data/XMLDiffLoader.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/XMLDiffLoader.cs
@@ -86,9 +86,7 @@ internal void ProcessDiffs(DataSet ds, XmlReader ssync)
while (iSsyncDepth < ssync.Depth)
{
tableBefore = null;
- string? diffId = null;
-
- oldRowRecord = -1;
+ string? diffId;
// the diffgramm always contains sql:before and sql:after pairs
@@ -141,7 +139,6 @@ internal void ProcessDiffs(ArrayList tableList, XmlReader ssync)
tableBefore = null;
string diffId;
- oldRowRecord = -1;
// the diffgramm always contains sql:before and sql:after pairs
@@ -308,7 +305,7 @@ private int ReadOldRowData(DataSet? ds, ref DataTable? table, ref int pos, XmlRe
}
int iRowDepth = row.Depth;
- string? value = null;
+ string? value;
value = row.GetAttribute(Keywords.ROWORDER, Keywords.MSDNS);
if (!string.IsNullOrEmpty(value))
diff --git a/src/libraries/System.Data.Common/src/System/Data/XMLSchema.cs b/src/libraries/System.Data.Common/src/System/Data/XMLSchema.cs
index f103604b74c9f2..20e3c2140ba8a7 100644
--- a/src/libraries/System.Data.Common/src/System/Data/XMLSchema.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/XMLSchema.cs
@@ -916,7 +916,7 @@ internal void HandleParticle(XmlSchemaParticle pt, DataTable table, ArrayList ta
el.MaxOccurs = pt.MaxOccurs;
- DataTable? child = null;
+ DataTable? child;
// to decide if element is our table, we need to match both name and ns
// 286043 - SQL BU Defect Tracking
if (((el.Name == null) && (el.RefName.Name == table.EncodedTableName && el.RefName.Namespace == table.Namespace)) ||
@@ -1340,7 +1340,7 @@ internal void HandleKeyref(XmlSchemaKeyref keyref)
if (fKey[0].Table!.DataSet!.Relations[iExisting].RelationName != relName)
iExisting = -1;
}
- DataRelation? relation = null;
+ DataRelation? relation;
if (iExisting < 0)
{
relation = new DataRelation(relName, pKey, fKey);
@@ -1390,7 +1390,7 @@ internal void HandleKeyref(XmlSchemaKeyref keyref)
[RequiresUnreferencedCode(DataSet.RequiresUnreferencedCodeMessage)]
internal void HandleConstraint(XmlSchemaIdentityConstraint keyNode)
{
- string? name = null;
+ string? name;
name = XmlConvert.DecodeName(keyNode.Name);
if (name == null || name.Length == 0)
@@ -1964,7 +1964,7 @@ internal void HandleSimpleTypeSimpleContentColumn(XmlSchemaSimpleType typeNode,
return;
}
- Type? type = null;
+ Type? type;
SimpleType? xsdType = null;
// if (typeNode.QualifiedName.Namespace != Keywords.XSDNS) { // this means UDSimpleType
@@ -2101,7 +2101,7 @@ internal void HandleSimpleContentColumn(string strType, DataTable table, bool is
if (FromInference && table.XmlText != null) // backward compatability for inference
return;
- Type? type = null;
+ Type? type;
if (strType == null)
{
return;
@@ -2196,12 +2196,12 @@ internal void HandleSimpleContentColumn(string strType, DataTable table, bool is
[RequiresUnreferencedCode(DataSet.RequiresUnreferencedCodeMessage)]
internal void HandleAttributeColumn(XmlSchemaAttribute attrib, DataTable table, bool isBase)
{
- Type? type = null;
+ Type? type;
XmlSchemaAttribute? attr = attrib.Name != null ? attrib : (XmlSchemaAttribute)_attributes![attrib.RefName]!;
XmlSchemaAnnotated? typeNode = FindTypeNode(attr);
- string? strType = null;
+ string? strType;
SimpleType? xsdType = null;
if (typeNode == null)
@@ -2359,7 +2359,7 @@ internal void HandleAttributeColumn(XmlSchemaAttribute attrib, DataTable table,
[RequiresUnreferencedCode(DataSet.RequiresUnreferencedCodeMessage)]
internal void HandleElementColumn(XmlSchemaElement elem, DataTable table, bool isBase)
{
- Type? type = null;
+ Type? type;
XmlSchemaElement? el = elem.Name != null ? elem : (XmlSchemaElement?)_elementsTable![elem.RefName];
if (el == null) // it's possible due to some XSD compiler optimizations
@@ -2773,7 +2773,7 @@ private void AddTablesToList(List tableList, DataTable dt)
{
string xpath = key.Selector!.XPath!;
string[] split = xpath.Split('/');
- string prefix = string.Empty;
+ string prefix;
string QualifiedTableName = split[split.Length - 1]; //get the last string after '/' and ':'
diff --git a/src/libraries/System.Data.Common/src/System/Data/XmlDataLoader.cs b/src/libraries/System.Data.Common/src/System/Data/XmlDataLoader.cs
index 3f80ecdf1cbeee..736b340ece89ce 100644
--- a/src/libraries/System.Data.Common/src/System/Data/XmlDataLoader.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/XmlDataLoader.cs
@@ -150,7 +150,6 @@ private string GetValueForTextOnlyColums(XmlNode? n)
{
// don't use string builder if only one text node exists
value = n.Value;
- n = n.NextSibling;
}
else
{
@@ -702,7 +701,7 @@ private void LoadTopMostTable(DataTable table)
// If table name we have matches dataset
// name top node could be a DataSet OR a table.
// It's a table overwise.
- DataRow? row = null; // Data row we're going to add to this table
+ DataRow? row; // Data row we're going to add to this table
bool matchFound = false; // Assume we found no matching elements
@@ -880,7 +879,7 @@ private void LoadTable(DataTable table, bool isNested)
Debug.Assert(table != null, "Table to be loaded is null on LoadTable() entry");
- DataRow? row = null; // Data row we're going to add to this table
+ DataRow? row; // Data row we're going to add to this table
int entryDepth = _dataReader!.Depth; // Store current reader depth so we know when to stop reading
int entryChild = _childRowsStack!.Count; // Memorize child stack level on entry
diff --git a/src/libraries/System.Data.Common/src/System/Data/XmlToDatasetMap.cs b/src/libraries/System.Data.Common/src/System/Data/XmlToDatasetMap.cs
index 1c042b21029933..f27573c55b6d9c 100644
--- a/src/libraries/System.Data.Common/src/System/Data/XmlToDatasetMap.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/XmlToDatasetMap.cs
@@ -457,7 +457,7 @@ private ArrayList GetSelfAndDescendants(DataTable dt)
public object? GetColumnSchema(XmlNode node, bool fIgnoreNamespace)
{
Debug.Assert(node != null, "Argument validation");
- TableSchemaInfo? tableSchemaInfo = null;
+ TableSchemaInfo? tableSchemaInfo;
XmlNode? nodeRegion = (node.NodeType == XmlNodeType.Attribute) ? ((XmlAttribute)node).OwnerElement : node.ParentNode;
diff --git a/src/libraries/System.Data.Common/src/System/Data/xmlsaver.cs b/src/libraries/System.Data.Common/src/System/Data/xmlsaver.cs
index a65a2798e5f6f7..b79b96c418472b 100644
--- a/src/libraries/System.Data.Common/src/System/Data/xmlsaver.cs
+++ b/src/libraries/System.Data.Common/src/System/Data/xmlsaver.cs
@@ -1074,7 +1074,7 @@ internal XmlElement FillDataSetElement(XmlDocument xd, DataSet? ds, DataTable? d
internal void SetPath(XmlWriter xw)
{
- FileStream? fs = null;
+ FileStream? fs;
DataTextWriter? sw = xw as DataTextWriter;
fs = (sw != null) ? sw.BaseStream as FileStream : null;
@@ -1700,14 +1700,10 @@ internal static bool AutoGenerated(ForeignKeyConstraint fk, bool checkRelation)
if (fk.ExtendedProperties.Count > 0)
return false;
-
if (fk.AcceptRejectRule != AcceptRejectRule.None)
return false;
if (fk.DeleteRule != Rule.Cascade)
return false;
- if (fk.DeleteRule != Rule.Cascade)
- return false;
-
if (fk.RelatedColumnsReference.Length != 1)
return false;
@@ -1729,7 +1725,7 @@ internal XmlElement HandleTable(DataTable table, XmlDocument dc, XmlElement sche
Debug.Assert(_dsElement != null);
XmlElement root = dc.CreateElement(Keywords.XSD_PREFIX, Keywords.XSD_ELEMENT, Keywords.XSDNS);
- bool fWriteOrdinals = false;
+ bool fWriteOrdinals;
bool fUnqualified = false;
if (((table.DataSet == null) || (_ds != null && table.Namespace != _ds.Namespace)) && (_schFormat == SchemaFormat.Remoting))
@@ -1859,7 +1855,7 @@ internal XmlElement HandleTable(DataTable table, XmlDocument dc, XmlElement sche
root.SetAttribute(Keywords.TYPE, NewDiffgramGen.QualifiedName((string)_prefixes[table.TypeName.Namespace]!, table.TypeName.Name));
}
- XmlElement? compositor = null;
+ XmlElement? compositor;
DataColumn? colTxt = table.XmlText;
@@ -1993,7 +1989,7 @@ internal XmlElement HandleTable(DataTable table, XmlDocument dc, XmlElement sche
for (int i = 0; i < constraints.Count; i++)
{
- XmlElement? constraint = null;
+ XmlElement? constraint;
DataColumn[] fields;
if (constraints[i] is UniqueConstraint)
@@ -2545,7 +2541,7 @@ private void GenerateRow(DataRow row)
[RequiresUnreferencedCode(DataSet.RequiresUnreferencedCodeMessage)]
private void GenerateColumn(DataRow row, DataColumn col, DataRowVersion version)
{
- string? value = null;
+ string? value;
value = col.GetColumnValueAsString(row, version); // this is useless for CTD
if (value == null)
diff --git a/src/libraries/System.Data.Common/src/System/Xml/DataPointer.cs b/src/libraries/System.Data.Common/src/System/Xml/DataPointer.cs
index 3df260fa1abbcc..c7e99046842f25 100644
--- a/src/libraries/System.Data.Common/src/System/Xml/DataPointer.cs
+++ b/src/libraries/System.Data.Common/src/System/Xml/DataPointer.cs
@@ -650,7 +650,7 @@ internal void RealFoliate()
return;
}
- XmlNode? n = null;
+ XmlNode? n;
if (_doc.IsTextOnly(_column!))
{
diff --git a/src/libraries/System.Data.Common/src/System/Xml/XPathNodePointer.cs b/src/libraries/System.Data.Common/src/System/Xml/XPathNodePointer.cs
index 4e4c878b51c54f..5d5f7b4d268d16 100644
--- a/src/libraries/System.Data.Common/src/System/Xml/XPathNodePointer.cs
+++ b/src/libraries/System.Data.Common/src/System/Xml/XPathNodePointer.cs
@@ -88,7 +88,7 @@ private XPathNodeType DecideXPNodeTypeForTextNodes(XmlNode node)
private XPathNodeType ConvertNodeType(XmlNode node)
{
- int xnt = -1;
+ int xnt;
if (XmlDataDocument.IsTextNode(node.NodeType))
return DecideXPNodeTypeForTextNodes(node);
xnt = s_xmlNodeType_To_XpathNodeType_Map[(int)(node.NodeType)];
@@ -404,8 +404,8 @@ internal string XmlLang
{
RealFoliate();
XmlNode curNode = _node;
- XmlBoundElement? curBoundElem = null;
- object? colVal = null;
+ XmlBoundElement? curBoundElem;
+ object? colVal;
while (curNode != null)
{
curBoundElem = curNode as XmlBoundElement;
@@ -853,7 +853,7 @@ internal bool MoveToFirst()
if (_node != null)
{
DataRow? curRow = null;
- XmlNode? parent = null;
+ XmlNode? parent;
if (_column != null)
{
curRow = Row;
@@ -1006,7 +1006,7 @@ internal bool MoveToParent()
}
else
{
- XmlNode? n = null;
+ XmlNode? n;
if (_node.NodeType == XmlNodeType.Attribute)
n = ((XmlAttribute)_node).OwnerElement;
else
@@ -1099,7 +1099,7 @@ internal XmlNodeOrder ComparePosition(XPathNodePointer other)
if (IsSamePosition(other))
return XmlNodeOrder.Same;
- XmlNode? curNode1 = null, curNode2 = null;
+ XmlNode? curNode1, curNode2;
//deal with namespace node first
if (NodeType == XPathNodeType.Namespace && other.NodeType == XPathNodeType.Namespace)
@@ -1209,7 +1209,7 @@ internal XmlNodeOrder ComparePosition(XPathNodePointer other)
XmlNode? parent1 = GetParent(curNode1!);
XmlNode? parent2 = GetParent(curNode2!);
- XmlNode? nextNode = null;
+ XmlNode? nextNode;
while (parent1 != null && parent2 != null)
{
if (parent1 == parent2)
@@ -1291,7 +1291,7 @@ private void RealFoliate()
Debug.Assert(_column != null);
- XmlNode? n = null;
+ XmlNode? n;
if (_doc.IsTextOnly(_column))
n = _node.FirstChild;
@@ -1333,7 +1333,7 @@ private void RealFoliate()
{
if (be == null)
return null;
- XmlAttribute? attr = null;
+ XmlAttribute? attr;
if (be.IsFoliated)
{
attr = be.GetAttributeNode(name, StrReservedXmlns);
@@ -1374,8 +1374,8 @@ internal string GetNamespace(string name)
name = "xmlns";
RealFoliate();
XmlNode? node = _node;
- XmlNodeType nt = node.NodeType;
- string? retVal = null;
+ XmlNodeType nt;
+ string? retVal;
while (node != null)
{
//first identify an element node in the ancestor + itself
@@ -1407,15 +1407,10 @@ internal bool MoveToNamespace(string name)
//only need to check with _node, even if _column is not null and its mapping type is element, it can't have attributes
if (_parentOfNS == null)
return false;
- string attrName = name;
- if (attrName == "xmlns")
- attrName = "xmlns:xmlns";
- if (attrName != null && attrName.Length == 0)
- attrName = "xmlns";
RealFoliate();
XmlNode? node = _node;
- XmlAttribute? attr = null;
- XmlBoundElement? be = null;
+ XmlAttribute? attr;
+ XmlBoundElement? be;
while (node != null)
{
//check current element node
@@ -1524,7 +1519,7 @@ internal bool MoveToFirstNamespace(XPathNamespaceScope namespaceScope)
if (_parentOfNS == null)
return false;
XmlNode? node = _node;
- XmlBoundElement? be = null;
+ XmlBoundElement? be;
while (node != null)
{
be = node as XmlBoundElement;
@@ -1557,7 +1552,7 @@ private bool DuplicateNS(XmlBoundElement endElem, string lname)
if (_parentOfNS == null || endElem == null)
return false;
XmlBoundElement? be = _parentOfNS;
- XmlNode? node = null;
+ XmlNode? node;
while (be != null && be != endElem)
{
if (GetNamespace(be, lname) != null)
diff --git a/src/libraries/System.Data.Common/src/System/Xml/XmlBoundElement.cs b/src/libraries/System.Data.Common/src/System/Xml/XmlBoundElement.cs
index 97fcd22ba34122..92a6a510a9f368 100644
--- a/src/libraries/System.Data.Common/src/System/Xml/XmlBoundElement.cs
+++ b/src/libraries/System.Data.Common/src/System/Xml/XmlBoundElement.cs
@@ -158,7 +158,7 @@ public override XmlNode ReplaceChild(XmlNode newChild, XmlNode oldChild)
internal void RemoveAllChildren()
{
XmlNode? child = FirstChild;
- XmlNode? sibling = null;
+ XmlNode? sibling;
while (child != null)
{
diff --git a/src/libraries/System.Data.Common/src/System/Xml/XmlDataDocument.cs b/src/libraries/System.Data.Common/src/System/Xml/XmlDataDocument.cs
index 3eab2aeaf2e804..c75a7afa483216 100644
--- a/src/libraries/System.Data.Common/src/System/Xml/XmlDataDocument.cs
+++ b/src/libraries/System.Data.Common/src/System/Xml/XmlDataDocument.cs
@@ -148,7 +148,7 @@ internal void SyncRows(DataRow? parentRow, XmlNode node, bool fAddRowsToTable)
[RequiresUnreferencedCode(DataSet.RequiresUnreferencedCodeMessage)]
internal void SyncTree(XmlNode node)
{
- XmlBoundElement? be = null;
+ XmlBoundElement? be;
_mapper.GetRegion(node, out be);
DataRow? parentRow = null;
bool fAddRowsToTable = IsConnected(node);
@@ -765,7 +765,7 @@ private void ForceFoliation(XmlBoundElement node, ElementState newState)
private XmlNode? GetColumnInsertAfterLocation(DataRow row, DataColumn col, XmlBoundElement rowElement)
{
XmlNode? prev = null;
- XmlNode? node = null;
+ XmlNode? node;
// text only columns appear first
if (IsTextOnly(col))
@@ -866,7 +866,7 @@ private ArrayList GetNestedChildRelations(DataRow row)
private XmlNode? GetRowInsertBeforeLocation(DataRow row, XmlElement rowElement, XmlNode parentElement)
{
DataRow refRow = row;
- int i = 0;
+ int i;
int pos;
// Find position
@@ -2327,7 +2327,7 @@ private void PromoteNonValueChildren(XmlNode parent)
XmlNode prevSibling = parent;
XmlNode? child = parent.FirstChild;
bool bTextLikeNode = true;
- XmlNode? nextSibling = null;
+ XmlNode? nextSibling;
while (child != null)
{
nextSibling = child.NextSibling;
@@ -2496,7 +2496,7 @@ private void SynchronizeRowFromRowElementEx(XmlBoundElement rowElement, ArrayLis
Debug.Assert(row != null);
Hashtable foundColumns = new Hashtable();
- string xsi_attrVal = string.Empty;
+ string xsi_attrVal;
RegionIterator iter = new RegionIterator(rowElement);
bool fMore;
diff --git a/src/libraries/System.Data.Common/tests/System/Data/DataTableTest.cs b/src/libraries/System.Data.Common/tests/System/Data/DataTableTest.cs
index 7538f21eac709d..8a38cfc60027c8 100644
--- a/src/libraries/System.Data.Common/tests/System/Data/DataTableTest.cs
+++ b/src/libraries/System.Data.Common/tests/System/Data/DataTableTest.cs
@@ -3566,34 +3566,38 @@ public void Remote()
}
[Fact]
- [ActiveIssue("https://github.com/dotnet/runtime/issues/62965", TestPlatforms.Browser)] // fails on NodeJS on windows
public void Bug55978()
{
DataTable dt = new DataTable();
dt.Columns.Add("StartDate", typeof(DateTime));
DataRow dr;
- DateTime date = DateTime.Now;
+ DateTime now = DateTime.Now;
+
+ // In RowFilter we have a string containing only seconds,
+ // but in rows we have a DateTime which also contains milliseconds.
+ // The test would fail without this extra minute, when now.Millisecond is 0.
+ DateTime rowDate = now.AddMinutes(1);
for (int i = 0; i < 10; i++)
{
dr = dt.NewRow();
- dr["StartDate"] = date.AddDays(i);
+ dr["StartDate"] = rowDate.AddDays(i);
dt.Rows.Add(dr);
}
DataView dv = dt.DefaultView;
dv.RowFilter = string.Format(CultureInfo.InvariantCulture,
"StartDate >= #{0}# and StartDate <= #{1}#",
- DateTime.Now.AddDays(2),
- DateTime.Now.AddDays(4));
+ now.AddDays(2),
+ now.AddDays(4));
Assert.Equal(10, dt.Rows.Count);
int expectedRowCount = 2;
if (dv.Count != expectedRowCount)
{
StringBuilder sb = new();
- sb.AppendLine($"DataView.Rows.Count: Expected: {expectedRowCount}, Actual: {dv.Count}. Debug data: RowFilter: {dv.RowFilter}, date: {date}");
+ sb.AppendLine($"DataView.Rows.Count: Expected: {expectedRowCount}, Actual: {dv.Count}. Debug data: RowFilter: {dv.RowFilter}, date: {now}");
for (int i = 0; i < dv.Count; i++)
{
sb.Append($"row#{i}: ");
diff --git a/src/libraries/System.Data.Odbc/src/Common/System/Data/Common/DBConnectionString.cs b/src/libraries/System.Data.Odbc/src/Common/System/Data/Common/DBConnectionString.cs
index dba3fdbbc37e47..1e6a0a019a62a2 100644
--- a/src/libraries/System.Data.Odbc/src/Common/System/Data/Common/DBConnectionString.cs
+++ b/src/libraries/System.Data.Odbc/src/Common/System/Data/Common/DBConnectionString.cs
@@ -473,8 +473,8 @@ private static string[] NoDuplicateUnion(string[] a, string[] b)
{
int startPosition = nextStartPosition;
- string? keyname, keyvalue; // since parsing restrictions ignores values, it doesn't matter if we use ODBC rules or OLEDB rules
- nextStartPosition = DbConnectionOptions.GetKeyValuePair(restrictions, startPosition, buffer, false, out keyname, out keyvalue);
+ string? keyname; // since parsing restrictions ignores values, it doesn't matter if we use ODBC rules or OLEDB rules
+ nextStartPosition = DbConnectionOptions.GetKeyValuePair(restrictions, startPosition, buffer, false, out keyname, out _);
if (!string.IsNullOrEmpty(keyname))
{
string realkeyname = ((null != synonyms) ? (string)synonyms[keyname] : keyname); // MDAC 85144
diff --git a/src/libraries/System.Data.Odbc/src/Common/System/Data/Common/DbConnectionOptions.cs b/src/libraries/System.Data.Odbc/src/Common/System/Data/Common/DbConnectionOptions.cs
index d752d1233af8e5..56abf205f6e3c3 100644
--- a/src/libraries/System.Data.Odbc/src/Common/System/Data/Common/DbConnectionOptions.cs
+++ b/src/libraries/System.Data.Odbc/src/Common/System/Data/Common/DbConnectionOptions.cs
@@ -322,7 +322,7 @@ public bool ContainsKey(string keyword)
internal string? ExpandDataDirectories(ref string? filename, ref int position)
{
- string? value = null;
+ string? value;
StringBuilder builder = new StringBuilder(_usersConnectionString.Length);
string? datadir = null;
diff --git a/src/libraries/System.Data.Odbc/src/Common/System/Data/ProviderBase/DbConnectionPool.cs b/src/libraries/System.Data.Odbc/src/Common/System/Data/ProviderBase/DbConnectionPool.cs
index ab2d89be6121ac..d88cd4f4434832 100644
--- a/src/libraries/System.Data.Odbc/src/Common/System/Data/ProviderBase/DbConnectionPool.cs
+++ b/src/libraries/System.Data.Odbc/src/Common/System/Data/ProviderBase/DbConnectionPool.cs
@@ -909,7 +909,7 @@ private void PrepareConnection(DbConnection owningObject, DbConnectionInternal o
private DbConnectionInternal? GetFromGeneralPool()
{
- DbConnectionInternal? obj = null;
+ DbConnectionInternal? obj;
if (!_stackNew.TryPop(out obj))
{
diff --git a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/Odbc32.cs b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/Odbc32.cs
index 0eefd1d2cdb859..0d566e7c3276b4 100644
--- a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/Odbc32.cs
+++ b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/Odbc32.cs
@@ -730,7 +730,7 @@ internal static void GetDiagErrors(OdbcErrorCollection errors, string? source, O
{
int NativeError;
short iRec = 0;
- short cchActual = 0;
+ short cchActual;
StringBuilder message = new StringBuilder(1024);
string sqlState;
@@ -743,7 +743,7 @@ internal static void GetDiagErrors(OdbcErrorCollection errors, string? source, O
if ((SQLRETURN.SUCCESS_WITH_INFO == retcode) && (message.Capacity - 1 < cchActual))
{
message.Capacity = cchActual + 1;
- retcode = hrHandle.GetDiagnosticRecord(iRec, out sqlState, message, out NativeError, out cchActual);
+ retcode = hrHandle.GetDiagnosticRecord(iRec, out sqlState, message, out NativeError, out _);
}
//Note: SUCCESS_WITH_INFO from SQLGetDiagRec would be because
diff --git a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcCommandBuilder.cs b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcCommandBuilder.cs
index b9227c61026260..edff9d02d1a905 100644
--- a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcCommandBuilder.cs
+++ b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcCommandBuilder.cs
@@ -242,7 +242,7 @@ private static OdbcParameter[] DeriveParametersFromStoredProcedure(OdbcConnectio
rParams.Add(parameter);
}
}
- retcode = hstmt.CloseCursor();
+ hstmt.CloseCursor();
return rParams.ToArray();
}
@@ -330,20 +330,9 @@ public string UnquoteIdentifier(string quotedIdentifier, OdbcConnection? connect
quoteSuffix = quotePrefix;
}
+ // ignoring the return value because it is acceptable for the quotedString to not be quoted in this context.
string? unquotedIdentifier;
- // by the ODBC spec "If the data source does not support quoted identifiers, a blank is returned."
- // So if a blank is returned the string is returned unchanged. Otherwise the returned string is used
- // to unquote the string
- if (!string.IsNullOrEmpty(quotePrefix) || quotePrefix != " ")
- {
- // ignoring the return value because it is acceptable for the quotedString to not be quoted in this
- // context.
- ADP.RemoveStringQuotes(quotePrefix, quoteSuffix, quotedIdentifier, out unquotedIdentifier);
- }
- else
- {
- unquotedIdentifier = quotedIdentifier;
- }
+ ADP.RemoveStringQuotes(quotePrefix, quoteSuffix, quotedIdentifier, out unquotedIdentifier);
return unquotedIdentifier!;
}
}
diff --git a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcConnection.cs b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcConnection.cs
index 5c5f3e3a2c059a..5de32103c9e0cb 100644
--- a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcConnection.cs
+++ b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcConnection.cs
@@ -380,7 +380,7 @@ private void DisposeMe(bool disposing)
internal string GetConnectAttrString(ODBC32.SQL_ATTR attribute)
{
string value = "";
- int cbActual = 0;
+ int cbActual;
byte[] buffer = new byte[100];
OdbcConnectionHandle? connectionHandle = ConnectionHandle;
if (null != connectionHandle)
@@ -413,12 +413,11 @@ internal string GetConnectAttrString(ODBC32.SQL_ATTR attribute)
internal int GetConnectAttr(ODBC32.SQL_ATTR attribute, ODBC32.HANDLER handler)
{
int retval = -1;
- int cbActual = 0;
byte[] buffer = new byte[4];
OdbcConnectionHandle? connectionHandle = ConnectionHandle;
if (null != connectionHandle)
{
- ODBC32.SQLRETURN retcode = connectionHandle.GetConnectionAttribute(attribute, buffer, out cbActual);
+ ODBC32.SQLRETURN retcode = connectionHandle.GetConnectionAttribute(attribute, buffer, out _);
if ((ODBC32.SQLRETURN.SUCCESS == retcode) || (ODBC32.SQLRETURN.SUCCESS_WITH_INFO == retcode))
{
@@ -483,7 +482,7 @@ private int GetInfoInt32Unhandled(ODBC32.SQL_INFO infotype)
{
//SQLGetInfo
string? value = null;
- short cbActual = 0;
+ short cbActual;
byte[] buffer = new byte[100];
OdbcConnectionHandle? connectionHandle = ConnectionHandle;
if (null != connectionHandle)
diff --git a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcConnectionFactory.cs b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcConnectionFactory.cs
index d9d35950a2e612..8a978df0eb0528 100644
--- a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcConnectionFactory.cs
+++ b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcConnectionFactory.cs
@@ -53,25 +53,17 @@ internal override DbConnectionPoolGroupProviderInfo CreateConnectionPoolGroupPro
return new OdbcConnectionPoolGroupProviderInfo();
}
- protected override DbMetaDataFactory CreateMetaDataFactory(DbConnectionInternal internalConnection, out bool cacheMetaDataFactory)
+ protected override DbMetaDataFactory CreateMetaDataFactory(DbConnectionInternal internalConnection)
{
Debug.Assert(internalConnection != null, "internalConnection may not be null.");
- cacheMetaDataFactory = false;
OdbcConnection odbcOuterConnection = ((OdbcConnectionOpen)internalConnection).OuterConnection;
Debug.Assert(odbcOuterConnection != null, "outer connection may not be null.");
// get the DBMS Name
- object? driverName = null;
- string? stringValue = odbcOuterConnection.GetInfoStringUnhandled(ODBC32.SQL_INFO.DRIVER_NAME);
- if (stringValue != null)
- {
- driverName = stringValue;
- }
+ odbcOuterConnection.GetInfoStringUnhandled(ODBC32.SQL_INFO.DRIVER_NAME);
Stream? XMLStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("System.Data.Odbc.OdbcMetaData.xml");
- cacheMetaDataFactory = true;
-
Debug.Assert(XMLStream != null, "XMLstream may not be null.");
diff --git a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcConnectionHandle.cs b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcConnectionHandle.cs
index c23159d34b0b7e..b573da4b8ab6b1 100644
--- a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcConnectionHandle.cs
+++ b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcConnectionHandle.cs
@@ -41,7 +41,7 @@ internal OdbcConnectionHandle(OdbcConnection connection, OdbcConnectionString co
//a odbc 3.0 feature. The ConnectionTimeout on the managed providers represents
//the login timeout, nothing more.
int connectionTimeout = connection.ConnectionTimeout;
- retcode = SetConnectionAttribute2(ODBC32.SQL_ATTR.LOGIN_TIMEOUT, (IntPtr)connectionTimeout, (int)ODBC32.SQL_IS.UINTEGER);
+ SetConnectionAttribute2(ODBC32.SQL_ATTR.LOGIN_TIMEOUT, (IntPtr)connectionTimeout, (int)ODBC32.SQL_IS.UINTEGER);
string connectionString = constr.UsersConnectionString(false);
@@ -195,8 +195,7 @@ private ODBC32.SQLRETURN Connect(string connectionString)
try { }
finally
{
- short cbActualSize;
- retcode = Interop.Odbc.SQLDriverConnectW(this, ADP.PtrZero, connectionString, ODBC32.SQL_NTS, ADP.PtrZero, 0, out cbActualSize, (short)ODBC32.SQL_DRIVER.NOPROMPT);
+ retcode = Interop.Odbc.SQLDriverConnectW(this, ADP.PtrZero, connectionString, ODBC32.SQL_NTS, ADP.PtrZero, 0, out _, (short)ODBC32.SQL_DRIVER.NOPROMPT);
switch (retcode)
{
case ODBC32.SQLRETURN.SUCCESS:
@@ -212,14 +211,13 @@ private ODBC32.SQLRETURN Connect(string connectionString)
protected override bool ReleaseHandle()
{
// NOTE: The SafeHandle class guarantees this will be called exactly once and is non-interrutible.
- ODBC32.SQLRETURN retcode;
// must call complete the transaction rollback, change handle state, and disconnect the connection
- retcode = CompleteTransaction(ODBC32.SQL_ROLLBACK, handle);
+ CompleteTransaction(ODBC32.SQL_ROLLBACK, handle);
if ((HandleState.Connected == _handleState) || (HandleState.TransactionInProgress == _handleState))
{
- retcode = Interop.Odbc.SQLDisconnect(handle);
+ Interop.Odbc.SQLDisconnect(handle);
_handleState = HandleState.Allocated;
}
Debug.Assert(HandleState.Allocated == _handleState, "not expected HandleState.Allocated");
diff --git a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcDataReader.cs b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcDataReader.cs
index 8e57c9e8f4233d..fb9e8d88c4bea8 100644
--- a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcDataReader.cs
+++ b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcDataReader.cs
@@ -174,8 +174,7 @@ public override int FieldCount
}
if (null == _dataCache)
{
- short cColsAffected;
- ODBC32.SQLRETURN retcode = this.FieldCountNoThrow(out cColsAffected);
+ ODBC32.SQLRETURN retcode = this.FieldCountNoThrow(out _);
if (retcode != ODBC32.SQLRETURN.SUCCESS)
{
Connection!.HandleError(StatementHandle, retcode);
@@ -547,8 +546,7 @@ internal object GetValue(int i, TypeMap typemap)
{
if (_dataCache!.AccessIndex(i) == null)
{
- int dummy;
- bool isNotDbNull = QueryFieldInfo(i, ODBC32.SQL_C.BINARY, out dummy);
+ bool isNotDbNull = QueryFieldInfo(i, ODBC32.SQL_C.BINARY, out _);
// if the value is DBNull, QueryFieldInfo will cache it
if (isNotDbNull)
{
@@ -672,8 +670,7 @@ public override bool IsDBNull(int i)
// case 3 - the data has variable-length type, read zero-length data to query for null
// QueryFieldInfo will return false only if the object cached as DbNull
// QueryFieldInfo will put DbNull in cache only if the SQLGetData returns SQL_NULL_DATA, otherwise it does not change it
- int dummy;
- return !QueryFieldInfo(i, typeMap._sql_c, out dummy);
+ return !QueryFieldInfo(i, typeMap._sql_c, out _);
}
}
@@ -1133,7 +1130,7 @@ private long GetBytesOrChars(int i, long dataIndex, Array? buffer, bool isCharsB
// use the cache - preserve the original behavior to minimize regression risk
// 4. sequential access, no cache: (fixed now) user reads the bytes/chars in sequential order (no cache)
- object? cachedObj = null; // The cached object (if there is one)
+ object? cachedObj; // The cached object (if there is one)
// Get cached object, ensure the correct type using explicit cast, to preserve same behavior as before
if (isCharsBuffer)
@@ -1335,8 +1332,7 @@ private long GetBytesOrChars(int i, long dataIndex, Array? buffer, bool isCharsB
{
// for GetChars, ensure data is not null
// 2 bytes for '\0' termination, no data is actually read from the driver
- int cbLengthOrIndicator;
- bool isDbNull = !QueryFieldInfo(i, ODBC32.SQL_C.WCHAR, out cbLengthOrIndicator);
+ bool isDbNull = !QueryFieldInfo(i, ODBC32.SQL_C.WCHAR, out _);
if (isDbNull)
{
throw ADP.InvalidCast();
@@ -1550,7 +1546,6 @@ private object internalGetBytes(int i)
//
private SQLLEN GetColAttribute(int iColumn, ODBC32.SQL_DESC v3FieldId, ODBC32.SQL_COLUMN v2FieldId, ODBC32.HANDLER handler)
{
- short cchNameLength = 0;
SQLLEN numericAttribute;
ODBC32.SQLRETURN retcode;
@@ -1564,11 +1559,11 @@ private SQLLEN GetColAttribute(int iColumn, ODBC32.SQL_DESC v3FieldId, ODBC32.SQ
OdbcStatementHandle stmt = StatementHandle;
if (Connection.IsV3Driver)
{
- retcode = stmt.ColumnAttribute(iColumn + 1, (short)v3FieldId, Buffer, out cchNameLength, out numericAttribute);
+ retcode = stmt.ColumnAttribute(iColumn + 1, (short)v3FieldId, Buffer, out _, out numericAttribute);
}
else if (v2FieldId != (ODBC32.SQL_COLUMN)(-1))
{
- retcode = stmt.ColumnAttribute(iColumn + 1, (short)v2FieldId, Buffer, out cchNameLength, out numericAttribute);
+ retcode = stmt.ColumnAttribute(iColumn + 1, (short)v2FieldId, Buffer, out _, out numericAttribute);
}
else
{
@@ -1604,8 +1599,7 @@ private SQLLEN GetColAttribute(int iColumn, ODBC32.SQL_DESC v3FieldId, ODBC32.SQ
private string? GetColAttributeStr(int i, ODBC32.SQL_DESC v3FieldId, ODBC32.SQL_COLUMN v2FieldId, ODBC32.HANDLER handler)
{
ODBC32.SQLRETURN retcode;
- short cchNameLength = 0;
- SQLLEN numericAttribute;
+ short cchNameLength;
CNativeBuffer buffer = Buffer;
buffer.WriteInt16(0, 0);
@@ -1619,11 +1613,11 @@ private SQLLEN GetColAttribute(int iColumn, ODBC32.SQL_DESC v3FieldId, ODBC32.SQ
if (Connection.IsV3Driver)
{
- retcode = stmt.ColumnAttribute(i + 1, (short)v3FieldId, buffer, out cchNameLength, out numericAttribute);
+ retcode = stmt.ColumnAttribute(i + 1, (short)v3FieldId, buffer, out cchNameLength, out _);
}
else if (v2FieldId != (ODBC32.SQL_COLUMN)(-1))
{
- retcode = stmt.ColumnAttribute(i + 1, (short)v2FieldId, buffer, out cchNameLength, out numericAttribute);
+ retcode = stmt.ColumnAttribute(i + 1, (short)v2FieldId, buffer, out cchNameLength, out _);
}
else
{
@@ -1720,8 +1714,7 @@ private bool GetData(int i, ODBC32.SQL_C sqlctype)
{
// Never call GetData with anything larger than _buffer.Length-2.
// We keep reallocating native buffers and it kills performance!!!
- int dummy;
- return GetData(i, sqlctype, Buffer.Length - 4, out dummy);
+ return GetData(i, sqlctype, Buffer.Length - 4, out _);
}
///
@@ -1739,7 +1732,7 @@ private bool GetData(int i, ODBC32.SQL_C sqlctype)
/// false if value is DbNull, true otherwise
private bool GetData(int i, ODBC32.SQL_C sqlctype, int cb, out int cbLengthOrIndicator)
{
- IntPtr cbActual = IntPtr.Zero; // Length or an indicator value
+ IntPtr cbActual; // Length or an indicator value
if (IsCancelingCommand)
{
@@ -2334,7 +2327,7 @@ internal int RetrieveKeyInfo(bool needkeyinfo, QualifiedTableName qualifiedTable
string columnname;
int ordinal;
int keyColumns = 0;
- IntPtr cbActual = IntPtr.Zero;
+ IntPtr cbActual;
if (IsClosed || (_cmdWrapper == null))
{
@@ -2502,7 +2495,7 @@ private int RetrieveKeyInfoFromStatistics(QualifiedTableName qualifiedTableName,
ODBC32.SQLRETURN retcode;
string columnname = string.Empty;
- string indexname = string.Empty;
+ string indexname;
string currentindexname = string.Empty;
int[] indexcolumnordinals = new int[16];
int[] pkcolumnordinals = new int[16];
@@ -2511,8 +2504,8 @@ private int RetrieveKeyInfoFromStatistics(QualifiedTableName qualifiedTableName,
bool partialcolumnset = false;
int ordinal;
int indexordinal;
- IntPtr cbIndexLen = IntPtr.Zero;
- IntPtr cbColnameLen = IntPtr.Zero;
+ IntPtr cbIndexLen;
+ IntPtr cbColnameLen;
int keyColumns = 0;
// devnote: this test is already done by calling method ...
@@ -2788,7 +2781,7 @@ internal int GetOrdinalFromBaseColName(string? columnname, string? tablename)
((localcmdtext[1] == 's') || (localcmdtext[1] == 'S')))
{
// aliased table, skip the alias name
- localcmdtext = tokenstmt.NextToken();
+ tokenstmt.NextToken();
localcmdtext = tokenstmt.NextToken();
if ((localcmdtext.Length > 0) && (localcmdtext[0] == ','))
{
diff --git a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcEnvironmentHandle.cs b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcEnvironmentHandle.cs
index 07fa28c0884a84..3e4d63cccf3860 100644
--- a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcEnvironmentHandle.cs
+++ b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcEnvironmentHandle.cs
@@ -14,7 +14,7 @@ public OdbcEnvironmentHandle() : base(ODBC32.SQL_HANDLE.ENV, null)
//Set the expected driver manager version
//
- retcode = Interop.Odbc.SQLSetEnvAttr(
+ Interop.Odbc.SQLSetEnvAttr(
this,
ODBC32.SQL_ATTR.ODBC_VERSION,
ODBC32.SQL_OV_ODBC3,
diff --git a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcHandle.cs b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcHandle.cs
index 5c4cfbe5823b36..a15469babaf3d2 100644
--- a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcHandle.cs
+++ b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcHandle.cs
@@ -171,14 +171,12 @@ protected override bool ReleaseHandle()
if (null != parentHandle)
{
parentHandle.DangerousRelease();
- parentHandle = null;
}
return true;
}
internal ODBC32.SQLRETURN GetDiagnosticField(out string sqlState)
{
- short cbActual;
// ODBC (MSDN) documents it expects a buffer large enough to hold 5(+L'\0') unicode characters
StringBuilder sb = new StringBuilder(6);
ODBC32.SQLRETURN retcode = Interop.Odbc.SQLGetDiagFieldW(
@@ -188,7 +186,7 @@ internal ODBC32.SQLRETURN GetDiagnosticField(out string sqlState)
ODBC32.SQL_DIAG_SQLSTATE,
sb,
checked((short)(2 * sb.Capacity)), // expects number of bytes, see \\kbinternal\kb\articles\294\1\69.HTM
- out cbActual);
+ out _);
ODBC.TraceODBC(3, "SQLGetDiagFieldW", retcode);
if ((retcode == ODBC32.SQLRETURN.SUCCESS) || (retcode == ODBC32.SQLRETURN.SUCCESS_WITH_INFO))
{
diff --git a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcMetaDataFactory.cs b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcMetaDataFactory.cs
index f92e61e23acf04..8b4f0ae845e3d2 100644
--- a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcMetaDataFactory.cs
+++ b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcMetaDataFactory.cs
@@ -181,7 +181,7 @@ private DataTable DataTableFromDataReader(IDataReader reader, string tableName)
private void DataTableFromDataReaderDataTypes(DataTable dataTypesTable, OdbcDataReader dataReader, OdbcConnection connection)
{
- DataTable? schemaTable = null;
+ DataTable? schemaTable;
//
// Build a DataTable from the reader
diff --git a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcUtils.cs b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcUtils.cs
index 6df1b3c9ec9d50..f3c8d232268cb3 100644
--- a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcUtils.cs
+++ b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcUtils.cs
@@ -445,7 +445,6 @@ internal string NextToken()
break;
}
}
- endtoken = true;
break;
}
}
diff --git a/src/libraries/System.Data.OleDb/src/DbConnectionOptions.cs b/src/libraries/System.Data.OleDb/src/DbConnectionOptions.cs
index afce7a7dbc3a33..88addb2db1156b 100644
--- a/src/libraries/System.Data.OleDb/src/DbConnectionOptions.cs
+++ b/src/libraries/System.Data.OleDb/src/DbConnectionOptions.cs
@@ -391,7 +391,7 @@ protected internal virtual string Expand()
internal string? ExpandDataDirectories(ref string? filename, ref int position)
{
- string? value = null;
+ string? value;
StringBuilder builder = new StringBuilder(_usersConnectionString.Length);
string? datadir = null;
diff --git a/src/libraries/System.Data.OleDb/src/DbPropSet.cs b/src/libraries/System.Data.OleDb/src/DbPropSet.cs
index 6d462d9970c247..7a79d06c492a06 100644
--- a/src/libraries/System.Data.OleDb/src/DbPropSet.cs
+++ b/src/libraries/System.Data.OleDb/src/DbPropSet.cs
@@ -99,10 +99,9 @@ internal DBPropSet(UnsafeNativeMethods.ICommandProperties properties, PropertyID
private void SetLastErrorInfo(OleDbHResult lastErrorHr)
{
// note: OleDbHResult is actually a simple wrapper over HRESULT with OLEDB-specific codes
- UnsafeNativeMethods.IErrorInfo? errorInfo = null;
string message = string.Empty;
- OleDbHResult errorInfoHr = UnsafeNativeMethods.GetErrorInfo(0, out errorInfo); // 0 - IErrorInfo exists, 1 - no IErrorInfo
+ OleDbHResult errorInfoHr = UnsafeNativeMethods.GetErrorInfo(0, out UnsafeNativeMethods.IErrorInfo? errorInfo); // 0 - IErrorInfo exists, 1 - no IErrorInfo
if ((errorInfoHr == OleDbHResult.S_OK) && (errorInfo != null))
{
try
diff --git a/src/libraries/System.Data.OleDb/src/OleDbConnection.cs b/src/libraries/System.Data.OleDb/src/OleDbConnection.cs
index 7e456b936fba7b..1a605f9e2c4fae 100644
--- a/src/libraries/System.Data.OleDb/src/OleDbConnection.cs
+++ b/src/libraries/System.Data.OleDb/src/OleDbConnection.cs
@@ -70,7 +70,7 @@ public override int ConnectionTimeout
{
get
{
- object? value = null;
+ object? value;
if (IsOpen)
{
value = GetDataSourceValue(OleDbPropertySetGuid.DBInit, ODB.DBPROP_INIT_TIMEOUT);
@@ -583,8 +583,7 @@ internal bool SupportSchemaRowset(Guid schema)
// ErrorInfo object is to be checked regardless the hresult returned by the function called
Exception? e = null;
- UnsafeNativeMethods.IErrorInfo? errorInfo = null;
- OleDbHResult hr = UnsafeNativeMethods.GetErrorInfo(0, out errorInfo); // 0 - IErrorInfo exists, 1 - no IErrorInfo
+ OleDbHResult hr = UnsafeNativeMethods.GetErrorInfo(0, out UnsafeNativeMethods.IErrorInfo? errorInfo); // 0 - IErrorInfo exists, 1 - no IErrorInfo
if ((OleDbHResult.S_OK == hr) && (null != errorInfo))
{
try
diff --git a/src/libraries/System.Data.OleDb/src/OleDbConnectionString.cs b/src/libraries/System.Data.OleDb/src/OleDbConnectionString.cs
index e31ff207c57098..51b15e9ef6d707 100644
--- a/src/libraries/System.Data.OleDb/src/OleDbConnectionString.cs
+++ b/src/libraries/System.Data.OleDb/src/OleDbConnectionString.cs
@@ -243,7 +243,7 @@ private static int UdlPoolSize
private static string? LoadStringFromStorage(string udlfilename)
{
- string? udlConnectionString = null;
+ string? udlConnectionString;
Dictionary? udlcache = UDL._Pool;
if ((null == udlcache) || !udlcache.TryGetValue(udlfilename, out udlConnectionString))
diff --git a/src/libraries/System.Data.OleDb/src/OleDbDataAdapter.cs b/src/libraries/System.Data.OleDb/src/OleDbDataAdapter.cs
index 7972bb788617ed..eeccb6f1caf439 100644
--- a/src/libraries/System.Data.OleDb/src/OleDbDataAdapter.cs
+++ b/src/libraries/System.Data.OleDb/src/OleDbDataAdapter.cs
@@ -250,9 +250,8 @@ record = (adodb as UnsafeNativeMethods.ADORecordConstruction);
{
value[0] = DBNull.Value;
- object recordsAffected;
object nextresult;
- OleDbHResult hr = ((UnsafeNativeMethods.Recordset15)adodb).NextRecordset(out recordsAffected, out nextresult);
+ OleDbHResult hr = ((UnsafeNativeMethods.Recordset15)adodb).NextRecordset(out _, out nextresult);
if (0 > hr)
{
@@ -310,7 +309,7 @@ private int FillFromRecordset(object data, UnsafeNativeMethods.ADORecordsetConst
incrementResultCount = false;
IntPtr chapter; /*ODB.DB_NULL_HCHAPTER*/
- object? result = null;
+ object? result;
try
{
result = recordset.get_Rowset();
@@ -368,7 +367,7 @@ private int FillFromRecordset(object data, UnsafeNativeMethods.ADORecordsetConst
private int FillFromRecord(object data, UnsafeNativeMethods.ADORecordConstruction record, string srcTable)
{
- object? result = null;
+ object? result;
try
{
result = record.get_Row();
diff --git a/src/libraries/System.Data.OleDb/src/OleDbDataReader.cs b/src/libraries/System.Data.OleDb/src/OleDbDataReader.cs
index 51186f08e09e7f..966ec039781ebe 100644
--- a/src/libraries/System.Data.OleDb/src/OleDbDataReader.cs
+++ b/src/libraries/System.Data.OleDb/src/OleDbDataReader.cs
@@ -1261,7 +1261,6 @@ internal void HasRowsRead()
List? exceptions = null;
if (null != imultipleResults)
{
- object result;
IntPtr affected;
OleDbHResult hr;
@@ -1273,7 +1272,7 @@ internal void HasRowsRead()
{
break;
}
- hr = imultipleResults.GetResult(ADP.PtrZero, ODB.DBRESULTFLAG_DEFAULT, ref ODB.IID_NULL, out affected, out result);
+ hr = imultipleResults.GetResult(ADP.PtrZero, ODB.DBRESULTFLAG_DEFAULT, ref ODB.IID_NULL, out affected, out _);
// If a provider doesn't support IID_NULL and returns E_NOINTERFACE we want to break out
// of the loop without throwing an exception. Our behavior will match ADODB in that scenario
@@ -1355,7 +1354,7 @@ public override bool NextResult()
Debug.Assert(null == _irow, "NextResult: row loop check");
Debug.Assert(null == _irowset, "NextResult: rowset loop check");
- object? result = null;
+ object? result;
OleDbHResult hr;
IntPtr affected;
diff --git a/src/libraries/System.Data.OleDb/src/OleDbEnumerator.cs b/src/libraries/System.Data.OleDb/src/OleDbEnumerator.cs
index 03ddf25741551c..d06d83e8d0bf0f 100644
--- a/src/libraries/System.Data.OleDb/src/OleDbEnumerator.cs
+++ b/src/libraries/System.Data.OleDb/src/OleDbEnumerator.cs
@@ -34,7 +34,7 @@ internal static OleDbDataReader GetEnumeratorFromType(Type type)
private static OleDbDataReader GetEnumeratorReader(object? value)
{
- NativeMethods.ISourcesRowset? srcrowset = null;
+ NativeMethods.ISourcesRowset? srcrowset;
try
{
@@ -48,7 +48,6 @@ private static OleDbDataReader GetEnumeratorReader(object? value)
{
throw ODB.ISourcesRowsetNotSupported();
}
- value = null; // still held by ISourcesRowset, reused for IRowset
int propCount = 0;
IntPtr propSets = ADP.PtrZero;
diff --git a/src/libraries/System.Data.OleDb/src/OleDbError.cs b/src/libraries/System.Data.OleDb/src/OleDbError.cs
index 9fa39bc0472e1b..fe07229e52925f 100644
--- a/src/libraries/System.Data.OleDb/src/OleDbError.cs
+++ b/src/libraries/System.Data.OleDb/src/OleDbError.cs
@@ -61,7 +61,7 @@ internal OleDbError(UnsafeNativeMethods.IErrorRecords errorRecords, int index)
}
UnsafeNativeMethods.ISQLErrorInfo sqlErrorInfo;
- hr = errorRecords.GetCustomErrorObject(index, ref ODB.IID_ISQLErrorInfo, out sqlErrorInfo);
+ errorRecords.GetCustomErrorObject(index, ref ODB.IID_ISQLErrorInfo, out sqlErrorInfo);
if (null != sqlErrorInfo)
{
diff --git a/src/libraries/System.Data.OleDb/src/OleDbException.cs b/src/libraries/System.Data.OleDb/src/OleDbException.cs
index 31205aa04acd67..6bcead282f7f36 100644
--- a/src/libraries/System.Data.OleDb/src/OleDbException.cs
+++ b/src/libraries/System.Data.OleDb/src/OleDbException.cs
@@ -67,11 +67,8 @@ public OleDbErrorCollection Errors
internal static OleDbException CreateException(UnsafeNativeMethods.IErrorInfo errorInfo, OleDbHResult errorCode, Exception? inner)
{
OleDbErrorCollection errors = new OleDbErrorCollection(errorInfo);
- string? message = null;
- string? source = null;
- OleDbHResult hr = 0;
- hr = errorInfo.GetDescription(out message);
- hr = errorInfo.GetSource(out source);
+ errorInfo.GetDescription(out string? message);
+ errorInfo.GetSource(out string? source);
int count = errors.Count;
if (0 < errors.Count)
diff --git a/src/libraries/System.Data.OleDb/src/OleDbTransaction.cs b/src/libraries/System.Data.OleDb/src/OleDbTransaction.cs
index 4a169181f2b59b..723e37ca1b65f8 100644
--- a/src/libraries/System.Data.OleDb/src/OleDbTransaction.cs
+++ b/src/libraries/System.Data.OleDb/src/OleDbTransaction.cs
@@ -27,13 +27,12 @@ private sealed class WrappedTransaction : WrappedIUnknown
internal WrappedTransaction(UnsafeNativeMethods.ITransactionLocal transaction, int isolevel, out OleDbHResult hr) : base(transaction)
{
- int transactionLevel = 0;
RuntimeHelpers.PrepareConstrainedRegions();
try
{ }
finally
{
- hr = transaction.StartTransaction(isolevel, 0, IntPtr.Zero, out transactionLevel);
+ hr = transaction.StartTransaction(isolevel, 0, IntPtr.Zero, out _);
if (0 <= hr)
{
_mustComplete = true;
diff --git a/src/libraries/System.Data.OleDb/src/RowBinding.cs b/src/libraries/System.Data.OleDb/src/RowBinding.cs
index 80eb9283490672..828900bc5778b0 100644
--- a/src/libraries/System.Data.OleDb/src/RowBinding.cs
+++ b/src/libraries/System.Data.OleDb/src/RowBinding.cs
@@ -94,11 +94,10 @@ internal IntPtr DangerousGetDataPtr(int valueOffset)
internal OleDbHResult CreateAccessor(UnsafeNativeMethods.IAccessor iaccessor, int flags, ColumnBinding[] bindings)
{
- OleDbHResult hr = 0;
int[] rowBindStatus = new int[BindingCount()];
_iaccessor = iaccessor;
- hr = iaccessor.CreateAccessor(flags, (IntPtr)rowBindStatus.Length, this, (IntPtr)_dataLength, out _accessorHandle, rowBindStatus);
+ OleDbHResult hr = iaccessor.CreateAccessor(flags, (IntPtr)rowBindStatus.Length, this, (IntPtr)_dataLength, out _accessorHandle, rowBindStatus);
for (int k = 0; k < rowBindStatus.Length; ++k)
{
@@ -204,14 +203,13 @@ internal void SetVariantValue(int offset, object value)
Debug.Assert(0 == offset % 8, "invalid alignment");
ValidateCheck(offset, 2 * ODB.SizeOf_Variant);
- IntPtr buffer = ADP.PtrZero;
bool mustRelease = false;
RuntimeHelpers.PrepareConstrainedRegions();
try
{
DangerousAddRef(ref mustRelease);
- buffer = ADP.IntPtrOffset(DangerousGetHandle(), offset);
+ IntPtr buffer = ADP.IntPtrOffset(DangerousGetHandle(), offset);
RuntimeHelpers.PrepareConstrainedRegions();
try
@@ -331,8 +329,7 @@ internal void CloseFromConnection()
if ((ODB.DB_INVALID_HACCESSOR != accessorHandle) && (null != iaccessor))
{
OleDbHResult hr;
- int refcount;
- hr = iaccessor.ReleaseAccessor(accessorHandle, out refcount);
+ hr = iaccessor.ReleaseAccessor(accessorHandle, out _);
if (hr < 0)
{ // ignore any error msgs
SafeNativeMethods.Wrapper.ClearErrorInfo();
diff --git a/src/libraries/System.Data.OleDb/src/SafeHandles.cs b/src/libraries/System.Data.OleDb/src/SafeHandles.cs
index 1157f3e3a05808..534d865372aa1c 100644
--- a/src/libraries/System.Data.OleDb/src/SafeHandles.cs
+++ b/src/libraries/System.Data.OleDb/src/SafeHandles.cs
@@ -665,9 +665,8 @@ internal static class NativeOledbWrapper
{
internal static unsafe OleDbHResult IChapteredRowsetReleaseChapter(System.IntPtr ptr, System.IntPtr chapter)
{
- OleDbHResult hr = OleDbHResult.E_UNEXPECTED;
+ OleDbHResult hr;
IntPtr hchapter = chapter;
- System.Data.Common.UnsafeNativeMethods.IChapteredRowset? chapteredRowset = null;
RuntimeHelpers.PrepareConstrainedRegions();
try
{ }
@@ -677,8 +676,8 @@ internal static unsafe OleDbHResult IChapteredRowsetReleaseChapter(System.IntPtr
hr = (OleDbHResult)Marshal.QueryInterface(ptr, ref IID_IChapteredRowset, out var pChapteredRowset);
if (pChapteredRowset != IntPtr.Zero)
{
- chapteredRowset = (System.Data.Common.UnsafeNativeMethods.IChapteredRowset)Marshal.GetObjectForIUnknown(pChapteredRowset);
- hr = (OleDbHResult)chapteredRowset.ReleaseChapter(hchapter, out var refcount);
+ var chapteredRowset = (System.Data.Common.UnsafeNativeMethods.IChapteredRowset)Marshal.GetObjectForIUnknown(pChapteredRowset);
+ hr = (OleDbHResult)chapteredRowset.ReleaseChapter(hchapter, out _);
Marshal.ReleaseComObject(chapteredRowset);
Marshal.Release(pChapteredRowset);
}
@@ -688,8 +687,7 @@ internal static unsafe OleDbHResult IChapteredRowsetReleaseChapter(System.IntPtr
internal static unsafe OleDbHResult ITransactionAbort(System.IntPtr ptr)
{
- OleDbHResult hr = OleDbHResult.E_UNEXPECTED;
- ITransactionLocal? transactionLocal = null;
+ OleDbHResult hr;
RuntimeHelpers.PrepareConstrainedRegions();
try
{ }
@@ -699,7 +697,7 @@ internal static unsafe OleDbHResult ITransactionAbort(System.IntPtr ptr)
hr = (OleDbHResult)Marshal.QueryInterface(ptr, ref IID_ITransactionLocal, out var pTransaction);
if (pTransaction != IntPtr.Zero)
{
- transactionLocal = (ITransactionLocal)Marshal.GetObjectForIUnknown(pTransaction);
+ ITransactionLocal transactionLocal = (ITransactionLocal)Marshal.GetObjectForIUnknown(pTransaction);
hr = (OleDbHResult)transactionLocal.Abort(IntPtr.Zero, false, false);
Marshal.ReleaseComObject(transactionLocal);
Marshal.Release(pTransaction);
@@ -710,8 +708,7 @@ internal static unsafe OleDbHResult ITransactionAbort(System.IntPtr ptr)
internal static unsafe OleDbHResult ITransactionCommit(System.IntPtr ptr)
{
- OleDbHResult hr = OleDbHResult.E_UNEXPECTED;
- ITransactionLocal? transactionLocal = null;
+ OleDbHResult hr;
RuntimeHelpers.PrepareConstrainedRegions();
try
{ }
@@ -721,7 +718,7 @@ internal static unsafe OleDbHResult ITransactionCommit(System.IntPtr ptr)
hr = (OleDbHResult)Marshal.QueryInterface(ptr, ref IID_ITransactionLocal, out var pTransaction);
if (pTransaction != IntPtr.Zero)
{
- transactionLocal = (ITransactionLocal)Marshal.GetObjectForIUnknown(pTransaction);
+ ITransactionLocal transactionLocal = (ITransactionLocal)Marshal.GetObjectForIUnknown(pTransaction);
hr = (OleDbHResult)transactionLocal.Commit(false, (uint)XACTTC.XACTTC_SYNC_PHASETWO, 0);
Marshal.ReleaseComObject(transactionLocal);
Marshal.Release(pTransaction);
diff --git a/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionFactory.cs b/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionFactory.cs
index d096b432bc808d..aae9ec20294854 100644
--- a/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionFactory.cs
+++ b/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionFactory.cs
@@ -352,12 +352,11 @@ internal bool TryGetConnection(DbConnection owningConnection, TaskCompletionSour
throw ADP.InternalConnectionError(ADP.ConnectionError.ConnectionOptionsMissing);
}
- string expandedConnectionString = key.ConnectionString;
if (null == userConnectionOptions)
{ // we only allow one expansion on the connection string
userConnectionOptions = connectionOptions;
- expandedConnectionString = connectionOptions.Expand();
+ string expandedConnectionString = connectionOptions.Expand();
// if the expanded string is same instance (default implementation), the use the already created options
if ((object)expandedConnectionString != (object)key.ConnectionString)
@@ -432,8 +431,7 @@ internal DbMetaDataFactory GetMetaDataFactory(DbConnectionPoolGroup connectionPo
// if two threads happen to hit this at the same time. One will be GC'd
if (metaDataFactory == null)
{
- bool allowCache = false;
- metaDataFactory = CreateMetaDataFactory(internalConnection, out allowCache);
+ metaDataFactory = CreateMetaDataFactory(internalConnection, out bool allowCache);
if (allowCache)
{
connectionPoolGroup.MetaDataFactory = metaDataFactory;
diff --git a/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionHelper.cs b/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionHelper.cs
index c7cacdaf6cabbb..92f8137771f381 100644
--- a/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionHelper.cs
+++ b/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionHelper.cs
@@ -144,10 +144,8 @@ internal void AddWeakReference(object value, int tag)
protected override DbCommand CreateDbCommand()
{
- DbCommand? command = null;
-
DbProviderFactory providerFactory = ConnectionFactory.ProviderFactory;
- command = providerFactory.CreateCommand()!;
+ DbCommand? command = providerFactory.CreateCommand()!;
command.Connection = this;
return command;
}
diff --git a/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionInternal.Shared.cs b/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionInternal.Shared.cs
index 7aa55a95e73d61..d37dd9fc07a707 100644
--- a/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionInternal.Shared.cs
+++ b/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionInternal.Shared.cs
@@ -486,7 +486,7 @@ protected bool TryOpenConnectionInternal(DbConnection outerConnection, DbConnect
// ?->Connecting: prevent set_ConnectionString during Open
if (connectionFactory.SetInnerConnectionFrom(outerConnection, DbConnectionClosedConnecting.SingletonInstance, this))
{
- DbConnectionInternal? openConnection = null;
+ DbConnectionInternal? openConnection;
try
{
connectionFactory.PermissionDemand(outerConnection);
diff --git a/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionPool.cs b/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionPool.cs
index 521ea909f11da8..e1ba5c74bfa59b 100644
--- a/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionPool.cs
+++ b/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionPool.cs
@@ -1346,7 +1346,7 @@ private void PrepareConnection(DbConnection owningObject, DbConnectionInternal o
private DbConnectionInternal? GetFromGeneralPool()
{
- DbConnectionInternal? obj = null;
+ DbConnectionInternal? obj;
if (!_stackNew.TryPop(out obj))
{
diff --git a/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionPoolCounters.cs b/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionPoolCounters.cs
index 245209ce748429..015511d792f4c9 100644
--- a/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionPoolCounters.cs
+++ b/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionPoolCounters.cs
@@ -238,8 +238,6 @@ protected DbConnectionPoolCounters(string? categoryName, string? categoryHelp)
// SxS: this method uses GetCurrentProcessId to construct the instance name.
private string GetInstanceName()
{
- string? result = null;
-
string? instanceName = GetAssemblyName(); // instance perfcounter name
if (ADP.IsEmpty(instanceName))
@@ -257,7 +255,7 @@ private string GetInstanceName()
// to PERFMON. They recommend that we translate them as shown below, to
// prevent problems.
- result = $"{instanceName}[{pid}]";
+ string result = $"{instanceName}[{pid}]";
result = result.Replace('(', '[').Replace(')', ']').Replace('#', '_').Replace('/', '_').Replace('\\', '_');
// counter instance name cannot be greater than 127
diff --git a/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionPoolIdentity.cs b/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionPoolIdentity.cs
index c0f8270865f520..559e9d31711cd1 100644
--- a/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionPoolIdentity.cs
+++ b/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionPoolIdentity.cs
@@ -47,11 +47,10 @@ private static byte[] CreateWellKnownSid(WellKnownSidType sidType)
// not having to P/Invoke twice (once to get the buffer, once to get the data)
uint length = (uint)SecurityIdentifier.MaxBinaryLength;
- byte[] resultSid = new byte[length];
// NOTE - We copied this code from System.Security.Principal.Win32.CreateWellKnownSid...
- if (0 == UnsafeNativeMethods.CreateWellKnownSid((int)sidType, null, out resultSid, ref length))
+ if (0 == UnsafeNativeMethods.CreateWellKnownSid((int)sidType, null, out byte[] resultSid, ref length))
{
IntegratedSecurityError(Win32_CreateWellKnownSid);
}
diff --git a/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbMetaDataFactory.cs b/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbMetaDataFactory.cs
index f9a4d529da0f4c..2361fc26095c65 100644
--- a/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbMetaDataFactory.cs
+++ b/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbMetaDataFactory.cs
@@ -204,7 +204,6 @@ private DataTable ExecuteCommand(DataRow requestedCollectionRow, string?[]? rest
if (reader != null)
{
reader.Dispose();
- reader = null;
}
}
@@ -215,7 +214,6 @@ private DataColumn[] FilterColumns(DataTable sourceTable, string[]? hiddenColumn
{
DataColumn newDestinationColumn;
int currentColumn;
- DataColumn[]? filteredSourceColumns = null;
int columnCount = 0;
foreach (DataColumn sourceColumn in sourceTable.Columns)
@@ -232,7 +230,7 @@ private DataColumn[] FilterColumns(DataTable sourceTable, string[]? hiddenColumn
}
currentColumn = 0;
- filteredSourceColumns = new DataColumn[columnCount];
+ var filteredSourceColumns = new DataColumn[columnCount];
foreach (DataColumn sourceColumn in sourceTable.Columns)
{
@@ -362,13 +360,12 @@ private void FixUpVersion(DataTable dataSourceInfoTable)
private string GetParameterName(string neededCollectionName, int neededRestrictionNumber)
{
- DataTable? restrictionsTable = null;
- DataColumnCollection? restrictionColumns = null;
+ DataTable? restrictionsTable;
+ DataColumnCollection? restrictionColumns;
DataColumn? collectionName = null;
DataColumn? parameterName = null;
DataColumn? restrictionName = null;
DataColumn? restrictionNumber = null;
- ;
string? result = null;
restrictionsTable = _metaDataCollectionsDataSet.Tables[DbMetaDataCollectionNames.Restrictions];
@@ -416,13 +413,11 @@ public virtual DataTable GetSchema(DbConnection connection, string collectionNam
DataTable metaDataCollectionsTable = _metaDataCollectionsDataSet.Tables[DbMetaDataCollectionNames.MetaDataCollections]!;
DataColumn populationMechanismColumn = metaDataCollectionsTable.Columns[_populationMechanism]!;
DataColumn collectionNameColumn = metaDataCollectionsTable.Columns[DbMetaDataColumnNames.CollectionName]!;
- DataRow? requestedCollectionRow = null;
- DataTable? requestedSchema = null;
string[]? hiddenColumns;
- string? exactCollectionName = null;
+ DataTable? requestedSchema;
- requestedCollectionRow = FindMetaDataCollectionRow(collectionName);
- exactCollectionName = (requestedCollectionRow[collectionNameColumn, DataRowVersion.Current] as string)!;
+ DataRow? requestedCollectionRow = FindMetaDataCollectionRow(collectionName);
+ string exactCollectionName = (requestedCollectionRow[collectionNameColumn, DataRowVersion.Current] as string)!;
if (ADP.IsEmptyArray(restrictions) == false)
{
diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/ref/System.Diagnostics.DiagnosticSourceActivity.cs b/src/libraries/System.Diagnostics.DiagnosticSource/ref/System.Diagnostics.DiagnosticSourceActivity.cs
index fd218a7dbf9df1..a94fb9e380da8e 100644
--- a/src/libraries/System.Diagnostics.DiagnosticSource/ref/System.Diagnostics.DiagnosticSourceActivity.cs
+++ b/src/libraries/System.Diagnostics.DiagnosticSource/ref/System.Diagnostics.DiagnosticSourceActivity.cs
@@ -25,6 +25,7 @@ public string? Id
}
public bool IsAllDataRequested { get { throw null; } set { throw null; } }
+ public bool IsStopped { get { throw null; } }
public System.Diagnostics.ActivityIdFormat IdFormat { get { throw null; } }
public System.Diagnostics.ActivityKind Kind { get { throw null; } }
public string OperationName { get { throw null; } }
@@ -214,6 +215,7 @@ public readonly struct ActivityEvent
public string? TraceState { get { throw null; } }
public bool IsRemote { get { throw null; } }
public static bool TryParse(string? traceParent, string? traceState, out System.Diagnostics.ActivityContext context) { throw null; }
+ public static bool TryParse(string? traceParent, string? traceState, bool isRemote, out System.Diagnostics.ActivityContext context) { throw null; }
public static System.Diagnostics.ActivityContext Parse(string traceParent, string? traceState) { throw null; }
public static bool operator ==(System.Diagnostics.ActivityContext left, System.Diagnostics.ActivityContext right) { throw null; }
public static bool operator !=(System.Diagnostics.ActivityContext left, System.Diagnostics.ActivityContext right) { throw null; }
diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs
index 72c8a20bb77453..49bfc440d59b34 100644
--- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs
+++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs
@@ -684,9 +684,9 @@ public void Stop()
return;
}
- if (!IsFinished)
+ if (!IsStopped)
{
- IsFinished = true;
+ IsStopped = true;
if (Duration == TimeSpan.Zero)
{
@@ -920,7 +920,7 @@ private static bool IsW3CId(string id)
#if ALLOW_PARTIALLY_TRUSTED_CALLERS
[System.Security.SecuritySafeCriticalAttribute]
#endif
- internal static bool TryConvertIdToContext(string traceParent, string? traceState, out ActivityContext context)
+ internal static bool TryConvertIdToContext(string traceParent, string? traceState, bool isRemote, out ActivityContext context)
{
context = default;
if (!IsW3CId(traceParent))
@@ -941,7 +941,8 @@ internal static bool TryConvertIdToContext(string traceParent, string? traceStat
new ActivityTraceId(traceIdSpan.ToString()),
new ActivitySpanId(spanIdSpan.ToString()),
(ActivityTraceFlags) ActivityTraceId.HexByteFromChars(traceParent[53], traceParent[54]),
- traceState);
+ traceState,
+ isRemote);
return true;
}
@@ -951,7 +952,7 @@ internal static bool TryConvertIdToContext(string traceParent, string? traceStat
///
public void Dispose()
{
- if (!IsFinished)
+ if (!IsStopped)
{
Stop();
}
@@ -1232,7 +1233,7 @@ private static unsafe long GetRandomNumber()
private static bool ValidateSetCurrent(Activity? activity)
{
- bool canSet = activity == null || (activity.Id != null && !activity.IsFinished);
+ bool canSet = activity == null || (activity.Id != null && !activity.IsStopped);
if (!canSet)
{
NotifyError(new InvalidOperationException(SR.ActivityNotRunning));
@@ -1298,18 +1299,24 @@ private bool W3CIdFlagsSet
get => (_w3CIdFlags & ActivityTraceFlagsIsSet) != 0;
}
- private bool IsFinished
+ ///
+ /// Indicates whether this object is stopped
+ ///
+ ///
+ /// When subscribing to stop event using , the received object in the event callback will have as true.
+ ///
+ public bool IsStopped
{
- get => (_state & State.IsFinished) != 0;
- set
+ get => (_state & State.IsStopped) != 0;
+ private set
{
if (value)
{
- _state |= State.IsFinished;
+ _state |= State.IsStopped;
}
else
{
- _state &= ~State.IsFinished;
+ _state &= ~State.IsStopped;
}
}
}
@@ -1623,7 +1630,7 @@ private enum State : byte
FormatW3C = 0b_0_00000_10,
FormatFlags = 0b_0_00000_11,
- IsFinished = 0b_1_00000_00,
+ IsStopped = 0b_1_00000_00,
}
}
diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivityContext.cs b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivityContext.cs
index 93661f5d841356..55cacc67053ea3 100644
--- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivityContext.cs
+++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/ActivityContext.cs
@@ -65,8 +65,9 @@ public ActivityContext(ActivityTraceId traceId, ActivitySpanId spanId, ActivityT
///
/// W3C trace parent header.
/// W3C trace state.
+ /// Indicate the context is propagated from remote parent.
/// The ActivityContext object created from the parsing operation.
- public static bool TryParse(string? traceParent, string? traceState, out ActivityContext context)
+ public static bool TryParse(string? traceParent, string? traceState, bool isRemote, out ActivityContext context)
{
if (traceParent is null)
{
@@ -74,9 +75,17 @@ public static bool TryParse(string? traceParent, string? traceState, out Activit
return false;
}
- return Activity.TryConvertIdToContext(traceParent, traceState, out context);
+ return Activity.TryConvertIdToContext(traceParent, traceState, isRemote, out context);
}
+ ///
+ /// Parse W3C trace context headers to ActivityContext object.
+ ///
+ /// W3C trace parent header.
+ /// W3C trace state.
+ /// The ActivityContext object created from the parsing operation.
+ public static bool TryParse(string? traceParent, string? traceState, out ActivityContext context) => TryParse(traceParent, traceState, isRemote: false, out context);
+
///
/// Parse W3C trace context headers to ActivityContext object.
///
@@ -92,7 +101,7 @@ public static ActivityContext Parse(string traceParent, string? traceState)
throw new ArgumentNullException(nameof(traceParent));
}
- if (!Activity.TryConvertIdToContext(traceParent, traceState, out ActivityContext context))
+ if (!Activity.TryConvertIdToContext(traceParent, traceState, isRemote: false, out ActivityContext context))
{
throw new ArgumentException(SR.InvalidTraceParent);
}
diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs
index b598a75fa85e81..2dc1e539c2534a 100644
--- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs
+++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/DiagnosticSourceEventSource.cs
@@ -817,7 +817,7 @@ internal static void AddNewActivitySourceTransform(string filterAndPayloadSpec,
activitySourceName = activitySourceName.Slice(0, plusSignIndex).Trim();
}
- var transform = new FilterAndTransform(filterAndPayloadSpec, endIdx, colonIdx, activitySourceName.ToString(), activityName, supportedEvent, samplingResult, eventSource);
+ new FilterAndTransform(filterAndPayloadSpec, endIdx, colonIdx, activitySourceName.ToString(), activityName, supportedEvent, samplingResult, eventSource);
}
// Check if we are interested to listen to such ActivitySource
diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/Instrument.netfx.cs b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/Instrument.netfx.cs
index 2dc030f5662b10..d973afdacafda0 100644
--- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/Instrument.netfx.cs
+++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Metrics/Instrument.netfx.cs
@@ -17,7 +17,8 @@ namespace System.Diagnostics.Metrics
#endif
public abstract partial class Instrument : Instrument where T : struct
{
- [ThreadStatic] private KeyValuePair[] ts_tags;
+ [ThreadStatic]
+ private static KeyValuePair[] ts_tags;
private const int MaxTagsCount = 8;
@@ -108,4 +109,4 @@ protected void RecordMeasurement(T measurement, in TagList tagList)
ts_tags = tags;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/PassThroughPropagator.cs b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/PassThroughPropagator.cs
index 12515555fcf46c..a8aec1bb72cfc0 100644
--- a/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/PassThroughPropagator.cs
+++ b/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/PassThroughPropagator.cs
@@ -52,7 +52,7 @@ private static void GetRootId(out string? parentId, out string? traceState, out
traceState = activity?.TraceStateString;
parentId = activity?.ParentId ?? activity?.Id;
- isW3c = parentId is not null ? Activity.TryConvertIdToContext(parentId, traceState, out _) : false;
+ isW3c = parentId is not null ? Activity.TryConvertIdToContext(parentId, traceState, isRemote: false, out _) : false;
baggage = activity?.Baggage;
}
}
diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivitySourceTests.cs b/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivitySourceTests.cs
index edc695503c373c..8468ce541c1b3e 100644
--- a/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivitySourceTests.cs
+++ b/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivitySourceTests.cs
@@ -470,15 +470,32 @@ public void TestActivityContextParsing()
Assert.Equal("e82825765f051b47", context.SpanId.ToHexString());
Assert.Equal(ActivityTraceFlags.Recorded, context.TraceFlags);
Assert.Equal("k=v", context.TraceState);
+ Assert.False(context.IsRemote);
+
+ Assert.True(ActivityContext.TryParse(w3cId, "k=v", isRemote: true, out context));
+ Assert.Equal("99d43cb30a4cdb4fbeee3a19c29201b0", context.TraceId.ToHexString());
+ Assert.Equal("e82825765f051b47", context.SpanId.ToHexString());
+ Assert.Equal(ActivityTraceFlags.Recorded, context.TraceFlags);
+ Assert.Equal("k=v", context.TraceState);
+ Assert.True(context.IsRemote);
+
+ Assert.True(ActivityContext.TryParse(w3cId, "k=v", isRemote: false, out context));
+ Assert.Equal("99d43cb30a4cdb4fbeee3a19c29201b0", context.TraceId.ToHexString());
+ Assert.Equal("e82825765f051b47", context.SpanId.ToHexString());
+ Assert.Equal(ActivityTraceFlags.Recorded, context.TraceFlags);
+ Assert.Equal("k=v", context.TraceState);
+ Assert.False(context.IsRemote);
context = ActivityContext.Parse(w3cId, "k=v");
Assert.Equal("99d43cb30a4cdb4fbeee3a19c29201b0", context.TraceId.ToHexString());
Assert.Equal("e82825765f051b47", context.SpanId.ToHexString());
Assert.Equal(ActivityTraceFlags.Recorded, context.TraceFlags);
Assert.Equal("k=v", context.TraceState);
+ Assert.False(context.IsRemote);
context = ActivityContext.Parse(w3cId, null);
Assert.Null(context.TraceState);
+ Assert.False(context.IsRemote);
Assert.False(ActivityContext.TryParse(null, "k=v", out context));
Assert.Throws(() => ActivityContext.Parse(null, null));
@@ -486,6 +503,8 @@ public void TestActivityContextParsing()
const string invalidW3CContext = "00-Z9d43cb30a4cdb4fbeee3a19c29201b0-e82825765f051b47-01";
Assert.False(ActivityContext.TryParse(invalidW3CContext, null, out context));
+ Assert.False(ActivityContext.TryParse(invalidW3CContext, null, isRemote: true, out context));
+ Assert.False(ActivityContext.TryParse(invalidW3CContext, null, isRemote: false, out context));
}
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs b/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs
index 2ac5efa2d9fad5..6b2a0c8aecf5ec 100644
--- a/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs
+++ b/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs
@@ -299,7 +299,6 @@ public void ActivityIdOverflow()
Assert.Equal('#', activity.Id[activity.Id.Length - 1]);
}
-
///
/// Tests activity start and stop
/// Checks Activity.Current correctness, Id generation
@@ -320,6 +319,51 @@ public void StartStop()
Assert.Null(Activity.Current);
}
+ ///
+ /// Tests Activity.IsStopped
+ ///
+ [Fact]
+ public void IsStoppedTest()
+ {
+ using var activity = new Activity("activity");
+ Assert.False(activity.IsStopped);
+ activity.Start();
+ Assert.False(activity.IsStopped);
+ Assert.Equal(TimeSpan.Zero, activity.Duration);
+ activity.Stop();
+ Assert.NotEqual(TimeSpan.Zero, activity.Duration);
+ Assert.True(activity.IsStopped);
+
+ using var activity1 = new Activity("activity");
+ Assert.False(activity1.IsStopped);
+ activity1.Start();
+ Assert.False(activity1.IsStopped);
+ activity1.SetEndTime(DateTime.UtcNow.AddMinutes(1)); // Setting end time shouldn't mark the activity as stopped
+ Assert.False(activity1.IsStopped);
+ activity1.Stop();
+ Assert.True(activity1.IsStopped);
+
+ //
+ // Validate when receiving Start/Stop Activity events
+ //
+
+ using ActivitySource aSource = new ActivitySource("TestActivityIsStopped");
+ using ActivityListener listener = new ActivityListener();
+
+ listener.ShouldListenTo = (activitySource) => activitySource.Name == "TestActivityIsStopped";
+ listener.Sample = (ref ActivityCreationOptions activityOptions) => ActivitySamplingResult.AllData;
+ listener.ActivityStarted = a => Assert.False(a.IsStopped);
+ listener.ActivityStopped = a => Assert.True(a.IsStopped);
+ ActivitySource.AddActivityListener(listener);
+ Activity sourceActivity;
+ using (sourceActivity = aSource.StartActivity("a1"))
+ {
+ Assert.NotNull(sourceActivity);
+ Assert.False(sourceActivity.IsStopped);
+ }
+ Assert.True(sourceActivity.IsStopped);
+ }
+
///
/// Tests Id generation
///
diff --git a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/EventLog.cs b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/EventLog.cs
index 543ef529123a5c..6eab2a131f7e4c 100644
--- a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/EventLog.cs
+++ b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/EventLog.cs
@@ -849,7 +849,7 @@ internal static string TryFormatMessage(SafeLibraryHandle hModule, uint messageN
if (sb.Length > 0)
{
- int num = -1;
+ int num;
if (int.TryParse(sb.ToString(), NumberStyles.None, CultureInfo.InvariantCulture, out num))
{
largestNumber = Math.Max(largestNumber, num);
diff --git a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/EventLogInternal.cs b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/EventLogInternal.cs
index cb2031e37f104e..cc4c6198e178cb 100644
--- a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/EventLogInternal.cs
+++ b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/EventLogInternal.cs
@@ -661,7 +661,7 @@ internal string FormatMessageWrapper(string dllNameList, uint messageNum, string
if (dllName == null || dllName.Length == 0)
continue;
- SafeLibraryHandle hModule = null;
+ SafeLibraryHandle hModule;
if (IsOpen)
{
@@ -740,7 +740,7 @@ internal EventLogEntry[] GetAllEntries()
buf = new byte[minBytesNeeded];
}
success = Interop.Advapi32.ReadEventLog(readHandle, Interop.Advapi32.FORWARDS_READ | Interop.Advapi32.SEEK_READ,
- oldestEntry + idx, buf, buf.Length, out bytesRead, out minBytesNeeded);
+ oldestEntry + idx, buf, buf.Length, out bytesRead, out _);
if (!success)
break;
}
@@ -873,16 +873,14 @@ internal EventLogEntry GetEntryAtNoThrow(int index)
private EventLogEntry GetEntryWithOldest(int index)
{
- EventLogEntry entry = null;
int entryPos = GetCachedEntryPos(index);
if (entryPos >= 0)
{
- entry = new EventLogEntry(cache, entryPos, this);
- return entry;
+ return new EventLogEntry(cache, entryPos, this);
}
string currentMachineName = this.machineName;
- int flags = 0;
+ int flags;
if (GetCachedEntryPos(index + 1) < 0)
{
flags = Interop.Advapi32.FORWARDS_READ | Interop.Advapi32.SEEK_READ;
@@ -919,7 +917,7 @@ private EventLogEntry GetEntryWithOldest(int index)
}
}
success = Interop.Advapi32.ReadEventLog(readHandle, Interop.Advapi32.FORWARDS_READ | Interop.Advapi32.SEEK_READ, index,
- cache, cache.Length, out bytesRead, out minBytesNeeded);
+ cache, cache.Length, out bytesRead, out _);
}
if (!success)
diff --git a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/EventLogReader.cs b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/EventLogReader.cs
index ce2ad31f7e81f1..d42d20e7a0109c 100644
--- a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/EventLogReader.cs
+++ b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/EventLogReader.cs
@@ -303,21 +303,18 @@ public IList LogStatus
{
get
{
- List list = null;
- string[] channelNames = null;
- int[] errorStatuses = null;
EventLogHandle queryHandle = _handle;
if (queryHandle.IsInvalid)
throw new InvalidOperationException();
- channelNames = (string[])NativeWrapper.EvtGetQueryInfo(queryHandle, UnsafeNativeMethods.EvtQueryPropertyId.EvtQueryNames);
- errorStatuses = (int[])NativeWrapper.EvtGetQueryInfo(queryHandle, UnsafeNativeMethods.EvtQueryPropertyId.EvtQueryStatuses);
+ string[] channelNames = (string[])NativeWrapper.EvtGetQueryInfo(queryHandle, UnsafeNativeMethods.EvtQueryPropertyId.EvtQueryNames);
+ int[] errorStatuses = (int[])NativeWrapper.EvtGetQueryInfo(queryHandle, UnsafeNativeMethods.EvtQueryPropertyId.EvtQueryStatuses);
if (channelNames.Length != errorStatuses.Length)
throw new InvalidOperationException();
- list = new List(channelNames.Length);
+ var list = new List(channelNames.Length);
for (int i = 0; i < channelNames.Length; i++)
{
EventLogStatus cs = new EventLogStatus(channelNames[i], errorStatuses[i]);
diff --git a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/EventLogSession.cs b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/EventLogSession.cs
index 0d8da98aea5b6b..285359ddd591f7 100644
--- a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/EventLogSession.cs
+++ b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/EventLogSession.cs
@@ -242,8 +242,6 @@ public void ExportLogAndMessages(string path, PathType pathType, string query, s
public void ExportLogAndMessages(string path, PathType pathType, string query, string targetFilePath, bool tolerateQueryErrors, CultureInfo targetCultureInfo)
{
- if (targetCultureInfo == null)
- targetCultureInfo = CultureInfo.CurrentCulture;
ExportLog(path, pathType, query, targetFilePath, tolerateQueryErrors);
// Ignore the CultureInfo, pass 0 to use the calling thread's locale
NativeWrapper.EvtArchiveExportedLog(this.Handle, targetFilePath, 0, 0);
diff --git a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/NativeWrapper.cs b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/NativeWrapper.cs
index 35ee7fefbc9bd6..5b116fb59d2498 100644
--- a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/NativeWrapper.cs
+++ b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/NativeWrapper.cs
@@ -862,7 +862,7 @@ public static void EvtRenderBufferWithContextSystem(EventLogHandle contextHandle
public static IList EvtRenderBufferWithContextUserOrValues(EventLogHandle contextHandle, EventLogHandle eventHandle)
{
IntPtr buffer = IntPtr.Zero;
- IntPtr pointer = IntPtr.Zero;
+ IntPtr pointer;
int bufferNeeded;
int propCount;
UnsafeNativeMethods.EvtRenderFlags flag = UnsafeNativeMethods.EvtRenderFlags.EvtRenderEventValues;
diff --git a/src/libraries/System.Diagnostics.FileVersionInfo/src/System/Diagnostics/FileVersionInfo.Windows.cs b/src/libraries/System.Diagnostics.FileVersionInfo/src/System/Diagnostics/FileVersionInfo.Windows.cs
index ce77b52cc67856..4b575173e1fa6a 100644
--- a/src/libraries/System.Diagnostics.FileVersionInfo/src/System/Diagnostics/FileVersionInfo.Windows.cs
+++ b/src/libraries/System.Diagnostics.FileVersionInfo/src/System/Diagnostics/FileVersionInfo.Windows.cs
@@ -70,10 +70,7 @@ private static string ConvertTo8DigitHex(uint value)
private static Interop.Version.VS_FIXEDFILEINFO GetFixedFileInfo(IntPtr memPtr)
{
- IntPtr memRef = IntPtr.Zero;
- uint memLen;
-
- if (Interop.Version.VerQueryValue(memPtr, "\\", out memRef, out memLen))
+ if (Interop.Version.VerQueryValue(memPtr, "\\", out IntPtr memRef, out _))
{
return (Interop.Version.VS_FIXEDFILEINFO)Marshal.PtrToStructure(memRef);
}
@@ -93,10 +90,7 @@ private static unsafe string GetFileVersionLanguage(IntPtr memPtr)
private static string GetFileVersionString(IntPtr memPtr, string name)
{
- IntPtr memRef = IntPtr.Zero;
- uint memLen;
-
- if (Interop.Version.VerQueryValue(memPtr, name, out memRef, out memLen))
+ if (Interop.Version.VerQueryValue(memPtr, name, out IntPtr memRef, out _))
{
if (memRef != IntPtr.Zero)
{
@@ -109,10 +103,7 @@ private static string GetFileVersionString(IntPtr memPtr, string name)
private static uint GetVarEntry(IntPtr memPtr)
{
- IntPtr memRef = IntPtr.Zero;
- uint memLen;
-
- if (Interop.Version.VerQueryValue(memPtr, "\\VarFileInfo\\Translation", out memRef, out memLen))
+ if (Interop.Version.VerQueryValue(memPtr, "\\VarFileInfo\\Translation", out IntPtr memRef, out _))
{
return (uint)((Marshal.ReadInt16(memRef) << 16) + Marshal.ReadInt16((IntPtr)((long)memRef + 2)));
}
diff --git a/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounter.cs b/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounter.cs
index 00dbe615d66bc2..87da3cd584107a 100644
--- a/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounter.cs
+++ b/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounter.cs
@@ -575,9 +575,8 @@ public float NextValue()
{
//No need to initialize or Demand, since NextSample already does.
CounterSample newSample = NextSample();
- float retVal = 0.0f;
- retVal = CounterSample.Calculate(_oldSample, newSample);
+ float retVal = CounterSample.Calculate(_oldSample, newSample);
_oldSample = newSample;
return retVal;
diff --git a/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs b/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs
index 43d92d2c5729b3..8112fd21b40098 100644
--- a/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs
+++ b/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceCounterLib.cs
@@ -257,9 +257,7 @@ private static string SymbolFilePath
{
if (s_symbolFilePath == null)
{
- string tempPath;
-
- tempPath = Path.GetTempPath();
+ Path.GetTempPath();
try
{
@@ -838,13 +836,11 @@ private CategorySample GetCategorySample(string category)
if (entry == null)
return null;
- CategorySample sample = null;
byte[] dataRef = GetPerformanceData(entry.NameIndex.ToString(CultureInfo.InvariantCulture), usePool: true);
if (dataRef == null)
throw new InvalidOperationException(SR.Format(SR.CantReadCategory, category));
- sample = new CategorySample(dataRef, entry, this);
- return sample;
+ return new CategorySample(dataRef, entry, this);
}
internal static string[] GetCounters(string machine, string category)
@@ -1169,17 +1165,13 @@ internal static bool IsBaseCounter(int type)
private bool IsCustomCategory(string category)
{
- PerformanceCounterCategoryType categoryType;
-
- return FindCustomCategory(category, out categoryType);
+ return FindCustomCategory(category, out _);
}
internal static PerformanceCounterCategoryType GetCategoryType(string machine, string category)
{
- PerformanceCounterCategoryType categoryType = PerformanceCounterCategoryType.Unknown;
-
PerformanceCounterLib library = GetPerformanceCounterLib(machine, new CultureInfo(EnglishLCID));
- if (!library.FindCustomCategory(category, out categoryType))
+ if (!library.FindCustomCategory(category, out PerformanceCounterCategoryType categoryType))
{
if (CultureInfo.CurrentCulture.Parent.LCID != EnglishLCID)
{
@@ -1233,7 +1225,7 @@ private static void RegisterFiles(string arg0, bool unregister)
else
processStartInfo.FileName = Environment.SystemDirectory + "\\lodctr.exe";
- int res = 0;
+ int res;
try
{
processStartInfo.Arguments = "\"" + arg0 + "\"";
@@ -1324,7 +1316,6 @@ internal byte[] GetData(string item, bool usePool)
{
int waitRetries = 17; //2^16*10ms == approximately 10mins
int waitSleep = 0;
- byte[] data = null;
int error = 0;
// no need to revert here since we'll fall off the end of the method
@@ -1332,8 +1323,7 @@ internal byte[] GetData(string item, bool usePool)
{
try
{
- data = perfDataKey.GetValue(item, usePool);
- return data;
+ return perfDataKey.GetValue(item, usePool);
}
catch (IOException e)
{
diff --git a/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceDataRegistryKey.cs b/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceDataRegistryKey.cs
index 565966abab34c3..98ef10aa353790 100644
--- a/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceDataRegistryKey.cs
+++ b/src/libraries/System.Diagnostics.PerformanceCounter/src/System/Diagnostics/PerformanceDataRegistryKey.cs
@@ -24,8 +24,7 @@ private PerformanceDataRegistryKey(SafeRegistryHandle hkey)
public static PerformanceDataRegistryKey OpenRemoteBaseKey(string machineName)
{
// connect to the specified remote registry
- SafeRegistryHandle foreignHKey = null;
- int ret = Interop.Advapi32.RegConnectRegistry(machineName, new SafeRegistryHandle(new IntPtr(PerformanceData), ownsHandle: false), out foreignHKey);
+ int ret = Interop.Advapi32.RegConnectRegistry(machineName, new SafeRegistryHandle(new IntPtr(PerformanceData), ownsHandle: false), out SafeRegistryHandle foreignHKey);
if (ret == Interop.Errors.ERROR_DLL_INIT_FAILED)
{
diff --git a/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs b/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs
index 7e1f6d5d77adec..d6975bd7274153 100644
--- a/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs
+++ b/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs
@@ -178,10 +178,10 @@ public partial class ProcessModule : System.ComponentModel.Component
internal ProcessModule() { }
public System.IntPtr BaseAddress { get { throw null; } }
public System.IntPtr EntryPointAddress { get { throw null; } }
- public string? FileName { get { throw null; } }
+ public string FileName { get { throw null; } }
public System.Diagnostics.FileVersionInfo FileVersionInfo { get { throw null; } }
public int ModuleMemorySize { get { throw null; } }
- public string? ModuleName { get { throw null; } }
+ public string ModuleName { get { throw null; } }
public override string ToString() { throw null; }
}
public partial class ProcessModuleCollection : System.Collections.ReadOnlyCollectionBase
diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.FreeBSD.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.FreeBSD.cs
index 709fbba1fb7cfb..3fe4314636d33e 100644
--- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.FreeBSD.cs
+++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.FreeBSD.cs
@@ -90,8 +90,7 @@ private unsafe int ParentProcessId
// Gets execution path
private string? GetPathToOpenFile()
{
- Interop.Sys.FileStatus stat;
- if (Interop.Sys.Stat("/usr/local/bin/open", out stat) == 0)
+ if (Interop.Sys.Stat("/usr/local/bin/open", out _) == 0)
{
return "/usr/local/bin/open";
}
diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs
index d7644199391746..2a19a2de587770 100644
--- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs
+++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs
@@ -266,8 +266,7 @@ private ProcessPriorityClass PriorityClassCore
{
EnsureState(State.HaveNonExitedId);
- int pri = 0;
- int errno = Interop.Sys.GetPriority(Interop.Sys.PriorityWhich.PRIO_PROCESS, _processId, out pri);
+ int errno = Interop.Sys.GetPriority(Interop.Sys.PriorityWhich.PRIO_PROCESS, _processId, out int pri);
if (errno != 0) // Interop.Sys.GetPriority returns GetLastWin32Error()
{
throw new Win32Exception(errno); // match Windows exception
diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.BSD.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.BSD.cs
index c6c43dd36a91c5..2d1806842d35bd 100644
--- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.BSD.cs
+++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.BSD.cs
@@ -42,16 +42,12 @@ internal static ProcessModuleCollection GetModules(int processId)
// and why MainModule exists.
try
{
- string? exePath = GetProcPath(processId);
+ string exePath = GetProcPath(processId);
if (!string.IsNullOrEmpty(exePath))
{
return new ProcessModuleCollection(1)
{
- new ProcessModule()
- {
- FileName = exePath,
- ModuleName = Path.GetFileName(exePath)
- }
+ new ProcessModule(exePath, Path.GetFileName(exePath))
};
}
}
diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.FreeBSD.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.FreeBSD.cs
index bc2bd2e0753285..0546c4b3605fc8 100644
--- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.FreeBSD.cs
+++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.FreeBSD.cs
@@ -15,7 +15,7 @@ public static int[] GetProcessIds()
return Interop.Process.ListAllPids();
}
- internal static string? GetProcPath(int processId)
+ internal static string GetProcPath(int processId)
{
return Interop.Process.GetProcPath(processId);
}
diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Linux.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Linux.cs
index 9dede5b6685ad0..1f85741f1c77d4 100644
--- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Linux.cs
+++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Linux.cs
@@ -41,18 +41,20 @@ internal static ProcessModuleCollection GetModules(int processId)
ProcessModuleCollection modules = Interop.procfs.ParseMapsModules(processId) ?? new(capacity: 0);
// Move the main executable module to be the first in the list if it's not already
- string? exePath = Process.GetExePath(processId);
- for (int i = 0; i < modules.Count; i++)
+ if (Process.GetExePath(processId) is string exePath)
{
- ProcessModule module = modules[i];
- if (module.FileName == exePath)
+ for (int i = 0; i < modules.Count; i++)
{
- if (i > 0)
+ ProcessModule module = modules[i];
+ if (module.FileName == exePath)
{
- modules.RemoveAt(i);
- modules.Insert(0, module);
+ if (i > 0)
+ {
+ modules.RemoveAt(i);
+ modules.Insert(0, module);
+ }
+ break;
}
- break;
}
}
diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Win32.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Win32.cs
index 665bfb455c80e9..e64b359b6e770f 100644
--- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Win32.cs
+++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Win32.cs
@@ -161,13 +161,6 @@ private static ProcessModuleCollection GetModules(int processId, bool firstModul
continue;
}
- var module = new ProcessModule()
- {
- ModuleMemorySize = ntModuleInfo.SizeOfImage,
- EntryPointAddress = ntModuleInfo.EntryPoint,
- BaseAddress = ntModuleInfo.BaseOfDll
- };
-
int length = 0;
while ((length = Interop.Kernel32.GetModuleBaseName(processHandle, moduleHandle, chars, chars.Length)) == chars.Length)
{
@@ -178,12 +171,11 @@ private static ProcessModuleCollection GetModules(int processId, bool firstModul
if (length == 0)
{
- module.Dispose();
HandleLastWin32Error();
continue;
}
- module.ModuleName = new string(chars, 0, length);
+ string moduleName = new string(chars, 0, length);
while ((length = Interop.Kernel32.GetModuleFileNameEx(processHandle, moduleHandle, chars, chars.Length)) == chars.Length)
{
@@ -194,7 +186,6 @@ private static ProcessModuleCollection GetModules(int processId, bool firstModul
if (length == 0)
{
- module.Dispose();
HandleLastWin32Error();
continue;
}
@@ -205,9 +196,13 @@ private static ProcessModuleCollection GetModules(int processId, bool firstModul
{
charsSpan = charsSpan.Slice(NtPathPrefix.Length);
}
- module.FileName = charsSpan.ToString();
- modules.Add(module);
+ modules.Add(new ProcessModule(charsSpan.ToString(), moduleName)
+ {
+ ModuleMemorySize = ntModuleInfo.SizeOfImage,
+ EntryPointAddress = ntModuleInfo.EntryPoint,
+ BaseAddress = ntModuleInfo.BaseOfDll,
+ });
}
}
finally
diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessModule.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessModule.cs
index b45513b076c60b..9d0a3338a38edf 100644
--- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessModule.cs
+++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessModule.cs
@@ -13,19 +13,25 @@ namespace System.Diagnostics
[Designer("System.Diagnostics.Design.ProcessModuleDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public class ProcessModule : Component
{
+ private readonly string _fileName;
+ private readonly string _moduleName;
private FileVersionInfo? _fileVersionInfo;
- internal ProcessModule() { }
+ internal ProcessModule(string fileName, string moduleName)
+ {
+ _fileName = fileName;
+ _moduleName = moduleName;
+ }
///
/// Returns the name of the Module.
///
- public string? ModuleName { get; internal set; }
+ public string ModuleName => _moduleName;
///
/// Returns the full file path for the location of the module.
///
- public string? FileName { get; internal set; }
+ public string FileName => _fileName;
///
/// Returns the memory address that the module was loaded at.
@@ -49,7 +55,7 @@ internal ProcessModule() { }
///
/// Returns version information about the module.
///
- public FileVersionInfo FileVersionInfo => _fileVersionInfo ?? (_fileVersionInfo = FileVersionInfo.GetVersionInfo(FileName!));
+ public FileVersionInfo FileVersionInfo => _fileVersionInfo ??= FileVersionInfo.GetVersionInfo(_fileName);
public override string ToString() => $"{base.ToString()} ({ModuleName})";
}
diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessWaitState.Unix.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessWaitState.Unix.cs
index 482a627918fe4b..5342d99272f4ea 100644
--- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessWaitState.Unix.cs
+++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessWaitState.Unix.cs
@@ -307,8 +307,7 @@ internal bool HasExited
{
get
{
- int? ignored;
- return GetExited(out ignored, refresh: true);
+ return GetExited(out _, refresh: true);
}
}
@@ -679,8 +678,7 @@ internal static void CheckChildren(bool reapAll, bool configureConsole)
{
do
{
- int exitCode;
- pid = Interop.Sys.WaitPidExitedNoHang(-1, out exitCode);
+ pid = Interop.Sys.WaitPidExitedNoHang(-1, out _);
} while (pid > 0);
}
}
diff --git a/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs b/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs
index 801a328dc8b1bd..604a34dc8cd2a1 100644
--- a/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs
+++ b/src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs
@@ -312,6 +312,15 @@ public void ToString_NullFrame_ThrowsNullReferenceException()
Assert.Equal(Environment.NewLine, stackTrace.ToString());
}
+ [Fact]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/11354", TestRuntimes.Mono)]
+ public unsafe void ToString_FunctionPointerSignature()
+ {
+ // This is sepate from ToString_Invoke_ReturnsExpected since unsafe cannot be used for iterators
+ var stackTrace = FunctionPointerParameter(null);
+ Assert.Contains("System.Diagnostics.Tests.StackTraceTests.FunctionPointerParameter(IntPtr x)", stackTrace.ToString());
+ }
+
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void ToString_ShowILOffset()
{
@@ -384,6 +393,9 @@ public void ToString_ShowILOffset()
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
private static StackTrace TwoParameters(int x, string y) => new StackTrace();
+ [MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
+ private unsafe static StackTrace FunctionPointerParameter(delegate* x) => new StackTrace();
+
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
private static StackTrace Generic() => new StackTrace();
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
diff --git a/src/libraries/System.Diagnostics.StackTrace/tests/System.Diagnostics.StackTrace.Tests.csproj b/src/libraries/System.Diagnostics.StackTrace/tests/System.Diagnostics.StackTrace.Tests.csproj
index d6d002664cfef3..aec1d927639468 100644
--- a/src/libraries/System.Diagnostics.StackTrace/tests/System.Diagnostics.StackTrace.Tests.csproj
+++ b/src/libraries/System.Diagnostics.StackTrace/tests/System.Diagnostics.StackTrace.Tests.csproj
@@ -3,6 +3,7 @@
$(NetCoreAppCurrent)
true
true
+ true
true
diff --git a/src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj b/src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj
index 0c0804cfc6f104..ff38f3d644c709 100644
--- a/src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj
+++ b/src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj
@@ -7,7 +7,7 @@
- $(NoWarn);CA1845;CA1846
+ $(NoWarn);CA1845;CA1846;IDE0059
annotations
true
true
diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/BerConverter.Linux.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/BerConverter.Linux.cs
index 1cbda9c7cd4c05..7c4b96ba43753b 100644
--- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/BerConverter.Linux.cs
+++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/BerConverter.Linux.cs
@@ -12,9 +12,8 @@ private static int DecodeBitStringHelper(ArrayList resultList, SafeBerHandle ber
// Windows doesn't really decode BitStrings correctly, and wldap32 will internally treat it as 'O' Octet string.
// In order to match behavior, in Linux we will interpret 'B' as 'O' when passing the call to libldap.
- int error = 0;
// return BerVal
- byte[] byteArray = DecodingByteArrayHelper(berElement, 'O', ref error);
+ byte[] byteArray = DecodingByteArrayHelper(berElement, 'O', out int error);
if (!BerPal.IsBerDecodeError(error))
{
// add result to the list
diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/BerConverter.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/BerConverter.cs
index b1ca5e02eb6b4f..1b91fd7c4de769 100644
--- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/BerConverter.cs
+++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/BerConverter.cs
@@ -166,7 +166,7 @@ public static byte[] Encode(string format, params object[] value)
}
string[] stringValues = (string[])value[valueCount];
- byte[][] tempValues = null;
+ byte[][] tempValues;
if (stringValues != null)
{
tempValues = new byte[stringValues.Length][];
@@ -338,7 +338,7 @@ internal static object[] TryDecode(string format, byte[] value, out bool decodeS
Marshal.FreeHGlobal(berValue.bv_val);
}
- int error = 0;
+ int error;
for (int formatCount = 0; formatCount < format.Length; formatCount++)
{
@@ -360,7 +360,7 @@ internal static object[] TryDecode(string format, byte[] value, out bool decodeS
if (fmt == 'b')
{
// should return a bool
- bool boolResult = false;
+ bool boolResult;
if (result == 0)
boolResult = false;
else
@@ -378,7 +378,7 @@ internal static object[] TryDecode(string format, byte[] value, out bool decodeS
else if (fmt == 'a')
{
// return a string
- byte[] byteArray = DecodingByteArrayHelper(berElement, 'O', ref error);
+ byte[] byteArray = DecodingByteArrayHelper(berElement, 'O', out error);
if (!BerPal.IsBerDecodeError(error))
{
string s = null;
@@ -391,7 +391,7 @@ internal static object[] TryDecode(string format, byte[] value, out bool decodeS
else if (fmt == 'O')
{
// return BerVal
- byte[] byteArray = DecodingByteArrayHelper(berElement, fmt, ref error);
+ byte[] byteArray = DecodingByteArrayHelper(berElement, fmt, out error);
if (!BerPal.IsBerDecodeError(error))
{
// add result to the list
@@ -405,10 +405,10 @@ internal static object[] TryDecode(string format, byte[] value, out bool decodeS
else if (fmt == 'v')
{
//null terminate strings
- byte[][] byteArrayresult = null;
+ byte[][] byteArrayresult;
string[] stringArray = null;
- byteArrayresult = DecodingMultiByteArrayHelper(berElement, 'V', ref error);
+ byteArrayresult = DecodingMultiByteArrayHelper(berElement, 'V', out error);
if (!BerPal.IsBerDecodeError(error))
{
if (byteArrayresult != null)
@@ -432,9 +432,9 @@ internal static object[] TryDecode(string format, byte[] value, out bool decodeS
}
else if (fmt == 'V')
{
- byte[][] result = null;
+ byte[][] result;
- result = DecodingMultiByteArrayHelper(berElement, fmt, ref error);
+ result = DecodingMultiByteArrayHelper(berElement, fmt, out error);
if (!BerPal.IsBerDecodeError(error))
{
resultList.Add(result);
@@ -465,7 +465,7 @@ internal static object[] TryDecode(string format, byte[] value, out bool decodeS
private static int EncodingByteArrayHelper(SafeBerHandle berElement, byte[] tempValue, char fmt, nuint tag)
{
- int error = 0;
+ int error;
// one byte array, one int arguments
if (tempValue != null)
@@ -484,9 +484,8 @@ private static int EncodingByteArrayHelper(SafeBerHandle berElement, byte[] temp
return error;
}
- private static byte[] DecodingByteArrayHelper(SafeBerHandle berElement, char fmt, ref int error)
+ private static byte[] DecodingByteArrayHelper(SafeBerHandle berElement, char fmt, out int error)
{
- error = 0;
IntPtr result = IntPtr.Zero;
BerVal binaryValue = new BerVal();
byte[] byteArray = null;
@@ -522,7 +521,7 @@ private static byte[] DecodingByteArrayHelper(SafeBerHandle berElement, char fmt
private static int EncodingMultiByteArrayHelper(SafeBerHandle berElement, byte[][] tempValue, char fmt, nuint tag)
{
IntPtr berValArray = IntPtr.Zero;
- IntPtr tempPtr = IntPtr.Zero;
+ IntPtr tempPtr;
BerVal[] managedBervalArray = null;
int error = 0;
@@ -590,14 +589,13 @@ private static int EncodingMultiByteArrayHelper(SafeBerHandle berElement, byte[]
return error;
}
- private static byte[][] DecodingMultiByteArrayHelper(SafeBerHandle berElement, char fmt, ref int error)
+ private static byte[][] DecodingMultiByteArrayHelper(SafeBerHandle berElement, char fmt, out int error)
{
- error = 0;
// several BerVal
IntPtr ptrResult = IntPtr.Zero;
int i = 0;
ArrayList binaryList = new ArrayList();
- IntPtr tempPtr = IntPtr.Zero;
+ IntPtr tempPtr;
byte[][] result = null;
try
diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/DirectoryControl.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/DirectoryControl.cs
index 51b09c7d6d73bd..c34f9a4e7cc5a6 100644
--- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/DirectoryControl.cs
+++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/DirectoryControl.cs
@@ -173,7 +173,7 @@ internal static void TransformControls(DirectoryControl[] controls)
else if (controls[i].Type == "1.2.840.113556.1.4.474")
{
// The control is a SortControl.
- int result = 0;
+ int result;
string attribute = null;
object[] o = BerConverter.TryDecode("{ea}", value, out bool decodeSucceeded);
diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.Linux.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.Linux.cs
index 6adf1ebac982cd..49dfae1059f968 100644
--- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.Linux.cs
+++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.Linux.cs
@@ -32,7 +32,7 @@ private int InternalConnectToServer()
// available during init.
Debug.Assert(!_ldapHandle.IsInvalid);
- string scheme = null;
+ string scheme;
LdapDirectoryIdentifier directoryIdentifier = (LdapDirectoryIdentifier)_directoryIdentifier;
if (directoryIdentifier.Connectionless)
{
diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.cs
index 7e8c81dc4afb04..69ceeeb774e2e3 100644
--- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.cs
+++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapConnection.cs
@@ -426,7 +426,7 @@ public void Abort(IAsyncResult asyncResult)
throw new ArgumentException(SR.Format(SR.NotReturnedAsyncResult, nameof(asyncResult)));
}
- int messageId = -1;
+ int messageId;
LdapAsyncResult result = (LdapAsyncResult)asyncResult;
if (!result._partialResults)
@@ -1040,7 +1040,7 @@ private void BindHelper(NetworkCredential newCredential, bool needSetCredential)
}
// Set the credential.
- NetworkCredential tempCredential = null;
+ NetworkCredential tempCredential;
if (needSetCredential)
{
_directoryCredential = tempCredential = (newCredential != null ? new NetworkCredential(newCredential.UserName, newCredential.Password, newCredential.Domain) : null);
@@ -1297,7 +1297,7 @@ internal LdapMod[] BuildAttributes(CollectionBase directoryAttributes, ArrayList
for (int i = 0; i < directoryAttributes.Count; i++)
{
// Get the managed attribute first.
- DirectoryAttribute modAttribute = null;
+ DirectoryAttribute modAttribute;
if (attributeCollection != null)
{
modAttribute = attributeCollection[i];
@@ -1334,7 +1334,7 @@ internal LdapMod[] BuildAttributes(CollectionBase directoryAttributes, ArrayList
berValues = new BerVal[valuesCount];
for (int j = 0; j < valuesCount; j++)
{
- byte[] byteArray = null;
+ byte[] byteArray;
if (modAttribute[j] is string)
{
byteArray = encoder.GetBytes((string)modAttribute[j]);
@@ -1362,10 +1362,10 @@ internal LdapMod[] BuildAttributes(CollectionBase directoryAttributes, ArrayList
attributes[i].values = Utility.AllocHGlobalIntPtrArray(valuesCount + 1);
int structSize = Marshal.SizeOf(typeof(BerVal));
- IntPtr controlPtr = IntPtr.Zero;
- IntPtr tempPtr = IntPtr.Zero;
+ IntPtr controlPtr;
+ IntPtr tempPtr;
- int m = 0;
+ int m;
for (m = 0; m < valuesCount; m++)
{
controlPtr = Marshal.AllocHGlobal(structSize);
@@ -1396,7 +1396,7 @@ internal async ValueTask ConstructResponseAsync(int messageId
IntPtr requestName = IntPtr.Zero;
IntPtr requestValue = IntPtr.Zero;
- IntPtr entryMessage = IntPtr.Zero;
+ IntPtr entryMessage;
bool needAbandon = true;
@@ -1827,7 +1827,7 @@ internal DirectoryAttribute ConstructAttribute(IntPtr entryMessage, IntPtr attri
{
BerVal bervalue = new BerVal();
Marshal.PtrToStructure(tempPtr, bervalue);
- byte[] byteArray = null;
+ byte[] byteArray;
if (bervalue.bv_len > 0 && bervalue.bv_val != IntPtr.Zero)
{
byteArray = new byte[bervalue.bv_len];
@@ -1861,7 +1861,7 @@ internal SearchResultReference ConstructReference(IntPtr referenceMessage)
if (error == 0)
{
var referralList = new ArrayList();
- IntPtr tempPtr = IntPtr.Zero;
+ IntPtr tempPtr;
int count = 0;
if (referenceArray != IntPtr.Zero)
{
diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.cs
index 9a200fc5ba218b..fb2a71e51ed1bc 100644
--- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.cs
+++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/ldap/LdapSessionOptions.cs
@@ -1027,7 +1027,7 @@ private int ProcessDereferenceConnection(IntPtr PrimaryConnection, IntPtr Connec
{
if (ConnectionToDereference != IntPtr.Zero && _callbackRoutine.DereferenceConnection != null)
{
- LdapConnection dereferenceConnection = null;
+ LdapConnection dereferenceConnection;
WeakReference reference = null;
// in most cases it should be in our table
diff --git a/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj b/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj
index 6384fde3186b98..71c695235a69e3 100644
--- a/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj
+++ b/src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj
@@ -6,7 +6,7 @@
- $(NoWarn);CA1845;CA1846
+ $(NoWarn);CA1845;CA1846;IDE0059
enable
true
true
diff --git a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/Domain.cs b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/Domain.cs
index 54b8e160ed1bb6..e828ec3a9a5a4c 100644
--- a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/Domain.cs
+++ b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/Domain.cs
@@ -1280,7 +1280,7 @@ private ArrayList GetChildDomains()
private ArrayList GetTrustsHelper(string? targetDomainName)
{
- string? serverName = null;
+ string? serverName;
IntPtr domains = (IntPtr)0;
int count = 0;
ArrayList unmanagedTrustList = new ArrayList();
@@ -1288,7 +1288,7 @@ private ArrayList GetTrustsHelper(string? targetDomainName)
int localDomainIndex = 0;
string? localDomainParent = null;
int error = 0;
- bool impersonated = false;
+ bool impersonated;
// first decide which server to go to
if (context.isServer())
diff --git a/src/libraries/System.Drawing.Common/ref/System.Drawing.Common.netcoreapp.cs b/src/libraries/System.Drawing.Common/ref/System.Drawing.Common.netcoreapp.cs
index 7c5f8f890a84d8..f9d987de24d1c1 100644
--- a/src/libraries/System.Drawing.Common/ref/System.Drawing.Common.netcoreapp.cs
+++ b/src/libraries/System.Drawing.Common/ref/System.Drawing.Common.netcoreapp.cs
@@ -8,6 +8,8 @@ namespace System.Drawing
{
public sealed partial class Graphics
{
+ public void DrawRectangle(System.Drawing.Pen pen, System.Drawing.RectangleF rect) { }
+ public void FillPie(System.Drawing.Brush brush, System.Drawing.RectangleF rect, float startAngle, float sweepAngle) { }
public System.Numerics.Matrix3x2 TransformElements { get { throw null; } set { } }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Bitmap.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Bitmap.cs
index 7cacab64ba5eb7..581219b060261b 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Bitmap.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Bitmap.cs
@@ -30,7 +30,7 @@ public Bitmap(string filename, bool useIcm)
// so if the app's default directory changes we won't get an error.
filename = Path.GetFullPath(filename);
- IntPtr bitmap = IntPtr.Zero;
+ IntPtr bitmap;
int status;
if (useIcm)
@@ -88,7 +88,7 @@ public Bitmap(int width, int height, Graphics g)
throw new ArgumentNullException(nameof(g));
}
- IntPtr bitmap = IntPtr.Zero;
+ IntPtr bitmap;
int status = Gdip.GdipCreateBitmapFromGraphics(width, height, new HandleRef(g, g.NativeGraphics), out bitmap);
Gdip.CheckStatus(status);
@@ -97,7 +97,7 @@ public Bitmap(int width, int height, Graphics g)
public Bitmap(int width, int height, int stride, PixelFormat format, IntPtr scan0)
{
- IntPtr bitmap = IntPtr.Zero;
+ IntPtr bitmap;
int status = Gdip.GdipCreateBitmapFromScan0(width, height, stride, unchecked((int)format), scan0, out bitmap);
Gdip.CheckStatus(status);
@@ -106,7 +106,7 @@ public Bitmap(int width, int height, int stride, PixelFormat format, IntPtr scan
public Bitmap(int width, int height, PixelFormat format)
{
- IntPtr bitmap = IntPtr.Zero;
+ IntPtr bitmap;
int status = Gdip.GdipCreateBitmapFromScan0(width, height, 0, unchecked((int)format), IntPtr.Zero, out bitmap);
Gdip.CheckStatus(status);
@@ -163,7 +163,7 @@ public static Bitmap FromResource(IntPtr hinstance, string bitmapName)
[EditorBrowsable(EditorBrowsableState.Advanced)]
public IntPtr GetHbitmap(Color background)
{
- IntPtr hBitmap = IntPtr.Zero;
+ IntPtr hBitmap;
int status = Gdip.GdipCreateHBITMAPFromBitmap(new HandleRef(this, nativeImage), out hBitmap,
ColorTranslator.ToWin32(background));
if (status == 2 /* invalid parameter*/ && (Width >= short.MaxValue || Height >= short.MaxValue))
@@ -179,7 +179,7 @@ public IntPtr GetHbitmap(Color background)
[EditorBrowsable(EditorBrowsableState.Advanced)]
public IntPtr GetHicon()
{
- IntPtr hIcon = IntPtr.Zero;
+ IntPtr hIcon;
int status = Gdip.GdipCreateHICONFromBitmap(new HandleRef(this, nativeImage), out hIcon);
Gdip.CheckStatus(status);
@@ -193,7 +193,7 @@ public Bitmap Clone(RectangleF rect, PixelFormat format)
throw new ArgumentException(SR.Format(SR.GdiplusInvalidRectangle, rect.ToString()));
}
- IntPtr dstHandle = IntPtr.Zero;
+ IntPtr dstHandle;
int status = Gdip.GdipCloneBitmapArea(
rect.X,
@@ -297,7 +297,7 @@ public Color GetPixel(int x, int y)
throw new ArgumentOutOfRangeException(nameof(y), SR.ValidRangeY);
}
- int color = 0;
+ int color;
int status = Gdip.GdipBitmapGetPixel(new HandleRef(this, nativeImage), x, y, out color);
Gdip.CheckStatus(status);
@@ -337,7 +337,7 @@ public Bitmap Clone(Rectangle rect, PixelFormat format)
throw new ArgumentException(SR.Format(SR.GdiplusInvalidRectangle, rect.ToString()));
}
- IntPtr dstHandle = IntPtr.Zero;
+ IntPtr dstHandle;
int status = Gdip.GdipCloneBitmapAreaI(
rect.X,
rect.Y,
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/BufferedGraphicsContext.Windows.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/BufferedGraphicsContext.Windows.cs
index 0f492fc7bbd3ec..4eb8e61eb2601c 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/BufferedGraphicsContext.Windows.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/BufferedGraphicsContext.Windows.cs
@@ -139,7 +139,6 @@ private unsafe bool FillBitmapInfo(IntPtr hdc, IntPtr hpal, ref Interop.Gdi32.BI
if (hbm != IntPtr.Zero)
{
Interop.Gdi32.DeleteObject(hbm);
- hbm = IntPtr.Zero;
}
}
return bRet;
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Drawing2D/HatchBrush.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Drawing2D/HatchBrush.cs
index 92a14ba4c3945b..c34fe129b8a3cf 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Drawing2D/HatchBrush.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Drawing2D/HatchBrush.cs
@@ -35,7 +35,7 @@ internal HatchBrush(IntPtr nativeBrush)
public override object Clone()
{
- IntPtr clonedBrush = IntPtr.Zero;
+ IntPtr clonedBrush;
int status = Gdip.GdipCloneBrush(new HandleRef(this, NativeBrush), out clonedBrush);
Gdip.CheckStatus(status);
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Font.Unix.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Font.Unix.cs
index 8163d0eefb15e3..9721c7ff5681f7 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Font.Unix.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Font.Unix.cs
@@ -72,7 +72,7 @@ private void CreateFont(string familyName, float emSize, FontStyle style, Graphi
internal void unitConversion(GraphicsUnit fromUnit, GraphicsUnit toUnit, float nSrc, out float nTrg)
{
- float inchs = 0;
+ float inchs;
nTrg = 0;
switch (fromUnit)
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/FontConverter.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/FontConverter.cs
index ace1758b4d577a..41a39db24d23d6 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/FontConverter.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/FontConverter.cs
@@ -128,7 +128,7 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destina
char separator = culture.TextInfo.ListSeparator[0]; // For vi-VN: ','
string fontName = font; // start with the assumption that only the font name was provided.
string? style = null;
- string? sizeStr = null;
+ string? sizeStr;
float fontSize = 8.25f;
FontStyle fontStyle = FontStyle.Regular;
GraphicsUnit units = GraphicsUnit.Point;
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/FontFamily.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/FontFamily.cs
index 51c451037168de..bfd28aeeb6e277 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/FontFamily.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/FontFamily.cs
@@ -68,7 +68,7 @@ internal FontFamily(string name, bool createDefaultOnFail)
// Note: GDI+ creates singleton font family objects (from the corresponding font file) and reference count them.
private void CreateFontFamily(string name, FontCollection? fontCollection)
{
- IntPtr fontfamily = IntPtr.Zero;
+ IntPtr fontfamily;
IntPtr nativeFontCollection = (fontCollection == null) ? IntPtr.Zero : fontCollection._nativeFontCollection;
int status = Gdip.GdipCreateFontFamilyFromName(name, new HandleRef(fontCollection, nativeFontCollection), out fontfamily);
@@ -105,7 +105,7 @@ private void CreateFontFamily(string name, FontCollection? fontCollection)
///
public FontFamily(GenericFontFamilies genericFamily)
{
- IntPtr nativeFamily = IntPtr.Zero;
+ IntPtr nativeFamily;
int status;
switch (genericFamily)
@@ -204,7 +204,7 @@ public unsafe string GetName(int language)
private static IntPtr GetGdipGenericSansSerif()
{
- IntPtr nativeFamily = IntPtr.Zero;
+ IntPtr nativeFamily;
int status = Gdip.GdipGetGenericFontFamilySansSerif(out nativeFamily);
Gdip.CheckStatus(status);
@@ -253,7 +253,7 @@ public bool IsStyleAvailable(FontStyle style)
///
public int GetEmHeight(FontStyle style)
{
- int result = 0;
+ int result;
int status = Gdip.GdipGetEmHeight(new HandleRef(this, NativeFamily), style, out result);
Gdip.CheckStatus(status);
@@ -265,7 +265,7 @@ public int GetEmHeight(FontStyle style)
///
public int GetCellAscent(FontStyle style)
{
- int result = 0;
+ int result;
int status = Gdip.GdipGetCellAscent(new HandleRef(this, NativeFamily), style, out result);
Gdip.CheckStatus(status);
@@ -277,7 +277,7 @@ public int GetCellAscent(FontStyle style)
///
public int GetCellDescent(FontStyle style)
{
- int result = 0;
+ int result;
int status = Gdip.GdipGetCellDescent(new HandleRef(this, NativeFamily), style, out result);
Gdip.CheckStatus(status);
@@ -290,7 +290,7 @@ public int GetCellDescent(FontStyle style)
///
public int GetLineSpacing(FontStyle style)
{
- int result = 0;
+ int result;
int status = Gdip.GdipGetLineSpacing(new HandleRef(this, NativeFamily), style, out result);
Gdip.CheckStatus(status);
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/GdiPlusStreamHelper.Unix.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/GdiPlusStreamHelper.Unix.cs
index fb55982f8068dd..8013e23f54936a 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/GdiPlusStreamHelper.Unix.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/GdiPlusStreamHelper.Unix.cs
@@ -85,7 +85,7 @@ public unsafe int StreamGetBytesImpl(byte* buf, int bufsz, bool peek)
if (bufsz <= 0)
return 0;
- int read = 0;
+ int read;
long originalPosition = 0;
if (peek)
{
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Gdiplus.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Gdiplus.cs
index be0dd1f4b0a27a..512dd06f3bfb02 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Gdiplus.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Gdiplus.cs
@@ -30,7 +30,7 @@ static Gdip()
// GDI+ ref counts multiple calls to Startup in the same process, so calls from multiple
// domains are ok, just make sure to pair each w/GdiplusShutdown
- int status = GdiplusStartup(out s_initToken, ref input, out StartupOutput output);
+ int status = GdiplusStartup(out s_initToken, ref input, out _);
CheckStatus(status);
}
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/GdiplusNative.Unix.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/GdiplusNative.Unix.cs
index 1a85c2a79bd0df..cb74840b78e7b0 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/GdiplusNative.Unix.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/GdiplusNative.Unix.cs
@@ -30,7 +30,7 @@ internal static IntPtr LoadNativeLibrary()
{
var assembly = System.Reflection.Assembly.GetExecutingAssembly();
- IntPtr lib = IntPtr.Zero;
+ IntPtr lib;
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
if (!NativeLibrary.TryLoad("libgdiplus.dylib", assembly, default, out lib))
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Graphics.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Graphics.cs
index 4917e8f33d8314..9bb60157e61589 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Graphics.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Graphics.cs
@@ -382,7 +382,7 @@ public unsafe Matrix3x2 TransformElements
public IntPtr GetHdc()
{
- IntPtr hdc = IntPtr.Zero;
+ IntPtr hdc;
Gdip.CheckStatus(Gdip.GdipGetDC(new HandleRef(this, NativeGraphics), out hdc));
_nativeHdc = hdc; // need to cache the hdc to be able to release with a call to IDeviceContext.ReleaseHdc().
@@ -708,6 +708,16 @@ public void DrawBezier(Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)
DrawBezier(pen, pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
}
+ ///
+ /// Draws the outline of a rectangle specified by .
+ ///
+ /// A Pen that determines the color, width, and style of the rectangle.
+ /// A Rectangle structure that represents the rectangle to draw.
+ public void DrawRectangle(Pen pen, RectangleF rect)
+ {
+ DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height);
+ }
+
///
/// Draws the outline of a rectangle specified by .
///
@@ -1325,6 +1335,18 @@ public void FillPie(Brush brush, Rectangle rect, float startAngle, float sweepAn
FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
}
+ ///
+ /// Fills the interior of a pie section defined by an ellipse and two radial lines.
+ ///
+ /// A Brush that determines the characteristics of the fill.
+ /// A Rectangle structure that represents the bounding rectangle that defines the ellipse from which the pie section comes.
+ /// Angle in degrees measured clockwise from the x-axis to the first side of the pie section.
+ /// Angle in degrees measured clockwise from the parameter to the second side of the pie section.
+ public void FillPie(Brush brush, RectangleF rect, float startAngle, float sweepAngle)
+ {
+ FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
+ }
+
///
/// Fills the interior of a pie section defined by an ellipse and two radial lines.
///
@@ -1544,8 +1566,8 @@ public SizeF MeasureString(string? text, Font font, PointF origin, StringFormat?
ref layout,
new HandleRef(stringFormat, stringFormat?.nativeFormat ?? IntPtr.Zero),
ref boundingBox,
- out int a,
- out int b));
+ out _,
+ out _));
return boundingBox.Size;
}
@@ -1570,8 +1592,8 @@ public SizeF MeasureString(string? text, Font font, SizeF layoutArea, StringForm
ref layout,
new HandleRef(stringFormat, stringFormat?.nativeFormat ?? IntPtr.Zero),
ref boundingBox,
- out int a,
- out int b));
+ out _,
+ out _));
return boundingBox.Size;
}
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Icon.Unix.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Icon.Unix.cs
index bd14e2d73e7f72..9cb8421417051b 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Icon.Unix.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Icon.Unix.cs
@@ -545,10 +545,6 @@ internal Bitmap BuildBitmapOnWin32()
BitmapInfoHeader bih = ii.iconHeader;
int biHeight = bih.biHeight / 2;
- int ncolors = (int)bih.biClrUsed;
- if ((ncolors == 0) && (bih.biBitCount < 24))
- ncolors = (int)(1 << bih.biBitCount);
-
switch (bih.biBitCount)
{
case 1:
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Icon.Windows.NoCOMWrappers.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Icon.Windows.NoCOMWrappers.cs
index 34a5d19a0d9c83..124ce9f3a7bda1 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Icon.Windows.NoCOMWrappers.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Icon.Windows.NoCOMWrappers.cs
@@ -15,6 +15,7 @@ public void Save(Stream outputStream)
{
if (_iconData != null)
{
+ ArgumentNullException.ThrowIfNull(outputStream);
outputStream.Write(_iconData, 0, _iconData.Length);
}
else
@@ -32,9 +33,7 @@ public void Save(Stream outputStream)
{
try
{
- if (outputStream == null)
- throw new ArgumentNullException(nameof(outputStream));
-
+ ArgumentNullException.ThrowIfNull(outputStream);
picture.SaveAsFile(new GPStream(outputStream, makeSeekable: false), -1, out int temp);
}
finally
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Icon.Windows.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Icon.Windows.cs
index 73e65b379fe573..1ee3b3705ecf1d 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Icon.Windows.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Icon.Windows.cs
@@ -314,8 +314,8 @@ private void DrawIcon(IntPtr dc, Rectangle imageRect, Rectangle targetRect, bool
int imageHeight;
int targetX = 0;
int targetY = 0;
- int targetWidth = 0;
- int targetHeight = 0;
+ int targetWidth;
+ int targetHeight;
Size cursorSize = Size;
@@ -398,7 +398,6 @@ private static IntPtr SaveClipRgn(IntPtr hDC)
if (result > 0)
{
hSaveRgn = hTempRgn;
- hTempRgn = IntPtr.Zero;
}
else
{
@@ -811,7 +810,7 @@ private unsafe Bitmap BmpFrame()
Size size = Size;
bitmap = new Bitmap(size.Width, size.Height); // initialized to transparent
- Graphics? graphics = null;
+ Graphics? graphics;
using (graphics = Graphics.FromImage(bitmap))
{
try
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Image.Unix.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Image.Unix.cs
index 45504c00830efc..c12a3695349381 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Image.Unix.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Image.Unix.cs
@@ -328,7 +328,7 @@ protected virtual void Dispose(bool disposing)
public object Clone()
{
- IntPtr newimage = IntPtr.Zero;
+ IntPtr newimage;
int status = Gdip.GdipCloneImage(nativeImage, out newimage);
Gdip.CheckStatus(status);
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Image.Windows.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Image.Windows.cs
index c359e7af7fdd38..b561398144222e 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Image.Windows.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Image.Windows.cs
@@ -41,9 +41,7 @@ private IntPtr InitializeFromStream(Stream stream)
nativeImage = image;
- int type = -1;
-
- Gdip.CheckStatus(Gdip.GdipGetImageType(new HandleRef(this, nativeImage), out type));
+ Gdip.CheckStatus(Gdip.GdipGetImageType(new HandleRef(this, nativeImage), out _));
EnsureSave(this, null, stream);
return image;
}
@@ -71,7 +69,7 @@ private static unsafe IntPtr LoadGdipImageFromStream(GPStream stream, bool useEm
///
public object Clone()
{
- IntPtr cloneImage = IntPtr.Zero;
+ IntPtr cloneImage;
Gdip.CheckStatus(Gdip.GdipCloneImage(new HandleRef(this, nativeImage), out cloneImage));
ValidateImage(cloneImage);
@@ -386,7 +384,7 @@ public ColorPalette Palette
///
public Image GetThumbnailImage(int thumbWidth, int thumbHeight, GetThumbnailImageAbort? callback, IntPtr callbackData)
{
- IntPtr thumbImage = IntPtr.Zero;
+ IntPtr thumbImage;
Gdip.CheckStatus(Gdip.GdipGetImageThumbnail(
new HandleRef(this, nativeImage),
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Image.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Image.cs
index 24977ec94a51f2..c84a286c0df1b2 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Image.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Image.cs
@@ -109,7 +109,7 @@ public static Image FromFile(string filename, bool useEmbeddedColorManagement)
// so if our app changes default directory we won't get an error
filename = Path.GetFullPath(filename);
- IntPtr image = IntPtr.Zero;
+ IntPtr image;
if (useEmbeddedColorManagement)
{
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Imaging/ImageAttributes.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Imaging/ImageAttributes.cs
index dca1674b2d5367..cf64a391c60c0c 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Imaging/ImageAttributes.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Imaging/ImageAttributes.cs
@@ -55,7 +55,7 @@ internal void SetNativeImageAttributes(IntPtr handle)
///
public ImageAttributes()
{
- IntPtr newImageAttributes = IntPtr.Zero;
+ IntPtr newImageAttributes;
int status = Gdip.GdipCreateImageAttributes(out newImageAttributes);
@@ -126,7 +126,7 @@ private void Dispose(bool disposing)
///
public object Clone()
{
- IntPtr clone = IntPtr.Zero;
+ IntPtr clone;
int status = Gdip.GdipCloneImageAttributes(
new HandleRef(this, nativeImageAttributes),
@@ -443,7 +443,7 @@ public void SetRemapTable(ColorMap[] map)
public void SetRemapTable(ColorMap[] map, ColorAdjustType type)
{
- int index = 0;
+ int index;
int mapSize = map.Length;
int size = 4; // Marshal.SizeOf(index.GetType());
IntPtr memory = Marshal.AllocHGlobal(checked(mapSize * size * 2));
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.Windows.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.Windows.cs
index 3e23c5226b3bb3..500ab7f54e6a22 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.Windows.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Imaging/Metafile.Windows.cs
@@ -63,7 +63,7 @@ public Metafile(IntPtr referenceHdc, EmfType emfType, string? description)
///
public Metafile(IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, string? desc)
{
- IntPtr metafile = IntPtr.Zero;
+ IntPtr metafile;
if (frameRect.IsEmpty)
{
@@ -117,7 +117,7 @@ public Metafile(string fileName, IntPtr referenceHdc, Rectangle frameRect, Metaf
// Called in order to emulate exception behavior from .NET Framework related to invalid file paths.
Path.GetFullPath(fileName);
- IntPtr metafile = IntPtr.Zero;
+ IntPtr metafile;
if (frameRect.IsEmpty)
{
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Pen.Unix.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Pen.Unix.cs
index 4ac028d91dccf6..42a552112e6506 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Pen.Unix.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Pen.Unix.cs
@@ -21,7 +21,7 @@ public CustomLineCap CustomStartCap
{
get
{
- IntPtr lineCap = IntPtr.Zero;
+ IntPtr lineCap;
int status = Gdip.GdipGetPenCustomStartCap(new HandleRef(this, NativePen), out lineCap);
Gdip.CheckStatus(status);
if (lineCap == IntPtr.Zero)
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Pen.Windows.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Pen.Windows.cs
index 8f2a76b8f5824b..6c295fe9b00337 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Pen.Windows.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Pen.Windows.cs
@@ -16,7 +16,7 @@ public CustomLineCap CustomStartCap
{
get
{
- IntPtr lineCap = IntPtr.Zero;
+ IntPtr lineCap;
int status = Gdip.GdipGetPenCustomStartCap(new HandleRef(this, NativePen), out lineCap);
Gdip.CheckStatus(status);
@@ -42,7 +42,7 @@ public CustomLineCap CustomEndCap
{
get
{
- IntPtr lineCap = IntPtr.Zero;
+ IntPtr lineCap;
int status = Gdip.GdipGetPenCustomEndCap(new HandleRef(this, NativePen), out lineCap);
Gdip.CheckStatus(status);
return CustomLineCap.CreateCustomLineCapObject(lineCap);
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Pen.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Pen.cs
index ca5d045000dd4e..cf22eae646cd40 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Pen.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Pen.cs
@@ -91,7 +91,7 @@ public Pen(Brush brush, float width)
throw new ArgumentNullException(nameof(brush));
}
- IntPtr pen = IntPtr.Zero;
+ IntPtr pen;
int status = Gdip.GdipCreatePen2(new HandleRef(brush, brush.NativeBrush),
width,
(int)GraphicsUnit.World,
@@ -115,7 +115,7 @@ internal void SetNativePen(IntPtr nativePen)
///
public object Clone()
{
- IntPtr clonedPen = IntPtr.Zero;
+ IntPtr clonedPen;
int status = Gdip.GdipClonePen(new HandleRef(this, NativePen), out clonedPen);
Gdip.CheckStatus(status);
@@ -226,7 +226,7 @@ public LineCap StartCap
{
get
{
- int startCap = 0;
+ int startCap;
int status = Gdip.GdipGetPenStartCap(new HandleRef(this, NativePen), out startCap);
Gdip.CheckStatus(status);
@@ -268,7 +268,7 @@ public LineCap EndCap
{
get
{
- int endCap = 0;
+ int endCap;
int status = Gdip.GdipGetPenEndCap(new HandleRef(this, NativePen), out endCap);
Gdip.CheckStatus(status);
@@ -311,7 +311,7 @@ public DashCap DashCap
{
get
{
- int dashCap = 0;
+ int dashCap;
int status = Gdip.GdipGetPenDashCap197819(new HandleRef(this, NativePen), out dashCap);
Gdip.CheckStatus(status);
@@ -341,7 +341,7 @@ public LineJoin LineJoin
{
get
{
- int lineJoin = 0;
+ int lineJoin;
int status = Gdip.GdipGetPenLineJoin(new HandleRef(this, NativePen), out lineJoin);
Gdip.CheckStatus(status);
@@ -396,7 +396,7 @@ public PenAlignment Alignment
{
get
{
- PenAlignment penMode = 0;
+ PenAlignment penMode;
int status = Gdip.GdipGetPenMode(new HandleRef(this, NativePen), out penMode);
Gdip.CheckStatus(status);
@@ -543,7 +543,7 @@ public PenType PenType
{
get
{
- int type = -1;
+ int type;
int status = Gdip.GdipGetPenFillType(new HandleRef(this, NativePen), out type);
Gdip.CheckStatus(status);
@@ -565,7 +565,7 @@ public Color Color
throw new ArgumentException(SR.GdiplusInvalidParameter);
}
- int colorARGB = 0;
+ int colorARGB;
int status = Gdip.GdipGetPenColor(new HandleRef(this, NativePen), out colorARGB);
Gdip.CheckStatus(status);
@@ -659,7 +659,7 @@ public Brush Brush
private IntPtr GetNativeBrush()
{
- IntPtr nativeBrush = IntPtr.Zero;
+ IntPtr nativeBrush;
int status = Gdip.GdipGetPenBrushFill(new HandleRef(this, NativePen), out nativeBrush);
Gdip.CheckStatus(status);
@@ -673,7 +673,7 @@ public DashStyle DashStyle
{
get
{
- int dashStyle = 0;
+ int dashStyle;
int status = Gdip.GdipGetPenDashStyle(new HandleRef(this, NativePen), out dashStyle);
Gdip.CheckStatus(status);
@@ -714,7 +714,7 @@ public DashStyle DashStyle
///
private void EnsureValidDashPattern()
{
- int retval = 0;
+ int retval;
int status = Gdip.GdipGetPenDashCount(new HandleRef(this, NativePen), out retval);
Gdip.CheckStatus(status);
@@ -832,7 +832,7 @@ public float[] CompoundArray
{
get
{
- int count = 0;
+ int count;
int status = Gdip.GdipGetPenCompoundCount(new HandleRef(this, NativePen), out count);
Gdip.CheckStatus(status);
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.Windows.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.Windows.cs
index 47bb8a61937b15..24c8e0761adb2e 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.Windows.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PrinterSettings.Windows.cs
@@ -188,12 +188,12 @@ public static StringCollection InstalledPrinters
int bufferSize;
int count;
- Interop.Winspool.EnumPrinters(SafeNativeMethods.PRINTER_ENUM_LOCAL | SafeNativeMethods.PRINTER_ENUM_CONNECTIONS, null, Level, IntPtr.Zero, 0, out bufferSize, out count);
+ Interop.Winspool.EnumPrinters(SafeNativeMethods.PRINTER_ENUM_LOCAL | SafeNativeMethods.PRINTER_ENUM_CONNECTIONS, null, Level, IntPtr.Zero, 0, out bufferSize, out _);
IntPtr buffer = Marshal.AllocCoTaskMem(bufferSize);
int returnCode = Interop.Winspool.EnumPrinters(SafeNativeMethods.PRINTER_ENUM_LOCAL | SafeNativeMethods.PRINTER_ENUM_CONNECTIONS,
null, Level, buffer,
- bufferSize, out bufferSize, out count);
+ bufferSize, out _, out count);
var array = new string[count];
if (returnCode == 0)
@@ -448,7 +448,7 @@ public bool IsDirectPrintingSupported(ImageFormat imageFormat)
if (imageFormat.Equals(ImageFormat.Jpeg) || imageFormat.Equals(ImageFormat.Png))
{
int nEscape = imageFormat.Equals(ImageFormat.Jpeg) ? Interop.Gdi32.CHECKJPEGFORMAT : Interop.Gdi32.CHECKPNGFORMAT;
- int outData = 0;
+ int outData;
DeviceContext dc = CreateInformationContext(DefaultPageSettings);
HandleRef hdc = new HandleRef(dc, dc.Hdc);
try
@@ -707,7 +707,6 @@ private static string GetDefaultPrinterName()
string name = ReadOneDEVNAME(names, 1);
Interop.Kernel32.GlobalUnlock(handle);
- names = IntPtr.Zero;
// Windows allocates them, but we have to free them
Interop.Kernel32.GlobalFree(data.hDevNames);
@@ -731,7 +730,6 @@ private static string GetDefaultPrinterName()
string name = ReadOneDEVNAME(names, 1);
Interop.Kernel32.GlobalUnlock(handle);
- names = IntPtr.Zero;
// Windows allocates them, but we have to free them
Interop.Kernel32.GlobalFree(data.hDevNames);
@@ -761,7 +759,6 @@ private static string GetOutputPort()
string name = ReadOneDEVNAME(names, 2);
Interop.Kernel32.GlobalUnlock(handle);
- names = IntPtr.Zero;
// Windows allocates them, but we have to free them
Interop.Kernel32.GlobalFree(data.hDevNames);
@@ -786,7 +783,6 @@ private static string GetOutputPort()
string name = ReadOneDEVNAME(names, 2);
Interop.Kernel32.GlobalUnlock(handle);
- names = IntPtr.Zero;
// Windows allocates them, but we have to free them
Interop.Kernel32.GlobalFree(data.hDevNames);
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PrintingServices.Unix.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PrintingServices.Unix.cs
index 07c60aa8f943f4..6ccb314c06078c 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PrintingServices.Unix.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PrintingServices.Unix.cs
@@ -202,7 +202,7 @@ internal static void LoadPrinterSettings(string printer, PrinterSettings setting
settings.PrinterCapabilities.Clear();
- IntPtr dests = IntPtr.Zero, ptr = IntPtr.Zero, ptr_printer, ppd_handle = IntPtr.Zero;
+ IntPtr dests = IntPtr.Zero, ptr, ptr_printer, ppd_handle;
string name = string.Empty;
CUPS_DESTS printer_dest;
PPD_FILE ppd;
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Region.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Region.cs
index 379fc61e2e154f..d53c41d5e528c7 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Region.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Region.cs
@@ -337,7 +337,7 @@ public bool Equals(Region region, Graphics g)
return null;
byte[] regionData = new byte[regionSize];
- Gdip.CheckStatus(Gdip.GdipGetRegionData(new HandleRef(this, NativeRegion), regionData, regionSize, out regionSize));
+ Gdip.CheckStatus(Gdip.GdipGetRegionData(new HandleRef(this, NativeRegion), regionData, regionSize, out _));
return new RegionData(regionData);
}
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/SolidBrush.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/SolidBrush.cs
index 951947d87b5dee..6ff77667eae7b4 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/SolidBrush.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/SolidBrush.cs
@@ -53,7 +53,7 @@ internal SolidBrush(IntPtr nativeBrush)
public override object Clone()
{
- IntPtr clonedBrush = IntPtr.Zero;
+ IntPtr clonedBrush;
int status = Gdip.GdipCloneBrush(new HandleRef(this, NativeBrush), out clonedBrush);
Gdip.CheckStatus(status);
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/StringFormat.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/StringFormat.cs
index cd0a7d074d1c18..e233fe56798f39 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/StringFormat.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/StringFormat.cs
@@ -110,7 +110,7 @@ private void Dispose(bool disposing)
///
public object Clone()
{
- IntPtr cloneFormat = IntPtr.Zero;
+ IntPtr cloneFormat;
int status = Gdip.GdipCloneStringFormat(new HandleRef(this, nativeFormat), out cloneFormat);
@@ -167,7 +167,7 @@ public StringAlignment Alignment
{
get
{
- StringAlignment alignment = 0;
+ StringAlignment alignment;
int status = Gdip.GdipGetStringFormatAlign(new HandleRef(this, nativeFormat), out alignment);
if (status != Gdip.Ok)
@@ -197,7 +197,7 @@ public StringAlignment LineAlignment
{
get
{
- StringAlignment alignment = 0;
+ StringAlignment alignment;
int status = Gdip.GdipGetStringFormatLineAlign(new HandleRef(this, nativeFormat), out alignment);
if (status != Gdip.Ok)
@@ -279,7 +279,7 @@ public void SetTabStops(float firstTabOffset, float[] tabStops)
///
public float[] GetTabStops(out float firstTabOffset)
{
- int count = 0;
+ int count;
int status = Gdip.GdipGetStringFormatTabStopCount(new HandleRef(this, nativeFormat), out count);
if (status != Gdip.Ok)
@@ -393,9 +393,8 @@ public StringDigitSubstitute DigitSubstitutionMethod
get
{
StringDigitSubstitute digitSubstitute;
- int lang = 0;
- int status = Gdip.GdipGetStringFormatDigitSubstitution(new HandleRef(this, nativeFormat), out lang, out digitSubstitute);
+ int status = Gdip.GdipGetStringFormatDigitSubstitution(new HandleRef(this, nativeFormat), out _, out digitSubstitute);
if (status != Gdip.Ok)
throw Gdip.StatusException(status);
@@ -411,9 +410,8 @@ public int DigitSubstitutionLanguage
{
get
{
- StringDigitSubstitute digitSubstitute;
- int language = 0;
- int status = Gdip.GdipGetStringFormatDigitSubstitution(new HandleRef(this, nativeFormat), out language, out digitSubstitute);
+ int language;
+ int status = Gdip.GdipGetStringFormatDigitSubstitution(new HandleRef(this, nativeFormat), out language, out _);
if (status != Gdip.Ok)
throw Gdip.StatusException(status);
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Text/FontCollection.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Text/FontCollection.cs
index aa76ed2e15d693..e774b82c205c0e 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Text/FontCollection.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Text/FontCollection.cs
@@ -35,12 +35,12 @@ public FontFamily[] Families
{
get
{
- int numSought = 0;
+ int numSought;
int status = Gdip.GdipGetFontCollectionFamilyCount(new HandleRef(this, _nativeFontCollection), out numSought);
Gdip.CheckStatus(status);
var gpfamilies = new IntPtr[numSought];
- int numFound = 0;
+ int numFound;
status = Gdip.GdipGetFontCollectionFamilyList(new HandleRef(this, _nativeFontCollection), numSought, gpfamilies,
out numFound);
Gdip.CheckStatus(status);
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/TextureBrush.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/TextureBrush.cs
index 56ce6c20e3c97c..53d9ea5c117f70 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/TextureBrush.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/TextureBrush.cs
@@ -34,7 +34,7 @@ public TextureBrush(Image image, WrapMode wrapMode)
throw new InvalidEnumArgumentException(nameof(wrapMode), unchecked((int)wrapMode), typeof(WrapMode));
}
- IntPtr brush = IntPtr.Zero;
+ IntPtr brush;
int status = Gdip.GdipCreateTexture(new HandleRef(image, image.nativeImage),
(int)wrapMode,
out brush);
@@ -55,7 +55,7 @@ public TextureBrush(Image image, WrapMode wrapMode, RectangleF dstRect)
throw new InvalidEnumArgumentException(nameof(wrapMode), unchecked((int)wrapMode), typeof(WrapMode));
}
- IntPtr brush = IntPtr.Zero;
+ IntPtr brush;
int status = Gdip.GdipCreateTexture2(new HandleRef(image, image.nativeImage),
unchecked((int)wrapMode),
dstRect.X,
@@ -80,7 +80,7 @@ public TextureBrush(Image image, WrapMode wrapMode, Rectangle dstRect)
throw new InvalidEnumArgumentException(nameof(wrapMode), unchecked((int)wrapMode), typeof(WrapMode));
}
- IntPtr brush = IntPtr.Zero;
+ IntPtr brush;
int status = Gdip.GdipCreateTexture2I(new HandleRef(image, image.nativeImage),
unchecked((int)wrapMode),
dstRect.X,
@@ -102,7 +102,7 @@ public TextureBrush(Image image, RectangleF dstRect, ImageAttributes? imageAttr)
throw new ArgumentNullException(nameof(image));
}
- IntPtr brush = IntPtr.Zero;
+ IntPtr brush;
int status = Gdip.GdipCreateTextureIA(new HandleRef(image, image.nativeImage),
new HandleRef(imageAttr, (imageAttr == null) ?
IntPtr.Zero : imageAttr.nativeImageAttributes),
@@ -125,7 +125,7 @@ public TextureBrush(Image image, Rectangle dstRect, ImageAttributes? imageAttr)
throw new ArgumentNullException(nameof(image));
}
- IntPtr brush = IntPtr.Zero;
+ IntPtr brush;
int status = Gdip.GdipCreateTextureIAI(new HandleRef(image, image.nativeImage),
new HandleRef(imageAttr, (imageAttr == null) ?
IntPtr.Zero : imageAttr.nativeImageAttributes),
@@ -147,7 +147,7 @@ internal TextureBrush(IntPtr nativeBrush)
public override object Clone()
{
- IntPtr cloneBrush = IntPtr.Zero;
+ IntPtr cloneBrush;
int status = Gdip.GdipCloneBrush(new HandleRef(this, NativeBrush), out cloneBrush);
Gdip.CheckStatus(status);
@@ -180,7 +180,7 @@ public WrapMode WrapMode
{
get
{
- int mode = 0;
+ int mode;
int status = Gdip.GdipGetTextureWrapMode(new HandleRef(this, NativeBrush), out mode);
Gdip.CheckStatus(status);
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/ToolboxBitmapAttribute.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/ToolboxBitmapAttribute.cs
index aad75a27f3516e..be2a5c7d7679a9 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/ToolboxBitmapAttribute.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/ToolboxBitmapAttribute.cs
@@ -88,7 +88,7 @@ public override bool Equals([NotNullWhen(true)] object? value)
{
if ((large && _largeImage == null) || (!large && _smallImage == null))
{
- Image? img = null;
+ Image? img;
if (large)
{
img = _largeImage;
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/macFunctions.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/macFunctions.cs
index b8483c9fa53ef8..90b91cbe54729f 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/macFunctions.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/macFunctions.cs
@@ -61,8 +61,8 @@ internal static CocoaContext GetCGContextForNSView(IntPtr handle)
internal static CarbonContext GetCGContextForView(IntPtr handle)
{
IntPtr context = IntPtr.Zero;
- IntPtr port = IntPtr.Zero;
- IntPtr window = IntPtr.Zero;
+ IntPtr port;
+ IntPtr window;
window = GetControlOwner(handle);
diff --git a/src/libraries/System.Drawing.Common/tests/GraphicsTests.Core.cs b/src/libraries/System.Drawing.Common/tests/GraphicsTests.Core.cs
index 3a137da17c7e5e..d691cd23ff9dfd 100644
--- a/src/libraries/System.Drawing.Common/tests/GraphicsTests.Core.cs
+++ b/src/libraries/System.Drawing.Common/tests/GraphicsTests.Core.cs
@@ -77,5 +77,154 @@ public void TransformElements_RoundTrip()
}
}
}
+
+ [ConditionalFact(Helpers.IsDrawingSupported)]
+ public void DrawRectangle_NullPen_ThrowsArgumentNullException_Core()
+ {
+ using (var image = new Bitmap(10, 10))
+ using (Graphics graphics = Graphics.FromImage(image))
+ {
+ AssertExtensions.Throws("pen", () => graphics.DrawRectangle(null, new RectangleF(0f, 0f, 1f, 1f)));
+ // other DrawRectangle overloads tested in DrawRectangle_NullPen_ThrowsArgumentNullException()
+ }
+ }
+
+ [ConditionalFact(Helpers.IsDrawingSupported)]
+ public void DrawRectangle_DisposedPen_ThrowsArgumentException_Core()
+ {
+ using (var image = new Bitmap(10, 10))
+ using (Graphics graphics = Graphics.FromImage(image))
+ {
+ var pen = new Pen(Color.Red);
+ pen.Dispose();
+
+ AssertExtensions.Throws(null, () => graphics.DrawRectangle(pen, new RectangleF(0f, 0f, 1f, 1f)));
+ // other DrawRectangle overloads tested in DrawRectangle_DisposedPen_ThrowsArgumentException()
+ }
+ }
+
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)]
+ [ConditionalFact(Helpers.IsDrawingSupported)]
+ public void DrawRectangle_Busy_ThrowsInvalidOperationException_Core()
+ {
+ using (var image = new Bitmap(10, 10))
+ using (Graphics graphics = Graphics.FromImage(image))
+ using (var pen = new Pen(Color.Red))
+ {
+ graphics.GetHdc();
+ try
+ {
+ Assert.Throws(() => graphics.DrawRectangle(pen, new RectangleF(0f, 0f, 1f, 1f)));
+ // other DrawRectangle overloads tested in DrawRectangle_Busy_ThrowsInvalidOperationException()
+ }
+ finally
+ {
+ graphics.ReleaseHdc();
+ }
+ }
+ }
+
+ [ConditionalFact(Helpers.IsDrawingSupported)]
+ public void DrawRectangle_Disposed_ThrowsArgumentException_Core()
+ {
+ using (var image = new Bitmap(10, 10))
+ using (var pen = new Pen(Color.Red))
+ {
+ Graphics graphics = Graphics.FromImage(image);
+ graphics.Dispose();
+
+ AssertExtensions.Throws(null, () => graphics.DrawRectangle(pen, new RectangleF(0f, 0f, 1f, 1f)));
+ // other DrawRectangle overloads tested in DrawRectangle_Disposed_ThrowsArgumentException()
+ }
+ }
+
+ [ConditionalFact(Helpers.IsDrawingSupported)]
+ public void FillPie_NullPen_ThrowsArgumentNullException_Core()
+ {
+ using (var image = new Bitmap(10, 10))
+ using (Graphics graphics = Graphics.FromImage(image))
+ {
+ AssertExtensions.Throws("brush", () => graphics.FillPie(null, new RectangleF(0, 0, 1, 1), 0, 90));
+ // other FillPie overloads tested in FillPie_NullPen_ThrowsArgumentNullException()
+ }
+ }
+
+ [ConditionalFact(Helpers.IsDrawingSupported)]
+ public void FillPie_DisposedPen_ThrowsArgumentException_Core()
+ {
+ using (var image = new Bitmap(10, 10))
+ using (Graphics graphics = Graphics.FromImage(image))
+ {
+ var brush = new SolidBrush(Color.Red);
+ brush.Dispose();
+
+ AssertExtensions.Throws(null, () => graphics.FillPie(brush, new RectangleF(0, 0, 1, 1), 0, 90));
+ // other FillPie overloads tested in FillPie_DisposedPen_ThrowsArgumentException()
+ }
+ }
+
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)]
+ [ConditionalFact(Helpers.IsDrawingSupported)]
+ public void FillPie_ZeroWidth_ThrowsArgumentException_Core()
+ {
+ using (var image = new Bitmap(10, 10))
+ using (Graphics graphics = Graphics.FromImage(image))
+ using (var brush = new SolidBrush(Color.Red))
+ {
+ AssertExtensions.Throws(null, () => graphics.FillPie(brush, new RectangleF(0, 0, 0, 1), 0, 90));
+ // other FillPie overloads tested in FillPie_ZeroWidth_ThrowsArgumentException()
+ }
+ }
+
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)]
+ [ConditionalFact(Helpers.IsDrawingSupported)]
+ public void FillPie_ZeroHeight_ThrowsArgumentException_Core()
+ {
+ using (var image = new Bitmap(10, 10))
+ using (Graphics graphics = Graphics.FromImage(image))
+ using (var brush = new SolidBrush(Color.Red))
+ {
+ AssertExtensions.Throws(null, () => graphics.FillPie(brush, new RectangleF(0, 0, 1, 0), 0, 90));
+ // other FillPie overloads tested in FillPie_ZeroHeight_ThrowsArgumentException()
+ }
+ }
+
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)]
+ [ConditionalFact(Helpers.IsDrawingSupported)]
+ public void FillPie_Busy_ThrowsInvalidOperationException_Core()
+ {
+ using (var image = new Bitmap(10, 10))
+ using (Graphics graphics = Graphics.FromImage(image))
+ using (var brush = new SolidBrush(Color.Red))
+ {
+ graphics.GetHdc();
+ try
+ {
+ Assert.Throws(() => graphics.FillPie(brush, new RectangleF(0, 0, 1, 1), 0, 90));
+ // other FillPie overloads tested in FillPie_Busy_ThrowsInvalidOperationException()
+ }
+ finally
+ {
+ graphics.ReleaseHdc();
+ }
+ }
+ }
+
+ [ConditionalFact(Helpers.IsDrawingSupported)]
+ public void FillPie_Disposed_ThrowsArgumentException_Core()
+ {
+ using (var image = new Bitmap(10, 10))
+ using (var brush = new SolidBrush(Color.Red))
+ {
+ Graphics graphics = Graphics.FromImage(image);
+ graphics.Dispose();
+
+ AssertExtensions.Throws(null, () => graphics.FillPie(brush, new RectangleF(0, 0, 1, 1), 0, 90));
+ // other FillPie overloads tested in FillPie_Disposed_ThrowsArgumentException()
+ }
+ }
+
+
+
}
}
diff --git a/src/libraries/System.Drawing.Common/tests/GraphicsTests.cs b/src/libraries/System.Drawing.Common/tests/GraphicsTests.cs
index 8c0f280b863613..c99ad88ea40ae6 100644
--- a/src/libraries/System.Drawing.Common/tests/GraphicsTests.cs
+++ b/src/libraries/System.Drawing.Common/tests/GraphicsTests.cs
@@ -2399,7 +2399,6 @@ public void DrawRectangle_DisposedPen_ThrowsArgumentException()
var pen = new Pen(Color.Red);
pen.Dispose();
-
AssertExtensions.Throws(null, () => graphics.DrawRectangle(pen, new Rectangle(0, 0, 1, 1)));
AssertExtensions.Throws(null, () => graphics.DrawRectangle(pen, 0, 0, 1, 1));
AssertExtensions.Throws(null, () => graphics.DrawRectangle(pen, 0f, 0f, 1f, 1f));
@@ -3099,6 +3098,98 @@ public void DrawClosedCurve_Disposed_ThrowsArgumentException()
}
}
+ [ConditionalFact(Helpers.IsDrawingSupported)]
+ public void FillPie_NullPen_ThrowsArgumentNullException()
+ {
+ using (var image = new Bitmap(10, 10))
+ using (Graphics graphics = Graphics.FromImage(image))
+ {
+ AssertExtensions.Throws("brush", () => graphics.FillPie(null, new Rectangle(0, 0, 1, 1), 0, 90));
+ AssertExtensions.Throws("brush", () => graphics.FillPie(null, 0, 0, 1, 1, 0, 90));
+ AssertExtensions.Throws("brush", () => graphics.FillPie(null, 0f, 0f, 1f, 1f, 0, 90));
+ }
+ }
+
+ [ConditionalFact(Helpers.IsDrawingSupported)]
+ public void FillPie_DisposedPen_ThrowsArgumentException()
+ {
+ using (var image = new Bitmap(10, 10))
+ using (Graphics graphics = Graphics.FromImage(image))
+ {
+ var brush = new SolidBrush(Color.Red);
+ brush.Dispose();
+
+ AssertExtensions.Throws(null, () => graphics.FillPie(brush, new Rectangle(0, 0, 1, 1), 0, 90));
+ AssertExtensions.Throws(null, () => graphics.FillPie(brush, 0, 0, 1, 1, 0, 90));
+ AssertExtensions.Throws(null, () => graphics.FillPie(brush, 0f, 0f, 1f, 1f, 0, 90));
+ }
+ }
+
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)]
+ [ConditionalFact(Helpers.IsDrawingSupported)]
+ public void FillPie_ZeroWidth_ThrowsArgumentException()
+ {
+ using (var image = new Bitmap(10, 10))
+ using (Graphics graphics = Graphics.FromImage(image))
+ using (var brush = new SolidBrush(Color.Red))
+ {
+ AssertExtensions.Throws(null, () => graphics.FillPie(brush, new Rectangle(0, 0, 0, 1), 0, 90));
+ AssertExtensions.Throws(null, () => graphics.FillPie(brush, 0, 0, 0, 1, 0, 90));
+ AssertExtensions.Throws(null, () => graphics.FillPie(brush, 0f, 0f, 0f, 1f, 0, 90));
+ }
+ }
+
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)]
+ [ConditionalFact(Helpers.IsDrawingSupported)]
+ public void FillPie_ZeroHeight_ThrowsArgumentException()
+ {
+ using (var image = new Bitmap(10, 10))
+ using (Graphics graphics = Graphics.FromImage(image))
+ using (var brush = new SolidBrush(Color.Red))
+ {
+ AssertExtensions.Throws(null, () => graphics.FillPie(brush, new Rectangle(0, 0, 1, 0), 0, 90));
+ AssertExtensions.Throws(null, () => graphics.FillPie(brush, 0, 0, 1, 0, 0, 90));
+ AssertExtensions.Throws(null, () => graphics.FillPie(brush, 0f, 0f, 1f, 0f, 0, 90));
+ }
+ }
+
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/22221", TestPlatforms.AnyUnix)]
+ [ConditionalFact(Helpers.IsDrawingSupported)]
+ public void FillPie_Busy_ThrowsInvalidOperationException()
+ {
+ using (var image = new Bitmap(10, 10))
+ using (Graphics graphics = Graphics.FromImage(image))
+ using (var brush = new SolidBrush(Color.Red))
+ {
+ graphics.GetHdc();
+ try
+ {
+ Assert.Throws(() => graphics.FillPie(brush, new Rectangle(0, 0, 1, 1), 0, 90));
+ Assert.Throws(() => graphics.FillPie(brush, 0, 0, 1, 1, 0, 90));
+ Assert.Throws(() => graphics.FillPie(brush, 0f, 0f, 1f, 1f, 0, 90));
+ }
+ finally
+ {
+ graphics.ReleaseHdc();
+ }
+ }
+ }
+
+ [ConditionalFact(Helpers.IsDrawingSupported)]
+ public void FillPie_Disposed_ThrowsArgumentException()
+ {
+ using (var image = new Bitmap(10, 10))
+ using (var brush = new SolidBrush(Color.Red))
+ {
+ Graphics graphics = Graphics.FromImage(image);
+ graphics.Dispose();
+
+ AssertExtensions.Throws(null, () => graphics.FillPie(brush, new Rectangle(0, 0, 1, 1), 0, 90));
+ AssertExtensions.Throws(null, () => graphics.FillPie(brush, 0, 0, 1, 1, 0, 90));
+ AssertExtensions.Throws(null, () => graphics.FillPie(brush, 0f, 0f, 1f, 1f, 0, 90));
+ }
+ }
+
[ConditionalFact(Helpers.IsDrawingSupported)]
public void Clear_Color_Success()
{
diff --git a/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCtor.cs b/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCtor.cs
index 787f9e37f719db..83a3bd57cbfe1b 100644
--- a/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCtor.cs
+++ b/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoCtor.cs
@@ -439,5 +439,14 @@ public void TestCreationWithTemporaryLCID(int lcid)
Assert.NotEqual(lcid, new CultureInfo(lcid).LCID);
}
+
+ [InlineData("zh-TW-u-co-zhuyin")]
+ [InlineData("de-DE-u-co-phoneb")]
+ [InlineData("de-u-co-phonebk")]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsIcuGlobalization))]
+ public void TestCreationWithMangledSortName(string cultureName)
+ {
+ Assert.True(CultureInfo.GetCultureInfo(cultureName).CompareInfo.Name.Equals(cultureName, StringComparison.OrdinalIgnoreCase));
+ }
}
}
diff --git a/src/libraries/System.IO.Compression.Brotli/src/System/IO/Compression/enc/BrotliEncoder.cs b/src/libraries/System.IO.Compression.Brotli/src/System/IO/Compression/enc/BrotliEncoder.cs
index fbd813f4412ec1..c0e737bb10322d 100644
--- a/src/libraries/System.IO.Compression.Brotli/src/System/IO/Compression/enc/BrotliEncoder.cs
+++ b/src/libraries/System.IO.Compression.Brotli/src/System/IO/Compression/enc/BrotliEncoder.cs
@@ -129,7 +129,7 @@ public static int GetMaxCompressedLength(int inputSize)
/// When this method returns, a span of bytes where the compressed data will be stored.
/// When this method returns, the total number of bytes that were written to .
/// One of the enumeration values that describes the status with which the operation finished.
- public OperationStatus Flush(Span destination, out int bytesWritten) => Compress(ReadOnlySpan.Empty, destination, out int bytesConsumed, out bytesWritten, BrotliEncoderOperation.Flush);
+ public OperationStatus Flush(Span destination, out int bytesWritten) => Compress(ReadOnlySpan.Empty, destination, out _, out bytesWritten, BrotliEncoderOperation.Flush);
internal OperationStatus Compress(ReadOnlyMemory source, Memory destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock) => Compress(source.Span, destination.Span, out bytesConsumed, out bytesWritten, isFinalBlock);
diff --git a/src/libraries/System.IO.Compression.ZipFile/tests/System.IO.Compression.ZipFile.Tests.csproj b/src/libraries/System.IO.Compression.ZipFile/tests/System.IO.Compression.ZipFile.Tests.csproj
index 7a2fed130efe48..0a6a7088ace395 100644
--- a/src/libraries/System.IO.Compression.ZipFile/tests/System.IO.Compression.ZipFile.Tests.csproj
+++ b/src/libraries/System.IO.Compression.ZipFile/tests/System.IO.Compression.ZipFile.Tests.csproj
@@ -4,6 +4,15 @@
true
$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser
+
+
+
+ WasmTestOnBrowser
+ $(TestArchiveRoot)browserornodejs/
+ $(TestArchiveTestsRoot)$(OSPlatformConfig)/
+ $(DefineConstants);TARGET_BROWSER
+
+
diff --git a/src/libraries/System.IO.Compression/ref/System.IO.Compression.cs b/src/libraries/System.IO.Compression/ref/System.IO.Compression.cs
index 40175713e69b3f..80b7286baa5416 100644
--- a/src/libraries/System.IO.Compression/ref/System.IO.Compression.cs
+++ b/src/libraries/System.IO.Compression/ref/System.IO.Compression.cs
@@ -49,6 +49,7 @@ public override void Flush() { }
public override void SetLength(long value) { }
public override void Write(byte[] buffer, int offset, int count) { }
public override void Write(System.ReadOnlySpan buffer) { }
+ public override void WriteByte(byte value) { }
public override System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask WriteAsync(System.ReadOnlyMemory buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
@@ -83,6 +84,7 @@ public override void Flush() { }
public override void SetLength(long value) { }
public override void Write(byte[] buffer, int offset, int count) { }
public override void Write(System.ReadOnlySpan buffer) { }
+ public override void WriteByte(byte value) { }
public override System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask WriteAsync(System.ReadOnlyMemory buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateManaged/DeflateManagedStream.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateManaged/DeflateManagedStream.cs
index c3a276593979af..ec71718a511d3d 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateManaged/DeflateManagedStream.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateManaged/DeflateManagedStream.cs
@@ -26,8 +26,6 @@ internal DeflateManagedStream(Stream stream, ZipArchiveEntry.CompressionMethodVa
throw new ArgumentNullException(nameof(stream));
if (!stream.CanRead)
throw new ArgumentException(SR.NotSupported_UnreadableStream, nameof(stream));
- if (!stream.CanRead)
- throw new ArgumentException(SR.NotSupported_UnreadableStream, nameof(stream));
Debug.Assert(method == ZipArchiveEntry.CompressionMethodValues.Deflate64);
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateManaged/InflaterManaged.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateManaged/InflaterManaged.cs
index 1031b5128e6243..a127d93bd1d44b 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateManaged/InflaterManaged.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateManaged/InflaterManaged.cs
@@ -165,7 +165,7 @@ public int Inflate(Span bytes)
private bool Decode()
{
bool eob = false;
- bool result = false;
+ bool result;
if (Finished())
{
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateZLib/DeflateStream.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateZLib/DeflateStream.cs
index 84b7ad0e5acade..a12f16f61080d4 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateZLib/DeflateStream.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateZLib/DeflateStream.cs
@@ -457,6 +457,21 @@ public override void Write(byte[] buffer, int offset, int count)
WriteCore(new ReadOnlySpan(buffer, offset, count));
}
+ public override void WriteByte(byte value)
+ {
+ if (GetType() != typeof(DeflateStream))
+ {
+ // DeflateStream is not sealed, and a derived type may have overridden Write(byte[], int, int) prior
+ // to this WriteByte override being introduced. In that case, this WriteByte override
+ // should use the behavior of the Write(byte[],int,int) overload.
+ base.WriteByte(value);
+ }
+ else
+ {
+ WriteCore(MemoryMarshal.CreateReadOnlySpan(ref value, 1));
+ }
+ }
+
public override void Write(ReadOnlySpan buffer)
{
if (GetType() != typeof(DeflateStream))
@@ -577,8 +592,7 @@ private void PurgeBuffers(bool disposing)
bool finished;
do
{
- int compressedBytes;
- finished = _deflater.Finish(_buffer, out compressedBytes);
+ finished = _deflater.Finish(_buffer, out _);
} while (!finished);
}
}
@@ -625,8 +639,7 @@ private async ValueTask PurgeBuffersAsync()
bool finished;
do
{
- int compressedBytes;
- finished = _deflater.Finish(_buffer, out compressedBytes);
+ finished = _deflater.Finish(_buffer, out _);
} while (!finished);
}
}
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipStream.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipStream.cs
index 8e674d13b97a82..0d184387d3e82d 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipStream.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipStream.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
@@ -111,6 +112,22 @@ public override void Write(byte[] buffer, int offset, int count)
_deflateStream.Write(buffer, offset, count);
}
+ public override void WriteByte(byte value)
+ {
+ if (GetType() != typeof(GZipStream))
+ {
+ // GZipStream is not sealed, and a derived type may have overridden Write(byte[], int, int) prior
+ // to this WriteByte override being introduced. In that case, this WriteByte override
+ // should use the behavior of the Write(byte[],int,int) overload.
+ base.WriteByte(value);
+ }
+ else
+ {
+ CheckDeflateStream();
+ _deflateStream.WriteCore(MemoryMarshal.CreateReadOnlySpan(ref value, 1));
+ }
+ }
+
public override void Write(ReadOnlySpan buffer)
{
if (GetType() != typeof(GZipStream))
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs
index 0481ee770dfba1..0d5de3cbac6bd2 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs
@@ -555,7 +555,7 @@ internal void WriteCentralDirectoryFileHeader()
internal bool LoadLocalHeaderExtraFieldAndCompressedBytesIfNeeded()
{
// we should have made this exact call in _archive.Init through ThrowIfOpenable
- Debug.Assert(IsOpenable(false, true, out string? message));
+ Debug.Assert(IsOpenable(false, true, out _));
// load local header's extra fields. it will be null if we couldn't read for some reason
if (_originallyInArchive)
@@ -641,7 +641,7 @@ private CheckSumAndSizeWriteStream GetDataCompressor(Stream backingStream, bool
private Stream GetDataDecompressor(Stream compressedStreamToRead)
{
- Stream? uncompressedStream = null;
+ Stream? uncompressedStream;
switch (CompressionMethod)
{
case CompressionMethodValues.Deflate:
diff --git a/src/libraries/System.IO.Compression/tests/System.IO.Compression.Tests.csproj b/src/libraries/System.IO.Compression/tests/System.IO.Compression.Tests.csproj
index 9b51d5b5d34ffd..509c7202afb435 100644
--- a/src/libraries/System.IO.Compression/tests/System.IO.Compression.Tests.csproj
+++ b/src/libraries/System.IO.Compression/tests/System.IO.Compression.Tests.csproj
@@ -3,6 +3,15 @@
$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser
true
+
+
+
+ WasmTestOnBrowser
+ $(TestArchiveRoot)browserornodejs/
+ $(TestArchiveTestsRoot)$(OSPlatformConfig)/
+ $(DefineConstants);TARGET_BROWSER
+
+
diff --git a/src/libraries/System.IO.FileSystem.AccessControl/src/System/Security/AccessControl/DirectoryObjectSecurity.cs b/src/libraries/System.IO.FileSystem.AccessControl/src/System/Security/AccessControl/DirectoryObjectSecurity.cs
index 6b1956aeb23520..a04d60120c7417 100644
--- a/src/libraries/System.IO.FileSystem.AccessControl/src/System/Security/AccessControl/DirectoryObjectSecurity.cs
+++ b/src/libraries/System.IO.FileSystem.AccessControl/src/System/Security/AccessControl/DirectoryObjectSecurity.cs
@@ -531,8 +531,7 @@ protected void AddAccessRule(ObjectAccessRule rule)
try
{
- bool modified;
- ModifyAccess(AccessControlModification.Add, rule, out modified);
+ ModifyAccess(AccessControlModification.Add, rule, out _);
}
finally
{
@@ -553,8 +552,7 @@ protected void SetAccessRule(ObjectAccessRule rule)
try
{
- bool modified;
- ModifyAccess(AccessControlModification.Set, rule, out modified);
+ ModifyAccess(AccessControlModification.Set, rule, out _);
}
finally
{
@@ -573,8 +571,7 @@ protected void ResetAccessRule(ObjectAccessRule rule)
try
{
- bool modified;
- ModifyAccess(AccessControlModification.Reset, rule, out modified);
+ ModifyAccess(AccessControlModification.Reset, rule, out _);
}
finally
{
@@ -598,8 +595,7 @@ protected bool RemoveAccessRule(ObjectAccessRule rule)
return true;
}
- bool modified;
- return ModifyAccess(AccessControlModification.Remove, rule, out modified);
+ return ModifyAccess(AccessControlModification.Remove, rule, out _);
}
finally
{
@@ -623,8 +619,7 @@ protected void RemoveAccessRuleAll(ObjectAccessRule rule)
return;
}
- bool modified;
- ModifyAccess(AccessControlModification.RemoveAll, rule, out modified);
+ ModifyAccess(AccessControlModification.RemoveAll, rule, out _);
}
finally
{
@@ -648,8 +643,7 @@ protected void RemoveAccessRuleSpecific(ObjectAccessRule rule)
try
{
- bool modified;
- ModifyAccess(AccessControlModification.RemoveSpecific, rule, out modified);
+ ModifyAccess(AccessControlModification.RemoveSpecific, rule, out _);
}
finally
{
@@ -668,8 +662,7 @@ protected void AddAuditRule(ObjectAuditRule rule)
try
{
- bool modified;
- ModifyAudit(AccessControlModification.Add, rule, out modified);
+ ModifyAudit(AccessControlModification.Add, rule, out _);
}
finally
{
@@ -688,8 +681,7 @@ protected void SetAuditRule(ObjectAuditRule rule)
try
{
- bool modified;
- ModifyAudit(AccessControlModification.Set, rule, out modified);
+ ModifyAudit(AccessControlModification.Set, rule, out _);
}
finally
{
@@ -708,8 +700,7 @@ protected bool RemoveAuditRule(ObjectAuditRule rule)
try
{
- bool modified;
- return ModifyAudit(AccessControlModification.Remove, rule, out modified);
+ return ModifyAudit(AccessControlModification.Remove, rule, out _);
}
finally
{
@@ -728,8 +719,7 @@ protected void RemoveAuditRuleAll(ObjectAuditRule rule)
try
{
- bool modified;
- ModifyAudit(AccessControlModification.RemoveAll, rule, out modified);
+ ModifyAudit(AccessControlModification.RemoveAll, rule, out _);
}
finally
{
@@ -748,8 +738,7 @@ protected void RemoveAuditRuleSpecific(ObjectAuditRule rule)
try
{
- bool modified;
- ModifyAudit(AccessControlModification.RemoveSpecific, rule, out modified);
+ ModifyAudit(AccessControlModification.RemoveSpecific, rule, out _);
}
finally
{
diff --git a/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.Unix.cs b/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.Unix.cs
index bc696ef7b5724d..e1eb1b53e0ee43 100644
--- a/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.Unix.cs
+++ b/src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.Unix.cs
@@ -43,7 +43,7 @@ public string DriveFormat
{
get
{
- string format = string.Empty;
+ string format;
CheckStatfsResultAndThrowIfNecessary(Interop.Sys.GetFormatInfoForMountPoint(Name, out format));
return format;
}
@@ -53,7 +53,7 @@ public long AvailableFreeSpace
{
get
{
- Interop.Sys.MountPointInformation mpi = default(Interop.Sys.MountPointInformation);
+ Interop.Sys.MountPointInformation mpi;
CheckStatfsResultAndThrowIfNecessary(Interop.Sys.GetSpaceInfoForMountPoint(Name, out mpi));
return checked((long)mpi.AvailableFreeSpace);
}
@@ -63,7 +63,7 @@ public long TotalFreeSpace
{
get
{
- Interop.Sys.MountPointInformation mpi = default(Interop.Sys.MountPointInformation);
+ Interop.Sys.MountPointInformation mpi;
CheckStatfsResultAndThrowIfNecessary(Interop.Sys.GetSpaceInfoForMountPoint(Name, out mpi));
return checked((long)mpi.TotalFreeSpace);
}
@@ -73,7 +73,7 @@ public long TotalSize
{
get
{
- Interop.Sys.MountPointInformation mpi = default(Interop.Sys.MountPointInformation);
+ Interop.Sys.MountPointInformation mpi;
CheckStatfsResultAndThrowIfNecessary(Interop.Sys.GetSpaceInfoForMountPoint(Name, out mpi));
return checked((long)mpi.TotalSize);
}
diff --git a/src/libraries/System.IO.FileSystem.DriveInfo/tests/DriveInfo.Unix.Tests.cs b/src/libraries/System.IO.FileSystem.DriveInfo/tests/DriveInfo.Unix.Tests.cs
index e7723229c0d2df..14abd97e397afe 100644
--- a/src/libraries/System.IO.FileSystem.DriveInfo/tests/DriveInfo.Unix.Tests.cs
+++ b/src/libraries/System.IO.FileSystem.DriveInfo/tests/DriveInfo.Unix.Tests.cs
@@ -42,7 +42,7 @@ public void TestGetDrives()
}
[Fact]
- [PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)]
+ [PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.Browser)]
public void PropertiesOfInvalidDrive()
{
string invalidDriveName = "NonExistentDriveName";
diff --git a/src/libraries/System.IO.FileSystem/tests/Directory/Exists.cs b/src/libraries/System.IO.FileSystem/tests/Directory/Exists.cs
index b5cff81546e151..a05fe8ad41f7dc 100644
--- a/src/libraries/System.IO.FileSystem/tests/Directory/Exists.cs
+++ b/src/libraries/System.IO.FileSystem/tests/Directory/Exists.cs
@@ -299,6 +299,7 @@ public void PathWithReservedDeviceNameAsPath_ReturnsFalse(string component)
Assert.False(Exists(component));
}
+ [ActiveIssue("https://github.com/dotnet/runtimelab/issues/901", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
[Theory,
MemberData(nameof(UncPathsWithoutShareName))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
diff --git a/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.Windows.cs b/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.Windows.cs
new file mode 100644
index 00000000000000..015ba30b6ad7c1
--- /dev/null
+++ b/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.Windows.cs
@@ -0,0 +1,85 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using Microsoft.DotNet.XUnitExtensions;
+using System.Diagnostics;
+using System.Diagnostics.Eventing.Reader;
+using System.Linq;
+using System.Security;
+using System.ServiceProcess;
+using Xunit;
+using Xunit.Abstractions;
+
+namespace System.IO.Tests
+{
+ public partial class EncryptDecrypt
+ {
+ partial void EnsureEFSServiceStarted()
+ {
+ try
+ {
+ using var sc = new ServiceController("EFS");
+ _output.WriteLine($"EFS service is: {sc.Status}");
+ if (sc.Status != ServiceControllerStatus.Running)
+ {
+ _output.WriteLine("Trying to start EFS service");
+ sc.Start();
+ _output.WriteLine($"EFS service is now: {sc.Status}");
+ }
+ }
+ catch (Exception e)
+ {
+ _output.WriteLine(e.ToString());
+ }
+ }
+
+ partial void LogEFSDiagnostics()
+ {
+ int hours = 1; // how many hours to look backwards
+ string query = @$"
+
+
+
+
+
+
+ *[System[TimeCreated[timediff(@SystemTime) >= {hours * 60 * 60 * 1000L}]]]
+
+
+ ";
+
+ var eventQuery = new EventLogQuery("System", PathType.LogName, query);
+
+ using var eventReader = new EventLogReader(eventQuery);
+
+ EventRecord record = eventReader.ReadEvent();
+ var garbage = new string[] { "Background Intelligent", "Intel", "Defender", "Intune", "BITS", "NetBT"};
+
+ _output.WriteLine("===== Dumping recent relevant events: =====");
+ while (record != null)
+ {
+ string description = "";
+ try
+ {
+ description = record.FormatDescription();
+ }
+ catch (EventLogException) { }
+
+ if (!garbage.Any(term => description.Contains(term, StringComparison.OrdinalIgnoreCase)))
+ {
+ _output.WriteLine($"{record.TimeCreated} {record.ProviderName} [{record.LevelDisplayName} {record.Id}] {description.Replace("\r\n", " ")}");
+ }
+
+ record = eventReader.ReadEvent();
+ }
+
+ _output.WriteLine("==== Finished dumping =====");
+ }
+ }
+}
diff --git a/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.cs b/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.cs
index 12299fad33fcf5..c4d34c320668ef 100644
--- a/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.cs
+++ b/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.cs
@@ -1,17 +1,28 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using Microsoft.DotNet.XUnitExtensions;
using System.Diagnostics;
+using System.Diagnostics.Eventing.Reader;
using System.Security;
+using System.ServiceProcess;
using Xunit;
+using Xunit.Abstractions;
namespace System.IO.Tests
{
[ActiveIssue("https://github.com/dotnet/runtime/issues/34582", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
- public class EncryptDecrypt : FileSystemTest
+ public partial class EncryptDecrypt : FileSystemTest
{
+ private readonly ITestOutputHelper _output;
+
+ public EncryptDecrypt(ITestOutputHelper output)
+ {
+ _output = output;
+ }
+
[Fact]
- public static void NullArg_ThrowsException()
+ public void NullArg_ThrowsException()
{
AssertExtensions.Throws("path", () => File.Encrypt(null));
AssertExtensions.Throws("path", () => File.Decrypt(null));
@@ -19,7 +30,7 @@ public static void NullArg_ThrowsException()
[SkipOnTargetFramework(TargetFrameworkMonikers.Netcoreapp)]
[Fact]
- public static void EncryptDecrypt_NotSupported()
+ public void EncryptDecrypt_NotSupported()
{
Assert.Throws(() => File.Encrypt("path"));
Assert.Throws(() => File.Decrypt("path"));
@@ -29,7 +40,8 @@ public static void EncryptDecrypt_NotSupported()
// because EFS (Encrypted File System), its underlying technology, is not available on these operating systems.
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer), nameof(PlatformDetection.IsNotWindowsHomeEdition))]
[PlatformSpecific(TestPlatforms.Windows)]
- public static void EncryptDecrypt_Read()
+ [OuterLoop] // Occasional failures: https://github.com/dotnet/runtime/issues/12339
+ public void EncryptDecrypt_Read()
{
string tmpFileName = Path.GetTempFileName();
string textContentToEncrypt = "Content to encrypt";
@@ -39,6 +51,8 @@ public static void EncryptDecrypt_Read()
string fileContentRead = File.ReadAllText(tmpFileName);
Assert.Equal(textContentToEncrypt, fileContentRead);
+ EnsureEFSServiceStarted();
+
try
{
File.Encrypt(tmpFileName);
@@ -48,7 +62,13 @@ public static void EncryptDecrypt_Read()
{
// Ignore ERROR_NOT_FOUND 1168 (0x490). It is reported when EFS is disabled by domain policy.
// Ignore ERROR_NO_USER_KEYS (0x1776). This occurs when no user key exists to encrypt with.
- return;
+ throw new SkipTestException($"Encrypt not available. Error 0x{e.HResult:X}");
+ }
+ catch (IOException e)
+ {
+ _output.WriteLine($"Encrypt failed with {e.Message} 0x{e.HResult:X}");
+ LogEFSDiagnostics();
+ throw;
}
Assert.Equal(fileContentRead, File.ReadAllText(tmpFileName));
@@ -63,5 +83,9 @@ public static void EncryptDecrypt_Read()
File.Delete(tmpFileName);
}
}
+
+ partial void EnsureEFSServiceStarted(); // no-op on Unix
+
+ partial void LogEFSDiagnostics(); // no-op on Unix currently
}
}
diff --git a/src/libraries/System.IO.FileSystem/tests/File/Exists.cs b/src/libraries/System.IO.FileSystem/tests/File/Exists.cs
index ec3e0336a41cec..d35ba99eeb2ab5 100644
--- a/src/libraries/System.IO.FileSystem/tests/File/Exists.cs
+++ b/src/libraries/System.IO.FileSystem/tests/File/Exists.cs
@@ -231,6 +231,7 @@ public void PathWithReservedDeviceNameAsPath_ReturnsFalse(string component)
Assert.False(Exists(component));
}
+ [ActiveIssue("https://github.com/dotnet/runtimelab/issues/901", typeof(PlatformDetection), nameof(PlatformDetection.IsNativeAot))]
[Theory,
MemberData(nameof(UncPathsWithoutShareName))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/51371", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
diff --git a/src/libraries/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj b/src/libraries/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj
index 7c219c593107bf..83f7bf47ea78e0 100644
--- a/src/libraries/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj
+++ b/src/libraries/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj
@@ -76,6 +76,7 @@
+
diff --git a/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.cs b/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.cs
index d2f04e84d27ef9..cc8d30ca73ef19 100644
--- a/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.cs
+++ b/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFile.cs
@@ -148,7 +148,12 @@ public static MemoryMappedFile CreateFromFile(string path, FileMode mode, string
throw new ArgumentException(SR.Argument_NewMMFWriteAccessNotAllowed, nameof(access));
}
- bool existed = File.Exists(path);
+ bool existed = mode switch
+ {
+ FileMode.Open => true, // FileStream ctor will throw if the file doesn't exist
+ FileMode.CreateNew => false,
+ _ => File.Exists(path)
+ };
FileStream fileStream = new FileStream(path, mode, GetFileAccess(access), FileShare.Read, 0x1000, FileOptions.None);
if (capacity == 0 && fileStream.Length == 0)
@@ -162,7 +167,7 @@ public static MemoryMappedFile CreateFromFile(string path, FileMode mode, string
capacity = fileStream.Length;
}
- SafeMemoryMappedFileHandle? handle = null;
+ SafeMemoryMappedFileHandle? handle;
try
{
handle = CreateCore(fileStream, mapName, HandleInheritability.None,
diff --git a/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Windows.cs b/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Windows.cs
index b974d4a0bdd98e..9d14b133f8a910 100644
--- a/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Windows.cs
+++ b/src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedView.Windows.cs
@@ -59,7 +59,7 @@ public static MemoryMappedView CreateView(SafeMemoryMappedFileHandle memMappedFi
// VirtualQueryEx: https://msdn.microsoft.com/en-us/library/windows/desktop/aa366907(v=vs.85).aspx
if (((viewInfo.State & Interop.Kernel32.MemOptions.MEM_RESERVE) != 0) || ((ulong)viewSize < (ulong)nativeSize))
{
- IntPtr tempHandle = Interop.VirtualAlloc(
+ Interop.VirtualAlloc(
viewHandle, (UIntPtr)(nativeSize != MemoryMappedFile.DefaultSize ? nativeSize : viewSize),
Interop.Kernel32.MemOptions.MEM_COMMIT, MemoryMappedFile.GetPageAccess(access));
int lastError = Marshal.GetLastPInvokeError();
diff --git a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateNew.Tests.cs b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateNew.Tests.cs
index 70b82398301d56..4336ce74d6a223 100644
--- a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateNew.Tests.cs
+++ b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateNew.Tests.cs
@@ -11,6 +11,7 @@ namespace System.IO.MemoryMappedFiles.Tests
///
/// Tests for MemoryMappedFile.CreateNew.
///
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/63240", typeof(PlatformDetection), nameof(PlatformDetection.IsOSX), nameof(PlatformDetection.IsArm64Process), nameof(PlatformDetection.IsNotMonoRuntime))]
public class MemoryMappedFileTests_CreateNew : MemoryMappedFilesTestBase
{
///
diff --git a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor.Tests.cs b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor.Tests.cs
index 8fe35396ae8044..adcfb0e9d4cc42 100644
--- a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor.Tests.cs
+++ b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor.Tests.cs
@@ -11,6 +11,7 @@ namespace System.IO.MemoryMappedFiles.Tests
///
/// Tests for MemoryMappedViewAccessor.
///
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/63240", typeof(PlatformDetection), nameof(PlatformDetection.IsOSX), nameof(PlatformDetection.IsArm64Process), nameof(PlatformDetection.IsNotMonoRuntime))]
public class MemoryMappedViewAccessorTests : MemoryMappedFilesTestBase
{
///
diff --git a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream.Tests.cs b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream.Tests.cs
index f279b8c33f98f7..3a950662e5d498 100644
--- a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream.Tests.cs
+++ b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream.Tests.cs
@@ -11,6 +11,7 @@ namespace System.IO.MemoryMappedFiles.Tests
///
/// Tests for MemoryMappedViewStream.
///
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/63240", typeof(PlatformDetection), nameof(PlatformDetection.IsOSX), nameof(PlatformDetection.IsArm64Process), nameof(PlatformDetection.IsNotMonoRuntime))]
public class MemoryMappedViewStreamTests : MemoryMappedFilesTestBase
{
///
diff --git a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStreamConformanceTests.cs b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStreamConformanceTests.cs
index c190d329a00fe6..1ec0b14fb8a15e 100644
--- a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStreamConformanceTests.cs
+++ b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStreamConformanceTests.cs
@@ -45,6 +45,7 @@ private Task CreateStream(byte[] initialData, FileAccess access)
}
}
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/63240", typeof(PlatformDetection), nameof(PlatformDetection.IsOSX), nameof(PlatformDetection.IsArm64Process), nameof(PlatformDetection.IsNotMonoRuntime))]
public class AnonymousMemoryMappedViewStreamConformanceTests : MemoryMappedViewStreamConformanceTests
{
protected override MemoryMappedFile CreateFile(int length) =>
diff --git a/src/libraries/System.IO.Packaging/src/System/IO/Packaging/ContentType.cs b/src/libraries/System.IO.Packaging/src/System/IO/Packaging/ContentType.cs
index ecfd746602a2c9..12da788ace902c 100644
--- a/src/libraries/System.IO.Packaging/src/System/IO/Packaging/ContentType.cs
+++ b/src/libraries/System.IO.Packaging/src/System/IO/Packaging/ContentType.cs
@@ -369,7 +369,7 @@ private static int GetLengthOfParameterValue(string s, int startIndex)
{
Debug.Assert(s != null);
- int length = 0;
+ int length;
//if the parameter value does not start with a '"' then,
//we expect a valid token. So we look for Linear White Spaces or
diff --git a/src/libraries/System.IO.Packaging/src/System/IO/Packaging/PackUriHelper.cs b/src/libraries/System.IO.Packaging/src/System/IO/Packaging/PackUriHelper.cs
index 616111cc36cbf8..15c89947da327f 100644
--- a/src/libraries/System.IO.Packaging/src/System/IO/Packaging/PackUriHelper.cs
+++ b/src/libraries/System.IO.Packaging/src/System/IO/Packaging/PackUriHelper.cs
@@ -389,7 +389,7 @@ internal static string GetStringForPartUri(Uri partUri)
if (partUri == null)
return new ArgumentNullException(nameof(partUri));
- Exception? argumentException = null;
+ Exception? argumentException;
argumentException = GetExceptionIfAbsoluteUri(partUri);
if (argumentException != null)
diff --git a/src/libraries/System.IO.Packaging/src/System/IO/Packaging/PartBasedPackageProperties.cs b/src/libraries/System.IO.Packaging/src/System/IO/Packaging/PartBasedPackageProperties.cs
index 20885d57997e34..20e59798df1470 100644
--- a/src/libraries/System.IO.Packaging/src/System/IO/Packaging/PartBasedPackageProperties.cs
+++ b/src/libraries/System.IO.Packaging/src/System/IO/Packaging/PartBasedPackageProperties.cs
@@ -438,7 +438,7 @@ private void ReadPropertyValuesFromPackage()
if (corePropertiesRelationship.TargetMode != TargetMode.Internal)
throw new FileFormatException(SR.NoExternalTargetForMetadataRelationship);
- PackagePart? propertiesPart = null;
+ PackagePart? propertiesPart;
Uri propertiesPartUri = PackUriHelper.ResolvePartUri(
PackUriHelper.PackageRootUri,
corePropertiesRelationship.TargetUri);
diff --git a/src/libraries/System.IO.Packaging/src/System/IO/Packaging/XmlCompatibilityReader.cs b/src/libraries/System.IO.Packaging/src/System/IO/Packaging/XmlCompatibilityReader.cs
index df65e29fdf1493..db69f44ecbb1b5 100644
--- a/src/libraries/System.IO.Packaging/src/System/IO/Packaging/XmlCompatibilityReader.cs
+++ b/src/libraries/System.IO.Packaging/src/System/IO/Packaging/XmlCompatibilityReader.cs
@@ -339,7 +339,7 @@ private bool ReadEndElement(ref bool more)
///
public override string GetAttribute(int i)
{
- string? result = null;
+ string? result;
if (_ignoredAttributeCount == 0)
{
diff --git a/src/libraries/System.IO.Packaging/src/System/IO/Packaging/ZipPackage.cs b/src/libraries/System.IO.Packaging/src/System/IO/Packaging/ZipPackage.cs
index 8f4fd15ddfc5a4..36938798542a41 100644
--- a/src/libraries/System.IO.Packaging/src/System/IO/Packaging/ZipPackage.cs
+++ b/src/libraries/System.IO.Packaging/src/System/IO/Packaging/ZipPackage.cs
@@ -260,7 +260,7 @@ internal ZipPackage(string path, FileMode packageFileMode, FileAccess packageFil
: base(packageFileAccess)
{
ZipArchive? zipArchive = null;
- ContentTypeHelper? contentTypeHelper = null;
+ ContentTypeHelper? contentTypeHelper;
_packageFileMode = packageFileMode;
_packageFileAccess = packageFileAccess;
@@ -302,7 +302,7 @@ internal ZipPackage(Stream s, FileMode packageFileMode, FileAccess packageFileAc
: base(packageFileAccess)
{
ZipArchive? zipArchive = null;
- ContentTypeHelper? contentTypeHelper = null;
+ ContentTypeHelper? contentTypeHelper;
_packageFileMode = packageFileMode;
_packageFileAccess = packageFileAccess;
diff --git a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/AnonymousPipeClientStream.cs b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/AnonymousPipeClientStream.cs
index 0c904b33c7c867..8c62382f50980e 100644
--- a/src/libraries/System.IO.Pipes/src/System/IO/Pipes/AnonymousPipeClientStream.cs
+++ b/src/libraries/System.IO.Pipes/src/System/IO/Pipes/AnonymousPipeClientStream.cs
@@ -30,8 +30,7 @@ public AnonymousPipeClientStream(PipeDirection direction, string pipeHandleAsStr
}
// Initialize SafePipeHandle from String and check if it's valid. First see if it's parseable
- long result = 0;
- bool parseable = long.TryParse(pipeHandleAsString, out result);
+ bool parseable = long.TryParse(pipeHandleAsString, out long result);
if (!parseable)
{
throw new ArgumentException(SR.Argument_InvalidHandle, nameof(pipeHandleAsString));
diff --git a/src/libraries/System.IO.Ports/src/System/IO/Ports/SerialStream.Unix.cs b/src/libraries/System.IO.Ports/src/System/IO/Ports/SerialStream.Unix.cs
index a30e4abe46ad6a..dd490acaecf626 100644
--- a/src/libraries/System.IO.Ports/src/System/IO/Ports/SerialStream.Unix.cs
+++ b/src/libraries/System.IO.Ports/src/System/IO/Ports/SerialStream.Unix.cs
@@ -517,7 +517,7 @@ private Interop.PollEvents PollEvents(int timeout, bool pollReadEvents, bool pol
eventsToPoll |= Interop.PollEvents.POLLOUT;
}
- Interop.PollEvents events = Interop.PollEvents.POLLNONE;
+ Interop.PollEvents events;
Interop.Error ret = Interop.Serial.Poll(
_handle,
eventsToPoll,
diff --git a/src/libraries/System.IO.Ports/src/System/IO/Ports/SerialStream.Windows.cs b/src/libraries/System.IO.Ports/src/System/IO/Ports/SerialStream.Windows.cs
index 56f5ef58522266..2c9e86a8220750 100644
--- a/src/libraries/System.IO.Ports/src/System/IO/Ports/SerialStream.Windows.cs
+++ b/src/libraries/System.IO.Ports/src/System/IO/Ports/SerialStream.Windows.cs
@@ -429,7 +429,7 @@ internal StopBits StopBits
{
Debug.Assert(!(value < StopBits.One || value > StopBits.OnePointFive), "An invalid value was passed to StopBits");
- byte nativeValue = 0;
+ byte nativeValue;
if (value == StopBits.One)
{
nativeValue = Interop.Kernel32.DCBStopBits.ONESTOPBIT;
@@ -1021,8 +1021,7 @@ internal unsafe int Read(byte[] array, int offset, int count, int timeout)
}
else
{
- int hr;
- numBytes = ReadFileNative(array, offset, count, null, out hr);
+ numBytes = ReadFileNative(array, offset, count, null, out _);
if (numBytes == -1)
{
throw Win32Marshal.GetExceptionForLastWin32Error();
@@ -1047,8 +1046,7 @@ internal unsafe int ReadByte(int timeout)
}
else
{
- int hr;
- numBytes = ReadFileNative(_tempBuf, 0, 1, null, out hr);
+ numBytes = ReadFileNative(_tempBuf, 0, 1, null, out _);
if (numBytes == -1)
{
throw Win32Marshal.GetExceptionForLastWin32Error();
@@ -1121,7 +1119,6 @@ internal unsafe void WriteByte(byte value, int timeout)
int numBytes;
- int hr;
if (_isAsync)
{
IAsyncResult result = BeginWriteCore(_tempBuf, 0, 1, null, null);
@@ -1133,7 +1130,7 @@ internal unsafe void WriteByte(byte value, int timeout)
}
else
{
- numBytes = WriteFileNative(_tempBuf, 0, 1, null, out hr);
+ numBytes = WriteFileNative(_tempBuf, 0, 1, null, out _);
if (numBytes == -1)
{
// This is how writes timeout on Win9x.
@@ -1334,8 +1331,7 @@ private unsafe SerialStreamAsyncResult BeginReadCore(byte[] array, int offset, i
// queue an async ReadFile operation and pass in a packed overlapped
//int r = ReadFile(_handle, array, numBytes, null, intOverlapped);
- int hr = 0;
- int r = ReadFileNative(array, offset, numBytes, intOverlapped, out hr);
+ int r = ReadFileNative(array, offset, numBytes, intOverlapped, out int hr);
// ReadFile, the OS version, will return 0 on failure. But
// my ReadFileNative wrapper returns -1. My wrapper will return
@@ -1379,9 +1375,8 @@ private unsafe SerialStreamAsyncResult BeginWriteCore(byte[] array, int offset,
asyncResult._overlapped = intOverlapped;
- int hr = 0;
// queue an async WriteFile operation and pass in a packed overlapped
- int r = WriteFileNative(array, offset, numBytes, intOverlapped, out hr);
+ int r = WriteFileNative(array, offset, numBytes, intOverlapped, out int hr);
// WriteFile, the OS version, will return 0 on failure. But
// my WriteFileNative wrapper returns -1. My wrapper will return
@@ -1762,8 +1757,6 @@ private void CallErrorEvents(object state)
if ((errors & (int)SerialError.Frame) != 0)
stream.ErrorReceived(stream, new SerialErrorReceivedEventArgs(SerialError.Frame));
}
-
- stream = null;
}
private void CallReceiveEvents(object state)
@@ -1780,8 +1773,6 @@ private void CallReceiveEvents(object state)
if ((nativeEvents & (int)SerialData.Eof) != 0)
stream.DataReceived(stream, new SerialDataReceivedEventArgs(SerialData.Eof));
}
-
- stream = null;
}
private void CallPinEvents(object state)
@@ -1809,8 +1800,6 @@ private void CallPinEvents(object state)
if ((nativeEvents & (int)SerialPinChange.Break) != 0)
stream.PinChanged(stream, new SerialPinChangedEventArgs(SerialPinChange.Break));
}
-
- stream = null;
}
}
diff --git a/src/libraries/System.Management/src/System.Management.csproj b/src/libraries/System.Management/src/System.Management.csproj
index a90719285f052b..d79acc744ac2f9 100644
--- a/src/libraries/System.Management/src/System.Management.csproj
+++ b/src/libraries/System.Management/src/System.Management.csproj
@@ -4,7 +4,7 @@
$(NoWarn);0618
- $(NoWarn);CA1845
+ $(NoWarn);CA1845;IDE0059
annotations
true
$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum);netstandard2.0
diff --git a/src/libraries/System.Memory/src/System/Text/EncodingExtensions.cs b/src/libraries/System.Memory/src/System/Text/EncodingExtensions.cs
index 97658fb8531c0c..11ec18302bd03b 100644
--- a/src/libraries/System.Memory/src/System/Text/EncodingExtensions.cs
+++ b/src/libraries/System.Memory/src/System/Text/EncodingExtensions.cs
@@ -59,7 +59,7 @@ public static long GetBytes(this Encoding encoding, ReadOnlySpan chars, IB
{
// Allocate a stateful Encoder instance and chunk this.
- Convert(encoding.GetEncoder(), chars, writer, flush: true, out long totalBytesWritten, out bool completed);
+ Convert(encoding.GetEncoder(), chars, writer, flush: true, out long totalBytesWritten, out _);
return totalBytesWritten;
}
}
@@ -95,7 +95,7 @@ public static long GetBytes(this Encoding encoding, in ReadOnlySequence ch
}
else
{
- Convert(encoding.GetEncoder(), chars, writer, flush: true, out long bytesWritten, out bool completed);
+ Convert(encoding.GetEncoder(), chars, writer, flush: true, out long bytesWritten, out _);
return bytesWritten;
}
}
@@ -270,7 +270,7 @@ public static long GetChars(this Encoding encoding, ReadOnlySpan bytes, IB
{
// Allocate a stateful Decoder instance and chunk this.
- Convert(encoding.GetDecoder(), bytes, writer, flush: true, out long totalCharsWritten, out bool completed);
+ Convert(encoding.GetDecoder(), bytes, writer, flush: true, out long totalCharsWritten, out _);
return totalCharsWritten;
}
}
@@ -306,7 +306,7 @@ public static long GetChars(this Encoding encoding, in ReadOnlySequence by
}
else
{
- Convert(encoding.GetDecoder(), bytes, writer, flush: true, out long charsWritten, out bool completed);
+ Convert(encoding.GetDecoder(), bytes, writer, flush: true, out long charsWritten, out _);
return charsWritten;
}
}
diff --git a/src/libraries/System.Net.Http.Json/src/System/Net/Http/Json/TranscodingReadStream.cs b/src/libraries/System.Net.Http.Json/src/System/Net/Http/Json/TranscodingReadStream.cs
index cc8ef875b9d71b..976b40250a6c38 100644
--- a/src/libraries/System.Net.Http.Json/src/System/Net/Http/Json/TranscodingReadStream.cs
+++ b/src/libraries/System.Net.Http.Json/src/System/Net/Http/Json/TranscodingReadStream.cs
@@ -139,7 +139,7 @@ private async Task ReadAsyncCore(ArraySegment readBuffer, Cancellatio
}
_encoder.Convert(_charBuffer.Array!, _charBuffer.Offset, _charBuffer.Count, _overflowBuffer.Array!, byteIndex: 0, _overflowBuffer.Array!.Length,
- flush: shouldFlushEncoder, out int overFlowChars, out int overflowBytes, out completed);
+ flush: shouldFlushEncoder, out int overFlowChars, out int overflowBytes, out _);
Debug.Assert(overflowBytes > 0 && overFlowChars > 0, "We expect writes to the overflow buffer to always succeed since it is large enough to accommodate at least one char.");
diff --git a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpAuthHelper.cs b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpAuthHelper.cs
index b0b6d86c675415..a8a364a8aaa815 100644
--- a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpAuthHelper.cs
+++ b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpAuthHelper.cs
@@ -51,9 +51,8 @@ public void CheckResponseForAuthentication(
ref uint proxyAuthScheme,
ref uint serverAuthScheme)
{
- uint supportedSchemes = 0;
- uint firstSchemeIgnored = 0;
- uint authTarget = 0;
+ uint supportedSchemes;
+ uint authTarget;
Debug.Assert(state.RequestMessage != null);
Debug.Assert(state.RequestMessage.RequestUri != null);
@@ -87,7 +86,7 @@ public void CheckResponseForAuthentication(
if (!Interop.WinHttp.WinHttpQueryAuthSchemes(
state.RequestHandle,
out supportedSchemes,
- out firstSchemeIgnored,
+ out _,
out authTarget))
{
// WinHTTP returns an error for schemes it doesn't handle.
@@ -140,7 +139,7 @@ public void CheckResponseForAuthentication(
if (!Interop.WinHttp.WinHttpQueryAuthSchemes(
state.RequestHandle,
out supportedSchemes,
- out firstSchemeIgnored,
+ out _,
out authTarget))
{
// WinHTTP returns an error for schemes it doesn't handle.
@@ -244,7 +243,7 @@ public bool GetServerCredentialsFromCache(
serverAuthScheme = 0;
serverCredentials = null;
- NetworkCredential? cred = null;
+ NetworkCredential? cred;
lock (_credentialCacheLock)
{
diff --git a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpChannelBinding.cs b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpChannelBinding.cs
index 9d3dbc8145367b..de47f6caaa25db 100644
--- a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpChannelBinding.cs
+++ b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpChannelBinding.cs
@@ -18,14 +18,13 @@ internal sealed class WinHttpChannelBinding : ChannelBinding
internal WinHttpChannelBinding(SafeWinHttpHandle requestHandle)
{
- IntPtr data = IntPtr.Zero;
uint dataSize = 0;
if (!Interop.WinHttp.WinHttpQueryOption(requestHandle, Interop.WinHttp.WINHTTP_OPTION_SERVER_CBT, IntPtr.Zero, ref dataSize))
{
if (Marshal.GetLastWin32Error() == Interop.WinHttp.ERROR_INSUFFICIENT_BUFFER)
{
- data = Marshal.AllocHGlobal((int)dataSize);
+ IntPtr data = Marshal.AllocHGlobal((int)dataSize);
if (Interop.WinHttp.WinHttpQueryOption(requestHandle, Interop.WinHttp.WINHTTP_OPTION_SERVER_CBT, data, ref dataSize))
{
diff --git a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs
index 07133b2667c229..a081b7b4d00459 100644
--- a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs
+++ b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs
@@ -1442,7 +1442,7 @@ private void SetRequestHandleClientCertificateOptions(SafeWinHttpHandle requestH
return;
}
- X509Certificate2? clientCertificate = null;
+ X509Certificate2? clientCertificate;
if (_clientCertificateOption == ClientCertificateOption.Manual)
{
clientCertificate = CertificateHelper.GetEligibleClientCertificate(ClientCertificates);
diff --git a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpResponseHeaderReader.cs b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpResponseHeaderReader.cs
index f2e3292321ced0..bab82d3baa81c8 100644
--- a/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpResponseHeaderReader.cs
+++ b/src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpResponseHeaderReader.cs
@@ -78,9 +78,7 @@ public bool ReadHeader([NotNullWhen(true)] out string? name, [NotNullWhen(true)]
/// true if the next line was read successfully, or false if all characters have been read.
public bool ReadLine()
{
- int startIndex;
- int length;
- return ReadLine(out startIndex, out length);
+ return ReadLine(out _, out _);
}
///
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/AuthenticationHeaderValue.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/AuthenticationHeaderValue.cs
index a3197527d80a6b..3ab1b980970209 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/AuthenticationHeaderValue.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/AuthenticationHeaderValue.cs
@@ -199,7 +199,7 @@ private static bool TrySkipFirstBlob(string input, ref int current, ref int para
{
if (input[current] == '"')
{
- int quotedStringLength = 0;
+ int quotedStringLength;
if (HttpRuleParser.GetQuotedStringLength(input, current, out quotedStringLength) !=
HttpParseResult.Parsed)
{
@@ -241,8 +241,7 @@ private static bool TryGetParametersEndIndex(string input, ref int parseEndIndex
{
current++; // skip ',' delimiter
- bool separatorFound = false; // ignore value returned by GetNextNonEmptyOrWhitespaceIndex()
- current = HeaderUtilities.GetNextNonEmptyOrWhitespaceIndex(input, current, true, out separatorFound);
+ current = HeaderUtilities.GetNextNonEmptyOrWhitespaceIndex(input, current, true, out _);
if (current == input.Length)
{
return true;
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/BaseHeaderParser.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/BaseHeaderParser.cs
index e22e1c5800e56b..1c8df35e50be83 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/BaseHeaderParser.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/BaseHeaderParser.cs
@@ -41,7 +41,7 @@ public sealed override bool TryParseValue(string? value, object? storeValue, ref
return SupportsMultipleValues;
}
- bool separatorFound = false;
+ bool separatorFound;
int current = HeaderUtilities.GetNextNonEmptyOrWhitespaceIndex(value, index, SupportsMultipleValues,
out separatorFound);
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/CacheControlHeaderValue.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/CacheControlHeaderValue.cs
index ca7d533532d9de..8eacd11d6691de 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/CacheControlHeaderValue.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/CacheControlHeaderValue.cs
@@ -545,12 +545,11 @@ private static bool TrySetOptionalTokenList(NameValueHeaderValue nameValue, ref
// We have a quoted string. Now verify that the string contains a list of valid tokens separated by ','.
int current = 1; // skip the initial '"' character.
int maxLength = valueString.Length - 1; // -1 because we don't want to parse the final '"'.
- bool separatorFound = false;
int originalValueCount = destination == null ? 0 : destination.Count;
while (current < maxLength)
{
current = HeaderUtilities.GetNextNonEmptyOrWhitespaceIndex(valueString, current, true,
- out separatorFound);
+ out _);
if (current == maxLength)
{
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ContentDispositionHeaderValue.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ContentDispositionHeaderValue.cs
index d94618a19d09c8..074aedf91a1fee 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ContentDispositionHeaderValue.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ContentDispositionHeaderValue.cs
@@ -384,7 +384,7 @@ private void SetName(string parameter, string? value)
}
else
{
- string processedValue = string.Empty;
+ string processedValue;
if (parameter.EndsWith('*'))
{
processedValue = HeaderUtilities.Encode5987(value);
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ContentRangeHeaderValue.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ContentRangeHeaderValue.cs
index c9aab0f9346c4a..97015936e8b5b6 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ContentRangeHeaderValue.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ContentRangeHeaderValue.cs
@@ -236,9 +236,9 @@ internal static int GetContentRangeLength(string? input, int startIndex, out obj
// Read range values and in ' -/'
int fromStartIndex = current;
- int fromLength = 0;
- int toStartIndex = 0;
- int toLength = 0;
+ int fromLength;
+ int toStartIndex;
+ int toLength;
if (!TryGetRangeLength(input, ref current, out fromLength, out toStartIndex, out toLength))
{
return 0;
@@ -260,7 +260,7 @@ internal static int GetContentRangeLength(string? input, int startIndex, out obj
// We may not have a length (e.g. 'bytes 1-2/*'). But if we do, parse the length now.
int lengthStartIndex = current;
- int lengthLength = 0;
+ int lengthLength;
if (!TryGetLengthLength(input, ref current, out lengthLength))
{
return 0;
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/EntityTagHeaderValue.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/EntityTagHeaderValue.cs
index 7725c0031861c7..f3c1f07e1021f1 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/EntityTagHeaderValue.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/EntityTagHeaderValue.cs
@@ -39,7 +39,7 @@ public EntityTagHeaderValue(string tag, bool isWeak)
{
throw new ArgumentException(SR.net_http_argument_empty_string, nameof(tag));
}
- int length = 0;
+ int length;
if ((HttpRuleParser.GetQuotedStringLength(tag, 0, out length) != HttpParseResult.Parsed) ||
(length != tag.Length))
{
@@ -147,13 +147,12 @@ internal static int GetEntityTagLength(string? input, int startIndex, out Entity
}
int tagStartIndex = current;
- int tagLength = 0;
+ int tagLength;
if (HttpRuleParser.GetQuotedStringLength(input, current, out tagLength) != HttpParseResult.Parsed)
{
return 0;
}
- parsedValue = new EntityTagHeaderValue();
if (tagLength == input.Length)
{
// Most of the time we'll have strong ETags without leading/trailing whitespace.
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/GenericHeaderParser.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/GenericHeaderParser.cs
index c6ec5e5b0b7660..9e93c595f377e3 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/GenericHeaderParser.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/GenericHeaderParser.cs
@@ -133,9 +133,9 @@ private static int ParseWithoutValidation(string value, int startIndex, out obje
private static int ParseHost(string value, int startIndex, out object? parsedValue)
{
- int hostLength = HttpRuleParser.GetHostLength(value, startIndex, false, out string? host);
+ int hostLength = HttpRuleParser.GetHostLength(value, startIndex, false);
- parsedValue = host;
+ parsedValue = value.Substring(startIndex, hostLength);
return hostLength;
}
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HeaderUtilities.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HeaderUtilities.cs
index addd5ae321d040..6cc82433278f75 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HeaderUtilities.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HeaderUtilities.cs
@@ -130,7 +130,7 @@ private static void AddHexEscaped(byte c, StringBuilder destination)
{
// Note that the RFC requires decimal '.' regardless of the culture. I.e. using ',' as decimal
// separator is considered invalid (even if the current culture would allow it).
- double qualityValue = 0;
+ double qualityValue;
if (double.TryParse(qualityParameter.Value, NumberStyles.AllowDecimalPoint,
NumberFormatInfo.InvariantInfo, out qualityValue))
{
@@ -162,7 +162,7 @@ internal static void CheckValidComment(string value, string parameterName)
throw new ArgumentException(SR.net_http_argument_empty_string, parameterName);
}
- int length = 0;
+ int length;
if ((HttpRuleParser.GetCommentLength(value, 0, out length) != HttpParseResult.Parsed) ||
(length != value.Length)) // no trailing spaces allowed
{
@@ -177,7 +177,7 @@ internal static void CheckValidQuotedString(string value, string parameterName)
throw new ArgumentException(SR.net_http_argument_empty_string, parameterName);
}
- int length = 0;
+ int length;
if ((HttpRuleParser.GetQuotedStringLength(value, 0, out length) != HttpParseResult.Parsed) ||
(length != value.Length)) // no trailing spaces allowed
{
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpContentHeaders.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpContentHeaders.cs
index bae8addd668fec..361e27bd8f0596 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpContentHeaders.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpContentHeaders.cs
@@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
namespace System.Net.Http.Headers
{
@@ -16,17 +14,8 @@ public sealed class HttpContentHeaders : HttpHeaders
private HttpHeaderValueCollection? _contentEncoding;
private HttpHeaderValueCollection? _contentLanguage;
- public ICollection Allow
- {
- get
- {
- if (_allow == null)
- {
- _allow = new HttpHeaderValueCollection(KnownHeaders.Allow.Descriptor, this);
- }
- return _allow;
- }
- }
+ public ICollection Allow =>
+ _allow ??= new HttpHeaderValueCollection(KnownHeaders.Allow.Descriptor, this);
public ContentDispositionHeaderValue? ContentDisposition
{
@@ -36,29 +25,11 @@ public ContentDispositionHeaderValue? ContentDisposition
// Must be a collection (and not provide properties like "GZip", "Deflate", etc.) since the
// order matters!
- public ICollection ContentEncoding
- {
- get
- {
- if (_contentEncoding == null)
- {
- _contentEncoding = new HttpHeaderValueCollection(KnownHeaders.ContentEncoding.Descriptor, this);
- }
- return _contentEncoding;
- }
- }
+ public ICollection ContentEncoding =>
+ _contentEncoding ??= new HttpHeaderValueCollection(KnownHeaders.ContentEncoding.Descriptor, this);
- public ICollection ContentLanguage
- {
- get
- {
- if (_contentLanguage == null)
- {
- _contentLanguage = new HttpHeaderValueCollection(KnownHeaders.ContentLanguage.Descriptor, this);
- }
- return _contentLanguage;
- }
- }
+ public ICollection ContentLanguage =>
+ _contentLanguage ??= new HttpHeaderValueCollection(KnownHeaders.ContentLanguage.Descriptor, this);
public long? ContentLength
{
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpGeneralHeaders.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpGeneralHeaders.cs
index b5fae3e1eec5ea..4bd4694f4d5d3d 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpGeneralHeaders.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpGeneralHeaders.cs
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
-using System.Collections.Generic;
using System.Diagnostics;
namespace System.Net.Http.Headers
@@ -74,29 +73,11 @@ public DateTimeOffset? Date
set { _parent.SetOrRemoveParsedValue(KnownHeaders.Date.Descriptor, value); }
}
- public HttpHeaderValueCollection Pragma
- {
- get
- {
- if (_pragma == null)
- {
- _pragma = new HttpHeaderValueCollection(KnownHeaders.Pragma.Descriptor, _parent);
- }
- return _pragma;
- }
- }
+ public HttpHeaderValueCollection Pragma =>
+ _pragma ??= new HttpHeaderValueCollection(KnownHeaders.Pragma.Descriptor, _parent);
- public HttpHeaderValueCollection Trailer
- {
- get
- {
- if (_trailer == null)
- {
- _trailer = new HttpHeaderValueCollection(KnownHeaders.Trailer.Descriptor, _parent);
- }
- return _trailer;
- }
- }
+ public HttpHeaderValueCollection Trailer =>
+ _trailer ??= new HttpHeaderValueCollection(KnownHeaders.Trailer.Descriptor, _parent);
internal static bool? GetTransferEncodingChunked(HttpHeaders parent, HttpGeneralHeaders? headers)
{
@@ -139,65 +120,20 @@ public bool? TransferEncodingChunked
}
}
- public HttpHeaderValueCollection Upgrade
- {
- get
- {
- if (_upgrade == null)
- {
- _upgrade = new HttpHeaderValueCollection(KnownHeaders.Upgrade.Descriptor, _parent);
- }
- return _upgrade;
- }
- }
+ public HttpHeaderValueCollection Upgrade =>
+ _upgrade ??= new HttpHeaderValueCollection(KnownHeaders.Upgrade.Descriptor, _parent);
- public HttpHeaderValueCollection Via
- {
- get
- {
- if (_via == null)
- {
- _via = new HttpHeaderValueCollection(KnownHeaders.Via.Descriptor, _parent);
- }
- return _via;
- }
- }
+ public HttpHeaderValueCollection Via =>
+ _via ??= new HttpHeaderValueCollection(KnownHeaders.Via.Descriptor, _parent);
- public HttpHeaderValueCollection Warning
- {
- get
- {
- if (_warning == null)
- {
- _warning = new HttpHeaderValueCollection(KnownHeaders.Warning.Descriptor, _parent);
- }
- return _warning;
- }
- }
+ public HttpHeaderValueCollection Warning =>
+ _warning ??= new HttpHeaderValueCollection(KnownHeaders.Warning.Descriptor, _parent);
- public HttpHeaderValueCollection Connection
- {
- get
- {
- if (_connection == null)
- {
- _connection = new HttpHeaderValueCollection(KnownHeaders.Connection.Descriptor, _parent);
- }
- return _connection;
- }
- }
+ public HttpHeaderValueCollection Connection =>
+ _connection ??= new HttpHeaderValueCollection(KnownHeaders.Connection.Descriptor, _parent);
- public HttpHeaderValueCollection TransferEncoding
- {
- get
- {
- if (_transferEncoding == null)
- {
- _transferEncoding = new HttpHeaderValueCollection(KnownHeaders.TransferEncoding.Descriptor, _parent);
- }
- return _transferEncoding;
- }
- }
+ public HttpHeaderValueCollection TransferEncoding =>
+ _transferEncoding ??= new HttpHeaderValueCollection(KnownHeaders.TransferEncoding.Descriptor, _parent);
internal HttpGeneralHeaders(HttpHeaders parent)
{
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpRequestHeaders.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpRequestHeaders.cs
index 684728b19c55ba..9a278ff1183196 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpRequestHeaders.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpRequestHeaders.cs
@@ -113,7 +113,7 @@ public string? Host
value = null;
}
- if ((value != null) && (HttpRuleParser.GetHostLength(value, 0, false, out string? _) != value.Length))
+ if ((value != null) && (HttpRuleParser.GetHostLength(value, 0, false) != value.Length))
{
throw new FormatException(SR.net_http_headers_invalid_host_header);
}
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/Int32NumberHeaderParser.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/Int32NumberHeaderParser.cs
index 2b052aca7be646..72ea43b3f5a84c 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/Int32NumberHeaderParser.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/Int32NumberHeaderParser.cs
@@ -40,7 +40,7 @@ protected override int GetParsedValueLength(string value, int startIndex, object
return 0;
}
- int result = 0;
+ int result;
if (!HeaderUtilities.TryParseInt32(value, startIndex, numberLength, out result))
{
return 0;
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/Int64NumberHeaderParser.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/Int64NumberHeaderParser.cs
index 12768a73d03cb9..771b9fa65d7752 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/Int64NumberHeaderParser.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/Int64NumberHeaderParser.cs
@@ -40,7 +40,7 @@ protected override int GetParsedValueLength(string value, int startIndex, object
return 0;
}
- long result = 0;
+ long result;
if (!HeaderUtilities.TryParseInt64(value, startIndex, numberLength, out result))
{
return 0;
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ProductInfoHeaderValue.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ProductInfoHeaderValue.cs
index d04ac66156903f..4c69dec3e80835 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ProductInfoHeaderValue.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ProductInfoHeaderValue.cs
@@ -135,11 +135,11 @@ internal static int GetProductInfoLength(string? input, int startIndex, out Prod
int current = startIndex;
// Caller must remove leading whitespace.
- string? comment = null;
- ProductHeaderValue? product = null;
+ string? comment;
+ ProductHeaderValue? product;
if (input[current] == '(')
{
- int commentLength = 0;
+ int commentLength;
if (HttpRuleParser.GetCommentLength(input, current, out commentLength) != HttpParseResult.Parsed)
{
return 0;
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/RangeItemHeaderValue.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/RangeItemHeaderValue.cs
index 91262983d8cdfe..8c14da848b1d08 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/RangeItemHeaderValue.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/RangeItemHeaderValue.cs
@@ -110,8 +110,7 @@ internal static int GetRangeItemListLength(string? input, int startIndex,
}
// Empty segments are allowed, so skip all delimiter-only segments (e.g. ", ,").
- bool separatorFound = false;
- int current = HeaderUtilities.GetNextNonEmptyOrWhitespaceIndex(input, startIndex, true, out separatorFound);
+ int current = HeaderUtilities.GetNextNonEmptyOrWhitespaceIndex(input, startIndex, true, out _);
// It's OK if we didn't find leading separator characters. Ignore 'separatorFound'.
if (current == input.Length)
@@ -132,7 +131,7 @@ internal static int GetRangeItemListLength(string? input, int startIndex,
rangeCollection.Add(range!);
current = current + rangeLength;
- current = HeaderUtilities.GetNextNonEmptyOrWhitespaceIndex(input, current, true, out separatorFound);
+ current = HeaderUtilities.GetNextNonEmptyOrWhitespaceIndex(input, current, true, out bool separatorFound);
// If the string is not consumed, we must have a delimiter, otherwise the string is not a valid
// range list.
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/TimeSpanHeaderParser.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/TimeSpanHeaderParser.cs
index 1d5f56c8803d5f..653f228ccdfe6f 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/TimeSpanHeaderParser.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/TimeSpanHeaderParser.cs
@@ -34,7 +34,7 @@ protected override int GetParsedValueLength(string value, int startIndex, object
return 0;
}
- int result = 0;
+ int result;
if (!HeaderUtilities.TryParseInt32(value, startIndex, numberLength, out result))
{
return 0;
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ViaHeaderValue.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ViaHeaderValue.cs
index 6f7ebdd49482e3..90f8a69292c704 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ViaHeaderValue.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/ViaHeaderValue.cs
@@ -176,21 +176,22 @@ internal static int GetViaLength(string? input, int startIndex, out object? pars
Debug.Assert(protocolVersion != null);
// Read in '[/] []'
- int receivedByLength = HttpRuleParser.GetHostLength(input, current, true, out string? receivedBy);
-
+ int receivedByLength = HttpRuleParser.GetHostLength(input, current, true);
if (receivedByLength == 0)
{
return 0;
}
+ string receivedBy = input.Substring(current, receivedByLength);
current = current + receivedByLength;
+
current = current + HttpRuleParser.GetWhitespaceLength(input, current);
string? comment = null;
if ((current < input.Length) && (input[current] == '('))
{
// We have a in '[/] []'
- int commentLength = 0;
+ int commentLength;
if (HttpRuleParser.GetCommentLength(input, current, out commentLength) != HttpParseResult.Parsed)
{
return 0; // We found a '(' character but it wasn't a valid comment. Abort.
@@ -281,7 +282,7 @@ private static void CheckReceivedBy(string receivedBy)
// 'receivedBy' can either be a host or a token. Since a token is a valid host, we only verify if the value
// is a valid host.;
- if (HttpRuleParser.GetHostLength(receivedBy, 0, true, out string? host) != receivedBy.Length)
+ if (HttpRuleParser.GetHostLength(receivedBy, 0, true) != receivedBy.Length)
{
throw new FormatException(SR.Format(System.Globalization.CultureInfo.InvariantCulture, SR.net_http_headers_invalid_value, receivedBy));
}
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/WarningHeaderValue.cs b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/WarningHeaderValue.cs
index caa70684ec7dff..6c358f1dc5865e 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/Headers/WarningHeaderValue.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/Headers/WarningHeaderValue.cs
@@ -172,13 +172,13 @@ internal static int GetWarningLength(string? input, int startIndex, out object?
}
// Read in ' [""]'
- if (!TryReadAgent(input, current, ref current, out string? agent))
+ if (!TryReadAgent(input, ref current, out string? agent))
{
return 0;
}
// Read in ' [""]'
- int textLength = 0;
+ int textLength;
int textStartIndex = current;
if (HttpRuleParser.GetQuotedStringLength(input, current, out textLength) != HttpParseResult.Parsed)
{
@@ -190,7 +190,7 @@ internal static int GetWarningLength(string? input, int startIndex, out object?
current = current + textLength;
// Read in ' [""]'
- DateTimeOffset? date = null;
+ DateTimeOffset? date;
if (!TryReadDate(input, ref current, out date))
{
return 0;
@@ -203,16 +203,19 @@ internal static int GetWarningLength(string? input, int startIndex, out object?
return current - startIndex;
}
- private static bool TryReadAgent(string input, int startIndex, ref int current, [NotNullWhen(true)] out string? agent)
+ private static bool TryReadAgent(string input, ref int current, [NotNullWhen(true)] out string? agent)
{
- int agentLength = HttpRuleParser.GetHostLength(input, startIndex, true, out agent!);
+ agent = null;
+ int agentLength = HttpRuleParser.GetHostLength(input, current, true);
if (agentLength == 0)
{
return false;
}
+ agent = input.Substring(current, agentLength);
current = current + agentLength;
+
int whitespaceLength = HttpRuleParser.GetWhitespaceLength(input, current);
current = current + whitespaceLength;
@@ -328,7 +331,7 @@ private static void CheckAgent(string agent)
// 'receivedBy' can either be a host or a token. Since a token is a valid host, we only verify if the value
// is a valid host.
- if (HttpRuleParser.GetHostLength(agent, 0, true, out string? host) != agent.Length)
+ if (HttpRuleParser.GetHostLength(agent, 0, true) != agent.Length)
{
throw new FormatException(SR.Format(System.Globalization.CultureInfo.InvariantCulture, SR.net_http_headers_invalid_value, agent));
}
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs
index 90bd0ad0251bdb..5c907ad6150b7a 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpContent.cs
@@ -606,7 +606,7 @@ protected virtual Task CreateContentReadStreamAsync(CancellationToken ca
// again; just return null.
if (_canCalculateLength)
{
- long length = 0;
+ long length;
if (TryComputeLength(out length))
{
return length;
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRuleParser.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRuleParser.cs
index 2e7390099282bd..e64125f0fb5f27 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpRuleParser.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpRuleParser.cs
@@ -196,12 +196,11 @@ internal static int GetNumberLength(string input, int startIndex, bool allowDeci
return current - startIndex;
}
- internal static int GetHostLength(string input, int startIndex, bool allowToken, out string? host)
+ internal static int GetHostLength(string input, int startIndex, bool allowToken)
{
Debug.Assert(input != null);
Debug.Assert(startIndex >= 0);
- host = null;
if (startIndex >= input.Length)
{
return 0;
@@ -236,13 +235,11 @@ internal static int GetHostLength(string input, int startIndex, bool allowToken,
return 0;
}
- string result = input.Substring(startIndex, length);
- if ((!allowToken || !isToken) && !IsValidHostName(result))
+ if ((!allowToken || !isToken) && !IsValidHostName(input.AsSpan(startIndex, length)))
{
return 0;
}
- host = result;
return length;
}
@@ -311,7 +308,7 @@ private static HttpParseResult GetExpressionLength(string input, int startIndex,
{
// Only check whether we have a quoted char, if we have at least 3 characters left to read (i.e.
// quoted char + closing char). Otherwise the closing char may be considered part of the quoted char.
- int quotedPairLength = 0;
+ int quotedPairLength;
if ((current + 2 < input.Length) &&
(GetQuotedPairLength(input, current, out quotedPairLength) == HttpParseResult.Parsed))
{
@@ -338,7 +335,7 @@ private static HttpParseResult GetExpressionLength(string input, int startIndex,
return HttpParseResult.InvalidFormat;
}
- int nestedLength = 0;
+ int nestedLength;
HttpParseResult nestedResult = GetExpressionLength(input, current, openChar, closeChar,
supportsNesting, nestedCount + 1, out nestedLength);
@@ -379,10 +376,10 @@ private static HttpParseResult GetExpressionLength(string input, int startIndex,
return HttpParseResult.InvalidFormat;
}
- private static bool IsValidHostName(string host)
+ private static bool IsValidHostName(ReadOnlySpan host)
{
// Also add user info (u@) to make sure 'host' doesn't include user info.
- return Uri.TryCreate("http://u@" + host + "/", UriKind.Absolute, out Uri? hostUri);
+ return Uri.TryCreate($"http://u@{host}/", UriKind.Absolute, out _);
}
}
}
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/AuthenticationHelper.Digest.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/AuthenticationHelper.Digest.cs
index 234ca135aa9bd1..c754dff03e59dc 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/AuthenticationHelper.Digest.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/AuthenticationHelper.Digest.cs
@@ -422,31 +422,25 @@ private void Parse(string challenge)
internal static class StringBuilderExtensions
{
- // Characters that require escaping in quoted string
- private static readonly char[] SpecialCharacters = new[] { '"', '\\' };
-
public static void AppendKeyValue(this StringBuilder sb, string key, string value, bool includeQuotes = true, bool includeComma = true)
{
- sb.Append(key);
- sb.Append('=');
+ sb.Append(key).Append('=');
+
if (includeQuotes)
{
+ ReadOnlySpan valueSpan = value;
sb.Append('"');
- int lastSpecialIndex = 0;
- int specialIndex;
while (true)
{
- specialIndex = value.IndexOfAny(SpecialCharacters, lastSpecialIndex);
- if (specialIndex >= 0)
+ int i = valueSpan.IndexOfAny('"', '\\'); // Characters that require escaping in quoted string
+ if (i >= 0)
{
- sb.Append(value, lastSpecialIndex, specialIndex - lastSpecialIndex);
- sb.Append('\\');
- sb.Append(value[specialIndex]);
- lastSpecialIndex = specialIndex + 1;
+ sb.Append(valueSpan.Slice(0, i)).Append('\\').Append(valueSpan[i]);
+ valueSpan = valueSpan.Slice(i + 1);
}
else
{
- sb.Append(value, lastSpecialIndex, value.Length - lastSpecialIndex);
+ sb.Append(valueSpan);
break;
}
}
@@ -459,8 +453,7 @@ public static void AppendKeyValue(this StringBuilder sb, string key, string valu
if (includeComma)
{
- sb.Append(',');
- sb.Append(' ');
+ sb.Append(',').Append(' ');
}
}
}
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs
index c51adc80d5c301..39b7b3006ee122 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs
@@ -455,12 +455,12 @@ private async Task AddHttp11ConnectionAsync(HttpRequestMessage request)
}
catch (OperationCanceledException oce) when (oce.CancellationToken == cts.Token)
{
- HandleHttp11ConnectionFailure(CreateConnectTimeoutException(oce));
+ HandleHttp11ConnectionFailure(request, CreateConnectTimeoutException(oce));
return;
}
catch (Exception e)
{
- HandleHttp11ConnectionFailure(e);
+ HandleHttp11ConnectionFailure(request, e);
return;
}
}
@@ -473,7 +473,7 @@ private void CheckForHttp11ConnectionInjection()
{
Debug.Assert(HasSyncObjLock);
- if (!_http11RequestQueue.TryPeekNextRequest(out HttpRequestMessage? request))
+ if (!_http11RequestQueue.TryPeekRequest(out HttpRequestMessage? request))
{
return;
}
@@ -561,6 +561,7 @@ private async Task HandleHttp11Downgrade(HttpRequestMessage request, Socket? soc
if (NetEventSource.Log.IsEnabled()) Trace("Server does not support HTTP2; disabling HTTP2 use and proceeding with HTTP/1.1 connection");
bool canUse = true;
+ TaskCompletionSourceWithCancellation? waiter = null;
lock (SyncObj)
{
Debug.Assert(_pendingHttp2Connection);
@@ -571,10 +572,6 @@ private async Task HandleHttp11Downgrade(HttpRequestMessage request, Socket? soc
_associatedHttp2ConnectionCount--;
_pendingHttp2Connection = false;
- // Signal to any queued HTTP2 requests that they must downgrade.
- while (_http2RequestQueue.TryDequeueNextRequest(null))
- ;
-
if (_associatedHttp11ConnectionCount < _maxHttp11Connections)
{
_associatedHttp11ConnectionCount++;
@@ -585,6 +582,23 @@ private async Task HandleHttp11Downgrade(HttpRequestMessage request, Socket? soc
// We are already at the limit for HTTP/1.1 connections, so do not proceed with this connection.
canUse = false;
}
+
+ _http2RequestQueue.TryDequeueWaiter(out waiter);
+ }
+
+ // Signal to any queued HTTP2 requests that they must downgrade.
+ while (waiter is not null)
+ {
+ if (NetEventSource.Log.IsEnabled()) Trace("Downgrading queued HTTP2 request to HTTP/1.1");
+
+ // We don't care if this fails; that means the request was previously canceled.
+ bool success = waiter.TrySetResult(null);
+ Debug.Assert(success || waiter.Task.IsCanceled);
+
+ lock (SyncObj)
+ {
+ _http2RequestQueue.TryDequeueWaiter(out waiter);
+ }
}
if (!canUse)
@@ -601,12 +615,12 @@ private async Task HandleHttp11Downgrade(HttpRequestMessage request, Socket? soc
}
catch (OperationCanceledException oce) when (oce.CancellationToken == cancellationToken)
{
- HandleHttp11ConnectionFailure(CreateConnectTimeoutException(oce));
+ HandleHttp11ConnectionFailure(request, CreateConnectTimeoutException(oce));
return;
}
catch (Exception e)
{
- HandleHttp11ConnectionFailure(e);
+ HandleHttp11ConnectionFailure(request, e);
return;
}
@@ -654,12 +668,12 @@ private async Task AddHttp2ConnectionAsync(HttpRequestMessage request)
}
catch (OperationCanceledException oce) when (oce.CancellationToken == cts.Token)
{
- HandleHttp2ConnectionFailure(CreateConnectTimeoutException(oce));
+ HandleHttp2ConnectionFailure(request, CreateConnectTimeoutException(oce));
return;
}
catch (Exception e)
{
- HandleHttp2ConnectionFailure(e);
+ HandleHttp2ConnectionFailure(request, e);
return;
}
}
@@ -669,7 +683,7 @@ private async Task AddHttp2ConnectionAsync(HttpRequestMessage request)
ValueTask shutdownTask = connection.WaitForShutdownAsync();
// Add the new connection to the pool.
- ReturnHttp2Connection(connection, isNewConnection: true);
+ ReturnHttp2Connection(connection, request, isNewConnection: true);
// Wait for connection shutdown.
await shutdownTask.ConfigureAwait(false);
@@ -681,7 +695,7 @@ private void CheckForHttp2ConnectionInjection()
{
Debug.Assert(HasSyncObjLock);
- if (!_http2RequestQueue.TryPeekNextRequest(out HttpRequestMessage? request))
+ if (!_http2RequestQueue.TryPeekRequest(out HttpRequestMessage? request))
{
return;
}
@@ -1573,10 +1587,12 @@ private async ValueTask EstablishProxyTunnelAsync(bool async, HttpReques
return (socket, stream);
}
- private void HandleHttp11ConnectionFailure(Exception e)
+ private void HandleHttp11ConnectionFailure(HttpRequestMessage request, Exception e)
{
if (NetEventSource.Log.IsEnabled()) Trace("HTTP/1.1 connection failed");
+ bool failRequest;
+ TaskCompletionSourceWithCancellation? waiter;
lock (SyncObj)
{
Debug.Assert(_associatedHttp11ConnectionCount > 0);
@@ -1585,17 +1601,28 @@ private void HandleHttp11ConnectionFailure(Exception e)
_associatedHttp11ConnectionCount--;
_pendingHttp11ConnectionCount--;
- // Fail the next queued request (if any) with this error.
- _http11RequestQueue.TryFailNextRequest(e);
+ // If the request that caused this connection attempt is still pending, fail it.
+ // Otherwise, the request must have been canceled or satisfied by another connection already.
+ failRequest = _http11RequestQueue.TryDequeueWaiterForSpecificRequest(request, out waiter);
CheckForHttp11ConnectionInjection();
}
+
+ if (failRequest)
+ {
+ // This may fail if the request was already canceled, but we don't care.
+ Debug.Assert(waiter is not null);
+ bool succeeded = waiter.TrySetException(e);
+ Debug.Assert(succeeded || waiter.Task.IsCanceled);
+ }
}
- private void HandleHttp2ConnectionFailure(Exception e)
+ private void HandleHttp2ConnectionFailure(HttpRequestMessage request, Exception e)
{
if (NetEventSource.Log.IsEnabled()) Trace("HTTP2 connection failed");
+ bool failRequest;
+ TaskCompletionSourceWithCancellation? waiter;
lock (SyncObj)
{
Debug.Assert(_associatedHttp2ConnectionCount > 0);
@@ -1604,11 +1631,20 @@ private void HandleHttp2ConnectionFailure(Exception e)
_associatedHttp2ConnectionCount--;
_pendingHttp2Connection = false;
- // Fail the next queued request (if any) with this error.
- _http2RequestQueue.TryFailNextRequest(e);
+ // If the request that caused this connection attempt is still pending, fail it.
+ // Otherwise, the request must have been canceled or satisfied by another connection already.
+ failRequest = _http2RequestQueue.TryDequeueWaiterForSpecificRequest(request, out waiter);
CheckForHttp2ConnectionInjection();
}
+
+ if (failRequest)
+ {
+ // This may fail if the request was already canceled, but we don't care.
+ Debug.Assert(waiter is not null);
+ bool succeeded = waiter.TrySetException(e);
+ Debug.Assert(succeeded || waiter.Task.IsCanceled);
+ }
}
///
@@ -1684,50 +1720,77 @@ public void ReturnHttp11Connection(HttpConnection connection, bool isNewConnecti
return;
}
- lock (SyncObj)
+ // Loop in case we get a cancelled request.
+ while (true)
{
- Debug.Assert(!_availableHttp11Connections.Contains(connection));
-
- if (isNewConnection)
+ TaskCompletionSourceWithCancellation? waiter = null;
+ bool added = false;
+ lock (SyncObj)
{
- Debug.Assert(_pendingHttp11ConnectionCount > 0);
- _pendingHttp11ConnectionCount--;
- }
+ Debug.Assert(!_availableHttp11Connections.Contains(connection), $"Connection already in available list");
+ Debug.Assert(_associatedHttp11ConnectionCount > _availableHttp11Connections.Count,
+ $"Expected _associatedHttp11ConnectionCount={_associatedHttp11ConnectionCount} > _availableHttp11Connections.Count={_availableHttp11Connections.Count}");
+ Debug.Assert(_associatedHttp11ConnectionCount <= _maxHttp11Connections,
+ $"Expected _associatedHttp11ConnectionCount={_associatedHttp11ConnectionCount} <= _maxHttp11Connections={_maxHttp11Connections}");
- if (_http11RequestQueue.TryDequeueNextRequest(connection))
- {
- Debug.Assert(_availableHttp11Connections.Count == 0, $"With {_availableHttp11Connections.Count} available HTTP/1.1 connections, we shouldn't have a waiter.");
+ if (isNewConnection)
+ {
+ Debug.Assert(_pendingHttp11ConnectionCount > 0);
+ _pendingHttp11ConnectionCount--;
+ isNewConnection = false;
+ }
- if (NetEventSource.Log.IsEnabled()) connection.Trace("Dequeued waiting HTTP/1.1 request.");
- return;
+ if (_http11RequestQueue.TryDequeueWaiter(out waiter))
+ {
+ Debug.Assert(_availableHttp11Connections.Count == 0, $"With {_availableHttp11Connections.Count} available HTTP/1.1 connections, we shouldn't have a waiter.");
+ }
+ else if (!_disposed)
+ {
+ // Add connection to the pool.
+ added = true;
+ _availableHttp11Connections.Add(connection);
+ }
+
+ // If the pool has been disposed of, we will dispose the connection below outside the lock.
+ // We do this after processing the queue above so that any queued requests will be handled by existing connections if possible.
}
- if (_disposed)
+ if (waiter is not null)
+ {
+ Debug.Assert(!added);
+ if (waiter.TrySetResult(connection))
+ {
+ if (NetEventSource.Log.IsEnabled()) connection.Trace("Dequeued waiting HTTP/1.1 request.");
+ return;
+ }
+ else
+ {
+ Debug.Assert(waiter.Task.IsCanceled);
+ if (NetEventSource.Log.IsEnabled()) connection.Trace("Discarding canceled HTTP/1.1 request from queue.");
+ // Loop and process the queue again
+ }
+ }
+ else if (added)
{
- // If the pool has been disposed of, dispose the connection being returned,
- // as the pool is being deactivated. We do this after the above in order to
- // use pooled connections to satisfy any requests that pended before the
- // the pool was disposed of.
- if (NetEventSource.Log.IsEnabled()) connection.Trace("Disposing connection returned to pool. Pool was disposed.");
+ if (NetEventSource.Log.IsEnabled()) connection.Trace("Put HTTP/1.1 connection in pool.");
+ return;
}
else
{
- // Add connection to the pool.
- _availableHttp11Connections.Add(connection);
- Debug.Assert(_availableHttp11Connections.Count <= _maxHttp11Connections, $"Expected {_availableHttp11Connections.Count} <= {_maxHttp11Connections}");
- if (NetEventSource.Log.IsEnabled()) connection.Trace("Put connection in pool.");
+ Debug.Assert(_disposed);
+ if (NetEventSource.Log.IsEnabled()) connection.Trace("Disposing HTTP/1.1 connection returned to pool. Pool was disposed.");
+ connection.Dispose();
return;
}
}
-
- // We determined that the connection is no longer usable.
- connection.Dispose();
}
- public void ReturnHttp2Connection(Http2Connection connection, bool isNewConnection)
+ public void ReturnHttp2Connection(Http2Connection connection, HttpRequestMessage? request = null, bool isNewConnection = false)
{
if (NetEventSource.Log.IsEnabled()) connection.Trace($"{nameof(isNewConnection)}={isNewConnection}");
+ Debug.Assert(isNewConnection || request is null, "Shouldn't have a request unless the connection is new");
+
if (!isNewConnection && CheckExpirationOnReturn(connection))
{
lock (SyncObj)
@@ -1737,91 +1800,111 @@ public void ReturnHttp2Connection(Http2Connection connection, bool isNewConnecti
_associatedHttp2ConnectionCount--;
}
- if (NetEventSource.Log.IsEnabled()) connection.Trace("Disposing HTTP/2 connection return to pool. Connection lifetime expired.");
+ if (NetEventSource.Log.IsEnabled()) connection.Trace("Disposing HTTP2 connection return to pool. Connection lifetime expired.");
connection.Dispose();
return;
}
- bool usable = true;
- bool poolDisposed = false;
- lock (SyncObj)
+ while (connection.TryReserveStream())
{
- Debug.Assert(_availableHttp2Connections is null || !_availableHttp2Connections.Contains(connection));
- Debug.Assert(_associatedHttp2ConnectionCount > (_availableHttp2Connections?.Count ?? 0));
-
- if (isNewConnection)
+ // Loop in case we get a cancelled request.
+ while (true)
{
- Debug.Assert(_pendingHttp2Connection);
- _pendingHttp2Connection = false;
- }
-
- while (!_http2RequestQueue.IsEmpty)
- {
- Debug.Assert((_availableHttp2Connections?.Count ?? 0) == 0, $"With {_availableHttp11Connections.Count} available HTTP2 connections, we shouldn't have a waiter.");
-
- if (!connection.TryReserveStream())
+ TaskCompletionSourceWithCancellation? waiter = null;
+ bool added = false;
+ lock (SyncObj)
{
- usable = false;
+ Debug.Assert(_availableHttp2Connections is null || !_availableHttp2Connections.Contains(connection), $"HTTP2 connection already in available list");
+ Debug.Assert(_associatedHttp2ConnectionCount > (_availableHttp2Connections?.Count ?? 0),
+ $"Expected _associatedHttp2ConnectionCount={_associatedHttp2ConnectionCount} > _availableHttp2Connections.Count={(_availableHttp2Connections?.Count ?? 0)}");
+
if (isNewConnection)
{
- // The new connection could not handle even one request, either because it shut down before we could use it for any requests,
- // or because it immediately set the max concurrent streams limit to 0.
- // We don't want to get stuck in a loop where we keep trying to create new connections for the same request.
- // Fail the next request, if any.
- HttpRequestException hre = new HttpRequestException(SR.net_http_http2_connection_not_established);
- ExceptionDispatchInfo.SetCurrentStackTrace(hre);
- _http2RequestQueue.TryFailNextRequest(hre);
+ Debug.Assert(_pendingHttp2Connection);
+ _pendingHttp2Connection = false;
+ isNewConnection = false;
}
- break;
- }
- isNewConnection = false;
+ if (_http2RequestQueue.TryDequeueWaiter(out waiter))
+ {
+ Debug.Assert((_availableHttp2Connections?.Count ?? 0) == 0, $"With {(_availableHttp2Connections?.Count ?? 0)} available HTTP2 connections, we shouldn't have a waiter.");
+ }
+ else if (_disposed)
+ {
+ // The pool has been disposed. We will dispose this connection below outside the lock.
+ // We do this check after processing the request queue so that any queued requests will be handled by existing connections if possible.
+ _associatedHttp2ConnectionCount--;
+ }
+ else
+ {
+ // Add connection to the pool.
+ added = true;
+ _availableHttp2Connections ??= new List();
+ _availableHttp2Connections.Add(connection);
+ }
+ }
- if (!_http2RequestQueue.TryDequeueNextRequest(connection))
+ if (waiter is not null)
{
- connection.ReleaseStream();
- break;
+ Debug.Assert(!added);
+ if (waiter.TrySetResult(connection))
+ {
+ if (NetEventSource.Log.IsEnabled()) connection.Trace("Dequeued waiting HTTP2 request.");
+ break;
+ }
+ else
+ {
+ Debug.Assert(waiter.Task.IsCanceled);
+ if (NetEventSource.Log.IsEnabled()) connection.Trace("Discarding canceled HTTP2 request from queue.");
+ // Loop and process the queue again
+ }
}
-
- if (NetEventSource.Log.IsEnabled()) connection.Trace("Dequeued waiting HTTP/2 request.");
- }
-
- // Since we only inject one connection at a time, we may want to inject another now.
- CheckForHttp2ConnectionInjection();
-
- if (_disposed)
- {
- // If the pool has been disposed of, we want to dispose the connection being returned, as the pool is being deactivated.
- // We do this after the above in order to satisfy any requests that were queued before the pool was disposed of.
- Debug.Assert(_associatedHttp2ConnectionCount > (_availableHttp2Connections?.Count ?? 0));
- _associatedHttp2ConnectionCount--;
- poolDisposed = true;
- }
- else if (usable)
- {
- if (_availableHttp2Connections is null)
+ else
{
- _availableHttp2Connections = new List();
+ connection.ReleaseStream();
+ if (added)
+ {
+ if (NetEventSource.Log.IsEnabled()) connection.Trace("Put HTTP2 connection in pool.");
+ return;
+ }
+ else
+ {
+ Debug.Assert(_disposed);
+ if (NetEventSource.Log.IsEnabled()) connection.Trace("Disposing HTTP2 connection returned to pool. Pool was disposed.");
+ connection.Dispose();
+ return;
+ }
}
-
- // Add connection to the pool.
- _availableHttp2Connections.Add(connection);
- if (NetEventSource.Log.IsEnabled()) connection.Trace("Put HTTP/2 connection in pool.");
- return;
}
}
- if (poolDisposed)
+ if (isNewConnection)
{
- if (NetEventSource.Log.IsEnabled()) connection.Trace("Disposing HTTP/2 connection returned to pool. Pool was disposed.");
+ Debug.Assert(request is not null, "Expect request for a new connection");
+
+ // The new connection could not handle even one request, either because it shut down before we could use it for any requests,
+ // or because it immediately set the max concurrent streams limit to 0.
+ // We don't want to get stuck in a loop where we keep trying to create new connections for the same request.
+ // So, treat this as a connection failure.
+
+ if (NetEventSource.Log.IsEnabled()) connection.Trace("New HTTP2 connection is unusable due to no available streams.");
connection.Dispose();
- return;
- }
- Debug.Assert(!usable);
+ HttpRequestException hre = new HttpRequestException(SR.net_http_http2_connection_not_established);
+ ExceptionDispatchInfo.SetCurrentStackTrace(hre);
+ HandleHttp2ConnectionFailure(request, hre);
+ }
+ else
+ {
+ // Since we only inject one connection at a time, we may want to inject another now.
+ lock (SyncObj)
+ {
+ CheckForHttp2ConnectionInjection();
+ }
- // We need to wait until the connection is usable again.
- DisableHttp2Connection(connection);
+ // We need to wait until the connection is usable again.
+ DisableHttp2Connection(connection);
+ }
}
///
@@ -1945,6 +2028,7 @@ public bool CleanCacheAndDisposeIfUnused()
{
TimeSpan pooledConnectionLifetime = _poolManager.Settings._pooledConnectionLifetime;
TimeSpan pooledConnectionIdleTimeout = _poolManager.Settings._pooledConnectionIdleTimeout;
+ long nowTicks = Environment.TickCount64;
List? toDispose = null;
@@ -1965,8 +2049,6 @@ public bool CleanCacheAndDisposeIfUnused()
// will be purged next time around.
_usedSinceLastCleanup = false;
- long nowTicks = Environment.TickCount64;
-
ScavengeConnectionList(_availableHttp11Connections, ref toDispose, nowTicks, pooledConnectionLifetime, pooledConnectionIdleTimeout);
if (_availableHttp2Connections is not null)
{
@@ -2143,66 +2225,43 @@ public TaskCompletionSourceWithCancellation EnqueueRequest(HttpRequestMessage
return waiter;
}
- public bool TryFailNextRequest(Exception e)
+ public bool TryDequeueWaiterForSpecificRequest(HttpRequestMessage request, [MaybeNullWhen(false)] out TaskCompletionSourceWithCancellation waiter)
{
- Debug.Assert(e is HttpRequestException or OperationCanceledException, "Unexpected exception type for connection failure");
-
- if (_queue is not null)
+ if (_queue is not null && _queue.TryPeek(out QueueItem item) && item.Request == request)
{
- // Fail the next queued request (if any) with this error.
- while (_queue.TryDequeue(out QueueItem item))
- {
- // Try to complete the waiter task. If it's been cancelled already, this will fail.
- if (item.Waiter.TrySetException(e))
- {
- return true;
- }
-
- // Couldn't transfer to that waiter because it was cancelled. Try again.
- Debug.Assert(item.Waiter.Task.IsCanceled);
- }
+ _queue.Dequeue();
+ waiter = item.Waiter;
+ return true;
}
+ waiter = null;
return false;
}
- public bool TryDequeueNextRequest(T connection)
+ public bool TryDequeueWaiter([MaybeNullWhen(false)] out TaskCompletionSourceWithCancellation waiter)
{
- if (_queue is not null)
+ if (_queue is not null && _queue.TryDequeue(out QueueItem item))
{
- while (_queue.TryDequeue(out QueueItem item))
- {
- // Try to complete the task. If it's been cancelled already, this will return false.
- if (item.Waiter.TrySetResult(connection))
- {
- return true;
- }
-
- // Couldn't transfer to that waiter because it was cancelled. Try again.
- Debug.Assert(item.Waiter.Task.IsCanceled);
- }
+ waiter = item.Waiter;
+ return true;
}
+ waiter = null;
return false;
}
- public bool TryPeekNextRequest([NotNullWhen(true)] out HttpRequestMessage? request)
+ public bool TryPeekRequest([MaybeNullWhen(false)] out HttpRequestMessage request)
{
- if (_queue is not null)
+ if (_queue is not null && _queue.TryPeek(out QueueItem item))
{
- if (_queue.TryPeek(out QueueItem item))
- {
- request = item.Request;
- return true;
- }
+ request = item.Request;
+ return true;
}
request = null;
return false;
}
- public bool IsEmpty => Count == 0;
-
public int Count => (_queue?.Count ?? 0);
}
}
diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpWindowsProxy.cs b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpWindowsProxy.cs
index 176b35c7401964..bd7d03388c7235 100644
--- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpWindowsProxy.cs
+++ b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpWindowsProxy.cs
@@ -78,7 +78,6 @@ private HttpWindowsProxy(WinInetProxyHelper proxyHelper, SafeWinHttpHandle? sess
if (!string.IsNullOrWhiteSpace(proxyHelper.ProxyBypass))
{
int idx = 0;
- int start = 0;
string? tmp;
// Process bypass list for manual setting.
@@ -104,7 +103,7 @@ private HttpWindowsProxy(WinInetProxyHelper proxyHelper, SafeWinHttpHandle? sess
idx += 1;
}
- start = idx;
+ int start = idx;
while (idx < proxyHelper.ProxyBypass.Length && proxyHelper.ProxyBypass[idx] != ' ' && proxyHelper.ProxyBypass[idx] != ';' && proxyHelper.ProxyBypass[idx] != ']') { idx += 1; };
if (idx == start)
diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs
index e232ee94419897..0c62b3bc3c0c7b 100644
--- a/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs
+++ b/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Cancellation.cs
@@ -3,6 +3,7 @@
using System.Diagnostics;
using System.IO;
+using System.Net.Sockets;
using System.Net.Test.Common;
using System.Threading;
using System.Threading.Tasks;
@@ -104,6 +105,97 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
options: new GenericLoopbackOptions() { UseSsl = false });
}
+ [OuterLoop]
+ [Theory]
+ [InlineData(true)]
+ [InlineData(false)]
+ public async Task ConnectionFailure_AfterInitialRequestCancelled_SecondRequestSucceedsOnNewConnection(bool useSsl)
+ {
+ if (UseVersion == HttpVersion.Version30)
+ {
+ // HTTP3 does not support ConnectCallback
+ return;
+ }
+
+ if (!TestAsync)
+ {
+ // Test relies on ordering of async operations, so we can't test the sync case
+ return;
+ }
+
+ await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
+ {
+ int connectCount = 0;
+
+ TaskCompletionSource tcsFirstConnectionInitiated = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
+ TaskCompletionSource tcsFirstRequestCanceled = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
+
+ using (var handler = CreateHttpClientHandler())
+ using (var client = CreateHttpClient(handler))
+ {
+ handler.ServerCertificateCustomValidationCallback = TestHelper.AllowAllCertificates;
+ var socketsHandler = GetUnderlyingSocketsHttpHandler(handler);
+ socketsHandler.ConnectCallback = async (context, token) =>
+ {
+ // Note we force serialization of connection creation by waiting on tcsFirstConnectionInitiated below,
+ // so we don't need to worry about concurrent access to connectCount.
+ bool isFirstConnection = connectCount == 0;
+ connectCount++;
+
+ Assert.True(connectCount <= 2);
+
+ if (isFirstConnection)
+ {
+ tcsFirstConnectionInitiated.SetResult();
+ }
+ else
+ {
+ Assert.True(tcsFirstConnectionInitiated.Task.IsCompletedSuccessfully);
+ }
+
+ // Wait until first request is cancelled and has completed
+ await tcsFirstRequestCanceled.Task;
+
+ if (isFirstConnection)
+ {
+ // Fail the first connection attempt
+ throw new Exception("Failing first connection");
+ }
+ else
+ {
+ // Succeed the second connection attempt
+ Socket socket = new Socket(SocketType.Stream, ProtocolType.Tcp) { NoDelay = true };
+ await socket.ConnectAsync(context.DnsEndPoint, token);
+ return new NetworkStream(socket, ownsSocket: true);
+ }
+ };
+
+ using CancellationTokenSource cts = new CancellationTokenSource();
+ Task t1 = client.SendAsync(new HttpRequestMessage(HttpMethod.Get, uri) { Version = UseVersion, VersionPolicy = HttpVersionPolicy.RequestVersionExact }, cts.Token);
+
+ // Wait for the connection attempt to be initiated before we send the second request, to avoid races in connection creation
+ await tcsFirstConnectionInitiated.Task;
+ Task t2 = client.SendAsync(new HttpRequestMessage(HttpMethod.Get, uri) { Version = UseVersion, VersionPolicy = HttpVersionPolicy.RequestVersionExact }, default);
+
+ // Cancel the first message and wait for it to complete
+ cts.Cancel();
+ await Assert.ThrowsAnyAsync(() => t1);
+
+ // Signal connections to proceed
+ tcsFirstRequestCanceled.SetResult();
+
+ // Second request should succeed, even though the first connection failed
+ HttpResponseMessage resp2 = await t2;
+ Assert.Equal(HttpStatusCode.OK, resp2.StatusCode);
+ Assert.Equal("Hello world", await resp2.Content.ReadAsStringAsync());
+ }
+ }, async server =>
+ {
+ await server.AcceptConnectionSendResponseAndCloseAsync(content: "Hello world");
+ },
+ options: new GenericLoopbackOptions() { UseSsl = useSsl });
+ }
+
[OuterLoop("Incurs significant delay")]
[Fact]
public async Task Expect100Continue_WaitsExpectedPeriodOfTimeBeforeSendingContent()
diff --git a/src/libraries/System.Net.Http/tests/UnitTests/HttpRuleParserTest.cs b/src/libraries/System.Net.Http/tests/UnitTests/HttpRuleParserTest.cs
index 707ddae2f4658c..35b3f607680874 100644
--- a/src/libraries/System.Net.Http/tests/UnitTests/HttpRuleParserTest.cs
+++ b/src/libraries/System.Net.Http/tests/UnitTests/HttpRuleParserTest.cs
@@ -377,9 +377,14 @@ private static void AssertGetCommentLength(string input, int startIndex, int exp
private static void AssertGetHostLength(string input, int startIndex, int expectedLength, bool allowToken,
string expectedResult)
{
- string result = null;
- Assert.Equal(expectedLength, HttpRuleParser.GetHostLength(input, startIndex, allowToken, out result));
- Assert.Equal(expectedResult, result);
+ int length = HttpRuleParser.GetHostLength(input, startIndex, allowToken);
+ Assert.Equal(expectedLength, length);
+
+ if (length != 0)
+ {
+ string result = input.Substring(startIndex, length);
+ Assert.Equal(expectedResult, result);
+ }
}
#endregion
}
diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/HttpListener.cs b/src/libraries/System.Net.HttpListener/src/System/Net/HttpListener.cs
index 640b7f6bde3093..adad957f1321cb 100644
--- a/src/libraries/System.Net.HttpListener/src/System/Net/HttpListener.cs
+++ b/src/libraries/System.Net.HttpListener/src/System/Net/HttpListener.cs
@@ -110,7 +110,7 @@ public HttpListenerPrefixCollection Prefixes
internal void AddPrefix(string uriPrefix)
{
- string? registeredPrefix = null;
+ string? registeredPrefix;
try
{
if (uriPrefix == null)
diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/HttpListenerRequest.cs b/src/libraries/System.Net.HttpListener/src/System/Net/HttpListenerRequest.cs
index c070c93dfc6801..5bfecb4453ef01 100644
--- a/src/libraries/System.Net.HttpListener/src/System/Net/HttpListenerRequest.cs
+++ b/src/libraries/System.Net.HttpListener/src/System/Net/HttpListenerRequest.cs
@@ -327,7 +327,7 @@ private static class Helpers
return null;
// parse the value
- string? attrValue = null;
+ string? attrValue;
int j;
@@ -567,7 +567,7 @@ internal static void FillFromString(NameValueCollection nvc, string s, bool urle
// extract the name / value pair
string? name = null;
- string? value = null;
+ string? value;
if (ti >= 0)
{
diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/HttpListenerRequestUriBuilder.cs b/src/libraries/System.Net.HttpListener/src/System/Net/HttpListenerRequestUriBuilder.cs
index f078b5bdbee6a4..24bbe30b5937b9 100644
--- a/src/libraries/System.Net.HttpListener/src/System/Net/HttpListenerRequestUriBuilder.cs
+++ b/src/libraries/System.Net.HttpListener/src/System/Net/HttpListenerRequestUriBuilder.cs
@@ -94,7 +94,7 @@ private void BuildRequestUriUsingCookedPath()
private void BuildRequestUriUsingRawPath()
{
- bool isValid = false;
+ bool isValid;
// Initialize 'rawPath' only if really needed; i.e. if we build the request Uri from the raw Uri.
_rawPath = GetPath(_rawUri);
@@ -172,7 +172,7 @@ private ParsingResult ParseRawPath(Encoding encoding)
Debug.Assert(encoding != null, "'encoding' must be assigned.");
int index = 0;
- char current = '\0';
+ char current;
Debug.Assert(_rawPath != null);
while (index < _rawPath.Length)
{
diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/HttpRequestStream.cs b/src/libraries/System.Net.HttpListener/src/System/Net/HttpRequestStream.cs
index 19036503817842..1cf9595c8feb14 100644
--- a/src/libraries/System.Net.HttpListener/src/System/Net/HttpRequestStream.cs
+++ b/src/libraries/System.Net.HttpListener/src/System/Net/HttpRequestStream.cs
@@ -15,10 +15,10 @@ internal partial class HttpRequestStream : Stream
public override int Read(byte[] buffer, int offset, int count)
{
- if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(this, "buffer.Length:" + buffer.Length + " count:" + count + " offset:" + offset);
-
ValidateBufferArguments(buffer, offset, count);
+ if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(this, "buffer.Length:" + buffer.Length + " count:" + count + " offset:" + offset);
+
if (count == 0 || _closed)
{
return 0;
@@ -29,10 +29,10 @@ public override int Read(byte[] buffer, int offset, int count)
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback? callback, object? state)
{
- if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(this, "buffer.Length:" + buffer.Length + " count:" + count + " offset:" + offset);
-
ValidateBufferArguments(buffer, offset, count);
+ if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(this, "buffer.Length:" + buffer.Length + " count:" + count + " offset:" + offset);
+
return BeginReadCore(buffer, offset, count, callback, state)!;
}
diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/Managed/ChunkStream.cs b/src/libraries/System.Net.HttpListener/src/System/Net/Managed/ChunkStream.cs
index b81824bc4c0a37..1a9ab35dc0528d 100644
--- a/src/libraries/System.Net.HttpListener/src/System/Net/Managed/ChunkStream.cs
+++ b/src/libraries/System.Net.HttpListener/src/System/Net/Managed/ChunkStream.cs
@@ -332,7 +332,7 @@ private State ReadCRLF(byte[] buffer, ref int offset, int size)
private State ReadTrailer(byte[] buffer, ref int offset, int size)
{
- char c = '\0';
+ char c;
// short path
if (_trailerState == 2 && (char)buffer[offset] == '\r' && _saved.Length == 0)
diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpConnection.cs b/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpConnection.cs
index fe4fc17f851d45..58d9b2029bdf0b 100644
--- a/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpConnection.cs
+++ b/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpConnection.cs
@@ -253,7 +253,7 @@ private static void OnRead(IAsyncResult ares)
private void OnReadInternal(IAsyncResult ares)
{
_timer.Change(Timeout.Infinite, Timeout.Infinite);
- int nread = -1;
+ int nread;
try
{
nread = _stream.EndRead(ares);
@@ -376,7 +376,6 @@ private bool ProcessInput(MemoryStream ms)
if (_inputState == InputState.RequestLine)
continue;
_currentLine = null;
- ms = null!;
return true;
}
diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpEndPointManager.cs b/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpEndPointManager.cs
index a0d62b816ec225..49b2b7318742a4 100644
--- a/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpEndPointManager.cs
+++ b/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpEndPointManager.cs
@@ -134,7 +134,7 @@ private static HttpEndPointListener GetEPListener(string host, int port, HttpLis
}
}
- Dictionary? p = null;
+ Dictionary? p;
if (s_ipEndPoints.ContainsKey(addr))
{
p = s_ipEndPoints[addr];
@@ -145,7 +145,7 @@ private static HttpEndPointListener GetEPListener(string host, int port, HttpLis
s_ipEndPoints[addr] = p;
}
- HttpEndPointListener? epl = null;
+ HttpEndPointListener? epl;
if (p.ContainsKey(port))
{
epl = p[port];
diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpListenerContext.Managed.cs b/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpListenerContext.Managed.cs
index cddfa7e5b66708..c5cc376f02b0ff 100644
--- a/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpListenerContext.Managed.cs
+++ b/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpListenerContext.Managed.cs
@@ -46,7 +46,7 @@ internal void ParseAuthentication(AuthenticationSchemes expectedSchemes)
}
internal IPrincipal? ParseBasicAuthentication(string authData) =>
- TryParseBasicAuth(authData, out HttpStatusCode errorCode, out string? username, out string? password) ?
+ TryParseBasicAuth(authData, out _, out string? username, out string? password) ?
new GenericPrincipal(new HttpListenerBasicIdentity(username, password), Array.Empty()) :
null;
diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpResponseStream.Managed.cs b/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpResponseStream.Managed.cs
index 13a9d26c9890c7..5aa170f8b74037 100644
--- a/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpResponseStream.Managed.cs
+++ b/src/libraries/System.Net.HttpListener/src/System/Net/Managed/HttpResponseStream.Managed.cs
@@ -55,7 +55,7 @@ internal HttpResponseStream(Stream stream, HttpListenerResponse response, bool i
private void DisposeCore()
{
- byte[]? bytes = null;
+ byte[]? bytes;
MemoryStream? ms = GetHeaders(true);
bool chunked = _response.SendChunked;
if (_stream.CanWrite)
@@ -169,7 +169,7 @@ private void WriteCore(byte[] buffer, int offset, int size)
if (size == 0)
return;
- byte[]? bytes = null;
+ byte[]? bytes;
MemoryStream? ms = GetHeaders(false);
bool chunked = _response.SendChunked;
if (ms != null)
diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/ServiceNameStore.cs b/src/libraries/System.Net.HttpListener/src/System/Net/ServiceNameStore.cs
index 7ccc90973af949..5284f810fca36e 100644
--- a/src/libraries/System.Net.HttpListener/src/System/Net/ServiceNameStore.cs
+++ b/src/libraries/System.Net.HttpListener/src/System/Net/ServiceNameStore.cs
@@ -84,8 +84,7 @@ public ServiceNameStore()
port = hostAndPort.Substring(colonIndex + 1); // Excludes colon
// Loosely validate the port just to make sure it was a port and not something else
- ushort portValue;
- if (!ushort.TryParse(port, NumberStyles.Integer, CultureInfo.InvariantCulture, out portValue))
+ if (!ushort.TryParse(port, NumberStyles.Integer, CultureInfo.InvariantCulture, out _))
{
return inputServiceName;
}
@@ -281,10 +280,9 @@ public string[] BuildServiceNames(string uriPrefix)
{
string hostname = ExtractHostname(uriPrefix, true)!;
- IPAddress? ipAddress = null;
if (string.Equals(hostname, "*", StringComparison.OrdinalIgnoreCase) ||
string.Equals(hostname, "+", StringComparison.OrdinalIgnoreCase) ||
- IPAddress.TryParse(hostname, out ipAddress))
+ IPAddress.TryParse(hostname, out _))
{
// for a wildcard, register the machine name. If the caller doesn't have DNS permission
// or the query fails for some reason, don't add an SPN.
diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpListener.Windows.cs b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpListener.Windows.cs
index 63c96497909f3a..5e2dedd9fd78fe 100644
--- a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpListener.Windows.cs
+++ b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpListener.Windows.cs
@@ -96,15 +96,13 @@ public bool UnsafeConnectionNtlmAuthentication
private void SetUrlGroupProperty(Interop.HttpApi.HTTP_SERVER_PROPERTY property, IntPtr info, uint infosize)
{
- uint statusCode = Interop.HttpApi.ERROR_SUCCESS;
-
Debug.Assert(_urlGroupId != 0, "SetUrlGroupProperty called with invalid url group id");
Debug.Assert(info != IntPtr.Zero, "SetUrlGroupProperty called with invalid pointer");
//
// Set the url group property using Http Api.
//
- statusCode = Interop.HttpApi.HttpSetUrlGroupProperty(
+ uint statusCode = Interop.HttpApi.HttpSetUrlGroupProperty(
_urlGroupId, property, info, infosize);
if (statusCode != Interop.HttpApi.ERROR_SUCCESS)
@@ -153,7 +151,6 @@ public HttpListenerTimeoutManager TimeoutManager
private void SetupV2Config()
{
- uint statusCode = Interop.HttpApi.ERROR_SUCCESS;
ulong id = 0;
//
@@ -175,7 +172,7 @@ private void SetupV2Config()
try
{
- statusCode = Interop.HttpApi.HttpCreateServerSession(
+ uint statusCode = Interop.HttpApi.HttpCreateServerSession(
Interop.HttpApi.s_version, &id, 0);
if (statusCode != Interop.HttpApi.ERROR_SUCCESS)
@@ -508,7 +505,14 @@ public HttpListenerContext GetContext()
uint size = 4096;
ulong requestId = 0;
memoryBlob = new SyncRequestContext((int)size);
- HttpListenerSession session = _currentSession!;
+ HttpListenerSession? session = _currentSession;
+
+ // Because there is no synchronization, the listener can be stopped or closed while the method is executing,
+ // resulting in a null session
+ if (session == null)
+ {
+ throw new HttpListenerException((int)Interop.HttpApi.ERROR_INVALID_PARAMETER);
+ }
while (true)
{
@@ -617,10 +621,20 @@ public IAsyncResult BeginGetContext(AsyncCallback? callback, object? state)
{
throw new InvalidOperationException(SR.Format(SR.net_listener_mustcall, "Start()"));
}
+
+ HttpListenerSession? session = _currentSession;
+
+ // Because there is no synchronization, the listener can be stopped or closed while the method is executing,
+ // resulting in a null session
+ if (session == null)
+ {
+ throw new HttpListenerException((int)Interop.HttpApi.ERROR_INVALID_PARAMETER);
+ }
+
// prepare the ListenerAsyncResult object (this will have it's own
// event that the user can wait on for IO completion - which means we
// need to signal it when IO completes)
- asyncResult = new ListenerAsyncResult(_currentSession!, state, callback);
+ asyncResult = new ListenerAsyncResult(session, state, callback);
uint statusCode = asyncResult.QueueBeginGetContext();
if (statusCode != Interop.HttpApi.ERROR_SUCCESS &&
statusCode != Interop.HttpApi.ERROR_IO_PENDING)
@@ -1271,9 +1285,8 @@ internal void SetAuthenticationHeaders(HttpListenerContext context)
HttpListenerResponse response = context.Response;
// We use the cached results from the delegates so that we don't have to call them again here.
- NTAuthentication? newContext;
ArrayList? challenges = BuildChallenge(context.AuthenticationSchemes, request._connectionId,
- out newContext, context.ExtendedProtectionPolicy, request.IsSecureConnection);
+ out _, context.ExtendedProtectionPolicy, request.IsSecureConnection);
// Setting 401 without setting WWW-Authenticate is a protocol violation
// but throwing from HttpListener would be a breaking change.
diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpRequestStream.Windows.cs b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpRequestStream.Windows.cs
index ecbadd5943c9fd..214416962eba75 100644
--- a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpRequestStream.Windows.cs
+++ b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpRequestStream.Windows.cs
@@ -307,7 +307,7 @@ internal void IOCompleted(uint errorCode, uint numBytes)
private static void IOCompleted(HttpRequestStreamAsyncResult asyncResult, uint errorCode, uint numBytes)
{
if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(null, $"asyncResult: {asyncResult} errorCode:0x {errorCode:x8} numBytes: {numBytes}");
- object? result = null;
+ object? result;
try
{
if (errorCode != Interop.HttpApi.ERROR_SUCCESS && errorCode != Interop.HttpApi.ERROR_HANDLE_EOF)
diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpResponseStreamAsyncResult.cs b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpResponseStreamAsyncResult.cs
index d41ff445938cd4..64514975250536 100644
--- a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpResponseStreamAsyncResult.cs
+++ b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpResponseStreamAsyncResult.cs
@@ -186,7 +186,7 @@ internal void IOCompleted(uint errorCode, uint numBytes)
private static void IOCompleted(HttpResponseStreamAsyncResult asyncResult, uint errorCode, uint numBytes)
{
if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(null, $"errorCode:0x{errorCode:x8} numBytes: {numBytes}");
- object? result = null;
+ object? result;
try
{
if (errorCode != Interop.HttpApi.ERROR_SUCCESS && errorCode != Interop.HttpApi.ERROR_HANDLE_EOF)
diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/WebSockets/WebSocketHttpListenerDuplexStream.cs b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/WebSockets/WebSocketHttpListenerDuplexStream.cs
index 67437df45f46e0..d32841971016e6 100644
--- a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/WebSockets/WebSocketHttpListenerDuplexStream.cs
+++ b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/WebSockets/WebSocketHttpListenerDuplexStream.cs
@@ -194,8 +194,7 @@ private unsafe bool ReadAsyncFast(HttpListenerAsyncEventArgs eventArgs)
eventArgs.StartOperationCommon(this, _inputStream.InternalHttpContext.RequestQueueBoundHandle);
eventArgs.StartOperationReceive();
- uint statusCode = 0;
- bool completedAsynchronouslyOrWithError = false;
+ bool completedAsynchronouslyOrWithError;
try
{
Debug.Assert(eventArgs.Buffer != null, "'BufferList' is not supported for read operations.");
@@ -242,7 +241,7 @@ private unsafe bool ReadAsyncFast(HttpListenerAsyncEventArgs eventArgs)
uint flags = 0;
uint bytesReturned = 0;
- statusCode =
+ uint statusCode =
Interop.HttpApi.HttpReceiveRequestEntityBody(
_inputStream.InternalHttpContext.RequestQueueHandle,
_inputStream.InternalHttpContext.RequestId,
@@ -445,7 +444,7 @@ private unsafe bool WriteAsyncFast(HttpListenerAsyncEventArgs eventArgs)
eventArgs.StartOperationSend();
uint statusCode;
- bool completedAsynchronouslyOrWithError = false;
+ bool completedAsynchronouslyOrWithError;
try
{
if (_outputStream.Closed ||
diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/WebSockets/WebSocketProtocolComponent.cs b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/WebSockets/WebSocketProtocolComponent.cs
index 2402dd36c0f09e..53da835ab8165e 100644
--- a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/WebSockets/WebSocketProtocolComponent.cs
+++ b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/WebSockets/WebSocketProtocolComponent.cs
@@ -225,9 +225,6 @@ internal static void WebSocketCreateServerHandle(Interop.WebSocket.Property[] pr
HttpWebSocket.ThrowPlatformNotSupportedException_WSPC();
}
- IntPtr responseHeadersPtr;
- uint responseHeaderCount;
-
// Currently the WSPC doesn't allow to initiate a data session
// without also being involved in the http handshake
// There is no information whatsoever, which is needed by the
@@ -243,8 +240,8 @@ internal static void WebSocketCreateServerHandle(Interop.WebSocket.Property[] pr
0,
s_ServerFakeRequestHeaders!,
(uint)s_ServerFakeRequestHeaders!.Length,
- out responseHeadersPtr,
- out responseHeaderCount);
+ out _,
+ out _);
ThrowOnError(errorCode);
@@ -421,9 +418,7 @@ private static void DrainActionQueue(SafeHandle webSocketHandle, ActionQueue act
"'webSocketHandle' MUST NOT be NULL or INVALID.");
IntPtr actionContext;
- IntPtr dummy;
Action action;
- BufferType bufferType;
while (true)
{
@@ -434,8 +429,8 @@ private static void DrainActionQueue(SafeHandle webSocketHandle, ActionQueue act
dataBuffers,
ref dataBufferCount,
out action,
- out bufferType,
- out dummy,
+ out _,
+ out _,
out actionContext);
if (!Succeeded(errorCode))
diff --git a/src/libraries/System.Net.Mail/src/System/Net/BufferedReadStream.cs b/src/libraries/System.Net.Mail/src/System/Net/BufferedReadStream.cs
index 8c8b778f74c799..da6c7eb2972eeb 100644
--- a/src/libraries/System.Net.Mail/src/System/Net/BufferedReadStream.cs
+++ b/src/libraries/System.Net.Mail/src/System/Net/BufferedReadStream.cs
@@ -74,7 +74,7 @@ public override int Read(byte[] buffer, int offset, int count)
public override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
- int read = 0;
+ int read;
if (_storedOffset >= _storedLength)
{
return base.ReadAsync(buffer, offset, count, cancellationToken);
diff --git a/src/libraries/System.Net.Mail/src/System/Net/Mail/Attachment.cs b/src/libraries/System.Net.Mail/src/System/Net/Mail/Attachment.cs
index 0ea9aa12af67eb..aaca28f6a4c8cb 100644
--- a/src/libraries/System.Net.Mail/src/System/Net/Mail/Attachment.cs
+++ b/src/libraries/System.Net.Mail/src/System/Net/Mail/Attachment.cs
@@ -12,7 +12,6 @@ public abstract class AttachmentBase : IDisposable
{
internal bool disposed;
private readonly MimePart _part = new MimePart();
- private static readonly char[] s_contentCIDInvalidChars = new char[] { '<', '>' };
internal AttachmentBase()
{
@@ -248,7 +247,7 @@ public string ContentId
}
else
{
- if (value.IndexOfAny(s_contentCIDInvalidChars) != -1)
+ if (value.AsSpan().IndexOfAny('<', '>') >= 0) // invalid chars
{
throw new ArgumentException(SR.MailHeaderInvalidCID, nameof(value));
}
diff --git a/src/libraries/System.Net.Mail/src/System/Net/Mail/MailAddress.cs b/src/libraries/System.Net.Mail/src/System/Net/Mail/MailAddress.cs
index f5ea92bf4e8374..1acfc449c5afdb 100644
--- a/src/libraries/System.Net.Mail/src/System/Net/Mail/MailAddress.cs
+++ b/src/libraries/System.Net.Mail/src/System/Net/Mail/MailAddress.cs
@@ -284,7 +284,7 @@ public override int GetHashCode()
// Encodes the full email address, folding as needed
internal string Encode(int charsConsumed, bool allowUnicode)
{
- string encodedAddress = string.Empty;
+ string encodedAddress;
IEncodableStream encoder;
Debug.Assert(Address != null, "address was null");
diff --git a/src/libraries/System.Net.Mail/src/System/Net/Mail/MailMessage.cs b/src/libraries/System.Net.Mail/src/System/Net/Mail/MailMessage.cs
index 67db9ed4c3956b..4e7ad597cabf9c 100644
--- a/src/libraries/System.Net.Mail/src/System/Net/Mail/MailMessage.cs
+++ b/src/libraries/System.Net.Mail/src/System/Net/Mail/MailMessage.cs
@@ -377,7 +377,7 @@ private void SetContent(bool allowUnicode)
{
// we should not unnecessarily use Multipart/Mixed
// When there is no attachement and all the alternative views are of "Alternative" types.
- MimeMultiPart? part = null;
+ MimeMultiPart? part;
MimeMultiPart viewsPart = new MimeMultiPart(MimeMultiPartType.Alternative);
if (!string.IsNullOrEmpty(_body))
diff --git a/src/libraries/System.Net.Mail/src/System/Net/Mail/MailPriority.cs b/src/libraries/System.Net.Mail/src/System/Net/Mail/MailPriority.cs
index aed784ce95b503..53e41d8f86e6c1 100644
--- a/src/libraries/System.Net.Mail/src/System/Net/Mail/MailPriority.cs
+++ b/src/libraries/System.Net.Mail/src/System/Net/Mail/MailPriority.cs
@@ -532,7 +532,7 @@ internal void EncodeHeaders(HeaderCollection headers, bool allowUnicode)
}
string[] values = headers.GetValues(headerName)!;
- string encodedValue = string.Empty;
+ string encodedValue;
for (int j = 0; j < values.Length; j++)
{
//encode if we need to
diff --git a/src/libraries/System.Net.Mail/src/System/Net/Mime/MimePart.cs b/src/libraries/System.Net.Mail/src/System/Net/Mime/MimePart.cs
index 218df997c6e22a..84fe52f5f48b9a 100644
--- a/src/libraries/System.Net.Mail/src/System/Net/Mime/MimePart.cs
+++ b/src/libraries/System.Net.Mail/src/System/Net/Mime/MimePart.cs
@@ -111,8 +111,6 @@ internal void SetContent(Stream stream)
if (_streamSet)
{
_stream!.Close();
- _stream = null;
- _streamSet = false;
}
_stream = stream;
diff --git a/src/libraries/System.Net.NameResolution/tests/PalTests/NameResolutionPalTests.cs b/src/libraries/System.Net.NameResolution/tests/PalTests/NameResolutionPalTests.cs
index b753063dfb4162..5ae74af0bd538c 100644
--- a/src/libraries/System.Net.NameResolution/tests/PalTests/NameResolutionPalTests.cs
+++ b/src/libraries/System.Net.NameResolution/tests/PalTests/NameResolutionPalTests.cs
@@ -155,7 +155,18 @@ public void TryGetAddrInfo_LocalHost_TryGetNameInfo()
Assert.NotNull(aliases);
Assert.NotNull(addresses);
- string name = NameResolutionPal.TryGetNameInfo(addresses[0], out error, out nativeErrorCode);
+ // Not all addresses returned by TryGetAddInfo can be resolved to host names, depending on network configuration.
+ // However at least one should be.
+ string name = null;
+ foreach(IPAddress address in addresses)
+ {
+ name = NameResolutionPal.TryGetNameInfo(address, out error, out nativeErrorCode);
+ if (error != SocketError.HostNotFound)
+ {
+ break;
+ }
+ }
+
Assert.Equal(SocketError.Success, error);
Assert.NotNull(name);
}
@@ -181,12 +192,22 @@ public void TryGetAddrInfo_HostName_TryGetNameInfo()
Assert.NotNull(aliases);
Assert.NotNull(addresses);
- string name = NameResolutionPal.TryGetNameInfo(addresses[0], out error, out nativeErrorCode);
- if (error == SocketError.HostNotFound)
+ // Not all addresses returned by TryGetAddInfo can be resolved to host names, depending on network configuration.
+ // However at least one should be.
+ string name = null;
+ foreach(IPAddress address in addresses)
+ {
+ name = NameResolutionPal.TryGetNameInfo(address, out error, out nativeErrorCode);
+ if (error != SocketError.HostNotFound)
+ {
+ break;
+ }
+ }
+
+ if (error == SocketError.HostNotFound && Environment.OSVersion.Platform == PlatformID.Unix)
{
// On Unix, getaddrinfo returns private ipv4 address for hostname. If the OS doesn't have the
// reverse dns lookup entry for this address, getnameinfo returns host not found.
- Assert.Equal(PlatformID.Unix, Environment.OSVersion.Platform);
return;
}
diff --git a/src/libraries/System.Net.NetworkInformation/ref/System.Net.NetworkInformation.cs b/src/libraries/System.Net.NetworkInformation/ref/System.Net.NetworkInformation.cs
index b8d331ba9918cd..66ab317a7d93de 100644
--- a/src/libraries/System.Net.NetworkInformation/ref/System.Net.NetworkInformation.cs
+++ b/src/libraries/System.Net.NetworkInformation/ref/System.Net.NetworkInformation.cs
@@ -123,9 +123,11 @@ public virtual void CopyTo(System.Net.NetworkInformation.IPAddressInformation[]
public abstract partial class IPGlobalProperties
{
protected IPGlobalProperties() { }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract string DhcpScopeName { get; }
public abstract string DomainName { get; }
public abstract string HostName { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract bool IsWinsProxy { get; }
public abstract System.Net.NetworkInformation.NetBiosNodeType NodeType { get; }
public virtual System.IAsyncResult BeginGetUnicastAddresses(System.AsyncCallback? callback, object? state) { throw null; }
@@ -136,16 +138,22 @@ protected IPGlobalProperties() { }
public abstract System.Net.IPEndPoint[] GetActiveTcpListeners();
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract System.Net.IPEndPoint[] GetActiveUdpListeners();
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract System.Net.NetworkInformation.IcmpV4Statistics GetIcmpV4Statistics();
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract System.Net.NetworkInformation.IcmpV6Statistics GetIcmpV6Statistics();
[System.Runtime.Versioning.UnsupportedOSPlatform("illumos")]
[System.Runtime.Versioning.UnsupportedOSPlatform("solaris")]
public static System.Net.NetworkInformation.IPGlobalProperties GetIPGlobalProperties() { throw null; }
public abstract System.Net.NetworkInformation.IPGlobalStatistics GetIPv4GlobalStatistics();
public abstract System.Net.NetworkInformation.IPGlobalStatistics GetIPv6GlobalStatistics();
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract System.Net.NetworkInformation.TcpStatistics GetTcpIPv4Statistics();
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract System.Net.NetworkInformation.TcpStatistics GetTcpIPv6Statistics();
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract System.Net.NetworkInformation.UdpStatistics GetUdpIPv4Statistics();
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract System.Net.NetworkInformation.UdpStatistics GetUdpIPv6Statistics();
public virtual System.Net.NetworkInformation.UnicastIPAddressInformationCollection GetUnicastAddresses() { throw null; }
public virtual System.Threading.Tasks.Task GetUnicastAddressesAsync() { throw null; }
@@ -153,41 +161,69 @@ protected IPGlobalProperties() { }
public abstract partial class IPGlobalStatistics
{
protected IPGlobalStatistics() { }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract int DefaultTtl { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract bool ForwardingEnabled { get; }
public abstract int NumberOfInterfaces { get; }
public abstract int NumberOfIPAddresses { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract int NumberOfRoutes { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract long OutputPacketRequests { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract long OutputPacketRoutingDiscards { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract long OutputPacketsDiscarded { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract long OutputPacketsWithNoRoute { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract long PacketFragmentFailures { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract long PacketReassembliesRequired { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract long PacketReassemblyFailures { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract long PacketReassemblyTimeout { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract long PacketsFragmented { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract long PacketsReassembled { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract long ReceivedPackets { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract long ReceivedPacketsDelivered { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract long ReceivedPacketsDiscarded { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract long ReceivedPacketsForwarded { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract long ReceivedPacketsWithAddressErrors { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract long ReceivedPacketsWithHeadersErrors { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract long ReceivedPacketsWithUnknownProtocol { get; }
}
public abstract partial class IPInterfaceProperties
{
protected IPInterfaceProperties() { }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract System.Net.NetworkInformation.IPAddressInformationCollection AnycastAddresses { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract System.Net.NetworkInformation.IPAddressCollection DhcpServerAddresses { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract System.Net.NetworkInformation.IPAddressCollection DnsAddresses { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract string DnsSuffix { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract System.Net.NetworkInformation.GatewayIPAddressInformationCollection GatewayAddresses { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract bool IsDnsEnabled { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract bool IsDynamicDnsEnabled { get; }
public abstract System.Net.NetworkInformation.MulticastIPAddressInformationCollection MulticastAddresses { get; }
public abstract System.Net.NetworkInformation.UnicastIPAddressInformationCollection UnicastAddresses { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract System.Net.NetworkInformation.IPAddressCollection WinsServersAddresses { get; }
public abstract System.Net.NetworkInformation.IPv4InterfaceProperties GetIPv4Properties();
public abstract System.Net.NetworkInformation.IPv6InterfaceProperties GetIPv6Properties();
@@ -212,11 +248,16 @@ public abstract partial class IPv4InterfaceProperties
{
protected IPv4InterfaceProperties() { }
public abstract int Index { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract bool IsAutomaticPrivateAddressingActive { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract bool IsAutomaticPrivateAddressingEnabled { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract bool IsDhcpEnabled { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract bool IsForwardingEnabled { get; }
public abstract int Mtu { get; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public abstract bool UsesWins { get; }
}
public abstract partial class IPv4InterfaceStatistics
@@ -316,7 +357,9 @@ protected NetworkInterface() { }
[System.Runtime.Versioning.UnsupportedOSPlatform("solaris")]
public static System.Net.NetworkInformation.NetworkInterface[] GetAllNetworkInterfaces() { throw null; }
public virtual System.Net.NetworkInformation.IPInterfaceProperties GetIPProperties() { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public virtual System.Net.NetworkInformation.IPInterfaceStatistics GetIPStatistics() { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public virtual System.Net.NetworkInformation.IPv4InterfaceStatistics GetIPv4Statistics() { throw null; }
[System.Runtime.Versioning.UnsupportedOSPlatform("illumos")]
[System.Runtime.Versioning.UnsupportedOSPlatform("solaris")]
diff --git a/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj b/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj
index dc251f9c75dc41..13a17550284e0d 100644
--- a/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj
+++ b/src/libraries/System.Net.NetworkInformation/src/System.Net.NetworkInformation.csproj
@@ -1,7 +1,7 @@
true
- $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris;$(NetCoreAppCurrent)
+ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris;$(NetCoreAppCurrent)
enable
@@ -26,7 +26,7 @@
-
+
@@ -118,8 +118,8 @@
-
-
+
+
@@ -144,6 +144,17 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPGlobalProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPGlobalProperties.cs
new file mode 100644
index 00000000000000..4cebb2c55efa9a
--- /dev/null
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPGlobalProperties.cs
@@ -0,0 +1,32 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+namespace System.Net.NetworkInformation
+{
+ internal sealed class AndroidIPGlobalProperties : UnixIPGlobalProperties
+ {
+ public override TcpConnectionInformation[] GetActiveTcpConnections() => throw new PlatformNotSupportedException();
+
+ public override IPEndPoint[] GetActiveTcpListeners() => throw new PlatformNotSupportedException();
+
+ public override IPEndPoint[] GetActiveUdpListeners() => throw new PlatformNotSupportedException();
+
+ public override IcmpV4Statistics GetIcmpV4Statistics() => throw new PlatformNotSupportedException();
+
+ public override IcmpV6Statistics GetIcmpV6Statistics() => throw new PlatformNotSupportedException();
+
+ public override IPGlobalStatistics GetIPv4GlobalStatistics()
+ => new AndroidIPGlobalStatistics(ipv4: true);
+
+ public override IPGlobalStatistics GetIPv6GlobalStatistics()
+ => new AndroidIPGlobalStatistics(ipv4: false);
+
+ public override TcpStatistics GetTcpIPv4Statistics() => throw new PlatformNotSupportedException();
+
+ public override TcpStatistics GetTcpIPv6Statistics() => throw new PlatformNotSupportedException();
+
+ public override UdpStatistics GetUdpIPv4Statistics() => throw new PlatformNotSupportedException();
+
+ public override UdpStatistics GetUdpIPv6Statistics() => throw new PlatformNotSupportedException();
+ }
+}
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPGlobalStatistics.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPGlobalStatistics.cs
new file mode 100644
index 00000000000000..de57e068a1ddbf
--- /dev/null
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPGlobalStatistics.cs
@@ -0,0 +1,73 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Diagnostics;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
+using System.Net.Sockets;
+
+namespace System.Net.NetworkInformation
+{
+ internal sealed class AndroidIPGlobalStatistics : IPGlobalStatistics
+ {
+ public AndroidIPGlobalStatistics(bool ipv4)
+ {
+ AndroidNetworkInterface[] networkInterfaces = NetworkInterfacePal.GetAndroidNetworkInterfaces();
+
+ foreach (var networkInterface in networkInterfaces)
+ {
+ var component = ipv4 ? NetworkInterfaceComponent.IPv4 : NetworkInterfaceComponent.IPv6;
+ if (networkInterface.Supports(component))
+ {
+ NumberOfInterfaces++;
+ }
+
+ foreach (UnixUnicastIPAddressInformation addressInformation in networkInterface.UnicastAddress)
+ {
+ bool isIPv4 = addressInformation.Address.AddressFamily == AddressFamily.InterNetwork;
+ if (isIPv4 == ipv4)
+ {
+ NumberOfIPAddresses++;
+ }
+ }
+
+ if (networkInterface.MulticastAddresess != null)
+ {
+ foreach (IPAddress address in networkInterface.MulticastAddresess)
+ {
+ bool isIPv4 = address.AddressFamily == AddressFamily.InterNetwork;
+ if (isIPv4 == ipv4)
+ {
+ NumberOfIPAddresses++;
+ }
+ }
+ }
+ }
+ }
+
+ public override int NumberOfInterfaces { get; }
+ public override int NumberOfIPAddresses { get; }
+
+ public override int DefaultTtl => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override bool ForwardingEnabled => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override int NumberOfRoutes => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override long OutputPacketRequests => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override long OutputPacketRoutingDiscards => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override long OutputPacketsDiscarded => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override long OutputPacketsWithNoRoute => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override long PacketFragmentFailures => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override long PacketReassembliesRequired => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override long PacketReassemblyFailures => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override long PacketReassemblyTimeout => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override long PacketsFragmented => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override long PacketsReassembled => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override long ReceivedPackets => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override long ReceivedPacketsDelivered => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override long ReceivedPacketsDiscarded => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override long ReceivedPacketsForwarded => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override long ReceivedPacketsWithAddressErrors => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override long ReceivedPacketsWithHeadersErrors => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override long ReceivedPacketsWithUnknownProtocol => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ }
+}
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPInterfaceProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPInterfaceProperties.cs
new file mode 100644
index 00000000000000..cee58c47d84475
--- /dev/null
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPInterfaceProperties.cs
@@ -0,0 +1,30 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Collections.Generic;
+using System.IO;
+
+namespace System.Net.NetworkInformation
+{
+ internal sealed class AndroidIPInterfaceProperties : UnixIPInterfaceProperties
+ {
+ private readonly AndroidIPv4InterfaceProperties _ipv4Properties;
+ private readonly AndroidIPv6InterfaceProperties _ipv6Properties;
+
+ public AndroidIPInterfaceProperties(AndroidNetworkInterface ani)
+ : base(ani, globalConfig: true)
+ {
+ _ipv4Properties = new AndroidIPv4InterfaceProperties(ani);
+ _ipv6Properties = new AndroidIPv6InterfaceProperties(ani);
+ }
+
+ public override IPv4InterfaceProperties GetIPv4Properties() => _ipv4Properties;
+ public override IPv6InterfaceProperties GetIPv6Properties() => _ipv6Properties;
+
+ public override bool IsDynamicDnsEnabled => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override IPAddressInformationCollection AnycastAddresses => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override GatewayIPAddressInformationCollection GatewayAddresses => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override IPAddressCollection DhcpServerAddresses => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override IPAddressCollection WinsServersAddresses => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ }
+}
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPv4InterfaceProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPv4InterfaceProperties.cs
new file mode 100644
index 00000000000000..cc12cf7f357456
--- /dev/null
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPv4InterfaceProperties.cs
@@ -0,0 +1,24 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.IO;
+
+namespace System.Net.NetworkInformation
+{
+ internal sealed class AndroidIPv4InterfaceProperties : UnixIPv4InterfaceProperties
+ {
+ public AndroidIPv4InterfaceProperties(AndroidNetworkInterface androidNetworkInterface)
+ : base(androidNetworkInterface)
+ {
+ Mtu = androidNetworkInterface._mtu;
+ }
+
+ public override int Mtu { get; }
+
+ public override bool IsAutomaticPrivateAddressingActive => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override bool IsAutomaticPrivateAddressingEnabled => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override bool IsDhcpEnabled => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override bool IsForwardingEnabled => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override bool UsesWins => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ }
+}
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPv6InterfaceProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPv6InterfaceProperties.cs
new file mode 100644
index 00000000000000..9a5f872231efde
--- /dev/null
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidIPv6InterfaceProperties.cs
@@ -0,0 +1,31 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.IO;
+
+namespace System.Net.NetworkInformation
+{
+ internal sealed class AndroidIPv6InterfaceProperties : UnixIPv6InterfaceProperties
+ {
+ private readonly AndroidNetworkInterface _androidNetworkInterface;
+
+ public AndroidIPv6InterfaceProperties(AndroidNetworkInterface androidNetworkInterface)
+ : base(androidNetworkInterface)
+ {
+ _androidNetworkInterface = androidNetworkInterface;
+ }
+
+ public override int Mtu => _androidNetworkInterface._mtu;
+
+ public override long GetScopeId(ScopeLevel scopeLevel)
+ {
+ if (scopeLevel == ScopeLevel.None || scopeLevel == ScopeLevel.Interface ||
+ scopeLevel == ScopeLevel.Link || scopeLevel == ScopeLevel.Subnet)
+ {
+ return _androidNetworkInterface.Index;
+ }
+
+ return 0;
+ }
+ }
+}
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidNetworkInterface.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidNetworkInterface.cs
new file mode 100644
index 00000000000000..dcf66895aea7b1
--- /dev/null
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/AndroidNetworkInterface.cs
@@ -0,0 +1,54 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Net;
+
+namespace System.Net.NetworkInformation
+{
+ ///
+ /// Implements a NetworkInterface on Android.
+ ///
+ internal sealed class AndroidNetworkInterface : UnixNetworkInterface
+ {
+ internal readonly int _mtu;
+ private readonly AndroidIPInterfaceProperties _ipProperties;
+
+ internal unsafe AndroidNetworkInterface(string name, Interop.Sys.NetworkInterfaceInfo *networkInterfaceInfo)
+ : base(name)
+ {
+ _index = networkInterfaceInfo->InterfaceIndex;
+ if (networkInterfaceInfo->NumAddressBytes > 0)
+ {
+ _physicalAddress = new PhysicalAddress(new ReadOnlySpan(networkInterfaceInfo->AddressBytes, networkInterfaceInfo->NumAddressBytes).ToArray());
+ }
+
+ _mtu = networkInterfaceInfo->Mtu;
+ _ipProperties = new AndroidIPInterfaceProperties(this);
+
+ OperationalStatus = (OperationalStatus)networkInterfaceInfo->OperationalState;
+ Speed = networkInterfaceInfo->Speed;
+ SupportsMulticast = networkInterfaceInfo->SupportsMulticast != 0;
+ NetworkInterfaceType = (NetworkInterfaceType)networkInterfaceInfo->HardwareType;
+ }
+
+ internal unsafe void AddAddress(Interop.Sys.IpAddressInfo *addressInfo)
+ {
+ var address = new IPAddress(new ReadOnlySpan(addressInfo->AddressBytes, addressInfo->NumAddressBytes));
+ if (address.IsIPv6LinkLocal)
+ {
+ address.ScopeId = addressInfo->InterfaceIndex;
+ }
+
+ AddAddress(address, addressInfo->PrefixLength);
+ }
+
+ public override bool SupportsMulticast { get; }
+ public override IPInterfaceProperties GetIPProperties() => _ipProperties;
+ public override IPInterfaceStatistics GetIPStatistics() => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override IPv4InterfaceStatistics GetIPv4Statistics() => throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform);
+ public override OperationalStatus OperationalStatus { get; }
+ public override NetworkInterfaceType NetworkInterfaceType { get; }
+ public override long Speed { get; }
+ public override bool IsReceiveOnly => false;
+ }
+}
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalProperties.cs
index d835ce2ecd65ba..1371a47d3ed945 100644
--- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalProperties.cs
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalProperties.cs
@@ -40,6 +40,7 @@ public static IPGlobalProperties GetIPGlobalProperties()
///
/// Gets the Dynamic Host Configuration Protocol (DHCP) scope name.
///
+ [UnsupportedOSPlatform("android")]
public abstract string DhcpScopeName { get; }
///
@@ -55,6 +56,7 @@ public static IPGlobalProperties GetIPGlobalProperties()
///
/// Gets a bool value that specifies whether the local computer is acting as a Windows Internet Name Service (WINS) proxy.
///
+ [UnsupportedOSPlatform("android")]
public abstract bool IsWinsProxy { get; }
///
@@ -72,25 +74,31 @@ public virtual UnicastIPAddressInformationCollection EndGetUnicastAddresses(IAsy
throw NotImplemented.ByDesignWithMessage(SR.net_MethodNotImplementedException);
}
+ [UnsupportedOSPlatform("android")]
public abstract TcpStatistics GetTcpIPv4Statistics();
+ [UnsupportedOSPlatform("android")]
public abstract TcpStatistics GetTcpIPv6Statistics();
///
/// Provides User Datagram Protocol (UDP) statistical data for the local computer.
///
+ [UnsupportedOSPlatform("android")]
public abstract UdpStatistics GetUdpIPv4Statistics();
+ [UnsupportedOSPlatform("android")]
public abstract UdpStatistics GetUdpIPv6Statistics();
///
/// Provides Internet Control Message Protocol (ICMP) version 4 statistical data for the local computer.
///
+ [UnsupportedOSPlatform("android")]
public abstract IcmpV4Statistics GetIcmpV4Statistics();
///
/// Provides Internet Control Message Protocol (ICMP) version 6 statistical data for the local computer.
///
+ [UnsupportedOSPlatform("android")]
public abstract IcmpV6Statistics GetIcmpV6Statistics();
///
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalPropertiesPal.Android.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalPropertiesPal.Android.cs
new file mode 100644
index 00000000000000..33e09ece17c696
--- /dev/null
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalPropertiesPal.Android.cs
@@ -0,0 +1,13 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+namespace System.Net.NetworkInformation
+{
+ internal static class IPGlobalPropertiesPal
+ {
+ public static IPGlobalProperties GetIPGlobalProperties()
+ {
+ return new AndroidIPGlobalProperties();
+ }
+ }
+}
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalStatistics.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalStatistics.cs
index a8103f867e83d4..04b9f14f1eab2b 100644
--- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalStatistics.cs
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPGlobalStatistics.cs
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System.Runtime.Versioning;
+
namespace System.Net.NetworkInformation
{
///
@@ -11,11 +13,13 @@ public abstract class IPGlobalStatistics
///
/// Gets the default time-to-live (TTL) value for Internet Protocol (IP) packets.
///
+ [UnsupportedOSPlatform("android")]
public abstract int DefaultTtl { get; }
///
/// Gets a bool value that specifies whether Internet Protocol (IP) packet forwarding is enabled.
///
+ [UnsupportedOSPlatform("android")]
public abstract bool ForwardingEnabled { get; }
///
@@ -31,91 +35,109 @@ public abstract class IPGlobalStatistics
///
/// Gets the number of outbound Internet Protocol (IP) packets.
///
+ [UnsupportedOSPlatform("android")]
public abstract long OutputPacketRequests { get; }
///
/// Gets the number of routes in the routing table that have been discarded.
///
+ [UnsupportedOSPlatform("android")]
public abstract long OutputPacketRoutingDiscards { get; }
///
/// Gets the number of transmitted Internet Protocol (IP) packets that have been discarded.
///
+ [UnsupportedOSPlatform("android")]
public abstract long OutputPacketsDiscarded { get; }
///
/// Gets the number of Internet Protocol (IP) packets for which the local computer could not determine a route to the destination address.
///
+ [UnsupportedOSPlatform("android")]
public abstract long OutputPacketsWithNoRoute { get; }
///
/// Gets the number of Internet Protocol (IP) packets that could not be fragmented.
///
+ [UnsupportedOSPlatform("android")]
public abstract long PacketFragmentFailures { get; }
///
/// Gets the number of Internet Protocol (IP) packets that required reassembly.
///
+ [UnsupportedOSPlatform("android")]
public abstract long PacketReassembliesRequired { get; }
///
/// Gets the number of Internet Protocol (IP) packets that were not successfully reassembled.
///
+ [UnsupportedOSPlatform("android")]
public abstract long PacketReassemblyFailures { get; }
///
/// Gets the maximum amount of time within which all fragments of an Internet Protocol (IP) packet must arrive.
///
+ [UnsupportedOSPlatform("android")]
public abstract long PacketReassemblyTimeout { get; }
///
/// Gets the number of Internet Protocol (IP) packets fragmented.
///
+ [UnsupportedOSPlatform("android")]
public abstract long PacketsFragmented { get; }
///
/// Gets the number of Internet Protocol (IP) packets reassembled.
///
+ [UnsupportedOSPlatform("android")]
public abstract long PacketsReassembled { get; }
///
/// Gets the number of Internet Protocol (IP) packets received.
///
+ [UnsupportedOSPlatform("android")]
public abstract long ReceivedPackets { get; }
///
/// Gets the number of Internet Protocol(IP) packets received and delivered.
///
+ [UnsupportedOSPlatform("android")]
public abstract long ReceivedPacketsDelivered { get; }
///
/// Gets the number of Internet Protocol (IP) packets that have been received and discarded.
///
+ [UnsupportedOSPlatform("android")]
public abstract long ReceivedPacketsDiscarded { get; }
///
/// Gets the number of Internet Protocol (IP) packets forwarded.
///
+ [UnsupportedOSPlatform("android")]
public abstract long ReceivedPacketsForwarded { get; }
///
/// Gets the number of Internet Protocol (IP) packets with address errors that were received.
///
+ [UnsupportedOSPlatform("android")]
public abstract long ReceivedPacketsWithAddressErrors { get; }
///
/// Gets the number of Internet Protocol (IP) packets with header errors that were received.
///
+ [UnsupportedOSPlatform("android")]
public abstract long ReceivedPacketsWithHeadersErrors { get; }
///
/// Gets the number of Internet Protocol (IP) packets received on the local machine with an unknown protocol in the header.
///
+ [UnsupportedOSPlatform("android")]
public abstract long ReceivedPacketsWithUnknownProtocol { get; }
///
/// Gets the number of routes in the Internet Protocol (IP) routing table.
///
+ [UnsupportedOSPlatform("android")]
public abstract int NumberOfRoutes { get; }
}
}
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPInterfaceProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPInterfaceProperties.cs
index e659598f5e4f4c..863737ce18f6d3 100644
--- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPInterfaceProperties.cs
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPInterfaceProperties.cs
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System.Runtime.Versioning;
+
namespace System.Net.NetworkInformation
{
///
@@ -12,16 +14,19 @@ public abstract class IPInterfaceProperties
///
/// Gets a bool value that indicates whether this interface is configured to send name resolution queries to a Domain Name System (DNS) server.
///
+ [UnsupportedOSPlatform("android")]
public abstract bool IsDnsEnabled { get; }
///
/// Gets the Domain Name System (DNS) suffix associated with this interface.
///
+ [UnsupportedOSPlatform("android")]
public abstract string DnsSuffix { get; }
///
/// Gets a bool value that indicates whether this interface is configured to automatically register its IP address information with the Domain Name System (DNS).
///
+ [UnsupportedOSPlatform("android")]
public abstract bool IsDynamicDnsEnabled { get; }
///
@@ -37,26 +42,31 @@ public abstract class IPInterfaceProperties
///
/// The address identifies multiple computers. Packets sent to an anycast address are sent to one of the computers identified by the address.
///
+ [UnsupportedOSPlatform("android")]
public abstract IPAddressInformationCollection AnycastAddresses { get; }
///
/// The address is that of a Domain Name Service (DNS) server for the local computer.
///
+ [UnsupportedOSPlatform("android")]
public abstract IPAddressCollection DnsAddresses { get; }
///
/// Gets the network gateway addresses.
///
+ [UnsupportedOSPlatform("android")]
public abstract GatewayIPAddressInformationCollection GatewayAddresses { get; }
///
/// Gets the addresses for Dynamic Host Configuration Protocol (DHCP) servers.
///
+ [UnsupportedOSPlatform("android")]
public abstract IPAddressCollection DhcpServerAddresses { get; }
///
/// Gets the list of Wins Servers registered with this interface
///
+ [UnsupportedOSPlatform("android")]
public abstract IPAddressCollection WinsServersAddresses { get; }
///
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPv4InterfaceProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPv4InterfaceProperties.cs
index 0f104e3fce8fc3..9f9d0b1e3766dd 100644
--- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPv4InterfaceProperties.cs
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/IPv4InterfaceProperties.cs
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System.Runtime.Versioning;
+
namespace System.Net.NetworkInformation
{
///
@@ -11,21 +13,25 @@ public abstract class IPv4InterfaceProperties
///
/// Gets a bool value that indicates whether an interface uses Windows Internet Name Service (WINS).
///
+ [UnsupportedOSPlatform("android")]
public abstract bool UsesWins { get; }
///
/// Gets a bool value that indicates whether the interface is configured to use a dynamic host configuration protocol (DHCP) server to obtain an IP address.
///
+ [UnsupportedOSPlatform("android")]
public abstract bool IsDhcpEnabled { get; }
///
/// Gets a bool value that indicates whether this interface has an automatic private IP addressing (APIPA) address.
///
+ [UnsupportedOSPlatform("android")]
public abstract bool IsAutomaticPrivateAddressingActive { get; }
///
/// Gets a bool value that indicates whether this interface has automatic private IP addressing (APIPA) enabled.
///
+ [UnsupportedOSPlatform("android")]
public abstract bool IsAutomaticPrivateAddressingEnabled { get; }
///
@@ -36,6 +42,7 @@ public abstract class IPv4InterfaceProperties
///
/// Gets a bool value that indicates whether this interface can route packets.
///
+ [UnsupportedOSPlatform("android")]
public abstract bool IsForwardingEnabled { get; }
///
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.UnknownUnix.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.UnknownUnix.cs
index 5fe320ac241f40..84482c14f7b567 100644
--- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.UnknownUnix.cs
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkAddressChange.UnknownUnix.cs
@@ -9,15 +9,6 @@ namespace System.Net.NetworkInformation
{
public partial class NetworkChange
{
- static NetworkChange()
- {
- // fake usage of static readonly fields to avoid getting CA1823 warning when we are compiling this partial.
- var addressChangedSubscribers = new Dictionary(s_addressChangedSubscribers);
- var availabilityChangedSubscribers = new Dictionary(s_availabilityChangedSubscribers);
- NetworkAvailabilityEventArgs args = addressChangedSubscribers.Count > 0 ? s_availableEventArgs : s_notAvailableEventArgs;
- ContextCallback callbackContext = s_runAddressChangedHandler != null ? s_runHandlerAvailable : s_runHandlerNotAvailable;
- }
-
[UnsupportedOSPlatform("illumos")]
[UnsupportedOSPlatform("solaris")]
public static event NetworkAddressChangedEventHandler? NetworkAddressChanged
@@ -33,5 +24,8 @@ public static event NetworkAvailabilityChangedEventHandler? NetworkAvailabilityC
add { throw new PlatformNotSupportedException(); }
remove { throw new PlatformNotSupportedException(); }
}
+
+ [Obsolete("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)]
+ public static void RegisterNetworkChange(NetworkChange nc) { }
}
}
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkInterface.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkInterface.cs
index 94cb8fb0b9d81c..24f02186c3dc3a 100644
--- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkInterface.cs
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkInterface.cs
@@ -70,6 +70,7 @@ public virtual IPInterfaceProperties GetIPProperties()
/// Provides Internet Protocol (IP) statistical data for this network interface.
///
/// The interface's IP statistics.
+ [UnsupportedOSPlatform("android")]
public virtual IPInterfaceStatistics GetIPStatistics()
{
throw NotImplemented.ByDesignWithMessage(SR.net_MethodNotImplementedException);
@@ -81,6 +82,7 @@ public virtual IPInterfaceStatistics GetIPStatistics()
/// Do not use this method, use GetIPStatistics instead.
///
/// The interface's IP statistics.
+ [UnsupportedOSPlatform("android")]
public virtual IPv4InterfaceStatistics GetIPv4Statistics()
{
throw NotImplemented.ByDesignWithMessage(SR.net_MethodNotImplementedException);
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkInterfacePal.Android.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkInterfacePal.Android.cs
new file mode 100644
index 00000000000000..3b68b90e5a5fc2
--- /dev/null
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/NetworkInterfacePal.Android.cs
@@ -0,0 +1,110 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Runtime.InteropServices;
+
+namespace System.Net.NetworkInformation
+{
+ internal static class NetworkInterfacePal
+ {
+ /// Returns objects that describe the network interfaces on the local computer.
+ public static NetworkInterface[] GetAllNetworkInterfaces() => GetAndroidNetworkInterfaces();
+ public static bool GetIsNetworkAvailable() => TransformNetworkInterfacess(IsSomeNetworkUp);
+ public static int IPv6LoopbackInterfaceIndex => LoopbackInterfaceIndex;
+ public static int LoopbackInterfaceIndex => TransformNetworkInterfacess(FindLoopbackInterfaceIndex);
+
+ internal static unsafe AndroidNetworkInterface[] GetAndroidNetworkInterfaces()
+ => TransformNetworkInterfacess(ToAndroidNetworkInterfaceArray);
+
+ private static unsafe T TransformNetworkInterfacess(Func transform)
+ {
+ int interfaceCount = 0;
+ int addressCount = 0;
+ Interop.Sys.NetworkInterfaceInfo *networkInterfaceInfo = null;
+ Interop.Sys.IpAddressInfo *addressInfo = null;
+
+ if (Interop.Sys.GetNetworkInterfaces(&interfaceCount, &networkInterfaceInfo, &addressCount, &addressInfo) != 0)
+ {
+ string message = Interop.Sys.GetLastErrorInfo().GetErrorMessage();
+ throw new NetworkInformationException(message);
+ }
+
+ // the native implementation of Interop.Sys.GetNetworkInterfaces allocates one block of memory
+ // for both networkInterfaceInfo and addressInfo so we only need to call free once pointing at
+ // the start of the network itnerfaces list
+ var globalMemory = (IntPtr)networkInterfaceInfo;
+
+ try
+ {
+ return transform(interfaceCount, (IntPtr)networkInterfaceInfo, addressCount, (IntPtr)addressInfo);
+ }
+ finally
+ {
+ Marshal.FreeHGlobal(globalMemory);
+ }
+ }
+
+ private static unsafe AndroidNetworkInterface[] ToAndroidNetworkInterfaceArray(int interfaceCount, IntPtr networkInterfacesPtr, int addressCount, IntPtr addressPtr)
+ {
+ var networkInterfaces = new AndroidNetworkInterface[interfaceCount];
+
+ var networkInterfaceInfo = (Interop.Sys.NetworkInterfaceInfo*)networkInterfacesPtr;
+ for (int i = 0; i < interfaceCount; i++, networkInterfaceInfo++)
+ {
+ var name = Marshal.PtrToStringAnsi((IntPtr)networkInterfaceInfo->Name);
+ networkInterfaces[i] = new AndroidNetworkInterface(name!, networkInterfaceInfo);
+ }
+
+ var addressInfo = (Interop.Sys.IpAddressInfo*)addressPtr;
+ for (int i = 0; i < addressCount; i++, addressInfo++)
+ {
+ // there is usually just a handful of few network interfaces on Android devices
+ // and this linear search does not have any impact on performance
+ foreach (var networkInterface in networkInterfaces)
+ {
+ if (networkInterface.Index == addressInfo->InterfaceIndex)
+ {
+ networkInterface.AddAddress(addressInfo);
+ break;
+ }
+ }
+ }
+
+ return networkInterfaces;
+ }
+
+ private static unsafe int FindLoopbackInterfaceIndex(int interfaceCount, IntPtr networkInterfacesPtr, int addressCount, IntPtr addressPtr)
+ {
+ var networkInterfaceInfo = (Interop.Sys.NetworkInterfaceInfo*)networkInterfacesPtr;
+ for (int i = 0; i < interfaceCount; i++, networkInterfaceInfo++)
+ {
+ if (networkInterfaceInfo->HardwareType == (int)NetworkInterfaceType.Loopback)
+ {
+ return networkInterfaceInfo->InterfaceIndex;
+ }
+ }
+
+ throw new NetworkInformationException(SR.net_NoLoopback);
+ }
+
+ private static unsafe bool IsSomeNetworkUp(int interfaceCount, IntPtr networkInterfacesPtr, int addressCount, IntPtr addressPtr)
+ {
+ var networkInterfaceInfo = (Interop.Sys.NetworkInterfaceInfo*)networkInterfacesPtr;
+ for (int i = 0; i < interfaceCount; i++, networkInterfaceInfo++)
+ {
+ if (networkInterfaceInfo->HardwareType == (int)NetworkInterfaceType.Loopback
+ || networkInterfaceInfo->HardwareType == (int)NetworkInterfaceType.Tunnel)
+ {
+ continue;
+ }
+
+ if (networkInterfaceInfo->OperationalState == (int)OperationalStatus.Up)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ }
+}
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SystemIPGlobalProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SystemIPGlobalProperties.cs
index 7a65e6e7a16c81..ef5fb68547fc7f 100644
--- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SystemIPGlobalProperties.cs
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SystemIPGlobalProperties.cs
@@ -105,7 +105,7 @@ public override IPEndPoint[] GetActiveTcpListeners()
private unsafe List GetAllTcpConnections()
{
uint size = 0;
- uint result = 0;
+ uint result;
List tcpConnections = new List();
// Check if it supports IPv4 for IPv6 only modes.
@@ -214,7 +214,7 @@ private unsafe List GetAllTcpConnections()
public unsafe override IPEndPoint[] GetActiveUdpListeners()
{
uint size = 0;
- uint result = 0;
+ uint result;
List udpListeners = new List();
// Check if it support IPv4 for IPv6 only modes.
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnixIPGlobalProperties.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnixIPGlobalProperties.cs
index cca949a317a6f8..eafa42ff3fec12 100644
--- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnixIPGlobalProperties.cs
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnixIPGlobalProperties.cs
@@ -13,6 +13,7 @@ namespace System.Net.NetworkInformation
internal abstract class UnixIPGlobalProperties : IPGlobalProperties
{
[UnsupportedOSPlatform("linux")]
+ [UnsupportedOSPlatform("android")]
[UnsupportedOSPlatform("osx")]
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
@@ -26,6 +27,7 @@ internal abstract class UnixIPGlobalProperties : IPGlobalProperties
public override string HostName { get { return HostInformation.HostName; } }
[UnsupportedOSPlatform("linux")]
+ [UnsupportedOSPlatform("android")]
[UnsupportedOSPlatform("osx")]
[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("tvos")]
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnixNetworkInterface.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnixNetworkInterface.cs
index d248c72b6930cf..00c5b3a9a3028c 100644
--- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnixNetworkInterface.cs
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/UnixNetworkInterface.cs
@@ -60,7 +60,7 @@ public override bool Supports(NetworkInterfaceComponent networkInterfaceComponen
public List UnicastAddress { get { return _unicastAddresses; } }
///
- /// Returns a list of all Unicast addresses of the interface's IP Addresses.
+ /// Returns a list of all Multicast addresses of the interface's IP Addresses.
///
public List? MulticastAddresess { get { return _multicastAddresses; } }
diff --git a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPGlobalPropertiesTest.cs b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPGlobalPropertiesTest.cs
index f9438935ffabdf..70804e19499e2f 100644
--- a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPGlobalPropertiesTest.cs
+++ b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPGlobalPropertiesTest.cs
@@ -26,6 +26,7 @@ public IPGlobalPropertiesTest(ITestOutputHelper output)
}
[Fact]
+ [SkipOnPlatform(TestPlatforms.Android, "Expected behavior is different on Android")]
public void IPGlobalProperties_AccessAllMethods_NoErrors()
{
IPGlobalProperties gp = IPGlobalProperties.GetIPGlobalProperties();
@@ -49,8 +50,71 @@ public void IPGlobalProperties_AccessAllMethods_NoErrors()
Assert.NotNull(gp.GetUdpIPv6Statistics());
}
+ [Fact]
+ [PlatformSpecific(TestPlatforms.Android)]
+ public void IPGlobalProperties_AccessAllMethods_NoErrors_Android()
+ {
+ IPGlobalProperties gp = IPGlobalProperties.GetIPGlobalProperties();
+
+ Assert.NotNull(gp.GetIPv4GlobalStatistics());
+ Assert.NotNull(gp.GetIPv6GlobalStatistics());
+
+ Assert.Throws(() => gp.GetActiveTcpConnections());
+ Assert.Throws(() => gp.GetActiveTcpListeners());
+ Assert.Throws(() => gp.GetActiveUdpListeners());
+ Assert.Throws(() => gp.GetIcmpV4Statistics());
+ Assert.Throws(() => gp.GetIcmpV6Statistics());
+ Assert.Throws(() => gp.GetTcpIPv4Statistics());
+ Assert.Throws(() => gp.GetTcpIPv6Statistics());
+ Assert.Throws(() => gp.GetUdpIPv4Statistics());
+ Assert.Throws(() => gp.GetUdpIPv6Statistics());
+ }
+
+ [Theory]
+ [InlineData(4)]
+ [InlineData(6)]
+ [PlatformSpecific(TestPlatforms.Android)]
+ public void IPGlobalProperties_IPv4_IPv6_NoErrors_Android(int ipVersion)
+ {
+ IPGlobalProperties gp = IPGlobalProperties.GetIPGlobalProperties();
+ IPGlobalStatistics statistics = ipVersion switch {
+ 4 => gp.GetIPv4GlobalStatistics(),
+ 6 => gp.GetIPv6GlobalStatistics(),
+ _ => throw new ArgumentOutOfRangeException()
+ };
+
+ _log.WriteLine($"- IPv{ipVersion} statistics: -");
+ _log.WriteLine($"Number of interfaces: {statistics.NumberOfInterfaces}");
+ _log.WriteLine($"Number of IP addresses: {statistics.NumberOfIPAddresses}");
+
+ Assert.InRange(statistics.NumberOfInterfaces, 1, int.MaxValue);
+ Assert.InRange(statistics.NumberOfIPAddresses, 1, int.MaxValue);
+
+ Assert.Throws(() => statistics.DefaultTtl);
+ Assert.Throws(() => statistics.ForwardingEnabled);
+ Assert.Throws(() => statistics.OutputPacketRequests);
+ Assert.Throws(() => statistics.OutputPacketRoutingDiscards);
+ Assert.Throws(() => statistics.OutputPacketsDiscarded);
+ Assert.Throws(() => statistics.OutputPacketsWithNoRoute);
+ Assert.Throws(() => statistics.PacketFragmentFailures);
+ Assert.Throws(() => statistics.PacketReassembliesRequired);
+ Assert.Throws(() => statistics.PacketReassemblyFailures);
+ Assert.Throws(() => statistics.PacketReassemblyTimeout);
+ Assert.Throws(() => statistics.PacketsFragmented);
+ Assert.Throws(() => statistics.PacketsReassembled);
+ Assert.Throws(() => statistics.ReceivedPackets);
+ Assert.Throws(() => statistics.ReceivedPacketsDelivered);
+ Assert.Throws(() => statistics.ReceivedPacketsDiscarded);
+ Assert.Throws(() => statistics.ReceivedPacketsForwarded);
+ Assert.Throws(() => statistics.ReceivedPacketsWithAddressErrors);
+ Assert.Throws(() => statistics.ReceivedPacketsWithHeadersErrors);
+ Assert.Throws(() => statistics.ReceivedPacketsWithUnknownProtocol);
+ Assert.Throws(() => statistics.NumberOfRoutes);
+ }
+
[Theory]
[MemberData(nameof(Loopbacks))]
+ [SkipOnPlatform(TestPlatforms.Android, "Unsupported on Android")]
public void IPGlobalProperties_TcpListeners_Succeed(IPAddress address)
{
using (var server = new Socket(address.AddressFamily, SocketType.Stream, ProtocolType.Tcp))
@@ -76,7 +140,7 @@ public void IPGlobalProperties_TcpListeners_Succeed(IPAddress address)
[Theory]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34690", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
- [PlatformSpecific(~(TestPlatforms.iOS | TestPlatforms.tvOS))]
+ [PlatformSpecific(~(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.Android))]
[MemberData(nameof(Loopbacks))]
public async Task IPGlobalProperties_TcpActiveConnections_Succeed(IPAddress address)
{
@@ -107,6 +171,7 @@ public async Task IPGlobalProperties_TcpActiveConnections_Succeed(IPAddress addr
}
[Fact]
+ [SkipOnPlatform(TestPlatforms.Android, "Unsupported on Android")]
public void IPGlobalProperties_TcpActiveConnections_NotListening()
{
TcpConnectionInformation[] tcpCconnections = IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpConnections();
@@ -117,7 +182,6 @@ public void IPGlobalProperties_TcpActiveConnections_NotListening()
}
[Fact]
- [ActiveIssue("https://github.com/dotnet/runtime/issues/50567", TestPlatforms.Android)]
public async Task GetUnicastAddresses_NotEmpty()
{
IPGlobalProperties props = IPGlobalProperties.GetIPGlobalProperties();
diff --git a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPInterfacePropertiesTest_Android.cs b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPInterfacePropertiesTest_Android.cs
new file mode 100644
index 00000000000000..61e57c854aa479
--- /dev/null
+++ b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPInterfacePropertiesTest_Android.cs
@@ -0,0 +1,221 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Linq;
+using System.Net.Http.Functional.Tests;
+using System.Net.Sockets;
+using System.Net.Test.Common;
+using System.Threading.Tasks;
+
+using Xunit;
+using Xunit.Abstractions;
+
+namespace System.Net.NetworkInformation.Tests
+{
+ [PlatformSpecific(TestPlatforms.Android)]
+ public class IPInterfacePropertiesTest_Android
+ {
+ private readonly ITestOutputHelper _log;
+
+ public IPInterfacePropertiesTest_Android(ITestOutputHelper output)
+ {
+ _log = output;
+ }
+
+ [Fact]
+ public async Task IPInfoTest_AccessAllProperties_NoErrors()
+ {
+ await Task.Run(() =>
+ {
+ foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
+ {
+ _log.WriteLine("Nic: " + nic.Name);
+ _log.WriteLine("- Speed:" + nic.Speed);
+ Assert.Equal(-1, nic.Speed);
+ _log.WriteLine("- Supports IPv4: " + nic.Supports(NetworkInterfaceComponent.IPv4));
+ _log.WriteLine("- Supports IPv6: " + nic.Supports(NetworkInterfaceComponent.IPv6));
+ Assert.False(nic.IsReceiveOnly);
+
+ IPInterfaceProperties ipProperties = nic.GetIPProperties();
+
+ Assert.NotNull(ipProperties);
+
+ Assert.Throws(() => ipProperties.AnycastAddresses);
+ Assert.Throws(() => ipProperties.DhcpServerAddresses);
+ Assert.Throws(() => ipProperties.DnsAddresses);
+ Assert.Throws(() => ipProperties.DnsSuffix);
+ Assert.Throws(() => ipProperties.GatewayAddresses);
+ Assert.Throws(() => ipProperties.IsDnsEnabled);
+ Assert.Throws(() => ipProperties.IsDynamicDnsEnabled);
+
+ Assert.NotNull(ipProperties.MulticastAddresses);
+ _log.WriteLine("- Multicast Addresses: " + ipProperties.MulticastAddresses.Count);
+ foreach (IPAddressInformation multi in ipProperties.MulticastAddresses)
+ {
+ _log.WriteLine("-- " + multi.Address.ToString());
+ Assert.Throws(() => multi.IsDnsEligible);
+ Assert.Throws(() => multi.IsTransient);
+ }
+
+ Assert.NotNull(ipProperties.UnicastAddresses);
+ _log.WriteLine("- Unicast Addresses: " + ipProperties.UnicastAddresses.Count);
+ foreach (UnicastIPAddressInformation uni in ipProperties.UnicastAddresses)
+ {
+ _log.WriteLine("-- " + uni.Address.ToString());
+ Assert.Throws(() => uni.AddressPreferredLifetime);
+ Assert.Throws(() => uni.AddressValidLifetime);
+ Assert.Throws(() => uni.DhcpLeaseLifetime);
+ Assert.Throws(() => uni.DuplicateAddressDetectionState);
+
+ Assert.NotNull(uni.IPv4Mask);
+ _log.WriteLine("--- IPv4 Mask: " + uni.IPv4Mask);
+ Assert.Throws(() => uni.IsDnsEligible);
+ Assert.Throws(() => uni.IsTransient);
+ Assert.Throws(() => uni.PrefixOrigin);
+ Assert.Throws(() => uni.SuffixOrigin);
+
+ // Prefix Length
+ _log.WriteLine("--- PrefixLength: " + uni.PrefixLength);
+ Assert.True(uni.PrefixLength > 0);
+ Assert.True((uni.Address.AddressFamily == AddressFamily.InterNetwork ? 33 : 129) > uni.PrefixLength);
+ }
+
+ Assert.Throws(() => ipProperties.WinsServersAddresses);
+ }
+ }).WaitAsync(TestHelper.PassingTestTimeout);
+ }
+
+ [Fact]
+ public async Task IPInfoTest_AccessAllIPv4Properties_NoErrors()
+ {
+ await Task.Run(() =>
+ {
+ foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
+ {
+ _log.WriteLine("Nic: " + nic.Name);
+
+ IPInterfaceProperties ipProperties = nic.GetIPProperties();
+
+ _log.WriteLine("IPv4 Properties:");
+
+ IPv4InterfaceProperties ipv4Properties = ipProperties.GetIPv4Properties();
+
+ _log.WriteLine("Index: " + ipv4Properties.Index);
+ Assert.Throws(() => ipv4Properties.IsAutomaticPrivateAddressingActive);
+ Assert.Throws(() => ipv4Properties.IsAutomaticPrivateAddressingEnabled);
+ Assert.Throws(() => ipv4Properties.IsDhcpEnabled);
+ Assert.Throws(() => ipv4Properties.IsForwardingEnabled);
+ _log.WriteLine("Mtu: " + ipv4Properties.Mtu);
+ Assert.Throws(() => ipv4Properties.UsesWins);
+ }
+ }).WaitAsync(TestHelper.PassingTestTimeout);
+ }
+
+ [Fact]
+ public async Task IPInfoTest_AccessAllIPv6Properties_NoErrors()
+ {
+ await Task.Run(() =>
+ {
+ foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
+ {
+ _log.WriteLine("Nic: " + nic.Name);
+
+ IPInterfaceProperties ipProperties = nic.GetIPProperties();
+
+ _log.WriteLine("IPv6 Properties:");
+
+ IPv6InterfaceProperties ipv6Properties = ipProperties.GetIPv6Properties();
+
+ if (ipv6Properties == null)
+ {
+ _log.WriteLine("IPv6Properties is null");
+ continue;
+ }
+
+ _log.WriteLine("Index: " + ipv6Properties.Index);
+ _log.WriteLine("Mtu: " + ipv6Properties.Mtu);
+ _log.WriteLine("Scope: " + ipv6Properties.GetScopeId(ScopeLevel.Link));
+ }
+ }).WaitAsync(TestHelper.PassingTestTimeout);
+ }
+
+ [Fact]
+ [Trait("IPv6", "true")]
+ public async Task IPv6ScopeId_AccessAllValues_Success()
+ {
+ await Task.Run(() =>
+ {
+ Assert.True(Capability.IPv6Support());
+
+ foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
+ {
+ _log.WriteLine("Nic: " + nic.Name);
+
+ if (!nic.Supports(NetworkInterfaceComponent.IPv6))
+ {
+ continue;
+ }
+
+ IPInterfaceProperties ipProperties = nic.GetIPProperties();
+
+ IPv6InterfaceProperties ipv6Properties = ipProperties.GetIPv6Properties();
+
+ Array values = Enum.GetValues(typeof(ScopeLevel));
+ foreach (ScopeLevel level in values)
+ {
+ _log.WriteLine("-- Level: " + level + "; " + ipv6Properties.GetScopeId(level));
+ }
+ }
+ }).WaitAsync(TestHelper.PassingTestTimeout);
+ }
+
+ [Fact]
+ [Trait("IPv4", "true")]
+ public async Task IPInfoTest_IPv4Loopback_ProperAddress()
+ {
+ await Task.Run(() =>
+ {
+ Assert.True(Capability.IPv4Support());
+
+ _log.WriteLine("Loopback IPv4 index: " + NetworkInterface.LoopbackInterfaceIndex);
+
+ NetworkInterface loopback = NetworkInterface.GetAllNetworkInterfaces().First(ni => ni.Name == "lo");
+ Assert.NotNull(loopback);
+
+ foreach (UnicastIPAddressInformation unicast in loopback.GetIPProperties().UnicastAddresses)
+ {
+ if (unicast.Address.Equals(IPAddress.Loopback))
+ {
+ Assert.Equal(IPAddress.Parse("255.0.0.0"), unicast.IPv4Mask);
+ Assert.Equal(8, unicast.PrefixLength);
+ break;
+ }
+ }
+ }).WaitAsync(TestHelper.PassingTestTimeout);
+ }
+
+ [Fact]
+ [Trait("IPv6", "true")]
+ public async Task IPInfoTest_IPv6Loopback_ProperAddress()
+ {
+ await Task.Run(() =>
+ {
+ Assert.True(Capability.IPv6Support());
+
+ _log.WriteLine("Loopback IPv6 index: " + NetworkInterface.IPv6LoopbackInterfaceIndex);
+
+ NetworkInterface loopback = NetworkInterface.GetAllNetworkInterfaces().First(ni => ni.Name == "lo");
+ Assert.NotNull(loopback);
+
+ foreach (UnicastIPAddressInformation unicast in loopback.GetIPProperties().UnicastAddresses)
+ {
+ if (unicast.Address.Equals(IPAddress.IPv6Loopback))
+ {
+ Assert.Equal(128, unicast.PrefixLength);
+ break;
+ }
+ }
+ }).WaitAsync(TestHelper.PassingTestTimeout);
+ }
+ }
+}
diff --git a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs
index 561cb687f3e75b..c022f74b2c234c 100644
--- a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs
+++ b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs
@@ -20,7 +20,6 @@ public NetworkInterfaceBasicTest(ITestOutputHelper output)
}
[Fact]
- [ActiveIssue("https://github.com/dotnet/runtime/issues/50567", TestPlatforms.Android)]
public void BasicTest_GetNetworkInterfaces_AtLeastOne()
{
Assert.NotEqual(0, NetworkInterface.GetAllNetworkInterfaces().Length);
@@ -57,7 +56,7 @@ public void BasicTest_AccessInstanceProperties_NoExceptions()
}
[Fact]
- [PlatformSpecific(TestPlatforms.Linux)] // Some APIs are not supported on Linux
+ [PlatformSpecific(TestPlatforms.Linux|TestPlatforms.Android)] // Some APIs are not supported on Linux and Android
public void BasicTest_AccessInstanceProperties_NoExceptions_Linux()
{
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
@@ -132,7 +131,6 @@ public void BasicTest_AccessInstanceProperties_NoExceptions_Bsd()
[Fact]
[Trait("IPv4", "true")]
- [ActiveIssue("https://github.com/dotnet/runtime/issues/50567", TestPlatforms.Android)]
public void BasicTest_StaticLoopbackIndex_MatchesLoopbackNetworkInterface()
{
Assert.True(Capability.IPv4Support());
@@ -156,7 +154,6 @@ public void BasicTest_StaticLoopbackIndex_MatchesLoopbackNetworkInterface()
[Fact]
[Trait("IPv4", "true")]
- [ActiveIssue("https://github.com/dotnet/runtime/issues/50567", TestPlatforms.Android)]
public void BasicTest_StaticLoopbackIndex_ExceptionIfV4NotSupported()
{
Assert.True(Capability.IPv4Support());
@@ -166,7 +163,6 @@ public void BasicTest_StaticLoopbackIndex_ExceptionIfV4NotSupported()
[Fact]
[Trait("IPv6", "true")]
- [ActiveIssue("https://github.com/dotnet/runtime/issues/50567", TestPlatforms.Android)]
public void BasicTest_StaticIPv6LoopbackIndex_MatchesLoopbackNetworkInterface()
{
Assert.True(Capability.IPv6Support());
@@ -191,7 +187,6 @@ public void BasicTest_StaticIPv6LoopbackIndex_MatchesLoopbackNetworkInterface()
[Fact]
[Trait("IPv6", "true")]
- [ActiveIssue("https://github.com/dotnet/runtime/issues/50567", TestPlatforms.Android)]
public void BasicTest_StaticIPv6LoopbackIndex_ExceptionIfV6NotSupported()
{
Assert.True(Capability.IPv6Support());
@@ -272,7 +267,6 @@ public void BasicTest_GetIPInterfaceStatistics_Success_Bsd()
[Fact]
- [ActiveIssue("https://github.com/dotnet/runtime/issues/50567", TestPlatforms.Android)]
public void BasicTest_GetIsNetworkAvailable_Success()
{
Assert.True(NetworkInterface.GetIsNetworkAvailable());
@@ -284,7 +278,6 @@ public void BasicTest_GetIsNetworkAvailable_Success()
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "Not supported on Browser, iOS, MacCatalyst, or tvOS.")]
[InlineData(false)]
[InlineData(true)]
- [ActiveIssue("https://github.com/dotnet/runtime/issues/50567", TestPlatforms.Android)]
public async Task NetworkInterface_LoopbackInterfaceIndex_MatchesReceivedPackets(bool ipv6)
{
using (var client = new Socket(SocketType.Dgram, ProtocolType.Udp))
diff --git a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceIPv4Statistics.cs b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceIPv4Statistics.cs
index 52aceb0d3f9c14..9b73374e99b267 100644
--- a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceIPv4Statistics.cs
+++ b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceIPv4Statistics.cs
@@ -69,6 +69,17 @@ public void BasicTest_GetIPv4InterfaceStatistics_Success_Linux()
}
}
+ [Fact]
+ [PlatformSpecific(TestPlatforms.Android)] // This API is not supported on Android
+ public void BasicTest_GetIPv4InterfaceStatistics_NotSupported_Android()
+ {
+ // This API is not actually IPv4 specific.
+ foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
+ {
+ Assert.Throws(() => nic.GetIPv4Statistics());
+ }
+ }
+
[Fact]
[PlatformSpecific(TestPlatforms.OSX)] // Some APIs are not supported on OSX
public void BasicTest_GetIPv4InterfaceStatistics_Success_OSX()
diff --git a/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/IcmpV4MessageConstants.cs b/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/IcmpV4MessageConstants.cs
index 6fcf1794a11c2a..4794b9b720f39f 100644
--- a/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/IcmpV4MessageConstants.cs
+++ b/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/IcmpV4MessageConstants.cs
@@ -53,38 +53,22 @@ internal static class IcmpV4MessageConstants
{
public static IPStatus MapV4TypeToIPStatus(int type, int code)
{
- switch ((IcmpV4MessageType)type)
+ return (IcmpV4MessageType)type switch
{
- case IcmpV4MessageType.EchoReply:
- return IPStatus.Success;
-
- case IcmpV4MessageType.DestinationUnreachable:
- switch ((IcmpV4DestinationUnreachableCode)code)
- {
- case IcmpV4DestinationUnreachableCode.DestinationNetworkUnreachable:
- return IPStatus.DestinationNetworkUnreachable;
- case IcmpV4DestinationUnreachableCode.DestinationHostUnreachable:
- return IPStatus.DestinationHostUnreachable;
- case IcmpV4DestinationUnreachableCode.DestinationProtocolUnreachable:
- return IPStatus.DestinationProtocolUnreachable;
- case IcmpV4DestinationUnreachableCode.DestinationPortUnreachable:
- return IPStatus.DestinationPortUnreachable;
- default:
- return IPStatus.DestinationUnreachable;
- }
-
- case IcmpV4MessageType.SourceQuench:
- return IPStatus.SourceQuench;
-
- case IcmpV4MessageType.TimeExceeded:
- return IPStatus.TimeExceeded;
-
- case IcmpV4MessageType.ParameterProblemBadIPHeader:
- return IPStatus.BadHeader;
-
- default:
- return IPStatus.Unknown;
- }
+ IcmpV4MessageType.EchoReply => IPStatus.Success,
+ IcmpV4MessageType.DestinationUnreachable => (IcmpV4DestinationUnreachableCode)code switch
+ {
+ IcmpV4DestinationUnreachableCode.DestinationNetworkUnreachable => IPStatus.DestinationNetworkUnreachable,
+ IcmpV4DestinationUnreachableCode.DestinationHostUnreachable => IPStatus.DestinationHostUnreachable,
+ IcmpV4DestinationUnreachableCode.DestinationProtocolUnreachable => IPStatus.DestinationProtocolUnreachable,
+ IcmpV4DestinationUnreachableCode.DestinationPortUnreachable => IPStatus.DestinationPortUnreachable,
+ _ => IPStatus.DestinationUnreachable,
+ },
+ IcmpV4MessageType.SourceQuench => IPStatus.SourceQuench,
+ IcmpV4MessageType.TimeExceeded => IPStatus.TtlExpired,
+ IcmpV4MessageType.ParameterProblemBadIPHeader => IPStatus.BadHeader,
+ _ => IPStatus.Unknown,
+ };
}
}
}
diff --git a/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/IcmpV6MessageConstants.cs b/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/IcmpV6MessageConstants.cs
index d0a098cf342d6f..e00a236a282bc9 100644
--- a/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/IcmpV6MessageConstants.cs
+++ b/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/IcmpV6MessageConstants.cs
@@ -54,52 +54,30 @@ internal static class IcmpV6MessageConstants
{
public static IPStatus MapV6TypeToIPStatus(byte type, byte code)
{
- switch ((IcmpV6MessageType)type)
+ return (IcmpV6MessageType)type switch
{
- case IcmpV6MessageType.EchoReply:
- return IPStatus.Success;
-
- case IcmpV6MessageType.DestinationUnreachable:
- switch ((IcmpV6DestinationUnreachableCode)code)
- {
- case IcmpV6DestinationUnreachableCode.NoRouteToDestination:
- return IPStatus.BadRoute;
- case IcmpV6DestinationUnreachableCode.SourceRoutingHeaderError:
- return IPStatus.BadHeader;
- default:
- return IPStatus.DestinationUnreachable;
- }
-
- case IcmpV6MessageType.PacketTooBig:
- return IPStatus.PacketTooBig;
-
- case IcmpV6MessageType.TimeExceeded:
- switch ((IcmpV6TimeExceededCode)code)
- {
- case IcmpV6TimeExceededCode.HopLimitExceeded:
- return IPStatus.TimeExceeded;
- case IcmpV6TimeExceededCode.FragmentReassemblyTimeExceeded:
- return IPStatus.TtlReassemblyTimeExceeded;
- default:
- return IPStatus.TimeExceeded;
- }
-
- case IcmpV6MessageType.ParameterProblem:
- switch ((IcmpV6ParameterProblemCode)code)
- {
- case IcmpV6ParameterProblemCode.ErroneousHeaderField:
- return IPStatus.BadHeader;
- case IcmpV6ParameterProblemCode.UnrecognizedNextHeader:
- return IPStatus.UnrecognizedNextHeader;
- case IcmpV6ParameterProblemCode.UnrecognizedIpv6Option:
- return IPStatus.BadOption;
- default:
- return IPStatus.ParameterProblem;
- }
-
- default:
- return IPStatus.Unknown;
- }
+ IcmpV6MessageType.EchoReply => IPStatus.Success,
+ IcmpV6MessageType.DestinationUnreachable => (IcmpV6DestinationUnreachableCode)code switch
+ {
+ IcmpV6DestinationUnreachableCode.NoRouteToDestination => IPStatus.BadRoute,
+ IcmpV6DestinationUnreachableCode.SourceRoutingHeaderError => IPStatus.BadHeader,
+ _ => IPStatus.DestinationUnreachable,
+ },
+ IcmpV6MessageType.PacketTooBig => IPStatus.PacketTooBig,
+ IcmpV6MessageType.TimeExceeded => (IcmpV6TimeExceededCode)code switch
+ {
+ IcmpV6TimeExceededCode.FragmentReassemblyTimeExceeded => IPStatus.TtlReassemblyTimeExceeded,
+ _ => IPStatus.TtlExpired,
+ },
+ IcmpV6MessageType.ParameterProblem => (IcmpV6ParameterProblemCode)code switch
+ {
+ IcmpV6ParameterProblemCode.ErroneousHeaderField => IPStatus.BadHeader,
+ IcmpV6ParameterProblemCode.UnrecognizedNextHeader => IPStatus.UnrecognizedNextHeader,
+ IcmpV6ParameterProblemCode.UnrecognizedIpv6Option => IPStatus.BadOption,
+ _ => IPStatus.ParameterProblem,
+ },
+ _ => IPStatus.Unknown,
+ };
}
}
}
diff --git a/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.RawSocket.cs b/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.RawSocket.cs
index fa5712656fafef..0d81532f2bc144 100644
--- a/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.RawSocket.cs
+++ b/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.RawSocket.cs
@@ -128,7 +128,7 @@ private bool TryGetPingReply(
// Skip IP header.
IcmpHeader receivedHeader = MemoryMarshal.Read(receiveBuffer.AsSpan(icmpHeaderOffset));
- ushort identifier = 0;
+ ushort identifier;
type = receivedHeader.Type;
code = receivedHeader.Code;
diff --git a/src/libraries/System.Net.Primitives/src/System/Net/CookieContainer.cs b/src/libraries/System.Net.Primitives/src/System/Net/CookieContainer.cs
index 4467d7d654f37a..68229958f88a72 100644
--- a/src/libraries/System.Net.Primitives/src/System/Net/CookieContainer.cs
+++ b/src/libraries/System.Net.Primitives/src/System/Net/CookieContainer.cs
@@ -376,11 +376,11 @@ private bool AgeCookies(string? domain)
DateTime tempUsed;
CookieCollection? lruCc = null;
- string? lruDomain = null;
+ string? lruDomain;
string tempDomain;
PathList pathList;
- int domain_count = 0;
+ int domain_count;
int itemp = 0;
float remainingFraction = 1.0F;
@@ -1021,8 +1021,7 @@ public string GetCookieHeader(Uri uri)
throw new ArgumentNullException(nameof(uri));
}
- string dummy;
- return GetCookieHeader(uri, out dummy);
+ return GetCookieHeader(uri, out _);
}
internal string GetCookieHeader(Uri uri, out string optCookie2)
diff --git a/src/libraries/System.Net.Primitives/src/System/Net/CredentialCache.cs b/src/libraries/System.Net.Primitives/src/System/Net/CredentialCache.cs
index bb7801cbebb82b..f0e19c005ab7fb 100644
--- a/src/libraries/System.Net.Primitives/src/System/Net/CredentialCache.cs
+++ b/src/libraries/System.Net.Primitives/src/System/Net/CredentialCache.cs
@@ -225,7 +225,7 @@ public void Remove(string? host, int port, string? authenticationType)
var key = new CredentialHostKey(host, port, authenticationType);
- NetworkCredential? match = null;
+ NetworkCredential? match;
_cacheForHosts.TryGetValue(key, out match);
if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(this, $"Returning {((match == null) ? "null" : "(" + match.UserName + ":" + match.Domain + ")")}");
diff --git a/src/libraries/System.Net.Primitives/tests/FunctionalTests/SocketAddressTest.cs b/src/libraries/System.Net.Primitives/tests/FunctionalTests/SocketAddressTest.cs
index 09938a1c15d619..70ef816d1d0af5 100644
--- a/src/libraries/System.Net.Primitives/tests/FunctionalTests/SocketAddressTest.cs
+++ b/src/libraries/System.Net.Primitives/tests/FunctionalTests/SocketAddressTest.cs
@@ -98,7 +98,7 @@ public static void ToString_LegacyUnknownFamily_Success(AddressFamily family)
[Theory]
[InlineData(AddressFamily.Packet)]
[InlineData(AddressFamily.ControllerAreaNetwork)]
- [SkipOnPlatform(TestPlatforms.Android | TestPlatforms.Linux | TestPlatforms.Browser, "Expected behavior is different on Android, Linux, or Browser")]
+ [SkipOnPlatform(TestPlatforms.Android | TestPlatforms.Linux | TestPlatforms.Browser, "Expected behavior is different on Android, Linux, or Browser")]
public static void ToString_UnsupportedFamily_Throws(AddressFamily family)
{
Assert.Throws(() => new SocketAddress(family));
diff --git a/src/libraries/System.Net.Quic/ref/System.Net.Quic.cs b/src/libraries/System.Net.Quic/ref/System.Net.Quic.cs
index be0b43d4200f37..0d4e4997cc4894 100644
--- a/src/libraries/System.Net.Quic/ref/System.Net.Quic.cs
+++ b/src/libraries/System.Net.Quic/ref/System.Net.Quic.cs
@@ -102,6 +102,7 @@ public override void Flush() { }
public override System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public override int Read(byte[] buffer, int offset, int count) { throw null; }
public override int Read(System.Span buffer) { throw null; }
+ public override int ReadByte() { throw null; }
public override System.Threading.Tasks.Task ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask ReadAsync(System.Memory buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override int ReadTimeout { get { throw null; } set { } }
@@ -112,6 +113,7 @@ public void Shutdown() { }
public System.Threading.Tasks.ValueTask WaitForWriteCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override void Write(byte[] buffer, int offset, int count) { }
public override void Write(System.ReadOnlySpan buffer) { }
+ public override void WriteByte(byte value) { }
public System.Threading.Tasks.ValueTask WriteAsync(System.Buffers.ReadOnlySequence buffers, bool endStream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public System.Threading.Tasks.ValueTask WriteAsync(System.Buffers.ReadOnlySequence buffers, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Interop/SafeMsQuicConfigurationHandle.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Interop/SafeMsQuicConfigurationHandle.cs
index 24200021ec0546..d536dfa58dbdcc 100644
--- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Interop/SafeMsQuicConfigurationHandle.cs
+++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/Interop/SafeMsQuicConfigurationHandle.cs
@@ -156,9 +156,13 @@ private static unsafe SafeMsQuicConfigurationHandle Create(QuicOptions options,
ulong ms = (ulong)options.IdleTimeout.Ticks / TimeSpan.TicksPerMillisecond;
if (ms > (1ul << 62) - 1) throw new Exception("IdleTimeout is too large (max 2^62-1 milliseconds)");
- settings.IsSetFlags |= QuicSettingsIsSetFlags.IdleTimeoutMs;
settings.IdleTimeoutMs = (ulong)options.IdleTimeout.TotalMilliseconds;
}
+ else
+ {
+ settings.IdleTimeoutMs = 0;
+ }
+ settings.IsSetFlags |= QuicSettingsIsSetFlags.IdleTimeoutMs;
uint status;
SafeMsQuicConfigurationHandle? configurationHandle;
diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs
index 54f0ed3f4ec85b..d2130779a7b87b 100644
--- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs
+++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs
@@ -533,7 +533,7 @@ private static unsafe int CopyMsQuicBuffersToUserBuffer(ReadOnlySpan
int originalDestinationLength = destinationBuffer.Length;
QuicBuffer nativeBuffer;
- int takeLength = 0;
+ int takeLength;
int i = 0;
do
diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicStream.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicStream.cs
index 912d32c9ad889c..98fdd51fb36330 100644
--- a/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicStream.cs
+++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicStream.cs
@@ -4,6 +4,7 @@
using System.Buffers;
using System.IO;
using System.Net.Quic.Implementations;
+using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
@@ -46,6 +47,12 @@ public override int Read(byte[] buffer, int offset, int count)
return Read(buffer.AsSpan(offset, count));
}
+ public override int ReadByte()
+ {
+ byte b = 0;
+ return Read(MemoryMarshal.CreateSpan(ref b, 1)) != 0 ? b : -1;
+ }
+
public override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
ValidateBufferArguments(buffer, offset, count);
@@ -58,6 +65,11 @@ public override void Write(byte[] buffer, int offset, int count)
Write(buffer.AsSpan(offset, count));
}
+ public override void WriteByte(byte value)
+ {
+ Write(MemoryMarshal.CreateReadOnlySpan(ref value, 1));
+ }
+
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
ValidateBufferArguments(buffer, offset, count);
diff --git a/src/libraries/System.Net.Requests/src/System/Net/FtpControlStream.cs b/src/libraries/System.Net.Requests/src/System/Net/FtpControlStream.cs
index 51d8a0d657931f..eb608a0456794b 100644
--- a/src/libraries/System.Net.Requests/src/System/Net/FtpControlStream.cs
+++ b/src/libraries/System.Net.Requests/src/System/Net/FtpControlStream.cs
@@ -1184,7 +1184,7 @@ protected override bool CheckValid(ResponseDescription response, ref int validTh
// If the line contained three other digits followed by the response, then this is a violation of the
// FTP protocol for multiline responses.
// All other cases indicate that the response is not yet complete.
- int index = 0;
+ int index;
while ((index = responseString.IndexOf("\r\n", validThrough, StringComparison.Ordinal)) != -1) // gets the end line.
{
int lineStart = validThrough;
diff --git a/src/libraries/System.Net.Requests/src/System/Net/FtpWebRequest.cs b/src/libraries/System.Net.Requests/src/System/Net/FtpWebRequest.cs
index 74dde855abe7e8..b0f8f6a7fb6c3a 100644
--- a/src/libraries/System.Net.Requests/src/System/Net/FtpWebRequest.cs
+++ b/src/libraries/System.Net.Requests/src/System/Net/FtpWebRequest.cs
@@ -812,7 +812,7 @@ public override IAsyncResult BeginGetRequestStream(AsyncCallback? callback, obje
public override Stream EndGetRequestStream(IAsyncResult asyncResult)
{
- Stream? requestStream = null;
+ Stream? requestStream;
try
{
if (asyncResult == null)
diff --git a/src/libraries/System.Net.Requests/src/System/Net/FtpWebResponse.cs b/src/libraries/System.Net.Requests/src/System/Net/FtpWebResponse.cs
index fd0f63ba3baf59..0c1b2de92ad38b 100644
--- a/src/libraries/System.Net.Requests/src/System/Net/FtpWebResponse.cs
+++ b/src/libraries/System.Net.Requests/src/System/Net/FtpWebResponse.cs
@@ -47,7 +47,7 @@ internal void UpdateStatus(FtpStatusCode statusCode, string? statusLine, string?
public override Stream GetResponseStream()
{
- Stream? responseStream = null;
+ Stream? responseStream;
if (_responseStream != null)
{
diff --git a/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.OSX.cs b/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.OSX.cs
index f1fef45e081264..6e9455954c29a2 100644
--- a/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.OSX.cs
+++ b/src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.OSX.cs
@@ -128,6 +128,11 @@ internal static string[] GetRequestCertificateAuthorities(SafeDeleteContext secu
using (SafeCFArrayHandle dnArray = Interop.AppleCrypto.SslCopyCADistinguishedNames(sslContext))
{
+ if (dnArray.IsInvalid)
+ {
+ return Array.Empty();
+ }
+
long size = Interop.CoreFoundation.CFArrayGetCount(dnArray);
if (size == 0)
diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/CipherSuitesPolicyPal.Linux.cs b/src/libraries/System.Net.Security/src/System/Net/Security/CipherSuitesPolicyPal.Linux.cs
index 0ddef7980c836f..d59c76ce47228a 100644
--- a/src/libraries/System.Net.Security/src/System/Net/Security/CipherSuitesPolicyPal.Linux.cs
+++ b/src/libraries/System.Net.Security/src/System/Net/Security/CipherSuitesPolicyPal.Linux.cs
@@ -28,7 +28,7 @@ internal sealed class CipherSuitesPolicyPal
internal CipherSuitesPolicyPal(IEnumerable allowedCipherSuites)
{
- if (!Interop.Ssl.Tls13Supported)
+ if (!Interop.Ssl.Capabilities.Tls13Supported)
{
throw new PlatformNotSupportedException(SR.net_ssl_ciphersuites_policy_not_supported);
}
diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStreamPal.Windows.cs b/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStreamPal.Windows.cs
index a2ea5bf41ea557..10ba2f5c772a71 100644
--- a/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStreamPal.Windows.cs
+++ b/src/libraries/System.Net.Security/src/System/Net/Security/NegotiateStreamPal.Windows.cs
@@ -20,7 +20,7 @@ internal static partial class NegotiateStreamPal
{
internal static IIdentity GetIdentity(NTAuthentication context)
{
- IIdentity? result = null;
+ IIdentity? result;
string name = context.IsServer ? context.AssociatedName! : context.Spn!;
string protocol = context.ProtocolName;
diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/Pal.OSX/SafeDeleteSslContext.cs b/src/libraries/System.Net.Security/src/System/Net/Security/Pal.OSX/SafeDeleteSslContext.cs
index b75ee2bee74753..3690837e33f679 100644
--- a/src/libraries/System.Net.Security/src/System/Net/Security/Pal.OSX/SafeDeleteSslContext.cs
+++ b/src/libraries/System.Net.Security/src/System/Net/Security/Pal.OSX/SafeDeleteSslContext.cs
@@ -316,7 +316,7 @@ private static void SetProtocols(SafeSslHandle sslContext, SslProtocols protocol
Interop.AppleCrypto.SslSetMaxProtocolVersion(sslContext, maxProtocolId);
}
- private static void SetCertificate(SafeSslHandle sslContext, SslStreamCertificateContext context)
+ internal static void SetCertificate(SafeSslHandle sslContext, SslStreamCertificateContext context)
{
Debug.Assert(sslContext != null, "sslContext != null");
diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Implementation.cs b/src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Implementation.cs
index 1cc4fecd5ef50c..9e6ad7475d7663 100644
--- a/src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Implementation.cs
+++ b/src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Implementation.cs
@@ -1361,7 +1361,7 @@ private Framing DetectFraming(ReadOnlySpan bytes)
// Returns TLS Frame size.
private int GetFrameSize(ReadOnlySpan buffer)
{
- int payloadSize = -1;
+ int payloadSize;
switch (_framing)
{
case Framing.Unified:
diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.OSX.cs b/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.OSX.cs
index 0414082781c1e8..7043b7afe19f4d 100644
--- a/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.OSX.cs
+++ b/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.OSX.cs
@@ -246,6 +246,13 @@ private static SecurityStatusPal HandshakeInternal(
Interop.AppleCrypto.SslSetTargetName(sslContext.SslContext, sslAuthenticationOptions.TargetHost);
}
+ if (sslAuthenticationOptions.CertificateContext == null && sslAuthenticationOptions.CertSelectionDelegate != null)
+ {
+ // certificate was not provided but there is user callback. We can break handshake if server asks for certificate
+ // and we can try to get it based on remote certificate and trusted issuers.
+ Interop.AppleCrypto.SslBreakOnCertRequested(sslContext.SslContext, true);
+ }
+
if (sslAuthenticationOptions.IsServer && sslAuthenticationOptions.RemoteCertRequired)
{
Interop.AppleCrypto.SslSetAcceptClientCert(sslContext.SslContext);
@@ -259,6 +266,35 @@ private static SecurityStatusPal HandshakeInternal(
SafeSslHandle sslHandle = sslContext!.SslContext;
SecurityStatusPal status = PerformHandshake(sslHandle);
+ if (status.ErrorCode == SecurityStatusPalErrorCode.CredentialsNeeded)
+ {
+ // we should not be here if CertSelectionDelegate is null but better check before dereferencing..
+ if (sslAuthenticationOptions.CertSelectionDelegate != null)
+ {
+ X509Certificate2? remoteCert = null;
+ try
+ {
+ string[] issuers = CertificateValidationPal.GetRequestCertificateAuthorities(context);
+ remoteCert = CertificateValidationPal.GetRemoteCertificate(context);
+ if (sslAuthenticationOptions.ClientCertificates == null)
+ {
+ sslAuthenticationOptions.ClientCertificates = new X509CertificateCollection();
+ }
+ X509Certificate2 clientCertificate = (X509Certificate2)sslAuthenticationOptions.CertSelectionDelegate(sslAuthenticationOptions.TargetHost!, sslAuthenticationOptions.ClientCertificates, remoteCert, issuers);
+ if (clientCertificate != null)
+ {
+ SafeDeleteSslContext.SetCertificate(sslContext.SslContext, SslStreamCertificateContext.Create(clientCertificate));
+ }
+ }
+ finally
+ {
+ remoteCert?.Dispose();
+ }
+ }
+
+ // We either got certificate or we can proceed without it. It is up to the server to decide if either is OK.
+ status = PerformHandshake(sslHandle);
+ }
outputBuffer = sslContext.ReadPendingWrites();
return status;
@@ -290,6 +326,8 @@ private static SecurityStatusPal PerformHandshake(SafeSslHandle sslHandle)
// So, call SslHandshake again to indicate to Secure Transport that we've
// accepted this handshake and it should go into the ready state.
break;
+ case PAL_TlsHandshakeState.ClientCertRequested:
+ return new SecurityStatusPal(SecurityStatusPalErrorCode.CredentialsNeeded);
default:
return new SecurityStatusPal(
SecurityStatusPalErrorCode.InternalError,
diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Unix.cs b/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Unix.cs
index 78b6cf47405c3e..f4c4c5424e18ee 100644
--- a/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Unix.cs
+++ b/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Unix.cs
@@ -87,6 +87,7 @@ private static SecurityStatusPal MapNativeErrorCode(Interop.Ssl.SslErrorCode err
{
Interop.Ssl.SslErrorCode.SSL_ERROR_RENEGOTIATE => new SecurityStatusPal(SecurityStatusPalErrorCode.Renegotiate),
Interop.Ssl.SslErrorCode.SSL_ERROR_ZERO_RETURN => new SecurityStatusPal(SecurityStatusPalErrorCode.ContextExpired),
+ Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP => new SecurityStatusPal(SecurityStatusPalErrorCode.CredentialsNeeded),
Interop.Ssl.SslErrorCode.SSL_ERROR_NONE or
Interop.Ssl.SslErrorCode.SSL_ERROR_WANT_READ => new SecurityStatusPal(SecurityStatusPalErrorCode.OK),
_ => new SecurityStatusPal(SecurityStatusPalErrorCode.InternalError, new Interop.OpenSsl.SslException((int)errorCode))
@@ -118,7 +119,7 @@ Interop.Ssl.SslErrorCode.SSL_ERROR_NONE or
public static SecurityStatusPal Renegotiate(ref SafeFreeCredentials? credentialsHandle, ref SafeDeleteSslContext? securityContext, SslAuthenticationOptions sslAuthenticationOptions, out byte[]? outputBuffer)
{
var sslContext = ((SafeDeleteSslContext)securityContext!).SslContext;
- SecurityStatusPal status = Interop.OpenSsl.SslRenegotiate(sslContext, out outputBuffer);
+ SecurityStatusPal status = Interop.OpenSsl.SslRenegotiate(sslContext, out _);
outputBuffer = Array.Empty();
if (status.ErrorCode != SecurityStatusPalErrorCode.OK)
@@ -158,12 +159,42 @@ private static SecurityStatusPal HandshakeInternal(SafeFreeCredentials credentia
context = new SafeDeleteSslContext((credential as SafeFreeSslCredentials)!, sslAuthenticationOptions);
}
- bool done = Interop.OpenSsl.DoSslHandshake(((SafeDeleteSslContext)context).SslContext, inputBuffer, out output, out outputSize);
+ SecurityStatusPalErrorCode errorCode = Interop.OpenSsl.DoSslHandshake(((SafeDeleteSslContext)context).SslContext, inputBuffer, out output, out outputSize);
+
+ if (errorCode == SecurityStatusPalErrorCode.CredentialsNeeded)
+ {
+ if (sslAuthenticationOptions.CertSelectionDelegate != null)
+ {
+ X509Certificate2? remoteCert = null;
+ string[] issuers = CertificateValidationPal.GetRequestCertificateAuthorities(context);
+ try
+ {
+ remoteCert = CertificateValidationPal.GetRemoteCertificate(context);
+ if (sslAuthenticationOptions.ClientCertificates == null)
+ {
+ sslAuthenticationOptions.ClientCertificates = new X509CertificateCollection();
+ }
+ X509Certificate2 clientCertificate = (X509Certificate2)sslAuthenticationOptions.CertSelectionDelegate(sslAuthenticationOptions.TargetHost!, sslAuthenticationOptions.ClientCertificates, remoteCert, issuers);
+ if (clientCertificate != null && clientCertificate.HasPrivateKey)
+ {
+ sslAuthenticationOptions.CertificateContext = SslStreamCertificateContext.Create(clientCertificate);
+ }
+ }
+ finally
+ {
+ remoteCert?.Dispose();
+ }
+ }
+
+ Interop.OpenSsl.UpdateClientCertiticate(((SafeDeleteSslContext)context).SslContext, sslAuthenticationOptions);
+ errorCode = Interop.OpenSsl.DoSslHandshake(((SafeDeleteSslContext)context).SslContext, null, out output, out outputSize);
+ }
+
// sometimes during renegotiation processing messgae does not yield new output.
// That seems to be flaw in OpenSSL state machine and we have workaround to peek it and try it again.
if (outputSize == 0 && Interop.Ssl.IsSslRenegotiatePending(((SafeDeleteSslContext)context).SslContext))
{
- done = Interop.OpenSsl.DoSslHandshake(((SafeDeleteSslContext)context).SslContext, ReadOnlySpan.Empty, out output, out outputSize);
+ errorCode = Interop.OpenSsl.DoSslHandshake(((SafeDeleteSslContext)context).SslContext, ReadOnlySpan.Empty, out output, out outputSize);
}
// When the handshake is done, and the context is server, check if the alpnHandle target was set to null during ALPN.
@@ -171,7 +202,7 @@ private static SecurityStatusPal HandshakeInternal(SafeFreeCredentials credentia
// We have this workaround, as openssl supports terminating handshake only from version 1.1.0,
// whereas ALPN is supported from version 1.0.2.
SafeSslHandle sslContext = context.SslContext;
- if (done && sslAuthenticationOptions.IsServer
+ if (errorCode == SecurityStatusPalErrorCode.OK && sslAuthenticationOptions.IsServer
&& sslAuthenticationOptions.ApplicationProtocols != null && sslAuthenticationOptions.ApplicationProtocols.Count != 0
&& sslContext.AlpnHandle.IsAllocated && sslContext.AlpnHandle.Target == null)
{
@@ -183,7 +214,7 @@ private static SecurityStatusPal HandshakeInternal(SafeFreeCredentials credentia
outputSize == output!.Length ? output :
new Span(output, 0, outputSize).ToArray();
- return new SecurityStatusPal(done ? SecurityStatusPalErrorCode.OK : SecurityStatusPalErrorCode.ContinueNeeded);
+ return new SecurityStatusPal(errorCode);
}
catch (Exception exc)
{
diff --git a/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs b/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs
index 139f77f83b5178..2fb36e595b20da 100644
--- a/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs
+++ b/src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs
@@ -196,11 +196,10 @@ public static unsafe SafeFreeCredentials AcquireCredentialsHandleSchannelCred(Ss
protocolFlags,
policy);
- Interop.Crypt32.CERT_CONTEXT* certificateHandle = null;
if (certificate != null)
{
secureCredential.cCreds = 1;
- certificateHandle = (Interop.Crypt32.CERT_CONTEXT*)certificate.Handle;
+ Interop.Crypt32.CERT_CONTEXT* certificateHandle = (Interop.Crypt32.CERT_CONTEXT*)certificate.Handle;
secureCredential.paCred = &certificateHandle;
}
@@ -253,11 +252,10 @@ public static unsafe SafeFreeCredentials AcquireCredentialsHandleSchCredentials(
Interop.SspiCli.SCH_CREDENTIALS credential = default;
credential.dwVersion = Interop.SspiCli.SCH_CREDENTIALS.CurrentVersion;
credential.dwFlags = flags;
- Interop.Crypt32.CERT_CONTEXT *certificateHandle = null;
if (certificate != null)
{
credential.cCreds = 1;
- certificateHandle = (Interop.Crypt32.CERT_CONTEXT *)certificate.Handle;
+ Interop.Crypt32.CERT_CONTEXT* certificateHandle = (Interop.Crypt32.CERT_CONTEXT*)certificate.Handle;
credential.paCred = &certificateHandle;
}
diff --git a/src/libraries/System.Net.Security/src/System/Security/Authentication/ExtendedProtection/ServiceNameCollection.cs b/src/libraries/System.Net.Security/src/System/Security/Authentication/ExtendedProtection/ServiceNameCollection.cs
index 8797f31cf589e6..43260e11d3e7d2 100644
--- a/src/libraries/System.Net.Security/src/System/Security/Authentication/ExtendedProtection/ServiceNameCollection.cs
+++ b/src/libraries/System.Net.Security/src/System/Security/Authentication/ExtendedProtection/ServiceNameCollection.cs
@@ -217,8 +217,7 @@ private static int GetCountOrOne(IEnumerable collection)
port = hostAndPort.Substring(colonIndex + 1); // Excludes colon
// Loosely validate the port just to make sure it was a port and not something else.
- ushort portValue;
- if (!ushort.TryParse(port, NumberStyles.Integer, CultureInfo.InvariantCulture, out portValue))
+ if (!ushort.TryParse(port, NumberStyles.Integer, CultureInfo.InvariantCulture, out _))
{
return inputServiceName;
}
diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationClientServer.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationClientServer.cs
index a605c859b4051f..5ca6a63e0d4acb 100644
--- a/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationClientServer.cs
+++ b/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationClientServer.cs
@@ -3,6 +3,7 @@
using System.Net.Sockets;
using System.Net.Test.Common;
+using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
@@ -34,6 +35,80 @@ public void Dispose()
_clientCertificate.Dispose();
}
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindows7))]
+ [InlineData(true, true)]
+ [InlineData(false, true)]
+ [InlineData(true, false)]
+ [InlineData(false, false)]
+ public async Task CertificateSelectionCallback_DelayedCertificate_OK(bool delayCertificate, bool sendClientCertificate)
+ {
+ X509Certificate? remoteCertificate = null;
+
+ (SslStream client, SslStream server) = TestHelper.GetConnectedSslStreams();
+ using (client)
+ using (server)
+ {
+ int count = 0;
+ SslClientAuthenticationOptions clientOptions = new SslClientAuthenticationOptions();
+ clientOptions.TargetHost = "localhost";
+ // Force Tls 1.2 to avoid issues with certain OpenSSL versions and Tls 1.3
+ // https://github.com/openssl/openssl/issues/7384
+ clientOptions.EnabledSslProtocols = SslProtocols.Tls12;
+ clientOptions.RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
+ clientOptions.LocalCertificateSelectionCallback = (sender, targetHost, localCertificates, certificate, acceptableIssuers) =>
+ {
+ count++;
+ remoteCertificate = certificate;
+ if (delayCertificate && count == 1)
+ {
+ // wait until we get remote certificate from peer e.g. handshake started.
+ return null;
+ }
+
+ return sendClientCertificate ? _clientCertificate : null;
+ };
+
+ SslServerAuthenticationOptions serverOptions = new SslServerAuthenticationOptions();
+ serverOptions.ServerCertificate = _serverCertificate;
+ serverOptions.ClientCertificateRequired = true;
+ serverOptions.RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =>
+ {
+ if (sendClientCertificate)
+ {
+ Assert.NotNull(certificate);
+ // The client chain may be incomplete.
+ Assert.True(sslPolicyErrors == SslPolicyErrors.None || sslPolicyErrors == SslPolicyErrors.RemoteCertificateChainErrors);
+ }
+ else
+ {
+ Assert.Equal(SslPolicyErrors.RemoteCertificateNotAvailable, sslPolicyErrors);
+ }
+
+ return true;
+ };
+
+
+ await TestConfiguration.WhenAllOrAnyFailedWithTimeout(
+ client.AuthenticateAsClientAsync(clientOptions),
+ server.AuthenticateAsServerAsync(serverOptions));
+
+ // verify that the session is usable with or without client's certificate
+ await TestHelper.PingPong(client, server);
+ await TestHelper.PingPong(server, client);
+
+ if (delayCertificate)
+ {
+ // LocalCertificateSelectionCallback should be called with real remote certificate.
+ if (!OperatingSystem.IsWindows())
+ {
+ // remote certificate does not work on windows.
+ // https://github.com/dotnet/runtime/issues/63321
+ Assert.NotNull(remoteCertificate);
+ }
+ }
+ }
+ }
+
[Theory]
[InlineData(false)]
[InlineData(true)]
diff --git a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/DynamicWinsockMethods.cs b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/DynamicWinsockMethods.cs
index 789a1782172bf5..923277fbb82209 100644
--- a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/DynamicWinsockMethods.cs
+++ b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/DynamicWinsockMethods.cs
@@ -57,8 +57,7 @@ private DynamicWinsockMethods(AddressFamily addressFamily, SocketType socketType
private static T CreateDelegate([NotNull] ref T? cache, SafeSocketHandle socketHandle, string guidString) where T: Delegate
{
Guid guid = new Guid(guidString);
- IntPtr ptr = IntPtr.Zero;
- int length;
+ IntPtr ptr;
SocketError errorCode;
unsafe
@@ -70,7 +69,7 @@ private static T CreateDelegate([NotNull] ref T? cache, SafeSocketHandle sock
sizeof(Guid),
out ptr,
sizeof(IntPtr),
- out length,
+ out _,
IntPtr.Zero,
IntPtr.Zero);
}
diff --git a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs
index 40b34ca83b2bc9..f3ecb8e64a9f05 100644
--- a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs
+++ b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs
@@ -1169,7 +1169,6 @@ public int Send(byte[] buffer, int offset, int size, SocketFlags socketFlags, ou
ValidateBufferArguments(buffer, offset, size);
- errorCode = SocketError.Success;
ValidateBlockingMode();
if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(this, $"SRC:{LocalEndPoint} DST:{RemoteEndPoint} size:{size}");
@@ -1886,7 +1885,7 @@ public int IOControl(int ioControlCode, byte[]? optionInValue, byte[]? optionOut
{
ThrowIfDisposed();
- int realOptionLength = 0;
+ int realOptionLength;
// IOControl is used for Windows-specific IOCTL operations. If we need to add support for IOCTLs specific
// to other platforms, we will likely need to add a new API, as the control codes may overlap with those
@@ -2037,7 +2036,7 @@ public void SetRawSocketOption(int optionLevel, int optionName, ReadOnlySpan Narrow(System.Numerics.Vector low, System.Numerics.Vector high) { throw null; }
public static System.Numerics.Vector Negate(System.Numerics.Vector value) where T : struct { throw null; }
public static System.Numerics.Vector OnesComplement(System.Numerics.Vector value) where T : struct { throw null; }
+ public static System.Numerics.Vector ShiftLeft(System.Numerics.Vector value, int shiftCount) { throw null; }
+ public static System.Numerics.Vector ShiftLeft(System.Numerics.Vector value, int shiftCount) { throw null; }
+ public static System.Numerics.Vector ShiftLeft(System.Numerics.Vector value, int shiftCount) { throw null; }
+ public static System.Numerics.Vector ShiftLeft(System.Numerics.Vector value, int shiftCount) { throw null; }
+ public static System.Numerics.Vector ShiftLeft(System.Numerics.Vector value, int shiftCount) { throw null; }
+ [System.CLSCompliantAttribute(false)]
+ public static System.Numerics.Vector ShiftLeft(System.Numerics.Vector value, int shiftCount) { throw null; }
+ [System.CLSCompliantAttribute(false)]
+ public static System.Numerics.Vector ShiftLeft(System.Numerics.Vector value, int shiftCount) { throw null; }
+ [System.CLSCompliantAttribute(false)]
+ public static System.Numerics.Vector ShiftLeft(System.Numerics.Vector value, int shiftCount) { throw null; }
+ [System.CLSCompliantAttribute(false)]
+ public static System.Numerics.Vector ShiftLeft(System.Numerics.Vector value, int shiftCount) { throw null; }
+ [System.CLSCompliantAttribute(false)]
+ public static System.Numerics.Vector ShiftLeft(System.Numerics.Vector value, int shiftCount) { throw null; }
+ public static System.Numerics.Vector ShiftRightArithmetic(System.Numerics.Vector value, int shiftCount) { throw null; }
+ public static System.Numerics.Vector ShiftRightArithmetic(System.Numerics.Vector value, int shiftCount) { throw null; }
+ public static System.Numerics.Vector ShiftRightArithmetic(System.Numerics.Vector value, int shiftCount) { throw null; }
+ public static System.Numerics.Vector ShiftRightArithmetic(System.Numerics.Vector value, int shiftCount) { throw null; }
+ [System.CLSCompliantAttribute(false)]
+ public static System.Numerics.Vector ShiftRightArithmetic(System.Numerics.Vector