Closed Zerachiel01 closed 4 months ago
cc @jeromelaban, @dansiegel
This behavior seems to be Visual Studio specific. Making the same changes and then running dotnet test
from the CLI works as expected.
@Zerachiel01 if you're able to update to 17.9.7 please let me know if this resolves the issue for you. I'm not able to reproduce the issue in 17.9.7 on my Mac with Parallels but I can on my PC with 17.9.6
@dansiegel Upgrading to even 17.10.0 did not resolve the issue unfortunately.
As a work around I extracted some of my classes into separate class libraries. Tests of classes of these libraries work just fine, the problem only occurs for the main uno project.
@Zerachiel01 this issue is related to this VS issue, and while this is a problem, with the latest changes we pushed a few days ago, you can get around testing by ensure that the debugger active target framework is set to net8.0
. This will allow the app to build in the targetframework used by tests.
@jeromelaban Thank you very much, works like a charm!
Current behavior
Hello everyone! I'm not sure if this is an uno platform issue, but I have not experienced this anywhere else.
I have a simple uno platform 5.2 app with a unit test project generated by a template. Now when I change some of my production code in the main project, for example adding a new method, call that method in a unit test and run that test, I get the "class does not contain a definition for 'MyMethod'" message in the build log. Visual Studio and the compiler recognize the new method as expected though. To get rid of this strange behaviour, I have to explicitly build the test project. The same issue appears if I change some lines inside a method or something like that.
It seems that Visual Studio (or whoever is responsible for that) does not see the need of rebuilding the changed(!) main project before running my test.
Expected behavior
If I change code in my main uno platform project and run a test using this changed code, Visual Studio is supposed to be rebuilding the main project, so that my test is using the up to date code.
How to reproduce it (as minimally and precisely as possible)
Workaround
Build the test project explicitly to trigger a build of the main project.
Works on UWP/WinUI
None
Environment
No response
NuGet package version(s)
No response
Affected platforms
No response
IDE
Visual Studio 2022
IDE version
17.9.6
Relevant plugins
No response
Anything else we need to know?
No response