SharpSvn - Exception from whitespace in path - sharpsvn

I'm receiving an exception from SharpSvn's client when I try to perform some operations if the specified repository sub-path has a whitespace character in its directory name, ie.
https://svn.mycompan​y.com/repos/myteambl​d/MyFolder1/My Folder 2/MyFolder3
I am able to access these paths through other applications, and SharpSvn works beautifully with non-whitespaced paths. Also, I am passing the path in as a Uri (not a string), so all spaces are automatically encoded
Here is the exception:
SharpSvn.SvnClientUnrelatedResourcesException was caught
HResult=-2146233088
Message=Unable to find repository location for 'https://svn.mycompan​y.com/repos/myteambl​d/MyFolder1/My%20Folder%202/MyFolder3' in revision 496637
Source=SharpSvn
Line=0
OperatingSystemErrorCode=0
SubversionErrorCode=195012
StackTrace:
at SharpSvn.SvnClientArgs.HandleResult(SvnClientContext client, SvnException error, Object targets) in g:\dist\src\sharpsvn\svnclientargs.cpp:line 78
at SharpSvn.SvnClientArgs.HandleResult(SvnClientContext client, svn_error_t* error, Object targets) in g:\dist\src\sharpsvn\svnclientargs.cpp:line 42
at SharpSvn.SvnClient.InternalLog(ICollection`1 targets, Uri logRoot, SvnRevision altPegRev, SvnLogArgs args, EventHandler`1 logHandler) in g:\dist\src\sharpsvn\commands\log.cpp:line 345
at SharpSvn.SvnClient.Log(Uri target, SvnLogArgs args, EventHandler`1 logHandler) in g:\dist\src\sharpsvn\commands\log.cpp:line 74
at SharpSvn.SvnClient.GetLog(Uri target, SvnLogArgs args, Collection`1& logItems) in g:\dist\src\sharpsvn\commands\log.cpp:line 402

Spaces aren't valid in URLs. Instead of you should use %20. You can easily encode your URL using Uri.EscapeUriString
This call:
var myUri="https://svn.mycompany.com/repos/myteambld/MyFolder1/My%20Folder%202/MyFolder3";
Uri.EscapeUriString(myUri);
will return:
https://svn.mycompany.com/repos/myteambld/MyFolder1/My%20Folder%202/MyFolder3

Related

Powershell: validate URL path, incorrect path vs non public path

I am trying to validate a URL that, if valid, I will use to download a file. But I want to validate the domain and the full path BEFORE doing the download, so I can provide a meaningful error log.
Given paths like the following
www.validDomain.com/downloads/validDownload.zip
www.validDomain.com/downloads/invalidDownload.zip
www.invalidDomain.com/downloads/validDownload.zip
I want to be able to report
invalid path: /downloads/invalidDownload.zip
Invalid domain: www.validDomain.com
I can use
$uri = [System.Uri]$path
if (Resolve-DnsName -Name:$uri.host) {}
to test the domain. I can then use
if (Invoke-Webrequest $uri.OriginalString -DisableKeepAlive -UseBasicParsing -Method:head) {}
to test the full path without actually doing the download, but the only error I get is The remote server returned an error: (403) Forbidden., both when the path doesn't exist and when the path does exist but it isn't a publicly available path.
Is there any way, on the PowerShell side, to differentiate the permissions issue vs the incorrect path issue?
Or do I have no choice but to provide a wishy washy error in the log? I know effetely the path does not exist to the user who doesn't have permissions, I am just hoping there is some client side way to differentiate. But I may be running into the limitations of how the web has been implemented.

ServiceStack License not found when using NUnit 3 through Console Runner in TeamCity

