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

"Ensure Event Failed" when generating event handler with "New Event Handler" option #1348

Closed
1 of 9 tasks
riandika-lumaris opened this issue Aug 7, 2019 · 16 comments
Closed
1 of 9 tasks
Labels
area/vswin Categorizes an issue or PR as relevant to Visual Studio for Windows blocked/vs Categorizes an issue as blocked by a Visual Studio problem

Comments

@riandika-lumaris
Copy link

Current behavior

When editing XAML file in VS 2019, generating event handler with "New Event Handler" options works for the first time, then it shows "Ensure Event Failed" after that. I need to close and reopen the xaml as the workaround.

Expected behavior

The options should work without "Ensure Event Failed" error.

How to reproduce it (as minimally and precisely as possible)

  1. Open xaml file
  2. Generate event handler in any component using "New Event Handler" option
  3. Repeat step 2 again then error shown

Environment

Nuget Package:

Package Version(s): 1.45.0

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • Windows
  • Build tasks

Visual Studio

  • 2017 (version: )
  • 2019 (version: 16.2)
  • for Mac (version: )

Relevant plugins

  • Resharper (version: )

Anything else we need to know?

@riandika-lumaris riandika-lumaris added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Aug 7, 2019
@ghuntley ghuntley added the area/vswin Categorizes an issue or PR as relevant to Visual Studio for Windows label Aug 8, 2019
@ghuntley
Copy link
Member

ghuntley commented Aug 8, 2019

Howdy @riandika-lumaris, this sounds like a bug in visual studio for windows. Can you please reproduce the problem and use the menus within Visual Studio to report it to Microsoft?

image

ps. Out of interest are you using a shared project?

@ghuntley ghuntley added triage/needs-information Indicates an issue needs more information in order to work on it. and removed triage/untriaged Indicates an issue requires triaging or verification kind/bug Something isn't working labels Aug 8, 2019
@ghuntley ghuntley closed this as completed Aug 8, 2019
@ghuntley ghuntley removed the triage/needs-information Indicates an issue needs more information in order to work on it. label Aug 8, 2019
@riandika-lumaris
Copy link
Author

I don't think it is a bug from VS because the option works perfectly with pure UWP Solution.

And yes, there is a shared project because I use the uno extension to create the solution.

@ghuntley
Copy link
Member

ghuntley commented Aug 9, 2019

The "New Event Handler" functionality comes from VSWIN, I've got a hunch that you'd be able to reproduce this with a pure UWP solution that uses shared projects. So many things are changing under the hood of VSWIN at the moment. Typically, I'm raising 1 to 3 new feedback items every week. Uno has a meta ticket open at #982, when you raise your feedback item can you please comment on it? Cheers.

@ghuntley
Copy link
Member

ghuntley commented Aug 12, 2019

Howdy @riandika-lumaris. I experienced this today and can confirm that it isn't a problem with Uno, it's a defect in vswin and shared projects. "Ensure Event Failed" appears when generating a new event handler on UWP when using Shared Projects. It does not happen when using a UWP class library.

Have opened https://developercommunity.visualstudio.com/content/problem/690015/uwp-ensure-event-failed-when-creating-new-event-ha.html. Could you drop on by and give it a 👍? Cheers.

Developer Community for Visual Studio Product family

@ivanjx
Copy link

ivanjx commented Dec 22, 2019

is there any way to add event to controls from xaml?

@jeromelaban
Copy link
Member

@realivanjx it depends on the version of visual studio, but recent ones, (e.g. VS 16.5 preview) seems to improve the situation.

@MikiraSora
Copy link

It still exist in vs2019 16.5

@yoshiask
Copy link

@jeromelaban This issue still exists in VS 2019 16.6. This is an incredibly annoying bug, and the issue over on Developer Community was closed just over a year ago with no solution or workaround.

@jeromelaban jeromelaban reopened this Sep 17, 2020
@ElyasMTarek
Copy link

I started working with UNO today and ran into the same problem. Is there a workaround or do I need to write the handlers manually?

@jeromelaban
Copy link
Member

@ElyasMTarek for now, no. There isn't a fix for this, though you can use the {x:Bind} event syntax for easier method authoring. See this document for details on how to use it.

@ElyasMTarek
Copy link

@jeromelaban Thanks for the advice. Hope this will get fixed in near future tho.

@n1xn
Copy link

n1xn commented Sep 20, 2020

I have the same problem, any updates to this?

@richkisic
Copy link

Bug is still in Visual Studio 2019 16.8. Agreed this is a very frustrating bug.
eef

@rizaanlakay
Copy link

Please fix this. It is really annoying.

@MartinZikmund
Copy link
Member

This problem is unfortunately caused by Visual Studio, please help us by sending feedback there and upvoting the linked issue in WinUI.

@MartinZikmund MartinZikmund removed the difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. label Jun 4, 2021
@MartinZikmund MartinZikmund added the blocked/vs Categorizes an issue as blocked by a Visual Studio problem label Jun 4, 2021
@jeromelaban
Copy link
Member

This is fixed in our latest 4.7 templates, using .NET 7 and WinAppSDK,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/vswin Categorizes an issue or PR as relevant to Visual Studio for Windows blocked/vs Categorizes an issue as blocked by a Visual Studio problem
Projects
None yet
Development

No branches or pull requests