Getting Character reference "&# at nonPublic mock exceptions

8 posts, 0 answers
  1. Peter Stefan
    Peter Stefan avatar
    6 posts
    Member since:
    Dec 2012

    Posted 23 Jun 2014 Link to this post

    Hello,

    when a test with a nonPublic mock fails, following gets written to the stacktrace of the .trx file:

    01.<Message>Test method test threw exception:
    02.System.ArgumentException: Method 'test' not found on type test</Message>
    03.          <StackTrace>    at Telerik.JustMock.Expectations.NonPublicExpectation.™(Type ‹, Type ‘, String , Object[] €)
    04.   at Telerik.JustMock.Expectations.NonPublicExpectation..›()
    05.   at “•.’•.Š•[–](Func`1 ‹•)
    06.   at Telerik.JustMock.Expectations.NonPublicExpectation.Arrange[TReturn](Object target, String memberName, Object[] args)
    07.   at Common.Test.MockData`1.NonPublicMockData.Arrange[TReturn](String memberName, String exprName, Object[] args) in c:\jenkins\workspace\Tests\Mock\MockData.cs:line 167
    08....
    09....
    10.truncated here
    11.</StackTrace>


    the &#x characters let the build fail, because they cannot be transformed.

    see:
    01.Processing tests results in file(s) Test\TestResults\testResults.trx
    02. Test\TestResults\testResults.trx
    03.ERROR: Publisher hudson.plugins.mstest.MSTestPublisher aborted due to exception
    04.java.io.IOException: remote file operation failed: c:\jenkins\workspace\Build - Tests at hudson.remoting.Channel@69bf0fd8:build3
    05.    at hudson.FilePath.act(FilePath.java:916)
    06.    at hudson.FilePath.act(FilePath.java:893)
    07.    at hudson.plugins.mstest.MSTestPublisher.perform(MSTestPublisher.java:73)
    08.    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    09.    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:745)
    10.    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:709)
    11.    at hudson.model.Build$BuildExecution.post2(Build.java:182)
    12.    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:658)
    13.    at hudson.model.Run.execute(Run.java:1735)
    14.    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    15.    at hudson.model.ResourceController.execute(ResourceController.java:88)
    16.    at hudson.model.Executor.run(Executor.java:231)
    17.Caused by: hudson.util.IOException2: Could not transform the MSTest report. Please report this issue to the plugin author
    18.    at hudson.plugins.mstest.MSTestTransformer.invoke(MSTestTransformer.java:66)
    19.    at hudson.plugins.mstest.MSTestTransformer.invoke(MSTestTransformer.java:28)
    20.    at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2474)
    21.    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
    22.    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    23.    at hudson.remoting.Request$2.run(Request.java:328)
    24.    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    25.    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    26.    at java.util.concurrent.FutureTask.run(Unknown Source)
    27.    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    28.    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    29.    at hudson.remoting.Engine$1$1.run(Engine.java:63)
    30.    at java.lang.Thread.run(Unknown Source)
    31.Caused by: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Character reference "&#
    32.    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
    33.    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
    34.    at hudson.plugins.mstest.MSTestReportConverter.transform(MSTestReportConverter.java:63)
    35.    at hudson.plugins.mstest.MSTestTransformer.invoke(MSTestTransformer.java:64)
    36.    ... 12 more
    37.Caused by: javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Character reference "&#
    38.    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getDOM(Unknown Source)
    39.    ... 16 more
    40.Caused by: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Character reference "&#
    41.    at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(Unknown Source)
    42.    at com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager.getDTM(Unknown Source)
    43.    ... 17 more

    already created an issue for the plugin author (https://issues.jenkins-ci.org/browse/JENKINS-23531)


    Is there a way to prevent this errors or to change the encoding of justmocks exception messages?

    kind regards
    peter
  2. Peter Stefan
    Peter Stefan avatar
    6 posts
    Member since:
    Dec 2012

    Posted 23 Jun 2014 in reply to Peter Stefan Link to this post

    the original message got lost, here is a screenshot:

  3. DevCraft R3 2016 release webinar banner
  4. Peter Stefan
    Peter Stefan avatar
    6 posts
    Member since:
    Dec 2012

    Posted 23 Jun 2014 in reply to Peter Stefan Link to this post

    visual studio test result screenshot:
  5. Peter Stefan
    Peter Stefan avatar
    6 posts
    Member since:
    Dec 2012

    Posted 23 Jun 2014 in reply to Peter Stefan Link to this post

    sorry, forgot to attach the screenshot
  6. Stefan
    Admin
    Stefan avatar
    198 posts

    Posted 23 Jun 2014 Link to this post

    Hi Peter,

    It appears that the obfuscation of Telerik.JustMock.dll is causing the problem. We'll remove the obfuscation in one of next releases. As a temporary workaround I suggest that you build the Telerik.JustMock.dll from source. You can find the source code here.

    Regards,
    Stefan
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  7. Peter Stefan
    Peter Stefan avatar
    6 posts
    Member since:
    Dec 2012

    Posted 23 Jun 2014 in reply to Stefan Link to this post

    Hello,

    thank you very much for your answer, 
    which build target should i use, and which dll should i use after building?

    tried it with releaseFree and there are not ddl's in the Telerik.JustMock folder - should i take a dll of Telerik.JustMock.Demolib?

  8. Peter Stefan
    Peter Stefan avatar
    6 posts
    Member since:
    Dec 2012

    Posted 23 Jun 2014 in reply to Peter Stefan Link to this post

    found it in a binaries folder, outside the solution

    but now i get
     ​Error 11 'Telerik.JustMock.Mock' does not contain a definition for 'SetupStatic' C:\Projekte\Test\TestSetup.cs 11 9 Common.Core.Mock

    when trying to build my project
  9. Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 26 Jun 2014 Link to this post

    Hi Peter,

    Please, try with the Release configuration instead of the ReleaseFree.

    I hope this helps.

    Regards,
    Kaloyan
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
DevCraft R3 2016 release webinar banner