Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2008
    Location
    Iran / Tehran
    Posts
    285

    exception on autofac !

    I'm really hating myself now,
    at the end of the video 94 (login client, chapter 12) when nelson used command line token to login and test the login system, and forward (i checked the photon update video, didn't help) i get this exception on master server :

    Code:
    1015 19:15:28    13    ERROR    Master    Photon.SocketServer.PeerBase    exception during handling of data.Peer:T:Peer,ConnId:10,ip:127.0.0.1:50514, Data: F3-02-00-00-01-03-62-00,
    1016 Exception:Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(BuzzMMO.Server.Master.MasterServerContext)' on type 'MainLobbyService'. ---> Value cannot be null.
    1017 Parameter name: source (See inner exception for details.) ---> System.ArgumentNullException: Value cannot be null.
    1018 Parameter name: source
    1019    at System.Linq.Enumerable.Select[TSource,TResult](IEnumerable`1 source, Func`2 selector)
    1020    at BuzzMMO.Server.Master.MainLobbyService..ctor(MasterServerContext context) in E:\UnityProjects\MMO\src\BuzzMMO.Server.Master\MainLobbyService.cs:line 27
    1021    at lambda_method(Closure , Object[] )
    1022    at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
    1023    --- End of inner exception stack trace ---
    1024    at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
    1025    at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
    1026    at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
    1027    at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
    1028    at Autofac.Core.Resolving.InstanceLookup.Execute()
    1029    at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
    1030    at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
    1031    at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
    1032    at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
    1033    at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
    1034    at Autofac.Core.Resolving.InstanceLookup.Execute()
    1035    at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
    1036    at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
    1037    at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
    1038    at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
    1039    at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable`1 parameters)
    1040    at BuzzMMO.Server.ClientSystems.Create[TConcreteType]() in E:\UnityProjects\MMO\src\BuzzMMO.Server\ClientSystems.cs:line 32
    1041    at BuzzMMO.Server.Master.Peer.CreateContext(ContextType type, OperationRequest request) in E:\UnityProjects\MMO\src\BuzzMMO.Server.Master\Peer.cs:line 29
    1042    at BuzzMMO.Server.MMOPeerBase`1.OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters) in E:\UnityProjects\MMO\src\BuzzMMO.Server\MMOPeerBase.cs:line 40
    1043    at Photon.SocketServer.PeerBase.OnReceive(Byte[] data, SendParameters sendParameters) in h:\svncontent\photon-socketserver-sdk_cloud\src\Photon.SocketServer\PeerBase.cs:line 1244
    1044    at Photon.SocketServer.PeerBase.OnReceiveInternal(Byte[] data, SendParameters sendParameters, Int32 rtt, Int32 rttVariance, Int32 numFailures) in h:\svncontent\photon-socketserver-sdk_cloud\src\Photon.SocketServer\PeerBase.cs:line 988
    I seriously don't know where to start checking the errors, the only thing i can say is that i have one user in data base (admin) that has roles of admin and registered and the game is enabled for both those roles.

    if anyone has any online repo, i would gladly take the clone of that repo at this point in project lol
    Last edited by css_maya; 07-23-2016 at 10:45 AM.
    If you want to learn something, start teaching about it to others, nothing will help you more than that !

  2. #2
    Join Date
    Jun 2008
    Location
    Iran / Tehran
    Posts
    285
    for more info, here are the line of codes that the stack trace is heading to :
    MainLobbyService (BuzzMMO.Server.Master), in cunstructor
    proxy = BroadcastProxy <IMainLobbySystemClient>.Create (context, players.Select (p => p.Value.Context.Transport));
    ClientSystem (BuzzMMO.Server), under Create<TConcreteType>
    var system = client.ClientScope.Resolve <TConcreteType> ();
    Peer : MMOPeerBase <ClientContext> (BuzzMMO.Server.Master), under CreateContext :
    context.Systems.Create <LoginSystem> ();
    MMOPeerBase , under OnOperationRequest :
    ClientContext = CreateContext (contextType, operationRequest);
    If you want to learn something, start teaching about it to others, nothing will help you more than that !

  3. #3
    Join Date
    Jun 2008
    Location
    Iran / Tehran
    Posts
    285
    Ufff, as always, that was my derpness with no ends, take a look, you may learn something lol
    here is MainLobbyService constructor as i had it before :
    Code:
    public MainLobbyService (MasterServerContext context)
            {
                proxy = BroadcastProxy <IMainLobbySystemClient>.Create  (context, players.Select (p => p.Value.Context.Transport));
                players = new Dictionary <int, MainLobbySystem> ();
                fiber = new ThreadFiber ();
                fiber.Start ();
            }
    now, you may wonder what was wrong with this? take a look at the first line in the constructor, i am doing a linq on the players dictionary !!! what would be that dictionary at the start of constructor? null !!!! watching the videos for the third time, i noticed that nelson had it at the end of the constructor, ok? that would instantiate the players into a new dictionary, that would solve the null exception, but what about populating that dictionary? well, fiber.start? maybe? possibly? yah !

    Code:
    public MainLobbyService (MasterServerContext context)
            {
                players = new Dictionary <int, MainLobbySystem> ();
                fiber = new ThreadFiber ();
                fiber.Start ();
                proxy = BroadcastProxy <IMainLobbySystemClient>.Create  (context, players.Select (p => p.Value.Context.Transport));
            }
    and now everything is working, so? well, not only that null dictionary was causing an issue, also, it's easy to forget how things work hand in hand the way nelson had implemented everything, namely, the fiber.start here, would run all the fiber enqueue things that we had in other classes and those enqueue deferred stuff would populate that dictionary of players !!!!

    ORDER OF OPERATIONS IS NASTY LMAO
    If you want to learn something, start teaching about it to others, nothing will help you more than that !

  4. #4
    Join Date
    Feb 2014
    Posts
    277
    lol. I can't believe you've had more problems than me!
    All I do is follow along character for character and I don't presume to make any changes to the learned musings of Nelson.
    You are probably your own worst enemy since you know what you are doing.

    What I conclude is that the dumber we are the more likely we are to get it working. (I bet you can't quite figure out if I am complimenting you or dissing you!)

  5. #5
    Join Date
    Jun 2008
    Location
    Iran / Tehran
    Posts
    285
    lol grey, you are absolutely right, i am my worst enemy in this project
    also, i take it as a compliment
    and i agree, the least you know, the more chance you pause the video and type the code line by line like nelson, what i do is that i have the video open on second monitor and keep my eyes on my code and just listen to nelson and type as we go forward, that is why i have these types of problems
    also, nelson's light speed typing won't help at all
    If you want to learn something, start teaching about it to others, nothing will help you more than that !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •