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

FluentWindow makes stack unbalanced #803

Closed
Yuval-pa opened this issue Oct 28, 2023 · 6 comments
Closed

FluentWindow makes stack unbalanced #803

Yuval-pa opened this issue Oct 28, 2023 · 6 comments
Labels
bug Something isn't working locked-due-to-inactivity

Comments

@Yuval-pa
Copy link

Yuval-pa commented Oct 28, 2023

Describe the bug

When turning a window into a FluentWindow, the function Wpf.Ui!Wpf.Ui.Interop.User32::SetWindowLong makes the stack unbalanced. This function is called form UnsafeNativeMethods.RemoveWindowTitlebarContents(IntPtr handle).
If you run the app without debugging you only get a black screen.

Exception:

Managed Debugging Assistant 'PInvokeStackImbalance'
Message=Managed Debugging Assistant 'PInvokeStackImbalance' : 'A call to PInvoke function 'Wpf.Ui!Wpf.Ui.Interop.User32::SetWindowLong' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.'

Call Stack (Partial)

Wpf.Ui.dll!Wpf.Ui.Interop.UnsafeNativeMethods.RemoveWindowTitlebarContents(System.IntPtr handle) Line 130 C#
Wpf.Ui.dll!Wpf.Ui.Interop.UnsafeNativeMethods.RemoveWindowTitlebarContents(System.Windows.Window window) Line 115 C#
Wpf.Ui.dll!Wpf.Ui.Controls.FluentWindow.OnExtendsContentIntoTitleBarChanged(bool oldValue, bool newValue) Line 146 C#
Wpf.Ui.dll!Wpf.Ui.Controls.FluentWindow.OnSourceInitialized(System.EventArgs e) Line 72 C#
PresentationFramework.dll!System.Windows.Window.CreateSourceWindow(bool duringShow) Unknown
PresentationFramework.dll!System.Windows.Window.CreateSourceWindowDuringShow() Unknown
PresentationFramework.dll!System.Windows.Window.SafeCreateWindowDuringShow() Unknown
PresentationFramework.dll!System.Windows.Window.ShowHelper(object booleanBox) Unknown

until the problem is solved, does anyone have an idea of what to use instead of FluentWindow so that NavigationView can stile be used (because UiWindow is no longer exsists)?

To Reproduce

  1. Open a new Wpf .net framework 4.8 project with Visual Studio
  2. Using the package manager console install WpfUi 3.0.0-preview.8
  3. Follow the steps in https://wpfui.lepo.co/documentation/getting-started.html
  4. Change main window type to ui:FluentWinow
  5. Run the app

Expected behavior

The app should not crach.

Screenshots

Running With Debugging

image

Running Without Debugging

image

OS version

Win10 Pro N, Version 22H2, build 19045.3570

.NET version

.Net Framework 4.8, work's fine in .Net 6

WPF-UI NuGet version

WPF-UI.3.0.0-preview.8 and WPF-UI.3.0.0-preview.9

Additional context

No response

@Yuval-pa Yuval-pa added the bug Something isn't working label Oct 28, 2023
@DevilGeek
Copy link

I stumbled across the same problem and it's preventing me from using the lib in our project.

Also the repo need a sample project targeting .net framework 4.8

@ghost1372
Copy link
Contributor

is there any fix?

@Yuval-pa
Copy link
Author

is there any fix?

Not any that I know of. Today I checked the new preview.9 version and the problem is stile there.
because of this bug and another one in 2.0.1 that prevents me from using the FluentWindow and NavigationView/CompactNavigationView respectivly, my UI is not working for the past 3 weeks and I turly dont know what to do, I hope this is fixed soon.

@ghost1372
Copy link
Contributor

is there any fix?

Not any that I know of. Today I checked the new preview.9 version and the problem is stile there.
because of this bug and another one in 2.0.1 that prevents me from using the FluentWindow and NavigationView/CompactNavigationView respectivly, my UI is not working for the past 3 weeks and I turly dont know what to do, I hope this is fixed soon.

I removed pinvoke that caused issue and i wrote new pinvoke and issue fixed, however there is a lot of issues something related to accent color exception 😑 and i removed it. I switched to another wpf fluent https://github.com/InkoreStudios/UI.WPF.Modern which is more stable.

@Yuval-pa
Copy link
Author

I removed pinvoke that caused issue and i wrote new pinvoke and issue fixed

can you please make a PR with that?

@ghost1372
Copy link
Contributor

I removed pinvoke that caused issue and i wrote new pinvoke and issue fixed

can you please make a PR with that?

#825

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working locked-due-to-inactivity
Projects
None yet
Development

No branches or pull requests

3 participants