Internal error: Object reference not set to an instance of an object

Hi. Whenever I try to compile my code, it fails with this error:-

Error 11 (E0) Internal error: Object reference not set to an instance of an object.

There is no line number or source file shown. What can I do to solve this please?

I am using Oxygene 5.1.35.1025

what code does this? Can you send it to us? (here or private via support@)

Here’s the specific bit that causes the problem. Not sure how much context you need.

result := Instruments
  .Where(i -> not(i.IsSterling and IncludeSterling))
  .Where(i -> not(i.IsDecember and IncludeDecembers))
  .Select(i -> new PriceRow(
    //Code := String.Format('X{0}{1}', Code, i.Code), 
    Bid := i.BidField, 
    Ask := i.AskField)); 

The commented out line is the one that causes the error to occur.

After experimenting, I noticed that having Code := causes the error.

Then I spotted that PriceRow does not have a member called Code.

Using the correct field name makes the code compile. So it seems that instead of producing a sensible error about the incorrect member name, the compiler faulted somewhere.

Hm, now I’m getting

Error 8 (E0) Internal error: EC Cannot Simplify Identifier C:\Projects\Delphi Prism XE2\Feeds\App_Code\CustomFeeds\HaverPrices.pas 261

Combined with intellisense not working, complete class not working, go to interface/implementation not working, syntax highlighting being all over the place, and having to restart VS every few minutes because strange things start to happen, I’m really not enjoying Oxygene as an experience :frowning:

result := Instruments
.Where(i -> (not i.IsSterling or IncludeSterling))
.Where(i -> (not i.IsDecember or IncludeDecembers))
.Select(i -> new HaverPriceRow(
DateStamp := dateStamp,
Contract := String.Format(‘X{0}{1}’, MetalCode, i.Code),
Bid := PriceData.Item(i.BidField), // 263
Ask := PriceData.Item(i.AskField) // 264
)
);

Error 4 (E318) No overloaded method “get_Item” with 0 parameters on type “System.Collections.Generic.Dictionary<System.String,System.Object>” C:\Projects\Delphi Prism XE2\Feeds\App_Code\CustomFeeds\HaverPrices.pas 263

Error 5 (E318) No overloaded method “get_Item” with 0 parameters on type “System.Collections.Generic.Dictionary<System.String,System.Object>” C:\Projects\Delphi Prism XE2\Feeds\App_Code\CustomFeeds\HaverPrices.pas 264

Is this the same project as the one in http://connect.remobjects.com/discussion/1643/visual-studio-exceptions ? If so, can you just mail me directly? ck at rem objects . com

Combined with intellisense not working, complete class not working, go to interface/implementation not working, syntax highlighting being all over the place, and having to restart VS every few minutes because strange things start to happen, I'm really not enjoying Oxygene as an experience :(

These are all related. if syntax highlighting fails the parser state is broken and complete class, intellisense, goto intf/impl are too. Once I have your project i can test this.

Hi Carlo. As I said in the other thread, I’ve put the latest version of this project in a Dropbox folder that is shared with support@remobjects.com.

If you have any problems getting access to it, please let me know and I’ll find another way to get it to you.

got it. we’ll work on it.

Thanks.

By the way, I am stuck trying to deliver an update to this project to a client, so if you have any interim suggestions for workarounds etc they would be much appreciated!

Once I’ve been able to extract it into a testcase I can try to fix it.

reproduced both; the no overload for item() is a code error. Dictionary has an item array property that needs to be accessed with [] not (). Fixing the other one.

@johncc: If you change it to use classes instead of records it should work and perform better. (Will fix to work with records too ofc)

@ck ahh right thanks. Will try it. That’s my C# showing :slight_smile: On the same line though when I used PriceData[i.BidField] was when I got the “Error 8 (E0) Internal error: EC Cannot Simplify Identifier” problem. Is that related to the records vs. classes too?

Record -> Class Workaround cures compiler errors as predicted. Thanks!