Client api throws exception when I call constructor

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

anton melegov
Posts: 12
Joined: 18 May 2015, 10:21

Client api throws exception when I call constructor

Postby anton melegov » 26 Jun 2015, 15:07

Platform android. Stack trace:
06-26 17:54:18.150: I/Unity(30411): TypeLoadException: A type load exception has occurred.
06-26 17:54:18.150: I/Unity(30411): at Sfs2X.SmartFox..ctor (Boolean debug) [0x00000] in <filename unknown>:0
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Client api throws exception when I call constructor

Postby Lapo » 28 Jun 2015, 17:55

Hi,
would you mind adding more details?
Such as the API version, Unity version, which DLL you're using (we ship three), the code that crashes.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
anton melegov
Posts: 12
Joined: 18 May 2015, 10:21

Re: Client api throws exception when I call constructor

Postby anton melegov » 30 Jun 2015, 07:45

Unity 5.1.0f3. Smartfox Version: 1.6.0 C# API. The code is so simple:

Code: Select all

            try
            {
                _smartFox = new SmartFox(true);
            }
            catch (Exception e)
            {
                Debug.LogException(e);
                return;
            }
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Client api throws exception when I call constructor

Postby Bax » 01 Jul 2015, 07:20

Can you send your test project by email?
Also, when do you get that error? When running the project in the Unity Editor or publishing it to the device?
Paolo Bax
The SmartFoxServer Team
anton melegov
Posts: 12
Joined: 18 May 2015, 10:21

Re: Client api throws exception when I call constructor

Postby anton melegov » 01 Jul 2015, 10:23

It is not a test project I cannot send it for u, sorry. In editor all works fine. Issue was appeared after client API was updated to new version. Previous version was working with same code
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Client api throws exception when I call constructor

Postby Lapo » 01 Jul 2015, 10:37

Can you create a small basic project and see if it gives you the same issue?
If it's not reproducible there might be something else going on.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
anton melegov
Posts: 12
Joined: 18 May 2015, 10:21

Re: Client api throws exception when I call constructor

Postby anton melegov » 07 Jul 2015, 09:06

I was sent a email on support@smartfoxserver.com
anton melegov
Posts: 12
Joined: 18 May 2015, 10:21

Re: Client api throws exception when I call constructor

Postby anton melegov » 08 Jul 2015, 13:40

Doesn't work with stripmode enabled. Try to avoid using reflection. Please fix
Attachments
rsuAsn6p0ax1qdRRcXRwQ.jpg
(74.43 KiB) Not downloaded yet
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Client api throws exception when I call constructor

Postby Lapo » 08 Jul 2015, 14:06

Unfortunately this is not possible as reflection is an integral part of the API and allows for exchange of custom defined types between client and server.
Lapo

--

gotoAndPlay()

...addicted to flash games
anton melegov
Posts: 12
Joined: 18 May 2015, 10:21

Re: Client api throws exception when I call constructor

Postby anton melegov » 08 Jul 2015, 15:10

Sad =(
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Client api throws exception when I call constructor

Postby Lapo » 08 Jul 2015, 15:35

In all fairness the difference between Level 3 stripping and No-Stripping with our Advanced Connector is a meager 900Kb.
I don't think it's worth being sad :)
Lapo

--

gotoAndPlay()

...addicted to flash games
anton melegov
Posts: 12
Joined: 18 May 2015, 10:21

Re: Client api throws exception when I call constructor

Postby anton melegov » 14 Jul 2015, 09:05

Did you compare builds on WebGL platform with stripping disabled|enabled? In real project it will be hundreds of megabytes difference between
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Client api throws exception when I call constructor

Postby Lapo » 15 Jul 2015, 10:25

I don't think I understand your comment.
The stripping level deals with code not assets. How can it possibly generate hundreds of megabytes of compiled code?

You asked if we compared the WebGL export. Yes we did.
I have tested the official Unity demo called Survival Shooter:
https://unity3d.com/learn/tutorials/pro ... al-shooter

It produces 108MB of data with no stripping and 108MB of data with Stripping level 3. No difference.

Similarly it produces a minor difference for Android build, roughly 2MB of difference for a 50MB apk file.

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 75 guests