BC22 OnPrem .net6 Dictionary issue

xdimidrolxxdimidrolx Member Posts: 6
Hi all,

Having an issue with our solution with BC22 specifically .net lib "System.Collections.Generic.Dictionary`2"

Based on the information provided in the article https://demiliani.com/2023/03/21/dynamics-365-business-central-and-net-6/ , it has come to our attention that Business Central version 22 (BC22) brings about significant changes related to the .NET framework. Consequently, we made adjustments on our end by updating the "al.assemblyProbingPaths" to accommodate .NET6.

However, we encountered an issue during compilation that is consistent with the problem we faced during the compiling process. The error message and details are shown in the following image:
image 268221769-4477bd62-ec87-4489-88da-b22cca5112a2.png

"message": "The call is ambiguous between the method 'Dictionary(DotNet \"System.Collections.Generic.IDictionary<System.Object, System.Object>\")' defined in DotNet 'System.Collections.Generic.Dictionary<System.Object, System.Object>' by the extension '123' and the method 'Dictionary(DotNet \"System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.Object, System.Object>>\")' defined in DotNet 'System.Collections.Generic.Dictionary<System.Object, System.Object>' by the extension '123'

Does anyone encounter such or similar issues? How possible to avoid the ambiguous call?
Please advise on this matter.


  • dreezdreez Member Posts: 65

    In your case you probably don't need to specify any parameter for the constructor, as I don't believe that you want to copy "gDNe_DataColumns" dictionary values to (the same) "gDNe_DataColumns" dictionary variable.

    You should be fine, when you just simply do:
    gDNe_DataColumns := gDNe_DataColumns.Dictionary();

    Then you don't have ambiguous calls.

    Just out of curiosity, why don't you just use the standard AL Dictionary variable such as:
    local procedure DictionaryTest()
        MyDictionary: Dictionary of [Text, Text];
        MyDictionary.Add('x', 'y');

Sign In or Register to comment.