Why does this message appear when I run this code?
<p>I wrote this code which sends an Image between sender and receiver.</p>

<p>First you must run receiver then run sender.</p>

<p>When I test this code on images between 1KB and 1.5KB, it works fine, but when I try to send a larger image, this message appears </p>

<blockquote>
  <p>cannot evaluate expression because a
  native ..........</p>
</blockquote>

<p>My code is below, can someone help?   </p>

<pre><code> using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    using System.Net;
    using System.Net.Sockets;
    using System.IO;
    using System.Drawing;
    using System.Drawing.Imaging;
    using System.Windows.Forms;
    using System.Threading;

    namespace UPDTester
    {
        public class UDPClass
        {

            public Image Merge(Queue&lt;byte[]&gt; myList)
            {
                int ImgHeight = BitConverter.ToInt32(myList.Dequeue(), 0);
                int ImgWidth = BitConverter.ToInt32(myList.Dequeue(), 0);

                Bitmap bmp = new Bitmap(ImgWidth, ImgHeight);
                Graphics g = Graphics.FromImage(bmp);

                int x, y = 0;
                while (myList.Count &gt; 0)
                {
                    x = BitConverter.ToInt32(myList.Dequeue(), 0);
                    y = BitConverter.ToInt32(myList.Dequeue(), 0);
                    g.DrawImage(ByteToBitmapConverter(myList.Dequeue()), x, y);
                }
                return bmp;
            }

            /// &lt;summary&gt;
            /// Image Segmentatoin.
            /// img: the image that we like to divided.
            /// &lt;/summary&gt;
            public Queue&lt;byte[]&gt; Segmentation(Bitmap img)
            {
                Queue&lt;byte[]&gt; ByteArray = new Queue&lt;byte[]&gt;();

                ByteArray.Enqueue(BitConverter.GetBytes(img.Width));
                ByteArray.Enqueue(BitConverter.GetBytes(img.Height));                    

                Image temimg;

                for (ushort x = 0; x &lt; img.Width - 5; x += 5)
                {
                    for (ushort y = 0; y &lt; img.Height - 5; y += 5)
                    {
                        //temimg = null;
                        temimg = img.Clone(new Rectangle(x, y,  5,  5), PixelFormat.Format32bppArgb);
                        ByteArray.Enqueue(BitConverter.GetBytes(x));
                        ByteArray.Enqueue(BitConverter.GetBytes(y));                    
                        ByteArray.Enqueue(ImageToByteConverter(temimg));
                    }
                }
                return ByteArray;
            }

            //Sender
            public void SenderUDP(Bitmap img)
            {
                byte[] data = new byte[1024];            
                IPEndPoint ipep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 9050);

                Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);

                string welcome = "Hello, are you there?";
                data = Encoding.ASCII.GetBytes(welcome);

                server.SendTo(data, data.Length, SocketFlags.None, ipep);

                IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);
                EndPoint Remote = (EndPoint)sender;

                data = new byte[1024];
                int recv = server.ReceiveFrom(data, ref Remote);

                MessageBox.Show("Message received from");
                MessageBox.Show(Encoding.ASCII.GetString(data, 0, recv));

                Queue&lt;byte[]&gt; temlist = Segmentation(img);
                data = new byte[1024];
                data =temlist.Dequeue();
                //Send Width of image.
                server.SendTo(data, data.Length, SocketFlags.None, ipep);

                data = new byte[1024];
                data = temlist.Dequeue();
                //Send Height of image.
                server.SendTo(data, data.Length, SocketFlags.None, ipep);

                data = BitConverter.GetBytes(temlist.Count);
                //Send Count of all list.
                server.SendTo(data, data.Length, SocketFlags.None, ipep);
                MessageBox.Show(temlist.Count.ToString() + " Iam Sender");

                while (temlist.Count &gt; 0)
                {
                    server.SendTo(temlist.Dequeue(), Remote);
                    //MessageBox.Show(temlist.Count.ToString() + "S");
                }
                //server.Close();
            }

            //Receiver..(IP, PortNum)
            public Image ReceiverUDP()
            //public void ReceiverUDP(ref PictureBox pic)
            {
                int recv;
                byte[] data = new byte[1024];
                IPEndPoint ipep = new IPEndPoint(IPAddress.Any, 9050);

                Socket newsock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);

                newsock.Bind(ipep);
                MessageBox.Show("Waiting for a client....");
                //Console.WriteLine("Waiting for a client....");

                IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);
                EndPoint Remote = (EndPoint)(sender);

                recv = newsock.ReceiveFrom(data, ref Remote);

                MessageBox.Show("Message received from ", Remote.ToString());
                MessageBox.Show(Encoding.ASCII.GetString(data, 0, recv));
                //Console.WriteLine("Message received from {0}:", Remote.ToString());
                //Console.WriteLine(Encoding.ASCII.GetString(data, 0, recv));

                string welcome = "Welcome to my test server";
                data = Encoding.ASCII.GetBytes(welcome);
                newsock.SendTo(data, data.Length, SocketFlags.None, Remote);

                Queue&lt;byte[]&gt; TempList = new Queue&lt;byte[]&gt;();

                //Receive Width of image.
                newsock.ReceiveFrom(data, ref Remote);
                TempList.Enqueue(data);

                //Receive Height of image.
                newsock.ReceiveFrom(data, ref Remote);
                TempList.Enqueue(data);

                //reccive Count of the list.
                newsock.ReceiveFrom(data, ref Remote);
                int count = BitConverter.ToInt32(data, 0);
                MessageBox.Show(count.ToString() + " Iam Receiver");

                data = new byte[1024];
                while (count &gt; 0)
                {                
                    data = new byte[1024];

                    newsock.ReceiveFrom(data, ref Remote);
                    TempList.Enqueue(data);
                    data = new byte[1024];

                    newsock.ReceiveFrom(data, ref Remote);
                    TempList.Enqueue(data);
                    data = new byte[1024];

                    newsock.ReceiveFrom(data, ref Remote);
                    TempList.Enqueue(data);

                    MessageBox.Show(count.ToString());    
                    count -= 3;
                }


                return Merge(TempList);
            }

            private byte[] ImageToByteConverter(Image img)
            {
                MemoryStream ms = new MemoryStream();
                img.Save(ms, ImageFormat.Png);
                return ms.ToArray();
            }

            private Image ByteToBitmapConverter(byte[] buffer)
            {
                MemoryStream ms = new MemoryStream(buffer);
                Image img = Image.FromStream(ms);
                return img;
            }
        }
    }
</code></pre>
