Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New MongoDbContext error #61

Closed
dongshengfengniaowu opened this issue May 17, 2019 · 5 comments

Comments

Projects
None yet
2 participants
@dongshengfengniaowu
Copy link

commented May 17, 2019

System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for 'MongoDB.Bson.Serialization.BsonClassMap' threw an exception.
Source=MongoDB.Bson
StackTrace:
at MongoDB.Bson.Serialization.BsonClassMap.GetRegisteredClassMaps()
at MongoFramework.Infrastructure.Mapping.EntityMapper.InitialiseClassMap() in E:\SourceCode\MongoFramework\src\MongoFramework\Infrastructure\Mapping\EntityMapper.cs:line 40
at MongoFramework.Infrastructure.Mapping.EntityMapper..ctor(Type entityType, IMongoDbConnection connection) in E:\SourceCode\MongoFramework\src\MongoFramework\Infrastructure\Mapping\EntityMapper.cs:line 30
at MongoFramework.MongoDbConnection.b__22_0(Type type) in E:\SourceCode\MongoFramework\src\MongoFramework\MongoDbConnection.cs:line 95
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
at MongoFramework.MongoDbConnection.GetEntityMapper(Type entityType) in E:\SourceCode\MongoFramework\src\MongoFramework\MongoDbConnection.cs:line 93
at MongoFramework.Infrastructure.EntityWriter1..ctor(IMongoDbConnection connection) in E:\SourceCode\MongoFramework\src\MongoFramework\Infrastructure\EntityWriter.cs:line 21 at MongoFramework.MongoDbSet1.SetConnection(IMongoDbConnection connection) in E:\SourceCode\MongoFramework\src\MongoFramework\MongoDbSet.cs:line 46
at MongoFramework.MongoDbContext.OnDbSetCreation(PropertyInfo property) in E:\SourceCode\MongoFramework\src\MongoFramework\MongoDbContext.cs:line 58
at MongoFramework.MongoDbContext.InitialiseDbSets() in E:\SourceCode\MongoFramework\src\MongoFramework\MongoDbContext.cs:line 34
at MongoFramework.MongoDbContext..ctor(IMongoDbConnection connection) in E:\SourceCode\MongoFramework\src\MongoFramework\MongoDbContext.cs:line 19
at MongoTest.MyContext..ctor(IMongoDbConnection connection) in E:\SourceCode\MongoFramework\MongoTest\Model.cs:line 17
at MongoTest.Program.

d__0.MoveNext() in E:\SourceCode\MongoFramework\MongoTest\Program.cs:line 20
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at MongoTest.Program.(String[] args)

Inner Exception 1:
ArgumentNullException: Value cannot be null.
Parameter name: type

@Turnerj

This comment has been minimized.

Copy link
Member

commented May 17, 2019

Thanks for reporting the issue with the stack trace. Can you please supply the version number of MongoFramework, of the MongoDB driver (in case you have a different version that what is referenced by MongoFramework) and a copy of the code that you experience this issue with?

I will need to be able to recreate the bug locally so I can fix the issue, thanks. 🙂

@Turnerj Turnerj added the bug label May 17, 2019

@dongshengfengniaowu

This comment has been minimized.

Copy link
Author

commented May 17, 2019

Use .net core 3 Preview5 , MongoFramework ,0.10.0 , Mongo Driver 2.8.1
Thinks very much.

@Turnerj

This comment has been minimized.

Copy link
Member

commented May 18, 2019

I've done some investigation into this and the problem seems to be the MongoDB Driver itself. That said, I can only recreate the issue with the v2.8.0 version of the driver and not v2.8.1 like you've mentioned. MongoFramework currently references v2.8.0 and maybe it is somehow still using that version rather than v2.8.1

I'm soon going to merge testing of .NET Core 3 into MongoFramework and will release a new version of MongoFramework that references v2.8.1 as I think it will solve the issues you're experiencing.

@Turnerj

This comment has been minimized.

Copy link
Member

commented May 18, 2019

OK, the new version of MongoFramework (v0.11.0) is being validated etc on NuGet right now so should be available for download soon. There are many under-the-hood changes in this version from some pretty big updates recently but it does include changes to better target .NET Core 3 (specifically tested against Preview 5) as well as updating the MongoDB Driver dependency to v2.8.1

Can you please try out this version and let me know how that works for you?

Unfortunately if it doesn't work, there doesn't seem to be much I can do - best bet would be to raise an issue on their Jira (they don't use GitHub for issues) but when they see the stack trace, they may try to throw you back to me (though again, the issue seems to be with their code and I can't fix that).

@dongshengfengniaowu

This comment has been minimized.

Copy link
Author

commented May 20, 2019

OK, much thinks, I will give a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.