c# - Illegal Characters In Path Mystery -
this question might quite localised, need opinion on i'm doing wrong here. how can passing illegal characters in path temporary file when @ every stage of process, appears fine , normal?
i'm getting this:
system.reflection.targetinvocationexception: exception has been thrown target of invocation. ---> system.argumentexception: illegal characters in path.
when passing this:
"c:\documents , settings\<username>\local settings\temp\1\tmp1e0.tmp"
to this:
xmldocument doc = new xmldocument(); doc.load(<above string>);
the file exists in location specified (i've checked during execution) although system.io.file.exists
thinks otherwise; cannot see obvious. there try work around it?
more code available upon request:
req1: how path being declared?
try { session.tempconfigdir = system.io.path.gettempfilename(); //all work done temp file happens within form form currentform = new welcomedialog(session); dialogresult dr = currentform.showdialog(); } { file.delete(session.tempconfigdir); }
the session variable passed around various locations, not altered.
req2: are using <username>
?
no, edited out. it's valid windows username.
req3: what debugging?
this happening within installer (which difficult physically debug) above string example can logs, valid username, of course.
req4: more code on how it's used?
i'm adding wix tag because involves wix3.7.
basic data holding class:
public class sessionstate { //<other properties> public string tempconfigdir { get; set; } public sessionstate() { //setting of properties } }
from within form:
//stringbuilder arguments installerargs.append("\" tempconfigdir=\""); installerargs.append(m_session.tempconfigdir); //... process p = process.start("msiexec", installerargs.tostring()); p.waitforexit();
append: part missed form:
//it's grabbing web.config existing install //and copying on temp file, not changing location or name. file.copy(m_session.installdir + dir_web_config, m_session.tempconfigdir, true);
from within wix3.7's msi:
<property id="tempconfigdir" value="unset" />
...
<custom action="ca_installuica.setprop" after="startservices">not installed</custom> <custom action="ca_installuica" after="ca_installuica.setprop">not installed</custom>
...
<customaction id="ca_installuica.setprop" property="ca_installuica" value="rcswebdir=[mcwsvdir];webdir=[webappvdir];installtype=notransaction;targetdir=[installdir];interaction=[interaction];tempconfigdir="[tempconfigdir]";" />
from within custom action uses it:
wz.autosettings.tempconfiglocation = session.customactiondata["tempconfigdir"]; //where above string passed out session.log(wz.autosettings.tempconfiglocation); //the rest of code uses above , exception thrown
req5: do change tempconfigdir variable something.xml?
no, copy xml file on exact name/directory that's supplied (including .tmp
).
req6: are sure it's happening on .load()?
yes, i've logged each side of line , hit first 1 when executing.
this line seems suspect:
<customaction id="ca_installuica.setprop" property="ca_installuica" value="rcswebdir=[mcwsvdir];webdir=[webappvdir];installtype=notransaction;targetdir=[installdir];interaction=[interaction];tempconfigdir="[tempconfigdir]";" />
the portion quoting path appears doubling quotes, producing exception:
tempconfigdir="[tempconfigdir]"
remove "e;
wrapping deliver actual path:
tempconfigdir=[tempconfigdir]
Comments
Post a Comment