Closed quassnoi closed 4 days ago
@quassnoi The SourceTest.cs file is being opened as a transient file in the miscellaneous workspace. You would see the following in your log if the LogLevel was set to trace:
[dbug]: OmniSharp.Roslyn.BufferManager
Adding transient file for /Users/joeyrobichaud/Downloads/omnisharp-intellisense-bug/source/SourceTest.cs
This workspace has a fairly small core set of references that are used to provide language services in the editor. It just happens that xunit is one of the references.
@quassnoi The SourceTest.cs file is being opened as a transient file in the miscellaneous workspace. You would see the following in your log if the LogLevel was set to trace:
[dbug]: OmniSharp.Roslyn.BufferManager Adding transient file for /Users/joeyrobichaud/Downloads/omnisharp-intellisense-bug/source/SourceTest.cs
This workspace has a fairly small core set of references that are used to provide language services in the editor. It just happens that xunit is one of the references.
I must admit I'm not intimately familiar with the inner workings of OmniSharp, but the Intellisense warning goes away if I comment out the <ItemGroup>
in consumer.csproj
and restart the extension.
The log entry for "adding transient file" is still there when I do that.
A lot has changed with O# project loading since this issue was opened. If you are still having problems, please open a new issue at https://github.com/omnisharp/omnisharp-roslyn/issues
Issue Description
omnisharp-intellisense-bug.tar.gz
In the solution folder, there are two projects: consumer (an xUnit test suite) and source (a classlib project).
Consumer copies *.cs files from source into its output folder on build, with a custom task.
This is a minimal reproducible example of the problem, but in my original project consumer is a unit test suite for a Roslyn analyzer, and source has the set of files I'm running the tests on. I prefer to keep them in a project because I can auto-format them, run syntax checks etc., but conceptually, source is just a source of data for unit tests, the data items being C# course code.
source is not a part of the solution and doesn't produce any artifacts.
Since source is not a part of compilation, I would expect that Intellisense would not look into source files while analyzing consumer.
However, it's not the case. One of the files in source redefines
XUnit.FactAttribute
and Intellisense is complaining about it, even though consumer is not using this file in compilation.The problem only affects Intellisense.
dotnet build
doesn't produce any warnings.This only happens if there is a solution file in the project. If I remove the solution file, the problem goes away.
If I go to
consumer.csproj
and remove the custom task which copies the files from source on build, the problem goes away as well.Steps to Reproduce
dotnet build
. Observe that there are no errors or warnings on build.Expected Behavior
No problems shown
Actual Behavior
Logs
OmniSharp log
C# log
Environment information
VSCode version: 1.67.2 C# Extension: 1.25.0
Mono Information
There is a problem with running OmniSharp on mono: Error: Unable to find Mono. Ensure that Mono's '/bin' folder is added to your environment's PATH variable.Dotnet Information
Пакет SDK для .NET (отражающий любой global.json): Version: 6.0.300 Commit: 8473146e7d Среда выполнения: OS Name: ubuntu OS Version: 20.04 OS Platform: Linux RID: ubuntu.20.04-x64 Base Path: /usr/share/dotnet/sdk/6.0.300/ Host (useful for support): Version: 6.0.5 Commit: 70ae3df4a6 .NET SDKs installed: 6.0.300 [/usr/share/dotnet/sdk] .NET runtimes installed: Microsoft.AspNetCore.App 6.0.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App] To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-downloadVisual Studio Code Extensions
|Extension|Author|Version| |---|---|---| |csharp|ms-dotnettools|1.25.0| |dotnet-test-explorer|formulahendry|0.7.7| |EditorConfig|EditorConfig|0.16.4| |xml|DotJoshJohnson|2.5.1|;