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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

oDataClient Utility V4. member names cannot be the same as their enclosing type

(0) ShareShare
ReportReport
Posted on by 30

Hi team:

i donlowad metadata  from dynamics URL http..../data/$metadata, then in config odataCliente into localPath:   to code C#generate with oDataCliente.tt.  -> oDataClient.cs

Then.  i have the next error when compiled to code:

Severity Code Description Project File Line Suppression State
Error CS0542 'SystemNotification': member names cannot be the same as their enclosing type ODataUtility
C:\Users\UserABC\Documents\Visual Studio 2015\Projects\Dynamic365\odata\TestODataSolution\ODataUtility\ODataClient.cs
898896 Active

I can See into $metadata file:

Line 3888: <EntityType Name="SystemNotification">
Line 3955: <Annotation Term="Microsoft.Dynamics.OData.Core.V1.LabelId" String="SystemNotification" />
Line 369502: <Action Name="SystemNotification" IsBound="true">
Line 369503: <Parameter Name="SystemNotification" Type="Microsoft.Dynamics.DataEntities.SystemNotification" />
Line 369503: <Parameter Name="SystemNotification" Type="Microsoft.Dynamics.DataEntities.SystemNotification" />
Line 370751: <EntitySet Name="SystemNotification" EntityType="Microsoft.Dynamics.DataEntities.SystemNotification" />
Line 370751: <EntitySet Name="SystemNotification" EntityType="Microsoft.Dynamics.DataEntities.SystemNotification" />

Error ODataClient

Versión Microsoft Dynamics

Installed product version : 10.0.13 (10.0.569.10005)

Installed platform version : Update37 (7.0.5746.35600)

Many thanks for help.

I have the same question (0)
  • frankrasta Profile Picture
    80 on at
    RE: oDataClient Utility V4. member names cannot be the same as their enclosing type

    Hi, guys

    I have workaround for it, 

    I removed in edmx: "SystemNotificationUser" and references Set  Collection and Action,  more i deleted "SystemNotification" too in edmx, then i generated oDataClient.cs from odataClient.tt  without more problems.

    Thats error is by consecuence, of exits one service called NotificationService, that exposed the error in metadata.  Not is a Data Entity.

    Many thanks 

    best regards. 

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,093 on at
    RE: oDataClient Utility V4. member names cannot be the same as their enclosing type

    Hi @frankrasta,

    It's a bug of standard entities, public name and collection name is the same for both entities and both entities contain oData action with the same name as public name and it's causing C# odata generator to generate the not-compilable code. Hopefully, it will be fixed in 10.0.14 GA version.

    As workaround you need open file (better to use notepad or notepad++ as VS can handle such big file)  C:\Users\UserABC\Documents\Visual Studio 2015\Projects\Dynamic365\odata\TestODataSolution\ODataUtility\ODataClient.cs and remove occurencies (complete classes) for SystemNotification\SystemNotificationUser.

  • Sukrut Parab Profile Picture
    71,699 Moderator on at
    RE: oDataClient Utility V4. member names cannot be the same as their enclosing type

    If you duplicated standard entity and forgot to name it differently specially label , public name , public collection name , you may encounter such a issues.

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: oDataClient Utility V4. member names cannot be the same as their enclosing type

    Hi @frankrasta,

    Do you have any modifications to SystemNotificationDataEntity data entity?

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 841 User Group Leader

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 753 Super User 2025 Season 2

#3
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 566

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans