ET版本:8.1
ET8.1查询数据库报错,
定位到代码
DBComponent dbComponent = self.Root().GetComponent<DBManagerComponent>().GetZoneDB(self.Zone());
entit = await dbComponent.Query<Entity>(unitId,self.key);
其中查询的是ET.Server.RoleInfo类,self.key是字符串“ET.Server.RoleInfo”
错误:
角色进入游戏逻辑服出现问题 账号Id: 1199967033099055 角色Id: 1200054623798065 异常信息: Error: 110307
ET.RpcException: Rpc error: actorId: 1:7:1 request: ET.Other2UnitCache_GetUnit, response: { “_t” : “UnitCache2Other_GetUnit”, “RpcId” : 4, “Error” : 110307, “Message” : “MongoDB.Bson.BsonSerializationException: Ambiguous discriminator ‘RoleInfo’.\r\n\u007fMongoDB.Bson.BsonSerializationException: Ambiguous discriminator ‘RoleInfo’.\r\n at Type MongoDB.Bson.Serialization.BsonSerializer.LookupActualType(Type nominalType, BsonValue discriminator)\r\n at Type MongoDB.Bson.Serialization.Conventions.StandardDiscriminatorConvention.GetActualType(IBsonReader bsonReader, Type nominalType)\r\n at Entity MongoDB.Bson.Serialization.BsonClassMapSerializer<ET.Entity>.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)\r\n at Entity MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize<Entity>(IBsonSerializer<Entity> serializer, BsonDeserializationContext context)\r\n at List<Entity> MongoDB.Driver.Core.Operations.CursorBatchDeserializationHelper.DeserializeBatch<Entity>(RawBsonArray batch, IBsonSerializer<Entity> documentSerializer, MessageEncoderSettings messageEncoderSettings)\r\n at CursorBatch<Entity> MongoDB.Driver.Core.Operations.FindOperation<ET.Entity>.CreateFirstCursorBatch(BsonDocument cursorDocument)\r\n at AsyncCursor<Entity> MongoDB.Driver.Core.Operations.FindOperation<ET.Entity>.CreateCursor(IChannelSourceHandle channelSource, IChannelHandle channel, BsonDocument commandResult)\r\n at async void MongoDB.Driver.Core.Operations.FindOperation<ET.Entity>+<ExecuteAsync>d129.MoveNext()\r\n at async void MongoDB.Driver.Core.Operations.FindOperation<ET.Entity>+<ExecuteAsync>d128.MoveNext()\r\n at async void MongoDB.Driver.OperationExecutor+<ExecuteReadOperationAsync>d3<MongoDB.Driver.IAsyncCursor<ET.Entity>>.MoveNext()\r\n at async void MongoDB.Driver.MongoCollectionImpl<ET.Entity>+<ExecuteReadOperationAsync>d99<MongoDB.Driver.IAsyncCursor<ET.Entity>>.MoveNext()\r\n at async void MongoDB.Driver.MongoCollectionImpl<ET.Entity>+<UsingImplicitSessionAsync>d107<MongoDB.Driver.IAsyncCursor<ET.Entity>>.MoveNext()\r\n at async void ET.Server.DBComponentSystem+<Query>d3<ET.Entity>.MoveNext() (at Assets/Scripts/Hotfix/Server/Module/DB/DBComponentSystem.cs:35)\n at Entity ET.ETTask<ET.Entity>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)\n at async ETTask<Entity> ET.Server.UnitCacheSystem.Get(UnitCache self, long unitId) (at Assets/Scripts/Hotfix/Server/Demo/UnitCache/UnitCacheSystem.cs:63)\n at Entity ET.ETTask<ET.Entity>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)\n at async ETTask<Entity> ET.Server.UnitCacheComponentSystem.Get(UnitCacheComponent self, long unitId, string key) (at Assets/Scripts/Hotfix/Server/Demo/UnitCache/UnitCacheComponentSystem.cs:56)\n at Entity ET.ETTask<ET.Entity>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)\n at async ETTask ET.Server.Other2UnitCache_GetUnitHandler.Run(Scene scene, Other2UnitCache_GetUnit request, UnitCache2Other_GetUnit response) (at Assets/Scripts/Hotfix/Server/Demo/UnitCache/Handler/Other2UnitCache_GetUnitHandler.cs:33)\n at Type MongoDB.Bson.Serialization.BsonSerializer.LookupActualType(Type nominalType, BsonValue discriminator)\r\n at Type MongoDB.Bson.Serialization.Conventions.StandardDiscriminatorConvention.GetActualType(IBsonReader bsonReader, Type nominalType)\r\n at Entity MongoDB.Bson.Serialization.BsonClassMapSerializer<ET.Entity>.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)\r\n at Entity MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize<Entity>(IBsonSerializer<Entity> serializer, BsonDeserializationContext context)\r\n at List<Entity> MongoDB.Driver.Core.Operations.CursorBatchDeserializationHelper.DeserializeBatch<Entity>(RawBsonArray batch, IBsonSerializer<Entity> documentSerializer, MessageEncoderSettings messageEncoderSettings)\r\n at CursorBatch<Entity> MongoDB.Driver.Core.Operations.FindOperation<ET.Entity>.CreateFirstCursorBatch(BsonDocument cursorDocument)\r\n at AsyncCursor<Entity> MongoDB.Driver.Core.Operations.FindOperation<ET.Entity>.CreateCursor(IChannelSourceHandle channelSource, IChannelHandle channel, BsonDocument commandResult)\r\n at async void MongoDB.Driver.Core.Operations.FindOperation<ET.Entity>+<ExecuteAsync>d129.MoveNext()\r\n at async void MongoDB.Driver.Core.Operations.FindOperation<ET.Entity>+<ExecuteAsync>d128.MoveNext()\r\n at async void MongoDB.Driver.OperationExecutor+<ExecuteReadOperationAsync>d3<MongoDB.Driver.IAsyncCursor<ET.Entity>>.MoveNext()\r\n at async void MongoDB.Driver.MongoCollectionImpl<ET.Entity>+<ExecuteReadOperationAsync>d99<MongoDB.Driver.IAsyncCursor<ET.Entity>>.MoveNext()\r\n at async void MongoDB.Driver.MongoCollectionImpl<ET.Entity>+<UsingImplicitSessionAsync>d107<MongoDB.Driver.IAsyncCursor<ET.Entity>>.MoveNext()\r\n at async void ET.Server.DBComponentSystem+<Query>d3<ET.Entity>.MoveNext() (at Assets/Scripts/Hotfix/Server/Module/DB/DBComponentSystem.cs:35)\n at Entity ET.ETTask<ET.Entity>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)\n at async ETTask<Entity> ET.Server.UnitCacheSystem.Get(UnitCache self, long unitId) (at Assets/Scripts/Hotfix/Server/Demo/UnitCache/UnitCacheSystem.cs:63)\n at Entity ET.ETTask<ET.Entity>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)\n at async ETTask<Entity> ET.Server.UnitCacheComponentSystem.Get(UnitCacheComponent self, long unitId, string key) (at Assets/Scripts/Hotfix/Server/Demo/UnitCache/UnitCacheComponentSystem.cs:56)\n at Entity ET.ETTask<ET.Entity>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)\n at async ETTask ET.Server.Other2UnitCache_GetUnitHandler.Run(Scene scene, Other2UnitCache_GetUnit request, UnitCache2Other_GetUnit response) (at Assets/Scripts/Hotfix/Server/Demo/UnitCache/Handler/Other2UnitCache_GetUnitHandler.cs:33)\n at void ET.ETTask.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:126)\n at async void ET.MessageHandler<ET.Scene, ET.Other2UnitCache_GetUnit, ET.UnitCache2Other_GetUnit>+<Handle>d__1.MoveNext() (at Assets/Scripts/Hotfix/Share/Module/Actor/MessageHandler.cs:67)\n”, “Unit” : null, “Entitys” : [] }
ET.RpcException: Rpc error: actorId: 1:7:1 request: ET.Other2UnitCache_GetUnit, response: { “_t” : “UnitCache2Other_GetUnit”, “RpcId” : 4, “Error” : 110307, “Message” : “MongoDB.Bson.BsonSerializationException: Ambiguous discriminator ‘RoleInfo’.\r\n\u007fMongoDB.Bson.BsonSerializationException: Ambiguous discriminator ‘RoleInfo’.\r\n at Type MongoDB.Bson.Serialization.BsonSerializer.LookupActualType(Type nominalType, BsonValue discriminator)\r\n at Type MongoDB.Bson.Serialization.Conventions.StandardDiscriminatorConvention.GetActualType(IBsonReader bsonReader, Type nominalType)\r\n at Entity MongoDB.Bson.Serialization.BsonClassMapSerializer<ET.Entity>.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)\r\n at Entity MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize<Entity>(IBsonSerializer<Entity> serializer, BsonDeserializationContext context)\r\n at List<Entity> MongoDB.Driver.Core.Operations.CursorBatchDeserializationHelper.DeserializeBatch<Entity>(RawBsonArray batch, IBsonSerializer<Entity> documentSerializer, MessageEncoderSettings messageEncoderSettings)\r\n at CursorBatch<Entity> MongoDB.Driver.Core.Operations.FindOperation<ET.Entity>.CreateFirstCursorBatch(BsonDocument cursorDocument)\r\n at AsyncCursor<Entity> MongoDB.Driver.Core.Operations.FindOperation<ET.Entity>.CreateCursor(IChannelSourceHandle channelSource, IChannelHandle channel, BsonDocument commandResult)\r\n at async void MongoDB.Driver.Core.Operations.FindOperation<ET.Entity>+<ExecuteAsync>d129.MoveNext()\r\n at async void MongoDB.Driver.Core.Operations.FindOperation<ET.Entity>+<ExecuteAsync>d128.MoveNext()\r\n at async void MongoDB.Driver.OperationExecutor+<ExecuteReadOperationAsync>d3<MongoDB.Driver.IAsyncCursor<ET.Entity>>.MoveNext()\r\n at async void MongoDB.Driver.MongoCollectionImpl<ET.Entity>+<ExecuteReadOperationAsync>d99<MongoDB.Driver.IAsyncCursor<ET.Entity>>.MoveNext()\r\n at async void MongoDB.Driver.MongoCollectionImpl<ET.Entity>+<UsingImplicitSessionAsync>d107<MongoDB.Driver.IAsyncCursor<ET.Entity>>.MoveNext()\r\n at async void ET.Server.DBComponentSystem+<Query>d3<ET.Entity>.MoveNext() (at Assets/Scripts/Hotfix/Server/Module/DB/DBComponentSystem.cs:35)\n at Entity ET.ETTask<ET.Entity>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)\n at async ETTask<Entity> ET.Server.UnitCacheSystem.Get(UnitCache self, long unitId) (at Assets/Scripts/Hotfix/Server/Demo/UnitCache/UnitCacheSystem.cs:63)\n at Entity ET.ETTask<ET.Entity>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)\n at async ETTask<Entity> ET.Server.UnitCacheComponentSystem.Get(UnitCacheComponent self, long unitId, string key) (at Assets/Scripts/Hotfix/Server/Demo/UnitCache/UnitCacheComponentSystem.cs:56)\n at Entity ET.ETTask<ET.Entity>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)\n at async ETTask ET.Server.Other2UnitCache_GetUnitHandler.Run(Scene scene, Other2UnitCache_GetUnit request, UnitCache2Other_GetUnit response) (at Assets/Scripts/Hotfix/Server/Demo/UnitCache/Handler/Other2UnitCache_GetUnitHandler.cs:33)\n at Type MongoDB.Bson.Serialization.BsonSerializer.LookupActualType(Type nominalType, BsonValue discriminator)\r\n at Type MongoDB.Bson.Serialization.Conventions.StandardDiscriminatorConvention.GetActualType(IBsonReader bsonReader, Type nominalType)\r\n at Entity MongoDB.Bson.Serialization.BsonClassMapSerializer<ET.Entity>.Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)\r\n at Entity MongoDB.Bson.Serialization.IBsonSerializerExtensions.Deserialize<Entity>(IBsonSerializer<Entity> serializer, BsonDeserializationContext context)\r\n at List<Entity> MongoDB.Driver.Core.Operations.CursorBatchDeserializationHelper.DeserializeBatch<Entity>(RawBsonArray batch, IBsonSerializer<Entity> documentSerializer, MessageEncoderSettings messageEncoderSettings)\r\n at CursorBatch<Entity> MongoDB.Driver.Core.Operations.FindOperation<ET.Entity>.CreateFirstCursorBatch(BsonDocument cursorDocument)\r\n at AsyncCursor<Entity> MongoDB.Driver.Core.Operations.FindOperation<ET.Entity>.CreateCursor(IChannelSourceHandle channelSource, IChannelHandle channel, BsonDocument commandResult)\r\n at async void MongoDB.Driver.Core.Operations.FindOperation<ET.Entity>+<ExecuteAsync>d129.MoveNext()\r\n at async void MongoDB.Driver.Core.Operations.FindOperation<ET.Entity>+<ExecuteAsync>d128.MoveNext()\r\n at async void MongoDB.Driver.OperationExecutor+<ExecuteReadOperationAsync>d3<MongoDB.Driver.IAsyncCursor<ET.Entity>>.MoveNext()\r\n at async void MongoDB.Driver.MongoCollectionImpl<ET.Entity>+<ExecuteReadOperationAsync>d99<MongoDB.Driver.IAsyncCursor<ET.Entity>>.MoveNext()\r\n at async void MongoDB.Driver.MongoCollectionImpl<ET.Entity>+<UsingImplicitSessionAsync>d107<MongoDB.Driver.IAsyncCursor<ET.Entity>>.MoveNext()\r\n at async void ET.Server.DBComponentSystem+<Query>d3<ET.Entity>.MoveNext() (at Assets/Scripts/Hotfix/Server/Module/DB/DBComponentSystem.cs:35)\n at Entity ET.ETTask<ET.Entity>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)\n at async ETTask<Entity> ET.Server.UnitCacheSystem.Get(UnitCache self, long unitId) (at Assets/Scripts/Hotfix/Server/Demo/UnitCache/UnitCacheSystem.cs:63)\n at Entity ET.ETTask<ET.Entity>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)\n at async ETTask<Entity> ET.Server.UnitCacheComponentSystem.Get(UnitCacheComponent self, long unitId, string key) (at Assets/Scripts/Hotfix/Server/Demo/UnitCache/UnitCacheComponentSystem.cs:56)\n at Entity ET.ETTask<ET.Entity>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)\n at async ETTask ET.Server.Other2UnitCache_GetUnitHandler.Run(Scene scene, Other2UnitCache_GetUnit request, UnitCache2Other_GetUnit response) (at Assets/Scripts/Hotfix/Server/Demo/UnitCache/Handler/Other2UnitCache_GetUnitHandler.cs:33)\n at void ET.ETTask.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:126)\n at async void ET.MessageHandler<ET.Scene, ET.Other2UnitCache_GetUnit, ET.UnitCache2Other_GetUnit>+<Handle>d__1.MoveNext() (at Assets/Scripts/Hotfix/Share/Module/Actor/MessageHandler.cs:67)\n”, “Unit” : null, “Entitys” : [] }
at IResponse ET.ETTask<ET.IResponse>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)
at async ETTask<IResponse> ET.MessageSenderStruct.Wait() (at Assets/Scripts/Core/Fiber/Module/Actor/MessageSenderStruct.cs:39)
at IResponse ET.ETTask<ET.IResponse>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)
at async ETTask<IResponse> ET.ProcessInnerSenderSystem.Call(ProcessInnerSender self, ActorId actorId, IRequest request, bool needException) (at Assets/Scripts/Core/Fiber/Module/Actor/ProcessInnerSenderSystem.cs:179)
at IResponse ET.ETTask<ET.IResponse>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)
at async ETTask<IResponse> ET.Server.MessageSenderSystem.Call(MessageSender self, ActorId actorId, IRequest request, bool needException) (at Assets/Scripts/Hotfix/Server/Module/Message/MessageSenderSystem.cs:51)
at IResponse ET.ETTask<ET.IResponse>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)
at async ETTask<Unit> ET.Server.UnitCacheHelper.GetUnitCache(Scene root, long unitId) (at Assets/Scripts/Hotfix/Server/Demo/UnitCache/UnitCacheHelper.cs:35)
at Unit ET.ETTask<ET.Unit>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)
at async ETTask<ValueTuple<bool, Unit>> ET.Server.UnitHelper.LoadUnit(Player player) (at Assets/Scripts/Hotfix/Server/Demo/Map/Unit/UnitHelper.cs:57)
at IResponse ET.ETTask<ET.IResponse>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)
at async ETTask<IResponse> ET.MessageSenderStruct.Wait() (at Assets/Scripts/Core/Fiber/Module/Actor/MessageSenderStruct.cs:39)
at IResponse ET.ETTask<ET.IResponse>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)
at async ETTask<IResponse> ET.ProcessInnerSenderSystem.Call(ProcessInnerSender self, ActorId actorId, IRequest request, bool needException) (at Assets/Scripts/Core/Fiber/Module/Actor/ProcessInnerSenderSystem.cs:179)
at IResponse ET.ETTask<ET.IResponse>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)
at async ETTask<IResponse> ET.Server.MessageSenderSystem.Call(MessageSender self, ActorId actorId, IRequest request, bool needException) (at Assets/Scripts/Hotfix/Server/Module/Message/MessageSenderSystem.cs:51)
at IResponse ET.ETTask<ET.IResponse>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)
at async ETTask<Unit> ET.Server.UnitCacheHelper.GetUnitCache(Scene root, long unitId) (at Assets/Scripts/Hotfix/Server/Demo/UnitCache/UnitCacheHelper.cs:35)
at Unit ET.ETTask<ET.Unit>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)
at async ETTask<ValueTuple<bool, Unit>> ET.Server.UnitHelper.LoadUnit(Player player) (at Assets/Scripts/Hotfix/Server/Demo/Map/Unit/UnitHelper.cs:57)
at ValueTuple<bool, Unit> ET.ETTask<System.ValueTuple<bool, ET.Unit>>.GetResult() (at Assets/Scripts/ThirdParty/ETTask/ETTask.cs:246)
at async ETTask ET.Server.C2G_EnterMapHandler.Run(Session session, C2G_EnterMap request, G2C_EnterMap response) (at Assets/Scripts/Hotfix/Server/Demo/Gate/C2G_EnterMapHandler.cs:84)