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

SharpHook can work #27218

Open
Snsaiu opened this issue Jan 19, 2025 · 4 comments
Open

SharpHook can work #27218

Snsaiu opened this issue Jan 19, 2025 · 4 comments
Labels
s/needs-attention Issue has more information and needs another look t/bug Something isn't working

Comments

@Snsaiu
Copy link

Snsaiu commented Jan 19, 2025

Description

SharpHook doesn't work properly on macos, but it works fine on windows; but I tested Avalonia's cross-platform solution and command line project and it works fine on macos.

Steps to Reproduce

1.create maui project,
2.import SharpHook
3.write code

var hook = new TaskPoolGlobalHook();
       hook.KeyPressed += (sender, e) =>
       {

       };
       hook.KeyReleased += (sender, e) =>
       {
           //  keyCodes.Clear();
       };

       hook.Run();

in MainProgram.cs
4. run project

Link to public reproduction project repository

No response

Version with bug

9.0.30 SR3

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

9.0.30 SR3

Affected platforms

macOS

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

@Snsaiu Snsaiu added the t/bug Something isn't working label Jan 19, 2025
@jfversluis
Copy link
Member

Thanks for the report! And what indication do you have this is specific to .NET MAUI and not on the library side?

Do you have any error messages, logs, a reproduction of what you are trying to do at all?

@jfversluis jfversluis added the s/needs-repro Attach a solution or code which reproduces the issue label Jan 20, 2025
@Snsaiu
Copy link
Author

Snsaiu commented Jan 20, 2025

I'm not 100% sure that the library works fine on Windows, but has problems on macOS, and I tested that SharpHook works fine on Avalonia. And it works fine even with command line programs, only when running on the Maui platform will it report an error

@dotnet-policy-service dotnet-policy-service bot added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Jan 20, 2025
@Zhanglirong-Winnie
Copy link

Could you provide us with a sample project so we can investigate it further? Looking forward to your reply!

@Snsaiu
Copy link
Author

Snsaiu commented Jan 21, 2025

https://github.com/Snsaiu/SharpHookTest.git

This is my test project. You need to run it on macos and the m1 chip. The test project contains three projects, namely ConsoleApp, Avalonia and MAUI. In the Avalonia and MAUI projects, you can view the App.xaml.cs file. You should find that the Avalonia and ConsoleApp projects can run normally, but the MAUI project cannot run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants