Skip to content

Conversation

@fernandanavamoya
Copy link
Contributor

@fernandanavamoya fernandanavamoya commented Jul 11, 2022

Using the CsWin32 PInvoke library

Converted these threads:
-DuplicateHandle
-GetCurrentProcess
-GetCurrentThread
-GetCurrentThreadId

Fixed the VB files to allow the new Windows.Win32 namespace

Fixed the information messages in Application.ThreadContext

Microsoft Reviewers: Open in CodeFlow

Using the CsWin32 PInvoke library

Converted these threads:
-DuplicateHandle
-GetCurrentProcess
-GetCurrentThread
-GetCurrentThreadId

Fixed the VB files to allow the new Windows.Win32 namespace

Fixed the information messages in Application.ThreadContext
@fernandanavamoya fernandanavamoya requested a review from a team as a code owner July 11, 2022 23:21
@fernandanavamoya
Copy link
Contributor Author

cc: @AArnott

Copy link
Member

@KlausLoeffelmann KlausLoeffelmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@fernandanavamoya fernandanavamoya merged commit 4c040fb into dotnet:feature/win32 Jul 12, 2022
@fernandanavamoya fernandanavamoya deleted the ThreadAPI branch July 12, 2022 01:10

<ItemGroup>
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="$(MicrosoftWin32SystemEventsPackageVersion)" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.2.1-beta">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't specify versions explicitly in proj files, the versions need to be specified in eng/versions.props (writing from memory on a phone)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll change that.

@RussKie
Copy link
Contributor

RussKie commented Jul 12, 2022

Could you please elaborate why CsWin32 was chosen? Thank you

@JeremyKuhne
Copy link
Member

Could you please elaborate why CsWin32 was chosen? Thank you

@RussKie this is a prototype effort to examine the viability of using CsWin32. It isn't "chosen" yet. As a general goal, we want to be using the Win32 metadata for our interop. CsWin32 is the only usable existing projection. We're working in conjunction with the .NET interop team and @AArnott to identify issues and opportunities based on this exploration.

@elachlan
Copy link
Contributor

Awesome. Is there an associated issue to keep track of progress and associated issues? Happy to help where I can.

I have made a NativeMethods.txt list of all User32 PInvokes. With a list that long, I think the NativeMethods.txt needs to be split up.

I have based my effort off of the example given by @AArnott in #4751.

@elachlan elachlan mentioned this pull request Jul 19, 2022
@RussKie
Copy link
Contributor

RussKie commented Jul 19, 2022

Thank you @elachlan for your interest. IIUIC this is an internal experiement run by @fernandanavamoya, and we don't have a definite commitment to this conversion just yet. That said, if you already have made some progress in this area as well and are willing to share it or wish to come along for the ride, we won't say no. With your help we may be able to take the experiement further and/or decide sooner whether the codebase will benefit from this conversion. Though a compulsary disclaimer that this work may get abandoned, if something doesn't pan out or proves to be too difficult.

I'll let @fernandanavamoya and @JeremyKuhne to chime in, but you can open a PR targeting feature/win32 branch we can take it from there.

@AArnott
Copy link
Contributor

AArnott commented Jul 19, 2022

I have made a NativeMethods.txt list of all User32 PInvokes.

@elachlan Yes, I imagine that would be a long list. If you really wanted that, you could just do User32.* though. Why list them all out? That said, why generate all methods, even if you don't use them? That'll just slow down compilation time and increase the size of the resulting assembly.

@elachlan
Copy link
Contributor

@AArnott yes, I should have said "all User32 PInvokes used in winforms".

JeremyKuhne pushed a commit to JeremyKuhne/winforms that referenced this pull request Jul 26, 2022
Using the CsWin32 PInvoke library

Converted these threads:
-DuplicateHandle
-GetCurrentProcess
-GetCurrentThread
-GetCurrentThreadId

Fixed the VB files to allow the new Windows.Win32 namespace

Fixed the information messages in Application.ThreadContext
RussKie pushed a commit that referenced this pull request Aug 9, 2022
Using the CsWin32 PInvoke library

Converted these threads:
-DuplicateHandle
-GetCurrentProcess
-GetCurrentThread
-GetCurrentThreadId

Fixed the VB files to allow the new Windows.Win32 namespace

Fixed the information messages in Application.ThreadContext
@ghost ghost locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants