private static async Task SetAttributesAsync(IStorageItem item, FileAttributes attributes) { BasicProperties basicProperties = await item.GetBasicPropertiesAsync().TranslateWinRTTask(item.Path); // This works for only a subset of attributes, unsupported attributes are ignored. // We don't mask the attributes since WinRT just ignores the unsupported ones and flowing // them enables possible lightup in the future. var property = new KeyValuePair <string, object>("System.FileAttributes", (UInt32)ConvertFileAttributes(attributes)); try { await basicProperties.SavePropertiesAsync(new[] { property }).AsTask().ConfigureAwait(false); } catch (Exception exception) { if (exception.HResult != HResults.ERROR_INVALID_PARAMETER) { throw new ArgumentException(SR.Arg_InvalidFileAttrs); } throw exception.TranslateWinRTException(item.Path); } }