Error Adding New Sales Order via REST API - Acumatica - rest

I am trying to add a new sales order, with detail rows, to my Acumatica system using the a custom endpoint I created at:
https://172.16.8.65/entity/ASG_INTEGRATION/6.00.001/SalesOrder
This is the JSON body I am sending in Postman:
{
"OrderType": { "value": "SO" },
"CustomerID": { "value": "6362212668" },
"Details":
[
{
"Account": {"value": "4040" },
"Branch": {"value": "00" },
"InventoryID": { "value": "33964" },
"OrderQty": { "value": 1.000000 }
}
]
}
The reason I had to create the custom End Point was because the "Branch" field that I have on my detail sales order item must be included, and the Default end point did not have the Branch field in its populated fields. (Thanks to this SO Question for pointing the way to that wrinkle!)
But now I get the following error (which does not tell me where to look for the error -- at least that I can see...):
{
"message": "An error has occurred.",
"exceptionMessage": "PX.Data.PXException: Error: The system failed to commit the CurrentDocument row.\r\n at PX.Api.SyImportProcessor.SyStep.a(Object A_0, PXFilterRow[] A_1, PXFilterRow[] A_2) in C:\\Bld2\\AC-FULL2019R113-JOB1\\Sources\\NetTools\\PX.Data\\Api\\Export\\SyImport\\ImportProcessor.cs:line 3638\r\n at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable() in C:\\Bld2\\AC-FULL2019R113-JOB1\\Sources\\NetTools\\PX.Data\\Api\\Export\\SyImport\\ImportProcessor.cs:line 1171",
"exceptionType": "PX.Api.ContractBased.OutcomeEntityHasErrorsException",
"stackTrace": " at System.Monads.ArgumentCheck.CheckNull[TSource](TSource source, Func`1 exceptionSource)\r\n at PX.Api.ContractBased.EntityService.GetOperationResult(EntityImpl entity, EntityExportContextBuilder entityExportContextBuilder, PXSYTable exportedKeys, List`1 errors) in C:\\Bld2\\AC-FULL2019R113-JOB1\\Sources\\NetTools\\PX.Api.ContractBased\\EntityService.cs:line 480\r\n at PX.Api.ContractBased.EntityService.Put(ISystemContract systemContract, String version, String name, EntityImpl entity, CbOperationContext operationContext) in C:\\Bld2\\AC-FULL2019R113-JOB1\\Sources\\NetTools\\PX.Api.ContractBased\\EntityService.cs:line 474\r\n at PX.Api.ContractBased.Soap.SoapFacadeBase.PutImpl(EntityImpl entity) in C:\\Bld2\\AC-FULL2019R113-JOB1\\Sources\\NetTools\\PX.Api.ContractBased\\Soap\\SoapFacadeBase.cs:line 117\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
}
Any idea where to go next in my debugging?
[Edit:Adding screenshots to address Fernando's question]
There are 2 possible branches, both named the same, and you cannot add both of them to an entity.
And this is in Document Details
Which one should I use? How can I know??? When I replicate what #Fernando shows (I assume using the Document Details "Branch"), I get a "Branch cannot be Empty" error:

OK, my conversation with Fernando was helpful. Here's what I discovered, and here's what worked:
The fact that there are two different ways of selecting "Branch" in the Fields is significant.
One shows up in the "Document Details" PopUp
And one shows up in the Financial Settings -> Financial Information PopUp:
As it turns out BOTH are needed. But they can't both belong to the SalesOrder Entity -- that's not allowed.
So, I extended the SalesOrder Entity with the Financial Settings "Branch"
And, I extended the SalesOrderDetail Entity with the DocumentDetails "Branch"
And then I could do this and it was accepted:
{
"CustomerID": { "value": "76758" },
"OrderType": { "value": "SO" },
"Branch": { "value": "00" },
"Details":
[
{
"Account": { "value": "4040" },
"Branch": { "value": "00" },
"InventoryID": { "value": "33964"},
"OrderQty": { "value": 1.000000 }
}
]
}
Setting the branch in only one of those places would not create an accepted Sales Order record. So this worked and I have a new Sales Order, with a detail line in it.
I cannot remember now, because I tried so many different things, but, I believe that in the 18.200.001 version of SalesOrder, the Branch field already exists in the SalesOrder Detail, but not in SalesOrder. And in the 6.00.001 version it doesn't exist in either. I'm not sure, but I think that is how it is. In case anyone stumbles across this and is using a different version...

Related

Second async operation started...don't see how

I'm getting the error about a second async operation starting on the context before the previous async operation ended, but I'm not seeing where it's happening. This is the code I'm using. Each of the async calls are using await, so what am I doing wrong?
This is a method on a Web API 2 call.
public async Task<IHttpActionResult> SendAssessmentArsAsync(int assessmentId) {
using (var context = new LAMPEntities()) {
var assessment = await context.EHS_Assessment_Audit.AsNoTracking().Where(x => x.id == assessmentId).FirstOrDefaultAsync();
var arsQuery = from r in context.EHS_Assessment_Audit_AR.AsNoTracking()
where r.EHS_Assessment_Audit_Id == assessmentId
join w in context.Worker on r.Assignee_WWID equals w.WWID
select new {
w.Email,
w.Full_Name,
r.AR,
r.Due_Date
};
var ars = await arsQuery.ToArrayAsync();
var lab = from s in context.Lab_Space.AsNoTracking()
where s.id == assessment.Lab_Space.id
join w in context.Worker.AsNoTracking() on s.Contact_WWID equals w.WWID
where w.Email != null
join d_join in context.Worker.AsNoTracking() on s.Delegate equals d_join.WWID into d_grp
from d in d_grp.DefaultIfEmpty()
select new {
Owner = w.Email,
Delegate = d.Email,
Barcode = s.Entry_Bar_Code,
Label = s.Floor_Space_Label,
Id = s.id
};
var mails = await lab.FirstAsync();
When it hits that last line is where it is throwing the exception.
Exception message:
A second operation started on this context before a previous asynchronous operation completed. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context. Any instance members are not guaranteed to be thread safe.
Here's the exception as shown via the webservice call:
b__a()
at System.Data.Entity.Core.Objects.ObjectContext.d__3d`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.d__9`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Data.Entity.Utilities.TaskExtensions.CultureAwaiter`1.GetResult()
at System.Data.Entity.Core.Objects.ObjectQuery`1.d__e.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Data.Entity.Utilities.TaskExtensions.CultureAwaiter`1.GetResult()
at System.Data.Entity.Internal.LazyAsyncEnumerator`1.d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Data.Entity.Infrastructure.IDbAsyncEnumerableExtensions.d__1d`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at LabSORService.Controllers.EHSController.d__21.MoveNext() in ...\\Controllers\\EHSController.cs:line 854
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Threading.Tasks.TaskHelpersExtensions.d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ApiControllerActionInvoker.d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ActionFilterResult.d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__15.MoveNext()" }
{
"message": "An error has occurred.",
"exceptionMessage": "A second operation started on this context before a previous asynchronous operation completed. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context. Any instance members are not guaranteed to be thread safe.",
"exceptionType": "System.NotSupportedException",
"stackTrace": " at System.Data.Entity.Core.Objects.ELinq.QueryParameterExpression.TryGetFieldOrPropertyValue(MemberExpression me, Object instance, Object& memberValue)
at System.Data.Entity.Core.Objects.ELinq.QueryParameterExpression.TryEvaluatePath(Expression expression, ConstantExpression& constantExpression)
at System.Data.Entity.Core.Objects.ELinq.QueryParameterExpression.EvaluateParameter(Object[] arguments)
at System.Data.Entity.Core.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable`1 forMergeOption)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClassc.
Most likely
where s.id == assessment.Lab_Space.id
is triggering lazy loading of Lab_Space navigation property in inappropriate time.
Assuming you have no explicit FK property like Lab_Space_Id (if you do have, just use it instead of Lab_Space.id), either eager load it (preferable):
var assessment = await context.EHS_Assessment_Audit.AsNoTracking()
.Include(x => x.Lab_Space) // <--
.Where(x => x.id == assessmentId).FirstOrDefaultAsync();
or evaluate it outside the query:
var labSpaceId = assessment.Lab_Space.id; // <--
var lab = from s in context.Lab_Space.AsNoTracking()
where s.id == labSpaceId // <--
...
Note that in the original query, assessment.Lab_Space access is just recorded in the query expression tree. The actual evaluation (hence triggering the lazy load) happens as part of the execution of the query.

How to use DbContext in multi-threaded app

I have an EF Core website that is set up in the typical way. This has worked fine.
However, I added a Controller Method that gets hit several times per second and when there are multiple active threads, EF throws an exception. If the requests are a few seconds apart, then it works fine.
I have tried debugging this, but I don't see what I am doing wrong.
Here are the details:
The requests are coming from a single page app, and they are all the same connection. If there is only one request, it works fine. But if there are two requests, then the exception is thrown.
System.IndexOutOfRangeException
HResult=0x80131508
Message=Index was outside the bounds of the array.
Source=System.Data
StackTrace:
at System.Data.SqlClient.SqlDataReader.CheckHeaderIsReady(Int32 columnIndex, Boolean permitAsync, String methodName)
at System.Data.SqlClient.SqlDataReader.IsDBNull(Int32 i)
at Microsoft.EntityFrameworkCore.Storage.Internal.TypedRelationalValueBufferFactory.Create(DbDataReader dataReader)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable1.AsyncEnumerator.<BufferlessMoveNext>d__12.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.<ExecuteImplementationAsync>d__312.MoveNext()
at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.d__312.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable1.AsyncEnumerator.d__11.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor1.EnumeratorExceptionInterceptor.<MoveNext>d__5.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Linq.AsyncEnumerable.<Aggregate_>d__63.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Traken.Data.Repositories.LookupListItemRepository.d__4.MoveNext() in C:\Dev\Traken.app\Traken.5\Dev\Traken\Data\Repositories\LookupListItemRepository.cs:line 38
The repository which is use:
services.AddScoped<LookupListItemRepository, LookupListItemRepository>();
I have also tried AddTransient but I get the same error.
services.AddTransient<LookupListItemRepository, LookupListItemRepository>();
The DbContext:
services.AddDbContext<ApplicationDbContext>(optionsBuilder =>
{
optionsBuilder.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"),
options => options.EnableRetryOnFailure());
});
The controller
[HttpGet("{tableName}")]
public async Task<List<LookupListItem>> GetLookupTableAsync(string tableName) => await this._repository.List(tableName);
The Repository
public async Task<List<LookupListItem>> List(string tableName)
{
return await this._dbContext.LookupTables.FromSql(
$#"{SqlStrings.SP.GetLookupTable}
#tableName = {tableName}"
).AsNoTracking().ToListAsync();
}
How do I resolve this?
I resolved this by setting the repository to AddTransient, instead of AddScoped
services.AddTransient<LookupListItemRepository, LookupListItemRepository>();
and setting the lifetime of the context to Transient.
services.AddDbContext<ApplicationDbContext>(optionsBuilder =>
{ optionsBuilder.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"),
options => options.EnableRetryOnFailure());
}, ServiceLifetime.Transient);
See Also: https://learn.microsoft.com/en-us/ef/core/querying/async
public async Task<List<Blog>> GetBlogsAsync()
{
using (var context = new BloggingContext())
{
return await context.Blogs.ToListAsync();
}
}

