Comments (11)
Of course!
In Prig, the block using (new IndirectionsContext()) { ... }
has only the function "Revert the all behavior from the methods that were replaced the bodies".
This means that the following program is valid:
using System;
using System.Prig;
class Program
{
static void Main(string[] args)
{
PDateTime.NowGet().Body = () => new DateTime(2014, 1, 1);
Console.WriteLine(DateTime.Now);
}
}
I don't know well what you want to do, but I hope that you use to a good thing O:)
from prig.
That's awesome! Thanks.
Will keep this updated if I run into any further problems
from prig.
Looks like I have to manually run
Add-Type -Path "path to dll I want to use Prig on"
To be able to use pfind and the likes, is it supposed to be that way?
from prig.
After running the above, adding a stub to the xml and trying to build I get these errors:
Warning 41 Exception calling "Load" with "1" argument(s): "Could not load file or c:\users\lenny\documents\visual studio 2013\Projects\ConsoleApplication2\ConsoleApplication2\EXEC ConsoleApplication2
Warning 42 Exception calling "Load" with "1" argument(s): "Could not load file or c:\users\lenny\documents\visual studio 2013\Projects\ConsoleApplication2\ConsoleApplication2\EXEC ConsoleApplication2
Warning 43 Exception calling "Load" with "1" argument(s): "Could not load file or c:\users\lenny\documents\visual studio 2013\Projects\ConsoleApplication2\ConsoleApplication2\EXEC ConsoleApplication2
Warning 44 There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "mscorlib", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. [c:\users\lenny\documents\visual studio 2013\Projects\ConsoleApplication2\ConsoleApplication2\Assembly-CSharp-firstpass.v2.0.50727.v0.0.0.0.MSIL.Prig\Assembly-CSharp-firstpass.Prig.g.csproj] ConsoleApplication2
Error 45 The type 'UnityEngine.MonoBehaviour' is defined in an assembly that is not referenced. You must add a reference to assembly 'UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. [c:\users\lenny\documents\visual studio 2013\Projects\ConsoleApplication2\ConsoleApplication2\Assembly-CSharp-firstpass.v2.0.50727.v0.0.0.0.MSIL.Prig\Assembly-CSharp-firstpass.Prig.g.csproj] c:\users\lenny\documents\visual studio 2013\Projects\ConsoleApplication2\ConsoleApplication2\PProxyUITextList.cs 64 41 ConsoleApplication2
Warning 46 There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "mscorlib", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. [c:\users\lenny\documents\visual studio 2013\Projects\ConsoleApplication2\ConsoleApplication2\Assembly-CSharp-firstpass.v2.0.50727.v0.0.0.0.MSIL.Prig\Assembly-CSharp-firstpass.Prig.g.csproj] ConsoleApplication2
Error 47 The type 'UnityEngine.MonoBehaviour' is defined in an assembly that is not referenced. You must add a reference to assembly 'UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. [c:\users\lenny\documents\visual studio 2013\Projects\ConsoleApplication2\ConsoleApplication2\Assembly-CSharp-firstpass.v2.0.50727.v0.0.0.0.MSIL.Prig\Assembly-CSharp-firstpass.Prig.g.csproj] c:\users\lenny\documents\visual studio 2013\Projects\ConsoleApplication2\ConsoleApplication2\PProxyUITextList.cs 64 41 ConsoleApplication2
Error 48 The command "cmd /c " "%VS120COMNTOOLS%VsDevCmd.bat" & %windir%\system32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -NoProfile -File "c:\users\lenny\documents\visual studio 2013\Projects\ConsoleApplication2\packages\Prig.0.0.0-alpha9\tools\Invoke-PilotStubber.ps1" -ReferenceFrom "@('c:\users\lenny\documents\visual studio 2013\Projects\ConsoleApplication2\packages\Prig.0.0.0-alpha9\lib\net40\Urasandesu.NAnonym.dll','c:\users\lenny\documents\visual studio 2013\Projects\ConsoleApplication2\packages\Prig.0.0.0-alpha9\lib\net40\Urasandesu.Prig.Framework.dll')" -AssemblyFrom "C:\games\Superboss Games\Intruder\Intruder\Intruder_Data\Managed\Assembly-CSharp-firstpass.dll" -TargetFrameworkVersion v4.5 -KeyFile "c:\users\lenny\documents\visual studio 2013\Projects\ConsoleApplication2\packages\Prig.0.0.0-alpha9\tools\Urasandesu.Prig.snk" -OutputPath "c:\users\lenny\documents\visual studio 2013\Projects\ConsoleApplication2\ConsoleApplication2\bin\Debug." -Settings "c:\users\lenny\documents\visual studio 2013\Projects\ConsoleApplication2\ConsoleApplication2\Assembly-CSharp-firstpass.v2.0.50727.v0.0.0.0.prig" "" exited with code -1. ConsoleApplication2
Warning 49 The referenced component 'Assembly-CSharp-firstpass.v2.0.50727.v0.0.0.0.MSIL.Prig' could not be found. ConsoleApplication2
From what I can tell it's missing some references in Projects that Prig generated, can I just edit those and add the references?
Nope it regenerates them on every build.
from prig.
Thanks for reporting the problem!
It seems that it is Prig's bug, but some different problems may be involved.
I want to regulate those circumstances, so please wait a moment...
from prig.
Created the child Issue #23: Can't be replaced the method that exposes the type of GAC unregistered assembly.
from prig.
Looks like I have to manually run
Add-Type -Path "path to dll I want to use Prig on"
To be able to use pfind and the likes, is it supposed to be that way?
Yes, you are right!
However, I recommended that you execute it only in PowerShell, don't in the Package Manager Console. Because you can never unload the dll until restarting Visual Studio if you it execute in the Package Manager Console.
I also explain the analysis step in Wiki for the migration, so please see the page(from JustMock: part 1, part 2, part 3; from Isolator).
Currently, I'm sorry there is no Comment-Based Help. In a normal situation, the above information should be in that :)
from prig.
Created the child Issue #24: Add Comment-Based Help.
from prig.
I will try to go through that, but I can't guarantee that I will get everything since I don't really have any experience with any framework other than fakes. (The reason I'm not using fakes is that it needs its a ShimConext which doesn't let me produce the outcome I want)
Again, currently the only problem that exists is the project that Prig generates doesn't have the references to some of the dlls that it needs. I can't add the references myself since Prig regenerates the project on every build.
Full error log is here
from prig.
Again, currently the only problem that exists is the project that Prig generates doesn't have the references to some of the dlls that it needs. I can't add the references myself since Prig regenerates the project on every build.
Full error log is here
In my understanding, this is Prig's bug(Issue #23), so I'll fix it in the future(It becomes to add necessary dlls to the *.g.csproj
automatically when regenerating).
If it is no and you want to just stop the regenerating, you can do it by commenting out the line 184 at Invoke-PilotStubber.ps1
:
...(snip)...
Write-Verbose 'Generate *.csproj ...'
$csprojInfo = New-PrigCsproj $workDir $asmInfo $refAsmInfos $KeyFile $TargetFrameworkVersion $OutputPath
$csprojDir = [System.IO.Path]::GetDirectoryName($csprojInfo.Path)
if (![string]::IsNullOrEmpty($csprojDir) -and ![IO.Directory]::Exists($csprojDir)) {
New-Item $csprojDir -ItemType Directory -WhatIf:$WhatIf -ErrorAction Stop | Out-Null
}
$csprojInfo.XmlDocument.Save($csprojInfo.Path)
Write-Verbose ('Output to {0} ...' -f $csprojInfo.Path)
...(snip)...
-->>
...(snip)...
Write-Verbose 'Generate *.csproj ...'
$csprojInfo = New-PrigCsproj $workDir $asmInfo $refAsmInfos $KeyFile $TargetFrameworkVersion $OutputPath
$csprojDir = [System.IO.Path]::GetDirectoryName($csprojInfo.Path)
if (![string]::IsNullOrEmpty($csprojDir) -and ![IO.Directory]::Exists($csprojDir)) {
New-Item $csprojDir -ItemType Directory -WhatIf:$WhatIf -ErrorAction Stop | Out-Null
}
#$csprojInfo.XmlDocument.Save($csprojInfo.Path) # to suppress regeneration
Write-Verbose ('Output to {0} ...' -f $csprojInfo.Path)
...(snip)...
Invoke-PilotStubber.ps1
exists in Prig's package directory that was generated by NuGet. You can probably find it in your environment c:\users\lenny\documents\visual studio 2013\Projects\ConsoleApplication2\packages\Prig.0.0.0-alpha9\tools\Invoke-PilotStubber.ps1
.
This is an illegal way, but maybe it go well. Good luck! :)
from prig.
This issue is fixed by the correction for issue #23.
from prig.
Related Issues (20)
- install the prig without visual studio HOT 5
- Mocking not working at all under VS 2015 Professional (Windows 7 Pro SP1) HOT 1
- Cannot re-register after unregistering Prig
- Cannot target x86 architecture on a x64 machine
- Houston is anyone there? HOT 1
- This project is now dead? HOT 1
- Support Run All HOT 4
- Problem debugging prig MSTests with ReSharper test runner HOT 4
- TeamCity Support HOT 7
- Prig test run crashing (when a nested static, unstubbed method is called) HOT 40
- MsTest: The method of generic type that has declaring type parameter excluding this cannot detour HOT 1
- MsTest: Test runner will crash when stubbing a shared member that shouldn't matter HOT 8
- Add Prig Assembly is failed immediately after installation
- Visual Studio 2017 support HOT 18
- From VS IDE unable to successfully run multiple test projects HOT 2
- Cannot uninstall Prig except for en-us locale environment
- Dotnet core support HOT 2
- Getting an error while buliding the project HOT 4
- How would i use this on CI HOT 1
- Stub a method of the parent type HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prig.