I am using Cosmos 3.3 sdk and below is the code to write to my container.
 public void WriteErrorLogs(Error entity, string collectionName)
        {
            try
            {
                Container container = cosmosclient.GetContainer(databaseName, collectionName);
                entity.LogID = Guid.NewGuid().ToString();          
                container.CreateItemAsync<Error>(entity, new PartitionKey(entity.LogID));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
The container in cosmos look like this having partition key as id
the Error class is like this
  public class Error
    {
        [JsonProperty(PropertyName = "id")]
        public string LogID { get; set; }
        public System.DateTime DateStamp { get; set; }
        public string EID { get; set; }
        public string Message { get; set; }
        public string StackTrace { get; set; }
        public string InnerException { get; set; }
I defined partition key to be the LogID which is a guid.The method needs to be synchronous due to the code constraint. Not sure where I am wrong but while debugging always getting" container error CS0103: The name 'container' does not exist in the current context" and logs are not getting created.Any help would be really appretiated,Thanks

 
     
    