Main Site Documentation

Vb.net


#1

Anyone is using VB.NET with last SDK?

I’ve really too many (absurd) problems and troubles programming the board (Cerbuino), so they cannot originate all from my mistakes. I’m thinking that maybe VB has some really bad support and all problems are from it…

Or there is someone that is working with VB without problem?

thanks


#2

Hi,
I’m using both languages, with Win8 and VS2012. I don’t know where you are troubles, in my case it’s true that found several dificulties with USB Drivers and the Cerbuino only works fine with old drivers. But in my apps cannot found any problem derived from the language “VB”.

May be you can share any scenario to try and test in my environment?
Best,
PepLLuis,


#3

working a long time with XP/VB.Net 2010
now with WIN8.1/VB.NET 2012

do’nt see any problems with my Spider

please show us some code and let us find it out thogether…


#4

Thank you.

So, my environment is Win 8.1 eng + VS 2012 Pro U4 eng
I’m working on Cerbuino Bee, last SDK

It’s quite hard to find a code snippet or a specific code to use as example, because I’ve a lot of strange troubles and not deterministic.

Some kind of problems:

  • networking: my board needs to make some udp and tcp connections. But sometimes the program starts, nic is initialized, but no outgoing connection works. Socket exception. I reboot the board, same. I reboot an other time, same. I disconnect it and reconnect, run the same program again, it works.
  • networking/2 same as previous, but during program runtime. Program starts, works, networking is fine, then later it needs some other connection: same as previous. This is less frequent.
  • timers: I’ve some “GT.Timer”. Sometimes they don’t raise any tick event. I reboot the app, the start working. Same app, timer are initialized at startup.
  • I try to insert or remove a breakpoints (F9): it takes about 20 seconds, is this normal?
  • VS crashes very often during debug, specially if I try to quick access a variable to test its value. In fact it’s impossible to break execution and check a variable without using command line.
  • it’s impossible to run a project as debug is it contains properties declared with just “Public property MyPro as Int32”, without to explicit get and sets. This is a bug in MF, I found on codeplex, however.

This is just something I can remember, but I really have a lot of this. I’m a newbie with .MF (I’ve completed only the previous version of this app, running on the Panda II), but I’m really experienced with VB in network and distributed solutions.

I can private share my app if someone has a board and want help me.

Thanks


#5

All timer events are executed in the same thread in NETMF.
Means as long as you do not return of the timer callback, no other timer is called.

Are you using the legacy drivers? They are very slow.
Search the forum for ‘WinUsb’ and/or ‘Legacy’ to find more. It was discussed often.


#6

My code starts as:


    Private Sub Timer_Tick(state As Object) Handles _timer.Tick

            ' - se non ho l'ora non ha senso che lavori
            If Not _board.IsDateTimeInitialized Then Return

and in debug I can see that the if is false, so the function is returned. :frowning:

No, new drivers.
However I’ve installed the old, and it seems a little BETTER (just a single BSOD).


#7

On some systems the Legacy Drivers can be faster since they are kernel mode drivers, however, it is a guaranteed BSOD when you reset the device while the debugger is attached.


#8

@ James: thanks ,ok.

Please note this bootup code:

  

Sub Main()

            _sd = New LocalStorage.SD

            Try

                Dim interfaces() = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces

                Dim eth1 = interfaces(0)

                ' -- assegno un mac random
                Dim r As New Random
                Dim mac(48 - 1) As Byte
                r.NextBytes(mac)
                ' *** testtttt
                '                eth1.PhysicalAddress = mac
                eth1.PhysicalAddress = New Byte() {&H0, &H75, &H65, &HDE, &HAC, &HAA}

                Dim netConfiguration = _sd.GetConfigurationNetwork()
                eth1.EnableStaticIP(netConfiguration.Address, netConfiguration.Subnet, netConfiguration.Gateway)

                ' -- come DNS usiamo fissi quelli di openDNS
                eth1.EnableStaticDns(New String() {"208.67.222.222", "208.67.220.220"})

' -- tests a dns resolution and NTP
                TryNetwork()

            Catch ex As Exception
                IsNetworkRunning = False
            End Try

            Try
....... other code inside a try block



If I run with debugger attached (VS F5, compiles as “release”), it always runs. Always the board loads the IP address and I can ping it.
If I run without debugger (or better, entire PC) attached, it alway doesn’t run. I cannot ping the board. Simply stops VS, restart the board (with or without USB connected) and same I stop pinging the IP assigned.

Any idea? :frowning:


#9

Well, VB.NET is not one of my strong points, however, if a chunk of code executes properly with debugger attached in any language, but does not work reliably without it, a timing issue is most likely to blame. Is there any difference if you add a delay between configuring the interface and the call to TryNetwork()?

Also, from the block of code you submitted, I’m not seeing the interface being opened as well as an assignment to the network stack.


#10

I’ve added a


      Threading.Thread.Sleep(500)

before TryNetwork(), but still the same. The network doesn’t start and IP address is not loaded.

What do you mean with “interface being opened as well as an assignment to the network stack”? I’m using a Cerbuino Bee and an ENC28, so there isn’t any “Open” or “AssignNetworkingStackTo” (I think).


#11

My apologies, I must have misread your other post. Are you familiar with using network tools such as WireShark? I would watch the network both while debugging and then without debugging to see if the DHCP and other transactions are actually different or if one end is simply missing an ACK.


#12

I know what it is, but I’ve never used it.
If I will install, can I easy get useful data or it’s too hard for a new user?


#13

It may be a bit daunting if you have never looked at data from a network analyzer before, but wireshark will allow you to save the captured data so that we can load it and take a look. Also, you can apply a ip=<destination_ip> filter and only catch data to and from that address.