I need to unit test a method that is using the System.Net.WebClient in the System.dll. I tried to Mole the System.dll, but when I tried to compile the project to add references to the System.dll mole, I got a bunch of errors like the following:
Error 2
'System.Net.Moles.SFileWebResponse.Dispose(bool)': no suitable method found to override [C:\DGALibrary\DGALib.IO.Tests\obj\x86\Debug\Moles\s\m.g.csproj] C:\DGALibrary\DGALib.IO.Tests\m.g.cs 251374 33 DGALib.IO.Tests
Error 3
'System.Net.Moles.SFileWebResponse.SupportsHeaders': no suitable method found to override [C:\DGALibrary\DGALib.IO.Tests\obj\x86\Debug\Moles\s\m.g.csproj] C:\DGALibrary\DGALib.IO.Tests\m.g.cs 251575 30 DGALib.IO.Tests
Error 4
'System.Net.Moles.SHttpWebResponse.Dispose(bool)': no suitable method found to override [C:\DGALibrary\DGALib.IO.Tests\obj\x86\Debug\Moles\s\m.g.csproj] C:\DGALibrary\DGALib.IO.Tests\m.g.cs 255264 33 DGALib.IO.Tests
Error 5
'System.Net.Moles.SHttpWebResponse.SupportsHeaders': no suitable method found to override [C:\DGALibrary\DGALib.IO.Tests\obj\x86\Debug\Moles\s\m.g.csproj] C:\DGALibrary\DGALib.IO.Tests\m.g.cs 255465 30 DGALib.IO.Tests
Error 6
'System.Net.Moles.SWebResponse.Dispose(bool)': no suitable method found to override [C:\DGALibrary\DGALib.IO.Tests\obj\x86\Debug\Moles\s\m.g.csproj] C:\DGALibrary\DGALib.IO.Tests\m.g.cs 303123 33 DGALib.IO.Tests
Error 7
'System.Net.Moles.SWebResponse.SupportsHeaders': no suitable method found to override [C:\DGALibrary\DGALib.IO.Tests\obj\x86\Debug\Moles\s\m.g.csproj] C:\DGALibrary\DGALib.IO.Tests\m.g.cs 303324 30 DGALib.IO.Tests
Error 8
'System.Net.Moles.SFileWebResponse.Dispose(bool)': no suitable method found to override [C:\DGALibrary\DGALib.IO.Tests\obj\x86\Debug\Moles\s\m.g.csproj] C:\DGALibrary\DGALib.IO.Tests\m.g.cs 251374 33 DGALib.IO.Tests
And finally
Error 28
The command ""C:\Program Files\Microsoft Moles\bin\moles.exe" #C:\DGALibrary\DGALib.IO.Tests\obj\x86\Debug\Moles\moles.args" exited with code -1002. DGALib.IO.Tests
Are we not able to mole system.dll?
try this
<Moles xmlns="http://schemas.microsoft.com/moles/2010/">
<Assembly Name="System" ExportedTypes="true" ReflectionOnly="true"/>
</Moles>
I'm new to Pex/Moles so I can't provide you with an answer as to why the errors are occurring. However, so long as the errors aren't for types you actually need to Mole you can resolve your problem by editing the system.moles file to restrict the types to mole to just the ones you care about.
Related
I want to run a model in Mallet and need the topic-docs output, which gives the most prominent documents for each topic. This is necessary for interpreting the less clear topics correctly. But Mallet keeps on giving me empty txt files.
This is the command I use:
bin\mallet train-topics --input cleandata1000.mallet --num-topics 250 --num-iterations 3000 --optimize-interval 50 --optimize-burn-in 50 --output-topic-keys 1000-300-3000-50-topic-keys.txt --output-topic-docs 1000-300-1000-50-topic-docs.txt --num-top-docs 20 --output-doc-topics 1000-300-1000-50-doc-topics.txt --doc-topics-threshold 0.01 --xml-topic-phrase-report 1000-300-1000-50-topic-phrase.xml --output-state 1000-300-1000-50-state.gz --use-symmetric-alpha true
Does anyone know what the cause could be?
Edit in response to David Mimno's 4 Nov comment:
The same thing happens with different data (where the docs have a different lenght).
I just ran some other models with Mallet's test data. Peculiar: This trial gave no output at all (so the "en-topic-docs.txt" did not get made).
bin\mallet train-topics --input en.mallet --num-topics 5 --output-topic-docs en-topic-docs.txt
When I ask for the topic keys as output, both files are made, but the en-topic-docs.txt is empty.
bin\mallet train-topics --input en.mallet --num-topics 5 --output-topic-keys en-topic-keys.txt --output-topic-docs en-topic-docs.txt
My bad: there is a recurring error message:
Exception in thread "main" java.lang.ClassCastException: class java.net.URI cannot be cast to class java.lang.String (java.net.URI and java.lang.String are in module java.base of loader 'bootstrap')
at cc.mallet.topics.ParallelTopicModel.printTopicDocuments(ParallelTopicModel.java:1773)
at cc.mallet.topics.tui.TopicTrainer.main(TopicTrainer.java:281)
I don't know what this might mean.
Thank you for any help, you are saving my PhD :)
I was able to fix this by using the latest release on github (202108) instead of MALLET 2.0.8. Now it works like a charm.
Instructions for using the developmental release: http://mallet.cs.umass.edu/download.php
Thank you for the pointers, David Mimno!
I'm trying to update my Genexus 16 U3 Kb to U4 and I'm having issues with all objects on compiling, throwing cannot file symbol for method createMasterPage, a method I think should be defined on gxclassR.jar
I have already tried rebuild all a couple times and making a new environment with new settings with no success.
RwdMasterPage by itself compiles with no errors.
This is an example of the error:
com\parametros\parmmodelo\comportamiento\actualizacionparametro_impl.java:185: error: cannot find symbol
MasterPageObj= createMasterPage(remoteHandle, "com.parametros.rwdmasterpage");
^
symbol: method createMasterPage(int,String)
location: class actualizacionparametro_impl
That createMasterPage function is defined in the gxclassr.jar (source is https://github.com/genexuslabs/JavaClasses/blob/master/java/src/main/java/com/genexus/webpanels/GXWebPanel.java), so for some reason, your compiler is not finding the right gxclassr.jar in the classpath.
Everybody,when I training the net,there comes an critical problem, then I debug the code and it shows:
0x00007ffff23c866b in pthread_join (threadid=140736858203904,
thread_return=0x0) at pthread_join.c:92
92 pthread_join.c: No such file or directory.
This error cause the data_layer can't working normally. But there is an declaration in data_lay.cpp. Does anybody know how to resolve this problem?
I was trying to use OpenCover (downloaded today) to get coverage of my tests. Here is the command line I've used :
OpenCover.Console.exe -target:"c:\Programmes2\xunit\xunit.console.clr4.x86.exe" -targetargs:"""C:\Sources\Project\BackOffice.Tests\bin\Debug\BackOffice.Tests.dll"" /noshadow " -output:bo.coverage.xml -targetdir:"C:\Sources\Project\BackOffice.Tests\bin\Debug" -filter:+[*]*
And here is the output I get
xUnit.net console test runner (32-bit .NET 4.0.30319.269)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.0.1566
Test assembly: C:\Sources\Project\BackOffice.Tests\bin\Debug\BackOffice.Tests.dll
31 total, 0 failed, 0 skipped, took 2.760 seconds
Committing...
No results - no assemblies that matched the supplied filter were instrumented
this could be due to missing PDBs for the assemblies that match the filter
please review the output file and refer to the Usage guide (Usage.rtf)
The generated report is always the same:
<?xml version="1.0" encoding="utf-8"?>
<CoverageSession xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Modules />
</CoverageSession>
A bit more context : The PDB's are present in the target folder, I'm running the Command prompt as an administrator. The project tested is an .net 4/mvc 3 application. My computer is running windows 7/32bits. On that topic, not sure if that's relevant in any way, but the x86 folder in the is empty, even if I force the target plateform to be x86.
Also, when I try to register the OpenCover.Profiler.dll with regsvr32, I get an error that says that the dll may not be compatible with my windows version.
If I try to user the -register or the -register:user parameters, I get an exception:
An exception occured: Failed to register(user:True,register:True,is64:False):3 the profiler assembly; you may want to look into permissions or using the -register:user option instead. C:\Windows\system32\regsvr32.exe /s /n /i:user "C:\Sources\Opencover\sawilde-opencover-be6e491\main\bin\Debug\x86\OpenCover.Profiler.dll"
stack:
à OpenCover.Framework.ProfilerRegistration.ExecuteRegsvr32(Boolean userRegistration, Boolean register, Boolean is64) dans C:\Sources\Opencover\sawilde-opencover-be6e491\main\OpenCover.Framework\ProfilerRegistration.cs:ligne 59
à OpenCover.Framework.ProfilerRegistration.ExecuteRegsvr32(Boolean userRegistration, Boolean register) dans C:\Sources\Opencover\sawilde-opencover-be6e491\main\OpenCover.Framework\ProfilerRegistration.cs:ligne 45
à OpenCover.Framework.ProfilerRegistration.Register(Boolean userRegistration) dans C:\Sources\Opencover\sawilde-opencover-be6e491\main\OpenCover.Framework\ProfilerRegistration.cs:ligne 31
à OpenCover.Console.Program.Main(String[] args) dans C:\Sources\Opencover\sawilde-opencover-be6e491\main\OpenCover.Console\Program.cs:ligne 82
I also tried with a DLL project (.net4) tested by a different project (xunit also), with the same (lack of) result.
Any help appreciated !
Downloading the release package solved the exception from the register parameter. But running the same command line generated multiple errors of this kind:
BackOffice.Tests.HomeControllerShould.Redirect_To_Action_Feed_Index [FAIL]
System.MissingMethodException : Méthode introuvable : 'Void System.CannotUnloadAppDomainException.SafeVisited(Int32)'.
Stack Trace:
à BackOffice.Tests.HomeControllerShould..ctor()
with this result:
31 total, 31 failed, 0 skipped, took 0.241 seconds
Committing...
Visited Classes 0 of 44 (0)
Visited Methods 0 of 183 (0)
Visited Points 0 of 1352 (0)
Visited Branches 0 of 322 (0)
==== Alternative Results (includes all methods including those without corresponding source) ====
Alternative Visited Classes 0 of 53 (0)
Alternative Visited Methods 0 of 268 (0)
After looking around for similar issues, I found this issue on github and tried the -oldStyle parameter. It solved mine.
#Shaun Wilde, if by any chance you see this question again, could you tell us if it's the recommended way to solve it and if we lose something from using it against the "normal" way (I would also suggest adding this parameter to the documentation page
Im trying to use the Windows API in Haxe to create a Windows application. I have already done this using ndlls and Haxe/Neko.
I tried doing it with the cpp target where I embed C++ code into the Haxe file using the new macro features in Haxe 2.09. But, as soon as I include windows.h it gives an error
./src/Main.cpp(79) : error C2039: 'RegisterClassA' : is not a member of 'hx'
./src/Main.cpp(81) : error C2660: 'RegisterClassA' : function does not take 9 arguments
Called from ? line 1
Called from BuildTool.hx line 1246
Called from BuildTool.hx line 554
Called from BuildTool.hx line 591
Called from BuildTool.hx line 710
Called from BuildTool.hx line 785
Uncaught exception - Error in building thread
Error : Build failed
Build halted with errors (haxe.exe).
Here is my code -
import cpp.Lib;
#:headerCode("#include <windows.h>")// if i comment this line or replace windows.h with another standard header file like iostream, the error goes
class Main
{
static function main()
{
//no code here
}
}
In fact, if I replace windows.h with any header file from the Windows or DirectX SDK, I get the same error
Im using Haxe 2.09 and FlashDevelop. I use Windows 7. I am also using the latest version of hxcpp (version 2.09).
Looks like <windows.h> is #defining RegisterClass to RegisterClassA (part of the auto-magic Unicode support).
Because this is done with a text-prepropcessor macro, any code that has a symbol named RegisterClass (as seems to be the case with BuildTool) has it automatically swapped out for RegisterClassA, which obviously causes problems if somebody goes looking for the function under its proper name.
Try this:
#:headerCode("#include <windows.h>")
#:headerCode("#undef RegisterClass")
You may need to do something similar for other clashes. See also this question.