Error : Index was outside the bounds of the array in Petapoco with Visual Studio 2010 - 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.

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

BTOUCH:error BI1017:Do not know how to make a signature for System.Int32* in method get_IssueTransport

I am binding JMC objective C static library to Xamarin compatible one, currently I am trying to build my binding project now(which contains ApiDefinition.cs, StructsAndEnums.cs and libJmcSDK.a) but when I try to build this Xamarin binding project I'm getting the following error:
BTOUCH: error BI1017: btouch: Do not know how to make a signature for System.Int32* in method 'get_IssueTransport'.
When I try to search for get_IssueTransport method, their is no search results for this, trying to find the System.Int32 signature as well but not able to find in throughout solution.
Any help in resolving this issue is much appreciated in advance. Thanks.
Answer
Remove unsafe keyword and * from int.
Like:
unsafe int*
Change int* (any pointer type) to IntPtr

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.

Windows 8 Store app, Type.IsClass and System.ComponentModel.DesignerProperties.IsInDesignTool missing

I am investigating Windows 8 Store app development, and am having trouble locating the following members
Type.IsClass
System.ComponentModel.DesignerProperties.IsInDesignTool
Visual studio claims they don't exist, but MSDN suggests they should.
I am obviously missing something silly: Can anyone point me in the right direction please?
Regards
John.
The IsClass property has moved to the TypeInfo class. Basically you need to replace;
bool result = type.IsClass;
with;
bool result = type.GetTypeInfo().IsClass;
GetTypeInfo() is an extension method from the System.Reflection namespace, no not obviously visible on System.Type unless you're already using System.Reflection.
The IsInDesignTool property has moved to another place too and changed name;
bool result = Windows.ApplicationModel.DesignMode.DesignModeEnabled;

Error during solution import in Visual Studio 2010 and when applying a web template

I'm trying to import a solution from a wsp-file into a SharePoint 2010 project in Visual Studio 2010. The solution file results from a site template I exported using the "safe as template" option of a website.
After selecting the solution file I exported and specifying the single items I want to import (I select all), Visual Studio starts to import the solution. When it finished with the last item it shows an error message saying:
The SharePoint solution import operation completed, but with errors. As a result, the project may not deploy successfully.
To check whether the import was OK or corrupted I packaged the solution again and try to redeploy it via code by creating a new website collection, uploading the solution file (packaged with Visual Studio) as an user solution (sandboxed solution) to the website collection, activating all features of the solution and applying the web template to the site collection's root website. At the point where the template is applied it takes a long time till a SPException occurs with the following message:
<nativehr>0x80131600</nativehr><nativestack></nativestack>
The inner exception's message is not really better, it says:
<nativehr>0x8107058a</nativehr><nativestack></nativestack><nativehr>0x80131600</nativehr><nativestack></nativestack>
StackTrace:
[COMException (0x8107058a): <nativehr>0x8107058a</nativehr><nativestack></nativestack><nativehr>0x80131600</nativehr><nativestack></nativestack>]
Microsoft.SharePoint.Library.SPRequestInternalClass.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId) +0
Microsoft.SharePoint.Library.SPRequest.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId) +172
[SPException: <nativehr>0x80131600</nativehr><nativestack></nativestack>]
Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx) +27257906
Microsoft.SharePoint.Library.SPRequest.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, String& bstrWebTemplate, Int32& plWebTemplateId) +27639363
Microsoft.SharePoint.SPWeb.ApplyWebTemplate(String strWebTemplate) +1218
Microsoft.SharePoint.ApplicationPages.TemplatePickerUtil.ApplyWebTemplateAndRedirect(SPWeb Web, String strWebTemplate, Nullable`1 bSharedNav, Boolean bOnTopNav, Boolean bOnQuickLaunch, Page page, Boolean bDeleteOnError) +1870
Microsoft.SharePoint.ApplicationPages.TemplatePickPage.BtnSubmit_Click(Object sender, EventArgs e) +129
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981
To validate that the error results from the solution import or packaging process I used the same code to create a website collection but this time using the original wsp-file which was not imported into Visual Studio and packaged again. And this time the web template can be applied without any error.
So I'm wondering what I'm doing wrong when I imported the solution into Visual Studio or when I packaged the solution again.
If you check the Visual Studio output window after the import, you'll likely see something like this in the "SharePoint Tools" output
Total number of items to import: 161
Total number of items imported successfully: 158
Total number of items not imported due to errors: 3
Then if you scroll up in the lines that are detailing what is being imported, you'll see descriptive errors of each item that failed.
In my case, it was
Importing Module: _catalogswfpubApproval - SharePoint 2010_Features\ReviewWorkflowsSPD1033...
Error occurred while importing 'Module: _catalogswfpubApproval - SharePoint 2010_Features\ReviewWorkflowsSPD1033'
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
Which is clear enough.
I simply recreated the project with a project path close to the system root, and it imported successfully.

Resources