Closed erenturkm closed 11 months ago
hi the test support requires nightly compiler as the necessary changes to rust compiler are not in stable yet.
to fix this, you will need to install nightly rust, switch to it and restart vs. let me know if that still does not solve the issue.
here is the documentation: https://youtu.be/pE1Vr2zVCbg?t=372
Sorry, it does not solve my issues since I can use test functionality with stable builds on other IDE's. This seems to be a problem with using rust in Visual Studio.
hi @erenturkm at least as of a couple of months back the rust testing experience was the most advanced in VS22 among all IDEs.
I personally made changes to the rust compiler to enable that.
Are you sure you have on par test explorer integration in other ides as well? manage, navigate, run, debug etc?
Note that rust nightly is pretty stable as it ford though a lot of, a lot of, testing. so using it during development should be find. for production releases rust stable can be used.
please reactivate as necessary.
Hi,
For the following code:
[test]
fn larger_can_hold_smaller() { let larger = Rectangle { width: 8, height: 7, }; let smaller = Rectangle { width: 5, height: 1, };
}
[test]
fn smaller_cannot_hold_larger() { let larger = Rectangle { width: 8, height: 7, }; let smaller = Rectangle { width: 5, height: 1, };
}
When I run Cargo test, it returns as expected.
When I build the solution in Visual Studio 2022 I get the following error: ========== Starting test discovery ========== ra.vs> DiscoverAndReportTestsFromOneSource starting with E:\erenturk\332-Rust\adder\target\debug\adder_libadder.rusttests ra.vs> Starting discovery of tests from E:\erenturk\332-Rust\adder\target\debug\adder_libadder.rusttests. ra.vs> ... using cargo.exe from 'C:\Users\MuratCudiErentürk.cargo\bin\cargo.exe'. ra.vs> Started PID:22776 with args: C:\Users\MuratCudiErentürk.cargo\bin\cargo.exe test --no-run --manifest-path E:\erenturk\332-Rust\adder\Cargo.toml --profile dev... ra.vs> ... Finished PID 22776 with exit code 0. ra.vs> Started PID:18536 with args: E:\erenturk\332-Rust\adder\target\debug\deps\adder-2d11de05d6b589d4.exe --list --format json -Zunstable-options... ra.vs> ... Finished PID 18536 with exit code 101. ra.vs> Unable to obtain metadata for file E:\erenturk\332-Rust\adder\Cargo.toml. Ex: System.InvalidOperationException: 101 error: the optiond50.MoveNext() in D:\a\rust-analyzer.vs\rust-analyzer.vs\src\RustAnalyzer.TestAdapter\Common\ProcessRunner.cs:line 343
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at KS.RustAnalyzer.TestAdapter.Cargo.ToolChainService.d 11.MoveNext() in D:\a\rust-analyzer.vs\rust-analyzer.vs\src\RustAnalyzer.TestAdapter\Cargo\ToolChainService.cs:line 202
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at KS.RustAnalyzer.TestAdapter.Cargo.ToolChainService.d10.MoveNext() in D:\a\rust-analyzer.vs\rust-analyzer.vs\src\RustAnalyzer.TestAdapter\Cargo\ToolChainService.cs:line 186
ra.vs> DiscoverAndReportTestsFromOneSource failed with System.InvalidOperationException: 101
error: the option d 50.MoveNext() in D:\a\rust-analyzer.vs\rust-analyzer.vs\src\RustAnalyzer.TestAdapter\Common\ProcessRunner.cs:line 343
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at KS.RustAnalyzer.TestAdapter.Cargo.ToolChainService.d11.MoveNext() in D:\a\rust-analyzer.vs\rust-analyzer.vs\src\RustAnalyzer.TestAdapter\Cargo\ToolChainService.cs:line 202
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at KS.RustAnalyzer.TestAdapter.Cargo.ToolChainService.d 10.MoveNext() in D:\a\rust-analyzer.vs\rust-analyzer.vs\src\RustAnalyzer.TestAdapter\Cargo\ToolChainService.cs:line 196
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at KS.RustAnalyzer.TestAdapter.TestDiscovererCommon.d2.MoveNext() in D:\a\rust-analyzer.vs\rust-analyzer.vs\src\RustAnalyzer.TestAdapter\TestDiscovererCommon.cs:line 26
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at KS.RustAnalyzer.TestAdapter.TestDiscoverer.d 1.MoveNext() in D:\a\rust-analyzer.vs\rust-analyzer.vs\src\RustAnalyzer.TestAdapter\TestDiscoverer.cs:line 30
An exception occurred while test discoverer 'TestDiscoverer' was loading tests. Exception: One or more errors occurred.
No test is available in E:\erenturk\332-Rust\adder\target\debug\adder_libadder.rusttests. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
========== Test discovery finished: 0 Tests found in 589 ms ==========
Z
is only accepted on the nightly compiler at KS.RustAnalyzer.TestAdapter.Common.ProcessRunner.Z
is only accepted on the nightly compiler at KS.RustAnalyzer.TestAdapter.Common.ProcessRunner.