Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

NAV 2013 .NET variable CAS policy error

Posted on by 75

Hello,

I'm using the Microsoft POS library but I get this error when I call the constructor of a variable (PosExplorer):

"This method explicitly uses CAS policy, which has been obsoleted by the .NET Framework"

How can I solve this in NAV, I have been searching but I haven't find any solution which fits on NAV 2013.

Thank you!

*This post is locked for comments

  • Suggested answer
    Txema Mas Profile Picture
    Txema Mas 75 on at
    RE: NAV 2013 .NET variable CAS policy error

    Thanks! I tested it and it works!

    I noticed that in both  config files (client and server) of NAV 2013 R2 it comes activated by default . In previous versions that code line doesn't exists.

  • Verified answer
    Roberto Stefanetti Profile Picture
    Roberto Stefanetti 12,998 on at
    RE: NAV 2013 .NET variable CAS policy error

    hi,

    to bypass (if possible), try to fix .NET configuration checks adding "NetFx40_LegacySecurityPolicy " parameter (with visual studio works fine)

    On Nav server config file or on client config file (for server ord client addins) try to add this line:

    Microsoft.Dynamics.NAV.Server.exe.config file:

    <NetFx40_LegacySecurityPolicy enabled="true"/>

    if doesn't works try to add parameter only to runtime execution

    <runtime>

    <NetFx40_LegacySecurityPolicy enabled="true"/>

    </runtime>

    ....

    For example in past (Nav 2000) i added "Garbage collection" configuration on NAV passing standard .net "gcServer configuration" parameter (this is an undocumented feature but works fine if added and speed up nav servers)

    Microsoft.Dynamics.NAV.Server.exe.config file:

    <configuration>

    <runtime>

    <gcServer enabled="true"/>

    </runtime>

    </configuration>

    let me know if works.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans