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

LanguageServerProjectSystem Error while loading ...csproj #7402

Closed
nathanswim opened this issue Jul 29, 2024 · 8 comments · Fixed by dotnet/roslyn#74791
Closed

LanguageServerProjectSystem Error while loading ...csproj #7402

nathanswim opened this issue Jul 29, 2024 · 8 comments · Fixed by dotnet/roslyn#74791
Assignees
Milestone

Comments

@nathanswim
Copy link

Type: Bug

Issue Description

I keep getting the error on Mac Arm64:
[Error - 4:46:28 PM] [LanguageServerProjectSystem] Error while loading ...csproj: Exception thrown: System.ArgumentException: Project does not contain output path '../obj/Debug/net8.0/win-x64/SendNotifications.dll' (Parameter 'outputPath')

csproj listing:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net8.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>disable</Nullable>
        <Title>Notification Sender</Title>
        <PublishSingleFile>true</PublishSingleFile>
        <SelfContained>true</SelfContained>
    </PropertyGroup>
...
    <ItemGroup>
        <None Update="appsettings.json">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
    </ItemGroup>

</Project>

Steps to Reproduce

I just use the following commands:

dotnet new console --name SendNotifications
dotnet new xunit --name _TestSendNotifications
dotnet new sln --SendNotifications
dotnet sln add SendNotifications/SendNotifications.csproj
dotnet sln add _TestSendNotifications/_TestSendNotifications.csproj
dotnet add _TestSendNotifications/_TestSendNotifications.csproj project SendNotifications/SendNotifications.csproj

Expected Behavior

Actual Behavior

Keep getting the error:
There were problems loading project SendNotifications.csproj. See log for details.

Logs

ArgumentException: Project does not contain output path '/Users/[user]/source/Server/a2u_web_configurations/SendNotifications/SendNotifications/obj/Debug/net8.0/win-x64/SendNotifications.dll' (Parameter 'outputPath')
at Microsoft.CodeAnalysis.Workspaces.ProjectSystem.ProjectSystemProjectFactory.RemoveProjectOutputPath_NoLock(SolutionChangeAccumulator solutionChanges, ProjectId projectId, String outputPath, ProjectUpdateState projectUpdateState, Boolean solutionClosing, SolutionServices solutionServices) in //src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProjectFactory.cs:line 756
at Microsoft.CodeAnalysis.Workspaces.ProjectSystem.ProjectSystemProject.<>c__DisplayClass54_0.b__0(SolutionChangeAccumulator solutionChanges, ProjectUpdateState projectUpdateState, String oldValue) in /
/src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProject.cs:line 342
at Microsoft.CodeAnalysis.Workspaces.ProjectSystem.ProjectSystemProject.<>c__DisplayClass104_0.b__0(SolutionChangeAccumulator solutionChanges, ProjectUpdateState projectUpdateState) in //src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProject.cs:line 568
at Microsoft.CodeAnalysis.Workspace.SetCurrentSolutionAsync[TData](Boolean useAsync, TData data, Func3 transformation, Boolean mayRaiseEvents, Action3 onBeforeUpdate, Action3 onAfterUpdate, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Workspace/Workspace.cs:line 514 at Microsoft.CodeAnalysis.Workspace.SetCurrentSolutionAsync(Boolean useAsync, Func2 transformation, Func3 changeKind, Action2 onBeforeUpdate, Action2 onAfterUpdate, CancellationToken cancellationToken) in /_/src/Workspaces/Core/Portable/Workspace/Workspace.cs:line 251 at Microsoft.CodeAnalysis.Workspaces.ProjectSystem.ProjectSystemProjectFactory.ApplyBatchChangeToWorkspaceMaybe_NoLockAsync(Boolean useAsync, Func3 mutation, Action1 onAfterUpdateAlways) in /_/src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProjectFactory.cs:line 297 at Microsoft.CodeAnalysis.Workspaces.ProjectSystem.ProjectSystemProjectFactory.ApplyBatchChangeToWorkspaceMaybeAsync(Boolean useAsync, Func3 mutation, Action`1 onAfterUpdateAlways) in /
/src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProjectFactory.cs:line 273
at Microsoft.CodeAnalysis.Workspaces.ProjectSystem.ProjectSystemProject.OnBatchScopeDisposedMaybeAsync(Boolean useAsync) in //src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProject.cs:line 564
at Microsoft.CodeAnalysis.Workspaces.ProjectSystem.ProjectSystemProject.BatchScope.DisposeAsync() in /
/src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProject.cs:line 533
at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LoadedProject.UpdateWithNewProjectInfoAsync(ProjectFileInfo newProjectInfo, ILogger logger) in //src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LoadedProject.cs:line 196
at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.LanguageServerProjectSystem.LoadOrReloadProjectAsync(ProjectToLoad projectToLoad, ToastErrorReporter toastErrorReporter, BuildHostProcessManager buildHostProcessManager, CancellationToken cancellationToken) in /
/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs:line 262

C# log

Post the output from Output-->C# here

C# LSP Trace Logs

Post the output from Output-->C# LSP Trace Logs here. Requires `dotnet.server.trace` to be set to `Trace`

Environment information

VSCode version: 1.91.1
C# Extension: 2.39.29
Using OmniSharp: false

Dotnet Information .NET SDK: Version: 8.0.303 Commit: 29ab8e3268 Workload version: 8.0.300-manifests.c915c39d MSBuild version: 17.10.4+10fbfbf2e

Runtime Environment:
OS Name: Mac OS X
OS Version: 14.5
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/8.0.303/

.NET workloads installed:
There are no installed workloads to display.

Host:
Version: 8.0.7
Architecture: arm64
Commit: 2aade6beb0

.NET SDKs installed:
6.0.402 [/usr/local/share/dotnet/sdk]
6.0.403 [/usr/local/share/dotnet/sdk]
6.0.424 [/usr/local/share/dotnet/sdk]
7.0.100 [/usr/local/share/dotnet/sdk]
7.0.317 [/usr/local/share/dotnet/sdk]
8.0.303 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.10 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.32 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.20 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.32 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.20 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
x64 [/usr/local/share/dotnet/x64]

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

Visual Studio Code Extensions
Extension Author Version Folder Name
atom-material-theme tobiasalthoff 1.10.9 tobiasalthoff.atom-material-theme-1.10.9
ayu teabyii 1.0.5 teabyii.ayu-1.0.5
Bookmarks alefragnani 13.5.0 alefragnani.bookmarks-13.5.0
csdevkit ms-dotnettools 1.8.14 ms-dotnettools.csdevkit-1.8.14-darwin-arm64
csharp ms-dotnettools 2.39.29 ms-dotnettools.csharp-2.39.29-darwin-arm64
data-workspace-vscode ms-mssql 0.5.0 ms-mssql.data-workspace-vscode-0.5.0
gitlens eamodio 15.2.3 eamodio.gitlens-15.2.3
icons tal7aouy 3.8.0 tal7aouy.icons-3.8.0
LiveServer ritwickdey 5.7.9 ritwickdey.liveserver-5.7.9
markdown-all-in-one yzhang 3.6.2 yzhang.markdown-all-in-one-3.6.2
markdown-mermaid bierner 1.23.1 bierner.markdown-mermaid-1.23.1
markdown-pdf yzane 1.5.0 yzane.markdown-pdf-1.5.0
markdown-preview-enhanced shd101wyy 0.8.13 shd101wyy.markdown-preview-enhanced-0.8.13
material-icon-theme PKief 5.8.0 pkief.material-icon-theme-5.8.0
material-theme zhuangtongfa 3.17.2 zhuangtongfa.material-theme-3.17.2
mssql ms-mssql 1.22.1 ms-mssql.mssql-1.22.1
one-monokai-python NoThlnG 0.4.5 nothlng.one-monokai-python-0.4.5
powershell ms-vscode 2024.2.2 ms-vscode.powershell-2024.2.2
remote-containers ms-vscode-remote 0.375.1 ms-vscode-remote.remote-containers-0.375.1
remote-explorer ms-vscode 0.4.3 ms-vscode.remote-explorer-0.4.3
remote-server ms-vscode 1.5.2 ms-vscode.remote-server-1.5.2
remote-ssh ms-vscode-remote 0.112.0 ms-vscode-remote.remote-ssh-0.112.0
remote-ssh-edit ms-vscode-remote 0.86.0 ms-vscode-remote.remote-ssh-edit-0.86.0
remote-wsl ms-vscode-remote 0.88.2 ms-vscode-remote.remote-wsl-0.88.2
RunOnSave emeraldwalk 0.2.0 emeraldwalk.runonsave-0.2.0
simple-react-snippets burkeholland 1.2.8 burkeholland.simple-react-snippets-1.2.8
snyk-vulnerability-scanner snyk-security 2.15.0 snyk-security.snyk-vulnerability-scanner-2.15.0
sql-bindings-vscode ms-mssql 0.4.0 ms-mssql.sql-bindings-vscode-0.4.0
sql-database-projects-vscode ms-mssql 1.4.1 ms-mssql.sql-database-projects-vscode-1.4.1
theme-atom-one-dark andischerer 0.0.1 andischerer.theme-atom-one-dark-0.0.1
theme-monokai-light anoff 1.2.0 anoff.theme-monokai-light-1.2.0
todo-txt rarnoldmobile 0.0.5 rarnoldmobile.todo-txt-0.0.5
vsc-material-theme-icons equinusocio 3.6.1 equinusocio.vsc-material-theme-icons-3.6.1
vscode-docker ms-azuretools 1.29.1 ms-azuretools.vscode-docker-1.29.1
vscode-dotnet-runtime ms-dotnettools 2.1.1 ms-dotnettools.vscode-dotnet-runtime-2.1.1
vscode-icons vscode-icons-team 12.8.0 vscode-icons-team.vscode-icons-12.8.0
vscode-markdownlint DavidAnson 0.55.0 davidanson.vscode-markdownlint-0.55.0
vscode-remote-extensionpack ms-vscode-remote 0.25.0 ms-vscode-remote.vscode-remote-extensionpack-0.25.0
vscode-rusty-onedark Jeraldson 1.0.3 jeraldson.vscode-rusty-onedark-1.0.3
vscode-theme-onelight akamud 2.3.0 akamud.vscode-theme-onelight-2.3.0
vsliveshare ms-vsliveshare 1.0.5936 ms-vsliveshare.vsliveshare-1.0.5936
xcode-12-theme mateocerquetella 5.0.0 mateocerquetella.xcode-12-theme-5.0.0
xml DotJoshJohnson 2.5.1 dotjoshjohnson.xml-2.5.1

Extension version: 2.39.29
VS Code version: Code 1.91.1 (Universal) (f1e16e1e6214d7c44d078b1f0607b2388f29d729, 2024-07-09T22:07:54.982Z)
OS version: Darwin arm64 23.5.0
Modes:

System Info
Item Value
CPUs Apple M1 Pro (10 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
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
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 3, 4, 3
Memory (System) 16.00GB (0.08GB free)
Process Argv --crash-reporter-id cb047d21-7dfd-4d63-bac2-fb4577940f26
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
bdiig495:31013172
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
dwnewjupyter:31046869
impr_priority:31102340
refactort:31101459
ccplc:31103425
pythonrstrctxtcf:31103194

@Mrcubix
Copy link

Mrcubix commented Jul 29, 2024

Also encountering the same issue, seems like something broke with the update from 6 days ago. Reverting to an older version is a workaround for now.

@dibarbet dibarbet self-assigned this Jul 31, 2024
@dibarbet dibarbet added this to the August2024 milestone Jul 31, 2024
@dibarbet
Copy link
Member

dibarbet commented Aug 1, 2024

I wasn't able to reproduce this using the commands you sent on my Mac - but I also don't see any appsettings.json being referenced in any of the projects generated by the templates, so it is possible I'm missing a step.

Would you be able to

  1. Attach the entire sln that is failing to load here (or send to my msft email, listed on my profile and reference this issue #).
  2. Is this issue reproducing every time you close / re-open VSCode - or only if you have VSCode opened when you run the commands?
  3. Set dotnet.server.trace to Trace in vscode settings, reload the window and then attach the C# output window contents here?

@nathanswim
Copy link
Author

image
I reinstalled the CSDevKit extension and now none of the csdevkit.* commands can be found.
The upside is that I am no longer getting the original error.

FWIW, I am using Profiles in VSCode.

@PetSerAl
Copy link

PetSerAl commented Aug 2, 2024

I have the same error, but with recent Avalonia version (11.1.1).
I happens to reduce repro case to following:

Test.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
  </PropertyGroup>
  <Target Name="MyBuild" AfterTargets="Compile">
    <ItemGroup>
      <IntermediateAssembly Update="*" AvaloniaCompileOutput="%(RelativeDir)Avalonia\%(Filename)%(Extension)" />
    </ItemGroup>
    <Copy SourceFiles="@(IntermediateAssembly)" DestinationFiles="@(IntermediateAssembly->Metadata('AvaloniaCompileOutput'))"/>
    <ItemGroup>
      <_AvaloniaXamlCompiledAssembly Include="@(IntermediateAssembly->Metadata('AvaloniaCompileOutput'))" />
      <IntermediateAssembly Remove="@(IntermediateAssembly)" />
      <IntermediateAssembly Include="@(_AvaloniaXamlCompiledAssembly)" />
    </ItemGroup>
  </Target>
</Project>

Test.cs

System.Console.WriteLine("Test");

Works with v2.34.12, fail with v2.39.29.

@Mrcubix
Copy link

Mrcubix commented Aug 3, 2024

With a default Avalonia template (except for some added dependencies in the core csproj) on Windows, without dev kit:

Reproduction Repo: https://github.com/Mrcubix/CsharpExtensionPathIssue

Logs: Reproduction Repo or extension.log on Line 252

@dibarbet
Copy link
Member

This should be fixed in next weeks prerelease (not this weeks). Will update when it is available.

@dibarbet
Copy link
Member

This should be available in 2.45.17 prerelease - let me know if you're still having issues with that version.

@GuaiGuaiOnMyComputer
Copy link

Thank you very much! It was instantly fixed once I switched to 2.45.17 prerelease. Originally I was experiencing this problem working with Avalonia and .NET 8.0.108.

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