Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove dead code from nativemethods #10840

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

kasperk81
Copy link
Contributor

followup on #9223

@JanKrivanek
Copy link
Member

Hello @kasperk81 - thank you for your contribution! MSBuild team for sure appraciates contributions. Upfront heads up via bug or other form of discussion is preferred (plus an explicit confirmation of wanting to fix).

More details: https://github.com/dotnet/msbuild/blob/main/documentation/wiki/Contributing-Code.md

Each PR should ideally have motivation and goal in the description (links are big advantage, but important context should be part of the PR).

By no means would I want to kill the interest and flow :-) But it should be just little extra work that will save us considerable time.


In this specific PR - it mentiones it's a followup of the other PR that uses IO.Redist on NetFx, while here only single implementation is used - it's bit confusing to me. It looks great as code cleanup. Though as mentioned followup I'd expect the usage of IO.Redist or justification why not using it

@kasperk81
Copy link
Contributor Author

while here only single implementation is used

the change in WindowsFileSystem.cs is following the other pr, MSBuildTaskHostFileSystem.cs is only built on netfx so it didn't required netcore tfm branch and that's the only difference there.

@JanKrivanek
Copy link
Member

while here only single implementation is used

the change in WindowsFileSystem.cs is following the other pr, MSBuildTaskHostFileSystem.cs is only built on netfx so it didn't required netcore tfm branch and that's the only difference there.

Is it just code removal though? The previous implementation of MSBuildTaskHostFileSystem.FileOrDirectoryExists ended up in FileOrDirectoryExistsWindows

internal static bool FileOrDirectoryExistsWindows(string path)
{
WIN32_FILE_ATTRIBUTE_DATA data = new WIN32_FILE_ATTRIBUTE_DATA();
return GetFileAttributesEx(path, 0, ref data);
}

Now it calls System.IO.[File|Directory]

It looks like a change in a good direction. It however doesn't look like dead code removal. Let's please add a motivation + reaso ning into PR description so that we can proceed with reviewing.

Copy link
Contributor

@maridematte maridematte left a comment

Choose a reason for hiding this comment

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

I agree with Jan here, please add more about the context as it is a bit hard to understand where these changes are coming from.

@kasperk81
Copy link
Contributor Author

@JanKrivanek seems like we are reading too much into semantics in a simple code cleanup moving stuff from native to managed. not the first pr of its kind in this repo. p/invoking win32 api for file.exists check looks to be some legacy from 90s which is no longer needed as green ci status is showing up here

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.

3 participants