microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
744 stars 245 forks source link

Find Event does Not Open #7542

Closed BernhardKloibmueller closed 10 months ago

BernhardKloibmueller commented 1 year ago

1. Describe the bug When using the function "Find Event" the list of events does not open.

2. To Reproduce Open an app Go to a Codeunit Object Press "F1" Select "AL: Find Event"

3. Expected behavior List of Events to select opens

4. Actual behavior Nothing opens

In Output Window you receive this error: Processing of message 'al/getEventPublishersRequest' failed with error: 'One or more errors occurred. (Object reference not set to an instance of an object.)' Details: System.AggregateException: One or more errors occurred. (Object reference not set to an instance of an object.) ---> System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.Extensions.GetEventPublishersRequestHandler.<>cDisplayClass4_1.b__5(MethodSymbol e) in D:\a_work\1\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\LanguageServer\Extensions\GetEventPublishersRequestHandler.cs:line 80 at System.Linq.Parallel.SelectQueryOperator2.SelectQueryOperatorEnumerator1.MoveNext(TOutput& currentElement, TKey& currentKey) at System.Linq.Parallel.SortHelper2.BuildKeysFromSource(GrowingArray1& keys, List1& values) at System.Linq.Parallel.SortHelper2.Sort() at System.Linq.Parallel.OrderPreservingSpoolingTask`2.SpoolingWork() at System.Linq.Parallel.SpoolingTaskBase.Work() at System.Linq.Parallel.QueryTask.BaseWork(Object unused) at System.Linq.Parallel.QueryTask.<>c.<.cctor>b10_0(Object o) at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of inner exception stack trace --- at System.Linq.Parallel.QueryTaskGroupState.QueryEnd(Boolean userInitiatedDispose) at System.Linq.Parallel.OrderPreservingSpoolingTask2.Spool(QueryTaskGroupState groupState, PartitionedStream2 partitions, Shared1 results, TaskScheduler taskScheduler) at System.Linq.Parallel.OrderPreservingMergeHelper2.System.Linq.Parallel.IMergeHelper.Execute() at System.Linq.Parallel.MergeExecutor1.Execute[TKey](PartitionedStream2 partitions, Boolean ignoreOutput, ParallelMergeOptions options, TaskScheduler taskScheduler, Boolean isOrdered, CancellationState cancellationState, Int32 queryId) at System.Linq.Parallel.PartitionedStreamMerger1.Receive[TKey](PartitionedStream2 partitionedStream) at System.Linq.Parallel.SelectQueryOperator2.WrapPartitionedStream[TKey](PartitionedStream2 inputStream, IPartitionedStreamRecipient1 recipient, Boolean preferStriping, QuerySettings settings) at System.Linq.Parallel.UnaryQueryOperator2.UnaryQueryOperatorResults.ChildResultsRecipient.Receive[TKey](PartitionedStream2 inputStream) at System.Linq.Parallel.SortQueryOperatorResults2.ChildResultsRecipient.Receive[TKey](PartitionedStream2 childPartitionedStream) at System.Linq.Parallel.DistinctQueryOperator1.WrapPartitionedStreamHelper[TKey](PartitionedStream2 hashStream, IPartitionedStreamRecipient1 recipient, CancellationToken cancellationToken) at System.Linq.Parallel.DistinctQueryOperator1.WrapPartitionedStream[TKey](PartitionedStream2 inputStream, IPartitionedStreamRecipient1 recipient, Boolean preferStriping, QuerySettings settings) at System.Linq.Parallel.UnaryQueryOperator2.UnaryQueryOperatorResults.ChildResultsRecipient.Receive[TKey](PartitionedStream2 inputStream) at System.Linq.Parallel.SelectManyQueryOperator3.WrapPartitionedStreamNotIndexed[TLeftKey](PartitionedStream2 inputStream, IPartitionedStreamRecipient1 recipient, QuerySettings settings) at System.Linq.Parallel.SelectManyQueryOperator3.WrapPartitionedStream[TLeftKey](PartitionedStream2 inputStream, IPartitionedStreamRecipient1 recipient, Boolean preferStriping, QuerySettings settings) at System.Linq.Parallel.UnaryQueryOperator2.UnaryQueryOperatorResults.ChildResultsRecipient.Receive[TKey](PartitionedStream2 inputStream) at System.Linq.Parallel.SelectManyQueryOperator3.WrapPartitionedStreamNotIndexed[TLeftKey](PartitionedStream2 inputStream, IPartitionedStreamRecipient1 recipient, QuerySettings settings) at System.Linq.Parallel.SelectManyQueryOperator3.WrapPartitionedStream[TLeftKey](PartitionedStream2 inputStream, IPartitionedStreamRecipient1 recipient, Boolean preferStriping, QuerySettings settings) at System.Linq.Parallel.UnaryQueryOperator2.UnaryQueryOperatorResults.ChildResultsRecipient.Receive[TKey](PartitionedStream2 inputStream) at System.Linq.Parallel.ListQueryResults1.GivePartitionedStream(IPartitionedStreamRecipient1 recipient) at System.Linq.Parallel.UnaryQueryOperator2.UnaryQueryOperatorResults.GivePartitionedStream(IPartitionedStreamRecipient1 recipient) at System.Linq.Parallel.UnaryQueryOperator2.UnaryQueryOperatorResults.GivePartitionedStream(IPartitionedStreamRecipient1 recipient) at System.Linq.Parallel.UnaryQueryOperator2.UnaryQueryOperatorResults.GivePartitionedStream(IPartitionedStreamRecipient1 recipient) at System.Linq.Parallel.SortQueryOperatorResults2.GivePartitionedStream(IPartitionedStreamRecipient1 recipient) at System.Linq.Parallel.UnaryQueryOperator2.UnaryQueryOperatorResults.GivePartitionedStream(IPartitionedStreamRecipient1 recipient) at System.Linq.Parallel.QueryOperator1.ExecuteAndGetResultsAsArray() at System.Linq.ParallelEnumerable.ToArray[TSource](ParallelQuery1 source) at Microsoft.Dynamics.Nav.EditorServices.Protocol.LanguageServer.Extensions.GetEventPublishersRequestHandler.HandleAsync(GetEventPublishersRequest request, Int32 requestId, CancellationToken cancellationToken) in D:\a\_work\1\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\LanguageServer\Extensions\GetEventPublishersRequestHandler.cs:line 70 at Microsoft.Dynamics.Nav.EditorServices.Protocol.MessageProtocol.RequestHandlerBase1.HandleAsync(JToken requestContents, Int32 requestId, CancellationToken cancellationToken) in D:\a_work\1\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\MessageProtocol\RequestHandlerBase.cs:line 103 at Microsoft.Dynamics.Nav.EditorServices.Protocol.RequestRegistry.Process(Message message) in D:\a_work\1\s\source\Prod\Microsoft.Dynamics.Nav.EditorServices.Protocol\Endpoints\RequestRegistry.cs:line 106

5. Versions:

dannoe commented 1 year ago

I can not reproduce this problem with Version: 12.1.883011.

BernhardKloibmueller commented 1 year ago

@dannoe thanks for the response.

After your comment I looked into it deeper and found the reason.

I have multiple dependencies. In one of these dependencies there is a tableextension which adds an event to a table from a different app. This app is not present in my app because there are not propagateDependencies activated and I don't need it directly. It seems due do the fact that the source table is missing the error occurs.

So my apps have a structure like this:

AppB adds an eventpublisher to a table of AppC

AppA cannot use "Find Events" nor the "AL Explorer" because of the missing Dependency.

Solution: Add dependency to AppC in AppA.

I will reach out to the developer of AppB and AppC to add propagateDependencies:true to their app,

But is this a bug which would get addressed? in the developer extensions? Thank you in advance.

BazookaMusic commented 1 year ago

The stack trace is a good indication that this is a bug, the extension should never crash.