Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

Object reference not set to an instance of an object. #607

Open
sybaris opened this issue Dec 20, 2023 · 0 comments
Open

Object reference not set to an instance of an object. #607

sybaris opened this issue Dec 20, 2023 · 0 comments
Labels

Comments

@sybaris
Copy link

sybaris commented Dec 20, 2023

Describe the bug
An exception "Object reference not set to an instance of an object" is thrown when using a particular fetchxml

To Reproduce
The following code reproduce the issue

[TestMethod]
       public void TestIssue()
       {
           string fetchxml = @"
               <fetch xmlns:generator='MarkMpn.SQL4CDS'>
                 <entity name='solutioncomponent'>

                   <attribute name='solutionid' />

                   <link-entity name='solutioncomponentdefinition' to='componenttype' from='objecttypecode' alias='solutioncomponentdefinition' link-type='outer'>
                     <attribute name='name' alias='solutioncomponentdefinitionname'/>
                     <attribute name='solutioncomponentdefinitionid' />
                   </link-entity>
                   <filter>
                
<condition attribute = 'name' entityname='solutioncomponentdefinition' operator='not-in'>
<value>AppSetting</value>
<value>AppElement</value>
</condition>

                   </filter>
                 </entity>
               </fetch>
               
";

           var context = MiddlewareBuilder
           .New()
           .AddCrud()
           .AddFakeMessageExecutors()
           .AddFakeMessageExecutors(Assembly.GetAssembly(typeof(RetrieveVersionRequestExecutor)))
           .AddGenericFakeMessageExecutors(Assembly.GetAssembly(typeof(NavigateToNextEntityOrganizationRequestExecutor)))
           .UseCrud()
           .UseMessages()
           .SetLicense(FakeXrmEasyLicense.RPL_1_5)
           .Build();
           context.EnableProxyTypes(Assembly.GetExecutingAssembly());
           context.InitializeMetadata(Assembly.GetExecutingAssembly());

           context.GetOrganizationService().RetrieveMultiple(new FetchExpression(fetchxml));
       }

Expected behavior
No exception, and get the result
Note that if you remove the condition block in the xml part, the unit test is green...

** FakeXrmEasy and Dynamics 365 / CRM version **
2.3.3

@sybaris sybaris added the bug label Dec 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant