Failed to register operation

Options
ewige
edited February 2012 in DotNet
After moving to Photon 3 I caught an error while trying to register an operation with signature:
[Operation(OperationCode = (byte)OperationCode.GetAsset)]
public static OperationResponse OperationGetAsset(PeerBase peer, OperationRequest request)

2011-12-22 17:09:04,462 [15] ERROR Wheels.Server.PhotonApplication - Operation SharedOperations.OperationGetAsset has wrong parameter count; 3 required.
Stacktrace:    at Photon.SocketServer.Rpc.Reflection.OperationMethodInfoCache.RegisterOperation(MethodInfo method) in c:\build\photon-socketserver-sdk_3.0\src\Photon.SocketServer\Rpc\Reflection\OperationMethodInfoCache.cs:line 190
...

What should I use as third parameter?

I've tried to use SendParameters, like in IOperationHandler.OnOperationRequest signature and got another error:
2011-12-22 16:19:02,955 [15] ERROR Wheels.Server.PhotonApplication - Error binding to target method.
Stacktrace:    at System.Delegate.CreateDelegate(Type type, MethodInfo method, Boolean throwOnBindFailure)
   at Photon.SocketServer.Rpc.Reflection.OperationMethodInfoCache.RegisterOperation(MethodInfo method) in c:\build\photon-socketserver-sdk_3.0\src\Photon.SocketServer\Rpc\Reflection\OperationMethodInfoCache.cs:line 211
   at Photon.SocketServer.Rpc.Reflection.OperationMethodInfoCache.RegisterOperations(Type targetType) in c:\build\photon-socketserver-sdk_3.0\src\Photon.SocketServer\Rpc\Reflection\OperationMethodInfoCache.cs:line 243
...

Could someone say, what signature should my handler have to be registered correctly?

Comments

  • Did you find a solution for this?

    I have the same error when the OperationDispatcher is created.
            private static readonly OperationMethodInfoCache _operations = new OperationMethodInfoCache();
    
            private readonly OperationDispatcher _dispatcher;
    
            static MyPeer()
            {
                _operations = new OperationMethodInfoCache();
                _operations.RegisterOperations(typeof(MyPeer));
            }
    
            public MyPeer(IRpcProtocol rpcProtocol, IPhotonPeer nativePeer) : base(rpcProtocol, nativePeer)
            {
                // Throws Exception here
               _dispatcher = new OperationDispatcher(_operations, this);
    
                this.SetCurrentOperationHandler(this);
            }
    
    
            [Operation(OperationCode = (byte)OperationCode.Login)]
            public OperationResponse OperationLogin(PeerBase peer, OperationRequest request, SendParameters sendParameters)
    ...
    
  • Nevermind... got the latest build and it appears to be working now.