none
A SQL Server warning in c# program RRS feed

  • Question

  • I have this C# program where Sql Server (Developer) is used all the time. On debug I got 46 warnings, no file name or line number, just warnings:

    Severity    Code    Description    Project    File    Line    Suppression State
    Warning        Reference 'Microsoft.SqlServer.Diagnostics.Strace' does not allow partially trusted callers.          

    What is this?

    Thanks, - MyCatAlex


    • Edited by MyCatAlex Sunday, September 23, 2018 5:55 PM
    Sunday, September 23, 2018 5:52 PM

All replies

  • Hi there,

    It looks like you're using a strong named assembly. 

    you can try the [assembly:AllowPartiallyTrustedCallers] attribute 

    https://docs.microsoft.com/en-us/sql/reporting-services/custom-assemblies/using-strong-named-custom-assemblies?view=sql-server-2017



    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Cherkaoui.Mouad Monday, September 24, 2018 11:52 AM
    Sunday, September 23, 2018 8:13 PM
  • It asks for a namespace, it seems. I tried using System.Configuration.Assemblies, it still gives me a compile error. That was when I placed it in AssemblyInfo.cs. When I placed it into Form1.Designer.cs it said it was a bad place and the statement will be ignored.

    Another question. I have an xml file: RunAsAdministrator.manifest and it still asks me for the administrator password. Why?

    - MyCatAlex


    • Edited by MyCatAlex Sunday, September 23, 2018 11:42 PM
    Sunday, September 23, 2018 11:41 PM
  • Hi MyCatAlex,

    About your error message, you can click on the assembly set the permission to unrestricted, or you can take refer to the laurens' s opinion, the rebuild your project.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/19ef2efb-c447-405b-a5b2-5255e866f9fa/that-assembly-does-not-allow-partially-trusted-callers?forum=csharpgeneral

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Cherkaoui.Mouad Monday, September 24, 2018 11:52 AM
    Monday, September 24, 2018 5:26 AM