Comments (5)
Please confirm that the merged PR solved the problem
from nmf.
Yes, this problem has been resolved.
from nmf.
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.
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.
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)
- enum values differ between model and serialization HOT 5
- GC allocations accessing INotifyEnumerable HOT 4
- il2cpp compability for unity3d engine HOT 5
- Ecore2Code does not handle multiple namespaces HOT 5
- MetaRepository can't resolve multiple namespaces with same interface HOT 3
- Code generates incorrectly for models with elements named the same as the class HOT 1
- Support .NET Standard? HOT 4
- Serialization: Boolean TypeConverter doesn't conform to XML standard HOT 3
- Issue loading model created in EMF HOT 4
- Running Ecore2Code on .NET core HOT 7
- Troubles loading EMF instances of an Ecore model HOT 2
- Using NMF metamodels in Unity HOT 4
- "Data at root level is invalid. Line 1, position 1." HOT 1
- Ecore2Code: Generated reference models have incorrect ModelRepresentationClassAttribute HOT 1
- Support for Extrinsic XMI IDs HOT 12
- API question: how to find all usages of an object? HOT 2
- Some names in .ecore file can cause compilation errors HOT 2
- Problem following tutorial with NMF version 2.0.176 HOT 6
- Wrong deserialization of multivalued reference properties HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nmf.