Skip to content

In .NET 8 and .NET 6 errors. #1

@korenevskiy

Description

@korenevskiy

Your library is not being added to mine.NET 8 from NUGET. I decided to import the SystemTray icon class itself. But after downloading, it gives an error at startup.

  1. error:
    wpf-notifyicon-2.0.1\src\NotifyIconWpf\Interop\WindowMessageSink.cs #243
    Exception: System.OverflowException: "Arithmetic operation resulted in an overflow.
                    ContextMenuReceived?.Invoke(new Point()
                    {
                        X = (short)((nint)wParam & 0xFFFF),
                        Y = (short)((nint)wParam >> 16 & 0xFFFF)
                    }.ScaleWithDpi());
// --->>>>>>>   wParam = 0x0000000003b0fed2
// --->>>>>>>   wParam = 0x0000000003b1fed1
var x = (nint)wParam & 0xFFFF; // where  wParam = 0x0000000003b0fed2
// where  (nint)wParam & 0xFFFF  = 0x000000000000fed5
// but it 0x000000000000fed5 not convert to SHORT

Replace SHORT to INT.

  1. error:
    wpf-notifyicon-2.0.1\src\NotifyIconWpf.Sample.ShowCases\Main.xaml.cs #53
    Exception: System.ArgumentException: "Argument must be between 0 and 2. (Parameter 'fieldCount')"
                var executingAssembly = Assembly.GetExecutingAssembly();

                // Use assembly version
                string version = executingAssembly.GetName().Version.ToString();

                // Use AssemblyFileVersion if available
                var assemblyFileVersionAttribute = executingAssembly.GetCustomAttribute<AssemblyFileVersionAttribute>();
                if (!string.IsNullOrEmpty(assemblyFileVersionAttribute?.Version))
                {
                    var assemblyFileVersion = new Version(assemblyFileVersionAttribute.Version);
                    version = assemblyFileVersion.ToString(3); // it is max 2
                }

Replace 3 to 2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions