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

ProcessFrameworkReferences task failed unexpectedly (was: Pre-Release version not working but Release version is working) #5980

Closed
Tracked by #5736
wahmedswl opened this issue Aug 1, 2023 · 10 comments · Fixed by dotnet/roslyn#69354
Assignees
Milestone

Comments

@wahmedswl
Copy link

Environment data

dotnet --info output:

.NET SDK:
Version: 7.0.400-preview.23330.10
Commit: 30cbb54276

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22621
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\7.0.400-preview.23330.10\

Host:
Version: 7.0.8
Architecture: x64
Commit: 4b0550942d

.NET SDKs installed:
3.1.426 [C:\Program Files\dotnet\sdk]
5.0.408 [C:\Program Files\dotnet\sdk]
6.0.120 [C:\Program Files\dotnet\sdk]
6.0.203 [C:\Program Files\dotnet\sdk]
6.0.315 [C:\Program Files\dotnet\sdk]
7.0.400-preview.23330.10 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.23 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.29 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.30 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
Not found

VS Code version:

C# Extension version:
Pre-Release Version

OmniSharp log

The "ProcessFrameworkReferences" task failed unexpectedly.
System.IO.FileLoadException: Could not load file or assembly 'NuGet.Frameworks, Version=6.7.0.111, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (0x80131621)
File name: 'NuGet.Frameworks, Version=6.7.0.111, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
---> System.IO.FileLoadException: Could not load file or assembly 'NuGet.Frameworks, Version=6.7.0.111, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
at System.Runtime.Loader.AssemblyLoadContext.g____PInvoke|5_0(IntPtr ptrNativeAssemblyBinder, UInt16* ilPath, UInt16* niPath, ObjectHandleOnStack retAssembly)
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
at Microsoft.NET.Build.Tasks.ProcessFrameworkReferences.<>c.b__141_0(ITaskItem item)
at System.Linq.Enumerable.SelectArrayIterator2.MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator1.ToList()
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Microsoft.NET.Build.Tasks.ProcessFrameworkReferences.ExecuteCore()
at Microsoft.NET.Build.Tasks.TaskBase.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)

Steps to reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Actual behavior

Additional context

Add any other context about the problem here.

@arunchndr arunchndr added this to the Post GA milestone Aug 2, 2023
@arunchndr
Copy link
Member

Using this as the external tracking issue for the issue we have been talking about recently. @mikadumont this should be added to the known issues.

The workaround currently is to use C# Dev Kit along with C#.

@wahmedswl
Copy link
Author

@arkalyanms Why switch to Dev Kit? Not using Dev Kit due to licensing issue, so its explicit decision. When release version is working, pre-release should also be compatible.

Would really appreciate if there is workaround etc otherwise have to stick with release version. Will release version remain compatible or it will also start to have issues just like pre-release version?

Thanks

@mikadumont mikadumont mentioned this issue Aug 2, 2023
10 tasks
@jasonmalinowski
Copy link
Member

@wahmedswl We are still investigating exactly why this is breaking -- the recommendation for DevKit as a workaround isn't a permanent recommendation, just that's what would unblock with the bits we have released.

@wahmedswl
Copy link
Author

@jasonmalinowski Thanks for the Note, will wait for the fix.

