Can't run unit tests on smart device emulator - c#

I'm running Visual Studio 2008 and have a C# program that runs beautifully on the "Pocket PC 2003 Second Edition" emulator. However, when I try to run any unit tests I get an error on the first test:
The test adapter ('Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter,
Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter, Version=9.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a') required to execute this test could not be loaded.
Check that the test adapter is installed properly.
ActiveSync bootstrap initialization failed.
Please connect/cradle a real device or download the User-level Windows Mobile Device Center Application
from http://go.microsoft.com/fwlink?linkid=67763
Comparing the properties for the unit test and the application:
Conditional compilation symbols are identical
Platform target is identical ("Any CPU")
Framework Version is identical (v3.5)
Platform is identical ("Windows CE")
Output file folder is identical
Both have "Display the latest version of the .NET Compact Framework" checked
Output type for the application is "Windows Application", for the unit test is "Class Library" but it seems like that's what it wants.
The error message seems to indicate the VS2008 can't connect to the emulator, but since the program is running I know that isn't the case. Can I not run unit tests on an emulator?
Or am I missing files? Is there something I need to install, in order to perform unit tests? Nowhere on my system do I have a file named Microsoft.VisualStudio.TestTools.TestTypes*.*.

The problem was in the SmartDeviceTestRun.testrunConfig file, it was set to run on the actual device instead of the emulator. This web site was helpful:
https://msdn.microsoft.com/en-us/library/bb384146%28v=vs.90%29.aspx

Related

Windows Form app won't run at startup but will run manually

I'm attempting to run an app on startup on a Dell laptop running Windows 10 Enterprise. It is written in C# using Visual Studio. The app is meant to run with administrator privileges. If I manually start the app, it works just fine. When I attempt to run it automatically using local group policy editor, it gives me the following error on login: "This application could not be started."
I looked up that error and wound up at the following link: https://support.microsoft.com/en-us/help/2715633/shim-errors-for-the-net-framework-version-and-platform-support. It said: "The app is not configured in a way that makes it possible to determine the appropriate version of the .NET Framework runtime. The corresponding shim code is SHIM_NOVERSION_FOUND."
I used information found here: https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed to determine which .NET frameworks were installed on the target device. There were a few, including version 4.0.
I added a config file to my project using instructions from the following link: https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-configure-an-app-to-support-net-framework-4-or-4-5.
When I rebuild the project and try to run it on the target machine, I get the same error as before.
NOTE: The target computer is under a group policy which may or may not be affecting the app. We don't know.
My ultimate solution for this problem was to build an installer for the program instead of just copying the release version over to the laptops manually

Running tests in parallel mono environment inside of MonoDevelop

I have a parallel mono environment installed to run my app and unit
tests. The app relies on MONO_PATH to find some of the assemblies it
depends on.
Now when I run my unit tests in Monodevelop they don't work because
MONO_PATH gets cleared before running the tests. Setting environment
variables in the project options doesn't help because they don't get set
when running tests.
Any ideas how the tests could be made to work within MD? Are there any
extension points that I could plug in to?
(MD 5.9.8 with Mono 3.12.1; my app requires Mono 3.4)
Make your test project depend on the libraries so they get copied to your bin/DEBUG|RELEASE/ path before execution?
Take in account that MONO_PATH is just a debugging tool and shouldn't be used in production.

Helpless error in Windows Phone Unit Test output

Under Visual Studio express 2012 update 4 I have created windows phone app, for which i added Windows Phone unit test App. When I try to run the tests, Tests output windows shows following error:
------ Run test started ------
Failed to import IDeployService. Cannot proceed with xap deployment. This failure can be observed if the component model cache (typically located in %LocalAppData%\Microsoft\VisualStudio\[version]\ComponentModelCache) is not up-to-date. To come out of this error, close all instances of visual studio, delete the component model cache folder and try again.
Unit tests in source D:\projekty\PhoneApp3\TestApp1\Bin\x86\Debug\TestApp1.dll cannot be run. Please create a Windows Store or Windows Phone Unit Test project.
========== Run test finished: 0 run (0:00:00,0009998) ==========
Deleting of %LocalAppData%\Microsoft\VisualStudio\[version]\ComponentModelCache does not help
EDIT:
If I open the same solution in VS 2013 Express for Windows I can successfully run those tests
Is it a side-by-side installation of VS21012+Update4 and VS2013 Express?
Maybe you could try repairing your VS2012 installation from "Programs & Features" in control panel and see if that resolves this issue?

VS 2010 Unit testing code located on external drives?

I've recently noticed that if your source code that you are running in VS 2010 or 12 is not located on same drive as to where your IDE of choice is running, then some weird behaviors can be observed.
var location = Assembly.GetExecutingAssembly().Location;
I have a simple MSTest unit test that runs the above and yeilds the below:
C:\Users\Ibrar\AppData\Local\Temp\ckiwsrev.qh0\A-----.Main.Tests\assembly\dl3\7e61424f\b0b1ebcc_318ace01\A----.Main.Tests.dll
Even though my source code is located on an external drive ... can any one shed any light on why this seems to be getting copied and pasted into the AppData folder and ran from there?
Is there anywhere of forcing VS to run the tests from where the source code folder is located?
I suspect it may have something to do with trust, security and permissions?
Linked Questions/Same Questions: How can I get “Copy to Output Directory” to work with Unit Tests?
This is the expected behavior. When you installed Visual Studio, it also installed 2 extra services:
Test Agent
Test Controller
These services are used to execute tests. When you hit run from Visual Studio, it sends the request with all sources to the available and selected Test Controller and the later sends the same request to all agents that are connected to it and shares to them the tests that they have to execute.
Each agent and controller can be installed at any machine (physical or not) at your network. So, the source code have to be copied on a specific folder on each machine so each agent can access it. It would be impossible for them to access the code on your local pc.
The same procedure takes place in your case. You have just decided to run your tests in your local pc. However, the Controller and Agent are still part of the whole procedure and Visual Studio needs them in order to execute the tests.
Setting Up Test Machines to Run Tests or Collect Data.
Although this refers to automating testing via Microsoft Test Manager the same structure used from Visual Studio.
Basically, from what I can tell there does not seem to be way to do this to force VS to run your test directly from the bin folder.
Seems like the answer to this for now is to use Deployment Items.

c#.net 32 bit application Not working on 64 bit OS

I am new to .NET application.
I have developed the application on 32 bit OS with Visual Studio 2008.
The application required the Microsoft.Interop services and for PDF services to open PDF files and MS Office files.
It also required SQL Express for database operations.
The application works fine on 32bit OS.
Then I created the setup for 64 bit OS, I added a new Setup project with wizard in Visual
Studio 2010 and select the Primary output and Localized resources.
But it does not included the Resources folder to the Application folder.
I set the target machine 64x and build the project, also before building give the prerequisites to the project which is Windows Installer 3.1, and .net framework 4.0, I have used the .net framwork 3.5 in the application.
Then I ran the setup, which executed successfully.
But when I tried to run the application it gave the message "Application has stoped working. Finding for the solution from the web.." and it closed.
Then I saw that there was no resources folder so I just copied the resources folder to the application where it was installed. Then the application worked fine.
So I created the setup again but this time I also provided the Resources folder to the application folder. Built the Setup and tried to run the application but the same message is prompted to me as it was giving before "Application has stopped working...", so I looked for the resource folder and all the required files which were there.
Creating a separate 64-bit version makes no sense in your case.
You have dependencies to 32-bit components; as a consequence, all1 your assemblies must be compiled to the x86 target platform and be installed using a 32-bit MSI.
If you get an "Application has stopped working..." error, this indicates that an exception occurred that has not been handled by your process. You can get the stack trace e.g. from the event log.
1 In fact, at the least the entry assembly must have an x86 target platform, and all other assemblies must have either an x86 or AnyCPU target platform.
Check you have changed the platform target to x64 or AnyCPU in your project -> Build Properties
hey friends thanks for answering my question. Finally doing a lot of things I found that it was converting the sql database to 2008 while creating the setup. And I was setting the sql express 2005 on the client machine. Then I changed the sql server 2005 to sql express 2008 and run the setup. Then I found that at the first time the exe required all the rights to convert so I tried the setup Run as Administrator and bingo the setup works for 2 different pc..
The only thing is required that at first time I need to run the application as Administrator.
Thanks for help I

Categories

Resources