Has anyone successfully used RavenDB 4.0 with Unity3d? I am starting to think it is just not compatible.

437 views
Skip to first unread message

MostHated

unread,
Apr 23, 2018, 10:38:57 PM4/23/18
to RavenDB - 2nd generation document database
Hey there all,
    I have been fighting all day trying to get RavenDB working with Unity3d, but I am just am not sure now if it is compatible anymore. I know 3.x was as the game framework I am trying to use used to use it, but I have been trying to upgrade it all day and keep running into issues left and right. Has anyone been able to successfully use it?

Thanks!

Oren Eini (Ayende Rahien)

unread,
Apr 24, 2018, 3:58:08 AM4/24/18
to ravendb
What issue are you running into?

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

M374llic4

unread,
Apr 24, 2018, 2:00:05 PM4/24/18
to rav...@googlegroups.com
Well, from what I just learned the current version of the game engine doesn't seem to work right with netstandard 2.0 yet. Not until the next release. I was having issues such as the below :

The type `System.Linq.IOrderedEnumerable`1<TSource>' is defined in an assembly that is not referenced. Consider adding a reference to assembly `netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'

I guess that would explain why though. They had some facade dlls you can use for System.Runtime, System.Resources.ResourcesManager, and System.Collections, but I am not sure they are going to fix the issue with it looking for .netstandard 2.0.0.0. 

MostHated

unread,
Apr 24, 2018, 7:05:54 PM4/24/18
to RavenDB - 2nd generation document database
Looks like I might have this worked out. Unity 2017.4 doesn't allow .netstandard 2.0.0.0, I updated to 2018.1 beta 13 and it seems like it should be ok there. While technically still beta the final release should actually come out sometime this week. They said last month it would be released in April. 

MostHated

unread,
Apr 24, 2018, 8:22:24 PM4/24/18
to RavenDB - 2nd generation document database
I take it back. I keep getting the error of :

ArgumentException: Object of type 'System.Reflection.BindingFlags' cannot be converted to type 'Newtonsoft.Json.Utilities.BindingFlags'.
Rethrow as TypeInitializationException: The type initializer for 'Raven.Client.Documents.Conventions.DocumentConventions' threw an exception.

MostHated

unread,
Apr 24, 2018, 8:45:07 PM4/24/18
to RavenDB - 2nd generation document database
As well as these it looks like.

Begin MonoManager ReloadAssembly
Could not load signature of Raven.Client.Documents.Linq.RavenQueryProviderProcessor`1[T]:HandleLoad due to: Could not load file or assembly 'Lambda2Js.Signed, Version=3.1.0.0, Culture=neutral, PublicKeyToken=9ba16f7edfc48fe6' or one of its dependencies. assembly:Lambda2Js.Signed, Version=3.1.0.0, Culture=neutral, PublicKeyToken=9ba16f7edfc48fe6 type:<unknown type> member:(null) signature:<none>
Could not load signature of Sparrow.Json.AsyncBlittableJsonTextWriter:MaybeOuterFlsuhAsync due to: Could not load file or assembly 'System.Threading.Tasks.Extensions, Version=4.1.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. assembly:System.Threading.Tasks.Extensions, Version=4.1.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 type:<unknown type> member:(null) signature:<none>

MostHated

unread,
Apr 24, 2018, 9:48:31 PM4/24/18
to RavenDB - 2nd generation document database
Unity does not let you install NuGet packages, I built the Raven.Client and Sparrow dlls from the source I downloaded and I put those two into my Unity project along with a Newtonsoft.Json 10.0.3 dll. Does Raven have built in the other things that it needs?


On Monday, April 23, 2018 at 9:38:57 PM UTC-5, MostHated wrote:

MostHated

unread,
Apr 24, 2018, 10:52:48 PM4/24/18
to RavenDB - 2nd generation document database
Sorry to keep adding to this, but I believe I made some progress. I moved this method outside of my DatabaseFactory.cs and into its own class file and called it and it no longer gave the above error when it got to DocumentStore.Initialize()
   
 public static IDocumentStore Initialize(string db)
    {
        var store = new DocumentStore
        {
            
        Urls = new[] { "http://localhost:8080" },
            Database = db,
        }.Initialize();
        return store;
    }

But, now I am getting the below error and I am not sure why. I am running the DB locally on my Windows 10 machine with no security for testing.


[Exception] NotImplementedException: The method or operation is not implemented.
HttpClientHandler.get_ServerCertificateCustomValidationCallback()    <20a8f293e89843148f03a963627efba4>:0


RequestExecutor.CreateHttpMessageHandler()    <c1b755c86a3a4cafbdaae7b2e82493b5>:0

RequestExecutor.CreateClient()    <c1b755c86a3a4cafbdaae7b2e82493b5>:0

System.Lazy`1[T].CreateValue()    <e1a80661d61443feb3dbdaac88eeb776>:0

System.Lazy`1[T].LazyInitValue()    <e1a80661d61443feb3dbdaac88eeb776>:0

System.Lazy`1[T].get_Value()    <e1a80661d61443feb3dbdaac88eeb776>:0

RequestExecutor.GetCachedOrCreateHttpClient()    <c1b755c86a3a4cafbdaae7b2e82493b5>:0

Raven.Client.Http.RequestExecutor..ctor()    <c1b755c86a3a4cafbdaae7b2e82493b5>:0

Oren Eini (Ayende Rahien)

unread,
Apr 25, 2018, 6:56:51 AM4/25/18
to ravendb
In what env are you actually running this?


Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


M374llic4

unread,
Apr 25, 2018, 11:57:28 AM4/25/18
to rav...@googlegroups.com
What specifically would you need to know? The environment is within the Unity3d game engine v2018.1 on windows 10 x64. 

Unity 2018.1 is based on Mono, has C# 6, .NET 4.7.1 class libraries, Support for assemblies built against .NET Standard 2.0 and 1.x

It definitely seems like it is very close to working. I just am not sure why this current error is happening. It seems to be from within the Raven.Client. 

Looking deeper into the error log and not just at the console shows this : 

NotImplementedException: The method or operation is not implemented.
  at System.Net.Http.HttpClientHandler.get_ServerCertificateCustomValidationCallback () [0x00000] in <20a8f293e89843148f03a963627efba4>:0 
  at Raven.Client.Http.RequestExecutor.CreateHttpMessageHandler (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, System.Boolean setSslProtocols, System.Boolean useCompression, System.Boolean hasExplicitlySetCompressionUsage) [0x00051] in <c1b755c86a3a4cafbdaae7b2e82493b5>:0 
  at Raven.Client.Http.RequestExecutor.CreateClient () [0x0001d] in <c1b755c86a3a4cafbdaae7b2e82493b5>:0 
  at System.Lazy`1[T].CreateValue () [0x00081] in <e1a80661d61443feb3dbdaac88eeb776>:0 '

It goes on for another 20 lines or so.

Federico Lois

unread,
Apr 25, 2018, 2:16:01 PM4/25/18
to rav...@googlegroups.com
That looks very much missing functionality on mono for client certificate validation. 

To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

M374llic4

unread,
Apr 25, 2018, 2:51:24 PM4/25/18
to rav...@googlegroups.com
My DB is local with no security setup, should / would that still cause an issue if I am not using any validation? 

To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

M374llic4

unread,
Apr 26, 2018, 12:50:06 AM4/26/18
to rav...@googlegroups.com
Oh well, I certainly tried. It looks like there is indeed an issue with the Mono used in even the newest version of Unity that I just won't be able to get around. Which is a shame as I really wanted to use Raven.

Oren Eini (Ayende Rahien)

unread,
Apr 26, 2018, 3:36:07 AM4/26/18
to ravendb
We'll have an update today or tomorrow that should resolve this issue.

M374llic4

unread,
Apr 26, 2018, 3:38:24 AM4/26/18
to rav...@googlegroups.com
Oh wow, really? That is fantastic, thank you so much!

M374llic4

unread,
Apr 27, 2018, 6:14:58 PM4/27/18
to rav...@googlegroups.com
This could probably be immature and a result of my impatience, but I saw a commit was done in regards to my issue so I built it from source and was eager to try it and came across another issue. It made it past the original it looks like. I wanted to make sure to report it anyways in case it was not known. It now gets to this point below and has a hold up. I first tried to connect to my DB that is on a remote test server and has security setup. I have a cert on both ends and here is how I tried to use it.

 have in my connection code the following :         readonly X509Certificate2 cert = new X509Certificate2("C:\\Users\\Home\\Downloads\\REDACTED.Cluster.Settings (1)\\admin.client.certificate.REDACTED.pfx");

Then using this code.

 public static IDocumentStore Initialize(string db, X509Certificate2 cert)
        {
            var store = new DocumentStore
            {
                //Urls = new[] {"http://127.0.0.1:8080"},
                Urls = new[]
                {
                    "https://a. REDACTED .ravendb.community:8889",
                    "https://rpg. REDACTED .io:8889"
                },
                Database = db,
                Certificate = cert,
            }.Initialize();
            Debug.Log("Initialized");
            return store;
        }

Which then gave the errors below

NotImplementedException: The method or operation is not implemented.
  at System.Net.Http.HttpClientHandler.get_ClientCertificates () [0x00000] in <20a8f293e89843148f03a963627efba4>:0 
  at Raven.Client.Http.RequestExecutor.CreateHttpMessageHandler (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, System.Boolean setSslProtocols, System.Boolean useCompression, System.Boolean hasExplicitlySetCompressionUsage) [0x000e3] in <9bb7c7950fe245dd93cfddb648c2ace4>:0 
  at Raven.Client.Http.RequestExecutor.CreateClient () [0x0001d] in <9bb7c7950fe245dd93cfddb648c2ace4>:0 
  at System.Lazy`1[T].CreateValue () [0x00081] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Lazy`1[T].LazyInitValue () [0x00080] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Lazy`1[T].get_Value () [0x0003a] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Raven.Client.Http.RequestExecutor.GetCachedOrCreateHttpClient (System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue] httpClientCache) [0x00032] in <9bb7c7950fe245dd93cfddb648c2ace4>:0 
  at Raven.Client.Http.RequestExecutor..ctor (System.String databaseName, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate


So I took the code above, commented out the remote connection code and used just the 127.0.0.1 url and started up a local unsecured database to test out just connecting (removed the Certificate = cert; from the code as well)  and then got the following error:


MissingFieldException: Field 'Raven.Client.Http.RavenCommand`1/<ProcessResponse>d__30<TResult_REF>.<>4__this' not found.
  at Raven.Client.Http.RequestExecutor+<ExecuteAsync>d__74`1[TResult].MoveNext () [0x00a68] in <9bb7c7950fe245dd93cfddb648c2ace4>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Raven.Client.Http.RequestExecutor+<ExecuteAsync>d__74`1[TResult].MoveNext () [0x00c1e] in <9bb7c7950fe245dd93cfddb648c2ace4>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Raven.Client.Http.RequestExecutor+<UpdateTopologyAsync>d__62.MoveNext () [0x00164] in <9bb7c7950fe245dd93cfddb648c2ace4>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Raven.Client.Http.RequestExecutor+<FirstTopologyUpdate>d__69.MoveNext () [0x000ea] in <9bb7c7950fe245dd93cfddb648c2ace4>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Raven.Client.Util.AsyncHelpers.RunSync (System.Func`1[TResult] task) [0x0008a] in <9bb7c7950fe245dd93cfddb648c2ace4>:0 
  at Raven.Client.Http.RequestExecutor.Execute[TResult] (Raven.Client.Http.RavenCommand`1[TResult] command, Sparrow.Json.JsonOperationContext context, Raven.Client.Documents.Session.SessionInfo sessionInfo) [0x00005] in <9bb7c7950fe245dd93cfddb648c2ace4>:0 
  at Raven.Client.Documents.Session.DocumentQuery`1[T].ExecuteActualQuery () [0x0002f] in <9bb7c7950fe245dd93cfddb648c2ace4>:0 
  at Raven.Client.Documents.Session.DocumentQuery`1[T].InitSync () [0x0002e] in <9bb7c7950fe245dd93cfddb648c2ace4>:0 
  at Raven.Client.Documents.Session.DocumentQuery`1[T].ExecuteQueryOperation (System.Nullable`1[T] take) [0x00050] in <9bb7c7950fe245dd93cfddb648c2ace4>:0 
  at Raven.Client.Documents.Session.DocumentQuery`1[T].GetEnumerator () [0x00000] in <9bb7c7950fe245dd93cfddb648c2ace4>:0 
  at Raven.Client.Documents.Linq.RavenQueryInspector`1[T].GetEnumerator () [0x00011] in <9bb7c7950fe245dd93cfddb648c2ace4>:0 
  at System.Collections.Generic.LargeArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x00000] in <839a3cb835c04d14aeb58d83bb7bc4bd>:0 
  at System.Collections.Generic.EnumerableHelpers.ToArray[T] (System.Collections.Generic.IEnumerable`1[T] source) [0x00033] in <839a3cb835c04d14aeb58d83bb7bc4bd>:0 
  at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00018] in <839a3cb835c04d14aeb58d83bb7bc4bd>:0 


I definitely appreciate you guys looking into this. I, for one, really hope to be able to use Raven in my game and I am sure once I start telling other people about it and they see how easy it is to actually implement into Unity once it actually works, hopefully it will open a relatively unknown door from the Unity community. : D

M374llic4

unread,
Apr 27, 2018, 6:15:55 PM4/27/18
to rav...@googlegroups.com
I meant "premature" no "immature", lol.

Oren Eini (Ayende Rahien)

unread,
Apr 27, 2018, 6:21:20 PM4/27/18
to ravendb
It looks like you mixed up some dlls.
When you compile from source, you need to take _all_ the dlls.
Easiest way to do that is to run the ./build.ps1 script

M374llic4

unread,
Apr 27, 2018, 6:24:10 PM4/27/18
to rav...@googlegroups.com
Oh ok, thanks for the reply, I will give that a try now.

M374llic4

unread,
Apr 27, 2018, 6:40:38 PM4/27/18
to rav...@googlegroups.com
I had to change my script execution in powershell, but I keep getting NPM not found in path. I can't seem to find how to install npm in powershell.

Oren Eini (Ayende Rahien)

unread,
Apr 27, 2018, 6:42:46 PM4/27/18
to ravendb

M374llic4

unread,
Apr 27, 2018, 6:44:19 PM4/27/18
to rav...@googlegroups.com
Ah, my apologies, I went to the site but didnt see a link anywhere aside from their pricing page and all that. Installing now. : D

M374llic4

unread,
Apr 27, 2018, 7:32:16 PM4/27/18
to rav...@googlegroups.com
Man, I can't win today. I got git installed and all that, but its saying my node is incompatible now, yet : 

C:\Users\Home\Downloads\ravendb-4.0 (1)\ravendb-4.0> .\build.ps1

Incompatible Node.js version. Must be 6 or later.
At C:\Users\Home\Downloads\ravendb-4.0 (1)\ravendb-4.0\scripts\checkPrerequisites.ps1:27 char:9
+         throw "Incompatible Node.js version. Must be 6 or later."
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Incompatible No... be 6 or later.:String) [], RuntimeException
    + FullyQualifiedErrorId : Incompatible Node.js version. Must be 6 or later.

C:\Users\Home\Downloads\ravendb-4.0 (1)\ravendb-4.0> node -v
v10.0.0

I am not sure what it is checking for exactly then? I installed from the link you sent me.

Oren Eini (Ayende Rahien)

unread,
Apr 27, 2018, 7:36:29 PM4/27/18
to ravendb
Try just commenting this

MostHated

unread,
Apr 27, 2018, 7:53:41 PM4/27/18
to RavenDB - 2nd generation document database
Ok, awesome. I had to delete the folder I downlaoded as zip and then pul; in powershell from github directly so that it knew it was a repo, then I ran it again after that and it is in process of building now. *fingers crossed* it will be ok after that. : D

MostHated

unread,
Apr 27, 2018, 7:55:04 PM4/27/18
to RavenDB - 2nd generation document database
I spoke to soon.. :



> node ./dist/install.js

!!!!!!!!!!!
typings-global is obsolete! Remove it!
Use `yarn add --dev @types/node` instead!
!!!!!!!!!!!
added 863 packages in 105.348s
Update version.json...

> Raven....@1.0.0 gulp C:\ravendb\src\Raven.Studio
> gulp "release"

gulp[26208]: src\node_contextify.cc:631: Assertion `args[1]->IsString()' failed.
 1: node::DecodeWrite
 2: node::DecodeWrite
 3: uv_loop_fork
 4: v8::internal::interpreter::BytecodeDecoder::Decode
 5: v8::internal::RegExpImpl::Exec
 6: v8::internal::RegExpImpl::Exec
 7: v8::internal::RegExpImpl::Exec
 8: 0000021639E04281
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! Raven....@1.0.0 gulp: `gulp "release"`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the Raven....@1.0.0 gulp script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Home\AppData\Roaming\npm-cache\_logs\2018-04-27T23_53_48_021Z-debug.log
EXE RETURNED EXIT CODE 134
CALLSTACK:
Command           Arguments                                                     Location
-------           ---------                                                     --------
CheckLastExitCode {}                                                            checkLastExitCode.ps1: line 11
BuildStudio       {srcDir=C:\ravendb\src\Raven.Studio, version=4.0.4-custom-40} buildProjects.ps1: line 89
build.ps1         {}                                                            build.ps1: line 135
<ScriptBlock>     {}                                                            <No file>
At C:\ravendb\scripts\checkLastExitCode.ps1:13 char:9
+         throw $msg
+         ~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (EXE RETURNED EX...
:String) [], RuntimeException
    + FullyQualifiedErrorId : EXE RETURNED EXIT CODE 134
CALLSTACK:
Command           Arguments                                                     Location
-------           ---------                                                     --------
CheckLastExitCode {}                                                            checkLastExitCode.ps1: line 11
BuildStudio       {srcDir=C:\ravendb\src\Raven.Studio, version=4.0.4-custom-40} buildProjects.ps1: line 89
build.ps1         {}                                                            build.ps1: line 135
<ScriptBlock>     {}                                                            <No file>

Oren Eini (Ayende Rahien)

unread,
Apr 27, 2018, 7:57:00 PM4/27/18
to ravendb
We currently use 8.x, iirc, try that

On Sat, 28 Apr 2018, 2:53 MostHated, <m374...@gmail.com> wrote:
Ok, awesome. I had to delete the folder I downlaoded as zip and then pul; in powershell from github directly so that it knew it was a repo, then I ran it again after that and it is in process of building now. *fingers crossed* it will be ok after that. : D

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

MostHated

unread,
Apr 27, 2018, 7:58:16 PM4/27/18
to RavenDB - 2nd generation document database
It might not matter though, in my bin/release of raven.client I have the dlls, so I wll try them out. Does it have to be done on the server side as well?


On Friday, April 27, 2018 at 6:53:41 PM UTC-5, MostHated wrote:

M374llic4

unread,
Apr 27, 2018, 8:36:11 PM4/27/18
to rav...@googlegroups.com
Ok, I installed the 8.x and rebuilt, it completed successfully. I took the netstandard 2.0 Raven.Client and Sparrow dlls and put them in my projects Plugins folder and ran it again. This is what I received.


MissingFieldException: Field 'Raven.Client.Http.RavenCommand`1/<ProcessResponse>d__30<TResult_REF>.<>4__this' not found.
  at Raven.Client.Http.RequestExecutor+<ExecuteAsync>d__74`1[TResult].MoveNext () [0x00a68] in <db037f43db19442ca567db7e76018d8e>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Raven.Client.Http.RequestExecutor+<ExecuteAsync>d__74`1[TResult].MoveNext () [0x00c1e] in <db037f43db19442ca567db7e76018d8e>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Raven.Client.Http.RequestExecutor+<UpdateTopologyAsync>d__62.MoveNext () [0x00164] in <db037f43db19442ca567db7e76018d8e>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Raven.Client.Http.RequestExecutor+<FirstTopologyUpdate>d__69.MoveNext () [0x000ea] in <db037f43db19442ca567db7e76018d8e>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Raven.Client.Util.AsyncHelpers.RunSync (System.Func`1[TResult] task) [0x0008a] in <db037f43db19442ca567db7e76018d8e>:0 
  at Raven.Client.Http.RequestExecutor.Execute[TResult] (Raven.Client.Http.RavenCommand`1[TResult] command, Sparrow.Json.JsonOperationContext context, Raven.Client.Documents.Session.SessionInfo sessionInfo) [0x00005] in <db037f43db19442ca567db7e76018d8e>:0 
  at Raven.Client.Documents.Session.DocumentQuery`1[T].ExecuteActualQuery () [0x0002f] in <db037f43db19442ca567db7e76018d8e>:0 
  at Raven.Client.Documents.Session.DocumentQuery`1[T].InitSync () [0x0002e] in <db037f43db19442ca567db7e76018d8e>:0 
  at Raven.Client.Documents.Session.DocumentQuery`1[T].ExecuteQueryOperation (System.Nullable`1[T] take) [0x00050] in <db037f43db19442ca567db7e76018d8e>:0 
  at Raven.Client.Documents.Session.DocumentQuery`1[T].GetEnumerator () [0x00000] in <db037f43db19442ca567db7e76018d8e>:0 
  at Raven.Client.Documents.Linq.RavenQueryInspector`1[T].GetEnumerator () [0x00011] in <db037f43db19442ca567db7e76018d8e>:0 
  at System.Collections.Generic.LargeArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x00000] in <839a3cb835c04d14aeb58d83bb7bc4bd>:0 
  at System.Collections.Generic.EnumerableHelpers.ToArray[T] (System.Collections.Generic.IEnumerable`1[T] source) [0x00033] in <839a3cb835c04d14aeb58d83bb7bc4bd>:0 
  at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00018] in <839a3cb835c04d14aeb58d83bb7bc4bd>:0 

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

M374llic4

unread,
Apr 28, 2018, 12:18:27 AM4/28/18
to rav...@googlegroups.com
    I know you said it seems like I am missing something, I am wondering if that stems from the way Unity works. Unity actually does the creation and management of the actual VS C# project, so if you try to add a NuGet package or something it ends up getting overwritten when you compile the game. version 2018.1 just came out of beta into RC1 yesterday and this is the first version that incorporates .netstandard 2.0 in any way, but I think there are some complexities to it which keep it from being  full on 100% compatible with anything .netstandard 2.0 and .netframework 4.6 (which 4.6 itself just came out of experimental status, 3.5 will be depreciated in the 2019 release cycle)

    I still have hope that something can be done to figure this out as I believe once Unity users see how easy it is to work with Raven, considering it being native to .net, see how nice the server management side of things has become with the dashboard updates in 4.0, see how great the community version license is for independent developers, and how quick and great the support is (nearly unheard of how helpful you guys have been) I think a lot of people might come try it out. 

    All that being said, are the Raven.Client and Sparrow dlls all that would be needed in the project if you are not using the NuGet package? Might there be more things I have to put into the project? Because Unity overwrites the VS project on compile, you have to put the dlls into the project itself within Unity and it then compiles them into the games assembly files. I did see random things about people possibly finding workarounds to using NuGet packages, and someone also actually made a Unity specific NuGet package manager that installs the packages and dependencies and whatnot into your Unity game project instead of the Visual Studio project, but I believe a special package needs to be made specifically for it, I am not sure though.

    If there is anything else I can try, or that you can recommend, I will definitely give it a go, as I would not be looking forward to having to convert my whole games framework to use another DB system, not just because of the amount of work it would take to set up another system, learn it, convert it and all that, but also because I just plain old like Raven, lol, but unfortunately I can't move forard at all with my game if I can't handle any data. : (

M374llic4

unread,
Apr 28, 2018, 8:46:35 AM4/28/18
to rav...@googlegroups.com
Well, i'll be a monkey uncle.

After messing around with it all night again, I decided to start a new project, download the NuGet package into it, then grabbed everything in there, put it in my project, removed anything that was causing issues with duplicates, etc, took the git compiled files, put them in there in place of the NuGet ones, went to reconnect, and saw this.


I was quite excited to see that it looks like I am at least getting some communication finally!

M374llic4

unread,
Apr 28, 2018, 8:51:03 AM4/28/18
to rav...@googlegroups.com
Though I just turned back on my remote Urls to try it across the net to a test server and it came back with : 

NotImplementedException: The method or operation is not implemented.
  at System.Net.Http.HttpClientHandler.get_ClientCertificates () [0x00000] in <20a8f293e89843148f03a963627efba4>:0 
  at Raven.Client.Http.RequestExecutor.CreateHttpMessageHandler (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, System.Boolean setSslProtocols, System.Boolean useCompression, System.Boolean hasExplicitlySetCompressionUsage) [0x00075] in <3af6f962c10f46e297126f8db0cace22>:0 
  at Raven.Client.Http.RequestExecutor.CreateClient () [0x0001d] in <3af6f962c10f46e297126f8db0cace22>:0 
  at System.Lazy`1[T].CreateValue () [0x00081] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Lazy`1[T].LazyInitValue () [0x00080] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Lazy`1[T].get_Value () [0x0003a] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Raven.Client.Http.RequestExecutor.GetCachedOrCreateHttpClient (System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue] httpClientCache) [0x00032] in <3af6f962c10f46e297126f8db0cace22>:0 
  at Raven.Client.Http.RequestExecutor+<>c__DisplayClass58_0.<.ctor>g__UpdateHttpClient|1 () [0x00021] in <3af6f962c10f46e297126f8db0cace22>:0 
  at Raven.Client.Http.RequestExecutor..ctor (System.String databaseName, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, Raven.Client.Documents.Conventions.DocumentConventions conventions, System.String[] initialUrls) [0x00128] in <3af6f962c10f46e297126f8db0cace22>:0 
  at Raven.Client.Http.RequestExecutor.Create (System.String[] initialUrls, System.String databaseName, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, Raven.Client.Documents.Conventions.DocumentConventions conventions) [0x00000] in <3af6f962c10f46e297126f8db0cace22>:0 

Oren Eini (Ayende Rahien)

unread,
Apr 28, 2018, 2:25:53 PM4/28/18
to ravendb
It looks like Unity isn't allowing client certs? In that case, you'll need to use ravendb in unsecured mode

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


M374llic4

unread,
Apr 28, 2018, 2:41:19 PM4/28/18
to rav...@googlegroups.com
From what you can tell it does look like it is now a Unity-specific issue? My game server will end up being on the game physical server as the database server and clients connect to the game server only, so the database would not be exposed to any outside direct connections. How would I go about disabling security if it is already setup with a certificate and what not? My local test server is set up that way, but that is because I never went through and actually set up the security. My remote test server I did do all the setup.

 Especially now that I saw some data communication I want to move forward trying to fully utilize Raven as my games database but would hate that one day down the line I do an update and I am told "Sorry man, that sucks". I saw something on github about netcore 2.1, which got me to worrying a bit about what the plan for Raven was in the near coming future. Since Unity only recently began being compliant with the netstandard 2.0 apis, I wanted to check and see if things that were simply optional things you could use, or are going to drive the direction of the database as a whole?

Oren Eini (Ayende Rahien)

unread,
Apr 28, 2018, 2:53:41 PM4/28/18
to ravendb
If you are talking to ravendb from the game server, why are you using Unity there and not the full framework?

M374llic4

unread,
Apr 28, 2018, 2:58:44 PM4/28/18
to rav...@googlegroups.com
The "game server" is still an instance of Unity running in headless mode that is stripped of textures, lighting, etc on a physical server that also will have Raven and another instance of Unity that handles authentication and such.

M374llic4

unread,
Apr 28, 2018, 8:57:08 PM4/28/18
to rav...@googlegroups.com
In your opinion, what are your thoughts on some sort of connector between my game and the Raven DB that sits right alongside the game, something super lightweight and its only function is to simply have my game talk to it, it then talks to the database? Is that a viable option? I don't know to make something like that, but I could certainly try and learn if it would alleviate any issues and not become a huge performance hindrance. It could be built using the full NuGet package and then have some sort of interface to my game server so that there are not internal game reference issues or any certificate issues or anything else down the road I would have to worry about (as far as I know).

Oren Eini (Ayende Rahien)

unread,
Apr 29, 2018, 4:27:52 AM4/29/18
to ravendb
The underlying reason is here:

If you can use the unsecured mode and local communication, you are better off running this inside the same instance.

M374llic4

unread,
Apr 29, 2018, 5:45:04 PM4/29/18
to rav...@googlegroups.com
Well then, that will sure do it, lol. How do I enable unsecured communication access from localhost while still allowing connections and management remotely? I am running it on Ubuntu 16.x and its headless so I would not be able to actually manage it locally.  Do I simply add UNSECURED_ACCESS_ALLOWED while keeping the rest of it set up the way it is currently? I have a data management application for remotely connecting and adding NPC's, quests, items, etc to the game as well but it is made in Windows forms and is not associated with Unity at all so it should be able to connect normally using the certificate.

M374llic4

unread,
Apr 29, 2018, 8:54:47 PM4/29/18
to rav...@googlegroups.com
This should hopefully be the last time I need to bother you for a while but this one is a bit more of a general usage question. The original query was as seen below, except it was for the Type NpcData which is in the example below this one as I tried to change it.

using (var session = this.world.WorldDatabase.OpenSession())
{
foreach (var goData in Queryable.Where(session.Query<GameObjectData>("GameObject/ByZoneId"), g => g.ZoneId == this.id))
{
var go = new Gameobject(this, goData.Guid, (GameObjectType) goData.GOType, goData.GroupId, goData);
this.objectCache.AddItem(go);

var position = goData.Position.ToVector();
var rotation = Quaternion.CreateEular(0, goData.Orientation, 0);
this.PrimaryFiber.Enqueue(() => go.Spawn(position, rotation));
}
}

I didn't change anything with it, and the data in the DB is a dump from the previous 3.x system, so I am not sure if it is a problem with the data in the DB, or with the query. This is the message  I keep getting.

Unhandled Exception:
System.InvalidOperationException: Could not convert document NPC/1377512776 to entity of type Karen90MmoFramework.Server.Data.NpcData ---> System.FormatException: Input string was not in a correct format.
  at System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) [0x00057] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00013] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Int32.Parse (System.String s, System.Globalization.NumberStyles style, System.IFormatProvider provider) [0x0000e] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Convert.ToInt32 (System.String value, System.IFormatProvider provider) [0x00005] in <e1a80661d61443feb3dbdaac88eeb776>:0 


I went to the site to look up how some examples were done and tried to emulate it on the NpcData one to see if it would make a difference. I came up with this.


using (var session = this.world.WorldDatabase.OpenSession())
{
        IRavenQueryable<NpcData> query = session.Query<NpcData>("NPC/ByZoneId")
        .Where(n => n.ZoneId == this.id);

foreach (var npcData in query) 
 {
// --- The rest is similar to above

The data in the DB looks like this.

The number id/name this document is "NPC/1377512776"

The data within it is :

{
    "GroupId": 5,
    "NpcType": "Civilian",
    "Alignment": "Good",
    "Species": "Humanoid",
    "MaxHealth": 140,
    "MaxMana": 220,
    "LootGroupId": 0,
    "Items": null,
    "StartQuests": [
        13
    ],
    "CompleteQuests": [
        13,
        12
    ],
    "Name": "Guy Whoownsacat",
    "Guid": 1377512776,
    "Class": "Cleric",
    "Level": 3,
    "Position": [
        "1459.289",
        "1370.904",
        "1.474"
    ],
    "Orientation": "251.0",
    "ZoneId": 1,
    "@metadata": {
        "@collection": "RINpcs",
        "Raven-Clr-Type": "Framework.Server.Game.Database.Objects.RINpc, Framework"
    }
}

I am not sure if something is wrong from stuff having come from a 3.x version, maybe the data isn't formatted corretly now for 4.x or what the issue is. I just used the built in data import on the dump.

M374llic4

unread,
Apr 29, 2018, 8:56:53 PM4/29/18
to rav...@googlegroups.com
I forgot to mention, after I tried to change it as per above, the error message was the same, the message posted above is the most current error message.

Oren Eini (Ayende Rahien)

unread,
Apr 30, 2018, 1:54:39 AM4/30/18
to ravendb
Yes.
You can do that in the setup, the unsecured mode will guide you through it.
Note that at this point you must ensure the security at the network level. 

Oren Eini (Ayende Rahien)

unread,
Apr 30, 2018, 1:55:35 AM4/30/18
to ravendb
Your Id property is an int? If so, it needs to be a string.

M374llic4

unread,
Apr 30, 2018, 3:29:07 PM4/30/18
to rav...@googlegroups.com
On the server the document ID is (for example) NPC/1818637598, which I am assuming is a string on the server side? Everything in the code on my end is using: 

"public string Id { get; set; }" 

It seems to error out right that the initial line of : 

        var query = session.Query<NpcData>("Npc/ByZoneId")
            .Where(n => n.ZoneId == this.id);

So it within <NpcData> it is set to  "public string Id { get; set; }" , and then  NPC/1818637598 is also a string on the server side, I am not sure where an int comes into play, unless there is something on the server side that I just can't find in which you can change what the document id is saved as? 

When looking in the management side of things, I don't see a way to edit the document id?

M374llic4

unread,
Apr 30, 2018, 3:34:33 PM4/30/18
to rav...@googlegroups.com
In my interface it is also setup like this .

        IRavenQueryable<T> Query<T>(string indexName) where T : IDataObject;

IDataObject is also  string Id { get; set; }

Oren Eini (Ayende Rahien)

unread,
Apr 30, 2018, 3:37:19 PM4/30/18
to ravendb
Please create a failing test case

M374llic4

unread,
Apr 30, 2018, 3:45:13 PM4/30/18
to rav...@googlegroups.com
Is there a document you can point me to which explains what a test case entails? Is that like a script that can be run that ends up with a similar result?

Oren Eini (Ayende Rahien)

unread,
Apr 30, 2018, 3:46:02 PM4/30/18
to ravendb

M374llic4

unread,
Apr 30, 2018, 4:27:47 PM4/30/18
to rav...@googlegroups.com
Ok, thank you. Before I do that I just wanted to include the full error message. The data when I look at it on the server side shows up in the Studio just as I posted above but I saw a lot below involving whole lot of conversions and just wanted to see if that had something to do with it. I tried to add in to "ToString()" just to see if that would make a difference since that is what it is look for the " NPC/1818637598" to be it looks like? It did't make a difference though.

System.InvalidOperationException: Could not convert document NPC/1818637598 to entity of type Framework.Server.Data.NpcData ---> System.FormatException: Input string was not in a correct format.
  at System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) [0x00057] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00013] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Int32.Parse (System.String s, System.Globalization.NumberStyles style, System.IFormatProvider provider) [0x0000e] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Convert.ToInt32 (System.String value, System.IFormatProvider provider) [0x00005] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.String.System.IConvertible.ToInt32 (System.IFormatProvider provider) [0x00000] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Convert.ChangeType (System.Object value, System.Type conversionType, System.IFormatProvider provider) [0x0011a] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Raven.Client.Json.BlittableJsonReader.ReadAsInt32 () [0x000c7] in <3af6f962c10f46e297126f8db0cace22>:0 
  at Newtonsoft.Json.JsonReader.ReadForType (Newtonsoft.Json.Serialization.JsonContract contract, System.Boolean hasConverter) [0x0004a] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues (Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty containerProperty, Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x000db] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters (Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty containerProperty, Newtonsoft.Json.Serialization.ObjectConstructor`1[T] creator, System.String id) [0x000b2] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject (Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Serialization.JsonObjectContract objectContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, Newtonsoft.Json.Serialization.JsonProperty containerProperty, System.String id, System.Boolean& createdFromNonDefaultCreator) [0x0008b] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) [0x00148] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) [0x0006d] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x000db] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00053] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Raven.Client.Documents.Conventions.JsonNetBlittableEntitySerializer.EntityFromJsonStream (System.Type type, Sparrow.Json.BlittableJsonReaderObject jsonObject) [0x0006e] in <3af6f962c10f46e297126f8db0cace22>:0 
  at Raven.Client.Documents.Session.EntityToBlittable.ConvertToEntity (System.Type entityType, System.String id, Sparrow.Json.BlittableJsonReaderObject document) [0x0009b] in <3af6f962c10f46e297126f8db0cace22>:0 
   --- End of inner exception stack trace ---
  at Raven.Client.Documents.Session.EntityToBlittable.ConvertToEntity (System.Type entityType, System.String id, Sparrow.Json.BlittableJsonReaderObject document) [0x000e1] in <3af6f962c10f46e297126f8db0cace22>:0 
  at Raven.Client.Documents.Session.InMemoryDocumentSessionOperations.TrackEntity (System.Type entityType, System.String id, Sparrow.Json.BlittableJsonReaderObject document, Sparrow.Json.BlittableJsonReaderObject metadata, System.Boolean noTracking) [0x000d0] in <3af6f962c10f46e297126f8db0cace22>:0 
  at Raven.Client.Documents.Session.InMemoryDocumentSessionOperations.TrackEntity[T] (System.String id, Sparrow.Json.BlittableJsonReaderObject document, Sparrow.Json.BlittableJsonReaderObject metadata, System.Boolean noTracking) [0x00000] in <3af6f962c10f46e297126f8db0cace22>:0 
  at Raven.Client.Documents.Session.Operations.QueryOperation.Deserialize[T] (System.String id, Sparrow.Json.BlittableJsonReaderObject document, Sparrow.Json.BlittableJsonReaderObject metadata, Raven.Client.Documents.Session.Tokens.FieldsToFetchToken fieldsToFetch, System.Boolean disableEntitiesTracking, Raven.Client.Documents.Session.InMemoryDocumentSessionOperations session) [0x0000d] in <3af6f962c10f46e297126f8db0cace22>:0 
  at Raven.Client.Documents.Session.Operations.QueryOperation.Complete[T] () [0x0007f] in <3af6f962c10f46e297126f8db0cace22>:0 
  at Raven.Client.Documents.Session.DocumentQuery`1[T].ExecuteQueryOperation (System.Nullable`1[T] take) [0x0005c] in <3af6f962c10f46e297126f8db0cace22>:0 
  at Raven.Client.Documents.Session.DocumentQuery`1[T].GetEnumerator () [0x00000] in <3af6f962c10f46e297126f8db0cace22>:0 
  at Raven.Client.Documents.Linq.RavenQueryInspector`1[T].GetEnumerator () [0x00011] in <3af6f962c10f46e297126f8db0cace22>:0 
  at Framework.Server.Game.MmoZone.LoadZone () [0x00213] in <1229402d4b8b4d4cb115c3c09abee41d>:0  Exception caught.

M374llic4

unread,
Apr 30, 2018, 5:34:53 PM4/30/18
to rav...@googlegroups.com
What is the difference between IRavenqueryable and IDocumentQuery? I wanted to see if that had something to do with it, but I didnt see a session.Query anymore when I changed IRavenQueryable to IDocumentQuery.

MostHated

unread,
Apr 30, 2018, 7:22:26 PM4/30/18
to RavenDB - 2nd generation document database
Ok, I found info on the difference in some documentation and can see that it would not help any. The Id that is there in the code is not referring to the document index Id at all, that is the ZoneId for an area of the map within the game, that part is a (short) and in the DB it is what is labeled as ZoneId. So when it has n.ZoneId == id it is comparing the ZoneId in the DB vs the currently loaded ZoneId of the MMOZone file in which is loading this data. Not sure if that makes a difference. I hate to keep bugging you, is there a community forum in which I could ask other Raven users for some help with that part of things if it's not an actual Raven issue? I am not sure exactly what kind of an issue it is, so if it's not Raven I would rather you not have to deal with it, lol.

Thank you kindly for all the help you have provided so far though, I am so close to having everything working the way it is supposed to that it makes me squirm in my chair that something probably so silly is holding it up. I know it is not the same as being able to afford an enterprise license or anything (hopefully one day if my game becomes popular! : P) but is there a way I can donate to Raven for all the help you have provided? You have definitely gone above and beyond and community support I have ever dealt with.

Oren Eini (Ayende Rahien)

unread,
May 1, 2018, 1:59:16 AM5/1/18
to ravendb
IRavenQueryable is when you are using Linq (sesion.Query()).
IDocumentQuery is for programatically building the query (session.Advanced.DocumentQuery())

Oren Eini (Ayende Rahien)

unread,
May 1, 2018, 1:59:45 AM5/1/18
to ravendb
This _is_ the community forum in which you are asking :-).



Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


On Tue, May 1, 2018 at 2:22 AM, MostHated <m374...@gmail.com> wrote:
Ok, I found info on the difference in some documentation and can see that it would not help any. The Id that is there in the code is not referring to the document index Id at all, that is the ZoneId for an area of the map within the game, that part is a (short) and in the DB it is what is labeled as ZoneId. So when it has n.ZoneId == id it is comparing the ZoneId in the DB vs the currently loaded ZoneId of the MMOZone file in which is loading this data. Not sure if that makes a difference. I hate to keep bugging you, is there a community forum in which I could ask other Raven users for some help with that part of things if it's not an actual Raven issue? I am not sure exactly what kind of an issue it is, so if it's not Raven I would rather you not have to deal with it, lol.

Thank you kindly for all the help you have provided so far though, I am so close to having everything working the way it is supposed to that it makes me squirm in my chair that something probably so silly is holding it up. I know it is not the same as being able to afford an enterprise license or anything (hopefully one day if my game becomes popular! : P) but is there a way I can donate to Raven for all the help you have provided? You have definitely gone above and beyond and community support I have ever dealt with.

--

Oren Eini (Ayende Rahien)

unread,
May 1, 2018, 2:00:19 AM5/1/18
to ravendb
And a test case that would show the problem in isolation would be very helpful to figure out the issue

M374llic4

unread,
May 1, 2018, 12:28:39 PM5/1/18
to rav...@googlegroups.com
I am not sure how to go about providing one that is not actually within a Unity3d project. The code is executed when running the server side of my game. Would it be acceptable to create a mini Unity3d project with just the necessary code in it and provide that along with a copy of my DB files just as I have them and you could run it within Unity3d? The engine is a free download, so all you would have to do is start the DB server, open the Unity project and hit the play button. Otherwise, I am not sure how to provide another similar scenario?

Oren Eini (Ayende Rahien)

unread,
May 1, 2018, 12:31:51 PM5/1/18
to ravendb
Yes, that would be fine.

M374llic4

unread,
May 1, 2018, 3:03:23 PM5/1/18
to rav...@googlegroups.com
If I submit a report on issues.hibernatingrhinos.com, will the submission be confidential? It will include a link and I do not want to post the link to my game server download publically.

Oren Eini (Ayende Rahien)

unread,
May 1, 2018, 3:04:50 PM5/1/18
to ravendb
Try sending that to sup...@ravendb.net then

M374llic4

unread,
May 1, 2018, 3:19:03 PM5/1/18
to rav...@googlegroups.com
Thank you much, I have just sent it over along with a text document containing instructions and file locations.

MostHated

unread,
Jun 16, 2018, 5:01:06 AM6/16/18
to RavenDB - 2nd generation document database
Hello there,
     It is me, once again. I had a question going back to the x509 / certificate issue we were havng before. There is an asset package for Unity called "Best HTTP". Looking at some of their documentation I saw that they had a dependancy they were using of "using Org.BouncyCastle.Asn1.X509;" in an example seen here 

using System;

using Org.BouncyCastle.Crypto.Tls;

using Org.BouncyCastle.Asn1.X509;


class CustomVerifier : ICertificateVerifyer

{

   public bool IsValid(Uri serverUri, X509CertificateStructure[] certs)

   {

      // TODO: Return false, if validation fails

             return true;

   }

}


var request = new HTTPRequest(new Uri("https://google.com"), ...);

request.CustomCertificateVerifyer = new CustomVerifier();

request.UseAlternateSSL = true;

request.Send();



Does the fact that they seem to be able to work with the certificates in some way look like it might be something that might help to solve the issue that we were having before when I was not able to connect to the DB because of a x509 error below of NotImplemented?

NotImplementedException: The method or operation is not implemented.
at System.Net.Http.HttpClientHandler.get_ClientCertificates () [0x00000] in <20a8f293e89843148f03a963627efba4>:0
at Raven.Client.Http.RequestExecutor.CreateHttpMessageHandler (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, System.Boolean setSslProtocols, System.Boolean useCompression, System.Boolean hasExplicitlySetCompressionUsage) [0x00075] in <3af6f962c10f46e297126f8db0cace22>:0

Thanks!
Message has been deleted

MostHated

unread,
Jun 16, 2018, 1:03:42 PM6/16/18
to RavenDB - 2nd generation document database


Someone also mentioned this https://github.com/mono/mono/blob/0bcbe39b148bb498742fc68416f8293ccd350fb6/mcs/class/System.Net.Http.WebRequest/System.Net.Http.WebRequest/WebRequestHandler.cs

I am not sure if its possible to try and use something else in place of whatever Raven is trying to use to connect out on its own?

Looking through WebRequestHandler, it does have something that looks promising : 

public X509CertificateCollection ClientCertificates {
get {
if (this.ClientCertificateOptions != ClientCertificateOption.Manual) {
throw new InvalidOperationException("The ClientCertificateOptions property must be set to 'Manual' to use this property.");
}
return clientCertificates;
}
}

Oren Eini (Ayende Rahien)

unread,
Jun 17, 2018, 2:39:22 AM6/17/18
to ravendb
You need to be able to actually do TLS negotiation for this to work
I think you _can_ implement that using Bouncy, but not sure. 


Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--

MostHated

unread,
Jun 17, 2018, 2:42:51 AM6/17/18
to rav...@googlegroups.com
I see, well, shoot. Especially considering the answer the answer to my other question, that definitely is going to be a pain to manage if I can't get to the management page because my server is headless, but then I can't connect with my game if security actually on. I guess maybe I could setup vpn or something.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

Oren Eini (Ayende Rahien)

unread,
Jun 17, 2018, 2:53:40 AM6/17/18
to ravendb
Can you run a _separate_ process as part of this?
If so, you can create a tunnel for your game that would handle this.

MostHated

unread,
Jun 17, 2018, 2:59:45 AM6/17/18
to rav...@googlegroups.com
Yea, I definitely could give that a go. I had mentioned about that before but you didn't think it was a good idea at the time, but that was before we dug deeper down into things. I am not sure exactly how I would go about it, but I would have no problem giving it a go if it would get me as close to to full functionality as I can be. Do you happen to know of anyone who has done that, or some sort of similar sample project to something I could look at? Is there a list online of what all the major end points would be that would need to be connected up?

Thanks!
Dan
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

Oren Eini (Ayende Rahien)

unread,
Jun 17, 2018, 3:05:12 AM6/17/18
to ravendb
The idea that you setup a simple proxy. Written in .NET core, one side will listen to the local machine, with pure TCP.
The other side will connect to RavenDB with the relevant cert.
You can authenticate the incoming side as you wish. 

Oren Eini (Ayende Rahien)

unread,
Jun 17, 2018, 3:05:51 AM6/17/18
to ravendb
Note that you do NOT want to implement anything beyond raw sockets, this way, you won't have to keep fussing with this everytime we change an endpoint.
Instead, you can just transfer the raw TCP across.

MostHated

unread,
Jun 20, 2018, 12:19:20 AM6/20/18
to RavenDB - 2nd generation document database
Hey there,
    I was doing some testing locally and was finally able to get to a point in my game where I could create an account and write the data to the db. I have been able to query and pull data all this time with no issue when security was off because of the certificate issue with Mono, but when I went to write my data just now I got this error below for some reason having to do with certs again?


2018-06-19 22:59:51,623 [Thread Pool Worker] ERROR Framework.Server.Login.Handlers.LoginOperationHandler [(null)] - System.NotImplementedException: The method or operation is not implemented.
  at System.Net.Http.HttpClientHandler.get_ServerCertificateCustomValidationCallback () [0x00000] in <20a8f293e89843148f03a963627efba4>:0 
  at Raven.Client.Http.RequestExecutor.CreateHttpMessageHandler (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, System.Boolean setSslProtocols, System.Boolean useCompression, System.Boolean hasExplicitlySetCompressionUsage) [0x00051] in <0e5db5f4071944889ef8a4d49c1b29f5>:0 
  at Raven.Client.Http.RequestExecutor.CreateClient () [0x0001d] in <0e5db5f4071944889ef8a4d49c1b29f5>:0 
  at System.Lazy`1[T].CreateValue () [0x00081] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Lazy`1[T].LazyInitValue () [0x00080] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Lazy`1[T].get_Value () [0x0003a] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Raven.Client.Http.RequestExecutor.GetCachedOrCreateHttpClient (System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue] httpClientCache) [0x00032] in <0e5db5f4071944889ef8a4d49c1b29f5>:0 
  at Raven.Client.Http.RequestExecutor..ctor (System.String databaseName, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, Raven.Client.Documents.Conventions.DocumentConventions conventions, System.String[] initialUrls) [0x000eb] in <0e5db5f4071944889ef8a4d49c1b29f5>:0 
  at Raven.Client.Http.RequestExecutor.Create (System.String[] initialUrls, System.String databaseName, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, Raven.Client.Documents.Conventions.DocumentConventions conventions) [0x00000] in <0e5db5f4071944889ef8a4d49c1b29f5>:0 
  at Raven.Client.Documents.DocumentStore+<>c__DisplayClass20_0.<GetRequestExecutor>g__CreateRequestExecutor|0 () [0x00027] in <0e5db5f4071944889ef8a4d49c1b29f5>:0 
  at System.Lazy`1[T].CreateValue () [0x00081] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Lazy`1[T].LazyInitValue () [0x00080] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Lazy`1[T].get_Value () [0x0003a] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Raven.Client.Documents.DocumentStore.GetRequestExecutor (System.String database) [0x0008f] in <0e5db5f4071944889ef8a4d49c1b29f5>:0 
  at Raven.Client.Documents.DocumentStore.OpenSession (Raven.Client.Documents.Session.SessionOptions options) [0x0002d] in <0e5db5f4071944889ef8a4d49c1b29f5>:0 
  at Raven.Client.Documents.DocumentStore.OpenSession () [0x00006] in <0e5db5f4071944889ef8a4d49c1b29f5>:0 
  at Framework.Database.DatabaseFactory.OpenSession () [0x00001] in <59d49a1cd55e43699b61c7bc950ecda2>:0 
  at Framework.Server.Login.Handlers.LoginOperationHandler.HandleCreateNewUser (System.Int32 sessionId, Framework.Server.ServerToClient.Operations.CreateUser operation) [0x0001a] in <59d49a1cd55e43699b61c7bc950ecda2>:0 
2018-06-19 22:59:51,633 [Thread Pool Worker] DEBUG Framework.Server.Networking.Listeners.TcpPeer [(null)] - Sending from TcpPeer1
2018-06-19 22:59:51,635 [Thread Pool Worker] DEBUG Framework.Server.Core.PeerBase [(null)] - SentOpResponse: Peer=T:LoginServerPeer,ConnId:1,ip:127.0.0.1:4520, opCode=4, return=-1, result=Ok size=14 bytes



This is what I have for settings for the DB

{
  "ServerUrl": "http://127.0.0.1:8089",
  "Setup.Mode": "Unsecured",
  "DataDir": "RavenData",
  "Security.UnsecuredAccessAllowed": "PublicNetwork",
  "License.Eula.Accepted": true
}


and here is what my connection and code look like for this particular action.



public DatabaseFactory(string db)
{
initialize = new Initializer();
DatabaseName = db;
store = initialize.Initialize(DatabaseName);
Debug.Log("Starting DB factory for " + db);
}


public class
Initializer
{
public IDocumentStore Initialize(string db)
{
var store = new DocumentStore
{
Urls = new[] { "http://127.0.0.1:8089" },
Database = db,
Conventions =
{
SaveEnumsAsIntegers = true
}
}.Initialize();
Debug.Log("Initialized");
return store;
}
}


Then this is the code in game to create the account

using (var session = this.application.UserDatabase.OpenSession())
{
var username = operation.Username.ToUpper();
var existingUserData = session.Query<UserData>("UserData/ByUsername")
//.Customize(x => x.WaitForNonStaleResultsAsOfNow())
.Select(user => new {user.Username})
.FirstOrDefault(user =>
user.Username.Equals(operation.Username, StringComparison.CurrentCultureIgnoreCase));

if (existingUserData != null)
return operation.GetErrorResponse((short) ResultCode.UsernameAlreadyExists);

ResultCode resultCode;
if (LoginHelper.IsValidUsername(username, out resultCode) == false)
return operation.GetErrorResponse((short) resultCode);

if (LoginHelper.IsValidPassword(operation.Password, out resultCode) == false)
return operation.GetErrorResponse((short) resultCode);

var passwordHash = SaltedHash.Create(operation.Password);
var newUserInfo = new UserData
{
Id = UserData.GenerateId(username),
Username = username,
Salt = passwordHash.Salt,
Password = passwordHash.Hash,
IsBanned = false,
CreatedOn = DateTime.Now,
LastLogin = null,
};

this.application.UserDatabase.Store(newUserInfo);
return operation.GetErrorResponse((short) ResultCode.Ok);

Then for the end where it does Store, this is the code for that.

public void Store(IDataObject entity)
{
using (var session = store.OpenSession())
{
if (string.IsNullOrEmpty(entity.Id))
throw new NullReferenceException("IDataObject does not have an Id set");

session.Store(entity);
session.SaveChanges();
}
}


This is all I need it seems like to finally have my game pretty much fully working until it comes time to worry about trying to make the proxy, which will be down the line a little bit. Well, unless I have to do it to make this work for some reason. Both the game and DB are running locally here on my pc at the moment, so I am not sure whats up with that new error. : /

Thanks again for all the help so far! 

Grisha Kotler

unread,
Jun 20, 2018, 3:27:01 AM6/20/18
to rav...@googlegroups.com
Are you running in secured mode?

Hibernating Rhinos Ltd  cid:image001.png@01CF95E2.8ED1B7D0

Grisha Kotler l RavenDB Core Team Developer Mobile: +972-54-586-8647

RavenDB paving the way to "Data Made Simplehttp://ravendb.net/


--

Grisha Kotler

unread,
Jun 20, 2018, 3:35:44 AM6/20/18
to rav...@googlegroups.com
Also, did you set the ServerCertificateCustomValidationCallback?

Hibernating Rhinos Ltd  cid:image001.png@01CF95E2.8ED1B7D0

Grisha Kotler l RavenDB Core Team Developer Mobile: +972-54-586-8647

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

RavenDB paving the way to "Data Made Simplehttp://ravendb.net/


Oren Eini (Ayende Rahien)

unread,
Jun 20, 2018, 4:25:56 AM6/20/18
to ravendb
Also, what is the exact build you are using?

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

M374llic4

unread,
Jun 20, 2018, 2:07:15 PM6/20/18
to rav...@googlegroups.com
I am not exactly sure about the first two questions, I simply downloaded it and ran it with the settings file as I posted in my question above, in which I have "Setup.Mode": "Unsecured", which I am guessing you are referring to? I am not sure what or where the ServerCertificateCustomValidationCallback would be set. Is that something that I need to do? 

The version I am currently running is the one in which you guys patched for Unity to work a few weeks ago. 4.0.4-nightly-20180427-0400.

Thanks,
Dan

To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

Oren Eini (Ayende Rahien)

unread,
Jun 20, 2018, 2:45:27 PM6/20/18
to ravendb
Please upgrade to 4.0.5 for both client and server. 
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

MostHated

unread,
Jun 20, 2018, 3:43:46 PM6/20/18
to RavenDB - 2nd generation document database
Awesome, it looks like that fixed it!  I was able to create an account. I went to login but got an error, but that was just due to a missing index which I can fix after work. Thanks again. : D

MostHated

unread,
Jun 21, 2018, 11:06:38 PM6/21/18
to RavenDB - 2nd generation document database
You had helped me before when I was having an issue with needing the data to be of type byte but in Raven 4.0 I believe it was not allowed anymore or something to that effect so I had followed your guidance to use a conversion method. It so far as been working just fine, but today I got to the point in my game where I am finally able to attempt to load my player into the game world, while loading the level I received this error below :  I am using the same exact format of the code used for this in many other places, so I am not sure why this particular one might be giving issues? The other places in which I am using the conversion are byte within the game and then a string in the sb and then it gets converted without an issue.

The Value of    "Origin": "Telsardris", was originally just the number 4, which it actually let me login even after reading that data upon logging in, but it would not let me load into the game, which is when I noticed it was not converted like the others, but when I converted it and changed it from "Origin": 4, to "Origin": "Telsardris", it no longer let me login either and gave the error below. 

The error at the very bottom is what comes up on the World server if I leave the Origin value at just the number 4 so that it lets me login to the game, but then gives the bottom error when actually loading into the world. I am guessing it is supposed to be converted like the other bytes but not sure why its not working right.

2018-06-21 21:48:58,550 [Thread Pool Worker] ERROR Framework.Server.Login.Handlers.CharacterOperationHandler [(null)] - System.FormatException: Input string was not in a correct format.
  at System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) [0x00057] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00013] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Int32.Parse (System.String s, System.Globalization.NumberStyles style, System.IFormatProvider provider) [0x0000e] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Convert.ToInt32 (System.String value, System.IFormatProvider provider) [0x00005] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.String.System.IConvertible.ToInt32 (System.IFormatProvider provider) [0x00000] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at System.Convert.ChangeType (System.Object value, System.Type conversionType, System.IFormatProvider provider) [0x0011a] in <e1a80661d61443feb3dbdaac88eeb776>:0 
  at Raven.Client.Json.BlittableJsonReader.ReadAsInt32 () [0x000c7] in <1f004969d47742baabb245e8424d3c7b>:0 
  at Newtonsoft.Json.JsonReader.ReadForType (Newtonsoft.Json.Serialization.JsonContract contract, System.Boolean hasConverter) [0x0004a] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues (Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty containerProperty, Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x000db] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters (Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty containerProperty, Newtonsoft.Json.Serialization.ObjectConstructor`1[T] creator, System.String id) [0x000b2] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject (Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Serialization.JsonObjectContract objectContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, Newtonsoft.Json.Serialization.JsonProperty containerProperty, System.String id, System.Boolean& createdFromNonDefaultCreator) [0x0008b] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) [0x00148] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) [0x0006d] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x000db] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00053] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Raven.Client.Documents.Conventions.JsonNetBlittableEntitySerializer.EntityFromJsonStream (System.Type type, Sparrow.Json.BlittableJsonReaderObject jsonObject) [0x0006e] in <1f004969d47742baabb245e8424d3c7b>:0 
  at Raven.Client.Documents.Session.Operations.QueryOperation.Deserialize[T] (System.String id, Sparrow.Json.BlittableJsonReaderObject document, Sparrow.Json.BlittableJsonReaderObject metadata, Raven.Client.Documents.Session.Tokens.FieldsToFetchToken fieldsToFetch, System.Boolean disableEntitiesTracking, Raven.Client.Documents.Session.InMemoryDocumentSessionOperations session) [0x00104] in <1f004969d47742baabb245e8424d3c7b>:0 
  at Raven.Client.Documents.Session.Operations.QueryOperation.Complete[T] () [0x0007f] in <1f004969d47742baabb245e8424d3c7b>:0 
  at Raven.Client.Documents.Session.DocumentQuery`1[T].ExecuteQueryOperation (System.Nullable`1[T] take) [0x0005c] in <1f004969d47742baabb245e8424d3c7b>:0 
  at Raven.Client.Documents.Session.DocumentQuery`1[T].GetEnumerator () [0x00000] in <1f004969d47742baabb245e8424d3c7b>:0 
  at Raven.Client.Documents.Linq.RavenQueryInspector`1[T].GetEnumerator () [0x00011] in <1f004969d47742baabb245e8424d3c7b>:0 
  at System.Collections.Generic.LargeArrayBuilder`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] items) [0x00000] in <839a3cb835c04d14aeb58d83bb7bc4bd>:0 
  at System.Collections.Generic.EnumerableHelpers.ToArray[T] (System.Collections.Generic.IEnumerable`1[T] source) [0x00033] in <839a3cb835c04d14aeb58d83bb7bc4bd>:0 
  at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00018] in <839a3cb835c04d14aeb58d83bb7bc4bd>:0 
  at Framework.Server.Login.Handlers.CharacterOperationHandler.HandleRetrieveCharacters (System.Int32 sessionId, Framework.Server.ServerToClient.Operations.RetrieveCharacters operation) [0x001c8] in <597742ef35f944cd9ba17717b3ba5828>:0 



