When we run the following code, it often crashes our application. We get
System.AccessViolationException: ‘Attempted to read or write protected memory. This is often an indication that other memory is corrupt.’
We use Couchbase.Lite 2.0.3 nuget package. This mostly happens when we run our .net application as a windows service
Code snippet:
IQuery searchQuery;
searchQuery = QueryBuilder.Select(SelectResult.All()).From(DataSource.Database(database)).Where(Function.Lower(Expression.Property(“type”)).EqualTo(Expression.String(type.ToLowerInvariant())));
try
{
// Run the query
var result = searchQuery.Execute().ToList();
var documents = result.Select(x => x.GetDictionary(0) as object).ToList();
return documents;
}
finally
{
searchQuery.Dispose();
}
Error Description in Event Log:
The process was terminated due to an internal error in the .NET Runtime at IP 000007FED161E9EB (000007FED1490000) with exit code c0000005.