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

Better rebuild logging #51852

Merged
merged 4 commits into from
Mar 16, 2021
Merged

Better rebuild logging #51852

merged 4 commits into from
Mar 16, 2021

Conversation

jaredpar
Copy link
Member

This moves our output logging to include a target framework directory.
Before we weren't doing this and we ended up with a race condition when
the same project failed to rebuild in multiple target frameworks.

Cleaned up the handling of failed CompilationDiff instances by turning
it into a adhoc-union

This moves our output logging to include a target framework directory.
Before we weren't doing this and we ended up with a race condition when
the same project failed to rebuild in multiple target frameworks.

Cleaned up the handling of failed `CompilationDiff` instances by turning
it into a adhoc-union
@jaredpar jaredpar added Area-Compilers New Language Feature - Rebuild Compiler ability to verify provenance of code via rebuild operations labels Mar 12, 2021
@jaredpar jaredpar requested review from a team as code owners March 12, 2021 23:28
@RikkiGibson RikkiGibson self-assigned this Mar 12, 2021
}
else
{
var originalBytes = File.ReadAllBytes(originalBinaryPath.FullName);
var originalBytes = File.ReadAllBytes(assemblyInfo.FilePath);
Copy link
Contributor

Choose a reason for hiding this comment

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

should we add a note that we want to avoid doing I/O here? e.g. eventually we need to make the public caller pass in a PE stream or pass in the assembly fully read into memory.

Copy link
Contributor

Choose a reason for hiding this comment

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

no need to change the PR for this--but this is a good moment to decide if we need to file an issue

Copy link
Contributor

Choose a reason for hiding this comment

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

Suddenly it occurs to me that we're in the CLI tool's area now, so it's not as much of a concern--but if we end up pulling parts of this over into the library side to help users diagnose rebuild failures, I think we'll have to keep an eye out for this sort of thing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree we need to keep an eye out for this. Really need to put a hard stop on anything like this going into the library.

@@ -278,25 +288,30 @@ private static bool ValidateFiles(IEnumerable<FileInfo> originalBinaries, Option
try
{
// Find the embedded pdb
using var originalBinaryStream = originalBinary.OpenRead();
using var originalBinaryStream = File.OpenRead(assemblyInfo.FilePath);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: feels like this line doesn't need to change if the declaration of originalBinary is moved up.

fixed (byte* ptr = _rebuildPortableExecutableBytes)
{
using var originalPeReader = new PEReader(ptr, _originalPortableExecutableBytes.Length);
using var rebuildPeReader = new PEReader(ptr, _rebuildPortableExecutableBytes.Length);
Copy link
Member

@cston cston Mar 15, 2021

Choose a reason for hiding this comment

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

The two readers are reading from the same ptr buffer? #Closed

Copy link
Member Author

Choose a reason for hiding this comment

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

Well that would explain the one head scratcher I was looking at 😦

sources,
metadataReferences);
if (compilation is null)
Compilation? compilation = null;
Copy link
Member

@cston cston Mar 15, 2021

Choose a reason for hiding this comment

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

Compilation? compilation = null [](start = 16, length = 31)

Minor: Looks like this can be declared non-nullable with no default value: Compilation compilation; #Closed

@jaredpar
Copy link
Member Author

Thanks. Responded to feedback.

OriginalPath = originalPath;
get
{
EnsureRebuildReslt(RebuildResult.MiscError);
Copy link
Member

Choose a reason for hiding this comment

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

Reslt [](start = 29, length = 5)

Typo?

Copy link
Member Author

Choose a reason for hiding this comment

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

My typos are eternal ....

@jaredpar
Copy link
Member Author

Integration failures are flaky tests.

@jaredpar jaredpar merged commit 773485b into dotnet:main Mar 16, 2021
@ghost ghost added this to the Next milestone Mar 16, 2021
@jaredpar jaredpar deleted the more branch March 16, 2021 03:25
@allisonchou allisonchou modified the milestones: Next, 16.10.P2 Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers New Language Feature - Rebuild Compiler ability to verify provenance of code via rebuild operations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants