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

PresentationUI ref-assembly missing: Build fails because cannot find type PresentationUIStyleResources #1423

Closed
jbe2277 opened this issue Jul 28, 2019 · 8 comments
Assignees
Labels
ask-mode Bug Product bug (most likely) regression status: This issue is a regression from a previous build or release
Milestone

Comments

@jbe2277
Copy link

jbe2277 commented Jul 28, 2019

  • .NET Core SDK: 3.0.100-preview7-012821
  • VS 2019: 16.2.0
  • Windows version: Win10 1809 (Azure VM, connected via Remote Desktop)
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: No

Now I get a build error for a solution which already build with an older .NET Core 3 version.

It worked with:

  • .NET Core SDK: 3.0.100-preview5-011256
  • Microsoft.WindowsDesktop.App 3.0.0-preview5-27610-56

Reproduce:

Build error:

4>------ Build started: Project: Writer.Presentation, Configuration: Debug Any CPU ------
4>C:\Users\dev\source\repos\waf\src\System.Waf\Samples\Writer\Writer.Presentation\Views\PrintPreviewView.xaml(15,44): 
error MC3066: The type reference cannot find a public type named 'PresentationUIStyleResources'. Line 15 Position 44.

Code line that produces this build error:
https://github.com/jbe2277/waf/blob/c7773460a1d58256b201df15c197c2b4263ec88e/src/System.Waf/Samples/Writer/Writer.Presentation/Views/PrintPreviewView.xaml#L15

Workaround:
Comment this line and it builds.

@rladuca
Copy link
Member

rladuca commented Jul 28, 2019

Well this is strange. PresentationUI.dll is NOT part of the reference set of .NET Framework. So this shouldn't build in .NET Framework at all.

However, looking at the binlog from the build, I see it picks this up from the GAC using the full library DLL.

    ReferenceAssembly = C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\PresentationUI\v4.0_4.0.0.0__31bf3856ad364e35\PresentationUI.dll

In Preview7, we removed PresentationUI from our reference set to match .NET Framework's reference set.

I don't really get why this is allowed. If you built against a GAC containing assemblies from version X that has public API not available in runtime assemblies X-1, you'd have a runtime break on systems with X-1, even if you were targeting that framework. This just seems unintended.

@vatsan-madhavan @SamBent What do you think about this? If picking up references from the GAC is a scenario in .NET Framework I am worried that matching the reference set isn't enough. Even if this is unintended, it seems like something that is relied on.

The binlog is attached here:
msbuild.zip

@weltkante
Copy link

weltkante commented Jul 29, 2019

Picking up references from GAC has always been a thing in VS/msbuild and as a user you don't really see a difference in the experience if you aren't using the VS UI to add references. We have been using this in the past a few times, but I don't think for framework assemblies.

@jbe2277
Copy link
Author

jbe2277 commented Jul 29, 2019

Additional Info: The XAML line that produces this build error comes from the original control template of the DocumentViewer. I have created a copy of this control template to apply some minor modifications.

I believe adding the reference to PresenationUI.dll was done by Visual Studio when I created a copy of the control template with the XAML designer.

@vatsan-madhavan
Copy link
Member

@rladuca, If we have a public type, then we are probably going to have to keep it .NET Core 3.0 and also include it in ref-assembly surface given the fact that there is no GAC or easy discovery mechanisms for runtime-assemblies in .NET Core 3.0.

As far as I can remember, this is likely the only type that's missing.

We should probably bring back PresentationUI ref assembly (easily done in the builds - need to ask shiproom permission first), and update our APICompat targets to incorporate what we've learned here.

/cc @ericstj

@rladuca
Copy link
Member

rladuca commented Jul 29, 2019

Yeah that makes sense. I was completely unaware of this GAC reference scenario, but bringing back the assembly is quick enough. We can bring it up in shiproom and if they approve it I can go about resurrecting it.

@grubioe grubioe added Bug Product bug (most likely) regression status: This issue is a regression from a previous build or release labels Jul 29, 2019
@grubioe grubioe added this to the 3.0 milestone Jul 29, 2019
@wjk
Copy link
Contributor

wjk commented Jul 29, 2019

@rladuca As much as PresentationUI.dll looks like it's not public API, as @jbe2277 noted, it does need to be referenced from user code if one is retemplating the DocumentViewer control. I would think the real solution here is to either get rid of PresentationUI entirely if it is no longer needed (I half-remember seeing mostly CAS-related crud in that file when I last ILDasm'ed it), or else move its code into one of the other assemblies. However, since this is a breaking change, it would need to wait until 5.0. Hope this helps!

vatsan-madhavan added a commit that referenced this issue Aug 7, 2019
vatsan-madhavan added a commit that referenced this issue Aug 7, 2019
* Helps with addressing #1423 - adding back PresentationUI ref-assembly.

- Adding PUI to RefAssembly list in props.
- Add PUI to RefApiCompatNeededProjects
@vatsan-madhavan
Copy link
Member

@vatsan-madhavan vatsan-madhavan changed the title Build fails because cannot find type PresentationUIStyleResources PresentationUI ref-assembly missing: Build fails because cannot find type PresentationUIStyleResources Aug 8, 2019
vatsan-madhavan added a commit to dotnet/core-setup that referenced this issue Aug 9, 2019
Add PresentationUI.dll to WPF profile
vatsan-madhavan added a commit to dotnet/core-setup that referenced this issue Aug 9, 2019
Add PresentationUI.dll to WPF profile
vatsan-madhavan added a commit to dotnet/core-setup that referenced this issue Aug 9, 2019
Add PresentationUI.dll to WPF profile
dagood pushed a commit to dotnet/core-setup that referenced this issue Aug 9, 2019
Add PresentationUI.dll to WPF profile
dagood pushed a commit to dotnet/core-setup that referenced this issue Aug 9, 2019
* Fixes dotnet/wpf#1423

Add PresentationUI.dll to WPF profile

* Update WPF Dependencies
@vatsan-madhavan
Copy link
Member

vatsan-madhavan commented Aug 10, 2019

This is now completed - we should start seeing new core-sdk builds shortly that contains PresentationUI ref assemblies again.

picenka21 pushed a commit to picenka21/runtime that referenced this issue Feb 18, 2022
* Fixes dotnet/wpf#1423

Add PresentationUI.dll to WPF profile

* Update WPF Dependencies


Commit migrated from dotnet/core-setup@0588e55
@dotnet dotnet locked as resolved and limited conversation to collaborators Apr 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ask-mode Bug Product bug (most likely) regression status: This issue is a regression from a previous build or release
Projects
None yet
Development

No branches or pull requests

6 participants