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

Can't create custom events

Public event error

Best Answer Chris Walker, 27 March 2015 - 08:32 AM

Hi marcbaye,

Are you running Visual Studio 2015 (CTP/Preview) by any chance? We experienced this same issue with VS2015 beta builds...and moving to Visual Studio 2013 solved the issue.

If not: this is something I want to get filed as an official bug report for VS/NETMF.

Chris Go to the full post


  • Please log in to reply
14 replies to this topic

#1 marcbaye

marcbaye

    New Member

  • Members
  • Pip
  • 5 posts

Posted 10 February 2015 - 12:33 AM

I'm playing with my new netduino plus 2... all fun until an error appeared when I deploy and debug:

 

Resolve: unknown type: System.Diagnostics.DebuggerBrowsableState

Error: ff000000

Waiting for debug commands...

The program '[1] Micro Framework application: Managed' has exited with code 0 (0x0).

 

After rolling back the newly added code until the sketch works again, I released that everything goes wrong when I try to create an event. I created a simple sketch that fails:

 

public class Program
{
  public event NativeEventHandler TestEvent;
  public static void Main()
  {
     while (true) { }
  }
}
 
Tested on 4.2 and 4.3 framework with same result... any ideas?
Thanks in advance!


#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 10 February 2015 - 01:18 AM

Hi marcbaye,

Did you mean to specifically use "NativeEventHandler"? Perhaps regular "EventHandler"?

Chris

#3 marcbaye

marcbaye

    New Member

  • Members
  • Pip
  • 5 posts

Posted 10 February 2015 - 01:20 AM

No no... I started with my own handler... tried EventHandler... whatever I use, the error occurs...



#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 10 February 2015 - 03:32 AM

Hi marcbaye,

Can you upload a zipped, super-simple sample project (using EventHandler)? A handful of lines of code, max?

Chris

#5 marcbaye

marcbaye

    New Member

  • Members
  • Pip
  • 5 posts

Posted 10 February 2015 - 07:46 AM

The full code is huge! But it doesn't matter: it works if I comment the events. Just add this to compile (even without using it)

 
public class Test
{
public delegate void MyEventHandler();
public event MyEventHandler TestEvent;
}
 
And the error appears.


#6 marcbaye

marcbaye

    New Member

  • Members
  • Pip
  • 5 posts

Posted 10 February 2015 - 07:54 AM

Uhm... I remember.... this cause exactly the same error:

 
public class Test
{
public int TestProperty { get; set; }
}
 
But I learned to change to:
 
public class Test
{
int _TestProperty;
public int TestProperty
{
get { return _TestProperty; }
set { _TestProperty = value; }
}
}
 
And then runs without problem.


#7 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 27 March 2015 - 08:32 AM   Best Answer

Hi marcbaye,

Are you running Visual Studio 2015 (CTP/Preview) by any chance? We experienced this same issue with VS2015 beta builds...and moving to Visual Studio 2013 solved the issue.

If not: this is something I want to get filed as an official bug report for VS/NETMF.

Chris

#8 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 27 July 2015 - 06:27 AM

If you run into this issue (especially with VS2015), here's a quick fix...

Add the following class to your project:
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
// Copyright (c) Microsoft Corporation.  All rights reserved. 
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
using System;

namespace System.Diagnostics
{
    //  DebuggerBrowsableState states are defined as follows:
    //      Never       never show this element
    //      Expanded    expansion of the class is done, so that all visible internal members are shown
    //      Collapsed   expansion of the class is not performed. Internal visible members are hidden
    //      RootHidden  The target element itself should not be shown, but should instead be
    //                  automatically expanded to have its members displayed.
    //  Default value is collapsed

    //  Please also change the code which validates DebuggerBrowsableState variable (in this file)
    //  if you change this enum.
    public enum DebuggerBrowsableState
    {
        Never = 0,
        Collapsed = 2,
        RootHidden = 3
    }
}
This was copy-and-pasted from the NETMF source. License is Apache 2.0.

This really shouldn't be necessary (and in fact...it should trigger a duplicated code warning/error). But it should get you back up and running.

Chris

#9 blindahl

blindahl

    Member

  • Members
  • PipPip
  • 14 posts
  • LocationSedro-Woolley, WA

Posted 28 July 2015 - 09:10 PM

Chris -

 

I just hit this in a Netduino 3 universal app, built against 4.3.2.2 in VS 2015 RC. The above fix didn't help. I can change over to non-automatic properties for now.

 

brian



#10 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 28 July 2015 - 10:58 PM

Hi brian,

What error are you getting, exactly? Also--do you have multiple projects in your solution, and did you add the source file to the project giving you the error?

Chris

#11 blindahl

blindahl

    Member

  • Members
  • PipPip
  • 14 posts
  • LocationSedro-Woolley, WA

Posted 29 July 2015 - 12:06 AM

The error was the same as in the original post:

 

Resolve: unknown type: System.Diagnostics.DebuggerBrowsableState

Error: ff000000

 

I tried adding it in 2 ways - one, pasting at the top of an existing code file in the main app project (keeping the namespace, of course), and also creating a new file in a secondary project.

 

The solution is 3 projects - a class library with some utility components, a class library that i'm working on with a menu framework for the LCD panel i'm using, and an app for testing the latter library. The latter library and the main app both use the utility library, so that's where I tried putting the new file.

 

I can revert the changes I made if it'll help get to the bottom of this. I'm also available to chat via skype or facebook chat if it helps streamline communication. :)

 

brian

 

EDIT -

 

Reverted back to short property declarations, and it went back to failing. Strange thing is that I still have several short properties in a static class in the utility library that DON'T make it fail...it's only the ones I created today in the new lib that are making it fail. Only difference I can see is that they're not static.



#12 marcbaye

marcbaye

    New Member

  • Members
  • Pip
  • 5 posts

Posted 29 July 2015 - 06:09 AM

I'm sorry, I'm out of the business for a while... but, in fact, in my case, the solution was to move to VS2013.



#13 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 29 July 2015 - 04:42 PM

Hi brian,

I tried adding it in 2 ways - one, pasting at the top of an existing code file in the main app project (keeping the namespace, of course), and also creating a new file in a secondary project.

With VS2015 support (experimental), the compiler will need the class in a separate file in the project which is giving you the compiler error.

Can you please add the code as a separate file in the main app project? [If it's in a secondary project, it won't fix the situation).

This appears to be a bug in the compiler/metadataprocessor portion of the VS2015 toolchain, and as of now it appears to only affect this specific enumeration (or enums in its classification).

Would you mind filing an issue on the NETMF repo as well, so we can coordinate to get this fixed and we can get VS2015 support to official status?

NETMF vNext bug filing:
https://github.com/n...erpreter/issues

NETMF 4.3 bug filing:
http://netmf.codeple...item/list/basic

Chris

#14 blindahl

blindahl

    Member

  • Members
  • PipPip
  • 14 posts
  • LocationSedro-Woolley, WA

Posted 29 July 2015 - 04:46 PM

I'll report it. Note that this isn't a compiler error... it's displayed in the 'resolving' phase when launching the app on the device.

 

brian



#15 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 29 July 2015 - 08:15 PM

Hi brian,

I'll report it. Note that this isn't a compiler error... it's displayed in the 'resolving' phase when launching the app on the device.

Thank you. Yeah, I think that the VS2015 compiler/linker is leaving out or garbling the reference. Based on user reports, recompiling and deploying from VS2013 (using the same NETMF SDK release) works as expected.

There have been a lot of changes to the build process with VS2015--but hopefully this is something simple to track down.

Thanks so much for helping improve the VS2015 + NETMF experience!

Chris




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.