Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5954355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:57:33+00:00 2026-05-22T17:57:33+00:00

I’m running into an issue where calls made from a GAC-ed assembly with the

  • 0

I’m running into an issue where calls made from a GAC-ed assembly with the AllowPartiallyTrustedCallers attribute to another GAC-ed assembly without that attribute made in a partial-trust environment succeed if made directly, but fail if made via reflection.

Assemblies involved:

  • AssemblyA (installed in GAC, does not have AllowPartiallyTrustedCallers, cannot be modified)
  • AssemblyB (installed in GAC, does have AllowPartiallyTrustedCallers, cannot be modified)
  • AssemblyC (installed in GAC, does have AllowPartiallyTrustedCallers, can be modified)
  • AssemblyD (signed, but not installed in GAC, does have AllowPartiallyTrustedCallers, can be modified).

I need to call code in AssemblyA from AssemblyD both directly and indirectly. For the direct calls, I just moved them from AssemblyD into AssemblyC and everything works. For the indirect calls, I need to call a method in AssemblyB that will internally use Reflection to create an use an instance of a class in AssemblyA. I can make the call to AssemblyB directly from AssemblyD or indirectly via AssemblyC – either would be acceptable, but neither is working for me.

The direct calls work great. The calls that use reflection fail if there is any partially-trusted code on the call stack. I can’t avoid the reflection calls AssemblyB is doing – it’s doing a lot of other work for me before it makes those calls – work that I can’t duplicate in AssemblyC and just make the calls direct.

I’ve uploaded a project demonstrating this to BitBucket: https://bitbucket.org/jorupp/partialtrusttest. Based on my understanding of partial-trust, all 4 should work (calling A directly from B or C and calling A via reflection from B or C), but the reflection-based calls are failing.

I’m guessing I need to be asserting some CAS permission or the like in my code in AssemblyC to get this working, but I can’t figure out what.

Note: the names in my scenario is obviously contrived, but the real-world scenario is a Sharepoint application, where AssemblyA is Microsoft.Sharepoint.Taxonomy, AssemblyB is Microsoft.Sharepoint, AssemblyC is my custom GAC-ed assembly, and AssemblyD is my custom webapp-deployed assembly. As near as I can tell, this is not a Sharepoint-specific problem.

Thanks in advance for any ideas or help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:57:34+00:00Added an answer on May 22, 2026 at 5:57 pm

    And after I spent an hour writing up the repro case and the question explaining it, I stumbled on a solution (though I’m not sure it’s the right one):

    I was trying to use code like this (in AssemblyC)

    public void UseClassBToCreateClassAViaReflection()
    {
        new SecurityPermission(PermissionState.Unrestricted).Assert();
        ClassB.CreateClassAViaReflection();
    }
    

    Which wasn’t working. This however, does:

    [PermissionSet(SecurityAction.Assert, Name = "FullTrust")]
    public void UseClassBToCreateClassAViaReflection()
    {
        ClassB.CreateClassAViaReflection();
    }
    

    I still don’t fully get CAS, but at least this gets me past my first issue and on to my the next one. I don’t think I’m creating a massive security whole here, but I’m not quite sure…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.