The blocks area did not load properly. Changes to the blocks for screen 5690035441500160_scrHoy will not be saved

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.

AcuerdateDeLaPastillaAbuela1_fixed.aia (482.0 KB)

But even after I removed all blocks from the “scrHoy” screen, the error still occurred. Even after I removed all components / arrangements.

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):

Thank you!

To set this up for the AI2 Issues FAQ, here is the code pattern to avoid,
as seen in the unchive tool …

Bottom line: Do not use text blocks for indexing and math.
(adding to App Inventor Issues FAQ)

The logical and, or, not blocks reject text blocks at docking time. (The Shakespeare example).

Why not have the list indexing and math blocks reject text blocks at dock time?

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.

#2037 fixed a slightly different issue. That was a problem with number inputs showing text when they shouldn’t.

The problem where text blocks don’t get kicked still exists:
TextBlocks

But that shouldn’t be too hard to fix. I can definitely look into it!

Ok I’ve put up a pull request (#2177) to add the block bumping!
NewTextBlocks

If you guys have any other ideas for making this system better, I’m happy to work on stuff :slight_smile:

1 Like

Yes, I knew that, but I removed the blocks here:

@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.

1 Like

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.

1 Like

Aha, thank you, that was the reason I was wondering why I don’t see 0 here:

grafik

Hi, @ewpatton

I am a coder and I had created a professional app.
But after I completed it I went to check it on my phone, and it had some errors. It was 11 In the night so I went to sleep with my computer shut downed.
After I woke up, I went to debug my code but to my surprise, it showed me this message: (The blocks area did not load properly. Changes to the blocks for screen 6730568888090624_Screen1 will not be saved.) and all my effort was gone to waste.
Help me, as this error is continuously coming as I am writing my code.
If you wish to contact me, you can feel free to contact me at removed by Mod - please do not share private info - instead use PM

Regards,
Vihaan Patil

Since it is a professional app you made backups?

3 Likes

Quando si tratta di una app professionale, come ben dice @Peter; devi avere l'accortenza di eseguire tantissimi file AIA..anche ogni 15 minuti; dato che le modifiche al codice sono molto frequenti.

You may have removed an extension or updated it. When blocks from a removed extension are left in the block area, or the new version no longer has any of the blocks. Often such a design fails. Without seeing your project, no one can help.

1 Like

There have been a few reports where things have gone wrong reloading the blocks after the upgrade. As far as I'm aware we have addressed all of them, so assuming this is new we will need you to share your project with us so that we can analyze it.