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

Adding the WindowsAppSDK to a C# project breaks VS FastUpToDate and causes it to always build. #1525

Closed
jlaanstra opened this issue Oct 2, 2021 · 4 comments · Fixed by microsoft/CsWinRT#1026
Assignees

Comments

@jlaanstra
Copy link
Contributor

jlaanstra commented Oct 2, 2021

Describe the bug
After adding the WindowsAppSDK package to a C# class library, the FastUpToDate checks in VS no longer consider the project to be up to date. This is particular problematic for larger solution as it breaks the inner loop by building everything every time.

Steps to reproduce the bug

  • Open the attached sample project, see below.
  • Rebuild the project to make sure all Nuget packages are restored and caches populated.
  • Close and reopen VS.
  • Build the projects without rebuilding them.
  • Observe that the native project is not build, but the managed project is build every time. VS output shows:
Build started...
1>FastUpToDate: Adding UpToDateCheckBuilt outputs: (WinUI3Managed)
1>FastUpToDate:     'D:\Projects\WinUI3TestApp\WinUI3Managed\obj\x64\Debug\net5.0-windows10.0.19041.0\WinUI3Managed.dll' (WinUI3Managed)
1>FastUpToDate:     'D:\Projects\WinUI3TestApp\WinUI3Managed\bin\x64\Debug\net5.0-windows10.0.19041.0\WinUI3Managed.dll' (WinUI3Managed)
1>FastUpToDate:     'D:\Projects\WinUI3TestApp\WinUI3Managed\obj\x64\Debug\net5.0-windows10.0.19041.0\WinUI3Managed.pdb' (WinUI3Managed)
1>FastUpToDate:     'D:\Projects\WinUI3TestApp\WinUI3Managed\bin\x64\Debug\net5.0-windows10.0.19041.0\WinUI3Managed.pdb' (WinUI3Managed)
1>FastUpToDate: Adding project file inputs: (WinUI3Managed)
1>FastUpToDate:     'D:\Projects\WinUI3TestApp\WinUI3Managed\WinUI3Managed.csproj' (WinUI3Managed)
1>FastUpToDate: Adding newest import input: (WinUI3Managed)
1>FastUpToDate:     'D:\Projects\WinUI3TestApp\WinUI3Managed\obj\WinUI3Managed.csproj.nuget.g.targets' (WinUI3Managed)
1>FastUpToDate: Adding Compile inputs: (WinUI3Managed)
1>FastUpToDate:     'D:\Projects\WinUI3TestApp\WinUI3Managed\Class1.cs' (WinUI3Managed)
1>FastUpToDate: Checking copied output (UpToDateCheckBuilt with Original property) file 'D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Foundation.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Graphics.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.UI.Text.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.UI.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.UI.Xaml.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Web.WebView2.Core.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.ApplicationModel.DynamicDependency.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.ApplicationModel.Resources.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.AppLifecycle.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.PushNotifications.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.System.Power.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.System.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Foundation.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Graphics.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.UI.Text.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.UI.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.UI.Xaml.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Web.WebView2.Core.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.ApplicationModel.DynamicDependency.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.ApplicationModel.Resources.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.AppLifecycle.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.PushNotifications.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.System.Power.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.System.winmd;D:\Projects\WinUI3TestApp\x64\Debug\WinUI3TestNative\WinUI3TestNative.winmd': (WinUI3Managed)
1>FastUpToDate: Up to date check completed in 0.8 ms (WinUI3Managed)
1>------ Build started: Project: WinUI3Managed, Configuration: Debug x64 ------
1>You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
1>Target assembly has already been patched. Exiting early as there is no work to do.
1>WinUI3Managed -> D:\Projects\WinUI3TestApp\WinUI3Managed\bin\x64\Debug\net5.0-windows10.0.19041.0\WinUI3Managed.dll
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========

Expected behavior

Build started...
========== Build: 0 succeeded, 0 failed, 2 up-to-date, 0 skipped ==========

Screenshots
N/A

Version Info

NuGet package version:
Microsoft.WindowsAppSDK 1.0.0-preview1

Visual Studio version:
VS 2019
VS 2022 Preview

Windows version Saw the problem?
Insider Build (xxxxx) Yes
May 2020 Update (19041)
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)

Additional context
WinUI3TestApp.zip

@jlaanstra
Copy link
Contributor Author

@Scottj1s do we have a contact in the VS project system who can look into what's tripping FastUpToDate?

drewnoakes added a commit to drewnoakes/project-system that referenced this issue Oct 15, 2021
`File.GetLastWriteTimeUtc` can throw several exceptions. One of them (`NotSupportedException`) was not covered in our catch clauses.

This exception was observed in microsoft/WindowsAppSDK#1525, where an invalid path string was being provided. When this exception is caught, the file is considered unavailable, and we log the path in the up-to-date check output. This will unblock further diagnosis.
@drewnoakes
Copy link
Member

drewnoakes commented Oct 15, 2021

I took a look into this from the VS side and filed PR dotnet/project-system#7698 to help diagnose this kind of issue in future.

With that change, the output would now include:

1>FastUpToDate: Source 'C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Foundation.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Graphics.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.UI.Text.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.UI.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.UI.Xaml.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Web.WebView2.Core.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.ApplicationModel.DynamicDependency.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.ApplicationModel.Resources.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.AppLifecycle.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.PushNotifications.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.System.Power.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.System.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Foundation.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Graphics.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.UI.Text.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.UI.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.UI.Xaml.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Web.WebView2.Core.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.ApplicationModel.DynamicDependency.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.ApplicationModel.Resources.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.AppLifecycle.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.PushNotifications.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.System.Power.winmd;C:\Users\drnoakes\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.System.winmd;D:\repos\issues\WinUI3TestApp\x64\Debug\WinUI3TestNative\WinUI3TestNative.winmd' does not exist, not up to date. (WinUI3Managed)
1>FastUpToDate: Up to date check completed in 51.8 ms (WinUI3Managed)

You can see there's a very long semicolon-delimited list of paths being treated as a single path.

This hint was present, but less obvious, before:

1>FastUpToDate: Checking copied output (UpToDateCheckBuilt with Original property) file 'D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Foundation.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Graphics.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.UI.Text.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.UI.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.UI.Xaml.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Web.WebView2.Core.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.ApplicationModel.DynamicDependency.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.ApplicationModel.Resources.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.AppLifecycle.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.PushNotifications.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.System.Power.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.System.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Foundation.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Graphics.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.UI.Text.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.UI.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.UI.Xaml.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Web.WebView2.Core.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.ApplicationModel.DynamicDependency.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.ApplicationModel.Resources.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.AppLifecycle.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.PushNotifications.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.System.Power.winmd;D:\.nuget\packages\microsoft.windowsappsdk\1.0.0-preview1\lib\uap10.0\Microsoft.Windows.System.winmd;D:\Projects\WinUI3TestApp\x64\Debug\WinUI3TestNative\WinUI3TestNative.winmd': (WinUI3Managed)

We can see the incorrectly formed path is coming from an UpToDateCheckBuilt item's Original metadata.

@drewnoakes
Copy link
Member

Ok I think the issue is here:

https://github.com/microsoft/CsWinRT/blob/375b8b93600bf9f6c90971c2e64f268f00641fb9/nuget/Microsoft.Windows.CsWinRT.targets#L122

This was broken in microsoft/CsWinRT#880.

Having said that, it might be reasonable to specify multiple paths in this way. I'll have to think about this. Any fix we made in VS for that would only apply in 17.1, so customers in 16.x or 17.0 would be out of luck.

@jlaanstra
Copy link
Contributor Author

@Scottj1s can you transfer this issue to the CsWinRT repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants