Code Monkey home page Code Monkey logo

Comments (11)

urasandesu avatar urasandesu commented on May 23, 2024

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);
    }
}

3

I don't know well what you want to do, but I hope that you use to a good thing O:)

from prig.

LennyPenny avatar LennyPenny commented on May 23, 2024

That's awesome! Thanks.
Will keep this updated if I run into any further problems

from prig.

LennyPenny avatar LennyPenny commented on May 23, 2024

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.

LennyPenny avatar LennyPenny commented on May 23, 2024

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.

urasandesu avatar urasandesu commented on May 23, 2024

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.

urasandesu avatar urasandesu commented on May 23, 2024

Created the child Issue #23: Can't be replaced the method that exposes the type of GAC unregistered assembly.

from prig.

urasandesu avatar urasandesu commented on May 23, 2024

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.

urasandesu avatar urasandesu commented on May 23, 2024

Created the child Issue #24: Add Comment-Based Help.

from prig.

LennyPenny avatar LennyPenny commented on May 23, 2024

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.

urasandesu avatar urasandesu commented on May 23, 2024

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.

urasandesu avatar urasandesu commented on May 23, 2024

This issue is fixed by the correction for issue #23.

from prig.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.