Pathing Problem

Topics: Argotic.Common
Jun 2, 2008 at 3:53 PM
I am trying to use Argotic to create some feeds. The problem I am encountering is the path for the XmlSyndicationResourceProvider is not resolving to the correct location. In my case, I have an assembly and types that are being created through some configuration so the path "~/syndication" is resolving to "C:\Windows\System32\~\syndication". I checked the source and it doesn't look as though there is any way for the XmlSyndicationResourceProvider to resolve the correct pathing relative to where the calling assembly is actually located (i.e. C:\DevRoot\MyApp\bin). I am probably going to add some code that will path it relative to the assembly location, i.e. Assembly.GetExecutingAssembly().CodeBase - but before I do that I have 2 questions:

1.) Am I missing something obvious?
2.) Is there a reason this sort of code was not put into the codebase? Meaning, not all assemblies are "HttpContext" aware.
Jun 2, 2008 at 5:19 PM
It is most likely that this is a bug and I just missed this issue. If you can supply some example code to help in my investigation, I will look nto fixing this issue. Thanks for bringing this to my attention.
Jun 2, 2008 at 8:47 PM
It's a little tricky to document, but here is the scenario. I have one assembly that is creating types dynamically. One of the types created is a "process" that runs some stuff - think windows service. The type that is created dynamically is in an assembly where there is no direct reference - kinda like Inversion of Control / Dependency Injection. This "process" runs and then as part of it's process, it is trying to write the feed data. When SyndicationManager.CreateResource is called it is looking at XmlSyndicationResourceProvider and specifically the private ApplicationPath property seems to be where the problem is. I'll be looking at it over the next few days as well so if I find out more, I'll post it here.
Jun 3, 2008 at 11:22 PM
around line 143 in XmlSyndicationResourceprovider I added the following code:

if (System.Web.HttpContext.Current == null) {
  if (applicationPath.StartsWith("~", StringComparison.Ordinal)) {
    applicationPath = System.IO.Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + applicationPath.Substring(1);
  else {
    applicationPath = System.IO.Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + applicationPath;

Jul 1, 2008 at 7:10 PM
Created work item 10410 to add this as a feature, this has been implemented in the next release.