Skip to content

Conversation

@jcouv
Copy link
Member

@jcouv jcouv commented May 7, 2017

A few things:

  • xml docs are not filtered when using /refonly (updated doc and tests to reflect)
  • NoPia is disallowed with either /refonly or /refout
  • compacting error codes for C# 7.1 (and fixing a bug in test for warnings)
  • emit ref assemblies with determinism, even if compilation isn't

@dotnet/roslyn-compiler for review. Thanks

@jcouv jcouv added this to the 15.3 milestone May 7, 2017
@jcouv jcouv self-assigned this May 7, 2017
@jcouv jcouv force-pushed the refout-prototype branch from 4416d9a to 7205ec6 Compare May 7, 2017 21:31
@jcouv jcouv force-pushed the refout-prototype branch from 7205ec6 to 6c5b341 Compare May 7, 2017 21:39

[Theory]
[InlineData("")]
[InlineData(@"[assembly: System.Reflection.AssemblyVersion(""1"")]")]
Copy link
Member Author

Choose a reason for hiding this comment

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

It seems that the /deterministic flag affects two things: (1) whether wildcards are allowed in AssemblyVersion attribute, and (2) how PEs are emitted.
Would you know what the rationale is for (1)? It doesn't seem "non-deterministic".

Copy link
Member

Choose a reason for hiding this comment

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

See the docs:

You can specify all the values or you can accept the default build number, revision number, or both by using an asterisk (*). [...] The default build number increments daily. The default revision number is the number of seconds since midnight local time (without taking into account time zone adjustments for daylight saving time), divided by 2.

That is nondeterministic.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the clarification.
I see that VersionHelper.GenerateVersionFromPatternAndCurrentTime replaces the wildcard (maxValue) with the timestamp of the build.
That means if you use a wildcard, the ref assembly will not be deterministic. I wonder if I should switch the compilation to be deterministic if either /refonly or /refout is used.


foreach (var member in this.GetMembers())
{
// PROTOTYPE(refout) Do something here?
Copy link
Member Author

Choose a reason for hiding this comment

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

📝 Explicit interface implementations should be included. My understanding is that they are virtual, and we already concluded that all virtual methods should be included in ref assemblies. I'll add a test to lock that in.

Copy link
Member

@gafter gafter left a comment

Choose a reason for hiding this comment

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

I have just the one question. The rest looks good.

<member name=""M:C.Main"">
<summary>Main method</summary>
</member>
<member name=""F:C.field"">
Copy link
Member

Choose a reason for hiding this comment

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

This is unexpected. We don't eliminate private fields of a class?

Copy link
Member Author

Choose a reason for hiding this comment

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

Such fields are stripped from the ref assembly, but not from the doc output. I'll take a stab tomorrow to strip it out.

AddDiagnostic(diagnostics, diagnosticOptions, ErrorCode.ERR_NoRefOutWhenRefOnly);
}

if (metadataReferences.Any(r => r.Properties.EmbedInteropTypes) && (refOnly || outputRefFilePath != null))
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps check second && operand first since that might be cheaper.

AddDiagnostic(diagnostics, ERRID.ERR_NoRefOutWhenRefOnly)
End If

If metadataReferences.Any(Function(r) r.Properties.EmbedInteropTypes) AndAlso (refOnly OrElse outputRefFileName IsNot Nothing) Then
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider checking second AndAlso operand first.

<value>Do not use refout when using refonly.</value>
</data>
<data name="ERR_NoEmbeddedTypeWhenRefOutOrRefOnly" xml:space="preserve">
<value>Cannot compile embed types when using /refout or /refonly.</value>
Copy link
Contributor

Choose a reason for hiding this comment

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

Cannot embed types ...

@cston
Copy link
Contributor

cston commented May 8, 2017

LGTM

@jcouv jcouv force-pushed the refout-prototype branch from 19ca82f to 1993456 Compare May 9, 2017 03:01
@jcouv
Copy link
Member Author

jcouv commented May 9, 2017

@gafter @cston Thanks for the feedback.

I added a fix for assembly redirect. This is a problem with System.IO.FileSystem, which I also encountered in the corefx repo. More details in this issue https://github.com/dotnet/corefx/issues/16322#issuecomment-286179535.
For the last couple of days, I had used a workaround (adding assembly redirect in msbuild.exe.config) so that CopyRefAssembly could load System.IO.FileSystem. But from discussion with @agocke, we already use a more robust solution for Csc and Vbc task. I'm applying the same trick in CopyRefAssembly. Verified it works locally and a VM.

I'll merge as soon as green, so that I can produce a new VS validation build.

@jcouv
Copy link
Member Author

jcouv commented May 9, 2017

Build correctness leg failed with:

20:08:59 Running BuildBoss
20:09:00 Processing Solution Roslyn.sln ... passed
20:09:00 Processing Solution Compilers.sln ... passed
20:09:00 Processing Solution src\Samples\Samples.sln ... passed
20:09:00 Processing Solution CrossPlatform.sln ... passed
20:09:00 Processing Targets build\Targets ... passed
20:09:14 Command failed to execute: D:\j\workspace\windows_build---59ebb5ea\Binaries\Debug\Exes\BuildBoss\BuildBoss.exe Roslyn.sln Compilers.sln src\Samples\Samples.sln CrossPlatform.sln build\Targets D:\j\workspace\windows_build---59ebb5ea\Binaries\Debug\build.xml
20:09:14 System.Management.Automation.RuntimeException: Command failed to execute: D:\j\workspace\windows_build---59ebb5ea\Binaries\Debug\Exes\BuildBoss\BuildBoss.exe Roslyn.sln Compilers.sln src\Samples\Samples.sln CrossPlatform.sln build\Targets D:\j\workspace\windows_build---59ebb5ea\Binaries\Debug\build.xml
20:09:14 Command failed to execute:  & ".\build\scripts\test-build-correctness.ps1" -config $buildConfiguration 
20:09:14 System.Management.Automation.RuntimeException: Command failed to execute:  & ".\build\scripts\test-build-correctness.ps1" -config $buildConfiguration 
20:09:14 Build step 'Execute Windows batch command' marked build as failure

I'll re-run.

@jcouv
Copy link
Member Author

jcouv commented May 9, 2017

@dotnet-bot test windows_build_correctness_prtest please

@jcouv jcouv merged commit 8af036a into dotnet:features/refout May 9, 2017
@jcouv jcouv deleted the refout-prototype branch May 9, 2017 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants