web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

CRM Online Unable to Generate Early Bound Class using CRMSvcUtil - NullReferenceException

(0) ShareShare
ReportReport
Posted on by 5

Hi All,

We are trying to generate early bound class with CRMSvc.util, but we are getting System.NullReferenceException.

This is happening for entities only. For optionset and functions there is no issue like this. 

CrmSvcUtil : CRM Service Utility [Version 9.1.0.25]
1> c 2019 Microsoft Corporation. All rights reserved
1>
1>
1> Exiting program with exception: Object reference not set to an instance of an object.
1>EXEC : CrmSvcUtil error : 2 : Exiting program with exit code 2 due to exception : System.NullReferenceException: Object reference not set to an instance of an object.
1> at Microsoft.Crm.Services.Utility.CodeGenerationService.UpdateAttributeMemberStatements(AttributeMetadata attribute, CodeTypeMember attributeMember)
1> at Microsoft.Crm.Services.Utility.CodeGenerationService.BuildAttributeOptionSet(EntityMetadata entity, AttributeMetadata attribute, CodeTypeMember attributeMember, ServiceProvider serviceProvider)
1> at Microsoft.Crm.Services.Utility.CodeGenerationService.BuildEntity(EntityMetadata entity, ServiceProvider serviceProvider)
1> at Microsoft.Crm.Services.Utility.CodeGenerationService.BuildEntities(EntityMetadata[] entityMetadata, ServiceProvider serviceProvider)
1> at Microsoft.Crm.Services.Utility.CodeGenerationService.BuildCodeDom(IOrganizationMetadata organizationMetadata, String outputNamespace, ServiceProvider serviceProvider)
1> at Microsoft.Crm.Services.Utility.CodeGenerationService.Microsoft.Crm.Services.Utility.ICodeGenerationService.Write(IOrganizationMetadata organizationMetadata, String language, String outputFile, String outputNamespace, IServiceProvider services)
1> at Microsoft.Crm.Services.Utility.CrmSvcUtil.WriteCode(IOrganizationMetadata organizationMetadata)
1> at Microsoft.Crm.Services.Utility.CrmSvcUtil.Run()
1> at Microsoft.Crm.Services.Utility.CrmSvcUtil.Main(String[] args)
1>EXEC : CrmSvcUtil error : 2 : ===== DETAIL ======
1>EXEC : CrmSvcUtil error : 2 : Source : CrmSvcUtil
1> Method : UpdateAttributeMemberStatements
1> Date : 2:48:13 PM
1> Time : 12/18/2020
1>EXEC : error : Object reference not set to an instance of an object.
1> Stack Trace : at Microsoft.Crm.Services.Utility.CodeGenerationService.UpdateAttributeMemberStatements(AttributeMetadata attribute, CodeTypeMember attributeMember)
1> at Microsoft.Crm.Services.Utility.CodeGenerationService.BuildAttributeOptionSet(EntityMetadata entity, AttributeMetadata attribute, CodeTypeMember attributeMember, ServiceProvider serviceProvider)
1> at Microsoft.Crm.Services.Utility.CodeGenerationService.BuildEntity(EntityMetadata entity, ServiceProvider serviceProvider)
1> at Microsoft.Crm.Services.Utility.CodeGenerationService.BuildEntities(EntityMetadata[] entityMetadata, ServiceProvider serviceProvider)
1> at Microsoft.Crm.Services.Utility.CodeGenerationService.BuildCodeDom(IOrganizationMetadata organizationMetadata, String outputNamespace, ServiceProvider serviceProvider)
1> at Microsoft.Crm.Services.Utility.CodeGenerationService.Microsoft.Crm.Services.Utility.ICodeGenerationService.Write(IOrganizationMetadata organizationMetadata, String language, String outputFile, String outputNamespace, IServiceProvider services)
1> at Microsoft.Crm.Services.Utility.CrmSvcUtil.WriteCode(IOrganizationMetadata organizationMetadata)
1> at Microsoft.Crm.Services.Utility.CrmSvcUtil.Run()
1> at Microsoft.Crm.Services.Utility.CrmSvcUtil.Main(String[] args)
1> ======================================================================================================================


Thanks in advance.

Sheharyar Hanif

I have the same question (0)
  • Suggested answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    try to use Early Bound Generator (it's a plugin available inside XrmToolBox)

    www.xrmtoolbox.com/.../

  • Sheharyar Hanif Profile Picture
    5 on at

    We have used Early bound generator. Getting same exception. We are able to generate classes for specific entities but not for all entities.

  • KalleK Profile Picture
    32 on at

    I'm having the very same problem!

    Is this a problem with early bound generator or something changed in CRM Online ?

  • Fedorov Profile Picture
    40 on at

    Hello, 

    This started happening for me too just before christmas. Out of nowhere..

    No solution yet?

  • KalleK Profile Picture
    32 on at

    With the latest XRM ToolBox version it should work.

    github.com/.../265

  • Sheharyar Hanif Profile Picture
    5 on at

    Yes we are still facing same issue. But alternative solution is that generate early bound class for only related entities (Entities used in the project). Do not  generate for all. 

  • Suggested answer
    MattB-MSFT Profile Picture
    on at

    This issue was resolved with the nuget release NuGet Gallery | Microsoft.CrmSdk.CoreTools 9.1.0.68  this was release the 2ed week of January. 
    Daryl's XRM toolbox addin was also updated 

    thanks

    MattB. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
iampranjal Profile Picture

iampranjal 41

#2
Martin Dráb Profile Picture

Martin Dráb 38 Most Valuable Professional

#3
Satyam Prakash Profile Picture

Satyam Prakash 35

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans