We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BoundConversion
Version Used: 80b8a9b
Steps to Reproduce:
compile and run:
using System; using System.Linq; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; var text = @" using System; using System.Runtime.CompilerServices; using System.Threading.Tasks; MyAwaitable Get() { return new MyAwaitable(); } var x = Get(); x.SetValue(42); Console.WriteLine(await x + ""!""); struct MyAwaitable { private ValueTask<int> task; private TaskCompletionSource<int> source; private TaskCompletionSource<int> Source { get { if (source == null) { source = new TaskCompletionSource<int>(); task = new ValueTask<int>(source.Task); } return source; } } internal ValueTask<int> Task { get { _ = Source; return task; } } public void SetValue(int i) { Source.SetResult(i); } } static class MyAwaitableExtension { public static System.Runtime.CompilerServices.ValueTaskAwaiter<int> GetAwaiter(this MyAwaitable a) { return a.Task.GetAwaiter(); } } "; var tree = SyntaxTree(ParseCompilationUnit(text)); var refApis = AppDomain.CurrentDomain.GetAssemblies().Select(a => MetadataReference.CreateFromFile(a.Location)); var com = CSharpCompilation.Create("something", new []{ tree }, refApis ); var diag =com.GetDiagnostics().Where(e => e.Severity == DiagnosticSeverity.Error).ToList(); foreach(var d in diag) { Console.WriteLine(d); } var model = com.GetSemanticModel(tree); var awaitExpression = tree.GetRoot().DescendantNodes().OfType<AwaitExpressionSyntax>().First(); var awaitInfo = model.GetAwaitExpressionInfo(awaitExpression); Console.WriteLine(awaitInfo.GetAwaiterMethod == null);
Expected Behavior: Roslyn should find / return the GetAwaiterMethod - it should print False.
GetAwaiterMethod
False
Actual Behavior: GetAwaiterMethod is null - it prints True
True
The text was updated successfully, but these errors were encountered:
Bugfix: GetAwaitExpressionInfo ignores BoundConversion (#54296)
9193177
fixes #54298 Bugfix to handle "BoundConversion"
Successfully merging a pull request may close this issue.
Version Used: 80b8a9b
Steps to Reproduce:
compile and run:
Expected Behavior:
Roslyn should find / return the
GetAwaiterMethod
- it should printFalse
.Actual Behavior:
GetAwaiterMethod
is null - it printsTrue
The text was updated successfully, but these errors were encountered: