2

After upgrading my .NET server and client projects to 4.0 RC I get NullReference exceptions because my custom State object is null. I instantiate the state property in OnOpen event handler, but inside the method body of the first call it is already null.

I have checked in debugger and see that this.GetHashCode() returns different values in OnOpen event handler and in method, which means it is a different instance.

Is it a known issue? I assume it is very basic behavior and probably I have missed something during upgrade to new version.

Thanks in advance.

Alex Michel
  • 416
  • 3
  • 13

2 Answers2

2

I managed to understand the problem. It happens when using PluginAlias. [XSocketMetadata(PluginAlias = When attribute is removed and client uses full controller name everything works as expected and GetHashCode returns same id.

I pushed the replication code to GitHub: https://github.com/amichel/PlayWithXSockets/tree/ReproduceBugs

Alex Michel
  • 416
  • 3
  • 13
1

When using alias there is a bug (as you have found out). The workaround is to either use the class name of the controller or only have alias in lower casing.

In your case using

[XSocketMetadata(PluginAlias = "test")]

would work.

Regards Uffe

Uffe
  • 2,275
  • 1
  • 13
  • 9