You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An ArgumentException and many other similar exceptions are occuring whenever building a Unity build with Parse onto a WebGL release. This exception occurs as soon as the project is run in the browser, as well as whenever I attempt to use any Parse methods, such as ParseClient.Instance.LogInAsync(string username, string password) in the browser.
Example Exception:
ArgumentException: Cannot register a type that does not implement the default constructor!
at Parse.Platform.Objects.ParseObjectClassController.AddValid (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
When exceptions are set to display the full exception and stack trace in the build settings, I also get this as the first exception, but in any attempts after that (for instance, in the Update loop), I instead get a NullReferenceException.
ArgumentException:
ArgumentException: Cannot register a type that does not implement the default constructor!
at Parse.Platform.Objects.ParseObjectClassController.AddValid (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at Parse.Platform.Objects.ParseObjectClassController.AddIntrinsic () [0x00000] in <00000000000000000000000000000000>:0
at Parse.ParseClient..ctor (Parse.Abstractions.Infrastructure.IServerConnectionData configuration, Parse.Abstractions.Infrastructure.IServiceHub serviceHub, Parse.Abstractions.Infrastructure.IServiceHubMutator[] configurators) [0x00000] in <00000000000000000000000000000000>:0
at ParseClientInitializer.Awake () [0x00000] in <00000000000000000000000000000000>:0
NullReferenceException:
System.NullReferenceException: Object reference not set to an instance of an object.
at Parse.UserServiceExtensions.LogInAsync (Parse.Abstractions.Infrastructure.IServiceHub serviceHub, System.String username, System.String password, System.Threading.CancellationToken cancellationToken) [0x00000] in <00000000000000000000000000000000>:0
at ParseClientInitializer.LoginParseClient (LoginCredentials loginCreds) [0x00000] in <00000000000000000000000000000000>:0
at JavascriptHook.ReceiveLoginCredentials (System.String loginJson) [0x00000] in <00000000000000000000000000000000>:0
at JavascriptHook.Start () [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0
at JavascriptHook.Start () [0x00000] in <00000000000000000000000000000000>:0
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
JavascriptHook:ReceiveLoginCredentials(String)
<Start>d__6:MoveNext()
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start(<Start>d__6&)
JavascriptHook:Start()
Full example code:
void Awake()
{
var connectionDataClient = new ParseClient(new ServerConnectionData
{
ApplicationID = "APP_ID",
ServerURI = "http://127.0.0.1:1337/parse/",
Key = "FAKE_API_KEY",
MasterKey = "FAKE_MASTER_KEY"
},
new LateInitializedMutableServiceHub { },
new MetadataMutator
{
EnvironmentData = new EnvironmentData { OSVersion = SystemInfo.operatingSystem, Platform = $"Unity {Application.unityVersion} on {SystemInfo.operatingSystemFamily}", TimeZone = TimeZoneInfo.Local.StandardName },
HostManifestData = new HostManifestData { Name = Application.productName, Identifier = Application.productName, ShortVersion = Application.version, Version = Application.version }
},
new AbsoluteCacheLocationMutator
{
CustomAbsoluteCacheFilePath = $"{Application.persistentDataPath.Replace('/', Path.DirectorySeparatorChar)}{Path.DirectorySeparatorChar}Parse.cache"
}
);
connectionDataClient.Publicize();
}
public void LoginParseClient(string username, string password)
{
ParseClient.Instance.LogInAsync(username, password);
}
public void Start() {
LoginParseClient("myUsername", "myPassword");
}
Has anyone else encountered this issue before? Is there any workarounds, or is Unity web deployment not supported?
Steps to reproduce
Create a unity project. Add Parse.dll to Assets/Plugins.
Create a code file with a ParseClient initialization connecting to an existing parse server with code for logging in a user with LogInAsync.
Observe that the code runs correctly when running on a local test.
Set target build platform to WebGL
Set webGL settings for maximum web compatability. Build settings --> Publishing settings --> Turn on stack traces, set compression to Gzip, turn on compression fallback
Build and run
Actual Outcome
When loading in files that use code from ParseInfrastructure, it causes an ArgumentException on startup. From then on, any uses of the code cause a NullReferenceException. The errors and stack traces are seen above.
Expected Outcome
The code should simply log in the user.
Environment
Unity 2022.3.31f1
Server
Parse Server version: 3.0.2
Operating system: MacOS Sonoma 14.4.1
Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local
Database
System (MongoDB or Postgres): MongoDB
Database version: n/a
Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Local
Client
Parse .NET SDK version: 3.0.2
Logs
The text was updated successfully, but these errors were encountered:
🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.
I replicated the issue on Unity 2022.3.37f1, exploring currently to see if I can determine the root cause.
I've tried probably a dozen different variations of similar code and I continue to reproduce the issue, I will genuinely be shocked if this is a result of user error. There may be some incompatability or something at play, but I think the code is solid.
Is Unity WebGL intended to be supported by Parse, but has this critical issue? Or is it not supported, and this is what happens when you try to use it? The docs don't explicitly say what Unity platforms are supported, and this is the only thing I could find which seems to be indicating its not.
New Issue Checklist
Issue Description
An ArgumentException and many other similar exceptions are occuring whenever building a Unity build with Parse onto a WebGL release. This exception occurs as soon as the project is run in the browser, as well as whenever I attempt to use any Parse methods, such as ParseClient.Instance.LogInAsync(string username, string password) in the browser.
Example Exception:
When exceptions are set to display the full exception and stack trace in the build settings, I also get this as the first exception, but in any attempts after that (for instance, in the Update loop), I instead get a NullReferenceException.
ArgumentException:
NullReferenceException:
Full example code:
Has anyone else encountered this issue before? Is there any workarounds, or is Unity web deployment not supported?
Steps to reproduce
Actual Outcome
When loading in files that use code from ParseInfrastructure, it causes an ArgumentException on startup. From then on, any uses of the code cause a NullReferenceException. The errors and stack traces are seen above.
Expected Outcome
The code should simply log in the user.
Environment
Unity 2022.3.31f1
Server
3.0.2
MacOS Sonoma 14.4.1
Local
Database
MongoDB
n/a
Local
Client
3.0.2
Logs
The text was updated successfully, but these errors were encountered: