I am trying to create a copy of a method during runtime using reflection. I have the following code. public static R CopyMethod<T, R>(Func<T, R> f, T t) { AppDomain currentDom = Thread.GetDomain(); AssemblyName asm = new AssemblyName(); asm.Name = "DynamicAssembly"; AssemblyBuilder abl = currentDom.DefineDynamicAssembly(asm, AssemblyBuilderAccess.Run); ModuleBuilder mbl = abl.DefineDynamicModule("Module"); [...] read more
I can't enable EF migrations! Using the package manager console, it throws the following: PM> Enable-Migrations System.BadImageFormatException: Could not load file or assembly 'MyApp' or one of its dependencies. Index not found. (Exception from HRESULT: 0x80131124) File name: 'MyApp' ---> System.BadImageFormatException: Index not found. (Exception from HRESULT: 0x80131124) at System.Reflection.RuntimeAssembly._nLoad(AssemblyName [...] read more
I'm trying to call unmanaged printf-like function using DynamicMethod. At runtime I get a > BadImageFormatException:Index not found. (Exception from HRESULT: 0x80131124) Is this a limitation of runtime or my emited code is wrong? public class Program { [DllImport("msvcrt40.dll",CallingConvention = CallingConvention.Cdecl)] public static extern int printf(string format, __arglist); static void [...] read more
My program is occasionally crashing with the following error message: > System.Reflection.TargetInvocationException: Exception has been thrown by the > target of an invocation. ---> System.BadImageFormatException: Index not found. > (Exception from HRESULT: 0x80131124) Some details which may be relevant: * C# 4 / .NET 4 * Windows 7 64 bit [...] read more
I have access to a function body Intermediate Language like this : byte[] ilCodes = NestedFooInfo.GetMethodBody().GetILAsByteArray(); I am able to modify its IL code so that before executing the method body I call the following method named OnChangeField: public static void OnChangeField() { Console.WriteLine("VICTORY"); return; } So far I do [...] read more
I want to write a program that watches a .dll for changes. When a change happens, it should load the assembly and invoke the foo function inside. I have some code that should implement this, but it behaves strangely. Sometimes it works. Sometimes the assembly it loads will be an [...] read more
I have published my website as a Azure web application(through Visual Studio publish) and I am getting a An unhandled exception has occurred while executing the System.BadImageFormatException: Index not found. (Exception from HRESULT: 0x80131124) error. The application however works fine on my local machine. Between the time when the application [...] read more
When building my solution, I randomly receive one of these errors: > C:\working_directory.nuget\NuGet.targets(91, 5): Type handle > 'NuGet.ProjectModel.LockFile' and method handle with declaring type > 'NuGet.ProjectModel.HashCodeCombiner' are incompatible. Get > RuntimeMethodHandle and declaring RuntimeTypeHandle off the same MethodBase. > C:\working_directory.nuget\NuGet.targets(91, 5): error MSB3073: The command > ""C:\working_directory.nuget\NuGet.exe" install > "C:\working_directory\Project_A\packages.config" [...] read more
I have an ASP.NET Web API application running on an Azure App Service which is, in turn, deployed via Octopus after a TFS build definition is completed. After certain successful deployments (no errors happen nor in TFS nor in Octopus), the whole API stops working and all endpoints respond with [...] read more
I'm working on an existing solution which works fine all this while. After a few weeks, I tried to add a new migration to entity framework and got this error. All projects are currently set to build 'Any CPU'. I'm using Net 4.6.1 and Entity Framework 6.1.3 PM> Add-Migration AddedVerifyRemarks [...] read more
This is erroring when run in Visual Studio F# Interactive window, but not in the command line F# REPL or in Rider. let numbers = [1..10] let numberFilter number = number % 5 = 0 || number % 3 = 0 ;; error FS0193: internal error: Index not found. (Exception [...] read more
I am having the following exception in visual studio xaml designer when trying to open a xaml file. System.BadImageFormatException Index not found. (Exception from HRESULT: 0x80131124) at Microsoft.MetadataReader.IMetadataAssemblyImport.GetAssemblyRefProps(Token token, EmbeddedBlobPointer& pPublicKey, Int32& cbPublicKey, StringBuilder szName, Int32 cchName, Int32& pchName, AssemblyMetaData& pMetaData, UnusedIntPtr& ppbHashValue, UInt32& pcbHashValue, AssemblyNameFlags& dwAssemblyRefFlags) at Microsoft.MetadataReader.AssemblyNameHelper.AssemblyNameFromRefBuilder.Fetch() at [...] read more
I have created a mvc4 web application. It works on my dev environment but when I deploy it to my production environment (WinHost) it generates following error. I have already changed copy Local to true > Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. > Index [...] read more
I tried to connect to SQL Server 2012 Express through Visual Studio 2012. It was working before until yesterday when it gave this error > Cannot connect to FRANCISPEDS\SQLEXPRESS. > ADDITIONAL INFORMATION: The type initializer for > 'System.Data.SqlClient.SqlConnection' threw an exception. (System.Data) Minutes later, tried to connect again, now it [...] read more
I have access to a function body Intermediate Language like this : byte[] ilCodes = NestedFooInfo.GetMethodBody().GetILAsByteArray(); I want to be able to modify its IL code so that whenever there is a stfld IL command I call the following method named OnChangeField: public static void OnChangeField(object obj, object value) { [...] read more