Get exception when I want to catch a large number of cards in list - manatee.trello

#gregdennis I wrote this code to catch all cards in one list:
var requestList = new List("556be3f8e4a6b530c795db6d");
var cardsCount = requestList.Cards.Filter(CardFilter.All).ToList();
I test this in URL with this:
https://api.trello.com/1/lists/556be3f8e4a6b530c795db6d/cards?filter=all&key=[myke]&token=[mytoken]
and I got the correct answer but with Manatee this Exception has thrown:
Exception has been thrown by the target of an invocation.
Inner Exception: Expected ','. Path: '$[849].name'
full stack:
System.AggregateException was unhandled
HResult=-2146233088
Message=One or more errors occurred.
Source=Manatee.Trello
StackTrace:
at Manatee.Trello.Internal.ExceptionHandling.DebugLog.Error(Exception e, Boolean shouldThrow) in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello\Internal\ExceptionHandling\DebugLog.cs:line 26
at Manatee.Trello.Internal.DataAccess.JsonRepository.ValidateResponse(IRestRequest request) in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello\Internal\DataAccess\JsonRepository.cs:line 62
at Manatee.Trello.Internal.DataAccess.JsonRepository.Execute[T](TrelloAuthorization auth, Endpoint endpoint, IDictionary`2 parameters) in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello\Internal\DataAccess\JsonRepository.cs:line 28
at Manatee.Trello.ReadOnlyCardCollection.Update() in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello\CardCollection.cs:line 64
at Manatee.Trello.ReadOnlyCollection`1.GetEnumerator() in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello\ReadOnlyCollection.cs:line 58
at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
at OrchidTrello.Program.Main(String[] args) in D:\Projects\Trello API\OrchidTrello\OrchidTrello\Program.cs:line 25
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
HResult=-2146232828
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Manatee.Trello.WebApi.WebApiJsonFormatter.Deserialize(Type type, String content) in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello.WebApi\WebApiJsonFormatter.cs:line 69
at Manatee.Trello.WebApi.WebApiJsonFormatter.Read(Type type, Stream readStream) in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello.WebApi\WebApiJsonFormatter.cs:line 55
at Manatee.Trello.WebApi.WebApiJsonFormatter.<>c__DisplayClass5_0.<ReadFromStreamAsync>b__0() in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello.WebApi\WebApiJsonFormatter.cs:line 42
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Net.Http.HttpContentExtensions.<ReadAsAsyncCore>d__0`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Manatee.Trello.WebApi.WebApiClient.<ExecuteAsync>d__7`1.MoveNext() in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello.WebApi\WebApiClient.cs:line 98
InnerException:
HResult=-2146233088
Message=Expected ','. Path: '$[944].name'
Path=$[944].name
Source=Manatee.Json
StackTrace:
at Manatee.Json.Parsing.JsonParser.Parse(String source) in C:\Users\gregd\OneDrive\Projects\Manatee.Json\Manatee.Json\Parsing\JsonParser.cs:line 51
at Manatee.Json.JsonValue.Parse(String source) in C:\Users\gregd\OneDrive\Projects\Manatee.Json\Manatee.Json\JsonValue.cs:line 343
at Manatee.Trello.ManateeJson.ManateeSerializer.Deserialize[T](String content) in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello.ManateeJson\ManateeSerializer.cs:line 74
InnerException:
this is my version:
<package id="Manatee.Json" version="5.2.0.1" targetFramework="net452" />
<package id="Manatee.Trello" version="1.15.0" targetFramework="net452" />
<package id="Manatee.Trello.ManateeJson" version="1.7.0" targetFramework="net452" />
<package id="Manatee.Trello.WebApi" version="1.0.6" targetFramework="net452" />

There was an issue in Manatee.Json. Please download the latest version (v5.2.1 or higher) to resolve the issue.

Related

Method 'get_Info' in type 'Microsoft.EntityFrameworkCore.SqlServer.Infrastructure.Internal.SqlServerOptionsExtension

I upgraded my web api from .netcore2.1 to 3.1 and updated all nuget packages to their latest version.
Now my api throws the following error
{"StatusCode":500,"ErrorMessage":"Internal server error: Method 'get_Info' in type 'Microsoft.EntityFrameworkCore.SqlServer.Infrastructure.Internal.SqlServerOptionsExtension'
from assembly 'Microsoft.EntityFrameworkCore.SqlServer, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation
Stack: at Microsoft.EntityFrameworkCore.SqlServerDbContextOptionsExtensions.UseSqlServer
at MyApi3.Startup.<ConfigureServices>b__4_0(DbContextOptionsBuilder options) in D:\\a\\1\\s\\MyApi3\\Startup.cs:line 58\
at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.<>c__DisplayClass1_0`2.<AddDbContext>b__0(IServiceProvider p, DbContextOptionsBuilder b)
at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.CreateDbContextOptions[TContext](IServiceProvider applicationServiceProvider, Action`2 optionsAction)
at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.<>c__DisplayClass10_0`1.<AddCoreServices>b__0(IServiceProvider p)
at ResolveService(ILEmitResolverBuilderRuntimeContext , ServiceProviderEngineScope )
at ResolveService(ILEmitResolverBuilderRuntimeContext , ServiceProviderEngineScope )
at ResolveService(ILEmitResolverBuilderRuntimeContext , ServiceProviderEngineScope )
at ResolveService(ILEmitResolverBuilderRuntimeContext , ServiceProviderEngineScope )
at ResolveService(ILEmitResolverBuilderRuntimeContext , ServiceProviderEngineScope )
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired)\r\n at lambda_method(Closure , IServiceProvider , Object[]
at Microsoft.AspNetCore.Mvc.Controllers.ControllerActivatorProvider.<>c__DisplayClass4_0.<CreateActivator>b__0(ControllerContext controllerContext)
at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.<CreateControllerFactory>g__CreateController|0(ControllerContext controllerContext)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
-- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)","SystemMessage":"Method 'get_Info' in type 'Microsoft.EntityFrameworkCore.SqlServer.Infrastructure.Internal.SqlServerOptionsExtension'
from assembly 'Microsoft.EntityFrameworkCore.SqlServer, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation."}
I added the following packages and the issue was solved
Microsoft.EntityFrameworkCore.SQLServer (3.1.2)
and Microsoft.EntityFrameworkCore (3.1.2)
Interesting that I got a runtime error not a build error.

Run WebTest in vNext build via PS-Remoting on Windows 10 server got "System.Data.Entity.Core.ProviderIncompatibleException"

In TFS vNext build I deploy serveral webtests via PS-Remoting to one Windows 10 test agent and run all webtests. It does not not stable because sometimes I get an error with "System.Data.Entity.Core.ProviderIncompatibleException" (s.below)
Visual Studio 2015 has be installed on the server. The same tests under the sam condition run very well on Windows 7 test agent.
What is the reason and how could I fix this? Many thanks!
<Timestamp> [5] ERROR <MyService>.GlobalExceptionHandler:29 - Internal Server Error!
System.Data.Entity.Core.ProviderIncompatibleException: The provider did not return a ProviderManifest instance. ---> System.Runtime.InteropServices.COMException: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
at System.Security.Policy.PEFileEvidenceFactory.GetLocationEvidence(SafePEFileHandle peFile, SecurityZone& zone, StringHandleOnStack retUrl)
at System.Security.Policy.PEFileEvidenceFactory.GenerateLocationEvidence()
at System.Security.Policy.PEFileEvidenceFactory.GenerateEvidence(Type evidenceType)
at System.Security.Policy.AssemblyEvidenceFactory.GenerateEvidence(Type evidenceType)
at System.Security.Policy.Evidence.GenerateHostEvidence(Type type, Boolean hostCanGenerate)
at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)
at System.Security.Policy.Evidence.GetHostEvidence(Type type, Boolean markDelayEvaluatedEvidenceUsed)
at System.Security.Policy.AppDomainEvidenceFactory.GenerateEvidence(Type evidenceType)
at System.Security.Policy.Evidence.GenerateHostEvidence(Type type, Boolean hostCanGenerate)
at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)
at System.Security.Policy.Evidence.RawEvidenceEnumerator.MoveNext()
at System.Security.Policy.Evidence.EvidenceEnumerator.MoveNext()
at System.Configuration.ClientConfigPaths.GetEvidenceInfo(AppDomain appDomain, String exePath, String& typeName)
at System.Configuration.ClientConfigPaths.GetTypeAndHashSuffix(AppDomain appDomain, String exePath)
at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig)
at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig)
at System.Configuration.ClientConfigurationHost.RequireCompleteInit(IInternalConfigRecord record)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Xml.XmlConfiguration.XmlReaderSection.get_ProhibitDefaultUrlResolver()
at System.Xml.Schema.Parser..ctor(SchemaType schemaType, XmlNameTable nameTable, SchemaNames schemaNames, ValidationEventHandler eventHandler)
at System.Xml.Schema.XmlSchema.Read(XmlReader reader, ValidationEventHandler validationEventHandler)
at System.Data.Entity.Core.SchemaObjectModel.Schema.SomSchemaSetHelper.AddXmlSchemaToSet(XmlSchemaSet schemaSet, XmlSchemaResource schemaResource, HashSet`1 schemasAlreadyAdded)
at System.Data.Entity.Core.SchemaObjectModel.Schema.SomSchemaSetHelper.ComputeSchemaSet(SchemaDataModelOption dataModel)
at System.Data.Entity.Core.Common.Utils.Memoizer`2.<>c__DisplayClass2.<Evaluate>b__0()
at System.Data.Entity.Core.Common.Utils.Memoizer`2.Result.GetValue()
at System.Data.Entity.Core.Common.Utils.Memoizer`2.Evaluate(TArg arg)
at System.Data.Entity.Core.SchemaObjectModel.Schema.CreateXmlReaderSettings()
at System.Data.Entity.Core.SchemaObjectModel.Schema.Parse(XmlReader sourceReader, String sourceLocation)
at System.Data.Entity.Core.SchemaObjectModel.SchemaManager.ParseAndValidate(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, SchemaDataModelOption dataModel, AttributeValueNotification providerNotification, AttributeValueNotification providerManifestTokenNotification, ProviderManifestNeeded providerManifestNeeded, IList`1& schemaCollection)
at System.Data.Entity.Core.SchemaObjectModel.SchemaManager.ParseAndValidate(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, SchemaDataModelOption dataModel, DbProviderManifest providerManifest, IList`1& schemaCollection)
at System.Data.Entity.Core.SchemaObjectModel.SchemaManager.LoadProviderManifest(XmlReader xmlReader, String location, Boolean checkForSystemNamespace, Schema& schema)
at System.Data.Entity.Core.Common.DbXmlEnabledProviderManifest.Load(XmlReader reader)
at System.Data.Entity.Core.Common.DbXmlEnabledProviderManifest..ctor(XmlReader reader)
at System.Data.SQLite.EF6.SQLiteProviderManifest..ctor(String manifestToken)
at System.Data.SQLite.EF6.SQLiteProviderServices.GetDbProviderManifest(String versionHint)
at System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifest(String manifestToken)
--- End of inner exception stack trace ---
at System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifest(String manifestToken)
at System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest)
at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
at System.Data.Entity.Internal.Linq.InternalSet`1.Create()
at System.Data.Entity.DbSet`1.Create()
at <MyService>.Persistence.EF.DeploymentRepository.CreateDeployment(String name, DeploymentStatus status)
at <MyService>.Persistence.EF.DeploymentRepository.CreateDeployment(String name)
at <MyService>.Controllers.DeploymentController.<CreateDeploymentAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__3`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.HttpServer.<SendAsync>d__0.MoveNext()
Are you installed the same version of VS on Windows 7 test agent? If not, you can try to remove VS from WIN10 and install that version same as WIN7, then try it again.
If the issue still exist, please check the Entity Framework version. Seems related to Entity Framework, see this article for more info, you can try using EFPowerTools to update Nuget EF accordingly.
Please reference below threads:
EntityFramework error: The provider did not return a ProviderManifest instance
How to use Entity Framework Power Tools in Visual Studio 2015?

Asp.net core TempData give 500 error when adding list and redirect to another view

I am try to build alerts list and added them to TempData. But it work if I did not do redirect. When I do redirect it give me 500 error. I set break point in view as well but it did not hit when did redirect other wise it hit correctly.
ActionMethod
public IActionResult Create(CategoryCreateVM input)
{
if (ModelState.IsValid)
{
var category = mapper.Map<Categories>(input);
categoryBL.Add(category);
List<Alert> alert = new List<Alert>();
alert.Add(new Alert("alert-success", "success message"));
alert.Add(new Alert("alert-danger", "danger message"));
TempData["Alert"] = alert;
return RedirectToAction("Index");
}
return View(input);
}
How I access in view.
#{
var alerts = TempData["Alert"] as List<Alert>;
}
#if (alerts != null && alerts.Count > 0)
{
<div class="">
#foreach (var alert in alerts)
{
<div class="alert #alert.AlertClass alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
#alert.Message
</div>
}
</div>
}
Stack Trace.
Exception thrown: 'System.InvalidOperationException' in Microsoft.AspNetCore.Mvc.ViewFeatures.dll
Exception thrown: 'System.InvalidOperationException' in mscorlib.dll
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Information: Executed action MvcSandbox.Controllers.HomeController.Index (MvcSandbox) in 46.4619ms
Exception thrown: 'System.InvalidOperationException' in mscorlib.dll
Exception thrown: 'System.InvalidOperationException' in mscorlib.dll
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware: Error: An unhandled exception has occurred while executing the request
System.InvalidOperationException: The 'Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.TempDataSerializer' cannot serialize an object of type 'MvcSandbox.Controllers.Alert'.
at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.TempDataSerializer.EnsureObjectCanBeSerialized(Object item) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\Internal\TempDataSerializer.cs:line 207
at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.TempDataSerializer.Serialize(IDictionary`2 values) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\Internal\TempDataSerializer.cs:line 142
at Microsoft.AspNetCore.Mvc.ViewFeatures.SessionStateTempDataProvider.SaveTempData(HttpContext context, IDictionary`2 values) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\ViewFeatures\SessionStateTempDataProvider.cs:line 62
at Microsoft.AspNetCore.Mvc.ViewFeatures.TempDataDictionary.Save() in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\ViewFeatures\TempDataDictionary.cs:line 166
at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter.SaveTempData(IActionResult result, ITempDataDictionaryFactory factory, HttpContext httpContext) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\Internal\SaveTempDataFilter.cs:line 91
at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter.OnResultExecuted(ResultExecutedContext context) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\Internal\SaveTempDataFilter.cs:line 80
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.Core\Internal\ControllerActionInvoker.cs:line 1023
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextResourceFilter>d__22.MoveNext() in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.Core\Internal\ControllerActionInvoker.cs:line 1105
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResourceExecutedContext context) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.Core\Internal\ControllerActionInvoker.cs:line 1377
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.Core\Internal\ControllerActionInvoker.cs:line 493
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>d__20.MoveNext() in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.Core\Internal\ControllerActionInvoker.cs:line 164
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Microsoft.AspNetCore.Session.SessionMiddleware.<Invoke>d__9.MoveNext() in D:\temp\Session-dev\Session-dev\src\Microsoft.AspNetCore.Session\SessionMiddleware.cs:line 106
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Session.SessionMiddleware.<Invoke>d__9.MoveNext() in D:\temp\Session-dev\Session-dev\src\Microsoft.AspNetCore.Session\SessionMiddleware.cs:line 123
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()
Exception thrown: 'System.InvalidOperationException' in Microsoft.AspNetCore.Http.dll
Microsoft.AspNetCore.Server.Kestrel: Error: Connection id "0HL1I8OFS17SU": An unhandled exception was thrown by the application.
System.InvalidOperationException: Session has not been configured for this application or request.
at Microsoft.AspNetCore.Http.DefaultHttpContext.get_Session()
at Microsoft.AspNetCore.Mvc.ViewFeatures.SessionStateTempDataProvider.SaveTempData(HttpContext context, IDictionary`2 values) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\ViewFeatures\SessionStateTempDataProvider.cs:line 57
at Microsoft.AspNetCore.Mvc.ViewFeatures.TempDataDictionary.Save() in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\ViewFeatures\TempDataDictionary.cs:line 166
at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter.SaveTempData(IActionResult result, ITempDataDictionaryFactory factory, HttpContext httpContext) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\Internal\SaveTempDataFilter.cs:line 91
at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter.<>c.<OnResultExecuting>b__5_0(Object state) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\Internal\SaveTempDataFilter.cs:line 57
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame.<FireOnStarting>d__178.MoveNext()
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware: Error: An exception was thrown attempting to display the error page.
System.ObjectDisposedException: The response has been aborted due to an unhandled application exception. ---> System.InvalidOperationException: Session has not been configured for this application or request.
at Microsoft.AspNetCore.Http.DefaultHttpContext.get_Session()
at Microsoft.AspNetCore.Mvc.ViewFeatures.SessionStateTempDataProvider.SaveTempData(HttpContext context, IDictionary`2 values) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\ViewFeatures\SessionStateTempDataProvider.cs:line 57
at Microsoft.AspNetCore.Mvc.ViewFeatures.TempDataDictionary.Save() in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\ViewFeatures\TempDataDictionary.cs:line 166
at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter.SaveTempData(IActionResult result, ITempDataDictionaryFactory factory, HttpContext httpContext) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\Internal\SaveTempDataFilter.cs:line 91
at Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.SaveTempDataFilter.<>c.<OnResultExecuting>b__5_0(Object state) in D:\temp\Mvc-dev\src\Microsoft.AspNetCore.Mvc.ViewFeatures\Internal\SaveTempDataFilter.cs:line 57
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame.<FireOnStarting>d__178.MoveNext()
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame.ThrowResponseAbortedException()
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame.<ProduceStartAndFireOnStartingAwaited>d__194.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame.Write(ArraySegment`1 data)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.FrameResponseStream.Write(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.IO.StreamWriter.Write(String value)
at Microsoft.Extensions.RazorViews.BaseView.Write(String value)
at Microsoft.AspNetCore.Diagnostics.RazorViews.ErrorPage.<ExecuteAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Extensions.RazorViews.BaseView.<ExecuteAsync>d__29.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()
Microsoft.AspNetCore.Server.Kestrel: Error: Connection id "0HL1I8OFS17SU": An unhandled exception was thrown by the application.
Finally I figured it out what's the issue after digging into the source code. Asp.Net Core MVC not supported complex data type for TempData currently. It only support string for now. It through this exception while serialize data, if we pass other then string.
The 'Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.TempDataSerializer' cannot serialize an object of type 'MvcSandbox.Controllers.Alert'.
I serialize my list to json and then save in TempData.
Here is how I did this. I create extension method to add and retrieve data from TempData.
const string Alerts = "Alerts";
public static List<Alert> GetAlert(this ITempDataDictionary tempData)
{
CreateAlertTempData(tempData);
return DeserializeAlerts(tempData[Alerts] as string);
}
public static void CreateAlertTempData(this ITempDataDictionary tempData)
{
if (!tempData.ContainsKey(Alerts))
{
tempData[Alerts] = "";
}
}
public static void AddAlert(this ITempDataDictionary tempData, Alert alert)
{
if(alert == null)
{
throw new ArgumentNullException(nameof(alert));
}
var deserializeAlertList = tempData.GetAlert();
deserializeAlertList.Add(alert);
tempData[Alerts] = SerializeAlerts(deserializeAlertList);
}
public static string SerializeAlerts(List<Alert> tempData)
{
return JsonConvert.SerializeObject(tempData);
}
public static List<Alert> DeserializeAlerts(string tempData)
{
if(tempData.Length == 0)
{
return new List<Alert>();
}
return JsonConvert.DeserializeObject<List<Alert>>(tempData);
}
Add Alert it TempData
tempData.AddAlert(new Alert(AlertClass, Message));
Finally get 'TempDatainView' and display.
#if (TempData.GetAlert().Count > 0)
{
<div class="alert-container">
#foreach (var alert in TempData.GetAlert())
{
<div class="alert #alert.AlertClass alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
#alert.Message
</div>
}
</div>
}
Did you configure Session? TempData is using session behind the scenes.
Project.json
"Microsoft.AspNetCore.Session": "1.1.0"
Here is the Startup.cs file. - ConfigureServices method
public void ConfigureServices(IServiceCollection services)
{
services.AddSession();
services.AddMvc();
}
And Configure method.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseSession();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
Now try with TempData, it will work.
And you can set the environment with set ASPNETCORE_ENVIRONMENT=Development environment variable.
This is what I use to enable Session and Temp data on Core Runtime 2.0.6.
ConfigureServices Section of Startup
// Add MVC service.
services.AddMvc(config =>
{
// Configure global usage of antiforgery tokens.
config.Filters.Add(new AutoValidateAntiforgeryTokenAttribute());
})
.AddSessionStateTempDataProvider();
// Adds the ability to use session variables.
services.AddSession(options =>
{
options.Cookie.HttpOnly = true;
});

EF SQL Connection string not conforming to specification

Ok, enough pulling my hair out. This all worked on previous projects.
I'm beginning to think there is a problem somewhere else in the project. That said, I did at one point, have a wrong username and it complained immediately. That means I think it is connection to the SQL Server just error parsing on the Entity Framework Side of things.
Any help is greatly appreciated. Thanks.
Connection String
<add name="QuizDB" connectionString="metadata=res://*/Model.QuizModel.csdl|res://*/Model.QuizModel.ssdl|res://*/Model.QuizModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=myserver.database.windows.net;Initial Catalog=mydatabasename;Integrated Security=False;User ID=myusername;Password=mypassword; MultipleActiveResultSets=True;App=EntityFrameworkEncrypt=True;TrustServerCertificate=False"" providerName="System.Data.EntityClient" />
Error
{
"Message": "An error has occurred.",
"ExceptionMessage": "The underlying provider failed on ConnectionString.",
"ExceptionType": "System.Data.Entity.Core.EntityException",
"StackTrace": " at System.Data.Entity.Core.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)\r\n at System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection)\r\n at System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config)\r\n at System.Data.Entity.Internal.LazyInternalConnection.Initialize()\r\n at System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel()\r\n at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()\r\n at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)\r\n at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()\r\n at System.Data.Entity.Internal.Linq.InternalSet`1.ToString()\r\n at System.String.Concat(Object[] args)\r\n at AutoMapper.AutoMapperMappingException.get_Message()\r\n at System.Web.Http.HttpError..ctor(Exception exception, Boolean includeErrorDetail)\r\n at System.Net.Http.HttpRequestMessageExtensions.<>c__DisplayClass8.<CreateErrorResponse>b__7(Boolean includeErrorDetail)\r\n at System.Net.Http.HttpRequestMessageExtensions.CreateErrorResponse(HttpRequestMessage request, HttpStatusCode statusCode, Func`2 errorCreator)\r\n at System.Web.Http.ExceptionHandling.DefaultExceptionHandler.Handle(ExceptionHandlerContext context)\r\n at System.Web.Http.ExceptionHandling.DefaultExceptionHandler.HandleAsync(ExceptionHandlerContext context, CancellationToken cancellationToken)\r\n at System.Web.Http.ExceptionHandling.ExceptionHandlerExtensions.<HandleAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.HttpServer.<SendAsync>d__0.MoveNext()",
"InnerException": {
"Message": "An error has occurred.",
"ExceptionMessage": "Format of the initialization string does not conform to specification starting at index 111.",
"ExceptionType": "System.ArgumentException",
"StackTrace": " at System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue)\r\n at System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey)\r\n at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules)\r\n at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)\r\n at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)\r\n at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)\r\n at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)\r\n at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)\r\n at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)\r\n at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.SetConnectionString(DbConnection connection, DbConnectionPropertyInterceptionContext`1 interceptionContext)\r\n at System.Data.Entity.Core.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)"
}
}

