RonaldK 18 Posted September 18, 2020 (edited) The following code doesn't work in Delphi 10.4.1 anymore: uses Xml.XMLDoc, xml.XMLIntf; type IXMLTest = interface(IXMLNode) ['{3BC4A779-907D-44D5-80A3-1C2D9F704D86}'] end; TXMLTest = class(TXMLNode, IXMLTest) end; procedure TForm2.Button1Click(Sender: TObject); var LXmlDoc : TXmlDocument; LIXMLTest : IXMLTest; begin LXmlDoc := TXmlDocument.Create (nil); LXmlDoc.Options := LXmlDoc.Options + [doNodeAutoIndent]; LIXMLTest := LXmlDoc.GetDocBinding('TEST', TXMLTest, 'http://foo') as IXMLTest; // <-- Error in this line 'No active document' end; It run with no problem in previous Delphi versions (up to 10.3) . Does Delphi 10.4.1 losing an interface reference here? Any idea what's wrong. Edited September 18, 2020 by RonaldK Share this post Link to post
Perpeto 5 Posted September 21, 2020 If I remember it correctly, you have to set "LXmlDoc.Active := true". Share this post Link to post
RonaldK 18 Posted September 21, 2020 (edited) 1 hour ago, Perpeto said: If I remember it correctly, you have to set "LXmlDoc.Active := true". Don't help. A solution is changing declaration: LXmlDoc : TXmlDocument; to: LXmlDoc : IXmlDocument; Seems that code in 10.4.1 have different Interface RefCounter behaviour. Edited September 21, 2020 by RonaldK Share this post Link to post
RonaldK 18 Posted September 21, 2020 (edited) Strangeness today. When I copy/past the above code into the Delphi source editor Last line has font display problems: Edited September 21, 2020 by RonaldK Share this post Link to post