Hi,

I'm trying to write an WPF Browser Application with DO4. I came accross something I do not understand. I get an exception on the Domain.Build(conf) during execution. It says something about security. Any clues what it could be. Here's the exception:

Inheritance security rules violated while overriding member: 'Xtensive.Storage.Entity.System.Runtime.Serialization.ISerializable.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.

A description of the code can be found on my blog (http://paul.sinnema.ch/?p=118).

Regards Paul Sinnema Diartis AG


Updated at 20.06.2010 12:42:49

Hi Alex,

Found a post about the same problem here: http://social.msdn.microsoft.com/Forums ... a4918c6ee5

Regards Paul Sinnema Diartis AG


Updated at 20.06.2010 12:47:41

Hi Alex,

Try applying [assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)] to your WPF project to temporarily workaround the issue.

No, does not help me.

Applied it in the App.xaml.cs above the namespace like this:

using System.Windows;

[assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)]
namespace AnyMatrix
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
    }
}

Regards Paul Sinnema Diartis AG


Updated at 20.06.2010 14:34:39

Alex,

I guess there's something wrong in the solution. I've divided the application into 1) the WPF Browser Application and 2) a class library containing the DO4 objects. I try and initialize the DO4 Domain from the WPF app using the Session Getter on the class you find in my blog. At first I got an exception that I needed to add some XTensive Assembly to the WPF App project. When I start the 'add reference' I don't see the assemblies in the Assemblies list. I went on and browsed for them in the 'C:\Program Files (x86)\DataObjects.Net\Bin\Release' directory. Maybe that's causing the problem.

Regards Paul Sinnema Diartis AG


Updated at 20.06.2010 14:49:48

[quote="Alex (Xtensive)":phn1eh6v]Can you try to run the application with full trust?

How do I do that?[/quote:phn1eh6v]

Found the solution here, very simple: http://blogs.microsoft.co.il/blogs/maxi ... ation.aspx

Regards Paul Sinnema Diartis AG


Updated at 22.06.2010 19:18:41

Alex,

With Full Trust activated the local run is ok, but when I publish it to my website I get error concerning 'trust'. When I make it a partial trust again. The application is download from the website but then the old error is back again.

I have no clue how to solve this.

Regards Paul Sinnema Diartis AG

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Jun 20 '10 at 11:29

Paul%20Sinnema's gravatar image

Paul Sinnema
261888896


2 Answers:

Most likely, that's because we didn't put new security attributes added in .NET 4.

Try applying [assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)] to your WPF project to temporarily workaround the issue.

I'm studying what should be done related to new .NET 4 security model right now.


> No upgrade handler is found for assembly 'OrmMatrix', version '1.0.0.0'.

Most likely you've changed version of your assembly with persistent types and run Domain.Build in Perform or PerformSafely mode.

v1.0.0.0 is the original version of your assembly.


> When I start the 'add reference' I don't see the assemblies in the Assemblies list.

Just fixed, the update will be published in a day or two.

Issue: http://code.google.com/p/dataobjectsdot ... ail?id=708


And issue about security: http://code.google.com/p/dataobjectsdot ... ail?id=707

Btw, you'll anyway need full trust. But now all the methods requiring elevated priviligies are properly annotated.

Earlier (i.e. in your version) there were no .NET 4 secutrity annotations, that's equivalent to a case when all the methods are marked as [SecurityCritical] = require full trust.


May be there is something wrong with certificate it is signed by (I simply don't imagine what else may differ / affect here)? I so, I almost sure this is covered in big list of comments below the article about publishing full-trust WPF-XBAP.

I don't have experience with WPF browser apps, so may be I'm wrong.

answered Jun 20 '10 at 12:32

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

I understood the cause: there is no neither [LinkDemand] nor [SecirityCritical] is applied to Entity.GetObjectData method.

Can you try to run the application with full trust?

I'm already fixing the issue.

(Jun 20 '10 at 12:32) Alex Yakunin Alex%20Yakunin's gravatar image

Can you try to run the application with full trust?

How do I do that?

(Jun 20 '10 at 12:32) Paul Sinnema Paul%20Sinnema's gravatar image

Alex,

The application now continues without the previous exception, but now running into the next exception.

No upgrade handler is found for assembly 'OrmMatrix', version '1.0.0.0'.

Regards Paul Sinnema Diartis AG

(Jun 20 '10 at 12:32) Paul Sinnema Paul%20Sinnema's gravatar image

Alex,

Everything is running smoothly locally. Look here http://paul.sinnema.ch/?p=118

Regards, Paul Sinnema Diartis AG

(Jun 20 '10 at 12:32) Paul Sinnema Paul%20Sinnema's gravatar image

Just fixed, the update will be published in a day or two. Where can I download this?

(Jun 20 '10 at 12:32) Paul Sinnema Paul%20Sinnema's gravatar image

Today i faced with same problem as this in my ASP.NET MVC app:

TypeLoadException: Inheritance security rules violated while overriding member: 'Xtensive.Core.UrlInfo.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.]
Xtensive.Core.ConnectionInfo..ctor(String connectionUrl) +0
   Xtensive.Orm.Configuration.Elements.DomainConfigurationElement.GetConnectionInfo() +175
   Xtensive.Orm.Configuration.Elements.DomainConfigurationElement.ToNative() +41
   Xtensive.Orm.Configuration.DomainConfiguration.Load(String sectionName, String name) +82
   Xtensive.Orm.Configuration.DomainConfiguration.Load(String name) +13
   TXSoftware.DataObjectsNetEntityModel.Web.Model.DomainBuilder.GetDomainConfiguration()
   TXSoftware.DataObjectsNetEntityModel.Web.Model.DomainBuilder.Build(Boolean rebuild) 
   TXSoftware.DataObjectsNetEntityModel.Web.Site.test.Page_Load(Object sender, EventArgs e)
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +91
   System.Web.UI.Control.LoadRecursive() +74
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

You write here that you fixed it, but it seems to me as not fixed, at version 4.4.0.7571.

Update: I must say that my asp.net app is hosted on external webhosting, and i dont know if they have some .net security restrictions or what.

answered Jun 03 '11 at 11:05

Peter%20%C5%A0ulek's gravatar image

Peter Ĺ ulek
492313236

edited Jun 03 '11 at 11:44

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×574

Asked: Jun 20 '10 at 11:29

Seen: 9,423 times

Last updated: Jun 03 '11 at 11:44

powered by OSQA