我试图添加一个附件到一个预先创建的Trello卡使用Manatee。
这就是我制作卡片的方式,我对它没有问题:
/// <summary>
/// This function creates a card on Trello <Board_Name> board, into the list named <List_Name>.
/// It creates a card with the title and descrition comming from the function which is called
/// </summary>
/// <param name="subject"> This is the subject (Title) of the ticket </param>
/// <param name="body"> This is the body section (description) of the ticket </param>
public string createTrelloTicketCard(string subject, string body)
{
string cardId = null;
trelloToken = adminTrelloToken; // define who is creating the card
Run(() =>
{
TrelloProcessor.WaitForPendingRequests = true;
var board = new Board(<Board_ID>); // board id
var list = board.Lists[5]; // The sixth list of the board
var card = list.Cards.Add(subject); // create a card with the subject from tblTasks
cardId = card.Id; // get the created card ID
card.Description = body; // define description from tblTasks
// Add all the IT members to the card
for (int i = 0; i < numberOfItMembersInBoard; i ++)
{
card.Members.Add(board.Members[i]);
}
});
return cardId;
}这就是我如何尝试添加附件到卡。此函数中出现了以下问题:
public void InsertAttachementIntoTrelloCard(string cardId, byte[] buffer, string name)
{
Run(() =>
{
TrelloProcessor.WaitForPendingRequests = true;
var board = new Board(<Board_ID>); // board id
var list = board.Lists[5]; // The sixth list of the board
var card = new Card(cardId); // specify the card that the file is going to be attached
card.Description = "Test3";
card.Attachments.Add(buffer, name); // Here I get the error
});
}当我试图附加文件时,我得到一个错误,从下面这个句子开始:
对象引用未设置为对象的实例.
我非常肯定创建的字节数组是正确的,当我删除该行时,程序结束时没有任何错误。我用错方法了吗?
这里是堆栈跟踪:
ex.Message =“对象引用未设置为对象的实例”。 (应Manatee.Trello.Internal.DataAccess.JsonRepository.PrepRequest(IRestRequest请求,e:\Projects\Manatee.Trello\Manatee.Trello\Internal\DataAccess\JsonRepository.cs:line 79中的ex.StackTrace =“ex.StackTrace=”,在端点端点,在e:\Projects\Manatee.Trello\Manatee.Trello\Internal\DataAccess\JsonRepository.cs:line 74中,在Manatee.Trello.Internal.DataAccess.JsonRepository.ExecuteT中,在e:\Projects\Manatee.Trello\Manatee.Trello\Internal\DataAccess\JsonRepository.cs:line中,46在Manatee.Trello.AttachmentCollection.Add(Byte[]数据,(字符串名称)在e:\Projects\Manatee.Trello\Manatee.Trello\AttachmentCollection.cs:line 112 at Live.XmlFax.XmlFaxForm.<>c__DisplayClass8.b__7() in c:\Users\arif.gencosmanoglu\Documents\EnteringC#\Printer Project\XmlFax\XmlFaxForm.cs:line 2035 at Live.XmlFax.XmlFaxForm.Run( action ) in c:\Users\arif.gencosmanoglu\Documents\EnteringC#\Printer Project\XmlFax\XmlFaxForm.cs:line 1724 at Live.XmlFax.XmlFaxForm.InsertAttachementIntoTrelloCard(String cardId,Byte[] buffer,( c:\Users\arif.gencosmanoglu\Documents\EnteringC#\Printer Project\XmlFax\XmlFaxForm.cs:line 2023 at Live.XmlFax.XmlFaxForm.ReadTicketEmail() at Live.XmlFax.XmlFaxForm.ReadTicketEmail() in c:\Users\arif.gencosmanoglu\Documents\EnteringC#\Printer Project\XmlFax\XmlFaxForm.cs:line 1981 at Live.XmlFax.XmlFaxForm.cmdItTicket_Click(Object Project\XmlFax\XmlFaxForm.cs:line,EventArgs e) ( c:\Users\arif.gencosmanoglu\Documents\EnteringC#\Printer Project\XmlFax\XmlFaxForm.cs:line 1884 )
发布于 2015-05-13 21:27:01
我不知道问题出在哪里。到堆栈跟踪中该点的每一条路径都包含所有的依赖项,不应该发生该错误。
请确保您有以下最新的Nuget软件包:
https://stackoverflow.com/questions/30201170
复制相似问题