Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 26 22:26
    jakubmisek commented #984
  • Oct 26 21:52
    siggi90 commented #984
  • Oct 26 21:42
    jakubmisek commented #984
  • Oct 26 21:27
    siggi90 opened #984
  • Oct 26 12:40
    jakubmisek commented #983
  • Oct 26 12:35
    jakubmisek commented #982
  • Oct 26 12:35

    jakubmisek on master

    Fix chr() ref https://github.c… (compare)

  • Oct 26 12:35
    jakubmisek closed #982
  • Oct 26 05:50
  • Oct 26 02:41
    kripper commented #983
  • Oct 25 23:34
    kripper opened #983
  • Oct 25 21:53
    kripper opened #982
  • Oct 25 21:31
    kripper commented #981
  • Oct 25 21:17
    jakubmisek commented #981
  • Oct 25 20:50
    kripper commented #981
  • Oct 25 20:48
    kripper commented #981
  • Oct 25 20:40
    jakubmisek commented #981
  • Oct 25 20:34
    kripper commented #981
  • Oct 25 20:13
    jakubmisek commented #981
  • Oct 25 18:16
    kripper commented #981
smx
@smx-smx
The project does build, but the issue is that it fails to run. Cannot load SixLabors.Core
HRESULT: 0x80131044
 in System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
   in System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   in System.RuntimeType.RuntimeTypeCache.MemberInfoCache`1.PopulateNestedClasses(Filter filter)
   in System.RuntimeType.RuntimeTypeCache.MemberInfoCache`1.GetListByName(Char* pName, Int32 cNameLen, Byte* pUtf8Name, Int32 cUtf8Name, MemberListType listType, CacheType cacheType)
   in System.RuntimeType.RuntimeTypeCache.MemberInfoCache`1.Populate(String name, MemberListType listType, CacheType cacheType)
   in System.RuntimeType.GetNestedTypeCandidates(String fullname, BindingFlags bindingAttr, Boolean allowPrefixLookup)
   in System.RuntimeType.GetMembers(BindingFlags bindingAttr)
   in Pchp.Core.Context.DllLoader`1.AddScriptReference(Assembly assembly)
   in Pchp.Core.Context.DllLoader`1..cctor()
 in Pchp.Core.Context.DllLoader`1.Bootstrap()
   in <Script>.Main(String[] args)
it tries to load 'SixLabors.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' but it fails to do that
even if it's in the same directory
from what i can see, it expects the assembly to have a strong name
i sadly can't switch to .NET Core yet since the project i'm using is bound to .NET Framework, and it has to overcome a few problems for it to be fully .NET Core compatible
My intention is to make a PeachPie command line program that uses the classes from the .NET Framework project
smx
@smx-smx
So i tried this
for %f in (*.dll) do snremove -r %f
and now it says, on PeachPie.Runtime: The module was expected to contain an assembly manifest.
smx
@smx-smx
ok i got it working by signing StrongLabors with the peachpie snk
but PeachPie.Library.Graphics.dll shouldn't signature-check its deps
Benjamin Fistein
@bfistein
Good job @smx-smx, you managed to get it done before we even got to respond. We didn't realize there were 3 unsigned libraries. We might have to fork those and sign them ourselves if the authors haven't done so.
smx
@smx-smx
thanks @bfistein :)
i was already working on an msbuild target that fixes the signature on the fly after build :P
yes they are unsigned
ImageSharp is unsigned, so it tries to load dlls that have a null PublicKeyToken
and .NET Framework doesn't allow that if the loading image is signed
so i had to sign ImageSharp and re-sign PeachPie.Library.Graphics in a single run
smx
@smx-smx
so that PeachPie.Library.Graphics gets patched to lookup a signed variant of ImageSharp
Patching the images one at a time didn't work because references weren't properly updated
smx
@smx-smx
made a workaround script
smx
@smx-smx
<?php
$toFix = array(
    "Peachpie.Library.Graphics.dll",
    "SixLabors.Core.dll",
    "SixLabors.ImageSharp.dll"
);

$fixer = "C:\Program Files\BrutalDev\.NET Assembly Strong-Name Signer\StrongNameSigner.Console.exe";

mkdir("tmp");

foreach($toFix as $item){
    copy($item, "tmp/{$item}");
}

$keyFile = escapeshellarg($argv[1]);
system("\"{$fixer}\" -in tmp -k {$keyFile}", $code);
if($code != 0)
    return $code;

foreach($toFix as $item){
    unlink($item);
    copy("tmp/{$item}", $item);
}

shell_exec("rd /s /q tmp");
invoke this from msbuild
  <Target Name="FixSignature" DependsOnTargets="Build" AfterTargets="Build">
    <Exec Command="php &quot;$(ProjectDir)fixer.php&quot; $(ProjectDir)peachpie.snk" WorkingDirectory="$(OutDir)" />
  </Target>
  <ItemGroup>
    <None Remove="fixer.php" />
  </ItemGroup>
hmm forgot that i made a copy of the snk in the outputdir
it should probably be passed as first arg
but w/e, just a temporary hax (P.S. updated the workaround script to do this)
smx
@smx-smx
question: is it possible to get syntax completion in referenced .NET projects? (in PHP land i mean)
at least for methods and types
smx
@smx-smx
also another question: how to do typeof in PHP (i need to get the type of a C# class)
smx
@smx-smx
worked around it with Type::GetType(string)
where string can be Type,ContainingAssembly
L!εsAμεr
@liesauer
i don't recommend write too many c# stuff
L!εsAμεr
@liesauer
u can write a c# util library and interop with it in php
Jakub Míšek
@jakubmisek
@smx-smx there is a NuGet package that does the post-compile signing I think
@smx-smx the code completion would have to be implemented in our VSCode extension (https://marketplace.visualstudio.com/items?itemName=iolevel.peachpie-vscode), and yes it is possible
@smx-smx basically there is no syntax for typeof in PHP. \System\Type::GetType() is the best you can have. In order to make it in compile-time, we would have to introduce our own typeof() function that would be well-known to the compiler, or we can have an extension to PHP's ReflectionClass
Jakub Míšek
@jakubmisek
but FYI :) you can specify CLR attributes in PHP and you can use typeof as the attribute parameter value https://docs.peachpie.io/net/attributes/
Calvin Baart
@calvinbaart
@jakubmisek Finally have some time to go through the issues, I noticed that I'm now getting a compile error though: https://travis-ci.com/calvinbaart/laravel-peachpie-sample/builds/127831082 any hints? Its not really clear whats going wrong here (except for a null-pointer exception)
Calvin Baart
@calvinbaart
I get the same error when compiling Laravel 6.0.3 locally
Jakub Míšek
@jakubmisek
Thanks, nullref exception will be fixed!
Jakub Míšek
@jakubmisek
@calvinbaart nullref is probably fixed, if it's not it would help to see line numbers in the exceptions :)
Calvin Baart
@calvinbaart
Just triggered a new build: https://travis-ci.com/calvinbaart/laravel-peachpie-sample/builds/127975520 Currently at work so can't really debug, how would I enable line numbers for the exceptions?
(I guess using the debug build for the compiler would do that...)
Jakub Míšek
@jakubmisek
thanks, yes the debug build
Calvin Baart
@calvinbaart
Got past the compile stage now (into a crash at runtime, I'll look into that at home)
Jakub Míšek
@jakubmisek
thanks, I see. It's a new one as well right?