TypeError: Cannot read properties of null (reading 'updateDynamicTexture') in v7.54.3

Hello,

when running unit tests in Angular I get this error when updating the Babylon packages to v7.54.3. I also tried updating to only v7.54.2 and I get no error there. I can try to create a reproduction if needed.

TypeError: Cannot read properties of null (reading 'updateDynamicTexture')
    at AdvancedDynamicTexture.update (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@babylonjs/core/Materials/Textures/dynamicTexture.js:114:26)
    at func (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@babylonjs/gui/2D/advancedDynamicTexture.js:667:26)
    at apply (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@babylonjs/core/Misc/timingTools.js:17:21)
    at apply (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone.js:1809:37)
    at _ZoneDelegate.invokeTask (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone.js:402:33)
    at ProxyZoneSpec.onInvokeTask (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone-testing.js:2113:39)
    at _ZoneDelegate.invokeTask (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone.js:401:38)
    at ZoneImpl.runTask (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone.js:159:47)
    at call (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone.js:483:34)
    at ZoneTask.invoke (http://localhost:9876/_karma_webpack_/webpack:/node_modules/zone.js/fesm2015/zone.js:472:48)

Welcome aboard!

cc @RaananW, but a repro may be necessary indeed.

How does the unit test look like? Are you mocking the engine object? or not passing it at all?
The culprit is probably this PR - Fix dynamicTexture resize losing track of readiness state by deltakosh · Pull Request #16407 · BabylonJS/Babylon.js · GitHub

From looking at the code, I have a feeling like youare mocking the engine object with certain functions, but it is missing the updateDynamicTexture, but it is really impossible to say without a reproduction or further explanation.

Thanks :blush:
I am not using any mocks in the test.
It’s a default test for a component generated with the Angular CLI that gives this error.

describe('StageComponent', () => {
  let component: StageComponent;
  let fixture: ComponentFixture<StageComponent>;

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      imports: [StageComponent],
    }).compileComponents();

    fixture = TestBed.createComponent(StageComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});

I will try to create a reproduction

1 Like

I’ll watch this topic. I have similar error on GUI element appears.

chunk-TSWBGMKK.js?v=d9944c0f:35594 Uncaught TypeError: Cannot read properties of null (reading 'updateDynamicTexture')
    at t2.update (chunk-TSWBGMKK.js?v=d9944c0f:35594:90)
    at babylonjs-gui.js?v=d9944c0f:1661:35
    at chunk-TSWBGMKK.js?v=d9944c0f:10762:74
setTimeout

I’ll try to reproduce it in PlayGround soon.

1 Like

thanks! let’s understand when that happens and resolve this.

It was fixed in recent release 8.2.2. :+1: Thank you.

1 Like