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

Visual Studio running into some problems while loading the Csproj with custm TargetPlatform #6656

Closed
Anipik opened this issue Oct 6, 2020 · 10 comments · Fixed by #6824
Closed
Assignees
Labels
Feature-Dependency-Node "Dependencies" node in Solution Explorer that display project, binary & package references Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed. Triage-Investigate Reviewed and investigation needed by dev team
Milestone

Comments

@Anipik
Copy link

Anipik commented Oct 6, 2020

Visual Studio Version:
Microsoft Visual Studio Enterprise 2019 Int Preview
Version 16.9.0 Preview 1.0 [30601.220.main]

Summary
Build is still working but the VS gives a warning that some of the functions might not work

Steps to Reproduce:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFrameworks>net5.0;net5.0-WindowsLKG</TargetFrameworks>
    <TargetPlatformSupported>true</TargetPlatformSupported>
    <TargetPlatformVersionSupported>true</TargetPlatformVersionSupported>
  </PropertyGroup>
  <PropertyGroup Condition="'$(TargetFramework)' == 'net5.0-WindowsLKG'">
    <TargetPlatformIdentifier>Unix</TargetPlatformIdentifier>
    <TargetPlatformVersion>8.0</TargetPlatformVersion>
  </PropertyGroup>
</Project>

Error

Must contain activeTargetFramework (.NETCoreApp,Version=v5.0).
Parameter name: dependenciesByTargetFramework

Log

=====================
10/6/2020 3:18:36 PM
Recoverable
System.AggregateException: Project system data flow 'DataflowBlockSlim (ActionBlockSlimAsync`1 : 12811440)' closed because of an exception: System.AggregateException: One or more errors occurred. ---> System.ArgumentException: Must contain activeTargetFramework (.NETCoreApp,Version=v5.0).
Parameter name: dependenciesByTargetFramework
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Snapshot.DependenciesSnapshot..ctor(TargetFramework activeTargetFramework, ImmutableDictionary`2 dependenciesByTargetFramework)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Snapshot.DependenciesSnapshot.SetTargets(ImmutableArray`1 targetFrameworks, TargetFramework activeTargetFramework)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.<>c__DisplayClass32_0.<UpdateProjectContextAndSubscriptionsAsync>b__2(DependenciesSnapshot previousSnapshot)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.SnapshotUpdater.TryUpdate(Func`2 updateFunc, CancellationToken token)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.<<UpdateProjectContextAndSubscriptionsAsync>b__32_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Threading.SemaphoreSlimExtensions.<ExecuteWithinLockAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.<<OnProjectFactoryCompletedAsync>g__OnActiveConfiguredProjectEvaluatedAsync|24_1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.DataReceivingBlockSlim`1.<ProcessInputQueueAsync>d__5.MoveNext()
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.ArgumentException: Must contain activeTargetFramework (.NETCoreApp,Version=v5.0).
Parameter name: dependenciesByTargetFramework
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Snapshot.DependenciesSnapshot..ctor(TargetFramework activeTargetFramework, ImmutableDictionary`2 dependenciesByTargetFramework)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Snapshot.DependenciesSnapshot.SetTargets(ImmutableArray`1 targetFrameworks, TargetFramework activeTargetFramework)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.<>c__DisplayClass32_0.<UpdateProjectContextAndSubscriptionsAsync>b__2(DependenciesSnapshot previousSnapshot)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.SnapshotUpdater.TryUpdate(Func`2 updateFunc, CancellationToken token)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.<<UpdateProjectContextAndSubscriptionsAsync>b__32_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Threading.SemaphoreSlimExtensions.<ExecuteWithinLockAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.<<OnProjectFactoryCompletedAsync>g__OnActiveConfiguredProjectEvaluatedAsync|24_1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.DataReceivingBlockSlim`1.<ProcessInputQueueAsync>d__5.MoveNext()<---
. ---> System.ArgumentException: Must contain activeTargetFramework (.NETCoreApp,Version=v5.0).
Parameter name: dependenciesByTargetFramework
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Snapshot.DependenciesSnapshot..ctor(TargetFramework activeTargetFramework, ImmutableDictionary`2 dependenciesByTargetFramework)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Snapshot.DependenciesSnapshot.SetTargets(ImmutableArray`1 targetFrameworks, TargetFramework activeTargetFramework)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.<>c__DisplayClass32_0.<UpdateProjectContextAndSubscriptionsAsync>b__2(DependenciesSnapshot previousSnapshot)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.SnapshotUpdater.TryUpdate(Func`2 updateFunc, CancellationToken token)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.<<UpdateProjectContextAndSubscriptionsAsync>b__32_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Threading.SemaphoreSlimExtensions.<ExecuteWithinLockAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.<<OnProjectFactoryCompletedAsync>g__OnActiveConfiguredProjectEvaluatedAsync|24_1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.DataReceivingBlockSlim`1.<ProcessInputQueueAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.ProjectSystem.CommonProjectSystemTools.Rethrow(Exception ex)
   at Microsoft.VisualStudio.ProjectSystem.ProjectErrorReporting.<>c__DisplayClass6_0.<SubmitErrorReport>b__0()
   at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2_0.<Guard>g__action|0()
   at GuardMethodClass.GuardMethod(Func`1 , Func`2 , Func`2 )
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.ArgumentException: Must contain activeTargetFramework (.NETCoreApp,Version=v5.0).
Parameter name: dependenciesByTargetFramework
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Snapshot.DependenciesSnapshot..ctor(TargetFramework activeTargetFramework, ImmutableDictionary`2 dependenciesByTargetFramework)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Snapshot.DependenciesSnapshot.SetTargets(ImmutableArray`1 targetFrameworks, TargetFramework activeTargetFramework)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.<>c__DisplayClass32_0.<UpdateProjectContextAndSubscriptionsAsync>b__2(DependenciesSnapshot previousSnapshot)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.SnapshotUpdater.TryUpdate(Func`2 updateFunc, CancellationToken token)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.<<UpdateProjectContextAndSubscriptionsAsync>b__32_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Threading.SemaphoreSlimExtensions.<ExecuteWithinLockAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.<<OnProjectFactoryCompletedAsync>g__OnActiveConfiguredProjectEvaluatedAsync|24_1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.DataReceivingBlockSlim`1.<ProcessInputQueueAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.ProjectSystem.CommonProjectSystemTools.Rethrow(Exception ex)
   at Microsoft.VisualStudio.ProjectSystem.ProjectErrorReporting.<>c__DisplayClass6_0.<SubmitErrorReport>b__0()
   at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2_0.<Guard>g__action|0()
   at GuardMethodClass.GuardMethod(Func`1 , Func`2 , Func`2 )<---

===================

cc @ericstj @ViktorHofer @safern

@ViktorHofer
Copy link
Member

cc @drewnoakes

@jjmew jjmew added the Triage-Investigate Reviewed and investigation needed by dev team label Oct 9, 2020
@jjmew jjmew added this to the 16.x milestone Oct 9, 2020
@drewnoakes
Copy link
Member

See also this CPS NFE.

@Anipik
Copy link
Author

Anipik commented Oct 30, 2020

See also this CPS NFE.

Can you give some context on what this link is about. i currently dont have permissions to do so.

@drewnoakes
Copy link
Member

@Anipik thank links to an internal dashboard where we track reported faults.

@drewnoakes drewnoakes added the Feature-Dependency-Node "Dependencies" node in Solution Explorer that display project, binary & package references label Nov 23, 2020
@danmoseley
Copy link
Member

This reproes simply cloning https://github.com/dotnet/runtime and opening src\libraries\System.Security.AccessControl\src\System.Security.AccessControl.csproj in 16.9 preview 3..

System.AggregateException: Project system data flow 'DataflowBlockSlim (ActionBlockSlimAsync`1 : 61111205)' closed because of an exception: System.AggregateException: One or more errors occurred. ---> System.ArgumentException: Value ".NETCoreApp,Version=v6.0" is unexpected. Must be a key in dependenciesByTargetFramework, which contains ".NETStandard,Version=v2.0,Profile=windows", ".NETCoreApp,Version=v2.1,Profile=Unix", ".NETCoreApp,Version=v2.1,Profile=windows", ".NETFramework,Version=v4.6.1,Profile=windows", ".NETStandard,Version=v2.0", ".NETStandard,Version=v2.0,Profile=Unix".
Parameter name: activeTargetFramework
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Snapshot.DependenciesSnapshot..ctor(TargetFramework activeTargetFramework, ImmutableDictionary`2 dependenciesByTargetFramework)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Snapshot.DependenciesSnapshot.SetTargets(ImmutableArray`1 targetFrameworks, TargetFramework activeTargetFramework)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.<>c__DisplayClass32_0.<UpdateProjectContextAndSubscriptionsAsync>b__2(DependenciesSnapshot previousSnapshot)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.SnapshotUpdater.TryUpdate(Func`2 updateFunc, CancellationToken token)
   at Microsoft.VisualStudio.ProjectSystem.Tree.Dependencies.Subscriptions.DependenciesSnapshotProvider.<<UpdateProjectContextAndSubscriptionsAsync>b__32_0>d.MoveNext()

@ViktorHofer
Copy link
Member

ViktorHofer commented Jan 1, 2021

Thanks Dan, that's really helpful. @drewnoakes how is dependenciesByTargetFramework calculated? It lists netcoreapp2.1 in it even though that projects doesn't have such configuration but instead net6.0 which is missing from the list.

@drewnoakes
Copy link
Member

Hey @ViktorHofer, apologies for the delay.

The collection is computed in AggregateCrossTargetProjectContextProvider.CreateProjectContextAsync, which in turn sources its values from CPS's IActiveConfiguredProjectsProvider.GetActiveConfiguredProjectsMapAsync. This part of the system needs revisiting, though it's low priority for us currently. We're tracking that in #6183.

@drewnoakes
Copy link
Member

drewnoakes commented Jan 11, 2021

Perhaps @lifengl knows a better API to retrieve the set of TFMs for a given UnconfiguredProject, as a short term solution to this problem.

drewnoakes added a commit to drewnoakes/project-system that referenced this issue Jan 11, 2021
The removed validation in is sound in theory, however is causing quite a few NFEs. For example dotnet#6656.

This commit disables it for now. The consequence of this test failing is that dependencies added to the tree are not exposed via extensibility APIs such as DTE/VSLangProj.

At some point we should revisit how the dependencies tree models its target frameworks, likely as part of dotnet#6183.
@drewnoakes
Copy link
Member

@ViktorHofer I've filed #6824 which disables the validation that's firing here. Whilst the validation is sound in theory, it isn't protecting against anything terribly serious and so I think the right thing to do is disable it for now. As I mentioned, in future I want to fix how we handle target frameworks in the dependencies tree, and at that time reinstate this validation.

@ViktorHofer
Copy link
Member

Thanks a lot @drewnoakes

@ghost ghost added the Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed. label Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature-Dependency-Node "Dependencies" node in Solution Explorer that display project, binary & package references Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed. Triage-Investigate Reviewed and investigation needed by dev team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants