Problems mixing Primitive and Entities

I have a fairly complicated Cesium based site that has been mixing primitives and entities without issues for many iterations. The original entities version launch message on this forum indicated that primitives and entities can co-exist safely.
Last night I added a new entity of type 'point' (using the Sandcastle Showcase 'Points' code as an example).
After I call entities.remove to remove my point I also call primitives.removeAll() to remove my primitive types from the scene. I then add another entity of type point. As soon as I add this point entity I get:

An error occurred while rendering. Rendering has stopped.
DeveloperError: This object was destroyed, i.e., destroy() was called.
    at new t (http://localhost:81/Build/Cesium/Cesium.js:424:6660)
    at A.o (http://localhost:81/Build/Cesium/Cesium.js:428:29924)
    at h.update (http://localhost:81/Build/Cesium/Cesium.js:454:5173)
    at x.update (http://localhost:81/Build/Cesium/Cesium.js:455:15704)
    at Y._onTick (http://localhost:81/Build/Cesium/Cesium.js:477:3362)
    at i.raiseEvent (http://localhost:81/Build/Cesium/Cesium.js:424:23947)
    at l.tick (http://localhost:81/Build/Cesium/Cesium.js:431:31042)
    at A.render (http://localhost:81/Build/Cesium/Cesium.js:474:13132)
    at t (http://localhost:81/Build/Cesium/Cesium.js:473:31914)

This happens on creating a new entity and adding to the scene.

I've created a minimal script to repro the problem. Clicking the folllowing button sequence : Entity,Clear,Entity I get the rendering has stopped message.
I'm using Cesium 1.18. Can anyone help me understand the cause of the problem please?

<script id="cesium_sandcastle_script">
    var _viewer;
    var _entity;

    function startup(Cesium) {
        "use strict";

        _entity = null;
        _viewer = new Cesium.Viewer('cesiumContainer',
            animation: false,
            geocoder: false,
            timeline: false,
            orderIndependentTranslucency: false
  Sandcastle.addToolbarButton("Entity", onEntityClick);
        Sandcastle.addToolbarButton("Clear", onClearClick);
    if (typeof Cesium !== "undefined") {
    } else if (typeof require === "function") {
        require(["Cesium"], startup);

    function onEntityClick() {

  _entity = _viewer.entities.add({
          position: Cesium.Cartesian3.fromDegrees(-122.332769, 47.605560),
          point: {
              pixelSize: 15,
              color: Cesium.Color.LIME

    function onClearClick() {

    function clearEntity() {

        if( _entity != null) {
      _viewer.entities.remove( _entity);
      _entity = null;


The Entity layer adds things to scene.primitives to draw the entities, and when you call scene.primitives.removeAll you’re destroying the PointPrimitiveCollection used to draw the point entities.

If you need to use both primitives and entities, you’ll need to call scene.primitives.remove(myPrimitive) instead of calling removeAll.

However, I would recommend switching over entirely to the Entity API. It is built on top of primitives and uses them in an optimal way.

I would also recommend upgrading to the latest version of Cesium. We’ve made some fixes and your example doesn’t crash, it just doesn’t draw the point after the collection has been removed.