locked
Dynamic Objects in Windows Store App VB RRS feed

  • Question

  • Hi,

    According to MSDN and posts in this forum, Dynamic objects are supported in Windows Store Apps. I am using the Live SDK, which uses a DynamicDictionary for the results and when I use this in VB, I get the following error:

    The API 'Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGetInvokeDefault(System.Object, System.Object[], System.String[], Boolean)' cannot be used on the current platform. See http://go.microsoft.com/fwlink/?LinkId=248273for more information.

    Any ideas why this is happening? This happens when you try to access the dynamic property, but all documentation seems to point to this being a supported scenario.

    Rgds,

    Anand


    Regards, Anand Mukundan http://www.dotnetindia.com

    Tuesday, February 12, 2013 5:08 PM

Answers

All replies

  • The Microsoft.VisualBasic API is not available for Store apps.  That's about it.  You might want to ask this question on the Live SDK forums as they will have more insight into using that SDK.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.


    Wednesday, February 13, 2013 8:10 PM
    Moderator
  • Thanks Matt. I understand that, but the documentation for Windows Store Apps in MSDN does say that System.Dynamics is supported and the way VB seems to have implemented Dynamics seem to call Microsoft.VisualBasic API.

    Both the forum posts (even in this forum,http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/bce9e63b-43d8-44e3-9175-199c8b9e2edc) and MSDN documentation says Dynamic objects are supported in Windows Store and nowhere does it say (at least from what I can find) only dynamics in C# is supported.

    Also according to the API documentation at http://msdn.microsoft.com/en-us/library/windows/apps/hh454060.aspx 'Microsoft.VisualBasic.CompilerServices.NewLateBinding' is supported in Windows Store Apps

    Even without Live SDK, the following code still fails for me with the same error (at the access location in Line 3):

     
            Dim x As Object = New Dynamic.ExpandoObject
            x.test = "abc"
            Debug.WriteLine(x.test)

    I am not sure if I am doing this wrong or the documentation is wrong.

    Rgds,

    Anand


    Regards, Anand Mukundan http://www.dotnetindia.com


    • Edited by AnandMVP Thursday, February 14, 2013 11:13 AM
    Thursday, February 14, 2013 11:08 AM
  • Hi Anand,

    Parts of Microsoft.VisualBasic.CompilerServices.NewLateBinding are supported in Windows Store apps, but the LateCallInvokeDefault method is not. If you look at the class documentation you will see a green shopping bag icon to indicate which methods are available to Windows Store apps, or look for the .Net for Windows Store apps section in the method documentation.

    I'm not familiar enough with the Dynamic objects API in VB to know exactly what types of access call LateCallInvokeDefault, except that the specific ones that you use here do and so those code patterns cannot be used in Windows Store apps.

    --Rob

    Thursday, February 14, 2013 11:44 PM
    Moderator
  • Hi All,

    I had posted a related post in the Windows Store Apps forum too (http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/9e70f264-e0d8-45a3-bc08-9cfdb6be5fd4/#2b8fe2d4-c380-4190-98aa-8163c0fe3da4), but this seems to be VB only problem.

    The below code

    Dim x As Object = New Dynamic.ExpandoObject
    Dim y As String
    x.test = "abc"
    y = x.test

    will work fine on a normal console app, but will result in the following error in Windows Store App.

    The API 'Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGetInvokeDefault(System.Object, System.Object[], System.String[], Boolean)' cannot be used on the current platform. See http://go.microsoft.com/fwlink/?LinkId=248273for more information.

    The MSDN documentation does say that LateGetInvokeDefault is not implemented in WinRT, but this seems to be internally called when 3rd line above is executed.

    But the below code equivalent in C# will run fine in Windows Store Apps.

    dynamic x = new System.Dynamic.ExpandoObject();
    string y;
    x.test = "abc";
    y = x.test;

    So this seems to be a problem specific to how VB implements Dynamics in WinRT.

    Rgds,

    Anand


    Regards, Anand Mukundan http://www.dotnetindia.com

    • Merged by Mike Feng Tuesday, February 26, 2013 3:34 PM duplicate
    Saturday, February 23, 2013 7:09 AM
  • Anand,

    The counterpart of the Dynamic in C# is Option Strict Off in top of your code.

    With that I don't say it goes.

    Dynamic is created in C# to make C# more equal in possibilities (I forgot the word for now) with VB. But as it is always in the program languages, new things are not always done in the same version. So maybe there are now added some things to the Dynamic keyword which is not yet solved with Option Strict Off.


    Success
    Cor

    Saturday, February 23, 2013 9:34 AM
  • Hi Cor,

    From what I can see Dynamic is the same as late binding in old VB. But now that Dynamic is part of the base .NET framework, some of the other SDKs have started using that. The problem I have is that the way this is implemented seems to stop VB from using Dynamic in Windows Store Apps, while C# seems to be able to do this fine..

    Rgds,

    Anand


    Regards, Anand Mukundan http://www.dotnetindia.com

    Sunday, February 24, 2013 1:50 PM