Details
-
Bug
-
Resolution: Done
-
Minor - P4
-
1.4
-
None
-
None
Description
public class OperationLog
|
{
|
public BsonObjectId _id { get; set; }
|
public DateTime TimeCreated { get; set; }
|
public string Area { get; set; }
|
public string Controller { get; set; }
|
public string Action { get; set; }
|
public string Operation { get; set; }
|
}
|
const string connectionString = "mongodb://localhost";
|
const string databaseName = "applogs";
|
var server = MongoServer.Create(connectionString);
|
var database= server.GetDatabase(databaseName, SafeMode.Create(true));
|
if (!database.CollectionExists("OperationLog"))
|
{
|
database.CreateCollection("OperationLog");
|
}
|
MongoCollection<OperationLog> collection = database.GetCollection<OperationLog>("OperationLog");
|
var noproblem = collection.AsQueryable<OperationLog>().Where(a => true).ToList(); //This line works without a problem
|
var problem = collection.AsQueryable<OperationLog>().ToList(); //This is where the exception occurs
|
System.ArgumentOutOfRangeException was unhandled
|
HResult=-2146233086
|
Message=Specified argument was out of the range of valid values.
|
Parameter name: Unable to find root IQueryable
|
Source=MongoDB.Driver
|
ParamName=Unable to find root IQueryable
|
StackTrace:
|
at MongoDB.Driver.Linq.MongoQueryTranslator.GetDocumentType(Expression expression) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Linq\Translators\MongoQueryTranslator.cs:line 80
|
at MongoDB.Driver.Linq.MongoQueryTranslator.Translate(MongoQueryProvider provider, Expression expression) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Linq\Translators\MongoQueryTranslator.cs:line 50
|
at MongoDB.Driver.Linq.MongoQueryProvider.Execute(Expression expression) in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Linq\MongoQueryProvider.cs:line 146
|
at MongoDB.Driver.Linq.MongoQueryable`1.GetEnumerator() in C:\work\10gen\mongodb\mongo-csharp-driver\Driver\Linq\MongoQueryable.cs:line 81
|
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
|
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
|
at MyApp.ConsoleApp.Program.Main(String[] args) in D:\MyApp\MyApp.ConsoleApp\Program.cs:line 67
|
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
|
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
|
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
|
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
|
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
|
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
|
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
|
at System.Threading.ThreadHelper.ThreadStart()
|
InnerException:
|
|
|
Attachments
Issue Links
- is duplicated by
-
CSHARP-420 Issue when try to access Collection.AsQueryable<T> when no query is specified
-
- Closed
-