Browse Source

Rx 2.1 update to build WinRT pieces for Windows Phone 8.
Also, adding the auto-homoiconizer tool for updating IQbservable.

Brian Grunkemeyer 12 years ago
parent
commit
22b0817625

+ 1 - 1
Rx/NET/Source/Common.targets

@@ -145,7 +145,7 @@
   </PropertyGroup>
 
   <PropertyGroup Condition=" '$(BuildTarget)' == 'WP8' ">
-    <DefineConstants>$(DefineConstants);NO_EVENTARGS_CONSTRAINT;USE_SL_DISPATCHER;NO_SERIALIZABLE;NO_REMOTING;NO_CDS_COLLECTIONS;USE_TIMER_SELF_ROOT</DefineConstants>
+    <DefineConstants>$(DefineConstants);HAS_EDI;HAS_PROGRESS;PREFER_ASYNC;HAS_AWAIT;NO_EVENTARGS_CONSTRAINT;USE_SL_DISPATCHER;HAS_WINRT;NO_SERIALIZABLE;NO_REMOTING;NO_CDS_COLLECTIONS;USE_TIMER_SELF_ROOT</DefineConstants>
     <TargetFrameworkIdentifier>WindowsPhone</TargetFrameworkIdentifier>
     <TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
     <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>

+ 4 - 2
Rx/NET/Source/Rx.sln

@@ -45,10 +45,10 @@ Global
 	GlobalSection(TeamFoundationVersionControl) = preSolution
 		SccNumberOfProjects = 1
 		SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
-		SccTeamFoundationServer = http://tfs1:8085/tfs/interop%20team%20projects
+		SccTeamFoundationServer = http://tfs1:8080/tfs/interop%20team%20projects
 		SccProjectUniqueName0 = Playground\\Playground.csproj
 		SccProjectName0 = Playground
-		SccAuxPath0 = http://tfs1:8085/tfs/interop%20team%20projects
+		SccAuxPath0 = http://tfs1:8080/tfs/interop%20team%20projects
 		SccLocalPath0 = Playground
 		SccProvider0 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
 	EndGlobalSection
