Open GoogleCodeExporter opened 8 years ago
In case there is any concern about running the program provided, here is the
source
C# code to go with it.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
using System.Threading;
namespace debugGE5
{
class Program
{
static private HttpListener listener = null;
static private Thread serverThread = null;
static private int updateCount = 0;
static void Main(string[] args)
{
if (!HttpListener.IsSupported)
{
return;
}
listener = new HttpListener();
listener.Prefixes.Add("http://*:9142/");
listener.Start();
if (serverThread == null)
{
serverThread = new Thread(listen);
serverThread.Name = "GEServer";
//Makes it so the application does not wait for this thread to finish
before it shuts down
serverThread.IsBackground = true;
serverThread.Start();
}
Console.WriteLine("Listening on http://*:9142/");
Console.WriteLine("Drop gecko.kml onto GE 5 to initiate test");
while (serverThread != null && serverThread.IsAlive && listener.IsListening)
{
System.Threading.Thread.Sleep(1000);
}
}
static public void listen()
{
for (; ; )
{
// Note: The GetContext method blocks while waiting for a request.
try
{
HttpListenerContext ctx = listener.GetContext();
ProcessRequest(ctx);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
static private void ProcessRequest(HttpListenerContext context)
{
try
{
string msg = context.Request.HttpMethod + " " + context.Request.Url;
string hostName = context.Request.Url.Host;
Console.WriteLine("Receive request " + msg);
byte[] b;
string url = msg.Replace("GET ", "");
if (msg.Contains("initial"))
{
StreamReader s = File.OpenText("initial.kml");
Console.WriteLine("Sending initial.kml");
b = Encoding.UTF8.GetBytes(s.ReadToEnd());
s.Close();
}
else // Anything else is considered an update
{
StreamReader s;
try
{
s = File.OpenText("update" + updateCount + ".kml");
Console.WriteLine("Sending update" + updateCount + ".kml");
}
catch (Exception exs)
{
s = File.OpenText("updateEmpty.kml");
Console.WriteLine("Sending updateEmpty.kml");
}
b = Encoding.UTF8.GetBytes(s.ReadToEnd());
s.Close();
updateCount++;
}
context.Response.ContentLength64 = b.Length;
context.Response.OutputStream.Write(b, 0, b.Length);
context.Response.OutputStream.Close();
}
catch (Exception ex)
{
Console.WriteLine("Error processing request: " + ex.Message);
}
}
}
}
Original comment by oddt...@gmail.com
on 9 Feb 2009 at 10:47
Through more debugging, I've reduced the example KML data to the specific
conditions
under which the crash occurrs.
Essentially any Create/Delete or Change/Delete of a Placemark feature within
the same
Update and that involves the LookAt element of the Placemark causes the crash
in 5.0,
but not 4.2.(Interestingly enough, modifying the Point element under the same
conditions didn't cause the crash)
The work-around in this case was to not do the Change if there was a Delete
going to
happen later in the Update, or to remove both the Create and Delete if they
occurred
in the same Update.
The work-around is actually the optimal solution, since it saves on unnecessary
element Updates.
Original comment by oddt...@gmail.com
on 10 Feb 2009 at 2:20
Original issue reported on code.google.com by
oddt...@gmail.com
on 6 Feb 2009 at 11:48Attachments: