logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
infotech@reesassociates.com  
#1 Posted : Thursday, September 28, 2023 3:02:40 PM(UTC)
infotech@reesassociates.com

Rank: Newbie

Groups: Registered
Joined: 3/9/2023(UTC)
Posts: 8

Thanks: 5 times
Hello,

After upgrading to CenterPoint 18, I'm getting an error message when I create the API object (Exception message below). It seems to be having an issue with the encoding for the file where the database connections are stored.

I'm able to use the external api to post transactions (invoices), but for some reason the databrowser is not working.
I get the exception on this code:

Dim api As DataAccessAPI = New DataAccessAPI()


Message=Failed to open xml document 'C:\ProgramData\Red Wing Software\CenterPoint\Config\Business\databases.xml'
Source=RedWingSoftware.Core.Resources.L0.V1

StackTrace:
at RedWingSoftware.CenterPoint.XMLFunctions.OpenXMLFile(XmlDocument xmlDoc, String fileName)
at RedWingSoftware.CenterPoint.DbConfigMethods.OpenDatabasesXml(String databasesXML)
at RedWingSoftware.CenterPoint.DbConfigMethods..ctor(SettingsFile settingsFile)
at RedWingSoftware.CenterPoint.MainCBL.GetDatabaseManager()
at RedWingSoftware.CenterPoint.ExternalAPI.BaseExternalAPI.ConfigureDatabaseManager()
at RedWingSoftware.CenterPoint.ExternalAPI.BaseExternalAPI.Initialize()
at CenterPointDataBrowser.DataAccessAPI.Initialize()
at CenterPointDataBrowser.DataAccessAPI..ctor()
at AccountingBatchCore.CashRequirementsReport.GetReportData() in C:\Users\mshultz\source\repos\Rees Accounting\AccountingBatchCore\CashRequirementsReport.vb:line 144
at AccountingBatchCore.CashRequirementsReport.Process() in C:\Users\mshultz\source\repos\Rees Accounting\AccountingBatchCore\CashRequirementsReport.vb:line 41
at AccountingBatchCore.Program.Main(String[] args) in C:\Users\mshultz\source\repos\Rees Accounting\AccountingBatchCore\Program.vb:line 16

This exception was originally thrown at this call stack:
[External Code]

Inner Exception 1:
XmlException: System does not support 'windows-1252' encoding. Line 1, position 31.

Inner Exception 2:
ArgumentException: 'windows-1252' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter 'name')

Thoughts?
tony  
#2 Posted : Thursday, September 28, 2023 5:50:29 PM(UTC)
tony

Rank: Advanced Member

Groups: Registered
Joined: 2/28/2018(UTC)
Posts: 65
United States
Location: Pennsylvani mostly

Was thanked: 9 time(s) in 9 post(s)
It looks to me that you can fix this by registering XML encoding in your code.

I wasn't running into the error myself because I was running in Service Bureau mode which gets a list of databases from a master database. However, the default way of getting a list of databases is to read in the databases.xml in the location referenced in the error message. I'm only mentioning this as background info.

I went to the startup program inserted a line of code right at the top of the Main() method and that seemed to take care of the problem. Here's what that looked like:

Code:

      static void Main()
      {
         System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);

Edited by user Thursday, September 28, 2023 5:57:59 PM(UTC)  | Reason: Not specified

thanks 1 user thanked tony for this useful post.
infotech@reesassociates.com on 10/4/2023(UTC)
infotech@reesassociates.com  
#3 Posted : Wednesday, October 4, 2023 2:48:08 PM(UTC)
infotech@reesassociates.com

Rank: Newbie

Groups: Registered
Joined: 3/9/2023(UTC)
Posts: 8

Thanks: 5 times
That worked, thank you!
That's the only hiccup I've run into with the update. Considering how much of an architectural change it was going from framework to .net, I'm quite impressed!
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.