Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

[C#] System.TypeInitializationException whenever creating BitStream #59

Open
alejzeis opened this issue Apr 28, 2015 · 0 comments
Open

Comments

@alejzeis
Copy link

Hey guys,

I am mostly a Java guy doing a lot of Minecraft: Pocket Edition Server development. MCPE uses RakNet as it's networking library, so with the Oculus purchase I thought that maybe I could use RakNet with C# as C# is similar to Java. I had some trouble compiling, but I finally got the C# code generated somehow, and I used VS2013 Community to compile it into a DLL. I added it into my project, and once I start receiving packets, the program crashes as I try to create a BitStream for each packet. A System.TypeInitalizationException is thrown. I have searched google for this, and turned up with nothing.

private void handlePacket(byte[] buffer)
        {
            BitStream bs = new BitStream(buffer, (uint)buffer.Length, false);

            byte packetID;
            bs.Read(out packetID);
            switch (packetID)
            {
                default:
                    logger.Info("Got a packet: " + packetID);
                    break;
            }
        }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant