microsoft / qsharp-compiler

Q# compiler, command line tool, and Q# language server
https://docs.microsoft.com/quantum
MIT License
682 stars 171 forks source link

Namespaces cannot be found while the program runs normally #434

Closed TheOnlylight closed 4 years ago

TheOnlylight commented 4 years ago

I use the vscode on Win10, with .net 3.1.4 the VScode reported red on the namespaces fro Q#, however the program managed to build and run properly ,this is so werid image image

cgranade commented 4 years ago

Thanks for the report, @TheOnlylight! I'll go on and transfer this to the qsharp-compiler repo where we track extension issues, but in the meantime, would you be willing to share the contents of the Q# Language Extension tab of the Output pane? You can get to this pane by going to View → Output, then selecting "Q# Language Extension":

image

image

That additional information will be really helpful in diagnosing the issue that you encountered. Thanks!

valdaarhun commented 4 years ago

Hi. I too am facing this issue. The program works even though I get errors stating that the namespaces could not be found. I am using vs code with .net 3.1.300. The version of the windows OS that I am using is 6.1.7601. Console Screen The screenshot below shows the contents of the Q# Language Extension tab of the Output pane. Output

bettinaheim commented 4 years ago

Yes, the output clarifies what the issue is! Thanks, @valdaarhun! It looks like the package that we are using for the design time build is older than the dotnet version you are using. We can update that with our next release. Thanks for pointing it out! @ricardo-espinoza It would be good if we could find a more permanent solution than having to explicitly reference and update the NuGet.Frameworks package.

bettinaheim commented 4 years ago

See also https://github.com/microsoft/MSBuildLocator/issues/86

venkyms commented 4 years ago

Same namespace issue occurs in mac version as well. Below are the details

Mac version : 10.15.5 
VS code version : 1.45.1
dotnet core version : 3.1.300
Q# extension version: 0.11.20042825

Error Message from the output window(Q# Language Extension)

[Error - 5:42:29 PM] MSBuild error in /usr/local/share/dotnet/sdk/3.1.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(59,5): The "ProcessFrameworkReferences" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'NuGet.Frameworks, Version=5.6.0.5, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

File name: 'NuGet.Frameworks, Version=5.6.0.5, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
   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)

Is there any work arround for this issue, until this get patched ? Thanks.

bettinaheim commented 4 years ago

@venkyms I believe this issue should indeed be fixed with the June 4th release. Unfortunately it might temporarily reoccur until this is fixed or we find an alternative. The workaround in the case of reoccurrence would be to not use the latest dotnet version until we've had a chance to update the package as part of our release.

valdaarhun commented 4 years ago

Hi. I would like to point out that after updating vscode the errors no longer appear and the program runs properly.

abidart commented 4 years ago

Hello everyone, I think this might be happening again, but with a new version of NuGet.Frameworks. I am experiencing the same issue while following the steps of the tutorial: Exercise - Install the QDK for Visual Studio Code (https://docs.microsoft.com/en-us/learn/modules/qsharp-create-first-quantum-development-kit/2-install-quantum-development-kit-code).

I am using MacOS Mojave 10.14.6 with dotnet version 3.1.401.

Here is the log (with the paths to the project edited out)

[Info  - 8:46:39 PM] workspace folder: [edited]
[Error - 8:46:40 PM] MSBuild error in /usr/local/share/dotnet/sdk/3.1.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(59,5): The "ProcessFrameworkReferences" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'NuGet.Frameworks, Version=5.7.0.7, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

File name: 'NuGet.Frameworks, Version=5.7.0.7, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
   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)

[Error - 8:46:40 PM] Failed to restore project [edited]
[Error - 8:46:40 PM] MSBuild error in /usr/local/share/dotnet/sdk/3.1.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(59,5): The "ProcessFrameworkReferences" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'NuGet.Frameworks, Version=5.7.0.7, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

File name: 'NuGet.Frameworks, Version=5.7.0.7, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
   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)

[Error - 8:46:40 PM] Failed to resolve assembly references for project [edited]
Discovered Q# project [edited]
Loading project [edited]
Done loading project [edited]
bamarsha commented 4 years ago

Hi @abidart, that looks like the same problem as #558. It should be fixed in the next release sometime this week. :) Hopefully, the fix is permanent this time and should continue to work with newer .NET Core versions.

alfogo commented 3 years ago

Hi, any update on this?. I'm on Quantum Dev Kit 0.14.2011.120240 with .net core sdk 3.1.405 and getting exactly same issue

bamarsha commented 3 years ago

Hi @alfogo, this issue was fixed in August, and QDK 0.14.2011120240 should work with .NET Core 3.1.405 SDK. I'm not sure what's causing the problem you're seeing, unfortunately. Could you create a new GitHub issue for it?