locked
There is one problem that I encountered by following the pos RRS feed

  • Question

  • There is one problem that I encountered by following the post. I was dynamically detecting for UniversalApiContract v4. However, when the code was running on .NET 4.5 classic desktop app (manifested for Windows 10 Runtime), there was an exception about “Windows Runtime-type XXXXX is not found”.

    Turned out that the when inlining the contract-specific call in the IF that checks for contract presence, then it will throw exception.

    So, the following is WRONG:
    public void DoContractSpecificStuff()
    {
    if(ApiInformation.IsApiContractPresent(“Windows.Foundation.UniversalApiContract”, 4))
    {
    GattCharacteristicsResult gatt = … Do some v4 stuff with GattCharacteristicsResult
    }
    else
    { /* Do <v4 stuff*/ }
    }

    It needs to be coded in the following way instead:
    public void DoContractSpecificStuff()
    {
    if(ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 4))
    {
    DoContractV4Call();
    }
    else
    { /* Do <v4 stuff*/ }
    }

    public void DoContractV4Call()
    {
    GattCharacteristicsResult using code goes here
    }

    • Moved by Just Karl Thursday, December 28, 2017 2:57 PM Looking for the correct forum
    Tuesday, November 21, 2017 10:37 PM

Answers

All replies

  • Hello,

    The MSDN, TechNet and Expression Library Feedback forum is to "Help improve the Library Experience in MSDN, TechNet and Expression by providing feedback on features, bugs, look and feel or by just providing suggestions". This is not a support forum.

    As it's off-topic here, I am moving the question to the Where is the forum for... forum.

    Karl

    Thursday, December 28, 2017 2:43 PM
  • Hello,

    Please ask in the proper language forum in the Visual Studio Languages forums on MSDN.

    Karl

    Thursday, December 28, 2017 2:49 PM