Giter Club home page Giter Club logo

Comments (5)

georghinkel avatar georghinkel commented on August 15, 2024

Please confirm that the merged PR solved the problem

from nmf.

ChrisH07 avatar ChrisH07 commented on August 15, 2024

Yes, this problem has been resolved.

from nmf.

ChrisH07 avatar ChrisH07 commented on August 15, 2024

Attached, Models.zip, are 2 metamodels that recreate this issue at SHA 37a4c19. Code was generated with the following commands:
-n ExampleA -f -o ./ModelA ModelA.nmf
-n ExampleB -f -o ./ModelB ModelB.nmf

This was included in a class library with the following in AssemblyInfo.cs:
[assembly: ModelMetadata("http://exampleA.com/ModelA/", "BlockSketch.MetaModels.ModelA.nmf")] [assembly: ModelMetadata("http://exampleB.com/ModelB/", "BlockSketch.MetaModels.ModelB.nmf")]

This class library was then referenced in a project that creates a model repo. This caused the following exception to occur:

System.Reflection.AmbiguousMatchException
HResult=0x8000211D
Message=Ambiguous match found.
Source=mscorlib
StackTrace:
at System.RuntimeType.GetInterface(String fullname, Boolean ignoreCase)
at System.Type.GetInterface(String name)
at NMF.Models.Repository.MetaRepository.RegisterAssembly(Assembly assembly) in C:\Git\NMF\Models\Models\Repository\MetaRepository.cs:line 173

As a side note, I had trouble recreating this issue with a simple metamodel. This issue occurred for me when both classes were called ModelElement, but I couldn't get this to build since the code generator didn't create the GetClass method. This is may not be related, but the name is the same as an NMeta class and some of my metamodels and OMG metamodels have the same names as NMeta classes. Additionally, if the class has no attributes or references then none of the interface methods are generated, but this is an unrealistic edge case.

EDIT: Sorry I posted the wrong example.

from nmf.

ChrisH07 avatar ChrisH07 commented on August 15, 2024

This issue can be reproduced from SHA 37a4c19 with kdm.txt. This is the OMG KDM metamodel converted to NMF. This metamodel was generated with:

-n OMg -f -o ./OMG/KDM kdm.nmf

This generated the following build errors:

Error CS1061 'Segment' does not contain a definition for 'Segment' and no accessible extension method 'Segment' accepting a first argument of type 'Segment' could be found (are you missing a using directive or an assembly reference?)
Error CS1061 'Segment' does not contain a definition for 'Segment' and no accessible extension method 'Segment' accepting a first argument of type 'Segment' could be found (are you missing a using directive or an assembly reference?)
Error CS1061 'Segment' does not contain a definition for '_segment' and no accessible extension method '_segment' accepting a first argument of type 'Segment' could be found (are you missing a using directive or an assembly reference?)
Error CS1061 'Segment' does not contain a definition for '_segment' and no accessible extension method '_segment' accepting a first argument of type 'Segment' could be found (are you missing a using directive or an assembly reference?)
Error CS0120 An object reference is required for the non-static field, method, or property 'KDMEntity.Track'
Error CS0120 An object reference is required for the non-static field, method, or property 'KDMEntity.Track'

from nmf.

georghinkel avatar georghinkel commented on August 15, 2024

Ah, I recall that I have seen this error before. It is actually not that the problem that the type reference does not take part in the name conflict resolution system, it is rather that in C#, members take precedence over a type name. Therefore, the comiler resolve the name as a member whereas it is thought of being a type.

I put a comment why the fully qualified type name is needed. Further, I included the KDM metamodel (the original Ecore version) as a unit/integration test, so that should never fail again for a published package.

from nmf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.