Skip to content
This repository
Browse code

Added support for no default constructor deserialization

  • Loading branch information...
commit 238293c906681a44ddf11c895eb5caa3b76ed7b0 1 parent 43c2917
Chris Patterson authored January 06, 2012
BIN  lib/Newtonsoft.Json/Net/Newtonsoft.Json.dll
Binary file not shown
BIN  lib/Newtonsoft.Json/Net/Newtonsoft.Json.pdb
Binary file not shown
7,141  lib/Newtonsoft.Json/Net/Newtonsoft.Json.xml
7141 additions, 0 deletions not shown
BIN  lib/Newtonsoft.Json/Net35/Newtonsoft.Json.dll
Binary file not shown
BIN  lib/Newtonsoft.Json/Net35/Newtonsoft.Json.pdb
Binary file not shown
6,982  lib/Newtonsoft.Json/Net35/Newtonsoft.Json.xml
6982 additions, 0 deletions not shown
BIN  lib/Newtonsoft.Json/Newtonsoft.Json.dll
Binary file not shown
11  src/Magnum.1.2.dotCover
... ...
@@ -0,0 +1,11 @@
  1
+<Configuration>
  2
+  <CoverageFilters>
  3
+    <IncludeFilters>
  4
+      <Filter ModuleMask="*" ClassMask="*" FunctionMask="*" />
  5
+    </IncludeFilters>
  6
+    <ExcludeFilters />
  7
+  </CoverageFilters>
  8
+  <SnapshotDialog>
  9
+    <InitialDirectory>D:\Home\Magnum\src</InitialDirectory>
  10
+  </SnapshotDialog>
  11
+</Configuration>
336  src/Magnum.6.1.ReSharper
... ...
@@ -0,0 +1,336 @@
  1
+<Configuration>
  2
+  <CodeStyleSettings>
  3
+    <ExternalPath IsNull="False" />
  4
+    <Sharing>SOLUTION</Sharing>
  5
+    <CSS>
  6
+      <FormatSettings />
  7
+      <Naming2 />
  8
+    </CSS>
  9
+    <CSharp>
  10
+      <FormatSettings>
  11
+        <ALIGN_FIRST_ARG_BY_PAREN>True</ALIGN_FIRST_ARG_BY_PAREN>
  12
+        <BLANK_LINES_AFTER_START_COMMENT>0</BLANK_LINES_AFTER_START_COMMENT>
  13
+        <BLANK_LINES_AROUND_NAMESPACE>2</BLANK_LINES_AROUND_NAMESPACE>
  14
+        <BLANK_LINES_AROUND_TYPE>2</BLANK_LINES_AROUND_TYPE>
  15
+        <EXPLICIT_INTERNAL_MODIFIER>False</EXPLICIT_INTERNAL_MODIFIER>
  16
+        <EXPLICIT_PRIVATE_MODIFIER>False</EXPLICIT_PRIVATE_MODIFIER>
  17
+        <FORCE_ATTRIBUTE_STYLE>SEPARATE</FORCE_ATTRIBUTE_STYLE>
  18
+        <FORCE_FIXED_BRACES_STYLE>ONLY_FOR_MULTILINE</FORCE_FIXED_BRACES_STYLE>
  19
+        <FORCE_FOR_BRACES_STYLE>ONLY_FOR_MULTILINE</FORCE_FOR_BRACES_STYLE>
  20
+        <FORCE_FOREACH_BRACES_STYLE>ONLY_FOR_MULTILINE</FORCE_FOREACH_BRACES_STYLE>
  21
+        <FORCE_IFELSE_BRACES_STYLE>ONLY_FOR_MULTILINE</FORCE_IFELSE_BRACES_STYLE>
  22
+        <FORCE_USING_BRACES_STYLE>ONLY_FOR_MULTILINE</FORCE_USING_BRACES_STYLE>
  23
