Exception on getting branch name, but only for one specific branch

I have a really strange issue, which was reported by one person, that the build fails.
The reason is that Continua fails to get branch name property. I have reset the repository but it does not help. No other persone reported this issue and I tested other branches and they are OK…

The stack on getting the value is:

10:47:59  		Set Variable [Branch] - Iteration #1
10:47:59  			[Error] Could not expand property line of New Value with value '$Source.FusionMain.Branch$'. Exception: TypeInitializationException

Message: The type initializer for 'Ganss.Xss.HtmlSanitizer' threw an exception.

Stack Trace:    at Ganss.Xss.HtmlSanitizer..ctor()    at Continua.Shared.Extensions.XssStringExtensions.RemoveHtmlXss(String htmlIn, String baseUrl)    at Continua.Modules.Builds.Common.IssueRegex.ReplaceIssueLinksInChangesetCommentHtml(ChangesetDTO changeset)    at Continua.Modules.Builds.Descriptors.ChangesetDetails..ctor(ChangesetDTO changesetDto)    at Continua.Modules.Builds.Descriptors.RepositoryDetails..ctor(BuildRepositoryDTO buildRepositoryDto, IEnumerable`1 changesets, String workspacePath)    at Continua.Modules.Builds.Descriptors.RepositoryDescriptor..ctor(BuildRepositoryDTO repositoryDTO, IEnumerable`1 repoChangesets, String workspacePath, Boolean designtime)    at Continua.Modules.Builds.Descriptors.SourcesDescriptor.TryGetMember(String name, IDescriptor& descriptor)    at Continua.Querying.Parser.QueryResolver.ResolveMember[T](String value, IDescriptor rootDescriptor, IDescriptor& currentDescriptor, IDescriptor& descriptor)    at Continua.Querying.Parser.QueryResolver.ResolveObjectName(String value, IDescriptor& descriptor)    at Continua.Querying.Parser.QueryResolver.Resolve(String value, QueryASTNodeType& hint, IDescriptor& descriptor)    at Continua.Querying.Parser.QueryParser.MatchObjectElements(BaseQueryASTNode parentNode, TextPosition startPos)    at Continua.Querying.Parser.QueryParser.MatchObjectQuery(BaseQueryASTNode parentNode, TextPosition startPos)    at Continua.Querying.Parser.QueryParser.MatchDollar(BaseQueryASTNode parentNode)    at Continua.Querying.Parser.QueryParser.MatchSourceNode()    at Continua.Querying.Parser.QueryParser.DoParse(IParseData`2 parseData)    at VSoft.ParserFramework.BaseParser`3.Parse(ITextReader source)    at Continua.Querying.QueryExpansionEngine.GetDescriptorsIn(String text, String& errorMessage)    at Continua.Querying.QueryExpansionEngine.TryExpand(String text, IDescriptor& desc, String& errorMessage)


Type name is: Ganss.Xss.HtmlSanitizer. Exception: FileLoadException

Message: Could not load file or assembly 'AngleSharp, Version=1.0.2.0, Culture=neutral, PublicKeyToken=e83494dcdc6d31ea' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Stack Trace:    at Ganss.Xss.HtmlSanitizer..cctor()

Branch name is

feature/L6639_keepAliveTest_master

But looking at the stack I think that the problem migth be that the commit message contains

&

Hi Michal,

Which version are you running ? This issue should have been fixed in v1.9.2.1264.

Check that your agent configuration file at %ProgramFiles%\VSoft Technologies\ContinuaCI Agent\Continua.Agent.Service.exe.config contains the following lines:

	<runtime>
		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
			<dependentAssembly>
				<assemblyIdentity name="AngleSharp" publicKeyToken="e83494dcdc6d31ea" culture="neutral"/>
				<bindingRedirect oldVersion="0.0.0.0-1.0.7.0" newVersion="1.0.7.0"/>
			</dependentAssembly>
		</assemblyBinding>
		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
			<dependentAssembly>
				<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
				<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2"/>
			</dependentAssembly>
		</assemblyBinding>
		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
			<dependentAssembly>
				<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
				<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
			</dependentAssembly>
		</assemblyBinding>
	</runtime>

under the <configuration> node

I am still on 1.9.2.1252.
Good to know it is fixed :slight_smile:

@Sparky
I upgraded to newest version but the problem still occurs.
I checked the config files and they do not have those entries, but there is an additional file Continua.Agent.Service.exe.config.new that has them, it has by server addres, so I guess it should be used ?
The config file without “new” does not have my server address :slight_smile:
So which one is used ?

Hi Michal,

The file Continua.Agent.Service.exe.config is the one that is used by the agent service.

During installation:

  1. The file Continua.Agent.Service.exe.config.new is extracted from the installer.
  2. The installer then reads user settings from Continua.Agent.Service.exe.config, saves them to Continua.Agent.Service.exe.config.new.
  3. Next, it copies Continua.Agent.Service.exe.config to Continua.Agent.Service.exe.config.bak,
  4. deletes Continua.Agent.Service.exe.config, and then
  5. copies Continua.Agent.Service.exe.config.new to Continua.Agent.Service.exe.config.
  6. Continua.Agent.Service.exe.config is read by the service during start up.

From what you have said, step 5 doesn’t appear to be happening. Can you check the installer log file? It’s a file with a name fitting the pattern “Setup Log yyyy-mm-dd #nnn.txt” in the %TEMP% folder.

OK, I checked, there was a bug in my Ansible script for updating agents and I overwrote that config every time :smiley:
Sorry for that.