It appears that the Breeze EFContextProvider is trying to use System.Data.Objects.ObjectContext, which has apparently been moved (see EF 6 System.Data.Objects.ObjectContext Error).
Anyone know how to solve this problem?
This is the error I get returned to the browser from the Metadata action method.
{
*
$id: "1",
*
$type: "System.Web.Http.HttpError, System.Web.Http",
*
Message: "An error has occurred.",
*
ExceptionMessage: "Method not found: 'System.Data.Objects.ObjectContext System.Data.Entity.Infrastructure.IObjectContextAdapter.get_ObjectContext()'.",
*
ExceptionType: "System.MissingMethodException",
*
StackTrace: " at Breeze.WebApi.EFContextProvider`1.GetCsdlFromDbContext(Object context) at Breeze.WebApi.EFContextProvider`1.BuildJsonMetadata() at Breeze.WebApi.ContextProvider.Metadata() at App.Spa.Controllers.BreezeController.Metadata() in ...filepath...\BreezeController.cs:line 23 at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.<GetExecutor>b__c(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c__DisplayClass5.<ExecuteAsync>b__4() at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)"
}
EF 6 is still in Alpha. We probably won't try to support it for Breeze until it at least makes Beta. But you have access to the source via Git, so this specific issue should be pretty easy to fix by changing the source per the post you mentioned.
this is what i tried:
download breeze-master from the github and extract it,
open the Breeze.*.sln with visual studio 2012, update EF6 (remove old EF if exists) using Nuget Manager Package,
you will see some EF namespace referred in breeze-master source were underlined as reference error, to correct them, follow the Update namespace instructions mentioned at
http://entityframework.codeplex.com/wikipage?title=Updating%20Applications%20to%20use%20EF6
rebuild the entire solution and new Breeze.WebApi.dll is created
open your project and add reference to that Breeze.WebApi.dll
Related
I'm developing an application using AWS Lambda and DynamoDB. I'm getting the error below when I try to test my lambda function.
Error:
{
"errorType": "AggregateException",
"errorMessage": "One or more errors occurred. (Could not load type 'Amazon.Runtime.Internal.AsyncRunner' from assembly 'AWSSDK.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604'.)",
"stackTrace": [
"at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)",
"at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)",
"at ProChiller.SyncDevices.QueryDevices(Devices input)",
"at lambda_method(Closure , Stream , Stream , ContextInfo )"
],
"cause": {
"errorType": "TypeLoadException",
"errorMessage": "Could not load type 'Amazon.Runtime.Internal.AsyncRunner' from assembly 'AWSSDK.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604'.",
"stackTrace": [
"at Amazon.DynamoDBv2.DataModel.DynamoDBContext.LoadAsync[T](Object hashKey, CancellationToken cancellationToken)",
"at ProChiller.SyncDevices.d__6.MoveNext()"
]
}
}
As you can see it seems to not be able to load 'AsyncRunner' from the AWSSDK.
Code:
private static AmazonDynamoDBClient amazonDynamoDBClient = new AmazonDynamoDBClient();
public static Devices GetDeviceHandler(Devices input, ILambdaContext context)
{
var task = QueryDevices(input);
task.Wait();
return task.Result;
}
static async Task<Devices> QueryDevices(Devices device)
{
DynamoDBContext dbctx = new DynamoDBContext(amazonDynamoDBClient);
var operation = dbctx.LoadAsync<Devices>(device.TccvID);
Devices devices = await operation;
return devices;
}
What I've Tried:
I tried a number of different ways of querying with Dynamo, but this method is the cleanest and normally gets me the results I'm looking for.
Now I swear I had this code or very similar code working before at one point and I have in the past had issues with the SDK version causing problems when it was updated. I tried rolling back the version of the AWSSDK.Core to see if it was a problem with the newer version of it and my code. However, no matter what version I rollback to I still get the same error.
I've googled around in hopes that someone had a similar issue with that type load , but I could find anyone having written about this specific error or one similar enough that I could extrapolate. I was hoping maybe there was documentation of a specific SDK version I should be running for this type, but was not able to find anything.
The code I've posted is actually a paired down version where I tried to make it as simple as possible in hopes that there was something else I was doing that was causing this error.
Other Build Info:
The application is .Net Core 1.0.
AWSSDK.Core version is 3.3.24.3, but I do notice that in the error is says 'version=3.3.0.0'.
The Question:
Does anyone have an idea what might be causing this type load error? Is there a specific version of the SDK I should roll back to in order to fix this or am I barking up the wrong tree?
Thanks in advance for any help!
Short answer is I think you need to update to a newer version of AWSSDK.DynamoDBv2.
We had a pull request that removed the need for AsyncRunner from AWSSDK.Core that AWSSDK.DynamoDBv2 needed and so it was removed. In hindsight seeing your problem it wasn't the right decision to remove. If you update both your AWSSDK.Core and AWSSDK.DynamoDBv2 packages you would have been fine but in this case you updated just AWSSDK.Core but your older version of AWSSDK.DynamoDBv2 is still referencing AsyncRunner from AWSSDK.Core.
I'll have a discussion with the team and see about adding back AsyncRunner for cases like this.
I have a strange problem. I have a Windows service. Service runs ok on over 100 computers. But on a few of them after a few (or even a month) days it starts to throw exceptions like this:
System.InvalidOperationException: The 'X' property on 'Y' could not be set to a 'System.String' value. You must set this property to a non-null value of type 'System.Int32'.
in System.Data.Entity.Core.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader`1.GetValue(DbDataReader reader, Int32 ordinal)
in System.Data.Entity.Core.Common.Internal.Materialization.Shaper.GetPropertyValueWithErrorHandling[TProperty](Int32 ordinal, String propertyName, String typeName)
in lambda_method(Closure , Shaper )
in System.Data.Entity.Core.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly[TEntity](Func`2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet)
in lambda_method(Closure , Shaper )
in System.Data.Entity.Core.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper)
in System.Data.Entity.Core.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
in System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
in System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
There weren't any modification in code on in database structure. Exception is thrown in a few places. Other applications (not windows services) runs properly with the same database. As I can check some queries runs ok, only a few of them throws this exception. Type are various. Sometimes it can't convert from string to int32 and sometimes (in other query) it can't convert from int32 to string.
To fix the problem we have to restart Windows service.
I don't have any problem with memory (my first suspect). Service use about 100-150MB of ram.
Environment: Framework 4.0, EF 6.1.3, 64bit, SQL Server 2012 Express.
It seems like to need to do alot of logging job here. What I recommend, is that first of all, debug the cases and write logs in each place your code throws exceptions.
As a matter of precaution, do try to check as best as possible if your properties in your object are convertible - using int.TryParse:
if(int.TryParse(X, out intVar)
{
}
else
{
//failed to convert
}
Use also try catch and issue a log error with the exact stack trace, this is preferable for string exceptions as you cannot do try parse on a string property.
There is no easy way here, you will have to dig this through piece by piece.
I am currently experiencing an issues where a handful of queries to stored procedures hooked up via Telerik Open Access (v2015.1.87.3777) are returning the following error:
Exception: System.ArgumentNullException: Value cannot be null. Parameter name: converterName.
The error occurs at the point when the stored procedure is executed in the dynamically generated embedded .cs file of the .rlinq designer. E.g.,
IEnumerable<TestResult> queryResult = this.ExecuteQuery<TestResult>("[TestSchema].[spS_GetTestResult]", CommandType.StoredProcedure, parameterContextID, parameterReturnValue);
However, this is only happening on certain environments and not others, with seemingly the exact same config. This only started happening last night with no code changes. Prior to yesterday everything was working fine across the board.
I can reproduce the issue locally, and if I run the solution locally and point to a database server that I know works everything is fine. But if I change the connection string and point to a different server that I know doesn’t work I get the error. So the underlying code is exactly the same (given I am running it locally) with the only thing changing is the connection string. And it’s calling identical stored procedures – in fact the entire database is a clone of another that works.
I tried rolling back to previous versions of Telerik Open Access, which has had no effect. I have absolutely no idea what could’ve caused this, and no explanation why this is has surfaced, and in particular why it works on some environments, not others.
Here is the exception details.
System.ArgumentNullException was unhandled by user code
HResult=-2147467261
Message=Value cannot be null. Parameter name: converterName
Source=Telerik.OpenAccess.Runtime
ParamName=converterName
StackTrace:
at OpenAccessRuntime.Relational.metadata.RelationalMappingResolver.ResolveTypeConverterName(TypeConverterName
converterName)
at OpenAccessRuntime.Relational.metadata.RelationalMappingResolver.CreateConverter(TypeConverterName
converterName)
at OpenAccessRuntime.DataReaderTypeConverterImpl.Setup(Int32 offset, Type targetType)
at OpenAccessRuntime.DataReaderTypeConverterImpl.Convert(Type targetType, Int32 offset)
at Telerik.OpenAccess.Data.Common.OADataReader.GetConvertedValue[T](Int32
columnIndex)
at Telerik.OpenAccess.Data.Common.PropertyAccessor.Impl`2.Set(Object
inst, OADataReader reader, Int32 columnIndex)
at Telerik.OpenAccess.Data.Common.NonPersistentCapableMaterializer 1.d__0.MoveNext()
at Telerik.OpenAccess.RT.TypedEnumerator 1.MoveNext()
at System.Collections.Generic.List 1..ctor(IEnumerable 1 collection)
at Telerik.OpenAccess.OpenAccessContextBase.ExecuteQuery[T](String
commandText, CommandType commandType, DbParameter[] parameters)
at TestProject.ORM.PresentationData.GetTestResult(Nullable 1 contextID, Int32& returnValue) in
c:\Projects...\DataModels\PresentationData1.cs:line 1789
at TestProject.ORM.PresentationData.GetTestResult(Nullable 1 contextID) in c:\Projects...\DataModels\PresentationData1.cs:line 1768
at TestProject.ORM.DataHelpers.Presentation.GetTestResult(Int32 contextId) in c:\Projects...\DataHelpers\Presentation.cs:line 229
at TestProject.DataServices.PresentationService.GetTestResult(Int32
contextId) in c:\Projects...\PresentationService.svc.cs:line 404
at SyncInvokeGetTestResult(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object
instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&
rpc)
InnerException:
This was due to security updates that were rolled out on said servers. Rolling these patches back resolved the issue: The two security updates were:
KB3194719 (SQL)
KB3197873 (Windows)
Our TFS build has broken following updating the XAML build definition. Changes included modifying the template and a few parameters. The trace is below
TF215097: An error occurred while initializing a build for build definition [REDACTED]:
Exception Message: Cannot set unknown member 'Microsoft.TeamFoundation.Build.Activities.Git.GitPull.CheckoutSubmodules'. (type XamlObjectWriterException)
Exception Stack Trace: at System.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property)
at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
at System.Activities.XamlIntegration.FuncFactory`1.Evaluate()
at System.Activities.DynamicActivity.OnInternalCacheMetadata(Boolean createEmptyBindings)
at System.Activities.Activity.InternalCacheMetadata(Boolean createEmptyBindings, IList`1& validationErrors)
at System.Activities.ActivityUtilities.ProcessActivity(ChildActivity childActivity, ChildActivity& nextActivity, Stack`1& activitiesRemaining, ActivityCallStack parentChain, IList`1& validationErrors, ProcessActivityTreeOptions options, ProcessActivityCallback callback)
at System.Activities.ActivityUtilities.ProcessActivityTreeCore(ChildActivity currentActivity, ActivityCallStack parentChain, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1& validationErrors)
at System.Activities.ActivityUtilities.CacheRootMetadata(Activity activity, LocationReferenceEnvironment hostEnvironment, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1& validationErrors)
at System.Activities.Validation.ActivityValidationServices.InternalActivityValidationServices.InternalValidate()
at Microsoft.TeamFoundation.Build.Workflow.WorkflowHelpers.ValidateWorkflow(Activity activity, ValidationSettings validationSettings)
at Microsoft.TeamFoundation.Build.Hosting.BuildProcessCache.LoadFromXaml(String workflowXaml, TextExpressionImports textExpressionImports)
at Microsoft.TeamFoundation.Build.Hosting.BuildControllerWorkflowManager.PrepareRequestForBuild(WorkflowManagerActivity activity, IBuildDetail build, WorkflowRequest request, IDictionary`2 dataContext)
at Microsoft.TeamFoundation.Build.Hosting.BuildWorkflowManager.TryStartWorkflow(WorkflowRequest request, WorkflowManagerActivity activity, BuildWorkflowInstance& workflowInstance, Exception& error, Boolean& syncLockTaken)
The build fails in the first few seconds as this is the process that is trying to retrieve the source. However, I cannot come to any conclusions as to why this error is happening. A Google search doesn't bring up anything useful.
TFS version 2013
Has anyone encountered this error and if so how did you fix it?
If I need to provide more information please ask.
When you modify the Build process template and therefore it’s no longer in sync with the build definition you may get TF215097 error.
#jessehouwing's suspicion makes sense. I can't find too many articles to elaborate this issue, but in this MSND documentation mentions, if you want to edit a custom template, You must use only Visual Studio 2013 to edit your build process templates of TFS 2013.
Before posting this question I reviewed:
Runtime error when trying to run Fluent NHibernate tutorial example
Fluent nHibernate error - Could not compile the mapping document: (XmlDocument)
and many more similar questions which I was hoping could shed some light on my issue. No luck so far:
I was working a solution for some time now and everything was going fine until my most recent change. The solution still compiles but fails on startup with this exception:
An unhandled exception of type
'FluentNHibernate.Cfg.FluentConfigurationException' occurred in
xx.Initialization.dll
in View Details it says:
An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail."
PotentialReasons: Count = 0
InnerException: Could not compile the mapping document: xx.Website.Persistence.Repository.Mappings.UI.yyDataDto.hbm.xml
Inner exception: JIT Compiler encountered an internal limitation.
The .hbm.xml file that the exception is referring to is intact and there were no changed made to it. All of my code changes are covered by tests and whatever I changed doesn't seem to involve the exception directly.
To troubleshoot this, I committed and pushed all of my changes (feature branch) and asked my co-worker to get latest version. He was able to run the solution without any exceptions. I tried restarting my VS2013, my workstation, deleting my repository and getting the solution from scratch through source control as well as by a direct copy of my co-worker's solution folder (latest version) and still receiving the same error.
Not sure what else to try. Any tips/suggestions would be greatly appreciated. Thanks!
edit/update:
Today I attempted to repair my VS2013 installation, that didn't help. I then updated to latest service pack 4. Also no results.
I'm guessing at this point that something may be wrong with my debugger/settings because if I build the project and launch it (without debugging or by navigating to Bin folder and executing directly) it runs without exceptions. If I debug, I get the exception.
Here's the stacktrace:
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
at Company.Framework.Startup.Behaviour.NHibernateMultiDbBehaviour`2.ConfigureSessionFactory[TFluentMapping](String defaultSchema, String connectionStringKey)
at Company.Framework.Startup.Behaviour.NHibernateMultiDbBehaviour`2.<>c__DisplayClassa`1.<RegisterNHibernate>b__5()
at Castle.MicroKernel.Registration.ComponentRegistration`1.<>c__DisplayClassf`1.<UsingFactoryMethod>b__e(IKernel k, ComponentModel m, CreationContext c)
at Castle.MicroKernel.ComponentActivator.FactoryMethodActivator`1.Instantiate(CreationContext context)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context)
at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context)
at Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context)
at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired)
at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context, Boolean instanceRequired)
at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context)
at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments)
at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service)
at Castle.MicroKernel.DefaultKernel.Resolve(String key, Type service)
at Castle.MicroKernel.DefaultKernel.Resolve[T](String key)
at Company.Framework.Startup.Behaviour.NHibernateMultiDbBehaviour`2.<>c__DisplayClassa`1.<RegisterNHibernate>b__7(IKernel kernel)
at Castle.MicroKernel.Registration.ComponentRegistration`1.<>c__DisplayClass12`1.<UsingFactoryMethod>b__11(IKernel k, ComponentModel m, CreationContext c)
at Castle.MicroKernel.ComponentActivator.FactoryMethodActivator`1.Instantiate(CreationContext context)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context)
at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.Resolve(CreationContext context)
at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired)
at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context, Boolean instanceRequired)
at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context)
at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments)
at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service)
at Castle.MicroKernel.DefaultKernel.Resolve(String key, Type service)
at Castle.Windsor.WindsorContainer.Resolve[T](String key)
at Company.Framework.Startup.Behaviour.NHibernateMultiDbBehaviour`2.RegisterNHibernate[TFluentMapping](String factoryName, String sessionName, String defaultSchema, String connectionStringKey)
at Company.Framework.Startup.Behaviour.NHibernateMultiDbBehaviour`2.Start()
at Company.Framework.Startup.Behaviour.BehaviourManager.AddAndInitialize[T](Action`1 initialize)
at Company.Framework.Startup.Behaviour.BehaviourManager.Add[T](Action`1 initialize)
at Company.Project.Initialization.ServiceInitializator.ConfigureBehaviours() in c:\Path\Project.Initialization\ServiceInitializator.cs:line 99
The solution was to uninstall VS2013 completely and re-install it from scratch. After I did that, the exception went away.
I tried to remember what could've caused this and so far my only suspicion is that maybe when I ran CCleaner (prior to this issue appearing), it removed files or registry entries which made VS behave in such a way.