Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18303] Windows: No emulators found when trying to build project

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-01-09T15:38:37.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsWindows
Labelswindows
ReporterJamil Spain
AssigneeChristopher Williams
Created2015-01-05T17:24:44.000+0000
Updated2017-03-16T21:46:30.000+0000

Description

trying to build a project via the command line for windows. I just applied the Visual Studio Project update 4 to visual studio professional. I can successfully build a native project in Visual Studio 2013 with emulator 8-1-*. Now when I try to build on command line using the command: ti build -p windows -T wp-emulator -C 8-1-1 --wp-publisher-guid [GUID] I get the error "no Windows Phone Emulators found" no emulators are listed either when I run "ti info"

Comments

  1. Ingo Muschenetz 2015-01-05

    Please try the following:

    Open Visual Studio

    Create a new Windows Phone Project (not a Titanium one)

    Try to run it on an emulator

    Are there emulators listed there?
  2. Jamil Spain 2015-01-05

    Yes, emulators are listed and work fine
  3. Stephen Feather 2015-01-05

    This is where i was as well, but using latest community edition and a ti info shows 2 emulators available. I'll go back to lurking as I don't have the time this week to get back into the windows stuff.
  4. Christopher Williams 2015-01-06

    [~skypanther] is experiencing this issue as well, and I've spent a lot of time debugging it with him. So far it looks very much to me like a somewhat broken VS 2103 install. This is the only thing that appears to break and the underlying error stems from windowslib's wptool, which when trying to list the devices gives us:
       Unhandled Exception: System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
          at Microsoft.VisualStudio.DeviceConnectivity.Interop.ConManClass.GetDatastore(UInt32 dwLocale)
          at Microsoft.SmartDevice.Connectivity.DatastoreManager..ctor(Int32 localeId)
          at Microsoft.SmartDevice.Connectivity.Wrapper.ConnectivityWrapper11.GetDatastoreManager(Int32 localeId)
          at Microsoft.SmartDevice.Connectivity.Wrapper.ConnectivityWrapper11.GetCurrentPlatform(Int32 localeId)
          at Microsoft.SmartDevice.Connectivity.Wrapper.ConnectivityWrapper11.GetEmulatorsIds(Int32 localeId)
          at Microsoft.SmartDevice.MultiTargeting.Connectivity.MultiTargetingConnectivity.GetConnectableDevices(Boolean bNoLegacyDevices)
          at wptool.wptool.Main(String[] args)
       
    I cannot for the life of me figure out why it won't work here, and the best indication I have is that the VS install has some old/bad DLL or something. One possible "fix" is not to rely on [~cb1kenobi]'s wptool to get the listing of devices, but instead defer to C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.1\Tools\AppDeploy\AppDeployCmd.exe for WP 8.1, and C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\XAP Deployment\XapDeployCmd.exe for WP 8.0 to grab the listing of devices. We'd have to rely on basically using regex to parse out the output into structured data. I should note, however, that if wptool is busted for enumerating devices, it will be for connecting to devices as well, so we wouldn't be able to test if we can connect to a device which we use as a sanity check for deploying to device (and I think we use it for launching emulators without installing apps).
  5. Chris Barber 2015-01-06

    I don't understand why XapDeployCmd would work and wptool does not. It's making the same exact API calls as XapDeployCmd. The call in the stack to Microsoft.VisualStudio.DeviceConnectivity.Interop.ConManClass.GetDatastore(UInt32 dwLocale) is a native COM call. I have no clue what sort of file operations this function is doing. I Googled the error and found this: http://weblog.west-wind.com/posts/2005/Mar/12/And-the-Whidbey-SmartPhone-Saga-continues-with-the-February-CTP. The article is old, but explains that the user upgraded their VS and that's when things broke. So this may be the result of a corrupt VS install. I don't get why XapDeployCmd would work though. What is this GetDatastore() function doing? What file does not exist? A library? Maybe the file exists, but it's a file permissions thing?
  6. Jamil Spain 2015-01-06

    Chris, is this after installing the vs update 4 patch? Before the patch, I can confirm that the sdk saw devices, but could not start the app on the simulator, neither could vs professional 2013 start an 8.1 mobile native project.
  7. Chris Barber 2015-01-06

    It's possible that wptool was compiled with an older device connectivity assemblies, then after upgrading these files are no longer found. This is bad. That would explain the FileNotFoundException. Perhaps what we should do is after the "assembly" library finds the dependent assemblies, we copy them from the GAC to the windowslib directory, build wptool against them, and we're set. We can't distribute those assemblies, but we can copy them just in case the get blown away from the GAC. If [~skypanther] deletes the wptool.exe from the windowslib\bin folder, windowslib will recompile it. I wonder if this will fix his issue.
  8. Tim Poulsen 2015-01-07

    I tried deleting windowslib\wptool\bin\Release\wptool.exe as well as windowslib\bin\wptool.exe. Neither worked. I get the same error most of the time, though I also got:
       PS C:\Users\Tim\Documents\Titanium_Studio_Workspace\newwintestclassic> ti build -p windows
       
       C:\Users\Tim\AppData\Roaming\npm\node_modules\titanium\node_modules\longjohn\dist\longjohn.js:185
               throw e;
                     ^
       Error: EBUSY, resource busy or locked 'C:\ProgramData\Titanium\mobilesdk\win32\3.6.0.v20150106084422\node_modules\window
       slib\wptool\bin\Release'
           at fs.rmdirSync (fs.js:612:18)
           at exports.rmdirSyncRecursive (C:\ProgramData\Titanium\mobilesdk\win32\3.6.0.v20150106084422\node_modules\wrench\lib
       \wrench.js:170:15)
           at exports.rmdirSyncRecursive (C:\ProgramData\Titanium\mobilesdk\win32\3.6.0.v20150106084422\node_modules\wrench\lib
       \wrench.js:150:21)
           at C:\ProgramData\Titanium\mobilesdk\win32\3.6.0.v20150106084422\node_modules\windowslib\lib\wptool.js:202:81
           at C:\ProgramData\Titanium\mobilesdk\win32\3.6.0.v20150106084422\node_modules\windowslib\lib\assemblies.js:43:11
           at C:\ProgramData\Titanium\mobilesdk\win32\3.6.0.v20150106084422\node_modules\windowslib\lib\utilities.js:48:3
           at process._tickCallback (node.js:415:13)
       ---------------------------------------------
           at magik (C:\ProgramData\Titanium\mobilesdk\win32\3.6.0.v20150106084422\node_modules\windowslib\lib\utilities.js:33:
       10)
           at Object.detect (C:\ProgramData\Titanium\mobilesdk\win32\3.6.0.v20150106084422\node_modules\windowslib\lib\assembli
       es.js:40:9)
       ...
       
    (says the file was locked, though in fact it was deleted)
  9. Jamil Spain 2015-01-07

    Just pulled a current CI Build 3.6.0v20150107091442 and the problem still persists for me.
  10. Chris Barber 2015-01-07

    [~cwilliams] windowslib should support launching an emulator without installing & launching an app. I'm pretty sure that you cannot launch the emulator, install the app, but not launch it.
  11. Christopher Williams 2015-01-07

    [~cb1kenobi] I'm referring to launching an emulator without installing an app. We can use AppDeployCmd to simultaneously install an app and launch it, which launches an emulator as a byproduct - so replacing that functionality is easy (and actually that's what you already do, if I'm correct). But if we want to just launch the emulator without installing or launching a specific app, then it becomes a pain in the butt to do. I suppose I could cheat again there and ask the emulator to launch some pre-installed app using it's product id.
  12. Chris Barber 2015-01-07

    [~cwilliams] OK, so that's what wptool.connect() does. It will launch the emulator without installing an app.
  13. Christopher Williams 2015-01-07

    [~cb1kenobi] Right, and if Tim/Jamil/whomever's wptool.exe is busted that won't work. So I need to come up with a fallback for launching an emulator without installing an app. I'm hoping I can just do AppDeployCmd /launch with a pre-installed app id, because if not the hack to launch an emulator from the command line sucks.
  14. Chris Barber 2015-01-07

    [~cwilliams] Make sense. So why is wptool not working for Tim and Jamil, yet AppDeployCmd works just fine? I know it's because of the exception, but is there something goofy with their setup? I wonder if my VM has the same issues?
  15. Christopher Williams 2015-01-07

    [~cb1kenobi] That's the million $$$ question. I don't know. They both had a previous Windows Phone 8 setup they used for Win Hybrid, and then upgraded so that appears to be the common ground here. But I can't reproduce and I don't know how to debug further to determine why wptool is broken for them.
  16. Christopher Williams 2015-01-08

    Ok, found it. The 8.0 tooling is broken for [~skypanther]. If he runs XapDeployCmd it fails with the same error. Because we fail immediately and don't try 8.1's tooling/devices, we get none.
  17. Chris Barber 2015-01-08

    Ha, well, there ya go. I'm cool with wptool going away. I never tried the bogus guid trick, but it works great! We just want to retain the logic that starts the emulator as soon as possible in the build, then call XapDeployCmd again to install the app.
  18. Christopher Williams 2015-01-08

    https://github.com/appcelerator/windowslib/pull/10
  19. Tim Poulsen 2015-01-08

    By applying the windowslib PR#10 changes to my SDK I am able to build successfully for a Windows Phone 8.1 emulator. That PR has been merged.
  20. Christopher Williams 2015-01-08

    https://github.com/appcelerator/titanium_mobile/pull/6550
  21. Christopher Williams 2015-01-09

    reopening to assign sprint...
  22. Lee Morris 2017-03-16

    Closing ticket as the issue has been fixed.

JSON Source