Strange error when trying to save any function library

I was working this morning, and after testing one of my functions, I can no longer save any function library without getting this strange error shown at the bottom of the post.

The only two things I have done recently was install @josecgomez function testing screen and then try to test a function. Since libraries that I haven’t touched in months can no longer save, I’m assuming I buggered up something system wide but I don’t understand why or how.

Error

Application Error

Exception caught in: Anonymously Hosted DynamicMethods Assembly

Error Detail

Message: Unable to cast object of type ‘Ice.Tablesets.EfxFunctionTable’ to type ‘Ice.IceTable`1[Ice.Tablesets.ExecutionParameterRow]’.
Program: RefEmit_InMemoryManifestModule
Method: lambda_method

Client Stack Trace

at lambda_method(Closure , DataTable , IIceTable , Boolean )
at Ice.DatasetAdapter.Copy(DataSet sourceDataset, IceTableset destinationTableset, Boolean onlyChanges)
at Ice.Cloud.RpcSerializer.SerializeDataSetToTableset(Object value, Object serializationValue, Boolean useSparseCopy, Boolean onlyChanges, Stream stream)
at Ice.Cloud.RestRpcValueSerializer.Serialize(ProxyValueInInfo valueIn, ProxyValuesOut valuesOut, Stream stream)
at Ice.Cloud.RestRpcValueSerializer.Serialize(ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, Stream stream)
at Epicor.ServiceModel.Channels.ImplBase.BuildContent(RestValueSerializerBase serializer, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut)
at Epicor.ServiceModel.Channels.ImplBase.BuildRequestMessage(String methodName, RestValueSerializerBase serializer, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut)
at Epicor.ServiceModel.Channels.ImplBase.d__130.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 Epicor.Utilities.AsyncHelper.RunSync[TResult](Func1 method) at Epicor.ServiceModel.Channels.ImplBase.Execute(String methodName, RestValueSerializerBase serializer, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut) at Epicor.ServiceModel.Channels.ImplBase.<>c__DisplayClass126_0.<CallWithCommunicationFailureRetry>b__0(Context _) at Polly.Policy1.<>c__DisplayClass13_0.b__0(Context ctx, CancellationToken _)
at Polly.Retry.RetryEngine.Implementation[TResult](Func3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates1 shouldRetryResultPredicates, Action4 onRetry, Int32 permittedRetryCount, IEnumerable1 sleepDurationsEnumerable, Func4 sleepDurationProvider) at Polly.Retry.RetryPolicy1.Implementation(Func3 action, Context context, CancellationToken cancellationToken) at Polly.Policy1.Execute(Func3 action, Context context, CancellationToken cancellationToken) at Polly.Policy1.Execute(Func2 action, Context context) at Epicor.ServiceModel.Channels.ImplBase.CallWithCommunicationFailureRetry(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, RestRpcValueSerializer serializer) at Epicor.ServiceModel.Channels.ImplBase.CallWithMultistepBpmHandling(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, Boolean useSparseCopy) at Epicor.ServiceModel.Channels.ImplBase.Call(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, Boolean useSparseCopy) at Ice.Proxy.Lib.EfxLibraryDesignerImpl.ApplyChangesWithDiagnostics(EfxLibraryDataSet libraryTableset, IEnumerable1& diagnostics)
at Ice.UI.EfxLibraryMaintenance.Services.LibraryService.<>c__DisplayClass2_0.b__0(EfxLibraryDesignerImpl svc)
at Ice.Blaq.Client.EfxLibraryDesigner.LibraryInfoService.CallSvc(Action1 func) at Ice.UI.EfxLibraryMaintenance.Services.LibraryService.ApplyChangesWithDiagnostics(EfxLibraryDataSet& input, IEnumerable1& diagnostics)
at Ice.UI.EfxLibraryMaintenance.MainTransaction.ApplyChangesWithDiagnostics(String lastSelectedLibrary, IEnumerable1& diagnostics) at Ice.UI.EfxLibraryMaintenance.MainTransaction.adapterUpdate() at Ice.Lib.Framework.EpiMultiViewTransaction.Update(IEnumerable1 dataSets)

Looks like something got loaded funky somehow in memory. Can you recycle? The error seems to be coming from Epicor’s own internals (unless this is your program “RefEmit_InMemoryManifestModule” (though I doubt it)

I started the Restart Site process from the cloud portal, I’ll let you know if that fixes the issue.

2 Likes

All the tester does is run a function using REST like you would from postman. There is nothing there that could possibly cause this issue as far as I can tell.

this.CallService<Ice.Contracts.EfxLibraryDesignerSvcContract>(l =>
{
    var resp = l.GetLibrary(this.InLibraryID);
    var staging = resp.EfxLibrary[0].Published ? "" : "staging/";
    
    var client = new RestClient($"{this.Session.AppServerURL}/api/v2/efx/{staging}{this.Session.CompanyID}/{this.InLibraryID}/{this.InFunctionID}");

    var request = new RestRequest(Method.POST);
    request.AddHeader("sessioninfo", $"{{\"sessionId\":\"{this.Session.SessionID}\"}}");
    request.AddHeader("callsettings", $"{{\"Company\":\"{this.Session.CompanyID}\",\"Plant\":\"{this.Session.PlantID}\"}}");
    request.AddHeader("Content-Type", "application/json");
    request.AddHeader("Authorization", $"Bearer {this.Token}");

    request.AddJsonBody(this.InPayLoad);

    IRestResponse response = client.Execute(request);

    if (response.IsSuccessful)
    {
        var parsed = Newtonsoft.Json.Linq.JToken.Parse(response.Content);
        this.OutResult = parsed.ToString(Newtonsoft.Json.Formatting.Indented);
    }
    else
    {
        var errorInfo = new {
            StatusCode = response.StatusCode,
            StatusDescription = response.StatusDescription,
            ErrorMessage = response.ErrorMessage,
            Content = response.Content
        };
        this.OutResult = Newtonsoft.Json.JsonConvert.SerializeObject(errorInfo, Newtonsoft.Json.Formatting.Indented);
    }
});

Okay, restarting did get the function editor working again. That was the main issue.

However I tried testing it again and I get this function result in the tester:

what is the proper format to send a UD14 tableset with your function tester? I am trying this right now:

{
  "UD14": [
    {
      "Company": "78863",
      "Key1": "8500",
      "Key2": "1",
      "Key3": "Maxkleen",
      "Key4": "",
      "Key5": "",
      "Character01": "",
      "Character02": "",
      "Character03": "",
      "Character04": "",
      "Character05": "",
      "Character06": "",
      "Character07": "",
      "Character08": "",
      "Character09": "",
      "Character10": "",
      "Number01": 0.0,
      "Number02": 0.0,
      "Number03": 0.0,
      "Number04": 0.0,
      "Number05": 0.0,
      "Number06": 0.0,
      "Number07": 0.0,
      "Number08": 0.0,
      "Number09": 0.0,
      "Number10": 0.0,
      "Number11": 0.0,
      "Number12": 0.0,
      "Number13": 0.0,
      "Number14": 0.0,
      "Number15": 0.0,
      "Number16": 0.0,
      "Number17": 0.0,
      "Number18": 0.0,
      "Number19": 0.0,
      "Number20": 0.0,
      "Date01": null,
      "Date02": null,
      "Date03": null,
      "Date04": null,
      "Date05": null,
      "Date06": null,
      "Date07": null,
      "Date08": null,
      "Date09": null,
      "Date10": null,
      "Date11": null,
      "Date12": null,
      "Date13": null,
      "Date14": null,
      "Date15": null,
      "Date16": null,
      "Date17": null,
      "Date18": null,
      "Date19": null,
      "Date20": null,
      "CheckBox01": false,
      "CheckBox02": false,
      "CheckBox03": false,
      "CheckBox04": false,
      "CheckBox05": false,
      "CheckBox06": false,
      "CheckBox07": false,
      "CheckBox08": false,
      "CheckBox09": false,
      "CheckBox10": false,
      "CheckBox11": false,
      "CheckBox12": false,
      "CheckBox13": false,
      "CheckBox14": false,
      "CheckBox15": false,
      "CheckBox16": false,
      "CheckBox17": false,
      "CheckBox18": false,
      "CheckBox19": false,
      "CheckBox20": false,
      "ShortChar01": "",
      "ShortChar02": "",
      "ShortChar03": "",
      "ShortChar04": "",
      "ShortChar05": "",
      "ShortChar06": "",
      "ShortChar07": "",
      "ShortChar08": "",
      "ShortChar09": "",
      "ShortChar10": "",
      "ShortChar11": "",
      "ShortChar12": "",
      "ShortChar13": "",
      "ShortChar14": "",
      "ShortChar15": "",
      "ShortChar16": "",
      "ShortChar17": "",
      "ShortChar18": "",
      "ShortChar19": "",
      "ShortChar20": "",
      "GlobalUD14": false,
      "GlobalLock": false,
      "SysRevID": 103776161,
      "SysRowID": "9ee1b85e-cd83-477a-af3a-2f0908aa8fcc",
      "BitFlag": 0,
      "RowMod": "",
      "ConfigurationMessage_c": "",
      "ConfigurationStatus_c": "",
      "ConfigurationType_c": "",
      "CustomerEntry_c": "",
      "EngineeringOverride_c": false,
      "HeavyWireOSBAdjustment_c": 0.0,
      "Hook1Backleg_c": 0.0,
      "Hook1Direction_c": "",
      "Hook1Shape_c": "",
      "Hook1Throat_c": 0.0,
      "Hook2Backleg_c": 0.0,
      "Hook2Direction_c": "",
      "Hook2Shape_c": "",
      "Hook2Throat_c": 0.0,
      "ISBLength_c": 0.0,
      "JobComments_c": "",
      "LapOrientation_c": "",
      "LengthTolMinus_c": 0.0,
      "LengthTolPlus_c": 0.0,
      "MarkAsSpec_c": false,
      "MaxWAperture_c": 0.0,
      "NumberOfWires_c": 0.0,
      "OpeningSize_c": 0.0,
      "ProductionNotes_c": "",
      "QuoteOnly_c": false,
      "SalesNotes_c": "",
      "ScreenEqPinao_c": 0.0,
      "ScreenEq_c": 0.0,
      "ScreenType_c": "",
      "SideLapSelection_c": "",
      "SpecDeck_c": "",
      "SpecManufacturer_c": "",
      "SpecModel_c": "",
      "SpecPanelLocation_c": "",
      "SpecPanel_c": "",
      "TotalProfileCount_c": 0,
      "UD_SysRevID": "AAAAAAYvf6I=",
      "UseOldLaps_c": false,
      "Wheel_c": "",
      "WidthTolMinus_c": 0.0,
      "WidthTolPlus_c": 0.0,
      "Width_c": 0.0,
      "WireDiameter_c": 0.0,
      "WireType_c": ""
    }
  ],
  "UD14Attch": [],
  "ExtensionTables": []
}

Depends on what your Function expects as input. I would ditch the UD14Attch stuff and the extension tables bit. What does your function expect as input?


Got it go into /api/help and see what OData expects it to look like. Paste that in here screen shot or something. I’ve never tried a tableset but I suspect it wants it named

{
"ConfigData": {Table set here}
}
1 Like

Yeah it looks like it wants some sort of “special” string format but I can’t figure out what that is. It only “asks” for a “String” parameter. UBER Gross

I got my format by making a function that returned a UD14 table set, I figured that would give me the right format..

Yes but it looks like its expecting a little something different. Still poking on my end.

1 Like

Here you go @Evan_Purdy updated the library. Problem was it was treating the Tablesets as Strings
EFXRunner.efxb (15.8 KB)

Thanks so much! If you wanna split this into two threads I can give you two solutions. I will mark the first one here as a solution as it solved the problem I had in the thread title.

1 Like

All good I updated the original EFX post with a new copy as well for the next guy.

1 Like