Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XtextSerializationException for cross references to existing objects
XtextSerializationException for cross references to existing objects [message #1810056] Tue, 30 July 2019 07:35 Go to next message
Martin Neumann is currently offline Martin NeumannFriend
Messages: 1
Registered: July 2019
Location: Germany
Junior Member
Hi, a customer has designed an Xtext based DSL for a system I now have to maintain. A colleague wrote some code which generates data in that DSL, but also reads in existing files and amends them.

The problem I'm now facing is that when I try to save an object which contains a cross reference to an already existing object from a different resource, I get
Could not serialize cross reference from
newObject.reference to existingObject

I already checked that the referenced object is loaded successfully and also that it is known by the same ResourceProvider I use to save the new object.
What causes the Exception to be thrown is that the Node of the Token that is about to be written is null, so the Node can not be serialized.

Unfortunately I barely know anything about Xtext, so I don't really know if what I wrote even makes much sense. I also don't know how to find out where the Node for the Token should be set, or if the Node being null is a consequential error of something else I'm not aware of.

I'd be really grateful for any pointers on how to find the cause of that Exception.

The application uses Xtext 2.8.0.v201503090534, if that is important. I know it's old, but so is the whole application and we don't get the budget to update all the dependencies.
Re: XtextSerializationException for cross references to existing objects [message #1810486 is a reply to message #1810056] Mon, 12 August 2019 15:45 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13367
Registered: July 2009
Senior Member
hi, you should debug

String ref = crossRefSerializer.serializeCrossRef(eObjectConsumer.getEObject(),
(CrossReference) element, (EObject) value, node);

and see why the cross reference serializer does not provide a string for your refs. this should work if there is no node too.

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Previous Topic:working example connecting monaco editor with a Xtext LSP server
Next Topic:Writing java-style If statements in XText results in an error
Goto Forum:

Current Time: Wed Feb 26 20:37:54 GMT 2020

Powered by FUDForum. Page generated in 0.03479 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top