.NET and (E153) in Elements .2399

Hi
I have few complex projects that compile in older stable version, even in latest Preview .2397 (except issue with Invariant in Java that I reported). But new stable release throws many errors :

(E0) Internal error: System.NullReferenceException: Object reference not set to an instance of an object.
   at RemObjects.Oxygene.Code.Compiler.Compiler.ResolveCRef(ITypeResolutionScope aScope, IBaseInfo aTarget, Func`1 aPos, String aName, String& aError)
   at RemObjects.Oxygene.Code.Compiler.Compiler.ValidateXml(ITypeResolutionScope aScope, String& aComment, IBaseInfo aTarget, ImmutableArray`1 aPos, Node aPos2)
   at RemObjects.Oxygene.Code.Compiler.Compiler.CheckAttributes(ITypeResolutionScope aScope, AttributeTargets at, ImmutableArray`1 aAtt, Action`1 aRemove, ImmutableArray`1 aXML, IBaseInfo aTarget, Boolean aSkipXML)
   at RemObjects.Oxygene.Code.Compiler.Compiler.ResolveType(ScopeInfo lScope, IParsedType aType)
   at RemObjects.Oxygene.Code.Compiler.Compiler.ForAllInternalTypes(Action`1 aAt)
   at RemObjects.Oxygene.Code.Compiler.Compiler.ResolveMembers()	NDK_NET45	

(E153) No matching or parameterless constructor could be found in the ancestor, so an explicit inherited constructor call is required	
(E153) No matching or parameterless constructor could be found in the ancestor, so an explicit inherited constructor call is required 
...

I cannot reproduce the error an easy way (I tried many test cases, we have common code for Delphi, .NET, Java in several projects that I sent few times to Carlo some time ago). Here is a test case (.NET) from original code that compiles but shows the idea of class inheritance and constructor problem :

namespace ConsoleApplication3;

interface

type
  EGIS_Exception = public class( Exception )
    public
      constructor Create( const _message   : String  ;
                          const _refstring : String  ;
                          const _refcode   : Integer
                        ) ; overload;
      constructor Create( const _message   : String  ;
                          const _refstring : String  ;
                          const _refcode   : Integer ;
                          const _exception : Exception
                        ) ; overload;
  end ;

    EGIS_PaintException = public class( EGIS_Exception )
      public
        constructor Create( const _layer     : String ;
                            const _exception : Exception
                          ) ;
    end ;
    
  Program = class
  public
    class method Main(args: array of String): Int32;
  end;

implementation

 constructor EGIS_Exception.Create(
    const _message   : String ;
    const _refstring : String ;
    const _refcode   : Integer
  ) ;
  begin
    inherited Create( '' ) ;
  end ;

  constructor EGIS_Exception.Create(
    const _message   : String ;
    const _refstring : String ;
    const _refcode   : Integer ;
    const _exception : Exception
  ) ;
  begin
      inherited Create( '' , _exception  ) ;
  end ;

  constructor EGIS_PaintException.Create(    // <- compiler errors is displayed here 
    const _layer     : String ;
    const _exception : Exception
  ) ;
  begin
    assert( _exception <> nil ) ;
    
   // comment this line to get the error that I get **
      inherited Create( '', '', 0, _exception ) ;
  end;

class method Program.Main(args: array of String): Int32;
begin
  var box := new EGIS_PaintException( '', nil ) ;
end;

end.

Maybe this will guide You to what has changed since last preview release. All errors occur in classes constructors that call inherited Create(…) but the compiler seems to ignore them (like when commenting the line I marked **) or empty Constructor in base class is not visible. I tried to change the code by adding empty constructors to base classes what solved few errors but at the end there is the Object class that has the constructor.

Please let me know what’s wrong. It’s another stable release that we miss because of some regression issues that suddenly appear (although we were testing middle previews against our projects with success).

Regards
Artur

i’ll log, but i’m pretty sure we’ll need a full testcase that shows the actual error, to reproduce and fix this (you can send us your full project privately, and we will keep it confidential)

Thanks, logged as bugs://82474

I sent You private message with test project.

1 Like

bugs://82474 got closed with status fixed.