Bug 2527 - System.IO.Packaging.PackUriHelper.GetRelativeUri inverts parameters orders compared to .NET
Summary: System.IO.Packaging.PackUriHelper.GetRelativeUri inverts parameters orders co...
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: WindowsBase ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Alan McGovern
URL:
Depends on:
Blocks:
 
Reported: 2011-12-15 08:01 UTC by Andoni Morales
Modified: 2013-01-14 09:37 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
implementation of PackUriHelper.GetRelativeUri (956 bytes, text/plain)
2012-06-26 10:26 UTC, Timotheus Pokorra
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Andoni Morales 2011-12-15 08:01:45 UTC
While trying to use EPPlus with Mono I have noticed that System.IO.Packaging.PackUriHelper.GetRelativeUri returns different values in .NET and Mono like if parameters where inverted.

For example with PackUriHelper.GetRelativeUri(new Uri("/xl", UriKind.Relative), "docProps/Core.xml") we get:
  .NET -> "docProps/Core.xml"
  Mono -> "xl"
Comment 1 Timotheus Pokorra 2012-06-26 10:22:59 UTC
I had a look at the code of PackUriHelper.GetRelativeUri in
https://github.com/mono/mono/blob/master/mcs/class/WindowsBase/System.IO.Packaging/PackUriHelper.cs

I realized that this method is not implemented correctly at all, it just returns the first parameter.

I will add an attachment, that shows how that function could be implemented. I have created that code originally to work with relative paths, but it might work here as well.
I have tested my version of the function for EPPlus, and it returns the same relative URI as on .NET
Comment 2 Timotheus Pokorra 2012-06-26 10:26:06 UTC
Created attachment 2118 [details]
implementation of PackUriHelper.GetRelativeUri
Comment 3 Pablo Ruiz García 2012-10-12 19:26:40 UTC
I just sent a pull request fixing this issue: https://github.com/mono/mono/pull/476
Comment 4 Alan McGovern 2013-01-14 09:37:23 UTC
This has been merged in. Thanks!