C# error System.NullReferenceException

前端 未结 3 1480
情深已故
情深已故 2021-01-28 17:00

I have some problems with System.NullReferenceException. When server do things and we first check user is not null and then he disconnect and server progress something and it tr

3条回答
  •  广开言路
    2021-01-28 17:32

    Who is setting User to null and where? While your thread sleeps, somebody is obviously setting the User variable to null, causing the crash.

    Besides: "Magical sleeps" will not solve any problems. You need proper locking here.

提交回复
热议问题