Export (0) Print
Expand All
Debugging: Root Out Elusive Production Bugs with These Effective Techniques
Smart Tags: Simplify UI Development with Custom Designer Actions in Visual Studio
Ten Essential Tools: Visual Studio Add-Ins Every Developer Should Download Now
XML Comments: Document Your Code in No Time At All with Macros in Visual Studio
Expand Minimize

Using the Emulator in Smart Device Projects

Visual Studio .NET 2003
 

Don Espen, Jose Baldner, and Ximing Zhou

February 2003
Updated November 2003

Applies to:
   Smart Device Projects
   .NET Compact Framework
   Platform Builder

Summary: The information in this paper applies to emulator version 4.1 as shipped with Visual Studio .NET 2003. You can use the integrated development environment (IDE) to configure most emulator settings, or you can launch it from the command line with additional settings, such as custom skins. Using a share on the development computer is the preferred method of transferring files. Emulator connection problems can usually be identified and resolved quickly. Appendix A provides help for defining emulator-friendly platforms in Platform Builder. (21 printed pages)

Contents

Installation
Configuration Settings
Skins
Command-Line Launch
Copying Files to the Emulator
Configuring the Emulator to Connect to the Internet
Troubleshooting
Conclusion
Appendix A

Installation

Visual Studio .NET 2003 Setup copies the emulator files to the Visual Studio installation directory when Visual Studio is installed with the Smart Device Programmability option selected. This option is listed under the Visual Basic .NET or Visual C# .NET installation items. It is selected by default when you install either Visual Basic .NET or Visual C# .NET. (If you believe Smart Device Programmability was not selected during Setup, see "Installation Issues" later in this section for information on how to correct the installation.)

Visual Studio Setup provides emulator files but does not install the emulator. You install and register the emulator on the development computer when you first deploy it, either by attempting to connect to it or by deploying an active project that targets it. You install the emulator only once. For installation purposes, it makes no difference which emulator you select (for example, Windows CE or Pocket PC).

Installing the Emulator

You must have Administrator permissions to install or remove the emulator. On some operating systems (for example, Windows Server 2003), you must accept the driver security certificate if prompted.

To install the emulator by trying to connect to it

  1. On the Visual Studio Tools menu, click Connect to Device.
  2. In the Connect to Device dialog box, click any emulator (for example, Pocket PC 2002 Emulator).
  3. Click Connect.
  4. If prompted to accept the emulator driver security certificate, click OK.
  5. View the results on the screen. Installation is successful if:
    • The emulator appears.
    • The status bar in the IDE displays "Device Connected" or "Ready."

    Installation is not successful if:

    • The screen displays "Emulator driver installation failed. Most common cause: user does not have administrator permissions."
    • The status bar displays "Emulator driver installation failed."

To install the emulator by deploying a project to it

  1. On the Build menu, click Deploy Solution or Deploy <Projectname>.
  2. In the Deploy <Projectname> dialog box, click any emulator (for example, Pocket PC 2002 Emulator).
  3. Click Deploy.
  4. If prompted to accept the emulator driver security certificate, click OK.
  5. View the results as described in the preceding procedure.

Adding Emulator Files After Visual Studio Installation

If Visual Studio has been installed without the Smart Device Programmability option (and thus without the emulator files), you can update your installation using the following procedure.

To load emulator files if Visual Studio has been installed

  1. In Windows Control Panel, click Add or Remove Programs.
  2. Select your installation of Microsoft Visual Studio .NET, and then click Change/Remove.
  3. In the Visual Studio .NET Setup wizard, click Visual Studio .NET.
  4. On the Visual Studio .NET Maintenance page, click Add or Remove Features.
  5. On the Visual Studio .NET Options page, select the Smart Device Programmability check box under either Visual Basic .NET or Visual C# .NET.
  6. Click Update Now.

After the Visual Studio update is finished, install the emulator using either of the procedures in "Installing the Emulator" earlier in this section.

Installation Issues

The following items describe the most common causes for installation failure and the techniques for correcting them.

Administrator permissions lacking
It is unlikely in practice that Visual Studio users do not have Administrator permissions. However, if this is the case, ask a user with Administrator permissions to log on to the development computer and deploy the emulator using either of the two preceding procedures.
Security certificate not accepted
Deploy again, and accept the driver security certificate when prompted.
Emulator files not installed
Use the procedure in "Adding Emulator Files After Visual Studio Installation" earlier in this section.

Driver Properties

You can expose properties, such as version information for the emulator driver (Virtual PC Application Services), by clicking Device Manager and then System Devices. Do not try to remove the emulator using the Uninstall function in Device Manager. For details, see "Removing the Emulator," which follows.

Removing the Emulator

If you want to remove the emulator (for example, to install a later version), use the following procedure. Do not use Uninstall in Device Manager.

To remove the emulator

  1. In Windows Control Panel, click Add or Remove Programs.
  2. Select Emulator Driver for Visual Studio .NET 2003.
  3. Click Remove.

Configuration Settings

You can configure most emulator settings using the Configure Emulator Settings dialog box in the Visual Studio IDE. If you change any of these settings while the emulator is running, you must close and reopen it for the changes to take effect.

Note   If you want to change the OS image or skin or specify port mappings not exposed in the IDE (for example, COM3, COM4, LPT2), you must launch the emulator from the command line. For more information, see "Command-Line Launch" later in this paper.

To display the Configure Emulator Settings dialog box, click Options on the Visual Studio Tools menu, click Device Tools, and then click Devices. In the Devices box, select an emulator. When Emulation Startup Provider is displayed in the Startup server box, click Configure.

The following table enumerates the configurable settings of the emulator.

Option Tab
Color depth Display
Host key System
Memory size System
OS image <None>
Parallel port Hardware
Screen height Display
Screen width Display
Serial port 1 Hardware
Serial port 2 Hardware
Skin <None>

Display tab

Specifies the screen resolution of the device emulator on the development computer. You can specify a display size for the emulator as small as 80 by 64 pixels or as large as 1024 by 768 pixels. If an emulator uses a skin (as does the Pocket PC emulator), the skin sets the emulator display properties and overrides any display changes you make.

Screen width
Sets the number of pixels that establishes the width of the emulator display on the development computer. The range is any multiple of 8 between 80 and 1024.
Screen height
Sets the number of pixels that establishes the height of the emulator display on the development computer. The range is any multiple of 8 between 64 and 768.
Color depth
Sets a depth of 8, 16, or 32 bits per pixel.

Hardware tab

Emulates certain hardware features on the physical platform.

The emulator provides two serial ports (virtual COM ports) that you can map to COM ports on the development computer. The emulator also provides a parallel port that you can map directly to an LPT port on the development computer.

If your operating system image includes support for the Kernel Independent Transport Layer (KITL), the operating system sends its output to Serial Port 1, and you should use Serial Port 2 as a product serial port. With a retail operating system image, you may be able to use both serial port 1 and serial port 2 as product serial ports.

Serial port 1
Specifies the first serial port available to the emulator. Valid mappings are COM1, COM2, and none.
Serial port 2
Specifies the second serial port available to the emulator. Valid mappings are COM1, COM2, and none.
Parallel port
Maps the parallel port on the emulator to a parallel port on the development computer. Valid values are LPT1 and none.

System tab

Provides the development computer with control over certain aspects of the running emulator.

Memory size
Sets the maximum amount of memory (in megabytes) available to the emulator, which allocates memory only as needed. Memory size must be a positive integer between 32 and 256. The footprint of the operating system imaged in the emulator reduces available memory, and the operating system can place its own limitations on memory. Thus actual memory size may not match the figures in the dialog box.
Host key
Selects a single key on the development computer to serve as part of key combinations for menu shortcuts in the emulator.

Shortcuts on the Emulator menu in the emulator are shown in the following table.

Emulator command Shortcut key combination
Pause Host key + P
Hard Reset Host key + R
Soft Reset Host key + T
Shut Down Host key + F4

Some localized versions of the emulator have reported improper operation of the Host key feature.

Skins

You can display the emulator with or without a skin. Applying a skin affects the appearance and functionality of the emulator window.

Visual Studio .NET 2003 ships with a default skin for Pocket PC 2002 projects. When you use the IDE to deploy a Pocket PC 2002 project to the emulator, the Pocket PC skin is automatically applied to the emulator window.

The IDE does not apply a default skin for Windows CE projects. When you deploy a Windows CE project using the IDE, the emulator window appears as a standard Windows CE window without any customized appearance or functionality.

Note   To apply a custom skin to the emulator in Visual Studio .NET 2003, you must launch the emulator from the command line using the /Skin parameter. For more information, see "Command-Line Launch" later in this paper.

Help topics in the emulator provide detailed information on skin files and how to develop them, including a sample XML schema for the required .xml file.

To view the emulator Help topics

  1. Open Visual Studio .NET 2003.
  2. On the Tools menu, click Connect to Device.
  3. In the Connect to Device dialog box, click whichever emulator appears in the Devices box (for example, Pocket PC 2002 Emulator), and then click Connect.
  4. On the Help menu in the emulator window, click Emulator for Windows CE Help.
  5. Navigate to the Emulator Skin node.

Visual Studio .NET 2003 provides sample customized skin files at the following locations:

  • <Visual Studio Installation Folder>\CompactFrameworkSDK\ConnectionManager\Bin\Images)
  • <Visual Studio Installation Folder>\CompactFrameworkSDK\ ConnectionManager\v1.0.5000\Windows CE\Samples\EmulatorSkins

Command-Line Launch

The emulator opens automatically when you deploy a smart device project to it or when you open it by clicking Connect to Device on the Visual Studio Tools menu. This automatic launch uses emulator settings specified in the Configure Emulator Settings dialog box. (For details, see Configuration Settings earlier in this paper.)

Two settings are not exposed in the dialog box: specifying a custom operating system image and specifying a custom skin. To launch the emulator with these custom settings, you must use the command line.

If you installed Visual Studio .NET 2003 into its default location, the executable file for the emulator (Emulator.exe) is located at c:\program files\microsoft visual studio .net 2003\compactframeworksdk\connectionmanager\bin. The only required parameter is the operating system (/CEImage); all other parameters are optional.

Note   Entering emulator /help on the command line displays the Command Line Option Help dialog box. The information in that box is superseded by the information provided in the following "Syntax" section and in the Help topic displayed by clicking Help in the Configure Emulator Settings dialog box.

Syntax

Emulator /CEImage os_image_file [/Skin skin_file]
     [/Video vparms] [/MemorySize memsize] [/Hostkey key]
     [/VMName titlebar] [/serialport1 serialport1map]
     [/serialport2 serialport2map]
     [/parallelport parallelportmap] [/Ethernet network]
     [/VMID emulator_id] [/SkinEngine skingengine_file]

Parameters

os_image_file
Required. Specifies the path and file name of the kernel image the emulator is to use.
skin_file
Optional. Indicates which skin file to use. The file must be an XML file describing the skin. For more information, see "Skins" earlier in this paper.
vparms
Optional. Sets the resolution and bit depth of the emulator display. For more information, see "Example 3" later in this paper.

Arguments must be integers and be in the format of <width>x<height>x<bit depth>. Screen width must be a multiple of 8 between 80 and 1024. Screen height must be a multiple of 8 between 64 and 768. Bit depth must be either 8, 16, or 32.

If the command line includes the skin_file parameter, the skin dictates the display characteristics and the vparms parameter is ignored.

memsize
Optional. Specifies the maximum amount of memory (in megabytes) available to the emulator. The value must be a positive integer between 32 and 256. The footprint of the operating system imaged in the emulator reduces available memory, and the operating system can place its own limitations on memory. Thus actual memory size might not exactly match the value assigned to this variable.
key
Optional. Selects a single key on the development computer to serve as part of key combinations for menu shortcuts in the emulator. Values are limited to the following.
Host key Decimal value
LEFT ALT 164
LEFT CTRL 162
LEFT SHIFT 160
LEFT Windows logo key 91
RIGHT ALT 165
RIGHT CTRL 163
RIGHT SHIFT 161
RIGHT Windows logo key 92
Note   Specifying a Windows logo key in this release has no effect. This is a known issue.

Shortcut key combinations exposed on the Emulator menu in the emulator are shown in the following table.

Emulator command Shortcut key combination
Pause Host key + P
Hard Reset Host key + R
Soft Reset Host key + T
Shut Down Host key + F4

Some localized versions of the emulator have reported improper operation of the Host key feature.

titlebar
Optional. Specifies the text of the title bar, for example, "Pocket PC Emulator". The string is placed within double quotation marks. This parameter is ignored if a skin is applied that provides its own title bar text.
serialport1map
Optional. Specifies the first serial port available to the emulator. Valid mappings are COM1, COM2, COM3, COM4, and none.
serialport2map
Optional. Specifies the second serial port available to the emulator. Valid mappings are COM1, COM2, COM3, and COM4, and none.
parallelportmap
Optional. Maps the parallel port on the emulator to a parallel port on the development computer. Valid values are LPT1, LPT2, and none.
network
Optional. Enables or disables the Ethernet controller in the emulator. This parameter must be set to True.
Note   Disregard the additional values for /Ethernet listed in the Command Line Option Help message box. Values other than True are not supported for smart device development in Visual Studio .NET 2003.
emulator_id
Optional. Specifies the globally unique identifier (GUID) of the emulator. Valid values shipped with Visual Studio .NET 2003 include {72485E59-CA63-491c-95CB-C45AE6D3BBA9} for the Windows CE .NET emulator and {DE425A95-FBB8-46CB-8DFD-89867130F732} for the Pocket PC 2002 emulator.
skinengine_file
Optional. Specifies the path and file name of the skin engine the emulator is to use. The only skin engine available for smart device projects in Visual Studio .NET 2003 is the engine shipped with the product.

Minimizing Path Errors

The fully qualified path for many command-line elements can be quite long. For example, the following command, using only two arguments (operating system and skin) reads as follows:

"c:\program files\microsoft visual studio .net2003
    \compactframeworksdk\connectionmanager\bin\emulator"
    /skin "c:\program files\microsoft visual studio .net
    2003\compactframeworksdk\connectionmanager\bin\Images\
    PocketPC\2002\1033\ppc2002.xml" /CEImage "c:\program files
    \microsoft visual studio .net 2003\compactframeworksdk\
    connectionmanager \bin\Images\PocketPC\2002
    \1033\PPC2002.bin"

If you regularly use the command line to launch the emulator, you can minimize typing errors by using techniques, such as:

  • Saving the command-line text to a batch file
  • Adding the common part of the path to the Path statement in Environment Variables on the development computer
  • Establishing one or more virtual drives using the SUBST command

Examples

The following examples use the virtual drive technique for purposes of clarity. Create the virtual drive T using the following command:

c:\> SUBST T: "c:\program files\microsoft visual studio .net
    2003\compactframeworksdk\connectionmanager\bin"

Example 1: Custom operating system and skin (/CEImage, /Skin)

The following command launches the emulator with the WebPad operating system and WebPad skin.

T:\> Emulator /CEImage .\images\WindowsCE\WebPad\1033
    \wce4webpad.bin /Skin .\images\WindowsCE\WebPad
    \1033\WebPad.xml 

Example 2: Host key (/hostkey)

The following command launches the emulator with the Pocket PC 2002 operating system, Pocket PC skin, and RIGHT CTRL host key. In this scenario, the key combination RIGHT CTRL + F4 shuts down the emulator.

T:\> Emulator /CEImage .\images\PocketPC\2002\1033
    \PPC2002.bin /skin .\images\PocketPC\2002\1033
    \PPC2002.xml /hostkey 163

Example 3: Display characteristics (/Video)

The following command launches the emulator with the WebPad operating system and a display resolution of 800 x 480 x 8.

T:\> Emulator /CEImage .\images\WindowsCE\WebPad\1033
    \wce4webpad.bin /Video 800x480x8

Copying Files to the Emulator

An application running on the emulator does not automatically detect files that are just copied and pasted. The following methods are available for copying files to the emulator so that a running application recognizes them:

  • Including the file in the project so that it is downloaded with the application files
  • Using a shared folder on the development computer

Including the File in the Project

This method of copying a file to the emulator is the most straightforward.

To copy a file by including it in a project

  1. In Solution Explorer, right-click <ProjectName>, point to Add, and then click Add Existing Item.
  2. In the Add Existing Item dialog box, click the file to be included with the project.
  3. In Solution Explorer, right-click the file, and then click Properties.
  4. In the Properties dialog box, set Build Action to Content.

Using a Shared Folder on the Development Computer

This method of copying uses a shared folder on the development computer to facilitate copying in either direction.

To copy a file to a Pocket PC emulator

  1. Place the file to be copied into a shared folder on the development computer.
  2. On the emulator, click Start, point to Programs, and click File Explorer.
  3. Click the Network Share icon at the bottom of the emulator screen.
  4. In the Open dialog box, type the name of your computer, and click OK.

    You should see a message stating that the emulator is connecting to your computer.

    Note   If you receive a message informing you that a device with the same name already exists on the network, you must change the device ID of the emulator. On the emulator Start menu, click Settings. On the System tab, click About. On the Device ID tab, change the device name, and try connecting to the shared folder again.
  5. In the Network Log On box, type your user name, password, and domain for your computer, if applicable, and click OK.
  6. Click the shared folder, and do the following:
    • Click the name of the file, and hold down the mouse button.
    • After the animation finishes and a menu appears, click Copy.

To paste the file into the correct Pocket PC folder

  1. Click the My Device icon at the bottom of the emulator screen.
  2. Click the destination folder on the emulator.
  3. On the Edit menu, click Paste.

    The file should now appear in the folder.

To copy a file to a Windows CE emulator

  1. Put the file to be copied into a shared folder on the development computer.
  2. In the Windows CE emulator, click Start, point to Programs, and then click Windows Explorer.
  3. In the Address box, type the share address (for example, \\myshare\files).
  4. If a logon is required, type your user name, password, and domain (if applicable).
  5. Click the file to be copied.
  6. On the Edit menu, click Copy.

To paste the file into the correct Windows CE folder

  1. Use Windows Explorer to locate the destination folder.
  2. On the Edit menu, click Paste.

    The file should now appear in the folder.

Configuring the Emulator to Connect to the Internet

Connecting the emulator to the Internet requires proper configuration of the emulator. Procedures differ depending on the version of the emulator (for example, Pocket PC 2000 vs. Windows Mobile™ 2003-based Pocket PC) and whether your Internet connection uses a proxy server.

Ensuring a Unique Name for the Emulator

Before starting configuration procedures, be sure your emulator has a unique name on the network.

To ensure a unique name for the emulator

  1. Click Start on the emulator, click Settings, click System, click About, and click Device ID.
  2. Change the device name to a unique value that does not conflict with another device name on the network.

Configuring a Connection Through a Proxy Server

If your connection to the Internet uses a proxy server, use the following procedure to configure the emulator to use that server.

To configure a Windows Mobile 2003-based Pocket PC emulator connection

  1. Click Start on the emulator, click Settings, click the Connections tab, and then click the Connections icon.
  2. Click the Tasks tab, and select Set up my proxy server.
  3. Select the This network connects to the Internet and This network uses a proxy server to connect to the Internet check boxes.
  4. Under Proxy server, type your proxy server name.

To configure a Pocket PC 2002 or Pocket PC 2000 connection

  1. Click Start on the emulator, click Settings, click the Connections tab, and then click the Connections icon.
  2. Under My network card connects to, select Work.
  3. Under When needed, automatically connect to Work using these settings, click Modify, and then click the Proxy Settings tab.
  4. Select the This network connects to the Internet and This network uses a proxy server to connect to the Internet check boxes.
  5. Under Proxy server, type your proxy server name.

Configuring a Connection with No Proxy Server

If your connection to the Internet does not use a proxy server, use the following procedure to specify the configuration for connecting to the Internet.

To configure a Windows Mobile 2003-based Pocket PC emulator connection with no proxy server

  1. Click Start on the emulator, click Settings, click Connections (the tab), and click Connections (the icon).
  2. Click the Advanced tab, and click Select Networks.
  3. Under Programs that automatically connect to the Internet should connect using, select My ISP.

To configure a Pocket PC 2002 or Pocket PC 2000 connection with no proxy server

  1. Click Start on the emulator, click Settings, click Connections (the tab), and click Connections (the icon).
  2. Under My network card connects to, select The Internet.
  3. Under When needed, automatically connect to The Internet using these settings, select Internet Settings.

Troubleshooting

A number of issues have surfaced during testing. The most common are connectivity issues between the development computer and the emulator.

