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

Verify ref assembly behavior regarding embedded resources #31197

Closed
jcouv opened this issue Nov 15, 2018 · 8 comments
Closed

Verify ref assembly behavior regarding embedded resources #31197

jcouv opened this issue Nov 15, 2018 · 8 comments
Assignees
Labels
4 - In Review A fix for the issue is submitted for review. Area-Compilers Bug
Milestone

Comments

@jcouv
Copy link
Member

jcouv commented Nov 15, 2018

From discussion with Neal, the expected behavior is that resources should not be embedded into secondary assemblies:

  • refout: main assembly has resources, ref assembly doesn't
  • refonly: ref assembly has resources

@jonathanpeppers reported that updating resources causes the ref assembly to change.

A quick look at the implementation and tests make me unsure about the current behavior, so I'll investigate further.

Ref assembly spec: https://github.com/dotnet/roslyn/blob/master/docs/features/refout.md
Ref assembly main PR: #19417

@jonathanpeppers
Copy link
Member

Here is a log where I updated a <EmbeddedResource Include="foo.txt"/> in a netstandard project and ran an incremental build: msbuild.zip

What made me think there might be an issue here, is this in the log:

Target Name=CoreCompile Project=HelloForms.csproj
...
Input file "foo.txt" is newer than output file "obj\Debug\netstandard2.0\ref\HelloForms.dll".

I was using this example project, and added <ProduceReferenceAssembly>True</ProduceReferenceAssembly> to HelloForms.csproj.

@jcouv
Copy link
Member Author

jcouv commented Nov 15, 2018

That log line seems fine.

What would be an issue is if the timestamp of the HelloForms.dll reference assembly (at C:\Users\jopepper\Desktop\Git\HelloWorld\HelloForms\HelloForms\bin\Debug\netstandard2.0\ref\HelloForms.dll) is updated when you modify the resource file and build.
If that timestamp is updated, then dependent projects will have to build too, even though the change was not significant for them.

@jonathanpeppers
Copy link
Member

jonathanpeppers commented Nov 15, 2018

Yeah, later in the log, in the Xamarin.Android project referencing HelloForms:

Target Name=CoreCompile Project=HelloForms.Android.csproj
...
Input file "C:\Users\jopepper\Desktop\Git\HelloWorld\HelloForms\HelloForms\bin\Debug\netstandard2.0\ref\HelloForms.dll" is newer than output file "obj\Debug\90\HelloForms.Android.dll".

@jcouv
Copy link
Member Author

jcouv commented Nov 15, 2018

Thanks. That second log definitely indicates a problem. I'll investigate further.

@jcouv
Copy link
Member Author

jcouv commented Nov 18, 2018

Confirmed the issue. A fix is pending for the next version of VS (dev16).

@jcouv jcouv added the 4 - In Review A fix for the issue is submitted for review. label Nov 18, 2018
@jonathanpeppers
Copy link
Member

@jcouv just so I can try this when it is out, which Dev16 preview will this be in? thanks.

@jcouv
Copy link
Member Author

jcouv commented Dec 17, 2018

The PR is still in process. There is an open question on behavior for /refonly.
I'm aiming for dev16 preview2.

@jaredpar jaredpar added the Bug label Jan 2, 2019
@jcouv
Copy link
Member Author

jcouv commented Jan 11, 2019

Fix slipped out of preview2. It's being reviewed for preview3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - In Review A fix for the issue is submitted for review. Area-Compilers Bug
Projects
None yet
Development

No branches or pull requests

3 participants