Optimization cannot be performed error when trying to get sales price for specific item in acumatica

I am trying to get sales price for specific item in acumatica.
By postman I sent GET request to this URL:
https://my-acumarica-url/entity/Default/17.200.001/SalesPricesInquiry/?$filter=InventoryID eq '1000004'
I got the following error:
{
"message": "An error has occurred.",
"exceptionMessage": "Optimization cannot be performed.The following fields cause the error:\r\nEffectiveAsOf: View Filter has BQL delegate\r\nPriceWorkgroupIsMine: View Filter has BQL delegate\r\nInventoryID: View Filter has BQL delegate\r\nItemClassID: View Filter has BQL delegate\r\nPriceClass: View Filter has BQL delegate\r\nPriceCode: View Filter has BQL delegate\r\nPriceManager: View Filter has BQL delegate\r\nPriceManagerIsMe: View Filter has BQL delegate\r\nPriceType: View Filter has BQL delegate\r\nPriceWorkgroup: View Filter has BQL delegate\r\n",
"exceptionType": "PX.Api.ContractBased.OptimizedExport.CannotOptimizeException",
"stackTrace": " at PX.Api.ContractBased.OptimizedExport.NotWorkingOptimizedExportProvider.get_CanOptimize()\r\n at PX.Api.ContractBased.EntityService.GetList(ISystemContract systemContract, String version, String name, EntityImpl entity, Boolean returnFullEntities, CbOperationContext operationContext, Boolean ignoreValueFields, PXGraph graph)\r\n at PX.Api.ContractBased.Soap.SoapFacadeBase.GetListImpl(Entity entity, Boolean returnFullEntities)\r\n at PX.Api.ContractBased.SystemContracts.V2.RestController.GetList(String objectName, String select, String filter, String expand, String custom, Nullable`1 skip, Nullable`1 top)\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
}
SalesPricesInquiry is an inquiry and should be accessed via PUT, as the documentation says.
According to Default/17.200.001/swagger.json
"/InventorySummaryInquiry": {
"put": {
"tags": [
"InventorySummaryInquiry"
],
"summary": "Creates a record or updates an existing record.",
"operationId": "InventorySummaryInquiry_PutEntity",
"consumes": [
"application/json",
"text/json"
],
"produces": [
"application/json",
"text/json"
],
A "PUT" will cause an inventory entry to be created.
When I "PUT" Default/17.200.001/InventorySummaryInquiry
{"WarehouseID" : {"Value":"MSE01"}}
I get in response
{
"id": "497b52a8-8a81-4345-bcaa-9b607231886b",
"rowNumber": 1,
"note": null,
"ExpandByLotSerialNbr": {},
"InventoryID": {},
"LocationID": {},
"WarehouseID": {},
"custom": {},
"files": []
}
which does not make sense to me. I have 2000+ items in the "MSE01" warehouse.
I get a new "id" each time I try this, which maybe means a new entry is getting created, and that's what's being returned?

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?

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)"
}
}