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

TeachingTip throws exception when calling isOpen #6393

Closed
1 of 2 tasks
hgreer93 opened this issue Nov 28, 2021 · 8 comments
Closed
1 of 2 tasks

TeachingTip throws exception when calling isOpen #6393

hgreer93 opened this issue Nov 28, 2021 · 8 comments
Labels

Comments

@hgreer93
Copy link

hgreer93 commented Nov 28, 2021

Describe the bug

This bug appears to be extremely similar to this (#349).

When running under a debugger calling IsOpen(true) on a TeachingTip seems to crash the application. Application runs fine when not under the debugger.

Currently have the WinUI 2022 extension, fresh install on both Visual Studio 2022 and the extension. Followed steps listed here to create an unpackaged C++ application.

Steps to reproduce the bug

TeachingTip XAML copied from the WinUI control gallery sample:

<TeachingTip x:Name="ToggleThemeTeachingTip2"                 
	    Title="Change themes without hassle"
	    Subtitle="It's easier than ever to see control samples in both light and dark theme!"
	    PreferredPlacement="Auto"                                              
	    PlacementMargin="20"
	    IsLightDismissEnabled="True"
	    ActionButtonClick="ToggleThemeTeachingTip2_ActionButtonClick"
	    ActionButtonContent="Toggle theme now"
	    CloseButtonContent="Got it!"/>
        <Button x:Name="myButton" Click="myButton_Click">Click Me</Button>

C++

   void MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&)
    {
        myButton().Content(box_value(L"Clicked"));
        ToggleThemeTeachingTip2().IsOpen(true);
    }

Expected behavior

The application should not crash and the TeachingTip control should appear.

Screenshots

Edit: Forgot to add symbols to VS, here is a better callstack
WinUI Error2

NuGet package version

WinUI 3 - Windows App SDK 1.0 (If you're seeing your issue in older previews of WinUI 3, please try this release)

Windows app type

  • UWP
  • Win32

Device form factor

Desktop

Windows version

May 2021 Update (19043)

Additional context

No response

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Nov 28, 2021
@hgreer93 hgreer93 changed the title TeachingTip throws exception when calling isOpenBug title TeachingTip throws exception when calling isOpen Nov 29, 2021
@castorix
Copy link

castorix commented Dec 9, 2021

When running under a debugger calling IsOpen(true) on a TeachingTip seems to crash the application. Application runs fine when not under the debugger.

This is weird.
I tried to detach the debugger by code, but it still crashes (no crash in C# or packaged)

@gabbybilka gabbybilka added the product-winui3 WinUI 3 issues label Feb 8, 2022
@StephenLPeters StephenLPeters added area-TeachingTip team-Controls Issue for the Controls team labels Feb 17, 2022
@StephenLPeters
Copy link
Contributor

It does look similar to #349, but looking at the code (in winui2) I don't see how the same issue could be present. @llongley is there possibly a bad merge into winui3?

@StephenLPeters StephenLPeters removed the needs-triage Issue needs to be triaged by the area owners label Feb 17, 2022
@FrancisKoo
Copy link

I also met this issue in C++ unpackaged. @StephenLPeters

@FrancisKoo
Copy link

An error C2039 occured : "ProfileButton": is not a member of "winrt::App1::MainWindow" when I write like below(C++ unpackaged) @StephenLPeters

<Button x:Name="ProfileButton" Width="40" Height="40"  Background="Orange"
                                Click="ProfileButton_Click"/>
<TextBlock Text="Trunks" HorizontalAlignment="Center"/>
<TeachingTip x:Name="UserInfoTeachingTip" Target="{x:Bind ProfileButton}" />

@StephenLPeters
Copy link
Contributor

That looks like an x:bind issue.. @RealTommyKlein Thoughts?

@RealTommyKlein
Copy link
Member

@StephenLPeters @FrancisKoo - to bind to an x:Name'd element in C++/WinRT, you also need to add a corresponding property in your IDL, see: https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/binding-property#element-to-element-binding

That being said, we should raise an explicit Xaml compiler error when we detect that instead of our generated code failing to compile.

@FrancisKoo
Copy link

FrancisKoo commented Mar 2, 2022

@StephenLPeters @FrancisKoo - to bind to an x:Name'd element in C++/WinRT, you also need to add a corresponding property in your IDL, see: https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/binding-property#element-to-element-binding

That being said, we should raise an explicit Xaml compiler error when we detect that instead of our generated code failing to compile.

@StephenLPeters @RealTommyKlein
Thanks so much for your reply. I add it in my IDL and build successful. But it still crash when calling IsOpen in C++ unpackaged app. It works good in C++ packaged app.

@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale 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

No branches or pull requests

6 participants