Created
May 16, 2015 04:41
-
-
Save vladima/4f1b6c248ec21ff45fa1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// compile as: fsc -r:Mirror.dll client.fs | |
module Client | |
type T = Top.Repro.C | |
T.Run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// compile as: fsc --target:library ProvidedTypes.fsi ProvidedTypes.fs Mirror.fs | |
namespace Repro | |
open System.IO | |
open System.Reflection | |
open ProviderImplementation.ProvidedTypes | |
open Microsoft.FSharp.Core.CompilerServices | |
[<assembly : TypeProviderAssembly>] | |
do() | |
[<TypeProvider>] | |
type Mirror() as this = | |
inherit TypeProviderForNamespaces() | |
let thisAssembly = typeof<Mirror>.Assembly | |
let topType = ProvidedTypeDefinition(thisAssembly, "Top", "Repro", Some typeof<obj>, IsErased = true) | |
let csAssembly = | |
let location = Path.GetDirectoryName(thisAssembly.Location) | |
System.Reflection.Assembly.LoadFrom(Path.Combine(location, "program.dll")) | |
do topType.AddAssemblyTypesAsNestedTypesDelayed(fun() -> csAssembly) | |
do this.AddNamespace("Top", [topType]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// compile as: csc /t:library program.cs | |
using System; | |
using System.Net.Security; | |
using System.ServiceModel; | |
class C { | |
[FaultContract(typeof(Exception), ProtectionLevel = ProtectionLevel.Sign)] | |
public static void Run() {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment