Questions tagged with AWS Lambda

Content language: English

Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

Is X-Ray on Lambda Compatible with .NET Ahead-of-Time compilation?

When attempting to set up XRay in a .NET/C# Lambda function published with AOT, I am getting the following error upon invoking the function: ``` Unhandled Exception: System.TypeInitializationException: A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property. ---> System.MissingMethodException: No parameterless constructor defined for type 'Amazon.XRay.Recorder.Core.Sampling.Local.SamplingConfiguration'. at System.ActivatorImplementation.CreateInstance(Type, Boolean) + 0x120 at ThirdParty.LitJson.JsonMapper.ReadValue(Type, JsonReader) + 0x483 at ThirdParty.LitJson.JsonMapper.ToObject[T](TextReader) + 0x4f at Amazon.XRay.Recorder.Core.Sampling.Local.LocalizedSamplingStrategy.Init(Stream) + 0x60 at Amazon.XRay.Recorder.Core.Sampling.Local.LocalizedSamplingStrategy.InitWithDefaultSamplingRules() + 0x53 at Amazon.XRay.Recorder.Core.AWSXRayRecorder..ctor(ISegmentEmitter) + 0x5e at Amazon.XRay.Recorder.Core.AWSXRayRecorder..cctor() + 0xcd at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0xb9 --- End of inner exception stack trace --- [...] ``` I've tried adding the following to rd.xml, to no avail: ```xml <Directives xmlns=""> <Application> <Assembly Name="bootstrap" Dynamic="Required All"/> <Assembly Name="AWSSDK.Core" Dynamic="Required All"/> <Assembly Name="AWSSDK.SecretsManager" Dynamic="Required All"/> <Assembly Name="AWSSDK.XRay" Dynamic="Required All"/> <Assembly Name="AWSXRayRecorder.Core" Dynamic="Required All"/> <Assembly Name="AWSXRayRecorder.Handlers.AwsSdk" Dynamic="Required All"/> <Assembly Name="System.Configuration.ConfigurationManager"> <Type Name="System.Configuration.ClientConfigurationHost" Dynamic="Required All" /> <Type Name="System.Configuration.AppSettingsSection" Dynamic="Required All" /> </Assembly> </Application> </Directives> ``` My initialization code is as follows: ```c# AWSSDKHandler.RegisterXRayForAllServices(); AWSXRayRecorder.InitializeInstance(); // pass IConfiguration object that reads appsettings.json file ``` Any ideas?
Jason T
asked 15 hours ago