RejectedSoftware Forums

Sign up

Error with deserializeBson

Hi,

I am getting errors when using deserializeBson.

../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(233): Error: need 'this' for 'getAttribute' of type 'nothrow @safe NameAttribute(NameAttribute defaultvalue)'
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(233): Error: need 'this' for 'getAttribute' of type 'nothrow @safe NameAttribute(NameAttribute default
value)'
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(233): Error: need 'this' for 'getAttribute' of type 'nothrow @safe NameAttribute(NameAttribute defaultvalue)'
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(233): Error: need 'this' for 'getAttribute' of type 'nothrow @safe NameAttribute(NameAttribute default
value)'
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(233): Error: need 'this' for 'getAttribute' of type 'nothrow @safe NameAttribute(NameAttribute defaultvalue)'
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(233): Error: need 'this' for 'getAttribute' of type 'nothrow @safe NameAttribute(NameAttribute default
value)'
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(233): Error: need 'this' for 'getAttribute' of type 'nothrow @safe NameAttribute(NameAttribute defaultvalue)'
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(233): Error: need 'this' for 'getAttribute' of type 'nothrow @safe NameAttribute(NameAttribute default
value)'
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(170): instantiated from here: deserialize!(BlogModel, BsonSerializer)
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/bson.d(1016): instantiated from here: deserialize!(BsonSerializer, BlogModel, Bson)
source/blog.d(51): instantiated from here: deserializeBson!(BlogModel)
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(223): Error: function vibe.data.bson.BsonSerializer.readDictionary!(BlogModel).readDictionary (scope void delegate(string) entry_callback) is not callable using argument types (void)
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(170): Error: template instance vibe.data.serialization.deserialize!(BlogModel, BsonSerializer) error instantiating
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/bson.d(1016): instantiated from here: deserialize!(BsonSerializer, BlogModel, Bson)
source/blog.d(51): instantiated from here: deserializeBson!(BlogModel)
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/bson.d(1016): Error: template instance vibe.data.serialization.deserialize!(BsonSerializer, BlogModel, Bson) error instantiating
source/blog.d(51): instantiated from here: deserializeBson!(BlogModel)
source/blog.d(51): Error: template instance vibe.data.bson.deserializeBson!(BlogModel) error instantiating

Using this code:

`

BlogModel obtain(int id)
{
        auto data = blog.findOne(["id":id]);
        enforce(!data.isNull(),"Blog does not exist");
        auto res = deserializeBson!BlogModel(data);
        return res;
}

`

I do not see the issue exactly. I tried also doing

auto res = new BlogModel;deserializeBson(res,data);

but would still give a similar error but point it to deserializedBson. Could someone explain to me what I be doing wrong with that function?

Re: Error with deserializeBson

Hi! Try to do a dub upgrade --prerelease and then recompile - this
should use the latest 0.7.19-rc.2 instead of 0.7.18, which contains some
code that doesn't compile with DMD 2.065 anymore. The final 0.7.19 will
also be released in the coming days.

Re: Error with deserializeBson

On Sat, 22 Mar 2014 09:22:52 +0100, Sönke Ludwig wrote:

Hi! Try to do a dub upgrade --prerelease and then recompile - this
should use the latest 0.7.19-rc.2 instead of 0.7.18, which contains some
code that doesn't compile with DMD 2.065 anymore. The final 0.7.19 will
also be released in the coming days.

Thanks that fixed the issue. I will keep note of that as well. Thanks again :)