Skip to content

Conversation

@zZeck
Copy link

@zZeck zZeck commented Feb 13, 2022

ConnectNamedPipe can return 0, but have a good connection, when a client opens the pipe between the pipe's creation and the ConnectNamedPipe call. In that case, GetLastError() is ERROR_PIPE_CONNECTED.

For whatever reason, the threads in the host and client hit this scenario constantly on my PC. The Host goes into an infinite loop of "failed" ConnectNamedPipe calls since it never checked GetLastError.


I also had to edit the EasyHook csproj files so their default Configurations correspond to Configurations those projects actually define. The ProtoInput.sln didn't build in the ms build tools developer command line. Properties set for an sln build only apply to projects directly referenced in the sln file. If those projects reference a project not in the sln, that external project is built with its defaults.

This is an intentional* behavior when a build goes outside of a solution. The AssignProjectConfiguration task maps ProjectReferences to the appropriate project-level Configuration and Platform, given the active solution-level Configuration and Platform. When the referenced project is not part of the solution, there's no such mapping, and the build has to choose between passing along the referencing project's configuration or taking the referenced project's default configuration.

The csproj files for EasyHook define PropertyGroups for Configuration netfx4-Debug not Debug

PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx4-Debug|AnyCPU'"

but were setting the default Configuration to Debug

Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration

Now these commands both work

msbuild .\ProtoInput.sln /p:ConfigurationPlatforms=Debug /p:Platform="x64"
msbuild .\ProtoInput.sln /p:ConfigurationPlatforms=Debug /p:Platform="x86"

@zZeck
Copy link
Author

zZeck commented Feb 13, 2022

This is likely the fix for this issue. That's the behavior that happens for me. The host hangs when it tries to inject.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant