Project

General

Profile

Creating issues does not work after upgrading Redmine to version 5.0.5

Added by Lewap WitzLabO over 1 year ago

After upgrading Redmine to 5.0.5 my previously working code stopped working:
I used this code before and it worked:

            string projectName = "My project name";
            string issueType = "MyIssueType";
            string priorityName = "NamePrior";

                        var parameters = new NameValueCollection { { "status_id", "*" } };
            var prijectList = manager.GetObjects<Project>(parameters);
            var trackersList = manager.GetObjects<Tracker>(parameters);
            var priorityList = manager.GetObjects<IssuePriority>(parameters);

            Issue issue = new Issue();

            issue.Project = prijectList.Where(o => o.Name == projectName).SingleOrDefault();
            issue.Subject = "example title";
            issue.Description = "example description";
            issue.Tracker = trackersList.Where(o => o.Name == issueType).SingleOrDefault();
            issue.Priority = priorityList.Where(o => o.Name == priorityName).SingleOrDefault();

            //string documentPath = @"C:\document.txt";
            //byte[] documentData = System.IO.File.ReadAllBytes(documentPath);

            //Upload attachment = manager.UploadFile(documentData);

            //attachment.FileName = "document.txt";
            //attachment.Description = "przykładowy plik";
            //attachment.ContentType = "text/plain";

            //IList<Upload> attachments = new List<Upload>();
            //attachments.Add(attachment);

            //issue.Uploads = attachments;

            manager.CreateObject(issue, "7");

1.) first problem.

when trying to create a task without attachments, in the line:
manager.CreateObject(issue, "7");
exception is thrown:
Redmine.Net.Api.Exceptions.RedmineException: 'The XML document contains an error (1, 40).'
InnerException 1 of 2: InvalidOperationException: The XML document contains an error (1, 40).
InnerException 2 of 2: InvalidOperationException: <issues xmlns=''> was not expected.

2.) second problem

if I try to create and add an attachment first (which is what the commented out code does) then in the line:
Upload attachment = manager.UploadFile(documentData);
exception is thrown:
System.Net.WebException: 'An exception occurred during the WebClient request.'
InnerException 1 of 2:
NotFoundException: Not Found
InnerException 2 of 2:
WebException: The remote server returned an error: (404) Not Found.

What does it mean?
Previously it worked now it doesn't work, how should the correct creation of tasks/issues look like on Redmine 5.0.5?

in the case of the second problem description - I am sure that the file exists and has the correct path


Replies (3)

RE: Creating issues does not work after upgrading Redmine to version 5.0.5 - Added by Lewap WitzLabO 11 months ago

not yet, but I haven't even tried it for a few months - I'm still waiting, maybe someone will write something ;)

    (1-3/3)