LUISGEN Failed to generate LUIS Model when LUIS have Complex entities with subentities - azure-language-understanding

Currently I'm using LUISGen to help my bot to get Intent and Entities easily in C#.
My LUIS APP have main entity with subentities.
Here, I am using LUISGen to generating C# class for a LUIS app and getting the below error
Exception Info: System.ArgumentException: Can not convert Object to String.
at Newtonsoft.Json.Linq.JToken.op_Explicit(JToken value)
at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)
at CallSite.Target(Closure , CallSite , Object )
at LUISGen.Utils.EntityApply(JObject entity, Action`1 action) in D:\a\1\s\packages\LUISGen\src\Utils.cs:line 94
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid5[T0,T1,T2,T3,T4](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
at LUISGen.CSharp.Entities(Object app, Writer w) in D:\a\1\s\packages\LUISGen\src\CSharp.cs:line 161
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3[T0,T1,T2](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at LUISGen.CSharp.Generate(String description, Object app, String className, String space, String outPath) in D:\a\1\s\packages\LUISGen\src\CSharp.cs:line

The issue is in luis:convert and has been fixed since our last release. If you are using the pre-release version of bf and I tried doing luis:generate:cs on the .json file and failed with the same error. you can then doing luis:convert and then luis:generate:cs and it worked.
If you want to run the pre-release version of the bf tool, do the below.
Point npm at the MyGet feed: npm config set registry https://botbuilder.myget.org/F/botframework-cli/npm/
Install the CLI tool: npm install -g #microsoft/botframework-cli
You should install and try using bf luis:generate:cs https://github.com/microsoft/botframework-cli/blob/master/packages/luis/README.md#bf-luisgeneratecs for pre-release.

Related

Error opening MDriven EcoSpace or PMP component designers in Visual Studio .NET Standard project

I created a new .netstandard2.0 MDrivenEcoSpaceAndModelForNetStandard2 project. When it is created, I am not able to open the ecospace or the PMP component designers. I'm using Microsoft Visual Studio Enterprise 2019 Version 16.8.4 and MDriven Framework version 7.0.0.12868. I get the following error when opening the PMP. (BTW, Thanks, I am very happy to see the support for .net standard. Looking forward to getting this component designer issue figured out and everything working again. It's been a very long road converting all my projects over to .net standard/core). Any help is greatly appreciated.
"Unsupported type argument in custom attribute signature."
Instances of this error (1)
Call Stack
at Microsoft.MetadataReader.SignatureUtil.GetTypeId(Type type)
at Microsoft.MetadataReader.MetadataOnlyModule.GetConstructorArguments(ConstructorInfo constructorInfo, Byte[] customAttributeBlob, Int32& index)
at Microsoft.MetadataReader.MetadataOnlyModule.LazyAttributeParse(Token token, ConstructorInfo constructorInfo, IList1& constructorArguments, IList1& namedArguments)
at Microsoft.MetadataReader.MetadataOnlyCustomAttributeData.InitArgumentData()
at Microsoft.MetadataReader.MetadataOnlyCustomAttributeData.get_ConstructorArguments()
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.ConstructAttribute(CustomAttributeData data)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetCustomAttributes(ICustomAttributesDataProvider member, Type filter, CustomAttributesCache cache)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetCustomAttributes(Type type, Type filter, Boolean inherit, CustomAttributesCache cache)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkType.GetCustomAttributes(Type filter, Boolean inherit)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkAttributeCollection.GetAttributes(Type type, Type filter)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkAttributeCollection.GetAttributes(MemberInfo member, Type filter)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkAttributeCollection.get_Attributes()
at Microsoft.VisualStudio.Design.VSDesignSurface.EnsureExtensions(IComponent component)
at Microsoft.VisualStudio.Design.VSDesignSurface.CreateInstance(Type type)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)
Slightly different call stack when opening the ecospace:
Instances of this error (1)
Call Stack
at Microsoft.MetadataReader.SignatureUtil.GetTypeId(Type type)
at Microsoft.MetadataReader.MetadataOnlyModule.GetConstructorArguments(ConstructorInfo constructorInfo, Byte[] customAttributeBlob, Int32& index)
at Microsoft.MetadataReader.MetadataOnlyModule.LazyAttributeParse(Token token, ConstructorInfo constructorInfo, IList1& constructorArguments, IList1& namedArguments)
at Microsoft.MetadataReader.MetadataOnlyCustomAttributeData.InitArgumentData()
at Microsoft.MetadataReader.MetadataOnlyCustomAttributeData.get_ConstructorArguments()
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.ConstructAttribute(CustomAttributeData data)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetCustomAttributes(ICustomAttributesDataProvider member, Type filter, CustomAttributesCache cache)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUtil.GetCustomAttributes(Type type, Type filter, Boolean inherit, CustomAttributesCache cache)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkType.GetCustomAttributes(Type filter, Boolean inherit)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkAttributeCollection.GetAttributes(Type type, Type filter)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkAttributeCollection.GetAttributes(MemberInfo member, Type filter)
at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkAttributeCollection.get_Attributes()
at Microsoft.VisualStudio.Design.VSDesignSurface.EnsureExtensions(IComponent component)
at Microsoft.VisualStudio.Design.VSDesignSurface.CreateInstance(Type type)
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)
MDriven had real issues with the new project file format. It behaves very differently in our CodeGen and Save extensions for Visual Studio.
This is however now improved and we think all is fine from version 7.0.0.12950 and onwards.
When it comes to open designer for EcoSpace and PMP we still have issues - but it seems we are not alone since the same issues shows when trying to open a winforms designer. We will need to see how Visual Studio future release handles this.
Workaround is to link the files to a .netFramework project and edit them there - but compile them in .netstandard/core

Error : Index was outside the bounds of the array in Petapoco with Visual Studio 2010

I have define ConnectionStringName and Namespace in Database.tt and using Petapoco 4.0.2 . But when i Save the Database.tt page then follwing error comes :
Error 1 Running transformation: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Array.InternalGetReference(Void* elemRef, Int32 rank, Int32* pIndices)
at System.Array.GetValue(Int32 index)
at Microsoft.VisualStudio.TextTemplatingBCE09AF683DB0757ACB5E91651A283FE.GeneratedTextTransformation.GetCurrentProject()
at Microsoft.VisualStudio.TextTemplatingBCE09AF683DB0757ACB5E91651A283FE.GeneratedTextTransformation.GetConnectionString(String& connectionStringName, String& providerName)
at Microsoft.VisualStudio.TextTemplatingBCE09AF683DB0757ACB5E91651A283FE.GeneratedTextTransformation.InitConnectionString()
at Microsoft.VisualStudio.TextTemplatingBCE09AF683DB0757ACB5E91651A283FE.GeneratedTextTransformation.LoadTables()
at Microsoft.VisualStudio.TextTemplatingBCE09AF683DB0757ACB5E91651A283FE.GeneratedTextTransformation.TransformText()
at Microsoft.VisualStudio.TextTemplating.TransformationRunner.RunTransformation(TemplateProcessingSession session, String source, ITextTemplatingEngineHost host, String& result)
That's an old version you're using. Better support and bug fixes for T4 have been added in the newer version. Maybe check it out
In my case this error was showing up because I had a typo in one of the table names.

How to do a null check in a LINQ to Entities with SQL CE 4.0

I have a LINQ query:
Dim result = DataContext.Items.Select(Function(p) New With {
.Category = If(p.Category IsNot Nothing, p.Category.Name, String.Empty)
.Name = p.Name
})
This works fine against a SQL Server 2005,2008,2012 DB. When I run it against a SQL CE 4.0 DB, I get this exception:
Exception Details: System.Data.SqlServerCe.SqlCeException: The specified argument
value for the function is not valid. [ Argument # = 3, Name of
function(if known) = case ]
I've isolated the problem to String.Empty. If I use "" directly, the code runs fine. It also works if I use .Category = String.Empty. Seems like a bug in how SqlCe deals with a MemberAccessExpression inside an If MethodCallExpression.
If I take out the .Category line, everything works fine. What's the right way to do a null check in LINQ to SQL CE 4? I've checked Skeet's answer, but I actually want to check the DB value, not my value. I've also seen this answer, but it would load everything into memory which would defeat the purpose of using LINQ.
I still have the exception after upgrading to the EF 6 RC (as per ErikEJ's suggestion). Here's a stack trace:
at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr)
at System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan()
at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options)
at System.Data.SqlServerCe.SqlCeCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.SqlServerCompact.SqlCeMultiCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.SqlServerCompact.SqlCeMultiCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<>c__DisplayClassb.<Reader>b__8()
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TInterceptionContext,TResult](Func`1 operation, TInterceptionContext interceptionContext, Action`1 executing, Action`1 executed)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
This is a bug in currently released SQL Server Compact Entity Framework provider, and fixed in version 6 https://entityframework.codeplex.com/workitem/287. Emtity Framework 6 is supports .NET 4.0, and the NuGet package you want is EntityFramework.SqlServerCompact

