diff --git a/build/Targets/Dependencies.props b/build/Targets/Dependencies.props
index d25f03b1feea32dd37b420436ed593adbd7d0502..f8d5f93c3414b04ecae1f1bea197291547778f51 100644
--- a/build/Targets/Dependencies.props
+++ b/build/Targets/Dependencies.props
@@ -2,6 +2,7 @@
+ 0.9.2
3.0.0-unstable0085
1.9.4
0.2.0
diff --git a/build/Targets/Imports.targets b/build/Targets/Imports.targets
index 4ca1c5aa511d532daf9f44f4ce6361a38a6fc338..a41f3d1d7df7e9d2e40d22dc0f8b2e88006ffa5f 100644
--- a/build/Targets/Imports.targets
+++ b/build/Targets/Imports.targets
@@ -11,14 +11,14 @@
<_CopyReferences>false
<_CopyProjectReferences>false
false
- $(OutDir)Exes\$(MSBuildProjectName)\
+ $(OutputPath)Exes\$(MSBuildProjectName)\
<_IsAnyUnitTest>true
true
- $(OutDir)UnitTests\$(MSBuildProjectName)\
+ $(OutputPath)UnitTests\$(MSBuildProjectName)\
@@ -39,21 +39,21 @@
<_IsAnyUnitTest>true
<_IsAnyPortableUnitTest>true
false
- $(OutDir)Dlls\$(MSBuildProjectName)\
+ $(OutputPath)Dlls\$(MSBuildProjectName)\
<_CopyReferences>false
false
- $(OutDir)Exes\
+ $(OutputPath)Exes\
<_CopyReferences>false
true
- $(OutDir)Vsix\$(MSBuildProjectName)\
+ $(OutputPath)Vsix\$(MSBuildProjectName)\
@@ -62,8 +62,8 @@
$(AllowedReferenceRelatedFileExtensions);.pdb
true
- $(OutDir)CoreClrTest
- $(OutDir)UnitTests\Portable\
+ $(OutputPath)CoreClrTest
+ $(OutputPath)UnitTests\Portable\
@@ -74,19 +74,19 @@
<_CopyReferences>false
<_CopyProjectReferences>false
false
- $(OutDir)Dlls\$(MSBuildProjectName)\
+ $(OutputPath)Dlls\$(MSBuildProjectName)\
true
- $(OutDir)Exes\$(MSBuildProjectName)\
+ $(OutputPath)Exes\$(MSBuildProjectName)\
true
- $(OutDir)Exes\$(MSBuildProjectName)\
+ $(OutputPath)Exes\$(MSBuildProjectName)\
@@ -114,7 +114,6 @@
- $(OutDir)
0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9
002400000480000094000000060200000024000052534131000400000100010055e0217eb635f69281051f9a823e0c7edd90f28063eb6c7a742a19b4f6139778ee0af438f47aed3b6e9f99838aa8dba689c7a71ddb860c96d923830b57bbd5cd6119406ddb9b002cf1c723bf272d6acbb7129e9d6dd5a5309c94e0ff4b2c884d45a55f475cd7dba59198086f61f5a8c8b5e601c0edbf269733f6f578fc8579c2
@@ -367,6 +366,7 @@
DeployPortableOnDeveloperBuild;$(PrepareResourcesDependsOn)
+ RemoveDuplicateXUnitContent;$(PrepareForBuildDependsOn)
$(IntermediateOutputPath)$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)
$(IntermediateOutputPath)$(TargetFileName).pcbm
$(NuGetPackageRoot)\RoslynDependencies.OptimizationData\2.0.0-rc-61101-16\content\OptimizationData
@@ -464,10 +464,29 @@
Targets="GetTargetPath"
BuildInParallel="true">
-
+
+
+
+
+
+
+
+
diff --git a/build/Targets/Roslyn.Toolsets.Xunit.targets b/build/Targets/Roslyn.Toolsets.Xunit.targets
index 4b837cd3fca06f0c9ded97dba5d9e6fd0b07409b..39950a76c6cf7027b382f7836d34cbe4c853471a 100644
--- a/build/Targets/Roslyn.Toolsets.Xunit.targets
+++ b/build/Targets/Roslyn.Toolsets.Xunit.targets
@@ -32,7 +32,5 @@
app.config
-
-
-
\ No newline at end of file
+
diff --git a/build/Targets/Settings.props b/build/Targets/Settings.props
index a702d4dd7508d0b750deae80ce422e0dfa77ee06..db50ab1d7abc9b38598dac62c3e39c9df0089edd 100644
--- a/build/Targets/Settings.props
+++ b/build/Targets/Settings.props
@@ -27,7 +27,7 @@
true
true
$(RepoRoot)Binaries\
- $(BaseOutputPath)$(Configuration)\
+ $(BaseOutputPath)$(Configuration)\
$(RepoRoot)Binaries\Obj\
$(BaseIntermediateOutputPath)$(Configuration)\$(MSBuildProjectName)\
@@ -47,7 +47,7 @@
$(VisualStudioVersion)
false
diff --git a/build/config/RepoUtilData.json b/build/config/RepoUtilData.json
index ebd46ab5a24634eafa6126fe4c8025cec24712b2..85ecd228dc5f7446f6cf090a44454212079e7ee5 100644
--- a/build/config/RepoUtilData.json
+++ b/build/config/RepoUtilData.json
@@ -50,7 +50,8 @@
"GitLink",
"Microsoft.NETCore.Runtime.CoreCLR",
"Microsoft.VSSDK.BuildTools",
- "NETStandard.Library"
+ "NETStandard.Library",
+ "FakeSign"
]
}
},
diff --git a/build/scripts/build-utils.ps1 b/build/scripts/build-utils.ps1
index c8c66eb70a275903d4e19de2054c72a64d1c2b91..2f24e9b2055a301793b96aeff9f202087778d16f 100644
--- a/build/scripts/build-utils.ps1
+++ b/build/scripts/build-utils.ps1
@@ -9,43 +9,89 @@ $ErrorActionPreference="Stop"
# Handy function for executing a command in powershell and throwing if it
# fails.
+#
+# Use this when the full command is known at script authoring time and
+# doesn't require any dynamic argument build up. Example:
+#
+# Exec-Block { & $msbuild Test.proj }
#
# Original sample came from: http://jameskovacs.com/2010/02/25/the-exec-problem/
-function Exec([scriptblock]$cmd, [switch]$echo = $false) {
- if ($echo) {
- & $cmd
- }
- else {
- $output = & $cmd
- }
+function Exec-Block([scriptblock]$cmd) {
+ & $cmd
# Need to check both of these cases for errors as they represent different items
# - $?: did the powershell script block throw an error
# - $lastexitcode: did a windows command executed by the script block end in error
if ((-not $?) -or ($lastexitcode -ne 0)) {
- if (-not $echo) {
- Write-Host $output
- }
throw "Command failed to execute: $cmd"
}
}
-function Exec-Echo([scriptblock]$cmd) {
- Exec $cmd -echo:$true
+# Handy function for executing a windows command which needs to go through
+# windows command line parsing.
+#
+# Use this when the command arguments are stored in a variable. Particularly
+# when the variable needs reparsing by the windows command line. Example:
+#
+# $args = "/p:ManualBuild=true Test.proj"
+# Exec-Command $msbuild $args
+#
+function Exec-Command([string]$command, [string]$commandArgs) {
+ $startInfo = New-Object System.Diagnostics.ProcessStartInfo
+ $startInfo.FileName = $command
+ $startInfo.Arguments = $commandArgs
+
+ $startInfo.RedirectStandardOutput = $true
+ $startInfo.UseShellExecute = $false
+ $startInfo.CreateNoWindow = $true
+
+ $process = New-Object System.Diagnostics.Process
+ $process.StartInfo = $startInfo
+ $process.StartInfo.RedirectStandardOutput = $true;
+ $process.Start() | Out-Null
+
+ $finished = $false
+ try {
+ # The OutputDataReceived event doesn't fire as events are sent by the
+ # process in powershell. Possibly due to subtlties of how Powershell
+ # manages the thread pool that I'm not aware of. Using blocking
+ # reading here as an alternative which is fine since this blocks
+ # on completion already.
+ $out = $process.StandardOutput
+ while (-not $out.EndOfStream) {
+ $line = $out.ReadLine()
+ Write-Output $line
+ }
+
+ while (-not $process.WaitForExit(100)) {
+ # Non-blocking loop done to allow ctr-c interrupts
+ }
+
+ $finished = $true
+ if ($process.ExitCode -ne 0) {
+ throw "Command failed to execute: $command $commandArgs"
+ }
+ }
+ finally {
+ # If we didn't finish then an error occured or the user hit ctrl-c. Either
+ # way kill the process
+ if (-not $finished) {
+ $process.Kill()
+ }
+ }
}
-# Handy function for executing Invoke-Expression and reliably throwing an
-# error if the expression, or the command it invoked, fails
-#
-# Original sample came from: http://jameskovacs.com/2010/02/25/the-exec-problem/
-function Exec-Expression([string]$expr) {
- Exec { Invoke-Expression $expr } -echo:$true
+# Handy function for executing a powershell script in a clean environment with
+# arguments. Prefer this over & sourcing a script as it will both use a clean
+# environment and do proper error checking
+function Exec-Script([string]$script, [string]$scriptArgs = "") {
+ Exec-Command "powershell" "-noprofile -executionPolicy RemoteSigned -file `"$script`" $scriptArgs"
}
# Ensure that NuGet is installed and return the path to the
# executable to use.
function Ensure-NuGet() {
- Exec { & (Join-Path $PSScriptRoot "download-nuget.ps1") }
+ Exec-Block { & (Join-Path $PSScriptRoot "download-nuget.ps1") } | Out-Host
$nuget = Join-Path $repoDir "NuGet.exe"
return $nuget
}
@@ -56,7 +102,7 @@ function Ensure-BasicTool([string]$name, [string]$version) {
$p = Join-Path (Get-PackagesDir) "$($name).$($version)"
if (-not (Test-Path $p)) {
$nuget = Ensure-NuGet
- Exec { & $nuget install $name -OutputDirectory (Get-PackagesDir) -Version $version }
+ Exec-Block { & $nuget install $name -OutputDirectory (Get-PackagesDir) -Version $version } | Out-Null
}
return $p
@@ -206,14 +252,14 @@ function Get-VisualStudioDir() {
# Clear out the NuGet package cache
function Clear-PackageCache() {
$nuget = Ensure-NuGet
- Exec { & $nuget locals all -clear }
+ Exec-Block { & $nuget locals all -clear } | Out-Host
}
# Restore a single project
function Restore-Project([string]$fileName, [string]$nuget, [string]$msbuildDir) {
$nugetConfig = Join-Path $repoDir "nuget.config"
$filePath = Join-Path $repoDir $fileName
- Exec { & $nuget restore -verbosity quiet -configfile $nugetConfig -MSBuildPath $msbuildDir -Project2ProjectTimeOut 1200 $filePath }
+ Exec-Block { & $nuget restore -verbosity quiet -configfile $nugetConfig -MSBuildPath $msbuildDir -Project2ProjectTimeOut 1200 $filePath } | Out-Null
}
# Restore all of the projects that the repo consumes
diff --git a/build/scripts/build.ps1 b/build/scripts/build.ps1
index b59fbd8b0b40b721c1f3beae9ee8a8964fbf503f..0c53de2ab25be81e0af290c3ddbbefc22b52df7b 100644
--- a/build/scripts/build.ps1
+++ b/build/scripts/build.ps1
@@ -4,6 +4,7 @@ param (
[switch]$build = $false,
[switch]$restore = $false,
[switch]$test = $false,
+ [switch]$test64 = $false,
[switch]$clean = $false,
[switch]$clearPackageCache = $false,
[string]$project = "",
@@ -17,7 +18,8 @@ function Print-Usage() {
Write-Host "Build.ps1"
Write-Host "`t-build Run a build operation (default false)"
Write-Host "`t-restore Run a restore operation (default false)"
- Write-Host "`t-test Run tests (default false)"
+ Write-Host "`t-test Run unit tests (default false)"
+ Write-Host "`t-test64 Run unit tests in 64 bit mode"
Write-Host "`t-clean Do a clean build / restore (default false)"
Write-Host "`t-clearPackageCache Clear package cache before restoring"
Write-Host "`t-project Project the build or restore should target"
@@ -33,12 +35,16 @@ function Run-Build() {
$target = if ($project -ne "") { $project } else { Join-Path $repoDir "Roslyn.sln" }
$buildArgs = "$buildArgs $target"
- Exec-Expression "& `"$msbuild`" $buildArgs"
+ Exec-Command $msbuild $buildArgs | Out-Host
}
function Run-Test() {
$proj = Join-Path $repoDir "BuildAndTest.proj"
- Exec-Expression "& `"$msbuild`" /v:m /p:SkipCoreClr=true /t:Test $proj"
+ $args = "/v:m /p:SkipCoreClr=true /p:ManualTest=true /t:Test $proj"
+ if ($test64) {
+ $args += " /p:Test64=true"
+ }
+ Exec-Command $msbuild $args | Out-Host
}
try {
@@ -68,7 +74,7 @@ try {
Run-Build
}
- if ($test) {
+ if ($test -or $test64) {
Run-Test
}
}
diff --git a/build/scripts/cibuild.ps1 b/build/scripts/cibuild.ps1
index a7916ead7132c98ded23d59941c30ba20c55bf3f..41a098b4580063615b0aefd3c5285c591bafa2f7 100644
--- a/build/scripts/cibuild.ps1
+++ b/build/scripts/cibuild.ps1
@@ -31,10 +31,12 @@ function Run-MSBuild() {
# that we do not reuse MSBuild nodes from other jobs/builds on the machine. Otherwise,
# we'll run into issues such as https://github.com/dotnet/roslyn/issues/6211.
# MSBuildAdditionalCommandLineArgs=
- & $msbuild /warnaserror /nologo /m /nodeReuse:false /consoleloggerparameters:Verbosity=minimal /filelogger /fileloggerparameters:Verbosity=normal @args
- if (-not $?) {
- throw "Build failed"
+ $buildArgs = "/warnaserror /nologo /m /nodeReuse:false /consoleloggerparameters:Verbosity=minimal /filelogger /fileloggerparameters:Verbosity=normal"
+ foreach ($arg in $args) {
+ $buildArgs += " $arg"
}
+
+ Exec-Command $msbuild $buildArgs
}
# Kill any instances VBCSCompiler.exe to release locked files, ignoring stderr if process is not open
@@ -87,14 +89,14 @@ try {
Redirect-Temp
if ($testBuildCorrectness) {
- Exec-Echo { & ".\build\scripts\test-build-correctness.ps1" -config $buildConfiguration }
+ Exec-Block { & ".\build\scripts\test-build-correctness.ps1" -config $buildConfiguration } | Out-Host
exit 0
}
# Output the commit that we're building, for reference in Jenkins logs
if (-not $skipCommitPrinting) {
Write-Host "Building this commit:"
- Exec { & git show --no-patch --pretty=raw HEAD }
+ Exec-Block { & git show --no-patch --pretty=raw HEAD } | Out-Host
}
# Build with the real assembly version, since that's what's contained in the bootstrap compiler redirects
@@ -108,14 +110,14 @@ try {
Terminate-BuildProcesses
if ($testDeterminism) {
- Exec { & ".\build\scripts\test-determinism.ps1" -buildDir $bootstrapDir }
+ Exec-Block { & ".\build\scripts\test-determinism.ps1" -buildDir $bootstrapDir } | Out-Host
Terminate-BuildProcesses
exit 0
}
if ($testPerfCorrectness) {
Run-MSBuild Roslyn.sln /p:Configuration=$buildConfiguration /p:DeployExtension=false
- Exec { & ".\Binaries\$buildConfiguration\Exes\Perf.Runner\Roslyn.Test.Performance.Runner.exe" --ci-test }
+ Exec-Block { & ".\Binaries\$buildConfiguration\Exes\Perf.Runner\Roslyn.Test.Performance.Runner.exe" --ci-test } | Out-Host
exit 0
}
@@ -140,7 +142,7 @@ try {
Create-Directory ".\Binaries\$buildConfiguration\tools\"
# Get the benchview tools - Place alongside Roslyn.Test.Performance.Runner.exe
- Exec { & ".\build\scripts\install_benchview_tools.cmd" ".\Binaries\$buildConfiguration\tools\" }
+ Exec-Block { & ".\build\scripts\install_benchview_tools.cmd" ".\Binaries\$buildConfiguration\tools\" } | Out-Host
}
Terminate-BuildProcesses
diff --git a/build/scripts/generate-compiler-code.ps1 b/build/scripts/generate-compiler-code.ps1
index 4ac3612f9f0375d144a35f7ce16f6e2113e24655..d9acdedfd0de1e58875205a47e007579d85f8900 100644
--- a/build/scripts/generate-compiler-code.ps1
+++ b/build/scripts/generate-compiler-code.ps1
@@ -14,10 +14,7 @@ function Run-Tool($tool, $toolArgs) {
throw "$tool does not exist"
}
- Exec-Expression "& `"$coreRun`" `"$tool`" $toolArgs"
- if ((-not $?) -or ($lastexitcode -ne 0)) {
- throw "Failed"
- }
+ Exec-Command "$coreRun" "`"$tool`" $toolArgs" | Out-Host
}
function Run-LanguageCore($language, $languageSuffix, $languageDir, $syntaxTool, $errorFactsTool, $generatedDir, $generatedTestDir) {
diff --git a/build/scripts/test-build-correctness.ps1 b/build/scripts/test-build-correctness.ps1
index 85b00ec69ce998d420968d505c525c9151748b9d..dd2055da0f9ce693fecc9e82c4d89509f5edf5ee 100644
--- a/build/scripts/test-build-correctness.ps1
+++ b/build/scripts/test-build-correctness.ps1
@@ -34,24 +34,24 @@ try {
}
Write-Host "Building Roslyn.sln with logging support"
- Exec-Echo { & $msbuild /v:m /m /logger:StructuredLogger`,$structuredLoggerPath`;$logPath /nodeReuse:false /p:DeployExtension=false Roslyn.sln }
+ Exec-Command $msbuild "/v:m /m /logger:StructuredLogger,$structuredLoggerPath;$logPath /nodeReuse:false /p:DeployExtension=false Roslyn.sln"
Write-Host ""
# Verify the state of our various build artifacts
Write-Host "Running BuildBoss"
$buildBossPath = Join-Path $configDir "Exes\BuildBoss\BuildBoss.exe"
- Exec-Echo { & $buildBossPath Roslyn.sln Compilers.sln src\Samples\Samples.sln CrossPlatform.sln "build\Targets" $logPath }
+ Exec-Command $buildBossPath "Roslyn.sln Compilers.sln src\Samples\Samples.sln CrossPlatform.sln build\Targets $logPath"
Write-Host ""
# Verify the state of our project.jsons
Write-Host "Running RepoUtil"
$repoUtilPath = Join-Path $configDir "Exes\RepoUtil\RepoUtil.exe"
- Exec-Echo { & $repoUtilPath verify }
+ Exec-Command $repoUtilPath verify
Write-Host ""
# Verify the state of our generated syntax files
Write-Host "Checking generated compiler files"
- Exec-Echo { & (Join-Path $PSScriptRoot "generate-compiler-code.ps1") -test }
+ Exec-Block { & (Join-Path $PSScriptRoot "generate-compiler-code.ps1") -test }
exit 0
}
diff --git a/build/scripts/test-determinism.ps1 b/build/scripts/test-determinism.ps1
index 93d178d868a37b7df08a4a921c21bd4c2f2c37b0..de59d2b6f71c26964aa31b8ea15cc7fb2de7efd2 100644
--- a/build/scripts/test-determinism.ps1
+++ b/build/scripts/test-determinism.ps1
@@ -37,12 +37,10 @@ function Run-Build() {
# Clean out the previous run
Write-Host "Cleaning the Binaries"
- Remove-Item -re -fo $debugDir
- Remove-Item -re -fo $objDir
- Exec {& $msbuild /nologo /v:m /nodeReuse:false /t:clean $sln }
+ Exec-Command $msbuild "/nologo /v:m /nodeReuse:false /t:clean $sln"
Write-Host "Building the Solution"
- Exec { & $msbuild /nologo /v:m /nodeReuse:false /m /p:DebugDeterminism=true /p:BootstrapBuildPath=$script:buildDir '/p:Features="debug-determinism;pdb-path-determinism"' /p:UseRoslynAnalyzers=false $pathMapBuildOption $sln }
+ Exec-Command $msbuild "/nologo /v:m /nodeReuse:false /m /p:DebugDeterminism=true /p:BootstrapBuildPath=$script:buildDir /p:Features=`"debug-determinism;pdb-path-determinism`" /p:UseRoslynAnalyzers=false $pathMapBuildOption $sln"
}
finally {
Pop-Location
diff --git a/docs/Language Feature Status.md b/docs/Language Feature Status.md
index fdc296f49a43ec34f96489f0c10a536ff270ad5a..0b296a6d7968f94f47b90610330b71a502bca50b 100644
--- a/docs/Language Feature Status.md
+++ b/docs/Language Feature Status.md
@@ -13,7 +13,7 @@ efforts behind them.
| [Async Main](https://github.com/dotnet/csharplang/blob/master/proposals/async-main.md) | [async-main](https://github.com/dotnet/roslyn/tree/features/async-main) | Prototype | [tyoverby](https://github.com/tyoverby) | [vsadov](https://github.com/vsadov) | [stephentoub](https://github.com/stephentoub) |
| [Default Expressions](https://github.com/dotnet/csharplang/blob/master/proposals/target-typed-default.md) | master | Merged | [jcouv](https://github.com/jcouv) | [cston](https://github.com/cston) | [jcouv](https://github.com/jcouv) |
| [Ref Assemblies](https://github.com/dotnet/roslyn/blob/features/refout/docs/features/refout.md) | [refout](https://github.com/dotnet/roslyn/tree/features/refout) | Integration & validation | [jcouv](https://github.com/jcouv) | [gafter](https://github.com/gafter) | N/A |
-| [Infer tuple names](https://github.com/dotnet/csharplang/blob/master/proposals/target-typed-default.md) | [tuple-names](https://github.com/dotnet/roslyn/tree/features/tuple-names) | Implementation | [jcouv](https://github.com/jcouv) | [gafter](https://github.com/gafter) | [jcouv](https://github.com/jcouv) |
+| [Infer tuple names](https://github.com/dotnet/csharplang/blob/master/proposals/tuple-names.md) | [tuple-names](https://github.com/dotnet/roslyn/tree/features/tuple-names) | Implementation | [jcouv](https://github.com/jcouv) | [gafter](https://github.com/gafter) | [jcouv](https://github.com/jcouv) |
# C# 7.2
diff --git a/docs/contributing/Powershell Guidelines.md b/docs/contributing/Powershell Guidelines.md
index 39e69363f6d935ff42d89230d246e2e7ff7bd740..bbdb1a1343c3e0c1e26d3542f1a326e7112b2054 100644
--- a/docs/contributing/Powershell Guidelines.md
+++ b/docs/contributing/Powershell Guidelines.md
@@ -88,26 +88,28 @@ to the invocation and removes the need for error prone if checking after every c
# DO NOT
& msbuild /v:m /m Roslyn.sln
# DO
-Exec { & msbuild /v:m /m Roslyn.sln }
+Exec-Block { & msbuild /v:m /m Roslyn.sln }
```
Note this will not work for the rare Windows commands which use 0 as an exit code on failure. For
example robocopy and corflags.
In some cases windows commands need to have their argument list built up dynamically. When that
-happens do not use Invoke-Expression to execute the command, instead use Exec-Expression. The former
-does not fail when the windows command fails and can lead to silent errors. The Exec-Expression
-will throw if the underlying expression or windows command fails.
+happens do not use Invoke-Expression to execute the command, instead use Exec-Command. The former
+does not fail when the windows command fails, can invoke powershell argument parsing and doesn't
+have a mechanism for echoing output to console. The Exec-Command uses Process directly and can support
+the major functionality needed.
``` powershell
-$command = "& msbuild /v:m Roslyn.sln"
+$command = "C:\Program Files (x86)\Microsoft Visual Studio\Preview\Dogfood\MSBuild\15.0\Bin\MSBuild.exe"
+$args = "/v:m Roslyn.sln"
if (...) {
- $command += " /fl /flp:v=diag"
+ $args += " /fl /flp:v=diag"
}
# DO NOT
-Invoke-Expression $command
+Invoke-Expression "& $command $args"
# DO
-Exec-Expression $command
+Exec-Command $command $args
```
diff --git a/src/Compilers/CSharp/Portable/BoundTree/DecisionTree.cs b/src/Compilers/CSharp/Portable/BoundTree/DecisionTree.cs
index df1322e973a3b30f527d7b5d81fd9a2e27ba698d..f1c1244c2ba446eb280e03c8fa82b595210df827 100644
--- a/src/Compilers/CSharp/Portable/BoundTree/DecisionTree.cs
+++ b/src/Compilers/CSharp/Portable/BoundTree/DecisionTree.cs
@@ -89,7 +89,7 @@ public static DecisionTree Create(BoundExpression expression, TypeSymbol type, S
{
// Unless it is a constant, the decision tree acts on a copy of the input expression.
// We create a temp to represent that copy. Lowering will assign into this temp.
- temp = new SynthesizedLocal(enclosingSymbol as MethodSymbol, type, SynthesizedLocalKind.PatternMatchingTemp, expression.Syntax, false, RefKind.None);
+ temp = new SynthesizedLocal(enclosingSymbol as MethodSymbol, type, SynthesizedLocalKind.PatternMatching, expression.Syntax, false, RefKind.None);
expression = new BoundLocal(expression.Syntax, temp, null, type);
}
diff --git a/src/Compilers/CSharp/Portable/BoundTree/DecisionTreeBuilder.cs b/src/Compilers/CSharp/Portable/BoundTree/DecisionTreeBuilder.cs
index 6253c6d194e4ea97cf7660b9de1db6b781f03c12..c2db5dbcacff4af4b8b1aa4c98e4ec2f25d2e2d4 100644
--- a/src/Compilers/CSharp/Portable/BoundTree/DecisionTreeBuilder.cs
+++ b/src/Compilers/CSharp/Portable/BoundTree/DecisionTreeBuilder.cs
@@ -237,7 +237,7 @@ private DecisionTree AddByValue(DecisionTree.ByType byType, BoundConstantPattern
if (forType == null)
{
var type = value.Value.Type;
- var localSymbol = new SynthesizedLocal(_enclosingSymbol as MethodSymbol, type, SynthesizedLocalKind.PatternMatchingTemp, Syntax, false, RefKind.None);
+ var localSymbol = new SynthesizedLocal(_enclosingSymbol as MethodSymbol, type, SynthesizedLocalKind.PatternMatching, Syntax, false, RefKind.None);
var narrowedExpression = new BoundLocal(Syntax, localSymbol, null, type);
forType = new DecisionTree.ByValue(narrowedExpression, value.Value.Type.TupleUnderlyingTypeOrSelf(), localSymbol);
byType.TypeAndDecision.Add(new KeyValuePair(value.Value.Type, forType));
@@ -329,7 +329,7 @@ private DecisionTree AddByType(DecisionTree.ByType byType, TypeSymbol type, Deci
if (result == null)
{
- var localSymbol = new SynthesizedLocal(_enclosingSymbol as MethodSymbol, type, SynthesizedLocalKind.PatternMatchingTemp, Syntax, false, RefKind.None);
+ var localSymbol = new SynthesizedLocal(_enclosingSymbol as MethodSymbol, type, SynthesizedLocalKind.PatternMatching, Syntax, false, RefKind.None);
var expression = new BoundLocal(Syntax, localSymbol, null, type);
result = makeDecision(expression, type);
Debug.Assert(result.Temp == null);
diff --git a/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncMethodToStateMachineRewriter.cs b/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncMethodToStateMachineRewriter.cs
index a79481a533cb3013b03f9f24b9e4f2c5d8790ff1..cc9ec0e6e2935f6146e41f7ece3e062a6f7df549 100644
--- a/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncMethodToStateMachineRewriter.cs
+++ b/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncMethodToStateMachineRewriter.cs
@@ -298,30 +298,15 @@ private BoundBlock VisitAwaitExpression(BoundAwaitExpression node, BoundExpressi
WellKnownMemberNames.GetResult,
resultsDiscarded: resultPlace == null);
- var nullAwaiter = F.AssignmentExpression(F.Local(awaiterTemp), F.NullOrDefault(awaiterTemp.Type));
- if (resultPlace != null && type.SpecialType != SpecialType.System_Void)
- {
- // $resultTemp = $awaiterTemp.GetResult();
- // $awaiterTemp = null;
- // $resultTemp
- LocalSymbol resultTemp = F.SynthesizedLocal(type);
- return F.Block(
- ImmutableArray.Create(awaiterTemp, resultTemp),
- awaitIfIncomplete,
- F.Assignment(F.Local(resultTemp), getResultCall),
- F.ExpressionStatement(nullAwaiter),
- F.Assignment(resultPlace, F.Local(resultTemp)));
- }
- else
- {
- // $awaiterTemp.GetResult();
- // $awaiterTemp = null;
- return F.Block(
- ImmutableArray.Create(awaiterTemp),
- awaitIfIncomplete,
- F.ExpressionStatement(getResultCall),
- F.ExpressionStatement(nullAwaiter));
- }
+ // [$resultPlace = ] $awaiterTemp.GetResult();
+ BoundStatement getResultStatement = resultPlace != null && type.SpecialType != SpecialType.System_Void ?
+ F.Assignment(resultPlace, getResultCall):
+ F.ExpressionStatement(getResultCall);
+
+ return F.Block(
+ ImmutableArray.Create(awaiterTemp),
+ awaitIfIncomplete,
+ getResultStatement);
}
private BoundExpression MakeCallMaybeDynamic(
diff --git a/src/Compilers/CSharp/Portable/Parser/LanguageParser.cs b/src/Compilers/CSharp/Portable/Parser/LanguageParser.cs
index 3c29dee6b81950e0031dabf8d48ee43a5b0c9db8..51099af4c439f9f805708352c42454d7db7f3f2f 100644
--- a/src/Compilers/CSharp/Portable/Parser/LanguageParser.cs
+++ b/src/Compilers/CSharp/Portable/Parser/LanguageParser.cs
@@ -5428,7 +5428,7 @@ private void ParseTypeArgumentList(out SyntaxToken open, SeparatedSyntaxListBuil
// remaining types & commas
while (true)
{
- if (this.CurrentToken.Kind == SyntaxKind.GreaterThanToken || this.IsPossibleTypeParameterConstraintClauseStart())
+ if (this.CurrentToken.Kind == SyntaxKind.GreaterThanToken)
{
break;
}
@@ -5459,11 +5459,6 @@ private PostSkipAction SkipBadTypeArgumentListTokens(SeparatedSyntaxListBuilder<
// Parses the individual generic parameter/arguments in a name.
private TypeSyntax ParseTypeArgument()
{
- if (this.IsPossibleTypeParameterConstraintClauseStart())
- {
- return this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_TypeExpected);
- }
-
var attrs = _pool.Allocate();
try
{
diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncEHTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncEHTests.cs
index 9b7d443dd7293dcd356e7cf38eaeeec08f328d8e..55f12adb9a61f42828e9a05d3351a10aa0def10d 100644
--- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncEHTests.cs
+++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncEHTests.cs
@@ -207,7 +207,7 @@ public static void Main()
CompileAndVerify(source, expectedOutput: expected).
VerifyIL("Test.d__0.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()", @"
{
- // Code size 867 (0x363)
+ // Code size 819 (0x333)
.maxstack 3
.locals init (int V_0,
int V_1,
@@ -245,11 +245,11 @@ .maxstack 3
IL_001d: ldloc.0
IL_001e: switch (
IL_0075,
- IL_00e8,
- IL_015b,
- IL_01ce,
- IL_0241,
- IL_02b4)
+ IL_00e0,
+ IL_014b,
+ IL_01b6,
+ IL_0221,
+ IL_028c)
IL_003b: call ""System.Runtime.CompilerServices.YieldAwaitable System.Threading.Tasks.Task.Yield()""
IL_0040: stloc.3
IL_0041: ldloca.s V_3
@@ -271,7 +271,7 @@ .maxstack 3
IL_0068: ldloca.s V_2
IL_006a: ldarg.0
IL_006b: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompletedd__0>(ref System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, ref Test.d__0)""
- IL_0070: leave IL_0362
+ IL_0070: leave IL_0332
IL_0075: ldarg.0
IL_0076: ldfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
IL_007b: stloc.2
@@ -285,305 +285,291 @@ .maxstack 3
IL_008c: stfld ""int Test.d__0.<>1__state""
IL_0091: ldloca.s V_2
IL_0093: call ""void System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.GetResult()""
- IL_0098: ldloca.s V_2
- IL_009a: initobj ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
- IL_00a0: ldarg.0
- IL_00a1: ldarg.0
- IL_00a2: ldfld ""int Test.d__0.5__1""
- IL_00a7: ldc.i4.1
- IL_00a8: add
- IL_00a9: stfld ""int Test.d__0.5__1""
- IL_00ae: call ""System.Runtime.CompilerServices.YieldAwaitable System.Threading.Tasks.Task.Yield()""
- IL_00b3: stloc.3
- IL_00b4: ldloca.s V_3
- IL_00b6: call ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter System.Runtime.CompilerServices.YieldAwaitable.GetAwaiter()""
- IL_00bb: stloc.2
- IL_00bc: ldloca.s V_2
- IL_00be: call ""bool System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.IsCompleted.get""
- IL_00c3: brtrue.s IL_0104
- IL_00c5: ldarg.0
- IL_00c6: ldc.i4.1
- IL_00c7: dup
- IL_00c8: stloc.0
- IL_00c9: stfld ""int Test.d__0.<>1__state""
- IL_00ce: ldarg.0
- IL_00cf: ldloc.2
- IL_00d0: stfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
+ IL_0098: ldarg.0
+ IL_0099: ldarg.0
+ IL_009a: ldfld ""int Test.d__0.5__1""
+ IL_009f: ldc.i4.1
+ IL_00a0: add
+ IL_00a1: stfld ""int Test.d__0.5__1""
+ IL_00a6: call ""System.Runtime.CompilerServices.YieldAwaitable System.Threading.Tasks.Task.Yield()""
+ IL_00ab: stloc.3
+ IL_00ac: ldloca.s V_3
+ IL_00ae: call ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter System.Runtime.CompilerServices.YieldAwaitable.GetAwaiter()""
+ IL_00b3: stloc.2
+ IL_00b4: ldloca.s V_2
+ IL_00b6: call ""bool System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.IsCompleted.get""
+ IL_00bb: brtrue.s IL_00fc
+ IL_00bd: ldarg.0
+ IL_00be: ldc.i4.1
+ IL_00bf: dup
+ IL_00c0: stloc.0
+ IL_00c1: stfld ""int Test.d__0.<>1__state""
+ IL_00c6: ldarg.0
+ IL_00c7: ldloc.2
+ IL_00c8: stfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
+ IL_00cd: ldarg.0
+ IL_00ce: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Test.d__0.<>t__builder""
+ IL_00d3: ldloca.s V_2
IL_00d5: ldarg.0
- IL_00d6: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Test.d__0.<>t__builder""
- IL_00db: ldloca.s V_2
- IL_00dd: ldarg.0
- IL_00de: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompletedd__0>(ref System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, ref Test.d__0)""
- IL_00e3: leave IL_0362
- IL_00e8: ldarg.0
- IL_00e9: ldfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
- IL_00ee: stloc.2
- IL_00ef: ldarg.0
- IL_00f0: ldflda ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
- IL_00f5: initobj ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
- IL_00fb: ldarg.0
- IL_00fc: ldc.i4.m1
- IL_00fd: dup
- IL_00fe: stloc.0
- IL_00ff: stfld ""int Test.d__0.<>1__state""
- IL_0104: ldloca.s V_2
- IL_0106: call ""void System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.GetResult()""
- IL_010b: ldloca.s V_2
- IL_010d: initobj ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
- IL_0113: ldarg.0
- IL_0114: ldarg.0
- IL_0115: ldfld ""int Test.d__0.5__1""
- IL_011a: ldc.i4.1
- IL_011b: add
- IL_011c: stfld ""int Test.d__0.5__1""
- IL_0121: call ""System.Runtime.CompilerServices.YieldAwaitable System.Threading.Tasks.Task.Yield()""
- IL_0126: stloc.3
- IL_0127: ldloca.s V_3
- IL_0129: call ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter System.Runtime.CompilerServices.YieldAwaitable.GetAwaiter()""
- IL_012e: stloc.2
- IL_012f: ldloca.s V_2
- IL_0131: call ""bool System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.IsCompleted.get""
- IL_0136: brtrue.s IL_0177
+ IL_00d6: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompletedd__0>(ref System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, ref Test.d__0)""
+ IL_00db: leave IL_0332
+ IL_00e0: ldarg.0
+ IL_00e1: ldfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
+ IL_00e6: stloc.2
+ IL_00e7: ldarg.0
+ IL_00e8: ldflda ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
+ IL_00ed: initobj ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
+ IL_00f3: ldarg.0
+ IL_00f4: ldc.i4.m1
+ IL_00f5: dup
+ IL_00f6: stloc.0
+ IL_00f7: stfld ""int Test.d__0.<>1__state""
+ IL_00fc: ldloca.s V_2
+ IL_00fe: call ""void System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.GetResult()""
+ IL_0103: ldarg.0
+ IL_0104: ldarg.0
+ IL_0105: ldfld ""int Test.d__0.5__1""
+ IL_010a: ldc.i4.1
+ IL_010b: add
+ IL_010c: stfld ""int Test.d__0.5__1""
+ IL_0111: call ""System.Runtime.CompilerServices.YieldAwaitable System.Threading.Tasks.Task.Yield()""
+ IL_0116: stloc.3
+ IL_0117: ldloca.s V_3
+ IL_0119: call ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter System.Runtime.CompilerServices.YieldAwaitable.GetAwaiter()""
+ IL_011e: stloc.2
+ IL_011f: ldloca.s V_2
+ IL_0121: call ""bool System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.IsCompleted.get""
+ IL_0126: brtrue.s IL_0167
+ IL_0128: ldarg.0
+ IL_0129: ldc.i4.2
+ IL_012a: dup
+ IL_012b: stloc.0
+ IL_012c: stfld ""int Test.d__0.<>1__state""
+ IL_0131: ldarg.0
+ IL_0132: ldloc.2
+ IL_0133: stfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
IL_0138: ldarg.0
- IL_0139: ldc.i4.2
- IL_013a: dup
- IL_013b: stloc.0
- IL_013c: stfld ""int Test.d__0.<>1__state""
- IL_0141: ldarg.0
- IL_0142: ldloc.2
- IL_0143: stfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
- IL_0148: ldarg.0
- IL_0149: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Test.d__0.<>t__builder""
- IL_014e: ldloca.s V_2
- IL_0150: ldarg.0
- IL_0151: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompletedd__0>(ref System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, ref Test.d__0)""
- IL_0156: leave IL_0362
- IL_015b: ldarg.0
- IL_015c: ldfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
- IL_0161: stloc.2
- IL_0162: ldarg.0
- IL_0163: ldflda ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
- IL_0168: initobj ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
+ IL_0139: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Test.d__0.<>t__builder""
+ IL_013e: ldloca.s V_2
+ IL_0140: ldarg.0
+ IL_0141: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompletedd__0>(ref System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, ref Test.d__0)""
+ IL_0146: leave IL_0332
+ IL_014b: ldarg.0
+ IL_014c: ldfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
+ IL_0151: stloc.2
+ IL_0152: ldarg.0
+ IL_0153: ldflda ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
+ IL_0158: initobj ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
+ IL_015e: ldarg.0
+ IL_015f: ldc.i4.m1
+ IL_0160: dup
+ IL_0161: stloc.0
+ IL_0162: stfld ""int Test.d__0.<>1__state""
+ IL_0167: ldloca.s V_2
+ IL_0169: call ""void System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.GetResult()""
IL_016e: ldarg.0
- IL_016f: ldc.i4.m1
- IL_0170: dup
- IL_0171: stloc.0
- IL_0172: stfld ""int Test.d__0.<>1__state""
- IL_0177: ldloca.s V_2
- IL_0179: call ""void System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.GetResult()""
- IL_017e: ldloca.s V_2
- IL_0180: initobj ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
- IL_0186: ldarg.0
- IL_0187: ldarg.0
- IL_0188: ldfld ""int Test.d__0.5__1""
- IL_018d: ldc.i4.1
- IL_018e: add
- IL_018f: stfld ""int Test.d__0.5__1""
- IL_0194: call ""System.Runtime.CompilerServices.YieldAwaitable System.Threading.Tasks.Task.Yield()""
- IL_0199: stloc.3
- IL_019a: ldloca.s V_3
- IL_019c: call ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter System.Runtime.CompilerServices.YieldAwaitable.GetAwaiter()""
- IL_01a1: stloc.2
- IL_01a2: ldloca.s V_2
- IL_01a4: call ""bool System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.IsCompleted.get""
- IL_01a9: brtrue.s IL_01ea
+ IL_016f: ldarg.0
+ IL_0170: ldfld ""int Test.d__0.5__1""
+ IL_0175: ldc.i4.1
+ IL_0176: add
+ IL_0177: stfld ""int Test.d__0.5__1""
+ IL_017c: call ""System.Runtime.CompilerServices.YieldAwaitable System.Threading.Tasks.Task.Yield()""
+ IL_0181: stloc.3
+ IL_0182: ldloca.s V_3
+ IL_0184: call ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter System.Runtime.CompilerServices.YieldAwaitable.GetAwaiter()""
+ IL_0189: stloc.2
+ IL_018a: ldloca.s V_2
+ IL_018c: call ""bool System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.IsCompleted.get""
+ IL_0191: brtrue.s IL_01d2
+ IL_0193: ldarg.0
+ IL_0194: ldc.i4.3
+ IL_0195: dup
+ IL_0196: stloc.0
+ IL_0197: stfld ""int Test.d__0.<>1__state""
+ IL_019c: ldarg.0
+ IL_019d: ldloc.2
+ IL_019e: stfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
+ IL_01a3: ldarg.0
+ IL_01a4: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Test.d__0.<>t__builder""
+ IL_01a9: ldloca.s V_2
IL_01ab: ldarg.0
- IL_01ac: ldc.i4.3
- IL_01ad: dup
- IL_01ae: stloc.0
- IL_01af: stfld ""int Test.d__0.<>1__state""
- IL_01b4: ldarg.0
- IL_01b5: ldloc.2
- IL_01b6: stfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
- IL_01bb: ldarg.0
- IL_01bc: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Test.d__0.<>t__builder""
- IL_01c1: ldloca.s V_2
- IL_01c3: ldarg.0
- IL_01c4: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompletedd__0>(ref System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, ref Test.d__0)""
- IL_01c9: leave IL_0362
- IL_01ce: ldarg.0
- IL_01cf: ldfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
- IL_01d4: stloc.2
- IL_01d5: ldarg.0
- IL_01d6: ldflda ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
- IL_01db: initobj ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
- IL_01e1: ldarg.0
- IL_01e2: ldc.i4.m1
- IL_01e3: dup
- IL_01e4: stloc.0
- IL_01e5: stfld ""int Test.d__0.<>1__state""
- IL_01ea: ldloca.s V_2
- IL_01ec: call ""void System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.GetResult()""
- IL_01f1: ldloca.s V_2
- IL_01f3: initobj ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
- IL_01f9: ldarg.0
- IL_01fa: ldarg.0
- IL_01fb: ldfld ""int Test.d__0.5__1""
- IL_0200: ldc.i4.1
- IL_0201: add
- IL_0202: stfld ""int Test.d__0.5__1""
- IL_0207: call ""System.Runtime.CompilerServices.YieldAwaitable System.Threading.Tasks.Task.Yield()""
- IL_020c: stloc.3
- IL_020d: ldloca.s V_3
- IL_020f: call ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter System.Runtime.CompilerServices.YieldAwaitable.GetAwaiter()""
- IL_0214: stloc.2
- IL_0215: ldloca.s V_2
- IL_0217: call ""bool System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.IsCompleted.get""
- IL_021c: brtrue.s IL_025d
- IL_021e: ldarg.0
- IL_021f: ldc.i4.4
- IL_0220: dup
- IL_0221: stloc.0
- IL_0222: stfld ""int Test.d__0.<>1__state""
- IL_0227: ldarg.0
- IL_0228: ldloc.2
- IL_0229: stfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
- IL_022e: ldarg.0
- IL_022f: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Test.d__0.<>t__builder""
- IL_0234: ldloca.s V_2
- IL_0236: ldarg.0
- IL_0237: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompletedd__0>(ref System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, ref Test.d__0)""
- IL_023c: leave IL_0362
- IL_0241: ldarg.0
- IL_0242: ldfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
- IL_0247: stloc.2
- IL_0248: ldarg.0
- IL_0249: ldflda ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
- IL_024e: initobj ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
- IL_0254: ldarg.0
- IL_0255: ldc.i4.m1
- IL_0256: dup
- IL_0257: stloc.0
- IL_0258: stfld ""int Test.d__0.<>1__state""
- IL_025d: ldloca.s V_2
- IL_025f: call ""void System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.GetResult()""
- IL_0264: ldloca.s V_2
- IL_0266: initobj ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
- IL_026c: ldarg.0
- IL_026d: ldarg.0
- IL_026e: ldfld ""int Test.d__0.5__1""
- IL_0273: ldc.i4.1
- IL_0274: add
- IL_0275: stfld ""int Test.d__0.5__1""
- IL_027a: call ""System.Runtime.CompilerServices.YieldAwaitable System.Threading.Tasks.Task.Yield()""
- IL_027f: stloc.3
- IL_0280: ldloca.s V_3
- IL_0282: call ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter System.Runtime.CompilerServices.YieldAwaitable.GetAwaiter()""
- IL_0287: stloc.2
- IL_0288: ldloca.s V_2
- IL_028a: call ""bool System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.IsCompleted.get""
- IL_028f: brtrue.s IL_02d0
- IL_0291: ldarg.0
- IL_0292: ldc.i4.5
- IL_0293: dup
- IL_0294: stloc.0
- IL_0295: stfld ""int Test.d__0.<>1__state""
- IL_029a: ldarg.0
- IL_029b: ldloc.2
- IL_029c: stfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
- IL_02a1: ldarg.0
- IL_02a2: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Test.d__0.<>t__builder""
- IL_02a7: ldloca.s V_2
- IL_02a9: ldarg.0
- IL_02aa: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompletedd__0>(ref System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, ref Test.d__0)""
- IL_02af: leave IL_0362
- IL_02b4: ldarg.0
- IL_02b5: ldfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
- IL_02ba: stloc.2
- IL_02bb: ldarg.0
- IL_02bc: ldflda ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
- IL_02c1: initobj ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
- IL_02c7: ldarg.0
- IL_02c8: ldc.i4.m1
- IL_02c9: dup
- IL_02ca: stloc.0
- IL_02cb: stfld ""int Test.d__0.<>1__state""
- IL_02d0: ldloca.s V_2
- IL_02d2: call ""void System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.GetResult()""
- IL_02d7: ldloca.s V_2
- IL_02d9: initobj ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
- IL_02df: ldarg.0
- IL_02e0: ldarg.0
- IL_02e1: ldfld ""int Test.d__0.5__1""
- IL_02e6: ldc.i4.1
- IL_02e7: add
- IL_02e8: stfld ""int Test.d__0.5__1""
- IL_02ed: leave.s IL_0302
+ IL_01ac: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompletedd__0>(ref System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, ref Test.d__0)""
+ IL_01b1: leave IL_0332
+ IL_01b6: ldarg.0
+ IL_01b7: ldfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
+ IL_01bc: stloc.2
+ IL_01bd: ldarg.0
+ IL_01be: ldflda ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
+ IL_01c3: initobj ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
+ IL_01c9: ldarg.0
+ IL_01ca: ldc.i4.m1
+ IL_01cb: dup
+ IL_01cc: stloc.0
+ IL_01cd: stfld ""int Test.d__0.<>1__state""
+ IL_01d2: ldloca.s V_2
+ IL_01d4: call ""void System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.GetResult()""
+ IL_01d9: ldarg.0
+ IL_01da: ldarg.0
+ IL_01db: ldfld ""int Test.d__0.5__1""
+ IL_01e0: ldc.i4.1
+ IL_01e1: add
+ IL_01e2: stfld ""int Test.d__0.5__1""
+ IL_01e7: call ""System.Runtime.CompilerServices.YieldAwaitable System.Threading.Tasks.Task.Yield()""
+ IL_01ec: stloc.3
+ IL_01ed: ldloca.s V_3
+ IL_01ef: call ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter System.Runtime.CompilerServices.YieldAwaitable.GetAwaiter()""
+ IL_01f4: stloc.2
+ IL_01f5: ldloca.s V_2
+ IL_01f7: call ""bool System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.IsCompleted.get""
+ IL_01fc: brtrue.s IL_023d
+ IL_01fe: ldarg.0
+ IL_01ff: ldc.i4.4
+ IL_0200: dup
+ IL_0201: stloc.0
+ IL_0202: stfld ""int Test.d__0.<>1__state""
+ IL_0207: ldarg.0
+ IL_0208: ldloc.2
+ IL_0209: stfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
+ IL_020e: ldarg.0
+ IL_020f: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Test.d__0.<>t__builder""
+ IL_0214: ldloca.s V_2
+ IL_0216: ldarg.0
+ IL_0217: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompletedd__0>(ref System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, ref Test.d__0)""
+ IL_021c: leave IL_0332
+ IL_0221: ldarg.0
+ IL_0222: ldfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
+ IL_0227: stloc.2
+ IL_0228: ldarg.0
+ IL_0229: ldflda ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
+ IL_022e: initobj ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
+ IL_0234: ldarg.0
+ IL_0235: ldc.i4.m1
+ IL_0236: dup
+ IL_0237: stloc.0
+ IL_0238: stfld ""int Test.d__0.<>1__state""
+ IL_023d: ldloca.s V_2
+ IL_023f: call ""void System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.GetResult()""
+ IL_0244: ldarg.0
+ IL_0245: ldarg.0
+ IL_0246: ldfld ""int Test.d__0.5__1""
+ IL_024b: ldc.i4.1
+ IL_024c: add
+ IL_024d: stfld ""int Test.d__0.5__1""
+ IL_0252: call ""System.Runtime.CompilerServices.YieldAwaitable System.Threading.Tasks.Task.Yield()""
+ IL_0257: stloc.3
+ IL_0258: ldloca.s V_3
+ IL_025a: call ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter System.Runtime.CompilerServices.YieldAwaitable.GetAwaiter()""
+ IL_025f: stloc.2
+ IL_0260: ldloca.s V_2
+ IL_0262: call ""bool System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.IsCompleted.get""
+ IL_0267: brtrue.s IL_02a8
+ IL_0269: ldarg.0
+ IL_026a: ldc.i4.5
+ IL_026b: dup
+ IL_026c: stloc.0
+ IL_026d: stfld ""int Test.d__0.<>1__state""
+ IL_0272: ldarg.0
+ IL_0273: ldloc.2
+ IL_0274: stfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
+ IL_0279: ldarg.0
+ IL_027a: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Test.d__0.<>t__builder""
+ IL_027f: ldloca.s V_2
+ IL_0281: ldarg.0
+ IL_0282: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompletedd__0>(ref System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, ref Test.d__0)""
+ IL_0287: leave IL_0332
+ IL_028c: ldarg.0
+ IL_028d: ldfld ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
+ IL_0292: stloc.2
+ IL_0293: ldarg.0
+ IL_0294: ldflda ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.d__0.<>u__1""
+ IL_0299: initobj ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
+ IL_029f: ldarg.0
+ IL_02a0: ldc.i4.m1
+ IL_02a1: dup
+ IL_02a2: stloc.0
+ IL_02a3: stfld ""int Test.d__0.<>1__state""
+ IL_02a8: ldloca.s V_2
+ IL_02aa: call ""void System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.GetResult()""
+ IL_02af: ldarg.0
+ IL_02b0: ldarg.0
+ IL_02b1: ldfld ""int Test.d__0.5__1""
+ IL_02b6: ldc.i4.1
+ IL_02b7: add
+ IL_02b8: stfld ""int Test.d__0.5__1""
+ IL_02bd: leave.s IL_02d2
}
finally
{
- IL_02ef: ldloc.0
- IL_02f0: ldc.i4.0
- IL_02f1: bge.s IL_0301
- IL_02f3: ldarg.0
- IL_02f4: ldarg.0
- IL_02f5: ldfld ""int Test.d__0.5__1""
- IL_02fa: ldc.i4.1
- IL_02fb: add
- IL_02fc: stfld ""int Test.d__0.5__1""
- IL_0301: endfinally
- }
- IL_0302: leave.s IL_0317
+ IL_02bf: ldloc.0
+ IL_02c0: ldc.i4.0
+ IL_02c1: bge.s IL_02d1
+ IL_02c3: ldarg.0
+ IL_02c4: ldarg.0
+ IL_02c5: ldfld ""int Test.d__0.5__1""
+ IL_02ca: ldc.i4.1
+ IL_02cb: add
+ IL_02cc: stfld ""int Test.d__0.5__1""
+ IL_02d1: endfinally
+ }
+ IL_02d2: leave.s IL_02e7
}
finally
{
- IL_0304: ldloc.0
- IL_0305: ldc.i4.0
- IL_0306: bge.s IL_0316
- IL_0308: ldarg.0
- IL_0309: ldarg.0
- IL_030a: ldfld ""int Test.d__0.5__1""
- IL_030f: ldc.i4.1
- IL_0310: add
- IL_0311: stfld ""int Test.d__0.5__1""
- IL_0316: endfinally
+ IL_02d4: ldloc.0
+ IL_02d5: ldc.i4.0
+ IL_02d6: bge.s IL_02e6
+ IL_02d8: ldarg.0
+ IL_02d9: ldarg.0
+ IL_02da: ldfld ""int Test.d__0.5__1""
+ IL_02df: ldc.i4.1
+ IL_02e0: add
+ IL_02e1: stfld ""int Test.d__0.5__1""
+ IL_02e6: endfinally
}
- IL_0317: leave.s IL_032c
+ IL_02e7: leave.s IL_02fc
}
finally
{
- IL_0319: ldloc.0
- IL_031a: ldc.i4.0
- IL_031b: bge.s IL_032b
- IL_031d: ldarg.0
- IL_031e: ldarg.0
- IL_031f: ldfld ""int Test.d__0.5__1""
- IL_0324: ldc.i4.1
- IL_0325: add
- IL_0326: stfld ""int Test.d__0.5__1""
- IL_032b: endfinally
- }
- IL_032c: ldarg.0
- IL_032d: ldfld ""int Test.d__0.5__1""
- IL_0332: stloc.1
- IL_0333: leave.s IL_034e
+ IL_02e9: ldloc.0
+ IL_02ea: ldc.i4.0
+ IL_02eb: bge.s IL_02fb
+ IL_02ed: ldarg.0
+ IL_02ee: ldarg.0
+ IL_02ef: ldfld ""int Test.d__0.5__1""
+ IL_02f4: ldc.i4.1
+ IL_02f5: add
+ IL_02f6: stfld ""int Test.d__0.5__1""
+ IL_02fb: endfinally
+ }
+ IL_02fc: ldarg.0
+ IL_02fd: ldfld ""int Test.d__0.5__1""
+ IL_0302: stloc.1
+ IL_0303: leave.s IL_031e
}
catch System.Exception
{
- IL_0335: stloc.s V_4
- IL_0337: ldarg.0
- IL_0338: ldc.i4.s -2
- IL_033a: stfld ""int Test.d__0.<>1__state""
- IL_033f: ldarg.0
- IL_0340: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Test.d__0.<>t__builder""
- IL_0345: ldloc.s V_4
- IL_0347: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetException(System.Exception)""
- IL_034c: leave.s IL_0362
+ IL_0305: stloc.s V_4
+ IL_0307: ldarg.0
+ IL_0308: ldc.i4.s -2
+ IL_030a: stfld ""int Test.d__0.<>1__state""
+ IL_030f: ldarg.0
+ IL_0310: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Test.d__0.<>t__builder""
+ IL_0315: ldloc.s V_4
+ IL_0317: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetException(System.Exception)""
+ IL_031c: leave.s IL_0332
}
- IL_034e: ldarg.0
- IL_034f: ldc.i4.s -2
- IL_0351: stfld ""int Test.d__0.<>1__state""
- IL_0356: ldarg.0
- IL_0357: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Test.d__0.<>t__builder""
- IL_035c: ldloc.1
- IL_035d: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult(int)""
- IL_0362: ret
+ IL_031e: ldarg.0
+ IL_031f: ldc.i4.s -2
+ IL_0321: stfld ""int Test.d__0.<>1__state""
+ IL_0326: ldarg.0
+ IL_0327: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Test.d__0.<>t__builder""
+ IL_032c: ldloc.1
+ IL_032d: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult(int)""
+ IL_0332: ret
}
-
");
}
-
-
+
[Fact, WorkItem(855080, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/855080")]
public void GenericCatchVariableInAsyncMethod()
{
@@ -745,7 +731,7 @@ public static void Main()
CompileAndVerify(source, expectedOutput: expected).
VerifyIL("Test.d__1.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()", @"
{
- // Code size 221 (0xdd)
+ // Code size 210 (0xd2)
.maxstack 3
.locals init (int V_0,
int V_1,
@@ -758,7 +744,7 @@ .maxstack 3
.try
{
IL_0007: ldloc.0
- IL_0008: brfalse.s IL_005b
+ IL_0008: brfalse.s IL_0058
IL_000a: ldarg.0
IL_000b: ldnull
IL_000c: stfld ""object Test.d__1.<>7__wrap1""
@@ -782,7 +768,7 @@ .maxstack 3
IL_002e: stloc.3
IL_002f: ldloca.s V_3
IL_0031: call ""bool System.Runtime.CompilerServices.TaskAwaiter.IsCompleted.get""
- IL_0036: brtrue.s IL_0077
+ IL_0036: brtrue.s IL_0074
IL_0038: ldarg.0
IL_0039: ldc.i4.0
IL_003a: dup
@@ -796,61 +782,59 @@ .maxstack 3
IL_004e: ldloca.s V_3
IL_0050: ldarg.0
IL_0051: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompleted, Test.d__1>(ref System.Runtime.CompilerServices.TaskAwaiter, ref Test.d__1)""
- IL_0056: leave IL_00dc
- IL_005b: ldarg.0
- IL_005c: ldfld ""System.Runtime.CompilerServices.TaskAwaiter Test.d__1.<>u__1""
- IL_0061: stloc.3
- IL_0062: ldarg.0
- IL_0063: ldflda ""System.Runtime.CompilerServices.TaskAwaiter Test.d__1.<>u__1""
- IL_0068: initobj ""System.Runtime.CompilerServices.TaskAwaiter""
- IL_006e: ldarg.0
- IL_006f: ldc.i4.m1
- IL_0070: dup
- IL_0071: stloc.0
- IL_0072: stfld ""int Test.d__1.<>1__state""
- IL_0077: ldloca.s V_3
- IL_0079: call ""int System.Runtime.CompilerServices.TaskAwaiter.GetResult()""
- IL_007e: ldloca.s V_3
- IL_0080: initobj ""System.Runtime.CompilerServices.TaskAwaiter""
- IL_0086: ldarg.0
- IL_0087: ldfld ""object Test.d__1.<>7__wrap1""
- IL_008c: stloc.2
- IL_008d: ldloc.2
- IL_008e: brfalse.s IL_00a5
- IL_0090: ldloc.2
- IL_0091: isinst ""System.Exception""
- IL_0096: dup
- IL_0097: brtrue.s IL_009b
- IL_0099: ldloc.2
- IL_009a: throw
- IL_009b: call ""System.Runtime.ExceptionServices.ExceptionDispatchInfo System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(System.Exception)""
- IL_00a0: callvirt ""void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()""
- IL_00a5: ldarg.0
- IL_00a6: ldnull
- IL_00a7: stfld ""object Test.d__1.<>7__wrap1""
- IL_00ac: stloc.1
- IL_00ad: leave.s IL_00c8
+ IL_0056: leave.s IL_00d1
+ IL_0058: ldarg.0
+ IL_0059: ldfld ""System.Runtime.CompilerServices.TaskAwaiter Test.d__1.<>u__1""
+ IL_005e: stloc.3
+ IL_005f: ldarg.0
+ IL_0060: ldflda ""System.Runtime.CompilerServices.TaskAwaiter Test.d__1.<>u__1""
+ IL_0065: initobj ""System.Runtime.CompilerServices.TaskAwaiter""
+ IL_006b: ldarg.0
+ IL_006c: ldc.i4.m1
+ IL_006d: dup
+ IL_006e: stloc.0
+ IL_006f: stfld ""int Test.d__1.<>1__state""
+ IL_0074: ldloca.s V_3
+ IL_0076: call ""int System.Runtime.CompilerServices.TaskAwaiter.GetResult()""
+ IL_007b: ldarg.0
+ IL_007c: ldfld ""object Test.d__1.<>7__wrap1""
+ IL_0081: stloc.2
+ IL_0082: ldloc.2
+ IL_0083: brfalse.s IL_009a
+ IL_0085: ldloc.2
+ IL_0086: isinst ""System.Exception""
+ IL_008b: dup
+ IL_008c: brtrue.s IL_0090
+ IL_008e: ldloc.2
+ IL_008f: throw
+ IL_0090: call ""System.Runtime.ExceptionServices.ExceptionDispatchInfo System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(System.Exception)""
+ IL_0095: callvirt ""void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()""
+ IL_009a: ldarg.0
+ IL_009b: ldnull
+ IL_009c: stfld ""object Test.d__1.<>7__wrap1""
+ IL_00a1: stloc.1
+ IL_00a2: leave.s IL_00bd
}
catch System.Exception
{
- IL_00af: stloc.s V_4
- IL_00b1: ldarg.0
- IL_00b2: ldc.i4.s -2
- IL_00b4: stfld ""int Test.d__1.<>1__state""
- IL_00b9: ldarg.0
- IL_00ba: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Test.d__1.<>t__builder""
- IL_00bf: ldloc.s V_4
- IL_00c1: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetException(System.Exception)""
- IL_00c6: leave.s IL_00dc
+ IL_00a4: stloc.s V_4
+ IL_00a6: ldarg.0
+ IL_00a7: ldc.i4.s -2
+ IL_00a9: stfld ""int Test.d__1.<>1__state""
+ IL_00ae: ldarg.0
+ IL_00af: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Test.d__1.<>t__builder""
+ IL_00b4: ldloc.s V_4
+ IL_00b6: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetException(System.Exception)""
+ IL_00bb: leave.s IL_00d1
}
- IL_00c8: ldarg.0
- IL_00c9: ldc.i4.s -2
- IL_00cb: stfld ""int Test.d__1.<>1__state""
- IL_00d0: ldarg.0
- IL_00d1: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Test.d__1.<>t__builder""
- IL_00d6: ldloc.1
- IL_00d7: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult(int)""
- IL_00dc: ret
+ IL_00bd: ldarg.0
+ IL_00be: ldc.i4.s -2
+ IL_00c0: stfld ""int Test.d__1.<>1__state""
+ IL_00c5: ldarg.0
+ IL_00c6: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Test.d__1.<>t__builder""
+ IL_00cb: ldloc.1
+ IL_00cc: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult(int)""
+ IL_00d1: ret
}
");
}
@@ -993,16 +977,16 @@ public static void Main()
v.VerifyIL("Test.d__1.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext", @"
{
- // Code size 481 (0x1e1)
+ // Code size 461 (0x1cd)
.maxstack 3
.locals init (int V_0,
int V_1,
System.Runtime.CompilerServices.TaskAwaiter V_2,
- int V_3,
- Test.d__1 V_4,
- object V_5,
- System.Runtime.CompilerServices.TaskAwaiter V_6,
- System.Exception V_7)
+ Test.d__1 V_3,
+ object V_4,
+ System.Runtime.CompilerServices.TaskAwaiter V_5,
+ System.Exception V_6,
+ int V_7)
~IL_0000: ldarg.0
IL_0001: ldfld ""int Test.d__1.<>1__state""
IL_0006: stloc.0
@@ -1016,7 +1000,7 @@ .maxstack 3
IL_000e: beq.s IL_0014
IL_0010: br.s IL_0019
IL_0012: br.s IL_002f
- IL_0014: br IL_0121
+ IL_0014: br IL_0115
-IL_0019: nop
-IL_001a: ldarg.0
IL_001b: ldc.i4.0
@@ -1033,14 +1017,14 @@ .maxstack 3
~IL_0030: ldloc.0
IL_0031: brfalse.s IL_0035
IL_0033: br.s IL_0037
- IL_0035: br.s IL_0074
+ IL_0035: br.s IL_0073
-IL_0037: nop
-IL_0038: call ""System.Threading.Tasks.Task Test.F()""
IL_003d: callvirt ""System.Runtime.CompilerServices.TaskAwaiter System.Threading.Tasks.Task.GetAwaiter()""
IL_0042: stloc.2
~IL_0043: ldloca.s V_2
IL_0045: call ""bool System.Runtime.CompilerServices.TaskAwaiter