reflectronic
reflectronic
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
:)
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
and once you have those function pointer, you should replace
int rc = load_assembly_and_get_function_pointer(
clrhost_lib_path.c_str(),
clrhost_type,
clrhost_init_method,
clrhost_delegate, /* Delegate type name, if using non-standard delegate */
nullptr,
(void**)&fh_init);
int rc = load_assembly_and_get_function_pointer(
clrhost_lib_path.c_str(),
clrhost_type,
clrhost_init_method,
clrhost_delegate, /* Delegate type name, if using non-standard delegate */
nullptr,
(void**)&fh_init);
with something like
int rc = load_assembly(
clrhost_lib_path.c_str(),
nullptr,
nullptr);

// error checking
int rc = get_function_pointer(
clrhost_type,
clrhost_init_method,
clrhost_delegate, /* Delegate type name, if using non-standard delegate */
nullptr,
nullptr,
(void**)&fh_init);

// error checking
int rc = load_assembly(
clrhost_lib_path.c_str(),
nullptr,
nullptr);

// error checking
int rc = get_function_pointer(
clrhost_type,
clrhost_init_method,
clrhost_delegate, /* Delegate type name, if using non-standard delegate */
nullptr,
nullptr,
(void**)&fh_init);

// error checking
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
based on the sample i assume you copied it from, you probably have something like
rc = get_delegate_fptr(
cxt,
hdt_load_assembly_and_get_function_pointer,
&load_assembly_and_get_function_pointer);
rc = get_delegate_fptr(
cxt,
hdt_load_assembly_and_get_function_pointer,
&load_assembly_and_get_function_pointer);
and you need to instead have something like
get_delegate_fptr(
cxt,
hdt_load_assembly,
&load_assembly);

get_delegate_fptr(
cxt,
hdt_get_function_pointer,
&get_function_pointer);
get_delegate_fptr(
cxt,
hdt_load_assembly,
&load_assembly);

get_delegate_fptr(
cxt,
hdt_get_function_pointer,
&get_function_pointer);
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
indeed
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
right, because that is the behavior of load_assembly_and_get_function_pointer_fn
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
yes, this is back to where it was before. fhcore is loaded into both the component ALC and the default ALC
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
ok, this is what i expect to see
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
type.BaseType.Assembly
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
uh
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
when it loads fhcore does you override return null or is assembly_path non-null
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
is one of them fhcore
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
can you log every asssembly you load in the override of Load
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
i still don't know how fhcore has sneaked into your custom ALC
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
there is documentation for what the methods all take here https://github.com/dotnet/runtime/blob/main/docs/design/features/native-hosting.md
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
and then you just use them
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
you acquire load_assembly and get_function_pointer in the same way that you acquire load_assembly_and_get_function_pointer_fn
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
this is why you are seeing typeof(FhModule) inside that IsolatedComponentLoadContext thing. that is the one created by the host API
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
the load_assembly_and_get_function_pointer_fn creates a new ALC for each component that you load. since, you are supposed to be able to load multiple of them
73 replies
CC#
Created by peppy on 5/1/2025 in #help
``Type.IsAssignableFrom`` returning false unexpectedly in plugin-loading scenario
i think what will be easier is to use load_assembly instead of load_assembly_and_get_function_pointer_fn in your host
73 replies