pan andrzej
pan andrzej
Explore posts from servers
CC#
Created by pan andrzej on 5/8/2023 in #help
❔ Realm .NET Error
I need help with Realm .NET. I'm making a plugin for unity game and I have server hosted on linux and I'm making a plugin on windows 10. Here's sample of my code:
public async Task MongoDBConnect()
{
var app = App.Create("my-realm");

var user = await app.LogInAsync(Credentials.Anonymous());

var mongoClient = user.GetMongoClient("mongodb://user:password@ip:port/&authSource=admin&connectTimeoutMS=1000&socketTimeoutMS=1000&serverSelectionTimeoutMS=1000");
var database = mongoClient.GetDatabase("db");
collection = (IMongoCollection<PlayerModel>)database.GetCollection<PlayerModel>("playerdatas");
}
public async Task MongoDBConnect()
{
var app = App.Create("my-realm");

var user = await app.LogInAsync(Credentials.Anonymous());

var mongoClient = user.GetMongoClient("mongodb://user:password@ip:port/&authSource=admin&connectTimeoutMS=1000&socketTimeoutMS=1000&serverSelectionTimeoutMS=1000");
var database = mongoClient.GetDatabase("db");
collection = (IMongoCollection<PlayerModel>)database.GetCollection<PlayerModel>("playerdatas");
}
And this code (excatly App.Create) is throwing this error:
System.TypeInitializationException: The type initializer for 'Realms.Sync.AppHandle' threw an exception. ---> System.DllNotFoundException: realm-wrappers
at (wrapper managed-to-native) Realms.SynchronizationContextScheduler.install_scheduler_callbacks(Realms.SynchronizationContextScheduler/get_context,Realms.SynchronizationContextScheduler/post_on_context,Realms.SynchronizationContextScheduler/release_context,Realms.SynchronizationContextScheduler/is_on_context)
--- End of inner exception stack trace ---
System.TypeInitializationException: The type initializer for 'Realms.Sync.AppHandle' threw an exception. ---> System.DllNotFoundException: realm-wrappers
at (wrapper managed-to-native) Realms.SynchronizationContextScheduler.install_scheduler_callbacks(Realms.SynchronizationContextScheduler/get_context,Realms.SynchronizationContextScheduler/post_on_context,Realms.SynchronizationContextScheduler/release_context,Realms.SynchronizationContextScheduler/is_on_context)
--- End of inner exception stack trace ---
and actually error says about missing realm-wrappers.dll, and problem is that it's generating only files for windows (x64 and x86). What I can do in that situation?
2 replies
CC#
Created by pan andrzej on 5/1/2023 in #help
❔ MongoDB.Driver.MongoConnectionException:
Hi, I have problem with finding document in MongoDB collection. Whenever method collection.find is fired, it throws this error: MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---> System.MissingMethodException: void System.Security.Cryptography.Rfc2898DeriveBytes..ctor(string,byte[],int,System.Security.Cryptography.HashAlgorithmName) here's code:
var client = new MongoClient("here's my uri");
var database = client.GetDatabase("test");
var collection = database.GetCollection<PlayerModel>("playerdatas");

var playerFilter = Builders<PlayerModel>.Filter.Eq("SteamID", player.UserId);
//this line throws error
var playerData = collection.Find(playerFilter).FirstOrDefault();
var client = new MongoClient("here's my uri");
var database = client.GetDatabase("test");
var collection = database.GetCollection<PlayerModel>("playerdatas");

var playerFilter = Builders<PlayerModel>.Filter.Eq("SteamID", player.UserId);
//this line throws error
var playerData = collection.Find(playerFilter).FirstOrDefault();
I'm using .NET framework 4.8.1, mongoDB 2.19.1 and Scram-SHA-1. Anyone know why it's happening?
8 replies