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
after a day or so of using ZLocation, I start to get this error:
C:\Users\whatever\AppData\Roaming\Local\tempz auto
Exception calling "ToObject" with "2" argument(s): "Unable to cast object of type 'LiteDB.ObjectId' to type 'System.String'."
At C:\Program Files\PowerShell\Modules\ZLocation\1.0.0\ZLocation.LiteDB.psm1:15 char:5
+ ,$mapper.ToObject($type, $obj)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidCastException
When I go and look at z-location.db, I see, along with the normal entries, an entry like this:
@vors, no I'm not sure, except it seems like somewhere we're accidentally putting a nonsense entry into the database. Maybe we're passing an incomplete object to the $mapper somewhere? Like, what happens if we accidentally try to increase the weight for a path when no such path entry exists in the database? Just a guess.
Now that I think about it for a few more minutes, I suspect that's the problem. I suspect that somewhere we're calling Add-ZWeight or $service.add() with a null $path. We have the Location class's path field mapped as LiteDB's _id. (LiteDB makes _id mandatory; otherwise I would have named it path within the database) So if $path/_id is unspecified, the database will auto-create an ID for that row, except the auto-created IDs aren't strings. Later, we try to map that row to a [Location] instance, and it fails because it can't convert the _id to Location's path field.
after a day or so of using ZLocation, I start to get this error:
When I go and look at z-location.db, I see, along with the normal entries, an entry like this:
[
{
"_id": {"$oid": "5ba9f338cfbf5e28a8f1314c"},
"weight": 1.0
}
]
If I remove that from the db, things work again. (Until a day or so later when I get the error again)
The text was updated successfully, but these errors were encountered: