Inheritance security rules violated by type: Microsoft.Dynamics.Nav

If you get the following error:

Unhandled Exception: System.TypeLoadException: Inheritance security rules violated by type: 'Microsoft.Dynamics.Nav.WindowsServices.NavServerWindowsService'. Derived types must either match the security accessibility of the base type or be less accessible.
   at Microsoft.Dynamics.Nav.WindowsServices.DynamicsNavServer.Main(String[] args)

Then you have properly (as I did) updated your service tier with files from a zip file, that Windows Server 2012 have decided that are unsafe and need to be blocked. I got the error after a quick update of Microsoft Dynamics NAV 2017 to CU4.

The solution is easy, fire up PowerShell, and run the following command in the folders where you copied files:

dir -Recurse | Unblock-File

Then everything should work again 🙂

MediaSet fields in Queries..

When designing queries in Dynamics NAV you’ll get an error i CSide if you include a BLOB field, but no error if you include a MediaSet field. At runtime, you’ll get this strange error:

Unable to compare operands of type NSMediaSetWrapper with NavMediaDescriptionCollection.

Remove your MediaSet field from the Query Object and everything works again.

Att Microsoft: Perhaps expand the BLOB check in FINSQL.EXE to include MediaSet fields also 🙂

Blog entry to serve as hit for googling this error

February Microsoft Dynamics NAV CUs are out

Grap ’em while there are hot 🙂

Also, important to notice, if you by any change installed the pulled NAV2016 CU15 or NAV2017 CU2 before they got pulled, please upgrade to either CU15.1/CU2.1 or better yet, this months release.

An adventure in Microsoft Dynamics NAV, .NET and other technologies