views:

120

answers:

0

Getting an AccessViolationException when calling ToString() on my MemberInfo. I suspect something is holding onto the Type information on one of my methods parameters and causing the error, could this be possible? What usually causes the AccessViolationExpection?

I'm getting looping through the Public Static methods a Type and am getting the exception in one particular case, the parameter to the static method is of a particular Type, one of our own Types.

public static void DisplayAnotherSet(MyType myparam)
        {
        }

This works ok:

public static string TakeInt(int i)
        {
            return "the result";
        }

I think that there maybe something else holding on the the MyType's info which is preventing the MethodInfo from being returned, I can get access the MethodInfo.Name but the ToString() and the ParameterType() blows up.

MethodInfo[] methods = _nativeType.GetMethods(BindingFlags.Static | BindingFlags.Public);
            foreach (MethodInfo method in methods)
            {
                string name = method.Name;
                string description = string.Empty;
                try
                {
                    description = method.ToString();//blows up here AccessViolationExpection
                }
                catch (AccessViolationException)
                {
                    description = method.Name;
                }
}

Also intermittently getting a System.IO.FileLoadException on the MethodInfo.ToString(). The exception also indicates and issue with locating the dll, the dll that contains the "MyType" which is uses as a parameter into the MethodInfo.

FusionLog shows :

*** Assembly Binder Log Entry  (01/09/2009 @ 09:45:38) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable  C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = *******************
LOG: DisplayName = MyAssembly, Version=1.0.903.27, Culture=neutral, PublicKeyToken=1fb390d5abbe9d5f
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe.Config
LOG: Using machine configuration file from c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x80070002).