Code Monkey home page Code Monkey logo

Comments (4)

svallee-dev avatar svallee-dev commented on May 14, 2024

Not sure why this is happening yet, but I found out why the code freezes into an infinite loop when using a function in the asm code.

This exception is triggered:
"Collection was modified; enumeration operation may not execute."
at SymbolManager.cs:911

It get caught by the try in AssemblyController.cs (line 113), and as it doesn't have a specific handler, it ends up running this code instead:

else
{
     Assembler.PassNeeded = true;
}

Which I assume cause the code to just get back into another pass, which trigger the same exception, etc etc.

I replaced that line of code by a simple throw; so at least my process stop when an exception is encountered (so I can print it).

I'll keep digging, just thought you might be interested to know :)

from 6502.net.

svallee-dev avatar svallee-dev commented on May 14, 2024

Ok looks like the IEnumerator ephemerals modify itself for some reason during its foreach loop, causing the exception. That makes no sense to me, whatsoever.

But as a dirty fix, I locally changed ephemerals to a List and that fixed my issue! Just... weird.

                    _ephemeralCounter--;
                    var ephemerals = new List<string>(_symbols.Keys.Where(k => k.Contains(sc, StringComparison.Ordinal)));
                    foreach (var key in ephemerals)
                        _symbols.Remove(key);

from 6502.net.

svallee-dev avatar svallee-dev commented on May 14, 2024

Oh I see: it's not that weird. ephemerals is a dynamic query of the _symbols table (the result collection is not created on the spot) so as soon as you call a Remove(), the whole enumerator is invalidated!

So this is a valid bug, but thankfully it's an easy fix :)

from 6502.net.

informedcitizenry avatar informedcitizenry commented on May 14, 2024

thank you @svallee-dev, you are right we have to essentially make ephemerals a separate container of the symbols we are removing from _symbols, which we are mutating. Good catch!

from 6502.net.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.