I would think it would be OK if a nullable was nil.
I’m getting this while trying to get the MongoDB driver library working in Silver 10.0.0.2343. It worked fine in old version of Silver.
System.NullReferenceException: ‘Nullable value is nil’
at RemObjects.Elements.System.GenericNullable1.get_Value() in c:\CI\b\elements\937\Source\RemObjects.Elements.Dynamic\Source\GenericNullable.pas:line 11 at RemObjects.Elements.System.GenericNullable
1.op_Implicit(GenericNullable`1 aVal) in c:\CI\b\elements\937\Source\RemObjects.Elements.Dynamic\Source\GenericNullable.pas:line 61
at Main.DeviceData.getDeviceOptionalBy__id(String id) in C:\Mark\Chic\Server\MainSwift\Cen\Server\User\DeviceData.swift:line 58"
The exception is thrown somewhere in here. I’ve tried everything I can think of, like replacing Builders < T > with Builders<T!>.
static func findOptional(elementName: String, value: BsonValue) -> T!
{
var filter = Builders<T>.Filter.Eq(elementName, value)
var result = mongoCollection.Find(filter)
if result.Count() > 0
{
return result.First()
}
return nil
}
As a workaround, I might create C# wrappers for accessing Mongo. I mean, a C# wrapper that is compatible with Silver as I fear the official MongoDB C# API is not. The official MongoDB C# API uses overly clever C#. Whoever wrote that had too much coffee
Any suggestions?