EF using Oracle (ODP.NET) works on one machine, throwing exceptions on another

Everything works fine on my development box (Windows 7 64 bit), I am able to retrieve records and save records.
When I deploy out to a Windows Server 2008 (32 bit) machine, I am able to retrieve data and view it fine. The problem comes when I either:
1) Try to save:
System.Data.Entity.Infrastructure.DbUpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.Data.UpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.ArgumentException: The specified value is not an instance of type 'Edm.Decimal'
Parameter name: value
at System.Data.Common.CommandTrees.ExpressionBuilder.Internal.ArgumentValidation.ValidateConstant(TypeUsage constantType, Object value)
at System.Data.Mapping.Update.Internal.UpdateCompiler.GenerateValueExpression(EdmProperty property, PropagatorResult value)
at System.Data.Mapping.Update.Internal.UpdateCompiler.BuildPredicate(DbExpressionBinding target, PropagatorResult referenceRow, PropagatorResult current, TableChangeProcessor processor, Boolean& rowMustBeTouched)
at System.Data.Mapping.Update.Internal.UpdateCompiler.BuildUpdateCommand(PropagatorResult oldRow, PropagatorResult newRow, TableChangeProcessor processor)
at System.Data.Mapping.Update.Internal.TableChangeProcessor.CompileCommands(ChangeNode changeNode, UpdateCompiler compiler)
--- End of inner exception stack trace ---
at System.Data.Mapping.Update.Internal.TableChangeProcessor.CompileCommands(ChangeNode changeNode, UpdateCompiler compiler)
at System.Data.Mapping.Update.Internal.UpdateTranslator.<ProduceDynamicCommands>d__0.MoveNext()
at System.Linq.Enumerable.<ConcatIterator>d__71`1.MoveNext()
at System.Data.Mapping.Update.Internal.UpdateCommandOrderer..ctor(IEnumerable`1 commands, UpdateTranslator translator)
at System.Data.Mapping.Update.Internal.UpdateTranslator.ProduceCommands()
at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)
at System.Data.EntityClient.EntityAdapter.Update(IEntityStateManager entityCache)
at System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options)
at System.Data.Entity.Internal.InternalContext.SaveChanges()
--- End of inner exception stack trace ---
at System.Data.Entity.Internal.InternalContext.SaveChanges()
at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
at System.Data.Entity.DbContext.SaveChanges()
at Dashboard.Data.Repository.RepositoryBase`2.OnCompleteSave()
2) Or try to retrieve the next number in a sequence:
System.InvalidOperationException: The specified cast from a materialized 'System.Decimal' type to the 'System.Int64' type is not valid.
at System.Data.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader`1.GetValue(DbDataReader reader, Int32 ordinal)
at lambda_method(Closure , Shaper )
at System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper)
at System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
at Dashboard.Data.DashboardDbContext.ExecuteScalar[TResult](String query, Object[] parameters) in c:\Builds\1\Exploration Archives\Dashboard (MAIN) (talus test)\Sources\Exploration Archives\Dashboard\Main\Dashboard.Data\Dashboard.contrib.cs:line 23
at Dashboard.Data.Repository.RepositoryBase`2.GetNextIdFromSequence()
The part that confuses me the most is the fact that after being deployed to the Windows Server 2008 machine, things partially work (I am able to retrieve data), but it only breaks when I try to retrieve from a sequence or save.
Any ideas what could be causing this?
Found the issue.
For my ID columns, on my .NET objects I was using data type long, with the corresponding oracle data type number. Worked fine on my machine. Based on other research into this issue, I tried changing the oracle data type to number(19). Still no go.
Seems like long support is flaky at best. I had to change my .NET objects' data types to int, and changed the oracle data types to int as well. This worked.
The part that bothers me most is that it obviously saw number and number(19) as a decimal data type, and it had no problem doing a narrowing conversion for me to long. The issue only came up when I tried to save, doing a non-narrowing conversion long to decimal. Go figure.
Adding a comment here for future reference as this issue also effects the Mysql Drivers - EntityFramework v6 and MySql.Data.Entities.6.8.3.0. Unsigned bigint db columns cause this issue.
"id BIGINT(20) UNSIGNED" causes a "The specified value is not an instance of a valid constant type. Parameter name: type" exception. Changing the associated class property ulong does not help. Binding db column "id BIGINT(20)" to...
[Key]
[Column("id")]
public long Id { get; set; }
...works fine.

MiniProfiler NullReferenceException in SqlServerStorage.LoadInBatch() function due to client timings

I'm getting the following exception when I click on the share link for an individual profile. I'm using the latest version from NuGet, 2.0.1.
The Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at StackExchange.Profiling.Storage.SqlServerStorage.LoadInBatch(DbConnection conn, Object idParameter) in C:\Users\sam\Desktop\MiniProfiler\StackExchange.Profiling\Storage\SqlServerStorage.cs:line 348
at StackExchange.Profiling.Storage.SqlServerStorage.Load(Guid id) in C:\Users\sam\Desktop\MiniProfiler\StackExchange.Profiling\Storage\SqlServerStorage.cs:line 297
at StackExchange.Profiling.UI.MiniProfilerHandler.Results(HttpContext context) in C:\Users\sam\Desktop\MiniProfiler\StackExchange.Profiling\UI\MiniProfilerHandler.cs:line 314
at StackExchange.Profiling.UI.MiniProfilerHandler.ProcessRequest(HttpContext context) in C:\Users\sam\Desktop\MiniProfiler\StackExchange.Profiling\UI\MiniProfilerHandler.cs:line 188
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
The code:
I found what I think is the source of the null reference in the code here:
ClientTimings clientTimings = null;
if (clientTimingList.Count > 0)
{
clientTimings.Timings = clientTimingList;
}
Am I missing something, or is that always going to throw an exception when there are entries in the clientTimingList?
Workarounds:
I thought maybe if I disabled batching, I wouldn't run the LoadInBatch function, but LoadIndividually has the same issue.
I looked for a way to disable client timings, but couldn't find a setting for it.
Maybe I could set a trigger in the database to delete the rows, but that seems a little extreme.
If I get the time, I'll get the code and submit a pull request. I wanted to make sure I wasn't missing anything obvious first.
Looks like it was a bug. I've added a ticket on github and a pull request to fix it: https://github.com/SamSaffron/MiniProfiler/pull/40
The new code looks like this:
if (clientTimingList.Count > 0)
{
clientTimings = new ClientTimings();
clientTimings.Timings = clientTimingList;
}

Resources