-
Notifications
You must be signed in to change notification settings - Fork 2
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
Cannot run unit tests in a project.json style project that targets multiple runtimes #31
Comments
Hitting this too, with the following error: |
@jeremydmiller, @gmartinezsan, I'm just about to release a new version (release notes always seem to take forever 😉). Could you try again with this build? The notes will look something like this: This version appears to work with @jeremydmiller's StructureMap.Testing project. @gmartinezsan, I don't know if it will make a difference for your project. If it doesn't, do you have some source I could try it with? |
@jcansdale I'll give it a try and let you know. |
I've fixed an issue that is possibly related to this: Could you give this updated build a spin and let me know how you get on? |
hi @jcansdale System.Exception: Couldn't find type with name 'DataTypeTests' |
This is a strange one! Does it work with other test classes in this assembly? Is the class public? Could you strip down the project so there is only this class and any sensitive code has been removed? Having a repro would really help. |
I saw what the problem is. Is something very simple. My solution supports .net451 and netcoreapp 1.0. And the issue I think is related to the selected framework in the code editor. There is a point where the framework is not valid, I guess, because I cannot select any in the code editor of Visual Studio. If I have selected in the code editor the 4.5.1 framework and I run a different one from the Test Driven context menu I got the error I mentioned. If in both cases I use the same framework, everything work as expected. |
I'm glad you found what the issue is! Any chance you could share the source file with DataTypeTests in? (or a trimmed down summary) I'd be interested to see exactly what's going on. |
Sure.. actually I think you can reproduce it with any project that targets multiple frameworks. Anyways I will create one and see what are the steps to reproduce it and will share it here. So you can check what the problem is. |
@jcansdale I'm back at checking the unit tests suite of my project, Now I'm getting this error when trying to debug a unit test from any of the classes. Although running them works fine. Is this a known issue? I'm using latest beta for testdriven.net System.MethodAccessException: Attempt to access method Xunit.FactAttribute..ctor() in violation of security transparency rules failed. |
@jcansdale I think this one is fixed, or at least it is for me in later builds. |
This looks looks like a weird one, especially since it only happens when debugging! I'm able to debug a simple xUnit test just fine. I wonder what might be different about your tests? Does this happen for all of your projects or are there any where debugging works? I'm pleased to hear your issue seems to be sorted! 😄 |
@jcansdale |
Switching views seems to work for me on console and class library projects. It is however only a view and Visual Studio always executes using the first framework defined in the "frameworks" section. I can't even detect which view is selected (if I wanted to make this work differently in TestDriven.Net). Could you upload a simple repro here? I haven't been able to trigger the exception mentioned. Thanks, Jamie. |
@jcansdale Finally took the time to create this solution and was able to have the repro steps. https://github.com/gmartinezsan/ConsoleAppForTrace Steps to reproduce:
------ Test started: Assembly: ConsoleTests.dll ------ System.Exception: Couldn't find declaring type with name 'ConsoleTests.Mytestclass'
When using the debugger I only can debug the first framework of my project.json file. For example if the first framework is .net451 then that's the only framework I can debug even if I have selected the .net core app in the combo of the code editor. Hope this helps! |
FWIW, selecting the target framework is implemented now in VS2017 Preview (15.3), and it basically sets an May (or may not ;)) be useful to @jcansdale ;) |
@kzu Thanks for the heads up. I'm messing with the 15.3 Preview at the moment... |
@kzu I've created a multi-target project, but can't find how to select the target framework. Could you give me a clue? 😄 I'm using 15.3 and my .csproj includes: |
Got it, thanks! I'd never have thought to look in
I guess that could also be used as a handy place to inject stuff into a build. I'm like to be able to right-click on a VSSDK project and have it install/execute in a different version of VS. Maybe |
If you want, you can pull down the StructureMap solution at http://github.com/structuremap/structuremap to see what I mean here. When I try to run any test - or all of the tests - with TD.Net I get:
When you look at the file system, dotnet is compiling it to: bin/Net451, but it drops all of its dependencies into a platform specific folder underneath that, "win7-x64" in my case.
The text was updated successfully, but these errors were encountered: