Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Error Function SrsPrintDestinationTokens::constructByTokenType has been incorrectly called when open any report

(0) ShareShare
ReportReport
Posted on by 85

Hello all,

I have Microsoft Dynamics AX 2012 R3 (3 tiers servers)

Suddenly the entire system and for all users get the following message when trying to run any report:

Function SrsPrintDestinationTokens::constructByTokenType has been incorrectly called.

I've tried:

1. Restart all servers.

2. Synchronize Database.

3. Full CIL Compile the application.

But nothing changes, Any idea?

  • CR-18091344-0 Profile Picture
    2 on at
    Error Function SrsPrintDestinationTokens::constructByTokenType has been incorrectly called when open any report
    Hi Ahmed,
     
    do you found a solution finally?
     
    thanks
  • Ahmed Awwad Profile Picture
    85 on at
    RE: Error Function SrsPrintDestinationTokens::constructByTokenType has been incorrectly called when open any report

    DAnny3211 

    Unfortunately, The link doesn't have a solution for this problem while in my case all reports stopped working.

  • Ahmed Awwad Profile Picture
    85 on at
    RE: Error Function SrsPrintDestinationTokens::constructByTokenType has been incorrectly called when open any report

    goshoom 

    I agree with but I still don't know why it's not instantiating.

  • Suggested answer
    DAnny3211 Profile Picture
    9,274 Moderator on at
    RE: Error Function SrsPrintDestinationTokens::constructByTokenType has been incorrectly called when open any report

    hi

    look this

    social.msdn.microsoft.com/.../function-srsprintdestinationtokensconstructbytokentype-has-been-incorrectly-called

    DAniele

  • Martin Dráb Profile Picture
    231,975 Most Valuable Professional on at
    RE: Error Function SrsPrintDestinationTokens::constructByTokenType has been incorrectly called when open any report

    If no instance can be created for the given token type, there is nothing to be inserted to the cache and there you can't retrieve anything from there. Therefore the cache is not important here; the object creation is.

  • Ahmed Awwad Profile Picture
    85 on at
    RE: Error Function SrsPrintDestinationTokens::constructByTokenType has been incorrectly called when open any report

    First, Thanks for your reply

    I've compiled the application using the

    axbuild.exe xppcompileall /s=01 /altbin="C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin"

    but still the same problem.

    I have an old backup of the system 2 days ago where the problem wasn't exists, After some debugging I've noticed that in method: SysExtensionAppClassFactory.getClassFromSysAttribute

    which have:

    searchStrategy = SysExtAppClassSearchStratDepth::newForCacheKey(_baseClassName, attributeInstance.parmCacheKey());
    cachedResult = searchStrategy.search();

    The cachedResult  in the backup version returns Size: 1 but in the live server returns Size: 0 which cause the problem

    Another way to solve the problem is changing in class: SrsPrintDestinationTokens.constructByTokenType

    if I changed the _tokenType from Worker to be None the reports working normally and the cachedResult in SysExtensionAppClassFactory.getClassFromSysAttribute return Size:1 but what about the consequences:

    SrsPrintDestinationTokensExtAttribute extensionAttribute = new SrsPrintDestinationTokensExtAttribute(_tokenType);
    SrsPrintDestinationTokens destTokens = SysExtensionAppClassFactory::getClassFromSysAttribute(classStr(SrsPrintDestinationTokens), extensionAttribute);

    I still cannot figure out the reason.

    Any idea?

  • Martin Dráb Profile Picture
    231,975 Most Valuable Professional on at
    RE: Error Function SrsPrintDestinationTokens::constructByTokenType has been incorrectly called when open any report

    It means that it's called with a token type that isn't supported by the system.

    If you can't find any problem when reviewing configuration, the debugger can tell you which token type is to blame.

    By the way, if you suspect that the environment wasn't deployed correctly and recompilation is needed (which shouldn't be the case in production), compiling CIL alone isn't sufficient. CIL compilation depends on results of X++ compilation, therefore you must compile X++ before CIL. The environment needs to be off and only one AOS active. The recommended approach is doing compilation in a pre-live system and than deploying the whole modelstore.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,276 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,975 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans