Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › C# Programming › Load Assembly into AppDomain from memory?

Load Assembly into AppDomain from memory?

Posts 1–8 of 8 · Page 1 of 1
T7
t7ancients
Load Assembly into AppDomain from memory?
So, here's the problem: I have a program that compiles source code into a System.Reflection.Assembly object, and I want to run that on an AppDomain. All of the methods and overloads for loading that Assembly into said AppDomain throw an exception when I try to load the Assembly. Does it absolutely have to be a file, or is there another way to load an assembly into an appdomain? If it'll be necessary, how would you get a byte array from the Assembly object? Any help would be greatly appreciated, reflection has got me bleeding from the eyes here. @_@
#1 · 14y ago
freedompeace
freedompeace
You'll need to load it from a file.
#2 · 14y ago
T7
t7ancients
Damn it. But isn't there a way to serialize it to a byte array from an object?
like.... object a = MyAssembly, and then convert the object into a byte array?
I don't know how to do this, but I read somewhere that it's possible. :/
#3 · 14y ago
T7
t7ancients
What I'm doing is compiling an assembly in memory, so a file version of it never exists, and I'm trying to pass that assembly object to an AppDomain, but I guess there's no realistic way to get a byte array from it in memory or to simply pass it from memory to the AppDomain. /derp
#4 · 14y ago
master131
[MPGH]master131
I could only find a few threads about this on Google and they were saying to use IO.File.ReadAllBytes but in your case, you can't.

If you use the AssemblyBuilder class though, you can Save it.
#5 · edited 14y ago · 14y ago
T7
t7ancients
I'm not looking to save it to a file, as I can just compile it to a file via CodeDom, what I'm doing is generating Assemblies in memory, and I want to load it into an AppDomain but there's no way to do it without using a file. I think what I'll have to do is compile to files, load all assemblies, and delete the files once they've loaded into memory. :/ A lot more than would have to be done if you could simply load assemblies from memory, fucking microsoft and our damned love/hate relationship.
#6 · 14y ago
freedompeace
freedompeace
Quote Originally Posted by t7ancients View Post
I'm not looking to save it to a file, as I can just compile it to a file via CodeDom, what I'm doing is generating Assemblies in memory, and I want to load it into an AppDomain but there's no way to do it without using a file. I think what I'll have to do is compile to files, load all assemblies, and delete the files once they've loaded into memory. :/ A lot more than would have to be done if you could simply load assemblies from memory, fucking microsoft and our damned love/hate relationship.
Why can't you use a file anyway? It's not like you'll hurt the OS or anything.
#7 · 14y ago
T7
t7ancients
Quote Originally Posted by freedompeace View Post


Why can't you use a file anyway? It's not like you'll hurt the OS or anything.
It's for a scripting system for a game. Don't want compiled script binaries clogging mah systemz. I suppose I could cave and redesign it for a plug-in build, that way I could use AppDomains. Currently I'm using reflection to invoke the main method for all scripts, ScriptMain(), of every script loaded into memory(On new threads, of course). Reflection is fine, as speed isn't an issue because it'll only really affect initial load times of scripts. Just wish I could use AppDomains, it's safer than just running an assembly per thread and easier to load/execute.
#8 · 14y ago
Posts 1–8 of 8 · Page 1 of 1

Post a Reply

Similar Threads

  • Converting Assembly Into BytesBy radnomguywfq3 in Visual Basic Programming
    0Last post 19y ago
  • [Help]Reading Stacks from memory using VB.netBy euverve in Visual Basic Programming
    2Last post 15y ago
  • [vb6] How do i read a float from memory(pointer+offset)+how to use multilevelpointerBy freitag in Visual Basic Programming
    5Last post 17y ago
  • Extracting classes from dynamically loaded libraries.By radnomguywfq3 in C++/C Programming
    3Last post 17y ago
  • Reading from a memory addressBy isaacboy in Visual Basic Programming
    0Last post 17y ago

Tags for this Thread

None