Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 7 of 7

Getting "unspecified error" in VB during FindAddre

This is a discussion on Getting "unspecified error" in VB during FindAddre within the MapPoint Desktop Discussion forums, part of the Map Forums category; I have a VB app that accesses the current Map object, and uses the following code... Set oFR = oMap.FindAddressResults(Address1, ...

  1. #1
    mschoonmaker is offline Junior Member White Belt
    Join Date
    Aug 2003
    Posts
    9

    Getting "unspecified error" in VB during FindAddre

    I have a VB app that accesses the current Map object, and uses the following code...

    Set oFR = oMap.FindAddressResults(Address1, City, ,ST, Zip, geoCountryUnitedStates)
    followed by
    If oFR.ResultsQuality < geoNoGoodResult Then...

    if Address1 includes the string "po box" then I get a VB application error (0x80004005) 'Unspecified error"

    I would have thought that if the FindAddressResults() fails, it would set oFR to nothing, OR the ResultsQuality would be geoNoGoodResult or higher. Unforunately, I'm never able to get this far.

    Any ideas?

    TIA,
    Mike
    Mike Schoonmaker

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    PO box

    I ran into the same problem. In the MP reference there are some guidelines. I had to add a filter to remove these items. I still think it is pretty bad that an unhandled exception is thrown.

    Here are the rules:

    Address coverage in MapPoint is available for all of the United States and major urban areas in Canada.

    Type as much of the address as possible. Adding the ZIP or postal code is especially helpful.

    Do not include apartment, suite, post office (P.O.) box numbers, or rural route (R.R.) addresses in the street address.

    Do not include fractions. For example, if the address is 654 1/2 Carlson Street, type 654 Carlson Street.

    If you are not sure of the correct spelling of a street or city name, type the closest approximation you can to view a list of possible choices, and then click the best match in the list.

    If a street name includes an ampersand (&), replace the ampersand with the word "and." (Ampersands are used to denote intersections.)

    If you cannot find an address that includes an abbreviation, try spelling it out. For example, try Saint James if "St. James" is not recognized.

  3. #3
    mschoonmaker is offline Junior Member White Belt
    Join Date
    Aug 2003
    Posts
    9

    RE: Getting "unspecified error" in VB during FindA

    The address being used should not be a problem. I'm running the addresses through some USPS CASS-certified software for Address Correction before running in MapPoint.

    Thanks for your suggestions.
    Mike Schoonmaker

  4. #4
    citrix_99301's Avatar
    citrix_99301 is offline Junior Member Yellow Belt
    Join Date
    Mar 2006
    Posts
    17

    MapPoint.Application.NA.13 Unspecified error

    I'm pretty sure it's not the address; I'm getting the same kind of unspecified error when querying a dataset / pushpin set using MapPoint.Recordset oRSR = oDS.QueryAllRecords(). I've a growing suspicion that this is a stack overflow issue within the axMapPoint object itself.

    My application is a route optimization tool for a large lawn and tree care company. Our routing department might pull up a week's worth of work for ten mowing routes; this might create 300 or so pushpins on the map. There's a treeview control on the windows form that displays each route as a node with the route's jobs as subnodes. When the user clicks on an item in the treeview, that route or job' pushpin(s) is higlighted on the axMapPoint map. After clicking on a few of these, the axMapPoint map invariably starts kicking out "Unspeciied Error" messages and won't respond anymore.

    I've double checked all the addresses and they all meet the criteria mentioned in the previous post. Furthermore, the failure appears to be random and based on the number of times a user clicks to the map rather than on a specific address. The more pushpins on the map, the fewer routes/jobs I have to click on before it fails. I've gotten it to fail with as few as 60 pushpins but have to click around for quite a while before it ails. However, with 350 pushpins the "unspecified error" failure is guaranteed after just a few clicks. The failure point is at oDS.QueryAllRecords(); the pushpin set has the correct number of matching records but throws the exception once it keeps working.

    The fact that the failure point happens on different addresses each time (an address may work the first time but fail if I click it again) and the failure point comes sooner the more pushpins are on the map leads me to believe that after a while a memory stack in MapPoint 2006 is overflowing.


    Thanks,

    Andre Ranieri



    private void tvRoutes_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
    {
    if (!this.bIsBuilding) // suppress if building a new map. this is set in another method
    {
    try
    {


    /// TOD: this loop is here for debugging: delete all pushpinsets w/ no pushpins
    foreach (MapPoint.DataSet ddd in axMapPoint.ActiveMap.DataSets)
    {
    Console.WriteLine(ddd.Name + '\t' + ddd.RecordCount);
    if (ddd.RecordCount == 0)
    ddd.Delete();
    }


    MapPoint.Map oMap = this.axMapPoint.ActiveMap;

    datDateSched = DateTime.Now;
    iServiceID = 0;
    this.sPrintDate = dtStart.Value.ToShortDateString() + " to " + dtEnd.Value.ToShortDateString();

    //remove highlighting on all pushpins
    foreach (TreeNode n in tvRoutes.Nodes)
    {
    if (n.Parent == null)
    {
    datDateSched = ((Senske.SenskePro.Accounts.myTechNode)(((System.W indows.Forms.TreeNode)((n))))).datDateScheduled;
    sNodeRoute = ((Senske.SenskePro.Accounts.myTechNode)(((System.W indows.Forms.TreeNode)((n))))).sRoute;
    Object oName = (object)sNodeRoute + "-" + datDateSched.ToShortDateString();

    if (oName == null)
    {
    return;
    }
    MapPoint.DataSet oDS = oMap.DataSets.get_Item(ref oName);
    if (oDS.RecordCount >= 1)
    {
    MapPoint.Recordset oRSR = oDS.QueryAllRecords(); // Sometimes generates "Unspecified Error" here

    oRSR.MoveFirst();
    if (oRSR.EOF)
    {
    return;
    }

    oRSR.MoveFirst();
    if (oRSR.EOF)
    {
    return;
    }
    while (!oRSR.EOF)
    {
    //MapPoint.Pushpin pin = oRS.MoveToPushpin();
    // pin.Highlight = true;

    oRSR.Pushpin.Highlight = false;
    oRSR.MoveNext();
    }
    oRSR = null; //clear recordset
    }
    }
    }


    // this is a top-level route node
    if (tvRoutes.SelectedNode.Parent == null)
    {
    sNodeType = "TechNode";
    datDateSched = ((Senske.SenskePro.Accounts.myTechNode)(((System.W indows.Forms.TreeNode)((tvRoutes.SelectedNode))))) .datDateScheduled;
    sNodeRoute = ((Senske.SenskePro.Accounts.myTechNode)(((System.W indows.Forms.TreeNode)((tvRoutes.SelectedNode))))) .sRoute;

    MapPoint.DataSet oDS;
    Object oName = (object)sNodeRoute + "-" + datDateSched.ToShortDateString();
    oDS = oMap.DataSets.get_Item(ref oName);

    if (oDS.RecordCount >= 1)
    {
    MapPoint.Recordset oRS = oDS.QueryAllRecords();
    oRS.MoveFirst();
    if (oRS.EOF)
    {
    return;
    }
    while (!oRS.EOF)
    {
    //MapPoint.Pushpin pin = oRS.MoveToPushpin();
    // pin.Highlight = true;

    oRS.Pushpin.Highlight = true;

    oRS.MoveNext();
    }
    oDS.ZoomTo();
    oRS = null; //clear recordset
    this.sPrintDate = " for " + datDateSched.ToShortDateString();
    }
    }

    // this is a second-level job node
    else
    {
    sNodeType = "JobNode";
    datDateSched = ((Senske.SenskePro.Accounts.myJobNode)(((System.Wi ndows.Forms.TreeNode)((tvRoutes.SelectedNode))))). datDateScheduled;
    iServiceID = ((Senske.SenskePro.Accounts.myJobNode)(((System.Wi ndows.Forms.TreeNode)((tvRoutes.SelectedNode))))). iServiceID;
    iAccountKey = ((Senske.SenskePro.Accounts.myJobNode)(((System.Wi ndows.Forms.TreeNode)((tvRoutes.SelectedNode))))). iAccountKey;
    sBName = ((Senske.SenskePro.Accounts.myJobNode)(((System.Wi ndows.Forms.TreeNode)((tvRoutes.SelectedNode))))). sBName;
    sSAddress = ((Senske.SenskePro.Accounts.myJobNode)(((System.Wi ndows.Forms.TreeNode)((tvRoutes.SelectedNode))))). sSAdress;
    sPrenotifyStatus = ((Senske.SenskePro.Accounts.myJobNode)(((System.Wi ndows.Forms.TreeNode)((tvRoutes.SelectedNode))))). sPrenotifyStatus;
    sServiceOn = ((Senske.SenskePro.Accounts.myJobNode)(((System.Wi ndows.Forms.TreeNode)((tvRoutes.SelectedNode))))). sServiceOn;
    sNodeRoute = ((Senske.SenskePro.Accounts.myJobNode)(((System.Wi ndows.Forms.TreeNode)((tvRoutes.SelectedNode))))). sRoute;



    if (oMap.FindPushpin(iServiceID.ToString()) != null)
    {
    oMap.FindPushpin(iServiceID.ToString()).Highlight = true;
    oMap.FindPushpin(iServiceID.ToString()).GoTo();
    }
    }
    oMap.Saved = true;
    }
    catch (Exception ex)
    {
    MessageBox.Show(ex.Message, "An error has occured at " + ex.Source ,MessageBoxButtons.OK, MessageBoxIcon.Error);
    Class1 cls1 = new Class1();
    cls1.SendError(this.ToString(), ex, "Route: " + this.cboRoute.Text + "\r\nNode: " + datDateSched.ToShortDateString());
    return;
    }
    }
    }

  5. #5
    citrix_99301's Avatar
    citrix_99301 is offline Junior Member Yellow Belt
    Join Date
    Mar 2006
    Posts
    17

    "Unspecified Error" - problem solved

    I just thought I'd post my solution to the "unspecified error" issue.

    I ended up setting the oName object to null at the end of the method and the symptoms went away.

    I didn't realize the object was being passed into Map Point itself; I'd incorectly assumed that they would be deallocated when the method completed and the object passed out of scope.


    Cheers,

    Andre Ranieri

  6. #6
    citrix_99301's Avatar
    citrix_99301 is offline Junior Member Yellow Belt
    Join Date
    Mar 2006
    Posts
    17

    Unspecified Error - MapPoint 2006 Active-X from VS .NET 2003

    A followup to my earlier post: It appears the unspecified error is some type of memory leak / buffer overflow coming from MapPoint itself. The users can query so many recordsets from the map's pushping sets before MapPoint bombs.

    Apprently, when the axMapPoint map object is dumped to a .ptm file (.saveas method) the buffers are cleared. I'll never know how I stumbled upon this. My really, really ugly workaround to the issue is to save the map to a file every time the pushpin selection changes on the map. Occasionally the file has an exclusive lock on it after being saved, which is only released when MapPoint is closed. This is the reason for the try / empty catch block and random number concatenated into the file name.

    The dispose method of the form attempts to delete the temp directory.

    Again, this is ugly but appears to solve the unspecified error bug.

    Andre Ranieri


    string sRnd = rGen.Next(1,1000).ToString();

    //create temp directory to "dump" mappoint maps

    if(!Directory.Exists(@"C:\Temp\" + Class1.sLogin + @"\MapPoint\"))
    {
    Directory.CreateDirectory(@"C:\Temp\" + Class1.sLogin + @"\MapPoint\");
    }
    try
    {
    this.axMapPoint.SaveMapAs(@"C:\Temp\" + Class1.sLogin + @"\MapPoint\BestFit" + sRnd+ ".ptm");
    }
    catch
    {

    }
    oMap.Saved = true;

  7. #7
    fatone is offline Junior Member White Belt
    Join Date
    Jul 2010
    Posts
    1

    Re: Getting "unspecified error" in VB during FindAddre

    Track the pushpins yourself.

    I did something like...
    Dim Pushpins as Collection

    Then I created a collection of collections for each Dataset.

    Thanks for no updates to fix your errors MS!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Error in calling "get_streetAddress"
    By dgaranz in forum MapPoint Desktop Discussion
    Replies: 5
    Last Post: 06-23-2006, 06:03 AM
  2. MapPoint OLE error: "Could not update object"
    By wiecho_k in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 07-23-2005, 11:53 AM
  3. Error "overflow execution stack" while readinq a
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 5
    Last Post: 02-18-2005, 02:47 PM
  4. Do I need "Autoroute Europe", if I install "M
    By bigtail in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-24-2004, 12:58 AM
  5. error 16398 with NT service "localsystem"
    By arsenic77 in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 06-19-2003, 11:37 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25