System.Reflection.TargetInvocationException when running Project Hawaii Sample app

I am using the Hawaii project SDK to create a Speech to Text app. I ran the sample project and the following exception was thrown at startup.

System.Reflection.TargetInvocationException was unhandled by user code
HResult=-2146232828
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
InnerException: System.MethodAccessException
   HResult=-2146233072
   Message=Attempt by security transparent method 'System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)' to access security critical method 'System.IO.File.Exists(System.String)' failed.
   Source=mscorlib
   InnerException: 

      

I see the description of the exception, however I cannot find a suitable solution. Here is the code of the block in which the error occurred.

 try
        {
            bool fileExists = (bool)existsMethodInfo.Invoke(null, new object[] { configFilePath });

            if (fileExists)
            {
                IEnumerable<string> lines = (IEnumerable<string>)readLinesMethodInfo.Invoke(null, new object[] { configFilePath });
                foreach (string line in lines)
                {
                    if (!string.IsNullOrEmpty(line))
                    {
                        return line;
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }

      

The summary of the function that makes these calls is "Function is used in a. It looks for settings in the specified file. If it does not exist, it returns the default. The [SecurityCritical] attribute must be present because of the CA2140 parsing rule."

+3
reflection c # windows-phone-7


source to share


No one has answered this question yet

Check out similar questions:

2
File that has no thumbnail throws COM Exception in Win 8 Metro
2
How do I convert a stream to BitmapImage?
1
CastException when using Decimal? a type
0
Reflection on IQueryable FirstOrDefault ()
0
I tried using WebMatrix.WebData but keep getting this error even after I uninstalled the package
0
Why will the automatically generated WP8 init code fail?
0
System.Reflection.TargetInvocationException error when trying to instantiate a new ViewController
0
System.Reflection.TargetInvocationException while starting MVC 4 app
-1
mscorlib: System.reflection.TargetInvocationException
-2
A COM object that has been detached from its underlying RCW cannot be used. in ice



All Articles
Loading...
X
Show
Funny
Dev
Pics