Skip to content
New issue

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

await completion adds async to unrelated local function instead of the containing method declaration #67952

Closed
Youssef1313 opened this issue Apr 25, 2023 · 0 comments · Fixed by #75517
Assignees
Labels
Milestone

Comments

@Youssef1313
Copy link
Member

I had a code like this:

		[TestMethod]
		public void Test()
		{
			var logs = new List<string>();
			var image = new Image();
			var bitmapImage = new BitmapImage(new Uri("ms-appx:///Assets/test_image_100_150.png"));
			bitmapImage.ImageFailed += BitmapImage_ImageFailed;
			bitmapImage.DownloadProgress += BitmapImage_DownloadProgress;
			bitmapImage.ImageOpened += BitmapImage_ImageOpened;
			image.ImageFailed += Image_ImageFailed;
			image.ImageOpened += Image_ImageOpened;
			var imageOpened = false;

			void BitmapImage_ImageFailed(object sender, ExceptionRoutedEventArgs e) => logs.Add("BitmapImage_ImageFailed");
			void BitmapImage_DownloadProgress(object sender, DownloadProgressEventArgs e) => logs.Add("BitmapImage_DownloadProgress");
			void BitmapImage_ImageOpened(object sender, RoutedEventArgs e) => logs.Add("BitmapImage_ImageOpened");
			void Image_ImageFailed(object sender, ExceptionRoutedEventArgs e) => logs.Add("Image_ImageFailed");
			void Image_ImageOpened(object sender, RoutedEventArgs e)
			{
				logs.Add("Image_ImageOpened");
				imageOpened = true;
			}

			$$ TestServices.WindowHelper.WaitFor(() => imageOpened);
		}

Invoke await completion in place of $$.

Image_ImageOpened will be async instead of Test

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 25, 2023
@arunchndr arunchndr added this to the 17.8 P4 milestone Aug 3, 2023
@arunchndr arunchndr removed the untriaged Issues and PRs which have not yet been triaged by a lead label Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants