While some one else might have better diagnostic skills looks to help, here is some loss mitigation and prevention for you âŚ
Look for a recent .aia export file as a fallback.
Keep multiple versions of .aia file exports.
Keep block level .png downloads for all procedures and events, for incremental recovery via drag and drop into a fresh project screen.
upload your .aia export file into https://unchive.kodular.io/build/ to see the blocks that AI2 could not load, to help you recreate them anew in a new Screen or Project. Unchive can see more blocks in your screen than AI2 can.
Beware of unfiltered copy and paste into AI2 text blocks. They can corrupt a project.
@Carlos_Campos_Sabori Iâve taken a look at your project and have a pretty good handle of whatâs going on conceptually. I will fix the issue and upload it here once Iâm done.
Hereâs the fixed version of the project. The issue is that you are using text blocks in many places they shouldnât really be used, such as the indices of list lookups and in math operations. The real problem was that you entered the text âcontadorâ into a text block plugged into a socket expecting a number. This causes App Inventor to fail to load the project. I changed this text block into a variable get block, which I think was your real intent. This is in the btnSoy Click handler.
If the project fails to load, we disabling saving it so that it canât get into an even worse state. You removed all the blocks, but since App Inventor wonât save it wonât fix the problem.
The underlying issue here is that when a check fails during project load, Blockly throws an exception and stops parsing the workspace at that point. This is why it appears as though many blocks disappear in spite of even the smallest of errors. Since we donât want people to inadvertently lose blocks (e.g., you fix the one problem but half the workspace is gone), itâs safer to prevent editing and put up an error because at least then we can intervene.
Iâve put together a potential fix (which is how I repaired this project):
It does. If you try this you will see that it doesn't even allow it to connect. The problem becomes when you have a text block that contains a number, e.g. "0", which we accept due to (your favorite) duck-typing, after which you change the valid value to an invalid value. I believe that this was fixed by @BeksOmega in #2037, but projects may still contain the problematic connections. The fix I linked above will handle the issue when loading projects that contain the bad code and mark the blocks as errors.
@Anke This may have caused other problems depending on how Notepad saved the file. For example, if it included a line ending so that the file wasnât completely empty (zero size), then App Inventor wonât know to regenerate it and will fail when it attempts to read the (now missing) XML. You could try deleting the .bky entirely, in which case the server should do the right thing.
We probably can't make this runtime-foolproof, but all we need here is Blockly-foolproof.
This is the only Blockly-killer I've seen recently, so we're probably good for now.