Skip to content

NullReferenceException with new Runtime 2.22.1.0 #1696

@hpetriffer

Description

@hpetriffer

With the new runtime the following code fails:

public class Test
	public constructor(resource as usual, notUsed := nil as usual, width := 0 as int, height := 0 as int, svgColorMode := ColorMode.Default as ColorMode)
		return
end class

function SafeCreateInstance(symObject as usual, uParams params usual[]) as object
	return CreateInstance(symObject, uParams)


function Start() as void strict
	var x := SafeCreateInstance(#Test, 16, 16)
	Console.ReadLine()

	return


public enum ColorMode

    /// <summary>
    /// Default mode.
    /// </summary>
    Default

    /// <summary>
    /// Light mode.
    /// </summary>
    Light

    /// <summary>
    /// Dark mode.
    /// </summary>
    Dark

    /// <summary>
    /// Custom mode (has to be handled by the user-code).
    /// </summary>
    Custom

end enum

In CreateInstance the following exception is thrown:

XSharp.Error
  HResult=0x80131500
  Message=Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
  Source=XSharp.RT
  StackTrace:
 OOPHELPERS:VALUECONVERT (Line: 0)
 OOPHELPERS:GETDEFAULTVALUE (Line: 0)
 OOPHELPERS:MATCHPARAMETERS (Line: 0)
 _CREATEINSTANCE (Line: 0)
 _CREATEINSTANCE (Line: 0)
 CREATEINSTANCE (Line: 0)
 SAFECREATEINSTANCE (Line: 14)
 START (Line: 18)


  This exception was originally thrown at this call stack:
    XSharp.RT.OOPHelpers.ValueConvert(XSharp.__Usual, System.Type)
    XSharp.RT.OOPHelpers.GetDefaultValue(System.Reflection.ParameterInfo)
    XSharp.RT.Functions._CreateInstance(System.Type, XSharp.__Usual[])

Inner Exception 1:
NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.

XSharpTests.zip

Metadata

Metadata

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions