[GH-ISSUE #208] Calling C# functions (that return result) from QML throws exception under .Net Framework #134

Closed
opened 2026-05-05 11:06:23 -06:00 by gitea-mirror · 0 comments
Owner

Originally created by @FieryRider on GitHub (Jun 2, 2020).
Original GitHub issue: https://github.com/qmlnet/qmlnet/issues/208

This is related to #207.
78628f2 fixed calling void C# functions but calling functions that return result throws exception again.
Here is an exception from one of the method calls:

Unhandled Exception: System.MethodAccessException: Attempt by method 'DynamicClass.method(Qml.Net.Internal.Types.NetReference, Qml.Net.Internal.Qml.NetVariantList, Qml.Net.Internal.Qml.NetVariant, System.Threading.Tasks.Task ByRef)' to access method 'Qml.Net.Internal.CodeGen.CodeGen+LoadMethods.LoadInt(Qml.Net.Internal.Qml.NetVariant, Int32)' failed.
   at method(NetReference , NetVariantList , NetVariant , Task& )
   at Qml.Net.Internal.DefaultCallbacks.InvokeMethod(IntPtr m, IntPtr t, IntPtr p, IntPtr r)
   at QmlNetTest.Program.Main(String[] args) in D:\@UserFolder@\Documents\code\C#\TestRepo1\QmlNetTest\Program.cs:line

The other excpetions are the same but for trying to access the following methods: LoadFloat, LoadDouble, LoadBool, LoadString, LoadObject(for arrays and lists)
Updated the repro repo with the new test case.
It works fine under .Net Core.

Originally created by @FieryRider on GitHub (Jun 2, 2020). Original GitHub issue: https://github.com/qmlnet/qmlnet/issues/208 This is related to #207. 78628f2 fixed calling `void C#` functions but calling functions that return result throws exception again. Here is an exception from one of the method calls: ``` Unhandled Exception: System.MethodAccessException: Attempt by method 'DynamicClass.method(Qml.Net.Internal.Types.NetReference, Qml.Net.Internal.Qml.NetVariantList, Qml.Net.Internal.Qml.NetVariant, System.Threading.Tasks.Task ByRef)' to access method 'Qml.Net.Internal.CodeGen.CodeGen+LoadMethods.LoadInt(Qml.Net.Internal.Qml.NetVariant, Int32)' failed. at method(NetReference , NetVariantList , NetVariant , Task& ) at Qml.Net.Internal.DefaultCallbacks.InvokeMethod(IntPtr m, IntPtr t, IntPtr p, IntPtr r) at QmlNetTest.Program.Main(String[] args) in D:\@UserFolder@\Documents\code\C#\TestRepo1\QmlNetTest\Program.cs:line ``` The other excpetions are the same but for trying to access the following methods: `LoadFloat`, `LoadDouble`, `LoadBool`, `LoadString`, `LoadObject`*(for arrays and lists)* Updated the [repro repo](https://github.com/FieryRider/TestRepo1) with the new test case. **It works fine under `.Net Core`.**
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/qmlnet#134
No description provided.