Weird override problem with Fluent NHibernate and .NET 4 (via StackOverflow)

707 views
Skip to first unread message

Mohamed Meligy

unread,
Dec 17, 2009, 7:54:37 PM12/17/09
to fluent-n...@googlegroups.com
Has anyone seen this question on Stackoverflow?
Quoting the most relevant part of the question:

When I try to run my application, I get the following exception on the last line (.BuildSessionFactory()):

Inheritance security rules violated while overriding member: 'FluentNHibernate.Cfg.FluentConfigurationException.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.

What is causing this?


Also, a try to answer the question and comments on it put more light:

From the Microsoft Connect issue:

Security attributes need to be re-applied on types that derive from other types that also have security attributes.

I looked at the source for System.Exception (see link below) and added the same attribute to FluentConfigurationException in my local copy, but it didn't help. Now that I read the error message again, it seems more like some other type is inheriting FluentConfigurationException, without the correct permissions, but I can't figure out where. Link to source: labs.developerfusion.co.uk/SourceViewer/…


I am not the involved in the question and haven't tried it myself under .NET 4.0, but thought maybe such issue needs more sport on it.

Regards,

--
Mohamed Meligy
Senior Developer, Team Lead Backup (.Net Technologies - TDG - Applications)
Injazat Data Systems
P.O. Box: 8230 Abu Dhabi, UAE.

Phone:  +971 2 6992700
Direct:   +971 2 4045385
Mobile:  +971 50 2623624, +971 55 2017 621

E-mail: eng.m...@gmail.com
Weblog: http://weblogs.asp.net/meligy

Paul Batum

unread,
Dec 20, 2009, 12:49:50 AM12/20/09
to fluent-nhibernate
I wonder if this is a breaking change introduced in .NET 4? It certainly looks like it. 

If someone can provide a patch that they've confirmed resolves this issue, I'd be happy to apply it. 

--

You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group.
To post to this group, send email to fluent-n...@googlegroups.com.
To unsubscribe from this group, send email to fluent-nhibern...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en.

Chris C

unread,
Dec 20, 2009, 12:26:13 PM12/20/09
to Fluent NHibernate
Here's the fix for it http://github.com/chilversc/fluent-nhibernate/commit/34e71adbefff6ffc17a5d5f7ff6c7d70954cfaf5

Note, to run the unit tests you'll also need to have these settings,
http://www.meadow.se/wordpress/?p=393 .
Without them sqlite will fail, and nunit won't be able to run.

On Dec 20, 5:49 am, Paul Batum <paul.ba...@gmail.com> wrote:
> I wonder if this is a breaking change introduced in .NET 4? It certainly
> looks like it.
>
> If someone can provide a patch that they've confirmed resolves this issue,
> I'd be happy to apply it.
>

> On Fri, Dec 18, 2009 at 11:54 AM, Mohamed Meligy <eng.mel...@gmail.com>wrote:
>
>
>
> > Has anyone seen this question on Stackoverflow?

> > Weird override problem with Fluent NHibernate and .NET 4<http://stackoverflow.com/questions/1924814/weird-override-problem-wit...>


> > Quoting the most relevant part of the question:
>
> >> When I try to run my application, I get the following exception on the
> >> last line (.BuildSessionFactory()):
>
> >> Inheritance security rules violated while overriding member:
> >> 'FluentNHibernate.Cfg.FluentConfigurationException.GetObjectData(System.Run time.Serialization.SerializationInfo,
> >> System.Runtime.Serialization.StreamingContext)'. Security accessibility of
> >> the overriding method must match the security accessibility of the method
> >> being overriden.
>

> >> *What is causing this?*


>
> > Also, a try to answer the question and comments on it put more light:
>

> > From the Microsoft Connect issue<http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?...>


> >> :
>
> >  Security attributes need to be re-applied on types that derive from other
> > types that also have security attributes.
>
> > I looked at the source for System.Exception (see link below) and added the
> >> same attribute to FluentConfigurationException in my local copy, but it
> >> didn't help. Now that I read the error message again, it seems more like
> >> some other type is inheriting FluentConfigurationException, without the
> >> correct permissions, but I can't figure out where. Link to source:

> >> labs.developerfusion.co.uk/SourceViewer/…<http://labs.developerfusion.co.uk/SourceViewer/browse.aspx?assembly=S...>


>
> > I am not the involved in the question and haven't tried it myself under
> > .NET 4.0, but thought maybe such issue needs more sport on it.
>
> > Regards,
>
> > --
> > Mohamed Meligy
> > Senior Developer, Team Lead Backup (.Net Technologies - TDG - Applications)
> > Injazat Data Systems
> > P.O. Box: 8230 Abu Dhabi, UAE.
>
> > Phone:  +971 2 6992700
> > Direct:   +971 2 4045385
> > Mobile:  +971 50 2623624, +971 55 2017 621
>

> > E-mail: eng.mel...@gmail.com


> > Weblog:http://weblogs.asp.net/meligy
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Fluent NHibernate" group.
> > To post to this group, send email to fluent-n...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > fluent-nhibern...@googlegroups.com<fluent-nhibernate%2Bunsubscr i...@googlegroups.com>

Tomas Lycken

unread,
Dec 20, 2009, 7:48:32 PM12/20/09
to Fluent NHibernate
Hi guys!

Thanks a lot for your help! I'll try this out on my local copy of the
FNH source as soon as I can, and keep you posted.

/ Tomas
(asked the question on SO)

On Dec 20, 6:26 pm, Chris C <chilve...@googlemail.com> wrote:
> Here's the fix for ithttp://github.com/chilversc/fluent-nhibernate/commit/34e71adbefff6ffc...

Reply all
Reply to author
Forward
0 new messages