@dibarbet dibarbet modified the milestones: Post GA, August Aug 2, 2023
@arunchndr arunchndr changed the title Pre-Release version not working but Release version is working ProcessFrameworkReferences task failed unexpectedly (was: Pre-Release version not working but Release version is working) Aug 2, 2023
jasonmalinowski added a commit to jasonmalinowski/roslyn that referenced this issue Aug 3, 2023
The 7.0.4xx SDKs ship with a newer version of NuGet.Frameworks than
we are shipping. Due to a complicated set of interactions of how
the various AssemblyLoadingContexts work (or don't work as expected!),
this means that when our LSP server uses MSBuildWorkspace to load
projects, it'll end up using the NuGet.Frameworks we use here rather
than the MSBuild one, causing load issues.

The underlying problem is tracked with
dotnet#61454, although I still need
to write up the full situation in that bug since back in June we ended
up running into a similar issue and had lots of deep analysis of it.
Fixing the problem requires changes in several different repositories
(and all involving AssemblyLoadContexts, so the changes are very
technical) so for now we'll just bump the version.

Fixes dotnet/vscode-csharp#5980
@wahmedswl
Copy link
Author

Release version now also has this BUG, what happened? Pushed the version even knowing having BUGS?

image

Thanks

jasonmalinowski added a commit to jasonmalinowski/roslyn that referenced this issue Aug 3, 2023
The 7.0.4xx SDKs ship with a newer version of NuGet.Frameworks than
we are shipping. Due to a complicated set of interactions of how
the various AssemblyLoadingContexts work (or don't work as expected!),
this means that when our LSP server uses MSBuildWorkspace to load
projects, it'll end up using the NuGet.Frameworks we use here rather
than the MSBuild one, causing load issues.

The underlying problem is tracked with
dotnet#61454, although I still need
to write up the full situation in that bug since back in June we ended
up running into a similar issue and had lots of deep analysis of it.
Fixing the problem requires changes in several different repositories
(and all involving AssemblyLoadContexts, so the changes are very
technical) so for now we'll just bump the version.

Fixes dotnet/vscode-csharp#5980
@wahmedswl
Copy link
Author

@jasonmalinowski Will new release be pushed?

@jasonmalinowski
Copy link
Member

@wahmedswl Yep, it's now live as 2.0.328. If you're still seeing it please do reactivate and we can dig further. I wasn't entirely sure about your screenshot you shared right before I closed this -- was the bug you were highlighting just bad squiggles or something else?

@wahmedswl
Copy link
Author

@jasonmalinowski Yes, it was squiggles not being shown. Technically, extension was not working. Verified with 2.0.328 and everything is good now. Thanks

image

@jasonmalinowski
Copy link
Member

@wahmedswl Great to hear, thanks for the help and the original bug report. Since this was due to a version conflict only with newer SDK versions, since your bug had the full list of SDKs on your machine it made it easy to confirm.

@vindicatorr
Copy link

vindicatorr commented Aug 21, 2023

I think this may need to be re-opened...
Type: Bug

Go to Definition tooltip: No definition found for <...>

Using dotnet configured on PATH
Dotnet path: /opt/dotnet/dotnet
Activating C# standalone...
[Info  - 2:34:40 AM] [Program]Language server initialized
[Info  - 2:34:48 AM] [LanguageServerProjectSystem]Loaded MSBuild at /opt/dotnet/sdk/8.0.100-preview.7.23376.3
[Error - 2:34:49 AM] [LanguageServerProjectSystem]Failure while loading /<pathTo>.csproj: The "ProcessFrameworkReferences" task failed unexpectedly.
System.IO.FileLoadException: Could not load file or assembly 'NuGet.Frameworks, Version=6.8.0.41, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (0x80131621)
File name: 'NuGet.Frameworks, Version=6.8.0.41, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
 ---> System.IO.FileLoadException: Could not load file or assembly 'NuGet.Frameworks, Version=6.8.0.41, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingLoad(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
   at Microsoft.NET.Build.Tasks.ProcessFrameworkReferences.<>c.<ExecuteCore>b__169_0(ITaskItem item)
   at System.Linq.Enumerable.SelectArrayIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.ToList()
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Microsoft.NET.Build.Tasks.ProcessFrameworkReferences.ExecuteCore()
   at Microsoft.NET.Build.Tasks.TaskBase.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
[Info  - 2:34:50 AM] [LanguageServerProjectSystem]Successfully completed load of /<pathTo>.csproj
[Info  - 2:34:50 AM] [LanguageServerProjectSystem]Completed (re)load of all projects in 00:00:01.3270356

Extension version: 2.0.376
VS Code version: Code - Insiders 1.82.0-insider (ccb95fd921349023027a0df25ed291b0992b9a18, 2023-08-17T05:33:22.719Z)
OS version: Linux x64 6.4.0-rc2-dirty
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i3-4130 CPU @ 3.40GHz (4 x 3392)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 2, 3, 4
Memory (System) 7.22GB (1.49GB free)
Process Argv --password-store=gnome --crash-reporter-id a2928a5c-190e-4d25-8038-9980bdeb3821
Screen Reader no
VM 0%
DESKTOP_SESSION plasma
XDG_CURRENT_DESKTOP KDE
XDG_SESSION_DESKTOP KDE
XDG_SESSION_TYPE x11
A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256197
vslsvsres303:30308271
pythontb:30258533
pythonptprofiler:30281269
vshan820:30294714
vscod805cf:30301675
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30404738
py29gd2263:30784851
vsclangdf:30492506
c4g48928:30535728
dsvsc012:30540252
pynewext54:30618038
a9j8j154:30646983
showlangstatbar:30737417
7ij38806:30687742
pythonfmttext:30716741
pythoncmvfstr:30726892
fixshowwlkth:30771523
showindicator:30805243
pythongtdpath:30726887
i26e3531:30792625
gsofa:30797620
welcomedialog:30812478
pythonnosmt12:30779711
pythonidxpt:30768918
pythonnoceb:30776497
copilotsettingc:30808720
dsvsc013:30777762
dsvsc014:30777825
diffeditorv2:30786206
pythonmpsinfo:30815194

EDIT0: ... or not. I have been testing tintoy/msbuild-project-tools-server#60, and came across this issue when I used the 8.0 sdk only.
When I flipped back to the 6.0+7.0+8.0 sdk combo, I got:

Using dotnet configured on PATH
Dotnet path: /opt/dotnet/dotnet
Activating C# standalone...
[Info  - 2:47:28 AM] [Program]Language server initialized
[Info  - 2:47:28 AM] [LanguageServerProjectSystem]Loaded MSBuild at /opt/dotnet/sdk/7.0.304
[Info  - 2:47:31 AM] [LanguageServerProjectSystem]Successfully completed load of /<pathTo>.csproj
[Info  - 2:47:31 AM] [LanguageServerProjectSystem]Successfully completed load of /<pathTo>.csproj
[Info  - 2:47:31 AM] [LanguageServerProjectSystem]Completed (re)load of all projects in 00:00:02.9118893
[Info  - 2:47:32 AM] [LanguageServerProjectSystem]Successfully completed load of /<pathTo>.csproj
[Info  - 2:47:32 AM] [LanguageServerProjectSystem]Completed (re)load of all projects in 00:00:00.1292615
[Info  - 2:47:32 AM] [LanguageServerProjectSystem]Successfully completed load of /<pathTo>.csproj
[Info  - 2:47:32 AM] [LanguageServerProjectSystem]Completed (re)load of all projects in 00:00:00.2367405

HOWEVER, I still can't go-to/preview definitions like Console.WriteLine (same tooltip message above).

EDIT1: Switching to setting "dotnet.server.useOmnisharp": true, I got my go-to/preview back, but then that is probably to be expected since it's using omnisharp instead of LSP.

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.

5 participants