+        <FORCE_WHILE_BRACES_STYLE>ONLY_FOR_MULTILINE</FORCE_WHILE_BRACES_STYLE>
  24
+        <INDENT_ANONYMOUS_METHOD_BLOCK>False</INDENT_ANONYMOUS_METHOD_BLOCK>
  25
+        <INDENT_EMBRACED_INITIALIZER_BLOCK>False</INDENT_EMBRACED_INITIALIZER_BLOCK>
  26
+        <MODIFIERS_ORDER IsNull="False">
  27
+          <Item>public</Item>
  28
+          <Item>protected</Item>
  29
+          <Item>internal</Item>
  30
+          <Item>private</Item>
  31
+          <Item>new</Item>
  32
+          <Item>abstract</Item>
  33
+          <Item>virtual</Item>
  34
+          <Item>override</Item>
  35
+          <Item>sealed</Item>
  36
+          <Item>static</Item>
  37
+          <Item>readonly</Item>
  38
+          <Item>extern</Item>
  39
+          <Item>unsafe</Item>
  40
+          <Item>volatile</Item>
  41
+        </MODIFIERS_ORDER>
  42
+        <PLACE_CONSTRUCTOR_INITIALIZER_ON_SAME_LINE>False</PLACE_CONSTRUCTOR_INITIALIZER_ON_SAME_LINE>
  43
+        <PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE>False</PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE>
  44
+        <PLACE_WHILE_ON_NEW_LINE>True</PLACE_WHILE_ON_NEW_LINE>
  45
+        <SIMPLE_EMBEDDED_STATEMENT_STYLE>LINE_BREAK</SIMPLE_EMBEDDED_STATEMENT_STYLE>
  46
+        <SPACE_AFTER_TYPECAST_PARENTHESES>False</SPACE_AFTER_TYPECAST_PARENTHESES>
  47
+        <SPACE_BEFORE_SIZEOF_PARENTHESES>False</SPACE_BEFORE_SIZEOF_PARENTHESES>
  48
+        <SPACE_BEFORE_TYPEOF_PARENTHESES>False</SPACE_BEFORE_TYPEOF_PARENTHESES>
  49
+        <WRAP_BEFORE_BINARY_OPSIGN>True</WRAP_BEFORE_BINARY_OPSIGN>
  50
+        <WRAP_BEFORE_FIRST_TYPE_PARAMETER_CONSTRAINT>True</WRAP_BEFORE_FIRST_TYPE_PARAMETER_CONSTRAINT>
  51
+        <WRAP_EXTENDS_LIST_STYLE>CHOP_ALWAYS</WRAP_EXTENDS_LIST_STYLE>
  52
+        <WRAP_MULTIPLE_TYPE_PARAMEER_CONSTRAINTS_STYLE>CHOP_ALWAYS</WRAP_MULTIPLE_TYPE_PARAMEER_CONSTRAINTS_STYLE>
  53
+        <WRAP_OBJECT_AND_COLLECTION_INITIALIZER_STYLE>CHOP_ALWAYS</WRAP_OBJECT_AND_COLLECTION_INITIALIZER_STYLE>
  54
+      </FormatSettings>
  55
+      <UsingsSettings>
  56
+        <AddImportsToDeepestScope>True</AddImportsToDeepestScope>
  57
+        <AllowAlias>False</AllowAlias>
  58
+      </UsingsSettings>
  59
+      <Naming2>
  60
+        <EventHandlerPatternLong>$object$_On$event$</EventHandlerPatternLong>
  61
+        <EventHandlerPatternShort>$event$Handler</EventHandlerPatternShort>
  62
+        <ExceptionName IsNull="False" />
  63
+        <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="TypesAndNamespaces" />
  64
+        <PredefinedRule Inspect="True" Prefix="I" Suffix="" Style="AaBb" ElementKind="Interfaces" />
  65
+        <PredefinedRule Inspect="True" Prefix="T" Suffix="" Style="AaBb" ElementKind="TypeParameters" />
  66
