We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d4e16ac commit abbd53dCopy full SHA for abbd53d
src/MongoDB.Driver/Linq/Linq3Implementation/Ast/Visitors/AstNodeVisitor.cs
@@ -88,13 +88,18 @@ public TNode VisitAndConvert<TNode>(TNode node)
88
return null;
89
}
90
91
- var newNode = Visit(node) as TNode;
+ var newNode = Visit(node);
92
+ var convertedNewNode = newNode as TNode;
93
if (newNode == null)
94
+ {
95
+ throw new InvalidOperationException($"Expected newNode to be a {typeof(TNode)}, not null.");
96
+ }
97
+ if (convertedNewNode == null)
98
{
99
throw new InvalidOperationException($"Expected newNode to be a {typeof(TNode)}, not a {newNode.GetType()}.");
100
101
- return newNode;
102
+ return convertedNewNode;
103
104
105
public IReadOnlyList<TNode> VisitAndConvert<TNode>(IReadOnlyList<TNode> nodes)
0 commit comments