The code is shown below。There are Two DefaultDomain in Process,and i need to do JIT in DefaultDomain, ImageFile’s AppDomin Can JIT,but another cant.
var Domains = GetAllAppDomains();
foreach (var domain in Domains)
{
ObjectHandle handle1 = domain.CreateInstanceFrom(
typeof(Process).Assembly.ManifestModule.FullyQualifiedName,
typeof(Process).FullName
);
Process DomainProcess = (Process)handle.Unwrap();
var Methods = DomainProcess.GetType().GetRuntimeMethods().ToList();
var StartWithCreateProcess = Methods.Where(_ => _.Name == "GetCurrentProcess").FirstOrDefault();
var methodhandle = StartWithCreateProcess.MethodHandle;
var methodAttr = StartWithCreateProcess.Attributes;
var methodType = methodhandle.GetType();
if (!((methodAttr & MethodAttributes.Abstract) == MethodAttributes.Abstract || methodType.ContainsGenericParameters))
{
RuntimeHelpers.PrepareMethod(methodhandle);
}
}
i try to use RuntimeHelpers.PrepareMethod
, but it didn’t work
Maybe can Call C++ complier to JIT?
New contributor
Montarius is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.