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 7401677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:32:13+00:00 2026-05-29T04:32:13+00:00

Can you create a .NET 4 version of your app for testing was the

  • 0

Can you create a .NET 4 version of your app for testing was the bosses’ innocent question – sure!

But after I changed our 27 projects in our Winforms application to .NET 4, and recompiled, when launching the app, I get

System.TypeLoadException was unhandled
Message=Inheritance security rules violated while overriding member:
‘MyCustomORM.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)’.
Security accessibility of the overriding method must match the security accessibility of the method being overriden.

Hmmm…..

MyCustomORM does indeed implement the ISerializable interface and thus has this method

[Serializable]
public abstract class MyCustomORM: IMyCustomORM, ISerializable, ICloneable, ISecurable
{
    public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
    {
        // do stuff here.......
    }
}

and I also have two classes that derive from Exception that override the GetObjectData method.

But what could be wrong here?? Googling around I found some additional attributes to stick onto my method and namespace – so I did:

[assembly: SecurityPermission(SecurityAction.RequestMinimum, Execution = true)]
namespace MyApplication.ORM
{
  [Serializable]
  public abstract class MyCustomORM: IMyCustomORM, ISerializable, ICloneable, ISecurable
  {
      [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
      public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
      {
          // do stuff here.......
      }
  }
}

but that doesn’t change anything…..

The exception happens even before my first line of code in my static Main() method is reached….

I’ve combed through the project and removed any references to old .NET 1.1 libraries (yes, the app is that old…..) and replaced them with their .NET 4 counterparts (mostly log4net). Still no luck….

Any ideas??

  • 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-29T04:32:14+00:00Added an answer on May 29, 2026 at 4:32 am

    Is the assembly in which the MyCustomORM class resides marked with SecurityTransparentAttribute? If so, the problem stems from changes in the security transparency model between .NET 3.5 and .NET 4.0. For your testing scenario, you may wish to simply opt into using the older transparency mechanism. To do so, add the following assembly-level attribute:

    [assembly: SecurityRules(SecurityRuleSet.Level1)]
    

    For more information on the differences between the Level1 and Level2 transparency models, see http://blogs.msdn.com/b/shawnfa/archive/2009/11/12/differences-between-the-security-rule-sets.aspx.

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

Sidebar

Related Questions

I'm fairly sure you can create screensavers with.NET but are there any tutorials on
I can create new Silverlight App with .NET RIA Services enabled. But when I
how can create a windows move maker like application in vb.net.... if we want
I want to know if I can create a WebBrowser through code in Vb.NET,
When I start a new ASP.NET project in Visual Studio, I can create an
How can I create a custom property for my .Net assembly which would then
How can I create a local user account using .NET 2.0 and c# and
How can I create a circular buffer on the heap in VB.NET ? This
The goal: To create a .NET dll i can reference from inside SQL Server
Using WPF .NET 4.0 in VS2010 RTM: I can't create a fullscreen WPF popup.

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.