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

**URL:** <https://www.finalbuilder.com/forums/t/exception-on-getting-branch-name-but-only-for-one-specific-branch/7457>\
**Category:** Bugs\
**Created:** [January 30, 2024, 9:59am UTC](https://www.finalbuilder.com/forums/t/exception-on-getting-branch-name-but-only-for-one-specific-branch/7457 "2024-01-30T09:59:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![k3tchup](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/k3tchup/32/2162_2.png) [@k3tchup](https://www.finalbuilder.com/forums/u/k3tchup)\
**Post date:** [January 30, 2024, 9:59am UTC](https://www.finalbuilder.com/forums/t/exception-on-getting-branch-name-but-only-for-one-specific-branch/7457/1 "2024-01-30T09:59:15Z")

</div>

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:

```auto
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

> &

---

<div class="post-metadata">

**Author:** ![Sparky](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/sparky/32/10_2.png) [@Sparky](https://www.finalbuilder.com/forums/u/Sparky)\
**Post date:** [January 30, 2024, 10:37am UTC](https://www.finalbuilder.com/forums/t/exception-on-getting-branch-name-but-only-for-one-specific-branch/7457/2 "2024-01-30T10:37:11Z")

</div>

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:

```auto
	<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

---

<div class="post-metadata">

**Author:** ![k3tchup](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/k3tchup/32/2162_2.png) [@k3tchup](https://www.finalbuilder.com/forums/u/k3tchup)\
**Post date:** [January 30, 2024, 10:57am UTC](https://www.finalbuilder.com/forums/t/exception-on-getting-branch-name-but-only-for-one-specific-branch/7457/3 "2024-01-30T10:57:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![k3tchup](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/k3tchup/32/2162_2.png) [@k3tchup](https://www.finalbuilder.com/forums/u/k3tchup)\
**Post date:** [February 12, 2024, 9:34am UTC](https://www.finalbuilder.com/forums/t/exception-on-getting-branch-name-but-only-for-one-specific-branch/7457/4 "2024-02-12T09:34:15Z")

</div>

@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 🙂  
So which one is used ?

---

<div class="post-metadata">

**Author:** ![Sparky](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/sparky/32/10_2.png) [@Sparky](https://www.finalbuilder.com/forums/u/Sparky)\
**Post date:** [February 12, 2024, 10:19am UTC](https://www.finalbuilder.com/forums/t/exception-on-getting-branch-name-but-only-for-one-specific-branch/7457/5 "2024-02-12T10:19:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![k3tchup](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/k3tchup/32/2162_2.png) [@k3tchup](https://www.finalbuilder.com/forums/u/k3tchup)\
**Post date:** [February 12, 2024, 1:01pm UTC](https://www.finalbuilder.com/forums/t/exception-on-getting-branch-name-but-only-for-one-specific-branch/7457/6 "2024-02-12T13:01:03Z")

</div>

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