Page 1 of 1

URGENT - "Attempt to access the method failed" exception

Posted: Wed 08 Mar 2006 23:53
by matlaf
Hi,

I'm a new user of MySqlDirect.Net. I read lot of post on your forum about licensing but I saw anything about this.

First I add the license to my project. Everything is ok on my computer. When I run it from my ISP I have this error.

Code: Select all

Attempt to access the method failed

[MethodAccessException: Attempt to access the method failed.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +103
   System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +261
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +66
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1036
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +114
   System.Activator.CreateInstance(Type type, Object[] args) +16
   System.SecurityUtils.SecureCreateInstance(Type type, Object[] args) +106
   System.ComponentModel.LicenseManager.ValidateInternalRecursive(LicenseContext context, Type type, Object instance, Boolean allowExceptions, License& license, String& licenseKey) +178
   System.ComponentModel.LicenseManager.ValidateInternal(Type type, Object instance, Boolean allowExceptions, License& license) +41
   System.ComponentModel.LicenseManager.IsValid(Type type) +20
   CoreLab.MySql.MySqlConnection..ctor() +105
   CoreLab.MySql.MySqlConnection..ctor(String connectionString) 
My ISP run my website as partialy trusted assembly.

I'm thinking that is MysqlDirect.net problem because this exception occur on the new of the MysqlConnection object.

What can I do?

It is very urgent to have an solution.

Thanks

MysqlDirect 3.20.9.0
Visual studio 2005
Asp.net 2.0

Posted: Thu 09 Mar 2006 01:02
by sjackson
Hello,

Yes, I am seeing exactly the same thing. The cause is that in ASP.NET 2.0 web applications are run with only partial trust - most ISPs require this. In 1.1 all assemblies run with full trust so this problem is not encountered. Here are some references:
- http://www.ureader.com/message/117166.aspx
- http://cyberforge.com/weblog/aniltj/arc ... 7/486.aspx
- http://intrepidnoodle.com/BlogViewArtic ... ticleId=19

There are two possible solutions:
1. Make the web application fully trusted. This will probably require changes to the ISP server setup (which they may refuse to do); or

2. CoreLab to recompile the MySQLDirect.NET assembly with the AllowPartiallyTrustedCallersAttribute.

Without one of these, it is not possible to use the CoreLab provider on an ASP.NET 2.0 platform.

Will CoreLab be recompiling to allow us to run on ASP.NET 2.0? Or has a later version of the library been compiled with this attribute set? Thanks...

Regards

Simon

Posted: Thu 09 Mar 2006 01:45
by matlaf
Thanks for your help and documentation.

The assembly Corelab.Mysql 3.20.9.0 already has the attribute.

For this reason I suppose I meet with this exception another problem.

I hope someone of corelab will answer quickly.

Must be an internal assertion

Posted: Thu 09 Mar 2006 01:55
by sjackson
Hmm - I didn't realize 3.20.9 was compiled with APTCA. I guess I would have seen a different exception if it wasn't.

It seems like something to do with permissions the (CoreLab) code is asserting. Permissions for things like IO, event logging, registry access and reflection have changed in .NET 2.0 so I'm wondering if it will be one of these?: http://msdn.microsoft.com/library/defau ... 000020.asp

Either way, I also need an urgent resolution of this.

Posted: Thu 09 Mar 2006 15:37
by Paul
We fixed the problem with licensing with Medium security policy level. This fix will be available in the next MySQLDirect .NET build. But you must have "SocketPermission" permission to be able to connect to MySQL server

Posted: Fri 10 Mar 2006 00:19
by matlaf
When the next build will be available for download? It is very urgent for me to have this fix.

Can you apply the fix on the 3.20.9.0 build?

Posted: Fri 10 Mar 2006 19:24
by matlaf
Hello, Is someone of CoreLab can answer my question ? :x

It's urgent to me to have this fix. Minimaly can I have a date for the next build?

Posted: Mon 13 Mar 2006 15:09
by Serious
We plan to release new stable Beta build on this week.
Runtime code in this version is stable enough to use it in production builds. Some known problems are present only in Visual Studio extensions.