Skip to content

Conversation

@jonathanpeppers
Copy link
Member

@jonathanpeppers jonathanpeppers commented Nov 2, 2017

This method was not using the full path to the project directory, and so
it wasn't actually deleting anything. This caused test failures on
Windows in tests such as ManifestTest.Bug12935. This particular test
was modifying the contents of AndroidManifest.xml, and checking the
results of the build afterward. Since the project files were not
deleted, changes to the AndroidManifest.xml were not getting written
to disk during the test.

@dnfclas
Copy link

dnfclas commented Nov 2, 2017

@jonathanpeppers,
Thanks for having already signed the Contribution License Agreement. Your agreement was validated by .NET Foundation. We will now review your pull request.
Thanks,
.NET Foundation Pull Request Bot

@jonathanpeppers
Copy link
Member Author

@dellis1972 let me know if you think there is something else we should fix here instead of changing this test. I wasn't seeing what would make AndroidManifest.xml get rewritten at all, but it appears to be doing it somehow on Mac.

builder.Cleanup ();
proj.TargetFrameworkVersion = "v4.1";
proj.AndroidManifest = string.Format (TargetSdkManifest, "16");
proj.OtherBuildItems [0].Timestamp = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

we should probably put this code in the project.AndroidManifest property setter (or something like it) so that if the property is updated it will do this.

@jonathanpeppers jonathanpeppers force-pushed the windows-tests-timestamps branch from ee95311 to e5185fc Compare November 3, 2017 13:19
@jonpryor
Copy link
Contributor

jonpryor commented Nov 3, 2017

I still don't understand why the timestamp matters. Doesn't NTFS have better file time precision than macOS? This seems confusing. :-(

@jonathanpeppers
Copy link
Member Author

@jonpryor the original test I was fixing changes the string contents of the manifest throughout the test.

There is some logic that is preventing the file from being rewritten--even if its contents changed. For some reason, this is only happening on Windows.

@jonpryor
Copy link
Contributor

jonpryor commented Nov 3, 2017

There is some logic that is preventing the file from being rewritten

...and that's what confuses me. What is the "some logic"? Why does this only happen on Windows? It feels like we don't actually know what's going on, it's just that clearing the Timestamp property papers over the issue enough to make it work.

@dellis1972
Copy link
Contributor

This method was not using the full path to the project directory, and so
it wasn't actually deleting anything. This caused test failures on
Windows in tests such as `ManifestTest.Bug12935`. This particular test
was modifying the contents of `AndroidManifest.xml`, and checking the
results of the build afterward. Since the project files were not
deleted, changes to the `AndroidManifest.xml` were not getting written
to disk during the test.
@jonathanpeppers jonathanpeppers force-pushed the windows-tests-timestamps branch from e5185fc to 0ac36cd Compare November 3, 2017 21:05
@jonathanpeppers jonathanpeppers changed the title [tests] Windows not writing AndroidManifest.xml to disk [tests] Fix issue in ProjectBuilder.Cleanup Nov 3, 2017

var item = OtherBuildItems?.FirstOrDefault (i => i.Include() == "Properties\\AndroidManifest.xml");
if (item != null) {
item.Timestamp = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

we can get away with using DateTime.UtcNow here I think

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually looking at the code.. builder.Cleanup should be deleting the project directory between these builds. Perhaps its that which is not working..

@dellis1972
Copy link
Contributor

@jonathanpeppers looks good. I'll merge once we get a green build

@dellis1972 dellis1972 merged commit 4ee1c3d into dotnet:master Nov 3, 2017
@jonathanpeppers jonathanpeppers deleted the windows-tests-timestamps branch November 4, 2017 03:37
@github-actions github-actions bot locked and limited conversation to collaborators Feb 4, 2024
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.

4 participants