I am using a valid license key. But I keep getting this error:
ServiceStack.LicenseException : The free-quota limit on '10 ServiceStack Operations' has been reached. Please see https://servicestack.net to upgrade to a commercial license or visit https://github.com/ServiceStackV3/ServiceStackV3 to revert back to the free ServiceStack v3.
So far I have tried the following:
Storing my license key in app.config
Storing my license key in web.config
Adding my key as a System Environment Variable called "SERVICESTACK_LICENSE"
Adding my key as a System Property through TeamCity Build Parameters
Adding my key as a System Environment Variable through TeamCity Build Parameters
Adding my key by calling Licensing.RegisterLicense before running AppHost.Init
When adding my key as a System Environment Variable through TeamCity Build Parameters I instead get an exception from JsConfig:
System.TypeInitializationException : The type initializer for 'ServiceStack.Text.JsConfig' threw an exception.
----> System.TypeInitializationException : The type initializer for 'ServiceStack.LicenseUtils' threw an exception.
----> System.IO.FileLoadException : Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at ServiceStack.Text.JsConfig.InitStatics()
at ServiceStack.AppHostHttpListenerPoolBase..ctor(String serviceName, Int32 poolSize, Assembly[] assembliesWithServices) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\AppHostHttpListenerPoolBase.cs:line 75
at ServiceStack.AppSelfHostBase..ctor(String serviceName, Assembly[] assembliesWithServices) in C:\BuildAgent\work\3481147c480f4a2f\src\ServiceStack\AppSelfHostBase.cs:line 13
at Alstra.SG.Tests.AppSelfHost..ctor() in C:\TeamCity\buildAgent\work\a0903bf22b2d1e1c\Test\AppSelfHost.cs:line 31
at Alstra.SG.Tests.Private.BaseIntegrationTest..ctor() in C:\TeamCity\buildAgent\work\a0903bf22b2d1e1c\Test\Private\BaseIntegrationTest.cs:line 16
at Alstra.SG.Tests.Private.Integration.RespondentServiceTests..ctor()
--TypeInitializationException
at ServiceStack.LicenseUtils.Init()
at ServiceStack.Text.JsConfig..cctor() in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\JsConfig.cs:line 21
--FileLoadException
at System.MemoryExtensions.AsSpan(String text)
at ServiceStack.Text.Jsv.JsvReader`1.Parse(String value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Jsv\JsvReader.Generic.cs:line 81
at ServiceStack.Text.TypeSerializer.DeserializeFromString[T](String value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\TypeSerializer.cs:line 67
at ServiceStack.LicenseUtils.ToLicenseKeyFallback(String licenseKeyText) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\LicenseUtils.cs:line 446
at ServiceStack.LicenseUtils.RegisterLicense(String licenseKeyText) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\LicenseUtils.cs:line 252
at ServiceStack.Net45PclExport.RegisterLicenseFromConfig() in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\PclExport.Net45.cs:line 140
at ServiceStack.LicenseUtils..cctor() in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\LicenseUtils.cs:line 135
When adding my key by calling Licensing.RegisterLicense before running AppHost.Init I get the following exception instead:
System.IO.FileLoadException : Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at System.MemoryExtensions.AsSpan(String text)
at ServiceStack.Text.Jsv.JsvReader`1.Parse(String value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Jsv\JsvReader.Generic.cs:line 81
at ServiceStack.Text.TypeSerializer.DeserializeFromString[T](String value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\TypeSerializer.cs:line 67
at ServiceStack.LicenseUtils.ToLicenseKeyFallback(String licenseKeyText) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\LicenseUtils.cs:line 446
at ServiceStack.LicenseUtils.RegisterLicense(String licenseKeyText) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\LicenseUtils.cs:line 252
at Alstra.SG.Tests.Private.BaseIntegrationTest..ctor() in C:\TeamCity\buildAgent\work\a0903bf22b2d1e1c\Test\Private\BaseIntegrationTest.cs:line 17
at Alstra.SG.Tests.Private.Integration.ActivityServiceTests..ctor()
Happy to get some help!
I believe the version of ServiceStack you are using was built with a different version of System.Runtime.CompilerServices.Unsafe than what you are using in your Test project and because bindingredirect are not working in this context.
See Does redirecting assembly binding work for unit testing with a test runner?
As a workaround, you can try changing System.Runtime.CompilerServices.Unsafe in Nuget Package Manager to 4.5.2.
This version matches the missing assembly, Version=4.0.4.1.
Edit: If you are using NUnit 3 in your NUnit build step, you can then specify "Path to application configuration file: " to point to your app.config.
This should solve the root problem and let you use the most current version of your Nuget packages (since the correct bindingRedirects will then be applied).

Azure dev ops pipeline failed: contains the character '*'. Remove the '*' and try again

I am publishing artifact and some supporting files for release phase.
Error I am getting:
Fail to upload '/home/vsts/work/1/a/app.yaml' due to 'TF10123: The
path '**/app.yaml' contains the character '*'. Remove the '*' and try
again.'.
There is no * in app.yaml file, please tell me what to do to fix this.
Let me know if any more information is required.
Check your file if it contains any whitespace characters (invisible ones, so use a HEX format display....), remove those characters and commit it again.

Start glassfish server on different port

I have created a new domain ac and defined a different port in domain.xml i.e. 11305. But when I try to start the domain it gives me following exception:
com.sun.enterprise.universal.xml.MiniXmlParserException: "Xml Parser Error: javax.xml.stream.XMLStreamException: ParseError at
[row,col]:[253,34]
Message: Open quote is expected for attribute "{1}" associated with an element type "port".
Here is the command:
./asadmin start-domain ac
Here is the part of the domain.xml file
<network-listeners>
<network-listener port=“11305” protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
<network-listener port="33389" protocol="http-listener-2" transport="tcp" name="http-listener-2" thread-pool="http-thread-pool"></network-listener>
<network-listener port="33356" protocol="admin-listener" transport="tcp" name="admin-listener" thread-pool="admin-thread-pool"></network-listener>
</network-listeners>
Where am I going wrong?
The xml config got malformed. Check if the port value is quoted and check if your quote is the right symbol (try copying quotes from other places in the xml)
Update: First and second quotes are non-standard in your excerpt of the domain.xml file, 3rd line. Compare the quotes around 11305 and the quotes around http-listener-1. They are different. The quotes around http-listener-1 are proper and you should use those.

Compiler error when putting class in App_Code folder for common use

I have put a class in the App_Code folder, so it should be accessible for all my source files. Intellisense indeed sees the class (in code-behind), but when I run the site from the browser I get a compiler error:
**Compilation Error**
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30002: Type 'ClsTranslation' is not defined.
Source Error:
Line 38: End If
Line 39:
**Line 40: Dim clsTrans As ClsTranslation**
Line 41: clsTrans = New ClsTranslation()
Line 42: lblLevel0.Text = clsTrans.GetResource("", "Modules")
Source File: C:\inetpub\wwwroot\myproject\InfoSiteMap.aspx.vb Line: 40
I am running this site as a web project and therefore the build-option content/compile for my App_Code/class is not available. I also tried to map the file to the pre-compiler using the # Reference directive, but this seems to work for user controls only and not for classes. Also tried to put the class in a namespace, all with same result.
Any suggestions?
Most of the time, when I do this, the build action of the file is to "Content" instead of "Compile". Highlight the class in solution explorer and hit f4 and change this.