URGENT - "Attempt to access the method failed" exception

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
matlaf
Posts: 4
Joined: Wed 08 Mar 2006 23:43

URGENT - "Attempt to access the method failed" exception

Post by matlaf » Wed 08 Mar 2006 23:53

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

sjackson
Posts: 2
Joined: Thu 09 Mar 2006 00:53

Post by sjackson » Thu 09 Mar 2006 01:02

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

matlaf
Posts: 4
Joined: Wed 08 Mar 2006 23:43

Post by matlaf » Thu 09 Mar 2006 01:45

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.

sjackson
Posts: 2
Joined: Thu 09 Mar 2006 00:53

Must be an internal assertion

Post by sjackson » Thu 09 Mar 2006 01:55

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.

Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Thu 09 Mar 2006 15:37

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

matlaf
Posts: 4
Joined: Wed 08 Mar 2006 23:43

Post by matlaf » Fri 10 Mar 2006 00:19

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?

matlaf
Posts: 4
Joined: Wed 08 Mar 2006 23:43

Post by matlaf » Fri 10 Mar 2006 19:24

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?

Serious

Post by Serious » Mon 13 Mar 2006 15:09

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.

Post Reply