locked
Windows phone 8.1 Cannot find type System.SystemException inmodule mscorlib.dll when using Microsoft.Phone.dll

    Question

  • I want to get my devices information

    • Manufacturer
    • Name
    • OS information

    Info along those lines

    How do I do this?

    I've been trying to use Microsoft.Phone.dll found in:

    C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\WindowsPhoneApp\v8.1\

    but that gives the error "cannot find type system.systemexception in module mscorlib.dll"

    The above was tested using Visual Studio express 2013 for Windows.

    I've tried using Visual Studio 2012 with a Windows Phone 8.0 project and I don't get the error.

    Any help will be greatly appreciated.

    Sunday, November 09, 2014 7:45 PM

Answers

  • Hi Aaron,

    Microsoft.Phone.dll is available for windows phone 8 or windows phone 8.1 silverlight project. It’s not available for runtime project. You will need to find some appropriate class to get the device information for silverlight project and runtime project.

    For silverlight project.

    var version = System.Environment.OSVersion;
    string modelname = null;
                object modelobject = null;
                if (Microsoft.Phone.Info.DeviceExtendedProperties.TryGetValue("DeviceName", out modelobject))
                    modelname = modelobject as string;
                string ManufacturerName = "";
                object manufacturerobject;
                if (DeviceExtendedProperties.TryGetValue("DeviceManufacturer", out manufacturerobject))
                    ManufacturerName = manufacturerobject.ToString();
                MessageBox.Show("Device Name = " + modelname + " Manufacturer = " + ManufacturerName);
    

    For runtime project.

    EasClientDeviceInformation deviceInfo = new EasClientDeviceInformation();

    If you still have questions, please feel free to let me know.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Monday, November 10, 2014 7:18 AM
    Moderator