Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Creating Device Emulator project with .NET MF 4.3 SDK throws exception


  • Please log in to reply
5 replies to this topic

#1 Emilio x64

Emilio x64

    Advanced Member

  • Members
  • PipPipPip
  • 40 posts

Posted 19 July 2013 - 03:28 PM

I am using Visual Studio 2012 Ultimate on a Windows 7 Ultimate x64 OS. I am new to Netduino. I downloaded and installed the .NET MF 4.3 as well as the Netduino 4.3 SDK (couldn't find the link to the x64 version).

 

I opened VS 2012 and created a Device Emulator project but every time I compiled it it gave a warning about missing references to the 4.3 libraries or so, but it would compile. In the project properlies I did see that the Target Framework was EMPTY but clicking on it would list the standard .NET frameworks but NOT the 4.3 Microframework, why?

 

I also created a sample MF console application. I was able to build the solution and run it. On ocassions and without any reason or interaction the whole thing would crash with an exception on the emulator but it wouldn't let me see well (the exception data disappears after the emulator window disappears, it disappears by itself after a little while). And then just the same without change it would work well and I am not doing anything fancy.

 

However, the problem now being that I used it until past midnight multiple times. This morning I started VS.2012 and opened my MF solution and now (no changes) the Device Emulator project would not load. It said I didn't have the Targeting Pack. It simply doesn't load anymore.

 

The same happens with some sample projects I downloaded, they don't load into VS.2012

 

There is a problem with the installer too. Like all security conscious people, I use my Administrator account for just that and have been developing under a restricted user account for years. I noticed that I could not find the samples on my restricted account. As it turned out, the installer placed the Samples files in the Documents folder of the Administrator user (where the install was made for ALL users). I would suggest those files be put in the Public user Documents folder or let the user where to install them.



#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 19 July 2013 - 04:27 PM

Hi degt, The Netduino 4.3 SDK has a single installer, for both 32-bit and 64-bit systems. It auto-detects, and automatically installs drivers appropriately. On the device emulator...it sounds like there's something wrong with the installation of the .NET MF 4.3 SDK. Can you try uninstalling and reinstalling that? Also--what happens if you run Visual Studio and try to create that project from your Administrator account? Chris

#3 nakchak

nakchak

    Advanced Member

  • Members
  • PipPipPip
  • 404 posts
  • LocationBristol, UK

Posted 19 July 2013 - 07:21 PM

Assuming the emulator lives in either program data or program files you probably will run into issues trying to debug or attaching the debugger due to the (relatively) new security features in win7+8.  If the emulator runs fine when you run VS as an admin then you could try moving the exe outside of programfiles and altering your project debug settings to launch from the location you copied it to, it may well work fine then without admin privileges...

 

The same thing can happen when trying to use IIS instead of IIS express when developing ASP.Net apps.

 

Nak.



#4 Emilio x64

Emilio x64

    Advanced Member

  • Members
  • PipPipPip
  • 40 posts

Posted 19 July 2013 - 09:58 PM

Well as I mention it is spurious, it may fail several times in a row and then the next one it doesn't crash. I have been developing .NET web & desktop apps for years under a restricted account and haven't encountered any real issues.

 

I tried putting a try/catch on the Main of the Emulator project but even with that it simply crashes back to VS and leaves absolutely no information (log, output) about what went wrong. Even the output window is empty.

 

BTW the Device Emulator project wouldn't load today anymore (didn't have that yesterday because I never existed VS). I had to change the target framework of the Emulator (no the MF application) to .NET 4.5. The target framework drop down would only show standard (not micro) framework versions. The MF application project however DOES show only the Microframework versions in that Target Framework dropdown. So is that okay? should I target my emulator at any of the std. frameworks (4.0, 4.5) ?

 

By trying multiple times and attempting to being extremely fast to do Select All & Copy in the Output window when the crash ocurrs I managed to get this. When it happens this information is left only for a second or two in the output window before it is cleared and replaced by "Found debugger!". I think that needs some attention.

Looking for a device on transport 'Emulator'Launching emulator with command line: '"N:CodeMicroFrameworkMyAppMyDeviceEmulatorbinDebugMyDeviceEmulator.exe" "/waitfordebugger" "/load:C:Program Files (x86)Microsoft .NET Micro Frameworkv4.3AssembliesleMicrosoft.SPOT.Native.pe" "/load:C:Program Files (x86)Microsoft .NET Micro Frameworkv4.3Assemblieslemscorlib.pe" "/load:C:Program Files (x86)Microsoft .NET Micro Frameworkv4.3AssembliesleMicrosoft.SPOT.Graphics.pe" "/load:C:Program Files (x86)Microsoft .NET Micro Frameworkv4.3AssembliesleMicrosoft.SPOT.Hardware.pe" "/load:N:CodeMicroFrameworkMyAppMyDeviceEmulatorbinDebugleMyApp.pe"'Restarting interpreter...Attaching to device...Deployment error: failed to (re)connect debugger engine to debugging target.The debugging target and the debugger engine failed to initialize because of unspecified device errors.The debugger engine thread has terminated unexpectedly with error 'Debugger engine could not attach to debugging target.'.


#5 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 19 July 2013 - 10:28 PM

degt, The Emulator is a Windows Desktop app. So you'll want to target the regular .NET Framework with it. The NETMF interpreter runs _inside_ the emulator. A bit confusing? Yes :) Chris

#6 Emilio x64

Emilio x64

    Advanced Member

  • Members
  • PipPipPip
  • 40 posts

Posted 26 July 2013 - 03:23 PM

OK the target is okay. What I have consistently noted is that the emulator tends to crash many times on startup with the same error, that it found the emulator but failed to (re)connect to the emulator.

 

I observe that my custom emulator UI pops up and the Output Window shows "Emulator found..." and many times it crashes a few seconds after that. If I try several times (without any change) then at some point it does connect to the emulator and I see a bunch of messages on the Output Window indicating the progress of loading assemblies and data from the PE file (memory usage, etc.).

 

Even in the cases it crashes I see that before it crashes I can FULLY interact with the WinForms custom emulator UI I created. Operating it does not cause the exception. Why the uF Emulator backend fails to (re)connect on initial loading puzzles me. Sometimes doing a "Clean Project" followed by "Rebuild Solution" does it, but other times it doesn't. Sometimes I have to try like 5-6 times to get it to run.

 

BTW... is there a flag or something in my emulator UI (WinForms) that I can use to wait for the Microsoft Emulator to be READY? I see a message on the Output Window that says "Hello World!" and that's how I know it is ready but I want to disable the UI until that phase is reached.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.