MSAJAX 1.0 conflict with V4 API. Sys.InvalidOperationException. V3 API is fine.

Hi Guys,

Been trying to use the new V4 API in my application but I get this error when I call the LoadMap method

function GetMap() {

map = new VEMap('myMap_myMap');

map.LoadMap(new VELatLong(53.278353017531821 , -2.153320312500008), 5 ,'h' ,false);

***** Get the error here when I call LoadMap.

Microsoft JScript runtime error: Sys.InvalidOperationException: Object Microsoft already exists and is not a namespace.

Can anybody please help me to find the problem. V3 of the API still works fine without any problems.

If I remove AJAX references from my page the error goes away. Unfortunately, I make heavy use of MS Ajax 1.0 and can't get around it.

thanks,

SoS



Answer this question

MSAJAX 1.0 conflict with V4 API. Sys.InvalidOperationException. V3 API is fine.

  • jchau

    .NET 2.0 callback is a different beast to MSAjax, formerly known as Atlas.

    http://ajax.asp.net explains it better than me.

    MSAjax is far richer and does shedloads more stuff than Clientcallback, although at present the list of features doesn't seem to include working with VE 4.0



  • ar_pad

    Have you tried moving your map initialization code to an applicatoin load method Like this:

    <%@ Page Language="C#" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


    <script runat="server">

    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
    <title>Virtual Earth v4/ASP.NET AJAX v1.0 Beta 2 Bug</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/v4/mapcontrol.js"></script>

    <script type="text/javascript">
    function LoadMap()
    {
    var map = new VEMap('map');
    map.LoadMap();
    }
    </script>

    </head>
    <body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div id="map" style="position: relative">
    </div>

    <script type="text/xml-script">

    <page xmlns:script="http://schemas.microsoft.com/xml-script/2005">

    <components>

    <application id="application" load="LoadMap" />

    </components>

    </page>

    </script>

    </form>
    </body>
    </html>


  • Dnieto23

    Hi,

    This is how I already initialise my map so I can say that this doesn't work as well. I have reverted back to Atlas until MS can resolve the issues

    thanks,


  • Sam_2

    Im not sure how you guys are getting V3 to work both V3 and V4 are broke for me. I did get it to break in the veapi.ashx somehow on this line: if(typeof registerNamespace!="undefined") registerNamespace("Microsoft.Web.Geometry");

    I sure hope someone at msft looks at this soon... my app depends on it.

    Please help!

    Thanks



  • Dan Lukinykh

    What are you all babbling about I use the .NET 2.0 ClientCallback stuff in my asp.net app with V4 and all works fine.

    MSAJAX whats this



  • ClaudiaHelpOnVSTO

    Hi All,

    I thought it might be helpful to include a very simple reproducible case for this bug. I would really appreciate it if someone from Microsoft could confirm that they are aware of this bug and provide status.

    Thanks a lot,
    Mike

    <%@ Page Language="C#" %>


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <script runat="server">

    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
    <title>Virtual Earth v4/ASP.NET AJAX v1.0 Beta 2 Bug</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/v4/mapcontrol.js"></script>

    <script type="text/javascript">
    function pageLoad()
    {
    var map = new VEMap('map');
    map.LoadMap();
    }
    </script>

    </head>
    <body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div id="map" style="position: relative">
    </div>
    </form>
    </body>
    </html>


  • Blader

    Same for me. VE v4 dies with the same message under MS Ajax Beta 1 /CTP goodies. I reverted back to VE v3 and everything is fine.

    The tricky part is I call a webservice from the clientside to fetch a list of pins and points on polylines, which means I need MSAjax, and can't go to VE 4 until MSAjax coexists happily with it.

    I only noticed this when checking something about 23:00 GMT last night, during the launch of the new API, and everything todo with VE was flakey, so as yet I haven't had the chance to fully check this out.



  • shahrul

    No problems on VE v3 for me, with MSAjax beta 1.0. I'm making quite heavy use of VE and Ajax webservices, for instance here:

    http://www.mtb-routes.co.uk/northyorkmoors/routes/route2.aspx route=10

    so I'd expect to any problem with VE3 to surface.

    Make sure you have refreshed all the scripts, by dumping your browser cache, as at one point VE3 wasn't working, and you may have got 'poisioned' versions of the scripts from that time lurking in your browser cache. The conflicting namespaces problem in VE4 is unfortunate, as until either VE 4 or MSAjax are fixed, it looks like VE4 isn't going to work for quite a few sites which use VE to display complex sets of data. I know MSAjax is still in beta, but you can't help wishing there was a bit more joined up thinking between the VE guys and the MSAjax guys. Both are outstanding 'best of breed' products, but would be even better if they worked together :-(



  • Andy 01264

    I also noticed ASP.NET AJAX Beta 2 is out now as well. Perhaps that will fix the issues

    http://forums.asp.net/thread/1455784.aspx

    Regards



  • neoret

    Scott, did this work for you I just wanted to ask before I went down a potential dead-end; thanks!

  • JayPi

    I was using Beta2 so I guess the same problem exists. I think it's just a problem with the VEAPI registering Microsoft as the root namespace as well as Ajax. Dunno though, bit over my head! :-)

    Hopefully there is a workaround.


  • Tadwick

    I am having the same problem but my V3 doesn't even work. When I remove the <asp:ScriptManager> tags it works fine.

    Thanks.



  • JerryCic

    I'm having the exact same problem. Please help MS! VE and AJAX Enhancements really should work together.

    Kinda sucks. First tried Beta1 and had to revert back to CTP. Now looks like this is the blocking issue for me on Beta2

    Maybe 3rd times a charm =)


  • Dharan Prakash

    Ditto. Still havent found a solution. Maybe Beta 3 will fix it, but I'm back to atlas for now.
  • MSAJAX 1.0 conflict with V4 API. Sys.InvalidOperationException. V3 API is fine.