# Extension class throws an Internal error on compile

**URL:** https://talk.remobjects.com/t/extension-class-throws-an-internal-error-on-compile/11441
**Category:** Elements Bugs
**Tags:** island, oxygene
**Created:** [November 28, 2016, 10:58am UTC](https://talk.remobjects.com/t/extension-class-throws-an-internal-error-on-compile/11441 "2016-11-28T10:58:59Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Adrian\_Veith](https://talk.remobjects.com/user_avatar/talk.remobjects.com/adrian_veith/32/4169_2.png) [@Adrian\_Veith](https://talk.remobjects.com/u/Adrian_Veith)
#### Post date: [November 28, 2016, 10:58am UTC](https://talk.remobjects.com/t/extension-class-throws-an-internal-error-on-compile/11441/1 "2016-11-28T10:58:59Z")

</div>

**IDE:** _Visual Studio X_  
**Version:** _9.0_  
**Target** (If relevant): _Island_  
**Description** :  
extension class throws an Internal error on compile:

```
    type
    Bytes = array of Byte;
    BytesExtension = public extension class(Bytes)
      method setI16(pos: Integer; v: Integer); inline;
      begin
        self[pos]:= v;
        self[pos + 1]:= v shr 8;
      end;
      method getI16(pos: Integer): Integer; inline;
      begin
        result:= (Integer(self[pos+1]) shl 8) or self[pos];
      end;
    end;
    Program = class
    public  
      class method Main(args: array of String): Int32;
      begin
        var b:= new Bytes(10);
        b.setI16(0,1024);
        writeLn(b.getI16(0));
      end;
    end;

```

**Expected Behavior** :  
compile without error - works on .NET

**Actual Behavior** :  
return with error:  
Schweregrad Code Beschreibung Projekt Datei Zeile Quelle Unterdrückungszustand  
Fehler (E0) Internal error: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. IslandBug 0 Build

**Steps** :

---

<div class="post-metadata">

### Author: ![RemObjectsSoftware](https://talk.remobjects.com/user_avatar/talk.remobjects.com/remobjectssoftware/32/15947_2.png) [@RemObjectsSoftware](https://talk.remobjects.com/u/RemObjectsSoftware)
#### Post date: [November 28, 2016, 10:59am UTC](https://talk.remobjects.com/t/extension-class-throws-an-internal-error-on-compile/11441/2 "2016-11-28T10:59:23Z")

</div>

Thanks, logged as bugs://76853

---

<div class="post-metadata">

### Author: ![RemObjectsSoftware](https://talk.remobjects.com/user_avatar/talk.remobjects.com/remobjectssoftware/32/15947_2.png) [@RemObjectsSoftware](https://talk.remobjects.com/u/RemObjectsSoftware)
#### Post date: [December 7, 2016, 8:52am UTC](https://talk.remobjects.com/t/extension-class-throws-an-internal-error-on-compile/11441/3 "2016-12-07T08:52:20Z")

</div>

bugs://76853 got closed with status fixed.

---

<div class="post-metadata">

### Author: ![RemObjectsSoftware](https://talk.remobjects.com/user_avatar/talk.remobjects.com/remobjectssoftware/32/15947_2.png) [@RemObjectsSoftware](https://talk.remobjects.com/u/RemObjectsSoftware)
#### Post date: [September 1, 2020, 5:36am UTC](https://talk.remobjects.com/t/extension-class-throws-an-internal-error-on-compile/11441/4 "2020-09-01T05:36:06Z")

</div>

Logged as [bugs://i64653](https://www.remobjects.com/portal/bugs/?id=i64653).

---

<div class="post-metadata">

### Author: ![RemObjectsSoftware](https://talk.remobjects.com/user_avatar/talk.remobjects.com/remobjectssoftware/32/15947_2.png) [@RemObjectsSoftware](https://talk.remobjects.com/u/RemObjectsSoftware)
#### Post date: [September 1, 2020, 5:36am UTC](https://talk.remobjects.com/t/extension-class-throws-an-internal-error-on-compile/11441/5 "2020-09-01T05:36:07Z")

</div>

[bugs://i64653](https://www.remobjects.com/portal/bugs/?id=i64653) was closed as fixed.
