getsentry / sentry-dotnet

Sentry SDK for .NET
https://docs.sentry.io/platforms/dotnet
MIT License
575 stars 205 forks source link

Explore Windows specific APIs for extra context #757

Open bruno-garcia opened 3 years ago

bruno-garcia commented 3 years ago

If there are useful context data available through Win32, we could get that data when net5-windows for example. Consider cswin32 for binding.

There are also UWP APIs available, for example: https://github.com/getsentry/sentry-xamarin/issues/92

Tyrrrz commented 3 years ago

GetSystemInfo function and SystemInfo structure look interesting/useful:

typedef struct _SYSTEM_INFO {
  union {
    DWORD dwOemId;
    struct {
      WORD wProcessorArchitecture;
      WORD wReserved;
    } DUMMYSTRUCTNAME;
  } DUMMYUNIONNAME;
  DWORD     dwPageSize;
  LPVOID    lpMinimumApplicationAddress;
  LPVOID    lpMaximumApplicationAddress;
  DWORD_PTR dwActiveProcessorMask;
  DWORD     dwNumberOfProcessors;
  DWORD     dwProcessorType;
  DWORD     dwAllocationGranularity;
  WORD      wProcessorLevel;
  WORD      wProcessorRevision;
} SYSTEM_INFO, *LPSYSTEM_INFO;

No need to limit this to net5-windows, can just check the current platform and call WinAPI only if on Windows. It's not like we expose any public API, it's all internal anyway.

SimonCropp commented 2 years ago

this will be re-examined if we ever need a windows specific target for other requirements