MVC3 EE CTP - Format of the initialization string does not conform to specification starting at index 0

I have small MVC 3 Entity code first application, I created table in my local database and took the backup of table and restored the data on winhost web hosting database.
In my web.config I have change connection string to winhost connection starting. it wrosk on my desktop.
I transferred my local application to windows, when access the application I am getting this error.
error coming from this method.
public ActionResult ListRecords()
{
var query = from e in db.Envelopes
orderby e.ReportDate descending
select e;
IEnumerable<Envelopes> top10 = query.Take(25);
return View(top10.ToList<Envelopes>());
}
Error message:
Format of the initialization string does not conform to specification starting at index 0.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: Format of the initialization string does not conform to specification starting at index 0.]
System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) +5025863
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +132
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +98
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +64
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +150
System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +59
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name) +399
System.Data.Entity.Internal.LazyInternalConnection.Initialize() +49
System.Data.Entity.Internal.LazyInternalConnection.get_ConnectionHasModel() +10
System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +252
System.Data.Entity.Internal.InternalContext.Initialize() +16
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +16
System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +61
System.Data.Entity.Internal.Linq.InternalSet`1.get_Provider() +15
System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +13
System.Linq.Queryable.OrderByDescending(IQueryable`1 source, Expression`1 keySelector) +66
Envelopesonly.Controllers.HomeController.ListRecords() in HomeController.cs:84
lambda_method(Closure , ControllerBase , Object[] ) +40
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +188
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +56
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +267
System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +20
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +190
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +329
System.Web.Mvc.Controller.ExecuteCore() +115
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +94
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +31
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +23
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +59
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8841105
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Any help fixing this error?
Thanks
SR
Why are you still using the CTP? The release has been out for quite some time. Upgrade, then see if your problem persists. It may be a fixed problem.
The stack trace points out that there is a problem with your connection string.
Fix your connection string, and the problem should dissapear.