NAV 2013 .NET variable CAS policy error

TxemaMasTxemaMas Member Posts: 3
edited 2013-11-15 in NAV Three Tier
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!

Answers

  • Jens_M-PJens_M-P Member, Microsoft Employee Posts: 39
    Without knowing the problem in detail it does seem as if this is due to the new CAS policy in .Net 4.5.
    What I would recommend trying is to add the line <NetFx40_LegacySecurityPolicy enabled="true"/> to the exe.config file (Microsoft.Dynamics.Nav.Server.exe.config) usually found in the folder C:\Program Files\Microsoft Dynamics NAV\71\Service.

    From your mail I cannot determine if it is a client side add-in that fails. If so then you need to modify the exe.config file for the client.

    Not sure that this will work - but it is worth trying out.
    Best regards,
    Jens Møller-Pedersen [MSFT]

    This posting is provided 'AS IS' with no warranties, and confers no rights.
  • TxemaMasTxemaMas Member Posts: 3
    Thanks for your answer, 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.
  • Jens_M-PJens_M-P Member, Microsoft Employee Posts: 39
    Yes, we decided to turn on this behavior by default in 2013 R2. This can give problems if an add-in uses the Dynamic Language Runtime in which case the corresponding .config file has to contain the config value = false (or removed).
    We do hope that we got it right in assuming that the chosen default would benefit the majority of partners.

    However, it is likely that the legacy security policy will get discontinued in a later version of .Net - but I have not heard of any plans of that yet.
    Best regards,
    Jens Møller-Pedersen [MSFT]

    This posting is provided 'AS IS' with no warranties, and confers no rights.
Sign In or Register to comment.