Connectivity Issues

Most connectivity issues discovered during testing center around the following:

  • Lack of file synchronization (prior releases of Visual Studio or Smart Device Extensions were not cleanly removed)
  • Sharing violations (the application to be deployed is already running)
  • Development computer lacks network connection
  • Emulator name duplicates name of another device
  • Emulator does not launch if the eMbedded Visual C++ 4.0 emulator is running

Emulator files not synchronized

Connection difficulties can occur on development computers where prior versions of smart device programmability or beta releases of Visual Studio .NET have been installed and removed. Error messages include the following:

  • Cannot establish a connection. Be sure the device is physically connected to the development computer.
  • One or more files from Emulator for Windows CE installation are missing. Reinstall Emulator for Windows CE and try again.

The most effective solution for this situation is to remove and reinstall smart device programmability using the following procedures.

To remove smart device programmability

  1. In Windows Control Panel, click Add or Remove Programs.
  2. Select your installation of Microsoft Visual Studio .NET, and then click Change/Remove.
  3. In the Visual Studio .NET Setup wizard, click Visual Studio .NET.
  4. On the Visual Studio .NET Maintenance page, click Add or Remove Features.
  5. On the Visual Studio .NET Options page, clear the Smart Device Programmability check box under Visual Basic .NET and Visual C# .NET.
  6. Click Update Now, and restart the development computer.

To reinstall smart device programmability

  1. Repeat the preceding procedure to display the Visual Studio .NET Options page.
  2. Select the Smart Device Programmability check box under Visual Basic .NET and Visual C# .NET.
  3. Click Update Now.

Sharing violations

When you see the message "Could not write to output file <projectname.exe> - Sharing violation" in the Output window, it is likely that the emulator is already running the application you are trying to deploy. This situation occurs especially in Pocket PC projects where clicking the Smart Minimize (X) button in the application window sends the application to the background but does not close it.

Use the following procedures to determine whether the application is already running in the emulator and to stop it if it is.

To determine whether an application is still running in the emulator

  • On the emulator Start menu, click Settings, click System, click Memory, and then click Running Programs.

    If you want to stop the application, you can do so from this window.

To stop an application running in the emulator, do one of the following

  • Stop the debugger if it is running.
  • Close the emulator without saving the state.
  • On the emulator Start menu, click Settings, click System, click Memory, click Running Programs, and then click Stop (or Stop All).
  • Perform a soft or hard reset of the emulator.

Another technique is to replace the Smart Minimize control with an OK control that actually closes the application. To make this change, set the Minimize Box property of the form to False.

Development computer lacks network connection

Deploying to the emulator over the TCP/IP transport requires that the development computer have at least a virtual network environment. If the development computer does not have access to a network, you can provide a virtual network environment by installing the Microsoft Loopback Adapter. Procedures for installing the adapter appear in the MSDN Library (look for "loopback adapter" in the MSDN Help Index) and are reproduced here.

To install the Microsoft Loopback Adapter in Microsoft Windows XP

  1. In Windows Control Panel, double-click Add Hardware, and then click Next.
  2. Select Yes, I have already connected the hardware, and then click Next.
  3. In the Installed hardware list, click Add a new hardware device, and then click Next.
  4. Select Install the hardware that I manually select from a list (Advanced), and then click Next.
  5. In the Common hardware types list, click Network adapters, and then click Next.
  6. In the Manufacturer list, click Microsoft.
  7. In the Network Adapter list, click Microsoft Loopback Adapter, and then click Next.
  8. Click Next, and then click Finish.

To install the Microsoft Loopback Adapter in Microsoft Windows 2000

  1. In Windows Control Panel, double-click Add/Remove Hardware, and then click Next.
  2. Click Add/Troubleshoot a device, and then click Next.
  3. In the Devices list, click Add a new device, and then click Next.
  4. Select No, I want to select the hardware from a list, and then click Next.
  5. In the Hardware types list, click Network adapters, and then click Next.
  6. In the Manufacturers list, click Microsoft.
  7. In the Network Adapter list, click Microsoft Loopback Adapter, and then click Next.
  8. Click Next, and then click Finish.

Emulator name duplicates name of another device

This issue arises, for example, when you try to connect the emulator to a share on the development computer. (For more information, see "Copying Files to the Emulator" earlier in this paper.) If you see the message, "A Device with the same name is already on the network," you must change the name of the emulator device.

To change the name for the Pocket PC emulator

  1. On the emulator Start menu, click Settings, click System, click About, and then click Device ID.
  2. In the Device name box, type a unique name.

To change the name for the Windows CE emulator

  1. Right-click My Computer, and then click Properties.
  2. In the System Properties dialog box, click Device Name.
  3. In the Device name box, type a unique name.

Emulator does not launch if eMbedded Visual C++ 4.0 emulator is running

Trying to launch the smart device emulator from Visual Studio .NET 2003 while the Microsoft eMbedded Visual C++ 4.0 (eVC4) emulator is running on the same development computer displays the message, "Error: Cannot establish a connection. Be sure the device is physically connected to the development computer."

To avoid this situation, close the eVC4 emulator before launching the smart device emulator.

Other Issues

Most issues discovered during the testing phase of this release of the emulator center around connectivity (see "Connectivity Issues" earlier in this paper). Other known issues include the following.

Simultaneous debugging on emulator and physical device not supported

Simultaneous debugging of multiple smart device projects is supported, provided that the projects being debugged are all on the emulator or all on a physical device.

If you try to debug a multiproject solution in which one project is deployed to the emulator and another to a physical device, you will see the message, "Do you want to stop debugging?"

Debugging from more than one Visual Studio environment instance not supported

Stop any other Visual Studio debuggers before attempting to debug an application running in the emulator.

Windows shutdown canceled

Trying to shut down the Windows operating system while the emulator is running produces unexpected results for the Windows shutdown process.

Whether you click OK in the emulator Shut Down dialog box (the emulator closes) or Cancel (the emulator remains open), the process to close the Windows operating system is canceled.

Emulator does not launch if Visual Studio is installed to path containing DBCS characters

If you install Visual Studio .NET 2003 to a path that contains double-byte character set (DBCS) characters, the emulator might fail to load an OS image or skin.

One workaround is to change the OS locale to a setting that supports the DBCS character set. However, this workaround is not always effective, especially when loading a skin. This is a known issue.

Emulator does not run on VMware

Visual Studio .NET 2003 does not support running the emulator in a VMware™ session.

Deployment stops

Opening the Options dialog box on the Visual Studio Tools menu while a project is being deployed to the emulator causes the deployment to stop. This is a known issue.

Unrecoverable processor error

Clicking Soft Reset after saving the state of the emulator displays the message, "An unrecoverable processor error has been encountered. The PC will reset now."

Clicking either Reset or Shutdown in that dialog box loses the saved state. This is a known issue.

Slow startup

Emulator startup, which includes starting the emulator image and downloading the Microsoft Windows .NET Compact Framework, can take so long on low-end development computers that the connection manager times out.

One workaround is to prestart the emulator (without downloading the project) by clicking Connect to Device on the Visual Studio Tools menu.

Note   When you first try to deploy an application after starting the emulator in this way, the deployment fails for no apparent reason. This is a known issue. A second try should be successful.

To avoid subsequent slow startups during the same session, close the emulator by clicking Save Emulator State rather than Turn Off Emulator.

Emulator displays black screen and does not boot

This behavior typically occurs when the emulator is configured to use a COM port that is being used by Microsoft ActiveSync or some other running application.

As a workaround, remove all COM port mappings, or change them to ports not used by ActiveSync or other applications. For information on changing COM port mappings, see "Configuration Settings" earlier in this paper.

Debugger does not work when device is cradled

Determine if you are using an image to run on the emulator and the image has the .NET Compact Framework inside. In this situation, you must also define the following registry key on the device:

HKLM\SOFTWARE\Microsoft\.NETCompactFramework\Managed Debugger
REG_DWORD "DefaultPort"=4000 (decimal)

Emulator generated by Platform Builder boots with black screen

This behavior results when the Kernel Independent Transport Layer (KITL) has been included in an image generated by Platform Builder. The emulator awaits a KITL response from Visual Studio, which does not support it.

To develop applications on images generated by Platform Builder, be sure KITL support is disabled. For step-by-step instructions, see Appendix A of this paper.

