首页 > 解决方案 > 为什么这个字节在我的 Program.cs 中抛出空异常

问题描述

我的 Program.cs 中的代码 不要评判我,但我正在尝试为 roblox 漏洞利用创建一个 imgui(副本),因为有人要求它我不知道要在这里添加它只是说我需要添加详细信息,所以我正在尝试这样做是打包我引用的 dll

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ImguiBase
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            AppDomain.CurrentDomain.AssemblyResolve += (Object sender, ResolveEventArgs args) =>
            {
                String thisExe = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
                System.Reflection.AssemblyName embeddedAssembly = new System.Reflection.AssemblyName(args.Name);
                String resourceName = thisExe + "." + embeddedAssembly.Name + ".dll";

                using (var stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
                {
                    Byte[] assemblyData = new Byte[stream.Length];
                    stream.Read(assemblyData, 0, assemblyData.Length);
                    return System.Reflection.Assembly.Load(assemblyData);
                }
            };
            Application.Run(new Form1());
        }
    }
}

我得到的例外是这个https://gyazo.com/660dfbc4661f11c1b05c7ff287d710b5

标签: c#winforms

解决方案


推荐阅读