+        <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="MethodPropertyEvent" />
  67
+        <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Locals" />
  68
+        <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="LocalConstants" />
  69
+        <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Parameters" />
  70
+        <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PublicFields" />
  71
+        <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Constants" />
  72
+        <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="StaticReadonly" />
  73
+        <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="EnumMember" />
  74
+        <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />
  75
+        <PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateInstanceFields" />
  76
+        <PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateStaticFields" />
  77
+        <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateConstants" />
  78
+        <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateStaticReadonly" />
  79
+      </Naming2>
  80
+      <CustomMemberReorderingPatterns><![CDATA[<?xml version="1.0" encoding="utf-8" ?>
  81
+
  82
+<!--
  83
+I. Overall
  84
+
  85
+I.1 Each pattern can have <Match>....</Match> element. For the given type declaration, the pattern with the match, evaluated to 'true' with the largest weight, will be used 
  86
+I.2 Each pattern consists of the sequence of <Entry>...</Entry> elements. Type member declarations are distributed between entries
  87
+I.3 If pattern has RemoveAllRegions="true" attribute, then all regions will be cleared prior to reordering. Otherwise, only auto-generated regions will be cleared
  88
+I.4 The contents of each entry is sorted by given keys (First key is primary,  next key is secondary, etc). Then the declarations are grouped and en-regioned by given property
  89
+
  90
+II. Available match operands
  91
+
  92
+Each operand may have Weight="..." attribute. This weight will be added to the match weight if the operand is evaluated to 'true'.
  93
+The default weight is 1
  94
+
  95
+II.1 Boolean functions:
  96
+II.1.1 <And>....</And>
  97
+II.1.2 <Or>....</Or>
  98
+II.1.3 <Not>....</Not>
  99
+
  100
+II.2 Operands
  101
+II.2.1 <Kind Is="..."/>. Kinds are: class, struct, interface, enum, delegate, type, constructor, destructor, property, indexer, method, operator, field, constant, event, member
  102
+II.2.2 <Name Is="..." [IgnoreCase="true/false"] />. The 'Is' attribute contains regular expression
  103
+II.2.3 <HasAttribute CLRName="..." [Inherit="true/false"] />. The 'CLRName' attribute contains regular expression
  104
+II.2.4 <Access Is="..."/>. The 'Is' values are: public, protected, internal, protected internal, private
  105
+II.2.5 <Static/>
  106
+II.2.6 <Abstract/>
  107
+II.2.7 <Virtual/>
  108
+II.2.8 <Override/>
  109
+II.2.9 <Sealed/>
  110
+II.2.10 <Readonly/>
  111
+II.2.11 <ImplementsInterface CLRName="..."/>. The 'CLRName' attribute contains regular expression
  112
+II.2.12 <HandlesEvent />
  113
+-->
  114
+
  115
+<Patterns xmlns="urn:shemas-jetbrains-com:member-reordering-patterns">
  116
+
  117
+  <!--Do not reorder COM interfaces-->
  118
+  <Pattern>
  119
+    <Match>
  120
+      <And Weight="100">
  121
+        <Kind Is="interface"/>
  122
+        <HasAttribute CLRName="System.Runtime.InteropServices.InterfaceTypeAttribute"/>
  123
+      </And>
  124
+    </Match>
  125
+  </Pattern>
  126
+
  127
+  <!--Special formatting of NUnit test fixture-->
  128
+  <Pattern RemoveAllRegions="true">
  129
+    <Match>
  130
+      <And Weight="100">
  131
+        <Kind Is="class"/>
  132
+        <HasAttribute CLRName="NUnit.Framework.TestFixtureAttribute" Inherit="true"/>
  133
+      </And>
  134
+    </Match>
  135
+
  136
+    <!--Setup/Teardow-->
  137
+    <Entry>
  138
+      <Match>
  139
+        <And>
  140
+          <Kind Is="method"/>
  141
+          <Or>
  142
+            <HasAttribute CLRName="NUnit.Framework.SetUpAttribute" Inherit="true"/>
  143
+            <HasAttribute CLRName="NUnit.Framework.TearDownAttribute" Inherit="true"/>
  144
+            <HasAttribute CLRName="NUnit.Framework.FixtureSetUpAttribute" Inherit="true"/>
  145
+            <HasAttribute CLRName="NUnit.Framework.FixtureTearDownAttribute" Inherit="true"/>
  146
+          </Or>
  147
+        </And>
  148
+      </Match>
  149
+    </Entry>
  150
+    
  151
+    <!--Test methods-->
  152
+    <Entry>
  153
+      <Match>
  154
+        <And Weight="100">
  155
+          <Kind Is="method"/>
  156
+          <HasAttribute CLRName="NUnit.Framework.TestAttribute" Inherit="false"/>
  157
+        </And>
  158
+      </Match>
  159
+      <Sort>
  160
+        <Name/>
  161
+      </Sort>
  162
+      <Group />
  163
+    </Entry>
  164
+
  165
+    <!--All other members-->
  166
+    <Entry/>
  167
+
  168
+  </Pattern>
  169
+
  170
+  <!--Default pattern-->
  171
+  <Pattern>
  172
+
  173
+    <!--public delegate-->
  174
+    <Entry>
  175
+      <Match>
  176
+        <And Weight="100">
  177
+          <Access Is="public"/>
  178
+          <Kind Is="delegate"/>
  179
+        </And>
  180
+      </Match>
  181
+      <Sort>
  182
+        <Name/>
  183
+      </Sort>
  184
+      <Group />
  185
+    </Entry>
  186
+    
  187
+    <!--public enum-->
  188
+    <Entry>
  189
+      <Match>
  190
+        <And Weight="100">
  191
+          <Access Is="public"/>
  192
+          <Kind Is="enum"/>
  193
+        </And>
  194
+      </Match>
  195
+      <Sort>
  196
+        <Name/>
  197
+      </Sort>
  198
+      <Group/>
  199
+    </Entry>
  200
+
  201
+    <!--fields and constants-->
  202
+    <Entry>
  203
+      <Match>
  204
+        <Or>
  205
+          <Kind Is="constant"/>
  206
+          <Kind Is="field"/>
  207
+        </Or>
  208
+      </Match>
  209
+      <Sort>
  210
+        <Kind Order="constant field"/>
  211
+        <Static/>
  212
+        <Readonly/>
  213
+        <Name/>
  214
+      </Sort>
  215
+    </Entry>
  216
+
  217
+    <!--Constructors. Place static one first-->
  218
+    <Entry>
  219
+      <Match>
  220
+        <Kind Is="constructor"/>
  221
+      </Match>
  222
+      <Sort>
  223
+        <Static/>
  224
+      </Sort>
  225
+    </Entry>
  226
+    
  227
+    <!--properties, indexers-->
  228
+    <Entry>
  229
+      <Match>
  230
+        <Or>
  231
+          <Kind Is="property"/>
  232
+          <Kind Is="indexer"/>
  233
+        </Or>
  234
+      </Match>
  235
+    </Entry>
  236
+    
  237
+    <!--interface implementations-->
  238
+    <Entry>
  239
+      <Match>
  240
+        <And Weight="100">
  241
+          <Kind Is="member"/>
  242
+          <ImplementsInterface/>
  243
+        </And>
  244
+      </Match>
  245
+      <Sort>
  246
+        <ImplementsInterface Immediate="true"/>
  247
+      </Sort>
  248
+      <Group />
  249
+    </Entry>
  250
+    
  251
+    <!--all other members-->
  252
+    <Entry/>
  253
+    
  254
+    <!--nested types-->
  255
+    <Entry>
  256
+      <Match>
  257
+        <Kind Is="type"/>
  258
+      </Match>
  259
+      <Sort>
  260
+        <Name/>
  261
+      </Sort>
  262
+      <Group/>
  263
+    </Entry>
  264
+  </Pattern>
  265
+  
  266
+</Patterns>
  267
+]]></CustomMemberReorderingPatterns>
  268
+    </CSharp>
  269
+    <HTML>
  270
+      <FormatSettings />
  271
+    </HTML>
  272
+    <JavaScript>
  273
+      <FormatSettings />
  274
+      <Naming2 />
  275
+    </JavaScript>
  276
+    <VB>
  277
+      <FormatSettings />
  278
+      <ImportsSettings />
  279
+      <Naming2>
  280
+        <EventHandlerPatternLong>$object$_On$event$</EventHandlerPatternLong>
  281
+        <EventHandlerPatternShort>$event$Handler</EventHandlerPatternShort>
  282
+      </Naming2>
  283
+    </VB>
  284
+    <Web>
  285
+      <Naming2 />
  286
+    </Web>
  287
+    <XML>
  288
+      <FormatSettings />
  289
+    </XML>
  290
+    <Xaml>
  291
+      <Naming2 />
  292
+    </Xaml>
  293
+    <FileHeader><![CDATA[Copyright 2007-2010 The Apache Software Foundation.
  294
+
  295
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use 
  296
+this file except in compliance with the License. You may obtain a copy of the 
  297
+License at 
  298
+
  299
+    http://www.apache.org/licenses/LICENSE-2.0 
  300
+
  301
+Unless required by applicable law or agreed to in writing, software distributed 
  302
+under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
  303
+CONDITIONS OF ANY KIND, either express or implied. See the License for the 
  304
+specific language governing permissions and limitations under the License.]]></FileHeader>
  305
+    <GenerateMemberBody />
  306
+    <Naming2>
  307
+      <EventHandlerPatternLong>$object$_On$event$</EventHandlerPatternLong>
  308
+      <EventHandlerPatternShort>$event$Handler</EventHandlerPatternShort>
  309
+      <ExceptionName>ex</ExceptionName>
  310
+      <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Locals" />
  311
+      <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Parameters" />
  312
+      <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="TypesAndNamespaces">
  313
+        <ExtraRule Prefix="" Suffix="" Style="Aa_bb" />
  314
+      </PredefinedRule>
  315
+      <PredefinedRule Inspect="True" Prefix="I" Suffix="" Style="AaBb" ElementKind="Interfaces">
  316
+        <ExtraRule Prefix="" Suffix="" Style="AaBb" />
  317
+      </PredefinedRule>
  318
+      <PredefinedRule Inspect="True" Prefix="T" Suffix="" Style="AaBb" ElementKind="TypeParameters" />
  319
+      <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="MethodPropertyEvent">
  320
+        <ExtraRule Prefix="" Suffix="" Style="Aa_bb" />
  321
+      </PredefinedRule>
  322
+      <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="LocalConstants" />
  323
+      <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PublicFields" />
  324
+      <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Constants" />
  325
+      <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="StaticReadonly" />
  326
+      <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="EnumMember" />
  327
+      <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />
  328
+      <PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateInstanceFields" />
  329
+      <PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateStaticFields" />
  330
+      <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateConstants" />
  331
+      <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateStaticReadonly">
  332
+        <ExtraRule Prefix="_" Suffix="" Style="aaBb" />
  333
+      </PredefinedRule>
  334
+    </Naming2>
  335
+  </CodeStyleSettings>
  336
+</Configuration>
4  src/Magnum.Routing/Magnum.Routing.csproj.DotSettings
... ...
@@ -0,0 +1,4 @@
  1
+<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
  2
+	<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=Binders/@EntryIndexedValue">True</s:Boolean>
  3
+	<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=Configuration/@EntryIndexedValue">True</s:Boolean>
  4
+	<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=Exceptions/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
2  src/Magnum.Routing/Magnum.Routing.csproj.DotSettings.user
... ...
@@ -0,0 +1,2 @@
  1
+<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
  2
+	<s:Boolean x:Key="/Default/Housekeeping/ProjectSettingsUpgraded/IsUpgraded/@EntryValue">True</s:Boolean></wpf:ResourceDictionary>
49  src/Magnum.Specs/Activator/NoDefaultConstructor_Specs.cs
... ...
@@ -0,0 +1,49 @@
  1
+namespace Magnum.Specs.Activator
  2
+{
  3
+    using Magnum.Reflection;
  4
+    using NUnit.Framework;
  5
+    using TestFramework;
  6
+
  7
+
  8
+    [TestFixture]
  9
+    public class When_a_class_has_no_default_constructor
  10
+    {
  11
+        [Test]
  12
+        public void Should_be_able_to_create_one()
  13
+        {
  14
+            var subject = FastActivator<Subject>.Create();
  15
+
  16
+            subject.ShouldNotBeNull();
  17
+        }
  18
+
  19
+
  20
+        [Test]
  21
+        public void Should_be_able_to_create_a_generic_type()
  22
+        {
  23
+            var subject = FastActivator.Create(typeof(GenericSubject<>), new[] {typeof(int)});
  24
+
  25
+            subject.ShouldNotBeNull();
  26
+        }
  27
+
  28
+        class Subject
  29
+        {
  30
+            public Subject(string value)
  31
+            {
  32
+                Value = value;
  33
+            }
  34
+
  35
+            public string Value { get; private set; }
  36
+        }
  37
+
  38
+
  39
+        class GenericSubject<T>
  40
+        {
  41
+            public GenericSubject(T value)
  42
+            {
  43
+                Value = value;
  44
+            }
  45
+
  46
+            public T Value { get; private set; }
  47
+        }
  48
+    }
  49
+}
14  src/Magnum.Specs/Magnum.Specs.csproj
@@ -74,10 +74,13 @@
74 74
       <SpecificVersion>False</SpecificVersion>
75 75
       <HintPath>..\..\lib\log4net\log4net.dll</HintPath>
76 76
     </Reference>
77  
-    <Reference Include="Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
78  
-      <HintPath>..\..\lib\Newtonsoft.Json\Newtonsoft.Json.dll</HintPath>
  77
+    <Reference Include="Newtonsoft.Json" Condition="'$(TargetFrameworkVersion)' == 'v3.5'">
  78
+      <HintPath>..\..\lib\Newtonsoft.Json\Net35\Newtonsoft.Json.dll</HintPath>
79 79
     </Reference>
80  
-    <Reference Include="nunit.framework, Version=2.5.2.9222, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
  80
+    <Reference Include="Newtonsoft.Json" Condition="'$(TargetFrameworkVersion)' == 'v4.0'">
  81
+      <HintPath>..\..\lib\Newtonsoft.Json\Net\Newtonsoft.Json.dll</HintPath>
  82
+    </Reference>
  83
+     <Reference Include="nunit.framework, Version=2.5.2.9222, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
81 84
       <SpecificVersion>False</SpecificVersion>
82 85
       <HintPath>..\..\lib\nunit\net-2.0\nunit.framework.dll</HintPath>
83 86
     </Reference>
@@ -110,6 +113,7 @@
110 113
     <Compile Include="Activator\Benchmarks\NewActivatorRunner.cs" />
111 114
     <Compile Include="Activator\Benchmarks\SingleArgumentConstructorBenchmark.cs" />
112 115
     <Compile Include="Activator\Benchmarks\TwoArgumentConstructorBenchmark.cs" />
  116
+    <Compile Include="Activator\NoDefaultConstructor_Specs.cs" />
113 117
     <Compile Include="Algorithms\DependencyGraph_Specs.cs" />
114 118
     <Compile Include="Algorithms\Edge_Specs.cs" />
115 119
     <Compile Include="Algorithms\NodeList_Specs.cs" />
@@ -362,11 +366,11 @@
362 366
     </Content>
363 367
   </ItemGroup>
364 368
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
365  
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
  369
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
366 370
        Other similar extension points exist, see Microsoft.Common.targets.
367 371
   <Target Name="BeforeBuild">
368 372
   </Target>
369 373
   <Target Name="AfterBuild">
370 374
   </Target>
371 375
   -->
372  
-</Project>
  376
+</Project>
11  src/Magnum/Magnum.csproj
@@ -76,8 +76,11 @@
76 76
     <CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
77 77
   </PropertyGroup>
78 78
   <ItemGroup>
79  
-    <Reference Include="Newtonsoft.Json">
80  
-      <HintPath>..\..\lib\Newtonsoft.Json\Newtonsoft.Json.dll</HintPath>
  79
+    <Reference Include="Newtonsoft.Json" Condition="'$(TargetFrameworkVersion)' == 'v3.5'">
  80
+      <HintPath>..\..\lib\Newtonsoft.Json\Net35\Newtonsoft.Json.dll</HintPath>
  81
+    </Reference>
  82
+    <Reference Include="Newtonsoft.Json" Condition="'$(TargetFrameworkVersion)' == 'v4.0'">
  83
+      <HintPath>..\..\lib\Newtonsoft.Json\Net\Newtonsoft.Json.dll</HintPath>
81 84
     </Reference>
82 85
     <Reference Include="System" />
83 86
     <Reference Include="System.Core">
@@ -601,11 +604,11 @@
601 604
     </BootstrapperPackage>
602 605
   </ItemGroup>
603 606
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
604  
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
  607
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
605 608
        Other similar extension points exist, see Microsoft.Common.targets.
606 609
   <Target Name="BeforeBuild">
607 610
   </Target>
608 611
   <Target Name="AfterBuild">
609 612
   </Target>
610 613
   -->
611  
-</Project>
  614
+</Project>
27  src/Magnum/Reflection/FastActivator.1.cs
@@ -17,6 +17,8 @@ namespace Magnum.Reflection
17 17
 	using System.Linq;
18 18
 	using System.Linq.Expressions;
19 19
 	using System.Reflection;
  20
+	using System.Runtime.Serialization;
  21
+	using System.Runtime.Serialization.Formatters.Binary;
20 22
 	using Extensions;
21 23
 
22 24
 
@@ -97,21 +99,30 @@ void InitializeNew()
97 99
 						.MatchingArguments()
98 100
 						.SingleOrDefault();
99 101
 
100  
-					if (constructorInfo == null)
101  
-						throw new FastActivatorException(typeof(T), "No usable constructor found");
  102
+                    if (constructorInfo == null)
  103
+                    {
  104
+                        _new = CreateUsingSerialization;
  105
+                    }
  106
+                    else
  107
+                    {
  108
+                        Func<T> lambda = Expression.Lambda<Func<T>>(Expression.New(constructorInfo)).Compile();
102 109
 
103  
-					Func<T> lambda = Expression.Lambda<Func<T>>(Expression.New(constructorInfo)).Compile();
  110
+                        _new = lambda;
  111
+                    }
104 112
 
105  
-					_new = lambda;
106  
-
107  
-					return lambda();
  113
+				    return _new();
108 114
 				};
109 115
 		}
110 116
 
  117
+        T CreateUsingSerialization()
  118
+        {
  119
+            return (T)FormatterServices.GetUninitializedObject(typeof(T));
  120
+        }
  121
+
111 122
 		T CreateFromArgs(object[] args)
112 123
 		{
113  
-			if (args == null)
114  
-				args = new object[] {};
  124
+            if (args == null || args.Length == 0)
  125
+                return _new();
115 126
 
116 127
 			int offset = 0;
117 128
 			int key = args.Aggregate(0, (x, o) => x ^ (o == null ? offset : o.GetType().GetHashCode() << offset++));

0 notes on commit 238293c

Please sign in to comment.
Something went wrong with that request. Please try again.