Here is the code for the conversion


public class OriginByteConverter : JsonConverter
{
   
public override bool CanConvert(Type objectType)
   
{
       
return typeof(Origin).IsAssignableFrom(objectType);
   
}

   
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
   
{
       
var enumString = (string)reader.Value;

       
return (byte)Enum.Parse(typeof(Origin), enumString, true);
   
}

   
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
   
{
       
var xcontainer = (Origin)value;
        writer
.WriteValue(xcontainer.ToString());
   
}
}

This is what the PlayerData file looks like : 

using System;
using System.Collections.Generic;
using System.Globalization;
using Framework.Server.Game.Systems;
using Newtonsoft.Json;

namespace Framework.Server.Data
{
/// <summary>
/// Id = PLAYER/($PlayerName | Upper)
/// </summary>
public class PlayerData : CharacterData
{
public string Username { get; set; }
public bool InitLogin { get; set; }
public DateTime CreatedOn { get; set; }
public DateTime? LastPlayed { get; set; }

[JsonProperty("Origin")]
[JsonConverter(typeof(OriginByteConverter))]
public byte Origin { get; set; }

public int Money { get; set; }
public int Xp { get; set; }
public int CurrHealth { get; set; }
public int CurrMana { get; set; }

public byte GmLevel { get; set; }

public InventoryData Inventory { get; set; }
public SpellsData Spells { get; set; }
public ActionBarData ActionBar { get; set; }

public short[] Stats { get; set; }

public short[] FinishedQuests { get; set; }
public Dictionary<short, QuestProgression> CurrentQuests { get; set; }

public long? GroupGuid { get; set; }

/// <summary>
/// Generates an id for this datamember
/// </summary>
public static string GenerateId(int playerId)
{
return "PLAYER/" + playerId.ToString(CultureInfo.InvariantCulture);
}
}
}


Data excerpt of that particular thing from the DB

 "Username": "MOSTHATED",
    "InitLogin": false,
    "CreatedOn": "2014-11-08T11:50:00.5622000",
    "LastPlayed": "2014-11-08T11:58:09.4002000",
    "Origin": "Telsardris",
    "Money": 15,
    "Xp": 34,
    "CurrHealth": 90,
    "CurrMana": 36,


-----------------------------------------
This is the error when loading into the world if Origin is only a 4 instead of the text name in the DB.

2018-06-21 21:26:26,601 [Thread Pool Worker] ERROR Framework.Threading.FailSafeBatchExecutor [(null)] - System.InvalidOperationException: Could not convert document PLAYER/381325757 to entity of type Framework.Server.Data.PlayerData ---> System.InvalidCastException: Specified cast is not valid.
  at Framework.Server.Data.OriginByteConverter.ReadJson (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Object existingValue, Newtonsoft.Json.JsonSerializer serializer) [0x00002] in C:\Users\Home\Documents\Unity\A_RPG\_Server\ARPG_World_Server\Assets\_Components\_Server\_Server\Database\Converters.cs:105 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable (Newtonsoft.Json.JsonConverter converter, Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Object existingValue) [0x00055] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue (Newtonsoft.Json.Serialization.JsonProperty property, Newtonsoft.Json.JsonConverter propertyConverter, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty, Newtonsoft.Json.JsonReader reader, System.Object target) [0x0004e] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject (System.Object newObject, Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, System.String id) [0x00268] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) [0x00161] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) [0x0006d] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x000db] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00053] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
  at Raven.Client.Documents.Conventions.JsonNetBlittableEntitySerializer.EntityFromJsonStream (System.Type type, Sparrow.Json.BlittableJsonReaderObject jsonObject) [0x0006e] in <1f004969d47742baabb245e8424d3c7b>:0 
  at Raven.Client.Documents.Session.EntityToBlittable.ConvertToEntity (System.Type entityType, System.String id, Sparrow.Json.BlittableJsonReaderObject document) [0x0009b] in <1f004969d47742baabb245e8424d3c7b>:0 

MostHated

unread,
Jun 22, 2018, 12:43:47 AM6/22/18
to RavenDB - 2nd generation document database
Did something change with 4.0.5 vs 4.0.3 in regards to this? I had to remove several of the json conversion in order to get some things working and then change things back to numbers instead of being string in the db.

Oren Eini (Ayende Rahien)

unread,
Jun 22, 2018, 2:06:21 AM6/22/18
to ravendb
You would need to provide us with a standalone code to run to check this.
See: 

It is possible, but unlikely, that we aren't invoking the right serializer, but I doubt it. Would need to actually see a repro

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


On Fri, Jun 22, 2018 at 7:43 AM, MostHated <m374...@gmail.com> wrote:
Did something change with 4.0.5 vs 4.0.3 in regards to this? I had to remove several of the json conversion in order to get some things working and then change things back to numbers instead of being string in the db.

--
Reply all
Reply to author
Forward
0 new messages