locked
Geolocator.GetGeopositionAsync throw "Class not registered" exception RRS feed

  • Question

  • Hello!

    I run next code in blank project and got "Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))"

    private Windows.Devices.Geolocation.Geolocator locator = new Windows.Devices.Geolocation.Geolocator();
    
            private async void Button_Click(object sender, RoutedEventArgs e)
            {
                try
                {
                    var position = await this.locator.GetGeopositionAsync();
                }
                catch (Exception ex)
                {
                    //Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
                }
            }

    Also, I tried to run Geolocation Sample 8.1 but got the same exception and I tried to run this sample not on 1 PC and not on 1 network. All the same.

    I have win8.1 rtm and VS2013 RC.

    Tuesday, October 1, 2013 7:00 AM

Answers

  • Hello Oleg, Gary, all

    This behaviour is indeed specific to the “N” editions.  For geolocation to work on N-editions of Windows, the Microsoft Media Feature Pack needs to be installed.

    Geolocation has a dependency on WPD (Windows Portable Devices) infrastructure which is not present in N editions until the feature pack is installed.

    This article about the feature pack for Windows 8 may be useful. The documentation for 8.1 should be available soon and will address the dependence on WPD of geolocation.

    Thanks

    Doug

    Friday, October 11, 2013 8:45 PM
    Moderator

All replies

  • Okay. I found ARM 8.1 Pro preview (with GNSS module) device and test sample on it. I didn't get this exception and all works fine. So I think its only occured on PC/Simulator.

    How to test GeoLocation app on PC/Simulator?

    UPD:

    5 min ago I tested Geolocation Sample 8.1 app on tablet( i5-3317U Processor and without GPS module) with 8.1 rtm and its work fine. I dont understand why it's dont work on notebook with wifi connection and PC with ethernet connection.


    • Edited by Oleg Kurzov Tuesday, October 1, 2013 10:13 AM
    Tuesday, October 1, 2013 9:22 AM
  • up. o/
    Wednesday, October 2, 2013 8:21 AM
  • up. \o
    Thursday, October 3, 2013 5:03 AM
  • up. \o/
    Thursday, October 3, 2013 6:09 PM
  • Tried to run JS geolocation sample. It's don't work (microsoft.winjs.2.0.preview is missing). I delete this lib from references and got some unhandled exceptions. Next, I take some code from this sample and got similar with c# exception:

    WinRTError: Class not registered
    
       at getResultsOfAsyncOp (Function code:338:5)
       at completed (Function code:427:21)

    How I know, JS/html5 use different geolocation API (W3C Geolocation), that we use in c#/xaml.

    Here are JS code:

     var geolocator = new Windows.Devices.Geolocation.Geolocator();
                var promise = geolocator.getGeopositionAsync();
                promise.done(GetPosition, errorPosition);
    
    //...
    
    function GetPosition(pos)
        {
             //this method never invoke.           
        }
    
        function errorPosition(err) {
           //class not registered
        }

    Thursday, October 3, 2013 8:26 PM
  • Tested this code on 8.0 - work fine.

    So this code work fine in 8.0, but not in 8.1. Microsoft, need your help. I think I need to add some library, but don't know where.

    • Marked as answer by Oleg Kurzov Friday, October 4, 2013 7:32 AM
    • Unmarked as answer by Oleg Kurzov Friday, October 4, 2013 8:08 AM
    • Edited by Oleg Kurzov Friday, October 4, 2013 8:09 AM
    Friday, October 4, 2013 7:32 AM
  • I found where is problem.

    I have Pro N version of win 8.1. In Pro N this code throw exception.

    On Enterprise and Pro versions all work fine.

    Friday, October 4, 2013 8:44 AM
  • I have 8.1 Enterprise N edition and i'm getting this error. How do I resolve it?
    Monday, October 7, 2013 3:16 PM
  • Hello! I don't know. But in my Pro "N" bug still reproduce, in your Enterprice "N" too. So maybe it's N issue? But How I know, N versions have difference only in media programs.

    Could anyone test this code on other N versions?

    • Edited by Oleg Kurzov Friday, October 11, 2013 6:59 AM
    Friday, October 11, 2013 6:59 AM
  • Hello Oleg, Gary, all

    This behaviour is indeed specific to the “N” editions.  For geolocation to work on N-editions of Windows, the Microsoft Media Feature Pack needs to be installed.

    Geolocation has a dependency on WPD (Windows Portable Devices) infrastructure which is not present in N editions until the feature pack is installed.

    This article about the feature pack for Windows 8 may be useful. The documentation for 8.1 should be available soon and will address the dependence on WPD of geolocation.

    Thanks

    Doug

    Friday, October 11, 2013 8:45 PM
    Moderator