AL icon indicating copy to clipboard operation
AL copied to clipboard

EXTENSION PUBLICATION - Object reference not set to an instance of an object.

Open aljochid opened this issue 6 months ago • 2 comments

Please include the following with each issue:

1. Describe the bug I have a production environment, to which I make a sandbox copy. In the sandbox environment, I run a customized extension. It currently works fine. The necessary changes are made, it runs, and tests are performed normally. Then, the execution stops, changes are made, and it runs again, and we get this error: Object reference not set to an instance of an object.

Assuming the error could be caused by the code, the latest changes are deleted, leaving the version that did run, and it cannot be published. The same error appears.

Another test is to obtain another sandbox, upload the changes (which initially didn't upload), and it uploads correctly. We try to make more changes, but we can't. The error is always the same.

2. To Reproduce execution, stop execution, re-execute.

  1. Go to '...'
Image

Note: Because the developers need to copy and paste the code snippet, including a code snippet as a media file (i.e. .gif) is not sufficient.

3. Expected behavior Executions are expected to continue to be published in the sandbox

4. Actual behavior You cannot perform more than 2 executions.

Image

5. Versions:

  • AL Language:
  • Visual Studio Code: 16.0.1523709
  • Business Central: 26.1
  • List of Visual Studio Code extensions that you have installed:
  • Version: 1.100.3 (user setup) Commit: 258e40fedc6cb8edf399a463ce3a9d32e7e1f6f3 Date: 2025-06-02T13:30:54.273Z Electron: 34.5.1 ElectronBuildId: 11369351 Chromium: 132.0.6834.210 Node.js: 20.19.0 V8: 13.2.152.41-electron.0 OS: Windows_NT x64 10.0.22631
  • Operating System:
    • [ x] Windows
    • [ ] Linux
    • [ ] MacOS

Final Checklist

Please remember to do the following:

  • [ x] Search the issue repository to ensure you are reporting a new issue

  • [ x] Reproduce the issue after disabling all extensions except the AL Language extension

  • [ x] Simplify your code around the issue to better isolate the problem

Internal work item: AB#580993

aljochid avatar Jun 11 '25 17:06 aljochid

I had a similar error in my docker. The docker was unsuable after I tried to publish my app. The error could be related to the new multiline-text syntax, since the error occured after I switched to runtime to 15.0.

Message (NullReferenceException): RootException: NullReferenceException (HResult: 0x80004003)
Object reference not set to an instance of an object.
ExceptionStackTrace:
   at Microsoft.Dynamics.Nav.Runtime.TextStoreCache.TextStoreObjectCacheEntry.Update(String translationKeyHash, Guid applicationId, Version version, String textHash)
   at Microsoft.Dynamics.Nav.Runtime.TextStoreCache.UpdateCache(Guid applicationId, Version applicationVersion, List`1 textStoreLines, NavAppPublishedAs navAppPublishedAs, NavDiagnostics diagnostics)
   at Microsoft.Dynamics.Nav.Runtime.TextStoreCacheService.UpdateCache(Guid applicationId, Version applicationVersion, String tenantId, NavAppPublishedAs navAppPublishedAs, Boolean isTenantDatabase, List`1 textStoreLines, NavDiagnostics diagnostics)
   at Microsoft.Dynamics.Nav.Runtime.TextStoreDataProvider.AddData(RuntimePackageId runtimePackageId, Guid applicationId, String applicationName, Version applicationVersion, AppTenantId appTenantId, NavAppPublishedAs navAppPublishedAs, NavDiagnostics navDiagnostics, NavAppPackageReader packageReader)
   at Microsoft.Dynamics.Nav.Runtime.TextStoreDataProvider.AddTextDataToTenantDatabase(NavAppRuntimeMetadata appRuntimeMetadata, NavSession session)
   at Microsoft.Dynamics.Nav.Runtime.Apps.NavAppInstallationProcessor.AddTextDataToTextStore(NavSqlConnectionScope tenantDatabaseScope, NavSession session)
   at Microsoft.Dynamics.Nav.Runtime.Apps.NavAppInstallationProcessor.DoTenantTransactionPartOfInstall(NavSqlConnectionScope tenantDatabaseScope, NavSession systemSession, Boolean doNotLoadData)
   at Microsoft.Dynamics.Nav.Runtime.Apps.NavAppInstallationProcessor.<>c__DisplayClass9_0.<HandleInstallTenantDatabase>b__0(NavSession session)
   at Microsoft.Dynamics.Nav.Runtime.Apps.NavAppInstallationProcessor.SetupSessionAndExecuteAction(NavSession session, Action`1 sessionAction, Boolean setupDebugging)
   at Microsoft.Dynamics.Nav.Runtime.Apps.NavAppInstallationProcessor.HandleInstallTenantDatabase(NavSqlConnectionScope tenantDatabaseScope, NavSession session, Boolean doNotLoadData, Boolean enableDebugging)
   at Microsoft.Dynamics.Nav.Runtime.Apps.NavAppInstaller.ExecuteTenantInstallTransactionPart(NavSqlConnectionScope tenantDatabaseScope, NavSession session, NavAppInstallationProcessor processor, Boolean doNotLoadData, Boolean enableDebugging, NavAppSyncMode syncMode, String origin)
CallerStackTrace:
   at Microsoft.Dynamics.Nav.Runtime.Apps.NavAppInstaller.ExecuteTenantInstallTransactionPart(NavSqlConnectionScope tenantDatabaseScope, NavSession session, NavAppInstallationProcessor processor, Boolean doNotLoadData, Boolean enableDebugging, NavAppSyncMode syncMode, String origin)
   at Microsoft.Dynamics.Nav.Runtime.Apps.NavAppInstaller.<>c__DisplayClass9_0.<ExecuteTenantDatabaseInstallTransactionParts>b__0(NavAppInstallationProcessor processor)
   at Microsoft.Dynamics.Nav.Runtime.Apps.NavAppInstaller.ExecuteTenantDatabaseTransactionParts(IEnumerable`1 installationProcessors, Func`2 process)
   at Microsoft.Dynamics.Nav.Runtime.Apps.NavAppInstaller.ExecuteTenantDatabaseInstallTransactionParts(NavSqlConnectionScope tenantDatabaseScope, NavSession session, IEnumerable`1 installationProcessors, Boolean doNotLoadData, Boolean enableDebugging, NavAppSyncMode syncMode, String origin)
   at Microsoft.Dynamics.Nav.Runtime.Apps.NavAppInstaller.Install(NavSqlConnectionScope tenantDatabaseScope, NavSqlDatabaseLock tenantLock, NavAppInstallPreCheckHelper precheckResult, NavSession session, String name, NavTenant tenant, Boolean doNotLoadData, String activityId, Boolean enableDebugging, NavAppSyncMode syncMode, String origin)
   at Microsoft.Dynamics.Nav.Runtime.NavManagementTasks.<>c__DisplayClass34_1.<InstallNavApp>b__1(NavTenant tenant, NavSession session)
   at Microsoft.Dynamics.Nav.Runtime.NavManagementTasks.<>c__DisplayClass34_0.<InstallNavApp>b__0()
   at Microsoft.Dynamics.Nav.Runtime.NavManagementTasks.InstallNavApp(InstallNavAppArguments installNavAppArguments, Boolean async)
   at Microsoft.Dynamics.Nav.Runtime.NavManagementTasks.InstallNavApp(InstallNavAppArguments installNavAppArguments)
   at Microsoft.Dynamics.Nav.Service.NSAdminService.<>c__DisplayClass61_0.<Microsoft.BusinessCentral.AdminApi.INCLAdminService.InstallNavApp>b__0(NavSession session)
   at Microsoft.Dynamics.Nav.Service.NSAdminService.<>c__DisplayClass60_0`1.<RunActionOnRequestedTenant>b__0()
   at Microsoft.Dynamics.Nav.Runtime.Apps.NavAppDiagnosticSession.<>c__DisplayClass1_0`1.<SendTraceTagOnFailure>b__0()
   at Microsoft.Dynamics.Nav.Runtime.Apps.NavAppDiagnosticSession.SendTraceTagOnFailure(Action operation, String additionalInfo, Func`2 exceptionMap, String callerName)
   at Microsoft.Dynamics.Nav.Runtime.Apps.NavAppDiagnosticSession.SendTraceTagOnFailure[T](Func`1 operation, String additionalInfo, Func`2 exceptionMap, String callerName)
   at Microsoft.Dynamics.Nav.Service.NSAdminService.RunActionOnRequestedTenant[T](String tenantId, Func`2 action, Boolean throwExceptions, String callerName)
   at Microsoft.Dynamics.Nav.Service.NSAdminService.Microsoft.BusinessCentral.AdminApi.INCLAdminService.InstallNavApp(InstallNavAppArguments installNavAppArguments)
   at Microsoft.Dynamics.Nav.Service.Dev.Publisher.Install(IAdminService adminService, Guid appId, Version version, String tenantId, Boolean useSystemSession, Boolean force, NavAppSyncMode syncMode)
   at Microsoft.Dynamics.Nav.Service.Dev.Publisher.InstallOrUpgrade(SchemaUpdateMode schemaUpdateMode, Version previousInstalledAppVersion, Boolean force, Nullable`1 appId, Version version)
   at Microsoft.Dynamics.Nav.Service.Dev.Publisher.InstallOrUpgradeTargetApp(SchemaUpdateMode schemaUpdateMode, Version previousInstalledAppVersion, IList`1 dependenciesUninstalled)
   at Microsoft.Dynamics.Nav.Service.Dev.Publisher.<>c__DisplayClass56_0.<UnsyncUnpublishPublish>b__4()
   at Microsoft.Dynamics.Nav.Service.Dev.Publisher.UnsyncUnpublishPublish(SchemaUpdateMode schemaUpdateMode, Version previousInstalledAppVersion, List`1 dependenciesUninstalled)
   at Microsoft.Dynamics.Nav.Service.Dev.Publisher.PublishAndInstallExtensionImpl(SchemaUpdateMode schemaUpdateMode)
   at Microsoft.Dynamics.Nav.Service.Dev.Publisher.PublishAndInstallExtension(SchemaUpdateMode schemaUpdateMode)
   at Microsoft.Dynamics.Nav.Service.Dev.DevService.<>c__DisplayClass4_0.<PublishAndInstallExtension>b__0()
   at Microsoft.Dynamics.Nav.Service.Dev.DevService.PublishAndInstallExtension(NavSession session, Stream packageStream, SchemaUpdateMode schemaUpdateMode, Boolean isRad, DependencyPublishingOption publishingOption, Boolean forceUpgrade, Boolean useSystemSession)
   at Microsoft.Dynamics.Nav.Service.Dev.Web.Controllers.AppsController.PublishAndInstall(String tenant, SchemaUpdateMode schemaUpdateMode, Boolean isRad, DependencyPublishingOption dependencyPublishingOption, Boolean forceUpgrade, Boolean useSystemSession)
   at _Diag_.Net._Async_Internals_()
   at Microsoft.Dynamics.Nav.Service.AspNetCore.HttpRequestExtensions.TryReadAsSingleMultipartSectionAsync(HttpRequest request, Func`1 zeroSectionsErrorResult, Func`1 multipleSectionsErrorResult)
   at _Diag_.Net._Async_Internals_()
   at Microsoft.Dynamics.Nav.Service.AspNetCore.HttpRequestExtensions.TryReadAsMultipartAsync(HttpRequest request, Func`2 validateFunc)
   at _Diag_.Net._Async_Internals_()
   at System.IO.Stream.<CopyToAsync>g__Core|27_0(Stream source, Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
   at _Diag_.Net._Async_Internals_()
   at Microsoft.AspNetCore.WebUtilities.MultipartReaderStream.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken)
   at _Diag_.Net._Async_Internals_()
   at Microsoft.AspNetCore.WebUtilities.BufferedReadStream.EnsureBufferedAsync(Int32 minCount, CancellationToken cancellationToken)
   at _Diag_.Net._Async_Internals_()
   at Microsoft.AspNetCore.WebUtilities.FileBufferingReadStream.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken)
   at _Diag_.Net._Async_Internals_()
   at System.IO.Strategies.BufferedFileStreamStrategy.ReadAsyncSlowPath(Task semaphoreLockTask, Memory`1 buffer, CancellationToken cancellationToken)
   at _Diag_.Net._Async_Internals_()

pri-kise avatar Jun 14 '25 06:06 pri-kise

THE ERROR PERSISTS FOR NOW, I FOUND THAT RESTARTING THE ENVIRONMENT ALLOWS PUBLISHING. THE ERROR PASSES AFTER A FEW EXECUTIONS, SO I RESTART THE ENVIRONMENT AND CONTINUE.

aljochid avatar Jun 26 '25 00:06 aljochid

Issue has been fixed. Fix is available on all platform builds for v27 and it is also available on v26 in platform builds 26.0.37867.0 or later.

SVinchi avatar Oct 01 '25 08:10 SVinchi