Type matching DotNet argument

Please see the code below.

.Net expect List<BCLibrary.Contact>, but I am not sure how to specify it in AL. As you see in the error, currently it is System.Object

Any help appreciated. Thanks


  type(BCLibrary.BCRouteManager; BCRouteManager) { }
  type(BCLibrary.Contact; Contact) { }
  type(BCLibrary.UploadContactResponse; UploadResponse) { }

// assembly(mscorlib)
// {
// type("System.Collections.Generic.List`1"; "List_Of_T") { }
// }

codeunit 50100 WrapperCodeunit
  procedure UploadContacts(Contacts: Record Customer)
   BCRouteManager: DotNet BCRouteManager;
   Customer: Record Customer;
   ContactL: DotNet Contact;
   ListL: DotNet List_Of_T;
   Response: DotNet UploadResponse;

    BCRouteManager := BCRouteManager.BCRouteManager();

    CreateContact(0, customer.Name, customer.Address, ContactL);

    Response := BCRouteManager.UploadContact('TODO', ListL) //TODO:
    // ListL --> Argument 2: cannot convert from 'DotNet 
    // "System.Collections.Generic.List<System.Object>"' to 'DotNet 
    // "System.Collections.Generic.List<BCLibrary.Contact>"

  1. Have you tried adding the Version, Culture and PublicKeyToken in the assembly?
    Not sure if that will help you. See the post below.

  2. Try to initialize every type like you did with BCRouteManager.

  3. Can you replace the dotnet list with the list standard variable ?

Here is a simple use of dotnets that might help: