Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordotnet-bot <dotnet-bot@microsoft.com>2021-07-09 20:31:10 +0300
committerdotnet-bot <dotnet-bot@microsoft.com>2021-07-09 20:31:10 +0300
commit208e377a5329ad6eb1db5e5fb9d4590fa50beadd (patch)
tree1192c96fcd8fa22e44996a31cc637c8ecbdb1695
parentf8d03e6119b6e2cf625c946d9a7907dbefff8a21 (diff)
parent84228b7a531ce33d28a96c347f9cd9a8c37ed076 (diff)
Merge in 'release/5.0' changesv5.0.9
-rw-r--r--eng/Version.Details.xml56
-rw-r--r--eng/Versions.props20
-rw-r--r--eng/common/generate-locproject.ps1110
-rw-r--r--eng/common/templates/job/onelocbuild.yml93
-rw-r--r--eng/common/tools.ps113
-rw-r--r--global.json8
-rw-r--r--src/coreclr/src/System.Private.CoreLib/src/System/StubHelpers.cs11
-rw-r--r--src/coreclr/src/vm/corelib.h1
-rw-r--r--src/coreclr/src/vm/ilmarshalers.cpp7
-rw-r--r--src/tests/Interop/StringMarshalling/LPTSTR/LPTSTRTest.cs15
-rw-r--r--src/tests/Interop/StringMarshalling/LPTSTR/LPTStrTestNative.cpp12
-rw-r--r--src/tests/Interop/StringMarshalling/LPTSTR/LPTStrTestNative.cs18
12 files changed, 315 insertions, 49 deletions
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 8f8c16f4add..97988db5dea 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -10,61 +10,61 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
- <Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="5.0.0-beta.21160.3">
+ <Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="5.0.0-beta.21328.3">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>670382be6a978ba401c21c57ba44311199d2682a</Sha>
+ <Sha>5266aa9856457785b84739fda2616f21da7ee6b4</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="5.0.0-beta.21160.3">
+ <Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="5.0.0-beta.21328.3">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>670382be6a978ba401c21c57ba44311199d2682a</Sha>
+ <Sha>5266aa9856457785b84739fda2616f21da7ee6b4</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.ApiCompat" Version="5.0.0-beta.21160.3">
+ <Dependency Name="Microsoft.DotNet.ApiCompat" Version="5.0.0-beta.21328.3">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>670382be6a978ba401c21c57ba44311199d2682a</Sha>
+ <Sha>5266aa9856457785b84739fda2616f21da7ee6b4</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.GenAPI" Version="5.0.0-beta.21160.3">
+ <Dependency Name="Microsoft.DotNet.GenAPI" Version="5.0.0-beta.21328.3">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>670382be6a978ba401c21c57ba44311199d2682a</Sha>
+ <Sha>5266aa9856457785b84739fda2616f21da7ee6b4</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.GenFacades" Version="5.0.0-beta.21160.3">
+ <Dependency Name="Microsoft.DotNet.GenFacades" Version="5.0.0-beta.21328.3">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>670382be6a978ba401c21c57ba44311199d2682a</Sha>
+ <Sha>5266aa9856457785b84739fda2616f21da7ee6b4</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.XUnitExtensions" Version="5.0.0-beta.21160.3">
+ <Dependency Name="Microsoft.DotNet.XUnitExtensions" Version="5.0.0-beta.21328.3">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>670382be6a978ba401c21c57ba44311199d2682a</Sha>
+ <Sha>5266aa9856457785b84739fda2616f21da7ee6b4</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.XUnitConsoleRunner" Version="2.5.1-beta.21160.3">
+ <Dependency Name="Microsoft.DotNet.XUnitConsoleRunner" Version="2.5.1-beta.21328.3">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>670382be6a978ba401c21c57ba44311199d2682a</Sha>
+ <Sha>5266aa9856457785b84739fda2616f21da7ee6b4</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.Build.Tasks.Packaging" Version="5.0.0-beta.21160.3">
+ <Dependency Name="Microsoft.DotNet.Build.Tasks.Packaging" Version="5.0.0-beta.21328.3">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>670382be6a978ba401c21c57ba44311199d2682a</Sha>
+ <Sha>5266aa9856457785b84739fda2616f21da7ee6b4</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.CodeAnalysis" Version="5.0.0-beta.21160.3">
+ <Dependency Name="Microsoft.DotNet.CodeAnalysis" Version="5.0.0-beta.21328.3">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>670382be6a978ba401c21c57ba44311199d2682a</Sha>
+ <Sha>5266aa9856457785b84739fda2616f21da7ee6b4</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk" Version="5.0.0-beta.21160.3">
+ <Dependency Name="Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk" Version="5.0.0-beta.21328.3">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>670382be6a978ba401c21c57ba44311199d2682a</Sha>
+ <Sha>5266aa9856457785b84739fda2616f21da7ee6b4</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.RemoteExecutor" Version="5.0.0-beta.21160.3">
+ <Dependency Name="Microsoft.DotNet.RemoteExecutor" Version="5.0.0-beta.21328.3">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>670382be6a978ba401c21c57ba44311199d2682a</Sha>
+ <Sha>5266aa9856457785b84739fda2616f21da7ee6b4</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="5.0.0-beta.21160.3">
+ <Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="5.0.0-beta.21328.3">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>670382be6a978ba401c21c57ba44311199d2682a</Sha>
+ <Sha>5266aa9856457785b84739fda2616f21da7ee6b4</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.VersionTools.Tasks" Version="5.0.0-beta.21160.3">
+ <Dependency Name="Microsoft.DotNet.VersionTools.Tasks" Version="5.0.0-beta.21328.3">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>670382be6a978ba401c21c57ba44311199d2682a</Sha>
+ <Sha>5266aa9856457785b84739fda2616f21da7ee6b4</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk" Version="5.0.0-beta.21160.3">
+ <Dependency Name="Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk" Version="5.0.0-beta.21328.3">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>670382be6a978ba401c21c57ba44311199d2682a</Sha>
+ <Sha>5266aa9856457785b84739fda2616f21da7ee6b4</Sha>
</Dependency>
<Dependency Name="optimization.windows_nt-x64.IBC.CoreFx" Version="99.99.99-master-20200806.6">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-optimization</Uri>
diff --git a/eng/Versions.props b/eng/Versions.props
index adbdaf95aa4..5aeea3f16a0 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -48,16 +48,16 @@
</ItemGroup>
<PropertyGroup>
<!-- Arcade dependencies -->
- <MicrosoftDotNetApiCompatVersion>5.0.0-beta.21160.3</MicrosoftDotNetApiCompatVersion>
- <MicrosoftDotNetBuildTasksFeedVersion>5.0.0-beta.21160.3</MicrosoftDotNetBuildTasksFeedVersion>
- <MicrosoftDotNetCodeAnalysisVersion>5.0.0-beta.21160.3</MicrosoftDotNetCodeAnalysisVersion>
- <MicrosoftDotNetGenAPIVersion>5.0.0-beta.21160.3</MicrosoftDotNetGenAPIVersion>
- <MicrosoftDotNetGenFacadesVersion>5.0.0-beta.21160.3</MicrosoftDotNetGenFacadesVersion>
- <MicrosoftDotNetXUnitExtensionsVersion>5.0.0-beta.21160.3</MicrosoftDotNetXUnitExtensionsVersion>
- <MicrosoftDotNetXUnitConsoleRunnerVersion>2.5.1-beta.21160.3</MicrosoftDotNetXUnitConsoleRunnerVersion>
- <MicrosoftDotNetBuildTasksPackagingVersion>5.0.0-beta.21160.3</MicrosoftDotNetBuildTasksPackagingVersion>
- <MicrosoftDotNetRemoteExecutorVersion>5.0.0-beta.21160.3</MicrosoftDotNetRemoteExecutorVersion>
- <MicrosoftDotNetVersionToolsTasksVersion>5.0.0-beta.21160.3</MicrosoftDotNetVersionToolsTasksVersion>
+ <MicrosoftDotNetApiCompatVersion>5.0.0-beta.21328.3</MicrosoftDotNetApiCompatVersion>
+ <MicrosoftDotNetBuildTasksFeedVersion>5.0.0-beta.21328.3</MicrosoftDotNetBuildTasksFeedVersion>
+ <MicrosoftDotNetCodeAnalysisVersion>5.0.0-beta.21328.3</MicrosoftDotNetCodeAnalysisVersion>
+ <MicrosoftDotNetGenAPIVersion>5.0.0-beta.21328.3</MicrosoftDotNetGenAPIVersion>
+ <MicrosoftDotNetGenFacadesVersion>5.0.0-beta.21328.3</MicrosoftDotNetGenFacadesVersion>
+ <MicrosoftDotNetXUnitExtensionsVersion>5.0.0-beta.21328.3</MicrosoftDotNetXUnitExtensionsVersion>
+ <MicrosoftDotNetXUnitConsoleRunnerVersion>2.5.1-beta.21328.3</MicrosoftDotNetXUnitConsoleRunnerVersion>
+ <MicrosoftDotNetBuildTasksPackagingVersion>5.0.0-beta.21328.3</MicrosoftDotNetBuildTasksPackagingVersion>
+ <MicrosoftDotNetRemoteExecutorVersion>5.0.0-beta.21328.3</MicrosoftDotNetRemoteExecutorVersion>
+ <MicrosoftDotNetVersionToolsTasksVersion>5.0.0-beta.21328.3</MicrosoftDotNetVersionToolsTasksVersion>
<!-- Installer dependencies -->
<MicrosoftNETCoreAppVersion>5.0.0-rc.1.20451.14</MicrosoftNETCoreAppVersion>
<MicrosoftNETCoreDotNetHostVersion>5.0.0-rc.1.20451.14</MicrosoftNETCoreDotNetHostVersion>
diff --git a/eng/common/generate-locproject.ps1 b/eng/common/generate-locproject.ps1
new file mode 100644
index 00000000000..de348a2e225
--- /dev/null
+++ b/eng/common/generate-locproject.ps1
@@ -0,0 +1,110 @@
+Param(
+ [Parameter(Mandatory=$true)][string] $SourcesDirectory, # Directory where source files live; if using a Localize directory it should live in here
+ [string] $LanguageSet = 'VS_Main_Languages', # Language set to be used in the LocProject.json
+ [switch] $UseCheckedInLocProjectJson, # When set, generates a LocProject.json and compares it to one that already exists in the repo; otherwise just generates one
+ [switch] $CreateNeutralXlfs # Creates neutral xlf files. Only set to false when running locally
+)
+
+# Generates LocProject.json files for the OneLocBuild task. OneLocBuildTask is described here:
+# https://ceapex.visualstudio.com/CEINTL/_wiki/wikis/CEINTL.wiki/107/Localization-with-OneLocBuild-Task
+
+Set-StrictMode -Version 2.0
+$ErrorActionPreference = "Stop"
+. $PSScriptRoot\tools.ps1
+
+Import-Module -Name (Join-Path $PSScriptRoot 'native\CommonLibrary.psm1')
+
+$exclusionsFilePath = "$SourcesDirectory\eng\Localize\LocExclusions.json"
+$exclusions = @{ Exclusions = @() }
+if (Test-Path -Path $exclusionsFilePath)
+{
+ $exclusions = Get-Content "$exclusionsFilePath" | ConvertFrom-Json
+}
+
+Push-Location "$SourcesDirectory" # push location for Resolve-Path -Relative to work
+
+# Template files
+$jsonFiles = @()
+$jsonFiles += Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\.template\.config\\localize\\en\..+\.json" } # .NET templating pattern
+$jsonFiles += Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "en\\strings\.json" } # current winforms pattern
+
+$xlfFiles = @()
+
+$allXlfFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory\*\*.xlf"
+$langXlfFiles = @()
+if ($allXlfFiles) {
+ $null = $allXlfFiles[0].FullName -Match "\.([\w-]+)\.xlf" # matches '[langcode].xlf'
+ $firstLangCode = $Matches.1
+ $langXlfFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory\*\*.$firstLangCode.xlf"
+}
+$langXlfFiles | ForEach-Object {
+ $null = $_.Name -Match "(.+)\.[\w-]+\.xlf" # matches '[filename].[langcode].xlf
+
+ $destinationFile = "$($_.Directory.FullName)\$($Matches.1).xlf"
+ $xlfFiles += Copy-Item "$($_.FullName)" -Destination $destinationFile -PassThru
+}
+
+$locFiles = $jsonFiles + $xlfFiles
+
+$locJson = @{
+ Projects = @(
+ @{
+ LanguageSet = $LanguageSet
+ LocItems = @(
+ $locFiles | ForEach-Object {
+ $outputPath = "$(($_.DirectoryName | Resolve-Path -Relative) + "\")"
+ $continue = $true
+ foreach ($exclusion in $exclusions.Exclusions) {
+ if ($outputPath.Contains($exclusion))
+ {
+ $continue = $false
+ }
+ }
+ $sourceFile = ($_.FullName | Resolve-Path -Relative)
+ if (!$CreateNeutralXlfs -and $_.Extension -eq '.xlf') {
+ Remove-Item -Path $sourceFile
+ }
+ if ($continue)
+ {
+ if ($_.Directory.Name -eq 'en' -and $_.Extension -eq '.json') {
+ return @{
+ SourceFile = $sourceFile
+ CopyOption = "LangIDOnPath"
+ OutputPath = "$($_.Directory.Parent.FullName | Resolve-Path -Relative)\"
+ }
+ }
+ else {
+ return @{
+ SourceFile = $sourceFile
+ CopyOption = "LangIDOnName"
+ OutputPath = $outputPath
+ }
+ }
+ }
+ }
+ )
+ }
+ )
+}
+
+$json = ConvertTo-Json $locJson -Depth 5
+Write-Host "LocProject.json generated:`n`n$json`n`n"
+Pop-Location
+
+if (!$UseCheckedInLocProjectJson) {
+ New-Item "$SourcesDirectory\eng\Localize\LocProject.json" -Force # Need this to make sure the Localize directory is created
+ Set-Content "$SourcesDirectory\eng\Localize\LocProject.json" $json
+}
+else {
+ New-Item "$SourcesDirectory\eng\Localize\LocProject-generated.json" -Force # Need this to make sure the Localize directory is created
+ Set-Content "$SourcesDirectory\eng\Localize\LocProject-generated.json" $json
+
+ if ((Get-FileHash "$SourcesDirectory\eng\Localize\LocProject-generated.json").Hash -ne (Get-FileHash "$SourcesDirectory\eng\Localize\LocProject.json").Hash) {
+ Write-PipelineTelemetryError -Category "OneLocBuild" -Message "Existing LocProject.json differs from generated LocProject.json. Download LocProject-generated.json and compare them."
+
+ exit 1
+ }
+ else {
+ Write-Host "Generated LocProject.json and current LocProject.json are identical."
+ }
+} \ No newline at end of file
diff --git a/eng/common/templates/job/onelocbuild.yml b/eng/common/templates/job/onelocbuild.yml
new file mode 100644
index 00000000000..e8bc77d2ebb
--- /dev/null
+++ b/eng/common/templates/job/onelocbuild.yml
@@ -0,0 +1,93 @@
+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:
+ vmImage: vs2017-win2016
+
+ CeapexPat: $(dn-bot-ceapex-package-r) # PAT for the loc AzDO instance https://dev.azure.com/ceapex
+ GithubPat: $(BotAccount-dotnet-bot-repo-PAT)
+
+ SourcesDirectory: $(Build.SourcesDirectory)
+ CreatePr: true
+ AutoCompletePr: false
+ UseLfLineEndings: true
+ UseCheckedInLocProjectJson: false
+ LanguageSet: VS_Main_Languages
+ LclSource: lclFilesInRepo
+ LclPackageId: ''
+ RepoType: gitHub
+ GitHubOrg: dotnet
+ MirrorRepo: ''
+ MirrorBranch: main
+ condition: ''
+
+jobs:
+- job: OneLocBuild
+
+ dependsOn: ${{ parameters.dependsOn }}
+
+ displayName: OneLocBuild
+
+ pool: ${{ parameters.pool }}
+
+ variables:
+ - group: OneLocBuildVariables # Contains the CeapexPat and GithubPat
+ - name: _GenerateLocProjectArguments
+ value: -SourcesDirectory ${{ parameters.SourcesDirectory }}
+ -LanguageSet "${{ parameters.LanguageSet }}"
+ -CreateNeutralXlfs
+ - ${{ if eq(parameters.UseCheckedInLocProjectJson, 'true') }}:
+ - name: _GenerateLocProjectArguments
+ value: ${{ variables._GenerateLocProjectArguments }} -UseCheckedInLocProjectJson
+
+
+ steps:
+ - task: Powershell@2
+ inputs:
+ filePath: $(Build.SourcesDirectory)/eng/common/generate-locproject.ps1
+ arguments: $(_GenerateLocProjectArguments)
+ displayName: Generate LocProject.json
+ condition: ${{ parameters.condition }}
+
+ - task: OneLocBuild@2
+ displayName: OneLocBuild
+ env:
+ SYSTEM_ACCESSTOKEN: $(System.AccessToken)
+ inputs:
+ locProj: eng/Localize/LocProject.json
+ outDir: $(Build.ArtifactStagingDirectory)
+ lclSource: ${{ parameters.LclSource }}
+ lclPackageId: ${{ parameters.LclPackageId }}
+ isCreatePrSelected: ${{ parameters.CreatePr }}
+ ${{ if eq(parameters.CreatePr, true) }}:
+ isAutoCompletePrSelected: ${{ parameters.AutoCompletePr }}
+ isUseLfLineEndingsSelected: ${{ parameters.UseLfLineEndings }}
+ packageSourceAuth: patAuth
+ patVariable: ${{ parameters.CeapexPat }}
+ ${{ if eq(parameters.RepoType, 'gitHub') }}:
+ repoType: ${{ parameters.RepoType }}
+ gitHubPatVariable: "${{ parameters.GithubPat }}"
+ ${{ if ne(parameters.MirrorRepo, '') }}:
+ isMirrorRepoSelected: true
+ gitHubOrganization: ${{ parameters.GitHubOrg }}
+ mirrorRepo: ${{ parameters.MirrorRepo }}
+ mirrorBranch: ${{ parameters.MirrorBranch }}
+ condition: ${{ parameters.condition }}
+
+ - task: PublishBuildArtifacts@1
+ displayName: Publish Localization Files
+ inputs:
+ PathtoPublish: '$(Build.ArtifactStagingDirectory)/loc'
+ PublishLocation: Container
+ ArtifactName: Loc
+ condition: ${{ parameters.condition }}
+
+ - task: PublishBuildArtifacts@1
+ displayName: Publish LocProject.json
+ inputs:
+ PathtoPublish: '$(Build.SourcesDirectory)/eng/Localize/'
+ PublishLocation: Container
+ ArtifactName: Loc
+ condition: ${{ parameters.condition }} \ No newline at end of file
diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1
index 60eb601c8f3..eba7ed49d78 100644
--- a/eng/common/tools.ps1
+++ b/eng/common/tools.ps1
@@ -371,7 +371,16 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements =
}
$msbuildVersionDir = if ([int]$vsMajorVersion -lt 16) { "$vsMajorVersion.0" } else { "Current" }
- return $global:_MSBuildExe = Join-Path $vsInstallDir "MSBuild\$msbuildVersionDir\Bin\msbuild.exe"
+
+ $local:BinFolder = Join-Path $vsInstallDir "MSBuild\$msbuildVersionDir\Bin"
+ $local:Prefer64bit = if (Get-Member -InputObject $vsRequirements -Name 'Prefer64bit') { $vsRequirements.Prefer64bit } else { $false }
+ if ($local:Prefer64bit -and (Test-Path(Join-Path $local:BinFolder "amd64"))) {
+ $global:_MSBuildExe = Join-Path $local:BinFolder "amd64\msbuild.exe"
+ } else {
+ $global:_MSBuildExe = Join-Path $local:BinFolder "msbuild.exe"
+ }
+
+ return $global:_MSBuildExe
}
function InitializeVisualStudioEnvironmentVariables([string] $vsInstallDir, [string] $vsMajorVersion) {
@@ -527,7 +536,7 @@ function GetDefaultMSBuildEngine() {
function GetNuGetPackageCachePath() {
if ($env:NUGET_PACKAGES -eq $null) {
- # Use local cache on CI to ensure deterministic build.
+ # Use local cache on CI to ensure deterministic build.
# Avoid using the http cache as workaround for https://github.com/NuGet/Home/issues/3116
# use global cache in dev builds to avoid cost of downloading packages.
# For directory normalization, see also: https://github.com/NuGet/Home/issues/7968
diff --git a/global.json b/global.json
index 4fb6c96213f..d5459e34345 100644
--- a/global.json
+++ b/global.json
@@ -12,10 +12,10 @@
"python3": "3.7.1"
},
"msbuild-sdks": {
- "Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "5.0.0-beta.21160.3",
- "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.21160.3",
- "Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk": "5.0.0-beta.21160.3",
- "Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.21160.3",
+ "Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "5.0.0-beta.21328.3",
+ "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.21328.3",
+ "Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk": "5.0.0-beta.21328.3",
+ "Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.21328.3",
"Microsoft.FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0",
"Microsoft.NET.Sdk.IL": "5.0.0-preview.8.20359.4",
"Microsoft.Build.NoTargets": "2.0.1",
diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/StubHelpers.cs b/src/coreclr/src/System.Private.CoreLib/src/System/StubHelpers.cs
index b507b28559d..6949bf13642 100644
--- a/src/coreclr/src/System.Private.CoreLib/src/System/StubHelpers.cs
+++ b/src/coreclr/src/System.Private.CoreLib/src/System/StubHelpers.cs
@@ -537,6 +537,17 @@ namespace System.StubHelpers
managed.Slice(0, numChars).CopyTo(native);
native[numChars] = '\0';
}
+
+ internal static unsafe string ConvertToManaged(IntPtr nativeHome, int length)
+ {
+ int end = SpanHelpers.IndexOf(ref *(char*)nativeHome, '\0', length);
+ if (end != -1)
+ {
+ length = end;
+ }
+
+ return new string((char*)nativeHome, 0, length);
+ }
} // class WSTRBufferMarshaler
#if FEATURE_COMINTEROP
diff --git a/src/coreclr/src/vm/corelib.h b/src/coreclr/src/vm/corelib.h
index ad892439138..915c9843666 100644
--- a/src/coreclr/src/vm/corelib.h
+++ b/src/coreclr/src/vm/corelib.h
@@ -1050,6 +1050,7 @@ DEFINE_METHOD(CSTRMARSHALER, CLEAR_NATIVE, ClearNative,
DEFINE_CLASS(FIXEDWSTRMARSHALER, StubHelpers, FixedWSTRMarshaler)
DEFINE_METHOD(FIXEDWSTRMARSHALER, CONVERT_TO_NATIVE, ConvertToNative, SM_Str_IntPtr_Int_RetVoid)
+DEFINE_METHOD(FIXEDWSTRMARSHALER, CONVERT_TO_MANAGED, ConvertToManaged, SM_IntPtr_Int_RetStr)
DEFINE_CLASS(BSTRMARSHALER, StubHelpers, BSTRMarshaler)
DEFINE_METHOD(BSTRMARSHALER, CONVERT_TO_NATIVE, ConvertToNative, SM_Str_IntPtr_RetIntPtr)
diff --git a/src/coreclr/src/vm/ilmarshalers.cpp b/src/coreclr/src/vm/ilmarshalers.cpp
index e0eb8c558d1..21cff7aa1a7 100644
--- a/src/coreclr/src/vm/ilmarshalers.cpp
+++ b/src/coreclr/src/vm/ilmarshalers.cpp
@@ -1909,11 +1909,8 @@ void ILFixedWSTRMarshaler::EmitConvertContentsNativeToCLR(ILCodeStream* pslILEmi
STANDARD_VM_CONTRACT;
EmitLoadNativeHomeAddr(pslILEmit);
- pslILEmit->EmitDUP();
- pslILEmit->EmitCALL(METHOD__STRING__WCSLEN, 1, 1);
- pslILEmit->EmitCALL(METHOD__STUBHELPERS__CHECK_STRING_LENGTH, 1, 0);
-
- pslILEmit->EmitNEWOBJ(METHOD__STRING__CTOR_CHARPTR, 1);
+ pslILEmit->EmitLDC(m_pargs->fs.fixedStringLength);
+ pslILEmit->EmitCALL(METHOD__FIXEDWSTRMARSHALER__CONVERT_TO_MANAGED, 2, 1);
EmitStoreManagedValue(pslILEmit);
}
diff --git a/src/tests/Interop/StringMarshalling/LPTSTR/LPTSTRTest.cs b/src/tests/Interop/StringMarshalling/LPTSTR/LPTSTRTest.cs
index 8c789d180c6..a29b99a01c4 100644
--- a/src/tests/Interop/StringMarshalling/LPTSTR/LPTSTRTest.cs
+++ b/src/tests/Interop/StringMarshalling/LPTSTR/LPTSTRTest.cs
@@ -60,5 +60,20 @@ class LPTStrTest
ReverseByValStringUni(ref uniStr);
Assert.AreEqual(Helpers.Reverse(InitialString), uniStr.str);
+
+ ReverseCopyByValStringAnsi(new ByValStringInStructAnsi { str = LongString }, out ByValStringInStructSplitAnsi ansiStrSplit);
+
+ Assert.AreEqual(Helpers.Reverse(LongString[^10..]), ansiStrSplit.str1);
+ Assert.AreEqual(Helpers.Reverse(LongString[..^10]), ansiStrSplit.str2);
+
+ ReverseCopyByValStringUni(new ByValStringInStructUnicode { str = LongString }, out ByValStringInStructSplitUnicode uniStrSplit);
+
+ Assert.AreEqual(Helpers.Reverse(LongString[^10..]), uniStrSplit.str1);
+ Assert.AreEqual(Helpers.Reverse(LongString[..^10]), uniStrSplit.str2);
+
+ ReverseCopyByValStringUni(new ByValStringInStructUnicode { str = LongUnicodeString }, out ByValStringInStructSplitUnicode uniStrSplit2);
+
+ Assert.AreEqual(Helpers.Reverse(LongUnicodeString[^10..]), uniStrSplit2.str1);
+ Assert.AreEqual(Helpers.Reverse(LongUnicodeString[..^10]), uniStrSplit2.str2);
}
}
diff --git a/src/tests/Interop/StringMarshalling/LPTSTR/LPTStrTestNative.cpp b/src/tests/Interop/StringMarshalling/LPTSTR/LPTStrTestNative.cpp
index 428ce488ddd..c618a5db4fb 100644
--- a/src/tests/Interop/StringMarshalling/LPTSTR/LPTStrTestNative.cpp
+++ b/src/tests/Interop/StringMarshalling/LPTSTR/LPTStrTestNative.cpp
@@ -47,3 +47,15 @@ extern "C" DLL_EXPORT void STDMETHODCALLTYPE ReverseByValStringUni(ByValStringIn
{
StringMarshalingTests<LPWSTR, TP_slen>::ReverseInplace(str->str);
}
+
+extern "C" DLL_EXPORT void STDMETHODCALLTYPE ReverseCopyByValStringAnsi(ByValStringInStructAnsi str, ByValStringInStructAnsi* out)
+{
+ *out = str;
+ StringMarshalingTests<char*, default_callconv_strlen>::ReverseInplace(out->str);
+}
+
+extern "C" DLL_EXPORT void STDMETHODCALLTYPE ReverseCopyByValStringUni(ByValStringInStructUnicode str, ByValStringInStructUnicode* out)
+{
+ *out = str;
+ StringMarshalingTests<LPWSTR, TP_slen>::ReverseInplace(out->str);
+}
diff --git a/src/tests/Interop/StringMarshalling/LPTSTR/LPTStrTestNative.cs b/src/tests/Interop/StringMarshalling/LPTSTR/LPTStrTestNative.cs
index 022c3dc250e..522c80e872f 100644
--- a/src/tests/Interop/StringMarshalling/LPTSTR/LPTStrTestNative.cs
+++ b/src/tests/Interop/StringMarshalling/LPTSTR/LPTStrTestNative.cs
@@ -14,6 +14,15 @@ class LPTStrTestNative
public string str;
}
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
+ public struct ByValStringInStructSplitAnsi
+ {
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
+ public string str1;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
+ public string str2;
+ }
+
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ByValStringInStructUnicode
{
@@ -21,6 +30,15 @@ class LPTStrTestNative
public string str;
}
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+ public struct ByValStringInStructSplitUnicode
+ {
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
+ public string str1;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
+ public string str2;
+ }
+
[DllImport(nameof(LPTStrTestNative), CharSet = CharSet.Unicode)]
public static extern bool Verify_NullTerminators_PastEnd(StringBuilder builder, int length);