// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
varcomp=CSharpTestBaseBase.CreateCompilation(source,new[]{MscorlibRef},TestOptions.ReleaseDll);// NOTE: 4.0, not 4.5, so it's missing the async helpers.
varcomp=CSharpTestBaseBase.CreateCompilation(source,new[]{MscorlibRef},TestOptions.ReleaseDll);// NOTE: 4.0, not 4.5, so it's missing the async helpers.
varcomp=CSharpTestBaseBase.CreateCompilation(source,new[]{MscorlibRef},TestOptions.ReleaseDll);// NOTE: 4.0, not 4.5, so it's missing the async helpers.
comp.VerifyEmitDiagnostics(
// (4,16): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
varcomp=CSharpTestBaseBase.CreateCompilation(source,new[]{MscorlibRef},TestOptions.ReleaseDll);// NOTE: 4.0, not 4.5, so it's missing the async helpers.
comp.VerifyEmitDiagnostics(
// (4,21): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
Assert.Equal("((MyTask a, T b) c, MyTask<(U, MyTask<T>)[]> d)",type.ToTestDisplayString());
Assert.Equal("((System.Threading.Tasks.Task a, T b) c, System.Threading.Tasks.Task<(U, System.Threading.Tasks.Task<T>)[]> d)",normalized.ToTestDisplayString());
BC31091:Importoftype'AsyncVoidMethodBuilder' from assembly or module 'AsyncVoid.dll' failed.
BC31091:Importoftype'AsyncVoidMethodBuilder' from assembly or module 'Async.dll' failed.
AsyncSubM()
AsyncSubM()
~~~~~~~~~~~~~~
~~~~~~~~~~~~~~
BC31091:Importoftype'AsyncVoidMethodBuilder' from assembly or module 'Async.dll' failed.
BC31091:Importoftype'AsyncVoidMethodBuilder' from assembly or module 'AsyncVoid.dll' failed.
AsyncSubM()
AsyncSubM()
~~~~~~~~~~~~~~
~~~~~~~~~~~~~~
BC31091:Importoftype'IAsyncStateMachine' from assembly or module 'Async.dll' failed.
BC31091:Importoftype'IAsyncStateMachine' from assembly or module 'AsyncVoid.dll' failed.
AsyncSubM()
AsyncSubM()
~~~~~~~~~~~~~~
~~~~~~~~~~~~~~
BC35000:Requestedoperationisnotavailablebecausetheruntimelibraryfunction'System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext' is not defined.
BC35000:Requestedoperationisnotavailablebecausetheruntimelibraryfunction'System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext' is not defined.
...
@@ -8437,8 +8436,80 @@ BC35000: Requested operation is not available because the runtime library functi
...
@@ -8437,8 +8436,80 @@ BC35000: Requested operation is not available because the runtime library functi
BC42356:Thisasyncmethodlacks'Await' operators and so will run synchronously. Consider using the 'Await' operator to await non-blocking API calls, or 'Await Task.Run(...)' to do CPU-bound work on a background thread.
BC42356:Thisasyncmethodlacks'Await' operators and so will run synchronously. Consider using the 'Await' operator to await non-blocking API calls, or 'Await Task.Run(...)' to do CPU-bound work on a background thread.
AsyncSubM()
AsyncSubM()
~
~
</errors>)
</errors>)
EndUsing
EndSub
<Fact>
PublicSubMissingAsyncTaskMethodBuilder()
Dimsource=
<compilationname="AsyncTask">
<filename="a.vb">
ImportsSystem.Threading.Tasks
PublicClassTestCase
AsyncFunctionM()AsTask
EndFunction
EndClass
</file>
</compilation>
Dimcomp=CreateCompilationWithReferences(source,{MscorlibRef},TestOptions.ReleaseDll)' NOTE: 4.0, Not 4.5, so it's missing the async helpers.
comp.AssertTheseEmitDiagnostics(
<errors>
BC31091:Importoftype'AsyncTaskMethodBuilder' from assembly or module 'AsyncTask.dll' failed.
AsyncFunctionM()AsTask
~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC31091:Importoftype'AsyncTaskMethodBuilder' from assembly or module 'AsyncTask.dll' failed.
AsyncFunctionM()AsTask
~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC31091:Importoftype'IAsyncStateMachine' from assembly or module 'AsyncTask.dll' failed.
AsyncFunctionM()AsTask
~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC35000:Requestedoperationisnotavailablebecausetheruntimelibraryfunction'System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext' is not defined.
AsyncFunctionM()AsTask
~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC35000:Requestedoperationisnotavailablebecausetheruntimelibraryfunction'System.Runtime.CompilerServices.IAsyncStateMachine.SetStateMachine' is not defined.
AsyncFunctionM()AsTask
~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42356:Thisasyncmethodlacks'Await' operators and so will run synchronously. Consider using the 'Await' operator to await non-blocking API calls, or 'Await Task.Run(...)' to do CPU-bound work on a background thread.
AsyncFunctionM()AsTask
~
</errors>)
EndSub
<Fact>
PublicSubMissingAsyncTaskMethodBuilder_T()
Dimsource=
<compilationname="AsyncTask_T">
<filename="a.vb">
ImportsSystem.Threading.Tasks
PublicClassTestCase
AsyncFunctionM()AsTask(OfInteger)
Return3
EndFunction
EndClass
</file>
</compilation>
Dimcomp=CreateCompilationWithReferences(source,{MscorlibRef},TestOptions.ReleaseDll)' NOTE: 4.0, Not 4.5, so it's missing the async helpers.
comp.AssertTheseEmitDiagnostics(
<errors>
BC31091:Importoftype'AsyncTaskMethodBuilder(Of )' from assembly or module 'AsyncTask_T.dll' failed.
AsyncFunctionM()AsTask(OfInteger)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC31091:Importoftype'AsyncTaskMethodBuilder(Of )' from assembly or module 'AsyncTask_T.dll' failed.
AsyncFunctionM()AsTask(OfInteger)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC31091:Importoftype'IAsyncStateMachine' from assembly or module 'AsyncTask_T.dll' failed.
AsyncFunctionM()AsTask(OfInteger)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC35000:Requestedoperationisnotavailablebecausetheruntimelibraryfunction'System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext' is not defined.
AsyncFunctionM()AsTask(OfInteger)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC35000:Requestedoperationisnotavailablebecausetheruntimelibraryfunction'System.Runtime.CompilerServices.IAsyncStateMachine.SetStateMachine' is not defined.
AsyncFunctionM()AsTask(OfInteger)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42356:Thisasyncmethodlacks'Await' operators and so will run synchronously. Consider using the 'Await' operator to await non-blocking API calls, or 'Await Task.Run(...)' to do CPU-bound work on a background thread.