Emulator generated by Platform Builder does not boot

If ActiveSync support is not included in a platform defined with Platform Builder, the emulator does not start.

To develop applications on images generated by Platform Builder, be sure that ActiveSync is supported in the platform definition. For step-by-step instructions, see Appendix A of this paper.

Debugging on emulators generated by Platform Builder produces error

Emulator images containing the .NET Compact Framework that are generated by Microsoft Platform Builder do not have the proper port settings for the Visual Studio managed debugger. Attempting to debug produces the message "Unable to debug application."

To remedy this situation, add a registry key to establish the proper port. For step-by-step instructions, see Appendix A of this paper.

Conclusion

The information in this paper was designed to supplement information provided in the Visual Studio .NET 2003 documentation. For basic information about the emulator, open the emulator in Visual Studio as described earlier in this paper, and then click Emulator for Windows CE Help on the emulator Help menu.

Appendix A

Managed Debugging on Emulators Generated by Platform Builder

Developers using default settings cannot debug a managed code application on the emulator in a Platform Builder-generated OS image. They receive an error message "Unable to debug application" and cannot proceed. The error results from a mismatch in port numbers used by the default emulator image and the Visual Studio managed debugger.

The following solution matches the port the emulator uses to the port used by the Visual Studio managed debugger. This change is implemented by defining a registry key in the OS image. The following procedures provide tips for defining an OS image that debugs properly.

These procedures assume you have installed and opened Platform Builder version 4.2. They include instructions for:

  • Creating an OS image that includes or excludes certain features.
  • Disabling Kernel Independent Transport Layer (KITL) support.
  • Adding a registry key for the managed debugger.
  • Building the platform.

Creating the OS Image

Before you begin, you must open the New Platform Wizard.

To open the New Platform Wizard

  • On the Platform Builder File menu, click New Platform.

The following procedure provides tips on including and excluding certain features to produce an OS image that supports managed debugging on the emulator.

To define the OS image

  1. In the New Platform Wizard – Step 1 (Welcome), click Next.
  2. In the New Platform Wizard – Step 2 (Board Support Packages (BSPs), select the Emulator: X86 BSP, and then click Next.
  3. In the New Platform Wizard – Step 3 (Platform Configuration), select the Enterprise Web Pad configuration, type the new Platform name (for example, MyEmulator), and then click Next.

    If you want to change the default location where the image file will be written, change the path in the Location box.

  4. In the New Platform Wizard – Step 4 (Application and Media), select ActiveSync, and then click Next.
  5. In the New Platform Wizard – Step 5 (Networking and Communications), remove the Wireless Local Area Network (802.11) feature (under the Local Area Network (LAN) node), remove TCP/IPV6, and then click Next.
  6. In the New Platform Wizard – Step 6 (ActiveSync Security Warning), click Next.
  7. In the New Platform Wizard – Step 7 (Completing the New Platform Wizard), click Finish.

Your platform is now defined.

Disabling KITL Support

The Kernel Independent Transport Layer (KITL), designed for debugging during operating system development, must be removed from the OS image provided to application developers in an SDK. For more information, look for "KITL" in the Windows CE .NET Help Index.

To disable KITL support

  1. On the Platform Builder Platform menu, click Settings.
  2. On the Build Options tab, clear the Enable KITL check box.

Adding a Registry Key

If the OS image you want to run on the emulator includes the .NET Compact Framework, you must define a registry key on the device for the Visual Studio managed debugger.

To define the registry key

  1. In the Platform Builder Workspace Window, click the ParameterView tab.
  2. In the Emulator/Project Specific Files folder, open the project.reg file.
  3. Insert the following lines at the end of the file:
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETCompactFramework\
       Managed Debugger]
    "DefaultPort"=dword:4000
    

Building the Platform

You can now use Platform Builder to build the platform.

To build the platform

  • On the Platform Builder Build menu, click Build Platform.

    The process should take approximately 10 minutes.

The image (nk.bin) is written to the folder specified in the New Platform Wizard - Step 3. The default location is:

<[DRIVE]:>\WINCE420\PUBLIC\<YourPlatformName>\RelDir\
   EMULATOR_X86Release\nk.bin
Show:
© 2014 Microsoft