@@ -1056,6 +1056,7 @@ Global
 		{EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugWP7|Mixed Platforms.ActiveCfg = DebugWP7|Any CPU
 		{EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugWP7|x86.ActiveCfg = DebugWP7|Any CPU
 		{EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugWP8|Any CPU.ActiveCfg = DebugWP8|Any CPU
+		{EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugWP8|Any CPU.Build.0 = DebugWP8|Any CPU
 		{EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugWP8|Mixed Platforms.ActiveCfg = DebugWP8|Any CPU
 		{EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugWP8|x86.ActiveCfg = DebugWP8|Any CPU
 		{EE655A70-A899-4B38-84D3-FB9F63A8C661}.DebugXBLV|Any CPU.ActiveCfg = DebugXBLV|Any CPU
@@ -1104,6 +1105,7 @@ Global
 		{EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseWP7|Mixed Platforms.ActiveCfg = ReleaseWP7|Any CPU
 		{EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseWP7|x86.ActiveCfg = ReleaseWP7|Any CPU
 		{EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseWP8|Any CPU.ActiveCfg = ReleaseWP8|Any CPU
+		{EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseWP8|Any CPU.Build.0 = ReleaseWP8|Any CPU
 		{EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseWP8|Mixed Platforms.ActiveCfg = ReleaseWP8|Any CPU
 		{EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseWP8|x86.ActiveCfg = ReleaseWP8|Any CPU
 		{EE655A70-A899-4B38-84D3-FB9F63A8C661}.ReleaseXBLV|Any CPU.ActiveCfg = ReleaseXBLV|Any CPU

+ 51 - 1
Rx/NET/Source/System.Reactive.WindowsRuntime/System.Reactive.WindowsRuntime.csproj

@@ -10,16 +10,66 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>System.Reactive</RootNamespace>
     <AssemblyName>System.Reactive.WindowsRuntime</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <ProductSignAssembly>true</ProductSignAssembly>
     <CodeAnalysisRuleSet>..\Rx.ruleset</CodeAnalysisRuleSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseXBLV|AnyCPU'">
     <OutputPath>bin\ReleaseXBLV\</OutputPath>
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugXBLV|AnyCPU'">
     <OutputPath>bin\DebugXBLV\</OutputPath>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug45|AnyCPU'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release45|AnyCPU'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug40|AnyCPU'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release40|AnyCPU'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugSL5|AnyCPU'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseSL5|AnyCPU'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugWP7|AnyCPU'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWP7|AnyCPU'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug35|AnyCPU'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release35|AnyCPU'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugSL3|AnyCPU'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseSL3|AnyCPU'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugSL4|AnyCPU'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseSL4|AnyCPU'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugXNA4|AnyCPU'">
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseXNA4|AnyCPU'">
+    <Prefer32Bit>false</Prefer32Bit>
   </PropertyGroup>
   <Import Project="..\Common.targets" />
   <PropertyGroup>

+ 59 - 0
Rx/NET/tools/HomoIcon/HomoIcon.csproj

@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{A29F7683-9994-43DC-8813-E4B1D9931682}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HomoIcon</RootNamespace>
+    <AssemblyName>HomoIcon</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+    <FileAlignment>512</FileAlignment>
+    <SccProjectName>SAK</SccProjectName>
+    <SccLocalPath>SAK</SccLocalPath>
+    <SccAuxPath>SAK</SccAuxPath>
+    <SccProvider>SAK</SccProvider>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <UseVSHostingProcess>false</UseVSHostingProcess>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Xml.Linq" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 10 - 0
Rx/NET/tools/HomoIcon/HomoIcon.csproj.vspscc

@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = ""
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}

+ 28 - 0
Rx/NET/tools/HomoIcon/HomoIcon.sln

@@ -0,0 +1,28 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HomoIcon", "HomoIcon.csproj", "{A29F7683-9994-43DC-8813-E4B1D9931682}"
+EndProject
+Global
+	GlobalSection(TeamFoundationVersionControl) = preSolution
+		SccNumberOfProjects = 2
+		SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
+		SccTeamFoundationServer = http://vstfpg04:8080/tfs/pg04
+		SccLocalPath0 = .
+		SccProjectUniqueName1 = HomoIcon.csproj
+		SccLocalPath1 = .
+	EndGlobalSection
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x86 = Debug|x86
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{A29F7683-9994-43DC-8813-E4B1D9931682}.Debug|x86.ActiveCfg = Debug|x86
+		{A29F7683-9994-43DC-8813-E4B1D9931682}.Debug|x86.Build.0 = Debug|x86
+		{A29F7683-9994-43DC-8813-E4B1D9931682}.Release|x86.ActiveCfg = Release|x86
+		{A29F7683-9994-43DC-8813-E4B1D9931682}.Release|x86.Build.0 = Release|x86
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

BIN
Rx/NET/tools/HomoIcon/HomoIcon.suo


+ 10 - 0
Rx/NET/tools/HomoIcon/HomoIcon.vssscc

@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = ""
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
+}

+ 929 - 0
Rx/NET/tools/HomoIcon/Program.cs

@@ -0,0 +1,929 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Reflection;
+using System.Threading.Tasks;
+using System.Xml.Linq;
+
+namespace HomoIconize
+{
+    static class Program
+    {
+        static void Main(string[] args)
+        {
+            Console.WriteLine("Auto-homoiconizer for Qbservable[Ex]");
+            Console.WriteLine("------------------------------------");
+            Console.WriteLine();
+
+            var uri = new Uri(Assembly.GetEntryAssembly().CodeBase);
+
+            var root = Path.Combine(Path.GetDirectoryName(uri.LocalPath), @"..\..\..\..\Source");
+            if (!Directory.Exists(root))
+            {
+                Console.WriteLine("Error:  Could not find directory \"" + root + "\"");
+                return;
+            }
+
+            Process(root, "System.Reactive.Linq", "System.Reactive.Providers", @"Reactive\Linq\Qbservable.Generated.cs", "System.Reactive.Linq.Observable", "Qbservable", true);
+            Console.WriteLine();
+
+            Process(root, "System.Reactive.Experimental", "System.Reactive.Experimental", @"Reactive\Linq\QbservableEx.Generated.cs", "System.Reactive.Linq.ObservableEx", "QbservableEx");            
+            Console.WriteLine();
+        }
+
+        static void Process(string root, string sourceAssembly, string targetAssembly, string targetFile, string sourceTypeName, string targetTypeName, bool includeAsync = false)
+        {
+
+            var rxRoot = Path.Combine(root, sourceAssembly);
+            if (!Directory.Exists(rxRoot))
+            {
+                Console.WriteLine("Error:  Could not find directory \"" + rxRoot + "\"");
+                return;
+            }
+
+            var qbRoot = Path.Combine(root, targetAssembly);
+            if (!Directory.Exists(qbRoot))
+            {
+                Console.WriteLine("Error:  Could not find directory \"" + qbRoot + "\"");
+                return;
+            }
+
+            var dll = Path.Combine(rxRoot, @"bin\debug40\" + sourceAssembly + ".dll");
+            if (!File.Exists(dll))
+            {
+                Console.WriteLine("Error:  Could not find file \"" + dll + "\"");
+                return;
+            }
+
+            var xml = Path.Combine(rxRoot, @"bin\debug40\" + sourceAssembly + ".xml");
+            if (!File.Exists(xml))
+            {
+                Console.WriteLine("Error:  Could not find file \"" + xml + "\"");
+                return;
+            }
+
+            var qbsgen = Path.Combine(qbRoot, targetFile);
+            if (!File.Exists(qbsgen))
+            {
+                Console.WriteLine("Error:  Could not find file \"" + qbsgen + "\"");
+                return;
+            }
+
+            Generate(dll, xml, qbsgen, sourceTypeName, targetTypeName, includeAsync);
+        }
+
+        // Prototype interface to break dependencies. Only used for ToString2 ultimately.
+        interface IQbservable<T>
+        {
+        }
+
+        static void Generate(string input, string xml, string output, string sourceTypeName, string targetTypeName, bool includeAsync)
+        {
+            var docs = XDocument.Load(xml).Root.Element("members").Elements("member").ToDictionary(m => m.Attribute("name").Value, m => m);
+
+            Console.WriteLine("Loading {0}...", input);
+
+            var asm = Assembly.LoadFrom(input);
+            var t = asm.GetType(sourceTypeName);
+            _qbs = typeof(IQbservable<>); //asm.GetType("System.Reactive.Linq.IQbservable`1");
+
+            Console.WriteLine("Checking {0}...", output);
+            var attr = File.GetAttributes(output);
+            if ((attr & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
+            {
+                Console.Write("Attempting to check out generated files... ");
+
+                try
+                {
+                    System.Diagnostics.Process.Start("tf.exe", "edit \"" + output + "\"").WaitForExit();
+                }
+                catch { /* no comment */ }
+
+                attr = File.GetAttributes(output);
+
+                if ((attr & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
+                {
+                    Console.WriteLine("Failed.");
+
+                    Console.ForegroundColor = ConsoleColor.Yellow;
+                    Console.WriteLine("Making file writable. DON'T FORGET TO INCLUDE IN CHECK-IN!");
+                    Console.ResetColor();
+
+                    File.SetAttributes(output, attr & ~FileAttributes.ReadOnly);
+                }
+                else
+                {
+                    Console.WriteLine("Succeeded.");
+                }
+            }
+
+            Console.WriteLine("Deleting {0}...", output);
+            File.Delete(output);
+
+            Console.WriteLine("Creating {0}...", output);
+            using (var fs = File.OpenWrite(output))
+            {
+                using (Out = new StreamWriter(fs))
+                {
+                    Generate(t, docs, targetTypeName, includeAsync);
+                }
+            }
+        }
+
+        static Type _qbs;
+
+        static void Generate(Type t, IDictionary<string, XElement> docs, string typeName, bool includeAsync)
+        {
+            WriteLine(
+@"/*
+ * WARNING: Auto-generated file (" + DateTime.Now + @")
+ * Run Rx's auto-homoiconizer tool to generate this file (in the HomoIcon directory).
+ */
+");
+            WriteLine(
+@"#pragma warning disable 1591
+");
+            WriteLine(
+@"#if !NO_EXPRESSIONS
+");
+
+            WriteLine(
+@"using System;
+using System.Reactive.Concurrency;
+using System.Collections.Generic;
+using System.Reactive.Joins;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Reflection;
+using System.Threading;
+using System.Reactive;
+using System.Reactive.Subjects;
+#if !NO_TPL
+using System.Threading.Tasks;
+#endif
+#if !NO_REMOTING
+using System.Runtime.Remoting.Lifetime;
+#endif
+");
+            WriteLine(
+@"namespace System.Reactive.Linq
+{");
+
+            Indent();
+
+            WriteLine(
+@"public static partial class " + typeName + @"
+{");
+
+            Indent();
+
+            var except = new[] { "ToAsync", "FromAsyncPattern", "And", "Then", "GetEnumerator", "get_Provider", "Wait", "ForEach", "ForEachAsync", "GetAwaiter", "First", "FirstOrDefault", "Last", "LastOrDefault", "Single", "SingleOrDefault", "Subscribe", "AsQbservable", "AsObservable", "ToEvent", "ToEventPattern" };
+
+            foreach (var m in t.GetMethods(BindingFlags.Public | BindingFlags.Static).OrderBy(m => m.Name).ThenBy(m => !m.IsGenericMethod ? "" : string.Join(",", m.GetGenericArguments().Select(p => p.Name))).ThenBy(m => string.Join(",", m.GetParameters().Select(p => p.Name + ":" + p.ParameterType.FullName))).Where(m => !except.Contains(m.Name)))
+            {
+                var docName = ToDocName(m);
+                var xmlDoc = default(XElement);
+                if (!docs.TryGetValue(docName, out xmlDoc))
+                {
+                    Console.ForegroundColor = ConsoleColor.Yellow;
+                    Console.WriteLine("Missing XML documentation for {0}", docName);
+                    Console.ResetColor();
+                }
+
+                var p = m.GetParameters();
+                if (m.Name == "When" && p.Length == 1 && p.Single().ParameterType.ToString().Contains("Plan"))
+                    continue;
+
+                var funky = from pi in p
+                            let pt = pi.ParameterType
+                            where pt.IsGenericType
+                            let ptgtd = pt.GetGenericTypeDefinition()
+                            where ptgtd.Name.StartsWith("Func")
+                            where ptgtd.GetGenericArguments().Count() > 5
+                            select pi;
+
+                var isLargeArity = funky.Any();
+
+                var hasTask = p.Any(pa => ContainsTask(pa.ParameterType));
+
+                var ret = m.ReturnType;
+                if (ret.IsGenericType)
+                {
+                    var d = ret.GetGenericTypeDefinition();
+                    if (d.Name.StartsWith("IConnectableObservable") || d.Name.StartsWith("ListObservable"))
+                        continue;
+                    if (d != typeof(IObservable<>) && d != typeof(IEnumerable<>))
+                        throw new InvalidOperationException("Invalid return type for " + m.Name);
+                }
+                else
+                    throw new InvalidOperationException("Invalid return type for " + m.Name);
+
+                ret = ret.Iconize();
+
+                var hasProvider = true;
+                if (p.Length > 0)
+                {
+                    var f = p.First();
+                    if (f.ParameterType.IsGenericType)
+                    {
+                        var d = f.ParameterType.GetGenericTypeDefinition();
+                        if (d == typeof(IObservable<>)) // Check - e.g. Amb    || d == typeof(IEnumerable<>))
+                            hasProvider = false;
+                    }
+                }
+
+                var nulls = new List<string>();
+                var pars = new List<string>();
+                var ptps = new List<string>();
+                var args = new List<string>();
+
+                var firstArg = hasProvider ? "IQbservableProvider" : p.First().ParameterType.Iconize().ToString2();
+                var firstName = hasProvider ? "provider" : p.First().Name;
+                pars.Add("this " + firstArg + " " + firstName);
+                ptps.Add(firstArg);
+                if (!hasProvider)
+                    args.Add(firstName + ".Expression");
+                else
+                    args.Add("Expression.Constant(provider, typeof(IQbservableProvider))");
+                nulls.Add(firstName);
+
+                var rem = hasProvider ? p : p.Skip(1);
+                var isCreateAsync = false;
+                foreach (var q in rem)
+                {
+                    var pt = q.ParameterType;
+                    if (pt.Name.StartsWith("Func") || pt.Name.StartsWith("Action"))
+                    {
+                        if (pt.Name.StartsWith("Func") && pt.GetGenericArguments().Last().Name.StartsWith("Task"))
+                        {
+                            isCreateAsync = true;
+                        }
+                        pt = typeof(Expression<>).MakeGenericType(pt);
+                        args.Add(q.Name);
+                    }
+                    else
+                    {
+                        var isObs = new Func<Type, bool>(tt => tt.IsGenericType && tt.GetGenericTypeDefinition() == typeof(IObservable<>));
+                        var isEnm = new Func<Type, bool>(tt => tt.IsGenericType && tt.GetGenericTypeDefinition() == typeof(IEnumerable<>));
+                        if (isObs(pt) || pt.IsArray && isObs(pt.GetElementType()) || isEnm(pt) || pt.IsArray && isEnm(pt.GetElementType()))
+                            args.Add("GetSourceExpression(" + q.Name + ")");
+                        else
+                            args.Add("Expression.Constant(" + q.Name + ", typeof(" + pt.ToString2() + "))");
+                    }
+
+                    var pts = pt.ToString2();
+                    var par = pts + " " + q.Name;
+                    if (q.IsDefined(typeof(ParamArrayAttribute), false))
+                        par = "params " + par;
+                    pars.Add(par);
+                    ptps.Add(pts);
+
+                    if (!q.ParameterType.IsValueType && !q.ParameterType.IsGenericParameter)
+                        nulls.Add(q.Name);
+                }
+
+                var factory = hasProvider ? "provider" : p.First().Name + ".Provider";
+                var requiresQueryProvider = ret.GetGenericTypeDefinition() == typeof(IQueryable<>);
+                if (requiresQueryProvider)
+                    factory = "((IQueryProvider)" + factory + ")";
+                
+                var genArgs = m.GetGenericArguments().Select(a => a.ToString2()).ToList();
+                var g = genArgs.Count > 0 ? "<" + string.Join(", ", genArgs) + ">" : "";
+                var name = m.Name;
+                if (name == "ToEnumerable")
+                    name = "ToQueryable";
+
+                var isExp = m.GetCustomAttributes(true).Where(a => a.GetType().Name.Equals("ExperimentalAttribute")).Any();
+                if (isExp)
+                    WriteLine("#if !STABLE", true);
+
+                var obsolete = m.GetCustomAttributes(typeof(ObsoleteAttribute), false).Cast<ObsoleteAttribute>().SingleOrDefault();
+
+                var poundIf = false;
+                if (name == "ObserveOn" || name == "SubscribeOn")
+                {
+                    if (p.Last().ParameterType.Name == "DispatcherScheduler")
+                    {
+                        WriteLine("#if !MONO", true);
+                        poundIf = true;
+                    }
+                    if (p.Last().ParameterType.Name == "ControlScheduler")
+                    {
+                        WriteLine("#if DESKTOPCLR", true);
+                        poundIf = true;
+                    }
+                }
+                if (name == "ObserveOnDispatcher" || name == "SubscribeOnDispatcher")
+                {
+                    WriteLine("#if !MONO", true);
+                    poundIf = true;
+                }
+                if (isCreateAsync || hasTask)
+                {
+                    WriteLine("#if !NO_TPL", true);
+                    poundIf = true;
+                }
+                //if (name == "Remotable")
+                //{
+                //    WriteLine("#if DESKTOPCLR", true);
+                //    poundIf = true;
+                //    if (nulls.Contains("lease"))
+                //        nulls.Remove("lease");
+                //}
+                if (isLargeArity)
+                {
+                    WriteLine("#if !NO_LARGEARITY", true);
+                }
+
+                var isFep = m.Name == "FromEventPattern";
+                var isGenFep = isFep && m.GetGenericArguments().Any(a => a.Name == "TEventArgs");
+                var isNonGenFep = isFep && !isGenFep;
+
+                for (var r = 0; r < (isNonGenFep ? 2 : 1); r++)
+                {
+                    var retStr = ret.ToString2();
+
+                    if (isNonGenFep)
+                    {
+                        if (r == 0)
+                        {
+                            WriteLine("#if !NO_EVENTARGS_CONSTRAINT", true);
+                        }
+                        else if (r == 1)
+                        {
+                            WriteLine("#else", true);
+                            retStr = retStr.Replace("EventPattern<EventArgs>", "EventPattern<object>");
+                        }
+                    }
+
+                    if (xmlDoc != null)
+                    {
+                        foreach (var docLine in xmlDoc.Element("summary").ToString().Split('\n'))
+                            WriteLine("/// " + docLine.TrimStart().TrimEnd('\r'));
+
+                        if (hasProvider)
+                            WriteLine("/// <param name=\"provider\">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>");
+
+                        foreach (var docLine in xmlDoc.Elements().Where(e => e.Name != "summary").SelectMany(e => e.ToString().Split('\n')))
+                            WriteLine("/// " + docLine.TrimStart().TrimEnd('\r'));
+
+                        if (requiresQueryProvider)
+                            WriteLine("/// <remarks>This operator requires the source's <see cref=\"IQbservableProvider\"/> object (see <see cref=\"IQbservable.Provider\"/>) to implement <see cref=\"IQueryProvider\"/>.</remarks>");
+                    }
+
+                    if (isExp)
+                        WriteLine("[Experimental]");
+
+                    if (obsolete != null)
+                        WriteLine("[Obsolete(\"" + obsolete.Message + "\")]");
+
+                    WriteLine("public static " + retStr + " " + name + g + "(" + string.Join(", ", pars) + ")");
+                    if (isGenFep)
+                    {
+                        WriteLine("#if !NO_EVENTARGS_CONSTRAINT", true);
+                        Indent();
+                        WriteLine("where TEventArgs : EventArgs");
+                        Outdent();
+                        WriteLine("#endif", true);
+                    }
+                    else
+                    {
+                        var genCons = (from a in m.GetGenericArguments()
+                                       from c in a.GetGenericParameterConstraints()
+                                       select new { a, c })
+                                      .ToList();
+
+                        if (genCons.Count > 0)
+                        {
+                            Indent();
+                            foreach (var gc in genCons)
+                                WriteLine("where " + gc.a.Name + " : " + gc.c.Name);
+                            Outdent();
+                        }
+                    }
+
+
+                    WriteLine("{");
+                    Indent();
+                    foreach (var n in nulls)
+                    {
+                        WriteLine("if (" + n + " == null)");
+                        Indent();
+                        WriteLine("throw new ArgumentNullException(\"" + n + "\");");
+                        Outdent();
+                    }
+                    WriteLine("");
+
+                    var gArg = ret.GetGenericArguments().Single().ToString2();
+                    if (isNonGenFep && r == 1)
+                    {
+                        gArg = gArg.Replace("EventPattern<EventArgs>", "EventPattern<object>");
+                    }
+
+                    WriteLine("return " + factory + ".CreateQuery<" + gArg + ">(");
+                    Indent();
+                    WriteLine("Expression.Call(");
+                    Indent();
+                    WriteLine("null,");
+                    var cma = args.Count > 0 ? "," : "";
+                    WriteLine("#if CRIPPLED_REFLECTION", true);
+                    WriteLine("InfoOf(() => " + typeName + "." + name + g + "(" + string.Join(", ", ptps.Select(pt => "default(" + pt + ")")) + "))" + cma);
+                    WriteLine("#else", true);
+                    if (!m.IsGenericMethod)
+                        WriteLine("(MethodInfo)MethodInfo.GetCurrentMethod()" + cma);
+                    else
+                        WriteLine("((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(" + string.Join(", ", m.GetGenericArguments().Select(ga => "typeof(" + ga.Name + ")").ToArray()) + ")" + cma);
+                    WriteLine("#endif", true);
+                    for (int j = 0; j < args.Count; j++)
+                        WriteLine(args[j] + (j < args.Count - 1 ? "," : ""));
+                    Outdent();
+                    WriteLine(")");
+                    Outdent();
+                    WriteLine(");");
+                    Outdent();
+                    WriteLine("}");
+
+                    if (isNonGenFep && r == 1)
+                        WriteLine("#endif", true);
+                }
+
+                if (poundIf)
+                    WriteLine("#endif", true);
+                if (isExp)
+                    WriteLine("#endif", true);
+                if (isLargeArity)
+                    WriteLine("#endif", true);
+                WriteLine("");
+            }
+
+            if (includeAsync)
+            {
+                GenerateAsync(docs, typeName);
+            }
+
+            Outdent();
+
+            WriteLine(
+@"}");
+
+            Outdent();
+
+            WriteLine(
+@"}
+");
+            WriteLine(
+@"#endif
+");
+            WriteLine(
+@"#pragma warning restore 1591
+");
+
+        }
+
+        static bool ContainsTask(Type t)
+        {
+            if (t == typeof(Task))
+                return true;
+
+            if (t.IsGenericType)
+            {
+                if (t.GetGenericTypeDefinition() == typeof(Task<>))
+                    return true;
+
+                return t.GetGenericArguments().Any(ContainsTask);
+            }
+
+            if (t.IsArray)
+                return ContainsTask(t.GetElementType());
+
+            return false;
+        }
+
+        static void GenerateAsync(IDictionary<string, XElement> docs, string typeName)
+        {
+            foreach (var ret in new[] { "Unit", "TResult" })
+            {
+                for (int i = 0; i <= 16; i++)
+                {
+                    if (i == 5)
+                        WriteLine("#if !NO_LARGEARITY", true);
+
+                    foreach (var withScheduler in new[] { false, true })
+                    {
+                        var genArgs = default(string[]);
+                        var lamPars = default(string[]);
+                        if (i == 0)
+                        {
+                            genArgs = new string[0];
+                            lamPars = new string[0];
+                        }
+                        //else if (i == 1)
+                        //{
+                        //    genArgs = new[] { "TSource" };
+                        //    lamPars = new[] { "t" };
+                        //}
+                        else
+                        {
+                            genArgs = Enumerable.Range(1, i).Select(j => "TArg" + j).ToArray();
+                            lamPars = Enumerable.Range(1, i).Select(j => "t" + j).ToArray();
+                        }
+
+                        var fParam = ret == "Unit" ? "action" : "function";
+                        var gConst = ret == "Unit" ? "Action" : "Func";
+
+                        var retType = "Func<" + string.Join(", ", genArgs.Concat(new[] { "IQbservable<" + ret + ">" }).ToArray()) + ">";
+
+                        if (ret != "Unit")
+                            genArgs = genArgs.Concat(new[] { "TResult" }).ToArray();
+
+                        var docName = "M:System.Reactive.Linq.Observable.ToAsync";
+                        if (genArgs.Length > 0)
+                            docName += "``" + genArgs.Length;
+
+                        var docArg = ret == "Unit" ? "System.Action" : "System.Func";
+                        if (genArgs.Length > 0)
+                            docArg += "{" + string.Join(",", Enumerable.Range(0, genArgs.Length).Select(j => "``" + j)) + "}";
+
+                        docName += "(" + docArg + (withScheduler ? ",System.Reactive.Concurrency.IScheduler" : "") + ")";
+
+                        var xmlDoc = default(XElement);
+                        if (!docs.TryGetValue(docName, out xmlDoc))
+                        {
+                            Console.ForegroundColor = ConsoleColor.Yellow;
+                            Console.WriteLine("Missing XML documentation for {0}", docName);
+                            Console.ResetColor();
+                        }
+
+                        var actType = "Expression<" + gConst + (genArgs.Length > 0 ? "<" + string.Join(", ", genArgs) + ">" : "") + ">";
+
+                        var genArgss = genArgs.Length > 0 ? "<" + string.Join(", ", genArgs) + ">" : "";
+
+                        if (xmlDoc != null)
+                        {
+                            foreach (var docLine in xmlDoc.Element("summary").ToString().Split('\n'))
+                                WriteLine("/// " + docLine.TrimStart().TrimEnd('\r'));
+
+                            WriteLine("/// <param name=\"provider\">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>");
+
+                            foreach (var docLine in xmlDoc.Elements().Where(e => e.Name != "summary").SelectMany(e => e.ToString().Split('\n')))
+                                WriteLine("/// " + docLine.TrimStart().TrimEnd('\r'));
+                        }
+
+                        WriteLine("public static " + retType + " ToAsync" + genArgss + "(this IQbservableProvider provider, " + actType + " " + fParam + (withScheduler ? ", IScheduler scheduler" : "") + ")");
+                        WriteLine("{");
+
+                        Indent();
+
+                        WriteLine("if (provider == null)");
+                        Indent();
+                        WriteLine("throw new ArgumentNullException(\"provider\");");
+                        Outdent();
+
+                        WriteLine("if (" + fParam + " == null)");
+                        Indent();
+                        WriteLine("throw new ArgumentNullException(\"" + fParam + "\");");
+                        Outdent();
+
+                        if (withScheduler)
+                        {
+                            WriteLine("if (scheduler == null)");
+                            Indent();
+                            WriteLine("throw new ArgumentNullException(\"scheduler\");");
+                            Outdent();
+                        }
+
+                        WriteLine("");
+                        WriteLine("#if CRIPPLED_REFLECTION", true);
+                        var aprs = new List<string> { "IQbservableProvider", actType };
+                        if (withScheduler)
+                            aprs.Add("IScheduler");
+                        WriteLine("var m = InfoOf(() => " + typeName + ".ToAsync" + genArgss + "(" + string.Join(", ", aprs.Select(pt => "default(" + pt + ")")) + "));");
+                        WriteLine("#else", true);
+                        if (genArgs.Length == 0)
+                            WriteLine("var m = (MethodInfo)MethodInfo.GetCurrentMethod();");
+                        else
+                            WriteLine("var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(" + string.Join(", ", genArgs.Select(a => "typeof(" + a + ")").ToArray()) + ");");
+                        WriteLine("#endif", true);
+
+                        WriteLine("return (" + string.Join(", ", lamPars) + ") => provider.CreateQuery<" + ret + ">(");
+                        Indent();
+                        WriteLine("Expression.Invoke(");
+                        Indent();
+                        WriteLine("Expression.Call(");
+                        Indent();
+                        WriteLine("null,");
+                        WriteLine("m,");
+                        WriteLine("Expression.Constant(provider, typeof(IQbservableProvider)),");
+                        WriteLine(fParam + (withScheduler ? "," : ""));
+                        if (withScheduler)
+                            WriteLine("Expression.Constant(scheduler, typeof(IScheduler))");
+                        Outdent();
+                        WriteLine(")" + (lamPars.Length > 0 ? "," : ""));
+                        var k = 0;
+                        foreach (var e in genArgs.Zip(lamPars, (g, l) => new { g, l }))
+                        {
+                            WriteLine("Expression.Constant(" + e.l + ", typeof(" + e.g + "))" + (k < i - 1 ? "," : ""));
+                            k++;
+                        }
+                        Outdent();
+                        WriteLine(")");
+                        Outdent();
+                        WriteLine(");");
+
+                        Outdent();
+
+                        WriteLine("}");
+                        WriteLine("");
+                    }
+
+                    if (i == 16)
+                        WriteLine("#endif", true);
+                }
+            }
+
+            WriteLine("");
+
+            foreach (var ret in new[] { "Unit", "TResult" })
+            {
+                for (int i = 0; i < 15; i++)
+                {
+                    if (i == 3)
+                        WriteLine("#if !NO_LARGEARITY", true);
+
+                    var genArgs = default(string[]);
+                    var lamPars = default(string[]);
+                    if (i == 0)
+                    {
+                        genArgs = new string[0];
+                        lamPars = new string[0];
+                    }
+                    else
+                    {
+                        genArgs = Enumerable.Range(1, i).Select(j => "TArg" + j).ToArray();
+                        lamPars = Enumerable.Range(1, i).Select(j => "t" + j).ToArray();
+                    }
+
+                    var fParam = ret == "Unit" ? "action" : "function";
+
+                    var retType = "Func<" + string.Join(", ", genArgs.Concat(new[] { "IQbservable<" + ret + ">" }).ToArray()) + ">";
+
+                    var begType = "Expression<Func<" + string.Join(", ", genArgs.Concat(new[] { "AsyncCallback", "object", "IAsyncResult" }).ToArray()) + ">>";
+                    var endType = ret == "Unit" ? "Expression<Action<IAsyncResult>>" : "Expression<Func<IAsyncResult, TResult>>";
+
+                    if (ret != "Unit")
+                        genArgs = genArgs.Concat(new[] { "TResult" }).ToArray();
+
+                    var docName = "M:System.Reactive.Linq.Observable.FromAsyncPattern";
+                    if (genArgs.Length > 0)
+                        docName += "``" + genArgs.Length;
+
+                    if (ret == "Unit")
+                    {
+                        var docArgB = "System.Func{" + string.Join(",", Enumerable.Range(0, genArgs.Length).Select(j => "``" + j)) + (genArgs.Length > 0 ? "," : "") + "System.AsyncCallback,System.Object,System.IAsyncResult}";
+                        var docArgE = "System.Action{System.IAsyncResult}";
+                        docName += "(" + docArgB + "," + docArgE + ")";
+                    }
+                    else
+                    {
+                        var docArgB = "System.Func{" + string.Join(",", Enumerable.Range(0, genArgs.Length - 1).Select(j => "``" + j)) + (genArgs.Length > 1 ? "," : "") + "System.AsyncCallback,System.Object,System.IAsyncResult}";
+                        var docArgE = "System.Func{System.IAsyncResult,``" + (genArgs.Length - 1) + "}";
+                        docName += "(" + docArgB + "," + docArgE + ")";
+                    }
+
+                    var xmlDoc = default(XElement);
+                    if (!docs.TryGetValue(docName, out xmlDoc))
+                    {
+                        Console.ForegroundColor = ConsoleColor.Yellow;
+                        Console.WriteLine("Missing XML documentation for {0}", docName);
+                        Console.ResetColor();
+                    }
+
+                    var genArgss = genArgs.Length > 0 ? "<" + string.Join(", ", genArgs) + ">" : "";
+
+                    if (xmlDoc != null)
+                    {
+                        foreach (var docLine in xmlDoc.Element("summary").ToString().Split('\n'))
+                            WriteLine("/// " + docLine.TrimStart().TrimEnd('\r'));
+
+                        WriteLine("/// <param name=\"provider\">Query provider used to construct the IQbservable&lt;T&gt; data source.</param>");
+
+                        foreach (var docLine in xmlDoc.Elements().Where(e => e.Name != "summary").SelectMany(e => e.ToString().Split('\n')))
+                            WriteLine("/// " + docLine.TrimStart().TrimEnd('\r'));
+                    }
+
+                    WriteLine("#if PREFERASYNC", true);
+                    WriteLine("[Obsolete(Constants_Linq.USE_TASK_FROMASYNCPATTERN)]");
+                    WriteLine("#endif", true);
+
+                    WriteLine("public static " + retType + " FromAsyncPattern" + genArgss + "(this IQbservableProvider provider, " + begType + " begin, " + endType + "end)");
+                    WriteLine("{");
+
+                    Indent();
+
+                    WriteLine("if (provider == null)");
+                    Indent();
+                    WriteLine("throw new ArgumentNullException(\"provider\");");
+                    Outdent();
+
+                    WriteLine("if (begin == null)");
+                    Indent();
+                    WriteLine("throw new ArgumentNullException(\"begin\");");
+                    Outdent();
+
+                    WriteLine("if (end == null)");
+                    Indent();
+                    WriteLine("throw new ArgumentNullException(\"end\");");
+                    Outdent();
+
+                    WriteLine("");
+
+                    WriteLine("#if CRIPPLED_REFLECTION", true);
+                    var aprs = new List<string> { "IQbservableProvider", begType, endType };
+                    WriteLine("var m = InfoOf(() => " + typeName + ".FromAsyncPattern" + genArgss + "(" + string.Join(", ", aprs.Select(pt => "default(" + pt + ")")) + "));");
+                    WriteLine("#else", true);
+                    if (genArgs.Length == 0)
+                        WriteLine("var m = (MethodInfo)MethodInfo.GetCurrentMethod();");
+                    else
+                        WriteLine("var m = ((MethodInfo)MethodInfo.GetCurrentMethod()).MakeGenericMethod(" + string.Join(", ", genArgs.Select(a => "typeof(" + a + ")").ToArray()) + ");");
+                    WriteLine("#endif", true);
+
+                    WriteLine("return (" + string.Join(", ", lamPars) + ") => provider.CreateQuery<" + ret + ">(");
+                    Indent();
+                    WriteLine("Expression.Invoke(");
+                    Indent();
+                    WriteLine("Expression.Call(");
+                    Indent();
+                    WriteLine("null,");
+                    WriteLine("m,");
+                    WriteLine("Expression.Constant(provider, typeof(IQbservableProvider)),");
+                    WriteLine("begin,");
+                    WriteLine("end");
+                    Outdent();
+                    WriteLine(")" + (lamPars.Length > 0 ? "," : ""));
+                    var k = 0;
+                    foreach (var e in genArgs.Zip(lamPars, (g, l) => new { g, l }))
+                    {
+                        WriteLine("Expression.Constant(" + e.l + ", typeof(" + e.g + "))" + (k < i - 1 ? "," : ""));
+                        k++;
+                    }
+                    Outdent();
+                    WriteLine(")");
+                    Outdent();
+                    WriteLine(");");
+
+                    Outdent();
+
+                    WriteLine("}");
+                    WriteLine("");
+
+                    if (i == 14)
+                        WriteLine("#endif", true);
+                }
+            }
+        }
+
+        static TextWriter Out { get; set; }
+        static int _indent;
+
+        static void WriteLine(string s, bool noIndent = false)
+        {
+            foreach (var t in s.Split('\n'))
+                Out.WriteLine((noIndent ? "" : new string(' ', _indent * 4)) + t.TrimEnd('\r'));
+        }
+
+        static void Indent()
+        {
+            _indent++;
+        }
+
+        static void Outdent()
+        {
+            _indent--;
+        }
+
+        static Type Iconize(this Type type)
+        {
+            if (type.IsGenericType && !type.IsGenericTypeDefinition)
+            {
+                var g = type.GetGenericTypeDefinition();
+                if (g == typeof(IObservable<>))
+                {
+                    return _qbs.MakeGenericType(type.GetGenericArguments());
+                }
+                else if (g == typeof(IEnumerable<>))
+                {
+                    return typeof(IQueryable<>).MakeGenericType(type.GetGenericArguments());
+                }
+            }
+
+            return type;
+        }
+
+        static string ToString2(this Type type)
+        {
+            if (type == typeof(int))
+                return "int";
+            else if (type == typeof(uint))
+                return "uint";
+            else if (type == typeof(long))
+                return "long";
+            else if (type == typeof(ulong))
+                return "ulong";
+            else if (type == typeof(float))
+                return "float";
+            else if (type == typeof(double))
+                return "double";
+            else if (type == typeof(byte))
+                return "byte";
+            else if (type == typeof(sbyte))
+                return "sbyte";
+            else if (type == typeof(bool))
+                return "bool";
+            else if (type == typeof(short))
+                return "short";
+            else if (type == typeof(ushort))
+                return "ushort";
+            else if (type == typeof(string))
+                return "string";
+            else if (type == typeof(object))
+                return "object";
+            else if (type == typeof(void))
+                return "void";
+            else if (type == typeof(decimal))
+                return "decimal";
+
+            if (type.IsArray)
+                return type.GetElementType().ToString2() + "[" + new string(',', type.GetArrayRank() - 1) + "]";
+
+            if (type.IsGenericType)
+            {
+                if (!type.IsGenericTypeDefinition)
+                {
+                    var g = type.GetGenericTypeDefinition();
+                    if (g == typeof(Nullable<>))
+                        return type.GetGenericArguments()[0].ToString2() + "?";
+                    else
+                        return g.ToString2() + "<" + string.Join(", ", type.GetGenericArguments().Select(t => t.ToString2()).ToArray()) + ">";
+                }
+                else
+                {
+                    var s = type.Name;
+                    return s.Substring(0, s.LastIndexOf('`'));
+                }
+            }
+
+            return type.Name;
+        }
+
+        static string ToDocName(MethodInfo method)
+        {
+            var name = "M:" + ToDocName(method.DeclaringType) + "." + method.Name;
+
+            var genArgs = new Type[0];
+
+            if (method.IsGenericMethod)
+            {
+                genArgs = method.GetGenericArguments();
+                name += "``" + genArgs.Length;
+            }
+
+            var pars = method.GetParameters();
+            if (pars.Length > 0)
+            {
+                name += "(" + string.Join(",", method.GetParameters().Select(p => ToDocName(p.ParameterType, genArgs))) + ")";
+            }
+
+            return name;
+        }
+
+        static string ToDocName(Type t, params Type[] genArgs)
+        {
+            var i = Array.IndexOf(genArgs, t);
+            if (i >= 0)
+                return "``" + i;
+
+            if (t.IsArray)
+            {
+                return ToDocName(t.GetElementType(), genArgs) + "[]";
+            }
+
+            if (t.IsGenericType)
+            {
+                var def = t.GetGenericTypeDefinition();
+                var name = def.FullName.Substring(0, def.FullName.LastIndexOf("`"));
+
+                var args = t.GetGenericArguments();
+
+                name += "{" + string.Join(",", args.Select(a => ToDocName(a, genArgs))) + "}";
+
+                return name;
+            }
+            else
+            {
+                return t.FullName;
+            }
+        }
+    }
+}

+ 36 - 0
Rx/NET/tools/HomoIcon/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HomoIcon")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("HomoIcon")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("fb62135f-908f-4908-a6fa-6e38eb4498ad")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

BIN
Rx/NET/tools/HomoIcon/bin/Debug/HomoIcon.exe


BIN
Rx/NET/tools/HomoIcon/bin/Debug/HomoIcon.pdb


BIN
Rx/NET/tools/HomoIcon/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache


+ 4 - 0
Rx/NET/tools/HomoIcon/obj/x86/Debug/HomoIcon.csproj.FileListAbsolute.txt

@@ -0,0 +1,4 @@
+C:\MSOpenTech\RX\NET\Main\Tools\HomoIcon\bin\Debug\HomoIcon.exe
+C:\MSOpenTech\RX\NET\Main\Tools\HomoIcon\bin\Debug\HomoIcon.pdb
+C:\MSOpenTech\RX\NET\Main\Tools\HomoIcon\obj\x86\Debug\HomoIcon.exe
+C:\MSOpenTech\RX\NET\Main\Tools\HomoIcon\obj\x86\Debug\HomoIcon.pdb

BIN
Rx/NET/tools/HomoIcon/obj/x86/Debug/HomoIcon.exe


BIN
Rx/NET/tools/HomoIcon/obj/x86/Debug/HomoIcon.pdb