Skip to content

Commit

Permalink
.NET: Use singular attribute lookup instead
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Apr 12, 2024
1 parent 2f340f0 commit e0a2027
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions csharp-api/REFrameworkNET/Proxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,14 @@ public ref class Proxy : public Reflection::DispatchProxy, public IProxy, public
protected:
virtual Object^ Invoke(Reflection::MethodInfo^ targetMethod, array<Object^>^ args) override {
// Get the REFrameworkNET::Attributes::Method attribute from the method
auto methodAttributes = targetMethod->GetCustomAttributes(REFrameworkNET::Attributes::Method::typeid, false);
//auto methodAttributes = targetMethod->GetCustomAttributes(REFrameworkNET::Attributes::Method::typeid, false);
auto methodAttribute = (REFrameworkNET::Attributes::Method^)System::Attribute::GetCustomAttribute(targetMethod, REFrameworkNET::Attributes::Method::typeid);

Object^ result = nullptr;
auto iobject = dynamic_cast<REFrameworkNET::IObject^>(Instance);

if (methodAttributes->Length != 0) {
// Get the first attribute's method
auto attr = (REFrameworkNET::Attributes::Method^)methodAttributes[0];
auto method = attr->GetMethod();
if (methodAttribute != nullptr) {
auto method = methodAttribute->GetMethod();

if (iobject != nullptr) {
iobject->HandleInvokeMember_Internal(method, args, result);
Expand Down

0 comments on commit e0a2027

Please sign in to comment.