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

NullReferenceException on Exists #462

Closed
SiPurdy opened this issue May 2, 2024 · 0 comments · Fixed by #466
Closed

NullReferenceException on Exists #462

SiPurdy opened this issue May 2, 2024 · 0 comments · Fixed by #466

Comments

@SiPurdy
Copy link

SiPurdy commented May 2, 2024

Experiencing the following Exception with version 9.0

	Exception: MarkMpn.Sql4Cds.Engine.Sql4CdsException (0x80004005): Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object.
	   at MarkMpn.Sql4Cds.Engine.ExecutionPlanBuilder.ConvertTableReference(TableReference reference, IList`1 hints, TSqlFragment query, INodeSchema outerSchema, Dictionary`2 outerReferences, NodeCompilationContext context)
	   at MarkMpn.Sql4Cds.Engine.ExecutionPlanBuilder.ConvertFromClause(FromClause fromClause, IList`1 hints, TSqlFragment query, INodeSchema outerSchema, Dictionary`2 outerReferences, NodeCompilationContext context)
	   at MarkMpn.Sql4Cds.Engine.ExecutionPlanBuilder.ConvertSelectQuerySpec(QuerySpecification querySpec, IList`1 hints, INodeSchema outerSchema, Dictionary`2 outerReferences, NodeCompilationContext context)
	   at MarkMpn.Sql4Cds.Engine.ExecutionPlanBuilder.ConvertExistsSubqueries(IDataExecutionPlanNodeInternal source, IList`1 hints, TSqlFragment query, NodeCompilationContext context, INodeSchema outerSchema, IDictionary`2 outerReferences)
	   at MarkMpn.Sql4Cds.Engine.ExecutionPlanBuilder.ConvertSelectQuerySpec(QuerySpecification querySpec, IList`1 hints, INodeSchema outerSchema, Dictionary`2 outerReferences, NodeCompilationContext context)
	   at MarkMpn.Sql4Cds.Engine.ExecutionPlanBuilder.ConvertPredicateQuery(BooleanExpression predicate, IDataExecutionPlanNodeInternal& predicateSource, String& sourceCol)
	   at MarkMpn.Sql4Cds.Engine.ExecutionPlan.UnparsedGoToNode.Compile()
	   at MarkMpn.Sql4Cds.Engine.Sql4CdsDataReader.Execute(Dictionary`2 parameterTypes, Dictionary`2 parameterValues)
	   at MarkMpn.Sql4Cds.Engine.Sql4CdsDataReader.Execute(Dictionary`2 parameterTypes, Dictionary`2 parameterValues)
	   at MarkMpn.Sql4Cds.Engine.Sql4CdsDataReader.ExecuteWithExceptionHandling(Dictionary`2 parameterTypes, Dictionary`2 parameterValues)
	   at MarkMpn.Sql4Cds.Engine.Sql4CdsDataReader..ctor(Sql4CdsCommand command, IQueryExecutionOptions options, CommandBehavior behavior)
	   at MarkMpn.Sql4Cds.Engine.Sql4CdsCommand.ExecuteDbDataReader(CommandBehavior behavior)
...

The foundation of the query is in the order of:

if exists(select solutionid from solution where uniquename='solution') begin
    print 'Solution Installed'
end
else begin
    print 'Solution Not Installed'
end

So the error was from c# code calling MarkMpn.Sql4Cds.Engine directly. I did originally get the error within XrmToolbox but I think my plugin setup has become corrupted downgrading to 8.0 to check for regression issues.

MarkMpn added a commit that referenced this issue May 3, 2024
@SiPurdy SiPurdy changed the title NullReferenceException on Existss NullReferenceException on Exists May 3, 2024
@MarkMpn MarkMpn mentioned this issue May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant