Skip to content

The HRESULT uint operator is missing unchecked(). #1663

@mjr4077au

Description

@mjr4077au

Actual behavior

The current uint operator for HRESULT is: public static implicit operator uint(HRESULT value) => (uint)value.Value;. In my checked build, this throws an overflow exception.

Image

Expected behavior

That this operation be wrapped in an unchecked block, just like public static explicit operator HRESULT(uint value) => new HRESULT(unchecked((int)value)); is.

Repro steps

  1. NativeMethods.txt content:
HRESULT
  1. NativeMethods.json content (if present): N/A

  2. Any of your own code that should be shared? N/A

Context

  • CsWin32 version: 0.3.269
  • Win32Metadata version: N/A
  • Target Framework: net472
  • LangVersion: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions