Ссылка 1
Ссылка 2
Ссылка 3
Ссылка 4
Загрузчик:
Код: Выделить всё
using System;
using System.Reflection;
namespace MyApp
{
internal class Program
{
static async Task Main(string[] args)
{
String filepath = "C:\\Users\\Bob\\source\\repos\\ConsoleApp1\\bin\\Debug\\net8.0\\ConsoleApp1.exe";
FileStream fs = new FileStream(filepath, FileMode.Open);
BinaryReader br = new BinaryReader(fs);
byte[] bin = br.ReadBytes(Convert.ToInt32(fs.Length));
fs.Close();
br.Close();
Assembly a = Assembly.Load(bin);
Console.WriteLine("A.entrypoint = {0}", a.EntryPoint); //Crashes here
//I have tried to print the entrypoint here as an example but anything you do with the assembly crashes here.
}
}
}
Код: Выделить всё
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
Код: Выделить всё
Unhandled exception. System.BadImageFormatException: Bad IL format.
Подробнее здесь: https://stackoverflow.com/questions/787 ... rom-memory
Мобильная версия