Skip to content

System.Xml.XmlException: The '/' character, hexadecimal value 0x2F, cannot be included in a name. #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Zatox opened this issue Apr 12, 2016 · 10 comments
Assignees

Comments

@Zatox
Copy link

Zatox commented Apr 12, 2016

A few seconds after clicking "start import" I get this exception. Hence the import fails.
My setup is Jira Cloud (SCRUM Project) to TFS 2012. Both TFS and JiraToTfs are running on a Windows Server 2012.

I've been manually parsing the results I get when hitting the REST API but I can't find any "/" in wierd places.

Here is the exceptions log:

2016-04-12 13:27:40,307 [5] INFO TicketImporter.TicketImportAgent - Preparing to import
2016-04-12 13:27:44,102 [5] INFO TicketImporter.TicketImportAgent - Validating Jira tickets against TFS
2016-04-12 13:27:44,539 [5] ERROR JiraToTfs.Presenter.JiraToTfsPresenter - System.Xml.XmlException: The '/' character, hexadecimal value 0x2F, cannot be included in a name.
at System.Xml.XmlConvert.VerifyNCName(String name, ExceptionType exceptionType)
at System.Xml.Linq.XName..ctor(XNamespace ns, String localName)
at System.Xml.Linq.XNamespace.GetName(String localName)
at System.Xml.Linq.XName.Get(String expandedName)
at TicketImporter.SettingsStore.<>c.b__4_0(KeyValuePair2 kv) at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
at System.Xml.Linq.XContainer.AddContentSkipNotify(Object content)
at TicketImporter.SettingsStore.Save(String key, IEnumerable1 source) at TicketImporter.JiraTypeMap..ctor(ITicketSource jiraProject, IAvailableTicketTypes availableTicektTypes) at TicketImporter.JiraProject.<Tickets>d__18.MoveNext() at TicketImporter.TicketImportAgent.StartImport() at JiraToTfs.Presenter.JiraToTfsPresenter.import_DoWork(Object sender, DoWorkEventArgs e) 2016-04-12 13:27:44,539 [1] ERROR JiraToTfs.Presenter.JiraToTfsPresenter - System.Xml.XmlException: The '/' character, hexadecimal value 0x2F, cannot be included in a name. at System.Xml.XmlConvert.VerifyNCName(String name, ExceptionType exceptionType) at System.Xml.Linq.XName..ctor(XNamespace ns, String localName) at System.Xml.Linq.XNamespace.GetName(String localName) at System.Xml.Linq.XName.Get(String expandedName) at TicketImporter.SettingsStore.<>c.<Save>b__4_0(KeyValuePair2 kv)
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Xml.Linq.XContainer.AddContentSkipNotify(Object content) at TicketImporter.SettingsStore.Save(String key, IEnumerable1 source)
at TicketImporter.JiraTypeMap..ctor(ITicketSource jiraProject, IAvailableTicketTypes availableTicektTypes)
at TicketImporter.JiraProject.d__18.MoveNext()
at TicketImporter.TicketImportAgent.StartImport()
at JiraToTfs.Presenter.JiraToTfsPresenter.import_DoWork(Object sender, DoWorkEventArgs e)

@Zatox
Copy link
Author

Zatox commented Apr 12, 2016

Interesting fact : when I click on "Advanced Settings" then the error shows up as well.

Other interesting fact : If I take out the protocol par for the "Jira server" field then "Advanced Settings" works again and the error that pops up after clicking "start import" is now "Transport level error: Invalid URI..."

So it seems like the "/" that's causing the issue might be one in "https://"

@Zatox
Copy link
Author

Zatox commented Apr 12, 2016

I tried creating a brand new vanilla Jira cloud and this time the error went away ( replaced by this one though).

So this issue might be due to custom data in the Jira used. This Jira has custom ticket fields and in the name of some of those custom fields there is a "/" (ex: "software or/and hardware"). Since default fields never contain a "/" I thought this might be a good candidate. I don't have the permission to change that so I wasn't able to test the theory though.
Clarification : I'm talking of custom fields as in example.com/secure/admin/ViewIssueFields.jspa

