Skip to content

Instantly share code, notes, and snippets.

@txdv txdv/code.cs
Last active Aug 29, 2015

Embed
What would you like to do?
Cruel code
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using LibuvSharp;
using LibuvSharp.Threading;
using LibuvSharp.Threading.Tasks;
using LibuvSharp.Utilities;
namespace Test
{
public static class Extensions
{
public static void TransferPipe<THandle>(this THandle handle, Action<Exception, THandle> callback)
where THandle : MainClass
{
}
}
public class MainClass
{
public static void Main(string[] args)
{
Loop.Default.Run(async () => {
var tcp = new MainClass();
tcp.TransferPipe(async (handle) => {
Console.WriteLine (Loop.Current.NativeHandle);
Console.WriteLine(Encoding.Default.GetString(await handle.ReadStructAsync()));
});
});
}
}
}
bentkus@gracious:~/Projects/mono/LibuvSharp.Terminal/LibuvSharp/Examples/Test$ dmcs Program.cs -r:../../bin/Debug/LibuvSharp.dll,/opt/mono/master/lib/mono/4.5/Facades/System.Threading.Tasks.dll
Unhandled Exception:
Mono.CSharp.InternalErrorException: Program.cs(27,22): Test.MainClass.Main(string[]) ---> Mono.CSharp.InternalErrorException: Program.cs(29,21): ---> System.NullReferenceException: Object reference not set to an instance of an object
at Mono.CSharp.StatementExpression.MarkReachable (Reachability rc) [0x00000] in <filename unknown>:0
at Mono.CSharp.Block.MarkReachable (Reachability rc) [0x00000] in <filename unknown>:0
at Mono.CSharp.AsyncInitializerStatement.MarkReachable (Reachability rc) [0x00000] in <filename unknown>:0
at Mono.CSharp.Block.MarkReachable (Reachability rc) [0x00000] in <filename unknown>:0
at Mono.CSharp.AnonymousExpression.MarkReachable (Reachability rc) [0x00000] in <filename unknown>:0
at Mono.CSharp.AnonymousExpression.Compatible (Mono.CSharp.ResolveContext ec, Mono.CSharp.AnonymousExpression ae) [0x00000] in <filename unknown>:0
at Mono.CSharp.AnonymousExpression.Compatible (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.AnonymousMethodExpression.Compatible (Mono.CSharp.ResolveContext ec, Mono.CSharp.TypeSpec type) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.CSharp.AnonymousMethodExpression.Compatible (Mono.CSharp.ResolveContext ec, Mono.CSharp.TypeSpec type) [0x00000] in <filename unknown>:0
at Mono.CSharp.AnonymousMethodExpression.ImplicitStandardConversionExists (Mono.CSharp.ResolveContext ec, Mono.CSharp.TypeSpec delegate_type) [0x00000] in <filename unknown>:0
at Mono.CSharp.Convert.ImplicitConversionExists (Mono.CSharp.ResolveContext ec, Mono.CSharp.Expression expr, Mono.CSharp.TypeSpec target_type) [0x00000] in <filename unknown>:0
at Mono.CSharp.OverloadResolver.IsArgumentCompatible (Mono.CSharp.ResolveContext ec, Mono.CSharp.Argument argument, Modifier param_mod, Mono.CSharp.TypeSpec parameter) [0x00000] in <filename unknown>:0
at Mono.CSharp.OverloadResolver.IsApplicable (Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments& arguments, Int32 arg_count, Mono.CSharp.MemberSpec& candidate, IParametersMember pm, System.Boolean& params_expanded_form, System.Boolean& dynamicArgument, Mono.CSharp.TypeSpec& returnType, Boolean errorMode) [0x00000] in <filename unknown>:0
at Mono.CSharp.OverloadResolver.ResolveMember[MethodSpec] (Mono.CSharp.ResolveContext rc, Mono.CSharp.Arguments& args) [0x00000] in <filename unknown>:0
at Mono.CSharp.MethodGroupExpr.OverloadResolve (Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments& args, IErrorHandler cerrors, Restrictions restr) [0x00000] in <filename unknown>:0
at Mono.CSharp.Invocation.DoResolveOverload (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Invocation.DoResolveInvocation (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.ResolveContext rc) [0x00000] in <filename unknown>:0
at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.CSharp.Method.Emit () [0x00000] in <filename unknown>:0
at Mono.CSharp.TypeDefinition.Emit () [0x00000] in <filename unknown>:0
at Mono.CSharp.ClassOrStruct.Emit () [0x00000] in <filename unknown>:0
at Mono.CSharp.Class.Emit () [0x00000] in <filename unknown>:0
at Mono.CSharp.TypeDefinition.EmitContainer () [0x00000] in <filename unknown>:0
at Mono.CSharp.TypeContainer.EmitContainer () [0x00000] in <filename unknown>:0
at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00000] in <filename unknown>:0
at Mono.CSharp.TypeContainer.EmitContainer () [0x00000] in <filename unknown>:0
at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00000] in <filename unknown>:0
at Mono.CSharp.TypeContainer.EmitContainer () [0x00000] in <filename unknown>:0
at Mono.CSharp.ModuleContainer.EmitContainer () [0x00000] in <filename unknown>:0
at Mono.CSharp.AssemblyDefinition.Emit () [0x00000] in <filename unknown>:0
at Mono.CSharp.AssemblyDefinitionStatic.Emit () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: Mono.CSharp.InternalErrorException: Program.cs(27,22): Test.MainClass.Main(string[]) ---> Mono.CSharp.InternalErrorException: Program.cs(29,21): ---> System.NullReferenceException: Object reference not set to an instance of an object
at Mono.CSharp.StatementExpression.MarkReachable (Reachability rc) [0x00000] in <filename unknown>:0
at Mono.CSharp.Block.MarkReachable (Reachability rc) [0x00000] in <filename unknown>:0
at Mono.CSharp.AsyncInitializerStatement.MarkReachable (Reachability rc) [0x00000] in <filename unknown>:0
at Mono.CSharp.Block.MarkReachable (Reachability rc) [0x00000] in <filename unknown>:0
at Mono.CSharp.AnonymousExpression.MarkReachable (Reachability rc) [0x00000] in <filename unknown>:0
at Mono.CSharp.AnonymousExpression.Compatible (Mono.CSharp.ResolveContext ec, Mono.CSharp.AnonymousExpression ae) [0x00000] in <filename unknown>:0
at Mono.CSharp.AnonymousExpression.Compatible (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.AnonymousMethodExpression.Compatible (Mono.CSharp.ResolveContext ec, Mono.CSharp.TypeSpec type) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.CSharp.AnonymousMethodExpression.Compatible (Mono.CSharp.ResolveContext ec, Mono.CSharp.TypeSpec type) [0x00000] in <filename unknown>:0
at Mono.CSharp.AnonymousMethodExpression.ImplicitStandardConversionExists (Mono.CSharp.ResolveContext ec, Mono.CSharp.TypeSpec delegate_type) [0x00000] in <filename unknown>:0
at Mono.CSharp.Convert.ImplicitConversionExists (Mono.CSharp.ResolveContext ec, Mono.CSharp.Expression expr, Mono.CSharp.TypeSpec target_type) [0x00000] in <filename unknown>:0
at Mono.CSharp.OverloadResolver.IsArgumentCompatible (Mono.CSharp.ResolveContext ec, Mono.CSharp.Argument argument, Modifier param_mod, Mono.CSharp.TypeSpec parameter) [0x00000] in <filename unknown>:0
at Mono.CSharp.OverloadResolver.IsApplicable (Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments& arguments, Int32 arg_count, Mono.CSharp.MemberSpec& candidate, IParametersMember pm, System.Boolean& params_expanded_form, System.Boolean& dynamicArgument, Mono.CSharp.TypeSpec& returnType, Boolean errorMode) [0x00000] in <filename unknown>:0
at Mono.CSharp.OverloadResolver.ResolveMember[MethodSpec] (Mono.CSharp.ResolveContext rc, Mono.CSharp.Arguments& args) [0x00000] in <filename unknown>:0
at Mono.CSharp.MethodGroupExpr.OverloadResolve (Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments& args, IErrorHandler cerrors, Restrictions restr) [0x00000] in <filename unknown>:0
at Mono.CSharp.Invocation.DoResolveOverload (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Invocation.DoResolveInvocation (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.ResolveContext rc) [0x00000] in <filename unknown>:0
at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at Mono.CSharp.Method.Emit () [0x00000] in <filename unknown>:0
at Mono.CSharp.TypeDefinition.Emit () [0x00000] in <filename unknown>:0
at Mono.CSharp.ClassOrStruct.Emit () [0x00000] in <filename unknown>:0
at Mono.CSharp.Class.Emit () [0x00000] in <filename unknown>:0
at Mono.CSharp.TypeDefinition.EmitContainer () [0x00000] in <filename unknown>:0
at Mono.CSharp.TypeContainer.EmitContainer () [0x00000] in <filename unknown>:0
at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00000] in <filename unknown>:0
at Mono.CSharp.TypeContainer.EmitContainer () [0x00000] in <filename unknown>:0
at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00000] in <filename unknown>:0
at Mono.CSharp.TypeContainer.EmitContainer () [0x00000] in <filename unknown>:0
at Mono.CSharp.ModuleContainer.EmitContainer () [0x00000] in <filename unknown>:0
at Mono.CSharp.AssemblyDefinition.Emit () [0x00000] in <filename unknown>:0
at Mono.CSharp.AssemblyDefinitionStatic.Emit () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
@akoeplinger

This comment has been minimized.

Copy link

commented Feb 13, 2015

using System;
using System.Threading.Tasks;

namespace Test
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            Task.Run(async () => {
                TransferPipe(async (handle) => {
                });
            });
        }

        public static void TransferPipe(Action<Exception, object> callback)
        {
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.