AL icon indicating copy to clipboard operation
AL copied to clipboard

cannot convert from 'UserControl Chart: "Microsoft.Dynamics.Nav.Client.BusinessChart"' to '__MissingTypeSymbol__

Open jimmymcp opened this issue 8 years ago • 18 comments

Page/Pag70086946.CleverCreditStatEntriesTMN.al(150,40): error AL0133: Argument 1: cannot convert from 'UserControl Chart: "Microsoft.Dynamics.Nav.Client.BusinessChart"' to 'MissingTypeSymbol'

AL Language version 0.17.30289 Latest bcinsider build (as of today)

My project compiles, but I get the above error attempting to publish the app to the server.

jimmymcp avatar Aug 22 '18 14:08 jimmymcp

Hi @jimmymcp ! Could you open the settings of your workspace and specify the "al.assemblyProbingPaths"? 'al.assemblyProbingPaths':[{PathToAddInsFolder}]

atoader avatar Aug 27 '18 08:08 atoader

Hi @atoader Working on this with jimmymcp, I've set the assembly probing path as

"al.assemblyProbingPaths": [
        "./.netpackages",
        "C:/Program Files/Microsoft Dynamics NAV/130/Service/Add-ins"
    ] 

which does have the BusinessChartBuffer folder inside. Still coming across the same error when publishing, but we can build the app. We do get the following as suggestions:

image

Have the target in the app.json set to Extension.

nmahate avatar Aug 30 '18 09:08 nmahate

Hi @atoader, I'm getting this error when publishing as well. Running AL Language 2.0.41872 and bcsandbox-master from yesterday.

The app builds just fine, but we get the error when VS Code tries to publish the app. So the error comes from the NAV Server, not from AL compiler as it seems.

Do you have a more specific sample on how the al.assemblyProbingPaths should be set? We've tried with local paths in the project (after copying the BusinessChart folder from the server) and remote paths (on the server), but no luck.

jwikman avatar Sep 04 '18 09:09 jwikman

@StanislawStempin According to #3423, this was a bug that should have been resolved and shipped. What am I missing? :)

jwikman avatar Sep 04 '18 09:09 jwikman

3423 is this bug, which one did you mean to point to?

StanislawStempin avatar Sep 04 '18 15:09 StanislawStempin

@StanislawStempin Auch, sorry! I meant to point to #2477

jwikman avatar Sep 04 '18 15:09 jwikman

Hi! It looks like you are trying to pass a BussinessChart user control to a procedure taking the backing .NET type. Could you please confirm that this is the issue? Can you post the snippet of code where the issue is located?

atoader avatar Sep 04 '18 16:09 atoader

Hi @atoader !

Thanks for the hint! I thought it was the UserControl that was the issue, but it was a call to the Update function of the "Business Chart Buffer" table, where we pass the user control as a parameter, that caused this error.

This is old converted code, that have been working just fine in C/AL for some time. Both in Web Client and WinClient.

First we have the usercontrol:

usercontrol(Chart; "Microsoft.Dynamics.Nav.Client.BusinessChart") 
{
    trigger AddInReady()
    begin
        gChartIsReady := true;
        UpdateChart(false);
    end;
}

And then some al to that:

var
    gBusChartBuf: Record "Business Chart Buffer";
    gChartIsReady: Boolean;

local procedure UpdateChart(pShowValues: Boolean);
begin
    if not gChartIsReady then
        exit;
    InitChartData(gBusChartBuf);
    gBusChartBuf.Update(CurrPage.Chart);
end;

If I remove the line "gBusChartBuf.Update(CurrPage.Chart);", the app can be published. But with that line present, I get the error:

error AL0133: Argument 1: cannot convert from 'UserControl Chart: "Microsoft.Dynamics.Nav.Client.BusinessChart"' to '__MissingTypeSymbol__'

How should we use this Business Chart if this call is not possible? Is this a bug?

jwikman avatar Sep 04 '18 19:09 jwikman

Hi @jwikman !

Can you try to compile this sample?

// Welcome to your new AL extension.
// Remember that object names and IDs should be unique across all extensions.
// AL snippets start with t*, like tpageext - give them a try and happy coding!

page 50100 MyPage
{
    PageType = Card;
    ApplicationArea = All;
    UsageCategory = Administration;

    layout
    {
        area(Content)
        {
            group(GroupName)
            {
                usercontrol(Chart; "Microsoft.Dynamics.Nav.Client.BusinessChart")
                {
                    trigger AddInReady()
                    begin
                        gChartIsReady := true;
                        UpdateChart(false);
                    end;
                }
            }
        }
    }

    var
        gBusChartBuf: Record "Business Chart Buffer";
        gChartIsReady: Boolean;

    local procedure UpdateChart(pShowValues: Boolean);
    begin
        if not gChartIsReady then
            exit;
        // InitChartData(gBusChartBuf);
        gBusChartBuf.Update(CurrPage.Chart);
    end;
}

I took the code you posted and put it on a page.

atoader avatar Sep 04 '18 20:09 atoader

@atoader , thanks for your fast reply.

Tried your page, and receives the very same error:

[2018-09-04 22:22:44.51] The request for path /NAV/dev/apps?SchemaUpdateMode=recreate failed with code 422. Reason: Extension compilation failed
HelloWorld.al(38,29): error AL0133: Argument 1: cannot convert from 'UserControl Chart: "Microsoft.Dynamics.Nav.Client.BusinessChart"' to '__MissingTypeSymbol_

Line 38: gBusChartBuf.Update(CurrPage.Chart);

So it seems at we've got a small repro for this issue :)

jwikman avatar Sep 04 '18 20:09 jwikman

I installed NAV from the latest release build, configured the development environment and published and it worked. Are you using C/SIDE with generatesymbols ?

atoader avatar Sep 04 '18 20:09 atoader

@jwikman could you post the exact steps you followed to set up your environment?

atoader avatar Sep 04 '18 20:09 atoader

I created an Azure VM with Docker yesterday through http://aka.ms/bcdeveloperpreviewext using bcinsider.azurecr.io/bcsandbox-master:se as the docker image. Let me know if you need more details

I just noticed that the C/SIDE shortcut that was created on the desktop had the parameter generatesymbolreference=1 set. I have not changed anything in C/AL, but I've been running C/SIDE.

jwikman avatar Sep 04 '18 20:09 jwikman

Thanks! I will try to repro this first thing in the morning. I think this is the source of a few of the issues we've been seeing.

atoader avatar Sep 04 '18 20:09 atoader

Great, looking forward to your results!

jwikman avatar Sep 04 '18 20:09 jwikman

This should be fixed and available in the daily drops.

atoader avatar Sep 11 '18 14:09 atoader

Thanks @atoader,

I can confirm that this works for me on NAV Version: 13.0.24284.0-SE

Unfortuanately it didn't make it into RC1 (there the same error occured, but now while compiling), so I hope we'll see a RC2 with this fix soon.

jwikman avatar Sep 14 '18 14:09 jwikman

Hi @atoader, I just installed RC3, but it still doesn't work there. runtime 13.0.24535 vsix 2.0.43900, Microsoft_Application_13.0.24573.0 Microsoft_System_13.0.12929.0

So I assume that this fix didn't make it into BC Fall '18 release? (build numbers are greater than where I saw the fix in MASTER branch) When can we expect this fix to be available in bcinsider.azurecr.io/bcsandbox?

I also assume that the issue right now is only in the vsix file, since I get the error as a problem in VS Code: "Argument 1: cannot convert from 'UserControl Chart: "Microsoft.Dynamics.Nav.Client.BusinessChart"' to 'MissingTypeSymbol" But I guess that it's a bad idea to use the vsix from MASTER... ;)

jwikman avatar Sep 19 '18 14:09 jwikman