I have a construction like this in my PQ function in Excel:
= (t)=> List.Generate(()=>[t = t], ...)
When I call the function, I have the error below. And I remember that in general making such constructions:
= (t)=> [t=t]
is a way to troubles, regardless of whether it is PBD or Excel.
But it is perfectly legal from the PQ Specification point of view.
I don't place the info in the error in the PBi forum, because they have too strict rules of posting errors. Hopefully, somebody from the team will pick up the info I provided here ...
So, the error message (and I pressed Throw Error in PQ editor as well):
Unexpected error: Operation is not valid due to the current state of the object.
Details:
Microsoft.Mashup.Evaluator.Interface.ErrorException: Operation is not valid due to the current state of the object. ---> Microsoft.Mashup.Evaluator.Interface.ErrorException: Operation is not valid due to the current state of the object. ---> Microsoft.Mashup.Evaluator.Interface.ErrorException: Operation is not valid due to the current state of the object. ---> Microsoft.Mashup.Evaluator.Interface.ErrorException: Operation is not valid due to the current state of the object. ---> Microsoft.Mashup.Evaluator.Interface.ErrorException: Operation is not valid due to the current state of the object. ---> System.InvalidOperationException: Operation is not valid due to the current state of the object. ---> System.InvalidOperationException: Operation is not valid due to the current state of the object.
at Microsoft.Mashup.Engine1.Language.Compiler.ToFunction(IFunctionExpression expression)
at Microsoft.Mashup.Engine1.Runtime.CollapseNestedFunctionsVisitor.VisitFunction(IFunctionExpression node)
at Microsoft.Mashup.Engine.Ast.AstVisitor2.VisitExpression(IExpression expression)
at Microsoft.Mashup.Engine.Ast.AstVisitor2.VisitListElements(IExpression[] list)
at Microsoft.Mashup.Engine.Ast.AstVisitor2.VisitInvocation(IInvocationExpression invocation)
at Microsoft.Mashup.Engine.Ast.AstVisitor2.VisitExpression(IExpression expression)
at Microsoft.Mashup.Engine.Ast.LogicalAstVisitor21.VisitInitializer(VariableInitializer member) at Microsoft.Mashup.Engine.Ast.AstVisitor2.VisitListElements(VariableInitializer[] list) at Microsoft.Mashup.Engine.Ast.AstVisitor2.VisitListElements(IList
1 list)
at Microsoft.Mashup.Engine.Ast.LogicalAstVisitor21.VisitRecord(IRecordExpression record, TBinding binding, IList
1 bindings)
at Microsoft.Mashup.Engine1.Runtime.CollapseNestedFunctionsVisitor.VisitRecord(IRecordExpression node)
at Microsoft.Mashup.Engine.Ast.AstVisitor2.VisitExpression(IExpression expression)
at Microsoft.Mashup.Engine.Ast.AstVisitor2.VisitFieldAccess(IFieldAccessExpression fieldAccess)
at Microsoft.Mashup.Engine.Ast.AstVisitor2.VisitExpression(IExpression expression)
at Microsoft.Mashup.Engine.Ast.LogicalAstVisitor21.VisitFunction(IFunctionExpression function, IList
1 bindings)
at Microsoft.Mashup.Engine1.Runtime.CollapseNestedFunctionsVisitor.VisitFunction(IFunctionExpression node)
at Microsoft.Mashup.Engine.Ast.AstVisitor2.VisitExpression(IExpression expression)
at Microsoft.Mashup.Engine.Ast.AstVisitor2.VisitInvocation(IInvocationExpression invocation)
at Microsoft.Mashup.Engine.Ast.AstVisitor2.VisitExpression(IExpression expression)
at Microsoft.Mashup.Engine.Ast.LogicalAstVisitor21.VisitFunction(IFunctionExpression function, IList
1 bindings)
at Microsoft.Mashup.Engine1.Runtime.CollapseNestedFunctionsVisitor.VisitFunction(IFunctionExpression node)
at Microsoft.Mashup.Engine.Ast.AstVisitor2.VisitExpression(IExpression expression)
at Microsoft.Mashup.Engine1.Language.Query.NormalizationVisitor.Normalize(IExpression node, TypeValue[] parameterTypes, Boolean normalizeInvocation)
at Microsoft.Mashup.Engine1.Language.Query.QueryExpressionBuilder.TryToQueryExpression(TypeValue type, IFunctionExpression functionExpression, QueryExpression& queryExpression)
at Microsoft.Mashup.Engine1.Language.Query.AddColumnsQuery.CreateQueryExpressions(FunctionValue columnGeneratorFunction, RecordTypeValue rowType)
at Microsoft.Mashup.Engine1.Language.Query.ProjectColumnsQuery.TryAddColumns(ColumnsConstructor columnGenerator, Query& query, ColumnSelection& newColumnProjection)
at Microsoft.Mashup.Engine1.Language.Query.ProjectColumnsQuery.AddColumns(ColumnsConstructor columnGenerator)
at Microsoft.Mashup.Engine1.Language.Query.QueryTableValue.AddColumns(ColumnsConstructor columnGenerator)
at Microsoft.Mashup.Engine1.Runtime.RelatedTablesTableValue.AddColumns(ColumnsConstructor columnsConstructor)
at Microsoft.Mashup.Engine1.Runtime.TableValue.AddColumns(ListValue columnNames, FunctionValue columnGenerator, Value columnTypes)
at Microsoft.Mashup.Engine1.Runtime.NativeFunctionValue45.Invoke(Value arg0, Value arg1, Value arg2, Value arg3) at Microsoft.Mashup.Engine1.Runtime.FunctionValue.Invoke(Value[] args) at Microsoft.Mashup.Engine1.Language.MembersFunctionValue1.Invoke(Value arg0) at Microsoft.Mashup.Engine1.Language.RecordInstruction.RuntimeRecordValue.Force(Int32 index) at Microsoft.Mashup.Engine1.Language.RecordInstruction.RuntimeRecordValue.get_Item(Int32 index) at Microsoft.Mashup.Engine1.Language.RuntimeFunctionValueN.Invoke(Value[] args) at Microsoft.Mashup.Engine1.Language.FunctionInvocationInstruction2.Execute(MembersFrameN& frame) at Microsoft.Mashup.Engine1.Language.RuntimeFunctionValueN.Invoke(Value[] args) at Microsoft.Mashup.Engine1.Language.DebugInstruction.Execute(MembersFrame1& frame) at Microsoft.Mashup.Engine1.Language.FunctionInvocationInstruction2.Execute(MembersFrame1& frame) at Microsoft.Mashup.Engine1.Language.DebugInstruction.Execute(MembersFrame1& frame) at Microsoft.Mashup.Engine1.Language.InstructionInvocationInstruction2.Execute(MembersFrame1& frame) at Microsoft.Mashup.Engine1.Language.DebugInstruction.Execute(MembersFrame1& frame) at Microsoft.Mashup.Engine1.Language.MembersFunctionValue1.Invoke(Value arg0) at Microsoft.Mashup.Engine1.Language.RecordInstruction.RuntimeRecordValue.Force(Int32 index) at Microsoft.Mashup.Engine1.Language.RecordInstruction.RuntimeRecordValue.get_Item(Int32 index) at Microsoft.Mashup.Engine1.Language.FunctionInvocationInstruction2.Execute(MembersFrame1& frame) at Microsoft.Mashup.Engine1.Language.DebugInstruction.Execute(MembersFrame1& frame) at Microsoft.Mashup.Engine1.Language.InstructionInvocationInstruction2.Execute(MembersFrame1& frame) at Microsoft.Mashup.Engine1.Language.DebugInstruction.Execute(MembersFrame1& frame) at Microsoft.Mashup.Engine1.Language.MembersFunctionValue1.Invoke(Value arg0) at Microsoft.Mashup.Engine1.Language.RecordInstruction.RuntimeRecordValue.Force(Int32 index) at Microsoft.Mashup.Engine1.Language.RecordInstruction.RuntimeRecordValue.get_Item(Int32 index) at Microsoft.Mashup.Engine1.Language.MembersFunctionValue1.Invoke(Value arg0) at Microsoft.Mashup.Engine1.Language.RecordInstruction.RuntimeRecordValue.Force(Int32 index) at Microsoft.Mashup.Engine1.Language.RecordInstruction.RuntimeRecordValue.get_Item(Int32 index) at Microsoft.Mashup.Engine1.Runtime.Library.Linker.BindFunctionValue.TypedInvoke(RecordValue environment, Value section, TextValue name) at Microsoft.Mashup.Engine1.Runtime.NativeFunctionValue3
4.Invoke(Value arg0, Value arg1, Value arg2)
at Microsoft.Mashup.Engine1.Language.MembersFunctionValue0.Invoke()
at Microsoft.Mashup.Engine1.Language.ListInstruction.RuntimeListValue.Force(Int32 index)
at Microsoft.Mashup.Engine1.Language.ListInstruction.RuntimeListValue.get_Item(Int32 index)
at Microsoft.Mashup.Engine1.Language.MembersFunctionValue1.Invoke(Value arg0)
at Microsoft.Mashup.Engine1.Language.RecordInstruction.RuntimeRecordValue.Force(Int32 index)
at Microsoft.Mashup.Engine1.Language.RecordInstruction.RuntimeRecordValue.get_Item(Int32 index)
at Microsoft.Mashup.Engine1.Language.FunctionInvocationInstruction2.Execute(MembersFrame1& frame)
at Microsoft.Mashup.Engine1.Language.Instruction.ExecuteCondition(MembersFrame1& frame)
at Microsoft.Mashup.Engine1.Language.DebugInstruction.ExecuteCondition(MembersFrame1& frame)
at Microsoft.Mashup.Engine1.Language.IfInstruction.Execute(MembersFrame1& frame)
at Microsoft.Mashup.Engine1.Language.DebugInstruction.Execute(MembersFrame1& frame)
at Microsoft.Mashup.Engine1.Language.MembersFunctionValue1.Invoke(Value arg0)
at Microsoft.Mashup.Engine1.Language.RecordInstruction.RuntimeRecordValue.Force(Int32 index)
at Microsoft.Mashup.Engine1.Language.RecordInstruction.RuntimeRecordValue.get_Item(Int32 index)
at Microsoft.Mashup.Engine1.Language.MembersFunctionValue0.Invoke()
at Microsoft.Mashup.Evaluator.SimpleDocumentEvaluator.BeginGetResult(DocumentEvaluationParameters parameters, Action1 callback) --- End of inner exception stack trace --- at Microsoft.Mashup.Evaluator.SimpleDocumentEvaluator.BeginGetResult(DocumentEvaluationParameters parameters, Action
1 callback)
at Microsoft.Mashup.Evaluator.SimpleDocumentEvaluator.BeginGetResult(DocumentEvaluationParameters parameters, Action1 callback) at Microsoft.Mashup.Evaluator.Interface.IDocumentEvaluatorExtensions.GetResult[T](IDocumentEvaluator
1 evaluator, DocumentEvaluationParameters parameters)
at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.Service.OnBeginGetResult[T](IMessageChannel channel, BeginGetResultMessage message, Action1 action) at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.Service.OnBeginGetPreviewValueSource(IMessageChannel channel, BeginGetPreviewValueSourceMessage message) at Microsoft.Mashup.Evaluator.MessageHandlers.TryDispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.ChannelMessenger.ChannelMessageHandlers.TryDispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.MessageHandlers.Dispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.ChannelMessenger.OnMessageWithUnknownChannel(IMessageChannel baseChannel, MessageWithUnknownChannel messageWithUnknownChannel) at Microsoft.Mashup.Evaluator.MessageHandlers.TryDispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.ChannelMessenger.ChannelMessageHandlers.TryDispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.MessageHandlers.Dispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.EvaluationHost.Run() at Microsoft.Mashup.Container.EvaluationContainerMain.Run(Object args) at Microsoft.Mashup.Evaluator.SafeThread2.<>c__DisplayClass9_0.<CreateAction>b__0(Object o) at Microsoft.Mashup.Container.EvaluationContainerMain.SafeRun(String[] args) at Microsoft.Mashup.Container.BootstrapAppDomainManager.Execute(String[] argv) --- End of inner exception stack trace --- at Microsoft.Mashup.Evaluator.SimpleDocumentEvaluator.<>c__DisplayClass3_0.<BeginGetResult>b__0(EvaluationResult2
1 result)
--- End of inner exception stack trace ---
at Microsoft.Mashup.Evaluator.SimpleDocumentEvaluator.<>c__DisplayClass3_0.<BeginGetResult>b__0(EvaluationResult21 result) at Microsoft.Mashup.Evaluator.SimpleDocumentEvaluator.BeginGetResult(DocumentEvaluationParameters parameters, Action
1 callback)
at Microsoft.Mashup.Evaluator.SimpleDocumentEvaluator.BeginGetResult(DocumentEvaluationParameters parameters, Action1 callback) at Microsoft.Mashup.Evaluator.Interface.IDocumentEvaluatorExtensions.GetResult[T](IDocumentEvaluator
1 evaluator, DocumentEvaluationParameters parameters)
at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.Service.OnBeginGetResult[T](IMessageChannel channel, BeginGetResultMessage message, Action1 action) at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.Service.OnBeginGetPreviewValueSource(IMessageChannel channel, BeginGetPreviewValueSourceMessage message) at Microsoft.Mashup.Evaluator.MessageHandlers.TryDispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.ChannelMessenger.ChannelMessageHandlers.TryDispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.MessageHandlers.Dispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.ChannelMessenger.OnMessageWithUnknownChannel(IMessageChannel baseChannel, MessageWithUnknownChannel messageWithUnknownChannel) at Microsoft.Mashup.Evaluator.MessageHandlers.TryDispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.ChannelMessenger.ChannelMessageHandlers.TryDispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.MessageHandlers.Dispatch(IMessageChannel channel, Message message) at Microsoft.Mashup.Evaluator.EvaluationHost.Run() at Microsoft.Mashup.Container.EvaluationContainerMain.Run(Object args) at Microsoft.Mashup.Evaluator.SafeThread2.<>c__DisplayClass9_0.<CreateAction>b__0(Object o) at Microsoft.Mashup.Container.EvaluationContainerMain.SafeRun(String[] args) at Microsoft.Mashup.Container.BootstrapAppDomainManager.Execute(String[] argv) --- End of inner exception stack trace --- at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.Service.<>c__DisplayClass9_1.<OnBeginGetPreviewValueSource>b__1() at Microsoft.Mashup.Evaluator.RemotePreviewValueSource.<>c__DisplayClass0_0.<RunStub>b__0() at Microsoft.Mashup.Evaluator.EvaluationHost.ReportExceptions(IHostTrace trace, IEngineHost engineHost, IMessageChannel channel, Action action) --- End of inner exception stack trace --- at Microsoft.Mashup.Evaluator.EvaluationHost.<>c__DisplayClass11_0.<TryReportException>b__1() at Microsoft.Mashup.Common.SafeExceptions.IgnoreSafeExceptions(IEngineHost host, IHostTrace trace, Action action) at Microsoft.Mashup.Evaluator.EvaluationHost.TryReportException(IHostTrace trace, IEngineHost engineHost, IMessageChannel channel, Exception exception) at Microsoft.Mashup.Evaluator.EvaluationHost.ReportExceptions(IHostTrace trace, IEngineHost engineHost, IMessageChannel channel, Action action) at Microsoft.Mashup.Evaluator.RemotePreviewValueSource.RunStub(IEngineHost engineHost, IMessageChannel channel, Func
1 getPreviewValueSource)
at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.Service.<>c__DisplayClass12_11.<OnBeginGetResult>b__0() at Microsoft.Mashup.Evaluator.EvaluationHost.ReportExceptions(IHostTrace trace, IEngineHost engineHost, IMessageChannel channel, Action action) at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.Service.OnBeginGetResult[T](IMessageChannel channel, BeginGetResultMessage message, Action
1 action)
at Microsoft.Mashup.Evaluator.RemoteDocumentEvaluator.Service.OnBeginGetPreviewValueSource(IMessageChannel channel, BeginGetPreviewValueSourceMessage message)
at Microsoft.Mashup.Evaluator.MessageHandlers.TryDispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.ChannelMessenger.ChannelMessageHandlers.TryDispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.MessageHandlers.Dispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.ChannelMessenger.OnMessageWithUnknownChannel(IMessageChannel baseChannel, MessageWithUnknownChannel messageWithUnknownChannel)
at Microsoft.Mashup.Evaluator.MessageHandlers.TryDispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.ChannelMessenger.ChannelMessageHandlers.TryDispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.MessageHandlers.Dispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.EvaluationHost.Run()
at Microsoft.Mashup.Container.EvaluationContainerMain.Run(Object args)
at Microsoft.Mashup.Evaluator.SafeThread2.<>c__DisplayClass9_0.<CreateAction>b__0(Object o)
at Microsoft.Mashup.Container.EvaluationContainerMain.SafeRun(String[] args)
at Microsoft.Mashup.Container.BootstrapAppDomainManager.Execute(String[] argv)
--- End of inner exception stack trace ---
at Microsoft.Mashup.Evaluator.EvaluationHost.OnException(IEngineHost engineHost, IMessageChannel channel, ExceptionMessage message)
at Microsoft.Mashup.Evaluator.MessageHandlers.TryDispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.MessageHandlers.Dispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.ChannelMessenger.ChannelMessageHandlers.TryDispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.MessageHandlers.Dispatch(IMessageChannel channel, Message message)
at Microsoft.Mashup.Evaluator.Interface.IMessageChannelExtensions.WaitFor[T](IMessageChannel channel)
at Microsoft.Mashup.Evaluator.RemotePreviewValueSource.PreviewValueSource.WaitFor(Func1 condition, Boolean disposing) at Microsoft.Mashup.Evaluator.RemotePreviewValueSource.PreviewValueSource.get_TableSource() at Microsoft.Mashup.Evaluator.Interface.TracingPreviewValueSource.get_TableSource() at Microsoft.Mashup.Host.Document.Analysis.PackageDocumentAnalysisInfo.PackagePartitionAnalysisInfo.SetPreviewValue(EvaluationResult2
1 result, Func1 getStaleSince, Func
1 getSampled)