@Zatox
Copy link
Author

Zatox commented Apr 14, 2016

So this one is related to the other issue mentioned in previous comment. It's not the custom field types as I though but actually the custom issue types that is creating the bug. This particular project has an issue type with a "/" in it.
Imagine that issue type was named "Ticket/WorkItem" in Jira and we wanted to map it to "Task" in TFS.
Then the app would be trying to build an XML looking like :
image
And that's most probably what is breaking the XML

@Zatox
Copy link
Author

Zatox commented Apr 14, 2016

A colleague of mine ( @dhouse109 ) came up with a little fix. It allowed us to do the migration but we're not sure it's totally safe regarding data integrity. It also might not be the best place to do it.

In the file "JiraTypeMap.cs", inside the function "JiraTypeMap" add those lines (first and last line are those that already exist in the code. First line should be line #83)

        availableTypes = availableTicektTypes;

        for (int i = 0; i < jiraTicketTypes.Count; i ++)
        {
            jiraTicketTypes[i] = jiraTicketTypes[i].Replace("/", " ");
        }

        if (jiraTicketTypes.Count > 0)

@KilskyreMan
Copy link
Owner

Thanks for that Zatox. I'll take the fix and investigate further.

Apologies for not getting back sooner unfortunately work commitments have kept me away for the last couple of weeks.

@KilskyreMan KilskyreMan self-assigned this Sep 26, 2016
@kashyapvirgo
Copy link

Hi

Thank you for putting hard work and sharing this tool with the community.
I am also experiencing the same issue.

"The '/' character, hexadecimal value 0x2F, cannot be included in a name."

is there a fix?
Do I need to keep anything in mind before I recompile source code with the fix suggested by user Zatox in this thread?
is there a specific instruction on how to compile this project after applying the fix.
thanks

@kashyapvirgo
Copy link

Nevermind
I recompiled the code with the fix provided by Zatox but now I get this new error.

2017-01-10 15:24:15,906 [1] ERROR JiraToTfs.Presenter.JiraToTfsPresenter - Syste
m.Collections.Generic.KeyNotFoundException: The given key was not present in the
dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at TicketImporter.TfsPriorityMap.get_Item(String lookUp) in C:\Users\kshah\De
sktop\JiraToTfs-1.0.1\TicketImporter\TfsPriorityMap.cs:line 58
at TicketImporter.TfsProject.toWorkItem(Ticket toImport) in C:\Users\kshah\De
sktop\JiraToTfs-1.0.1\TicketImporter\TfsProject.cs:line 306
at TicketImporter.TfsProject.CheckTicket(Ticket toAdd, IFailedTicket& failure
) in C:\Users\kshah\Desktop\JiraToTfs-1.0.1\TicketImporter\TfsProject.cs:line 42
4
at TicketImporter.TicketImportAgent.StartImport() in C:\Users\kshah\Desktop\J
iraToTfs-1.0.1\TicketImporter\TicketImportAgent.cs:line 119
at JiraToTfs.Presenter.JiraToTfsPresenter.import_DoWork(Object sender, DoWork
EventArgs e) in C:\Users\kshah\Desktop\JiraToTfs-1.0.1\JiraToTfs\Presenter\JiraT
oTfsPresenter.cs:line 306

Not sure where I am missing this or how to fix this issue,

@KilskyreMan
Copy link
Owner

KilskyreMan commented Jan 10, 2017 via email

@kashyapvirgo
Copy link

Ok let me try with fixing the XML file.
I see issue #9 thread here which talks about same errors.
thanks a lot for a quick response.
Let me try everything without wasting your time

@kashyapvirgo
Copy link

I fixed XML file with correct priority mapping and it works like a charm.
the only bug is when priorities start with a digit ( eg 1-high, 2-medium), it gives me an error saying it can't start with a number. We have those digits because its easy to sort sometimes on that field.
To test I removed a digit from front and it worked fine. Do you know which file I can change to overcome that condition. I will find out after debugging but if you know, it will save my time.

thanks again for putting out great work in the community.
If we decide to develop more features, I will share with you and you can decide to check them in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants