0

Running the below PowerShell script (i.e. to deploy all SSRS reports for AX) gives an error:

$axdllname = "Microsoft.Dynamics.AX.Framework.Management.dll"
$gacfolder = join-path $env:windir "assembly\GAC_MSIL"
$axdll = Get-ChildItem $gacfolder -Recurse -Name $axdllname
$axdll = join-path $gacfolder $axdll
import-module $axdll
Publish-AXReport -ReportName "*" -RestartReportServer

The error message is:

Publish-AXReport : Name cannot begin with the ' ' character, hexadecimal value 0x20. Line 46, position 8.
At line:1 char:17
+ Publish-AXReport <<<<  -ReportName "*" -RestartReportServer
+ CategoryInfo          : ParserError: (:) [Publish-AXReport], XmlException
+ FullyQualifiedErrorId : Name cannot begin with the ' ' character, hexadecimal value 0x20. Line 46, position 8.,M
icrosoft.Dynamics.AX.Framework.Management.Reports.PublishReportCommand

Sadly I can't find a copy of the source for Publish-AXReport, so can't dig deeper into where this exception's coming from.

Question

Does anyone know of a likely cause for this issue, or what steps I could take to uncover the cause?

Update

Instead of running for all reports using * I tried getting a list of all reports (works fine on its own / shows no reports with names beginning with a space) then piping this to the publish-axreport cmdlet; which now means I can see which report(s) produce that error.

Get-AxReport -ReportName * | Publish-AXReport

It's now clear that there are several reports (though only a small subset of those available) which throw this error when published. One of these is AssetAcquisitionDocumentPL.

The errors seem to occur only for reports with associated assemblies / always erring for those with; never for those without.

Same issue occurs if running Get-AXReportServerConfiguration | %{Publish-AXAssembly -id $_.ConfigurationId -vsprojectname 'assetAcquisitionDocumentPL.BusinessLogic'}

Running the above with the -verbose switch shows the error occurs at some point after the assumblies are copied form the temp directory to the SSRS bin directory.

JohnLBevan
  • 1,134
  • 7
  • 20
  • 44

2 Answers2

0

Looks like you have whitespaces (Hexidecimal 0x20) in the report name which is causing the error. Please check your script and/or report names to remove the whitespaces.

Line 46, position 8

bentek
  • 2,205
  • 1
  • 14
  • 23
0

Issue resolved in this thread: https://community.dynamics.com/ax/f/33/t/190841

Root Cause

File D:\Program Files\Microsoft SQL Server\MSRS11.AX2012_ENVIRON1\Reporting Services\ReportServer\rssrvpolicy.config contained a space between an open bracket and one of the element names; i.e. < CodeGroup ...> instead of <CodeGroup ...>.

Correcting this typo resolved the issue.

(I don't know how the space got into the file in the first place / doubt I'll find out unless we see this issue again).

Steps to Discover Cause

Should anyone have a similar issue with a different cause, here's a verbose version of how we uncovered the issue:

  • Download & extract process monitor: https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx
  • Close all unrequired processes / services (to reduce noise)
  • Open Microsoft Dynamics AX 2012 Management Shell as administrator
  • Type the command which generates the error (Publish-AXAssembly -id 'SSRSNLBAOS2' -vsprojectname 'assetAcquisitionDocumentPL.BusinessLogic' -verbose); select a command which does the least possible work before giving the error (to reduce noise).
  • Open Process Monitor
  • Run the command
  • The moment the error shows, hit Save in process monitor to save the session to a PML file.
  • Close process monitor and powershell
  • Open the PML file and filter on process name powershell.exe
  • Look for interesting events. For me I suspected an XML file, so looked at the file access events near the end of the file.
  • Since I'd seen similar issues with XML files before, focussed on the XML (format) files / tried to parse them to see which erred ([xml][string](get-content 'd:\some\path\to\a\file.config')).
  • When a file didn't parse / gave an error about an invalid space character, that was the culprit file.
  • I then opened the file in a text editor and thanks to syntax highlighting spotted the error immediately.
  • Correcting the file, saving, then confirming that was the only error in the file by parsing again left the file in a good state.
  • I then reran the Publish-AXAssembly ... command (without process monitor running) to see if the issue was resolved - it was.

Thanks to @BrandonWiese of the Dynamics Community for his assistance.

JohnLBevan
  • 1,134
  • 7
  • 20
  • 44