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.

andrewxxx

Member Since 08 Mar 2015
Offline Last Active Mar 12 2015 01:51 PM
-----

Topics I've Started

An unhandled exception of type 'System.Exception'

08 March 2015 - 06:09 PM

i'm working on a finger print module, the compiler throw me an unhandled exception with no details or data for what's wrong

An unhandled exception of type 'System.Exception' occurred in Project Intersect.exe

 


        public static implicit operator byte[](CommandPacket packet)
        {
            var buffer = new byte[52];
            fixed (byte* ptr = buffer)
            {
                *((ushort*)(ptr)) = (ushort)packet.PacketID;
                *((ushort*)(ptr + 2)) = (ushort)packet.Subtype;
                *((ushort*)(ptr + 4)) = packet.Length;
                for (var i = 0; i < 16; i++)
                    *(ptr + 6 + i) = packet.Data[i];
                *((ushort*)(ptr + 22)) = packet.CheckSum;
            }
            return buffer;
        }
it throws the exception at *((ushort*)(ptr)) = (ushort)packet.PacketID; (yeah i did try to comment this one as maybe it could be the enum casting that causes this problem but still same exception on the next line)
 
so what's wrong ? any alternatives ?

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.