Open ClubWebware opened 10 years ago
I never made any effort to have CsQuery work in a medium-trust environment, nor have I tested it, so I will assume it does not. It uses reflection extensively and while (to the best of my understanding) some reflection methods are allowed, I am sure this would cause problems in addition to this one.
This issue came up before: https://github.com/jamietre/CsQuery/issues/108 and I don't see any followup from it.
The particular error that's happening here seems like it would be resolvable but this is used early on (during HTML parsing). I don't doubt that you will find other problems running in medium-trust. I encourage you to pull the source down and try to get it working -- but it's not a big priority for me so I'm not likely to spend much effort on it.
Thank you for your prompt reply.
I'll see if I can work around this issue. And otherwise (regretfully) I will have to stop using CsQuery and try to find another solution.
Most of the time CsQuery works fine for us, even in a medium trust environment. We've only just recently run into this inheritance error. So maybe CsQuery is perfectly usable for us if we can just get this particular error out of the way.
Would it be too much to ask you to try and resolve this particular error?
I just looked at the actual source of this and.. actually it might not be hard to fix. I haven't looked at the class in a while but this particular method seems to be improperly implemented. I'll take a look at it tonight.
Hi jamietre,
Any luck yet?
Best regards, Marja
Well, just marking CombinedTextReader.CreateObjRef and InitializeLifetimeService methods with System.Security.SecurityCriticalAttribute solves the immediate issue - instantiating the CombinedTextReader class in medium trust. I'll try to send pull request these days.
@ClubWebware, this is easy enough to fix at your side and use a custom build - note however that, as @jamietre noted, the library can bump somewhere else when in medium trust.
CsQuery sometimes gives the following error:
"Inheritance security rules violated while overriding member: 'CsQuery.Implementation.CombinedTextReader.CreateObjRef(System.Type)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden."
Our web application needs to run in shared hosting environments, so our application must run under medium trust. Maybe that's part of the issue?
Any idea what might cause this error, and better yet: what to do about it?
Best regards, Marja