diff --git a/.gitignore b/.gitignore
index 55f2a4e5..e8a52f8c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,4 +12,5 @@ dist
packages/
AppPackages
.vs/
-TestResults/
\ No newline at end of file
+TestResults/
+*.nuget.targets
\ No newline at end of file
diff --git a/Ninject.sln b/Ninject.sln
index 4be9f438..791f7627 100644
--- a/Ninject.sln
+++ b/Ninject.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
-VisualStudioVersion = 14.0.22823.1
+VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3E299B94-5F07-49DE-8226-55EDC56F13E3}"
ProjectSection(SolutionItems) = preProject
@@ -55,6 +55,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ninject.Android.Tests", "sr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ninject.iOS-Unified", "src\Ninject\Ninject.iOS-Unified.csproj", "{420ACA2A-7853-4C5D-A3B1-E7AE938A801F}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ninject-dotnet", "src\Ninject.dotnet\Ninject-dotnet.csproj", "{00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}"
+EndProject
+Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Ninject.dotnet.Tests", "src\Ninject.dotnet.Tests\Ninject.dotnet\Ninject.dotnet.Tests.xproj", "{F177D383-F30F-4E09-B5C8-034525582FA8}"
+ ProjectSection(ProjectDependencies) = postProject
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A} = {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -424,6 +431,54 @@ Global
{420ACA2A-7853-4C5D-A3B1-E7AE938A801F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{420ACA2A-7853-4C5D-A3B1-E7AE938A801F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{420ACA2A-7853-4C5D-A3B1-E7AE938A801F}.Release|x86.ActiveCfg = Release|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Debug|ARM.Build.0 = Debug|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Debug|x86.Build.0 = Debug|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Release|ARM.ActiveCfg = Release|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Release|ARM.Build.0 = Release|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Release|iPhone.Build.0 = Release|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Release|x86.ActiveCfg = Release|Any CPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}.Release|x86.Build.0 = Release|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Debug|ARM.Build.0 = Debug|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Debug|x86.Build.0 = Debug|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Release|ARM.ActiveCfg = Release|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Release|ARM.Build.0 = Release|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Release|iPhone.Build.0 = Release|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Release|x86.ActiveCfg = Release|Any CPU
+ {F177D383-F30F-4E09-B5C8-034525582FA8}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -441,5 +496,6 @@ Global
{EE8989C3-2C73-4941-9F7E-5470344E9661} = {F1218241-9ED7-4DFA-9943-868AF26365CC}
{09A7BE45-2A38-4087-87E5-FCC842D0742A} = {F1218241-9ED7-4DFA-9943-868AF26365CC}
{87B049E5-878F-4694-9E83-D5A74C653039} = {F1218241-9ED7-4DFA-9943-868AF26365CC}
+ {F177D383-F30F-4E09-B5C8-034525582FA8} = {F1218241-9ED7-4DFA-9943-868AF26365CC}
EndGlobalSection
EndGlobal
diff --git a/Portable.Ninject.nuspec b/Portable.Ninject.nuspec
index 1c42923e..723981ed 100644
--- a/Portable.Ninject.nuspec
+++ b/Portable.Ninject.nuspec
@@ -1,5 +1,4 @@
-
Portable.Ninject
@@ -19,47 +18,64 @@
IoC container for .NET
Xamarin support for iOS and Android
Ninject ioc di portable pcl xamarin ios android monotouch monoandroid
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
-
-
-
+
-
-
+
+
+
+
\ No newline at end of file
diff --git a/global.json b/global.json
new file mode 100644
index 00000000..3eb265a4
--- /dev/null
+++ b/global.json
@@ -0,0 +1,5 @@
+{
+ "projects": [
+ "wrap"
+ ]
+}
\ No newline at end of file
diff --git a/src/Ninject.Test/Integration/DefaultScopeCallbackTests.cs b/src/Ninject.Test/Integration/DefaultScopeCallbackTests.cs
index af64fc66..9e5e3e07 100644
--- a/src/Ninject.Test/Integration/DefaultScopeCallbackTests.cs
+++ b/src/Ninject.Test/Integration/DefaultScopeCallbackTests.cs
@@ -60,7 +60,7 @@ public void CanOverrideDefaultScopeWithSingletonInBinding()
binding.ScopeCallback.Should().BeSameAs(StandardScopeCallbacks.Singleton);
}
-#if !WINRT
+#if !WINRT && !DOTNET
[Fact]
public void CanOverrideDefaultScopeWithThreadInBinding()
{
@@ -144,7 +144,7 @@ public void CanOverrideDefaultScopeWithTransientInBinding()
var binding = kernel.GetBindings(typeof(IService)).FirstOrDefault();
binding.ScopeCallback.Should().BeSameAs(StandardScopeCallbacks.Transient);
}
-#if !WINRT
+#if !WINRT && !DNXCORE50
[Fact]
public void ScopeShouldBeThread()
{
@@ -158,7 +158,7 @@ public void ImplicitSelfBindedTypeShouldBeTransient()
TestSelfBindedTypesAreTransient();
}
-#if !WINRT
+#if !WINRT && !DNXCORE50
[Fact]
public void ExplicitSelfBindedTypeShouldHaveThreadScope()
{
@@ -172,7 +172,7 @@ protected override void InitializeKernel()
{
var settings = new NinjectSettings
{
-#if !WINRT
+#if !WINRT && !DNXCORE50
DefaultScopeCallback = StandardScopeCallbacks.Thread
#endif
};
diff --git a/src/Ninject.Test/Integration/ModuleLoadingTests/WhenLoadIsCalledWithAssemblies.cs b/src/Ninject.Test/Integration/ModuleLoadingTests/WhenLoadIsCalledWithAssemblies.cs
index c2ba5a7d..6686eedc 100644
--- a/src/Ninject.Test/Integration/ModuleLoadingTests/WhenLoadIsCalledWithAssemblies.cs
+++ b/src/Ninject.Test/Integration/ModuleLoadingTests/WhenLoadIsCalledWithAssemblies.cs
@@ -1,4 +1,4 @@
-#if !NO_ASSEMBLY_SCANNING && !NO_MOQ
+#if !NO_ASSEMBLY_SCANNING && !NO_MOQ && !DOTNET
namespace Ninject.Tests.Integration.ModuleLoadingTests
{
using System.Linq;
@@ -13,6 +13,7 @@ public class WhenLoadIsCalledWithAssemblies : ModuleLoadingContext
public void ModulesContainedInAssembliesAreLoaded()
{
var expectedModules = new[] { typeof(TestModule), typeof(TestModule2), typeof(OtherFakes.TestModule) };
+
var assembly = Assembly.GetExecutingAssembly();
this.Kernel.Load(assembly);
diff --git a/src/Ninject.Test/Integration/ModuleLoadingTests/WhenLoadIsCalledWithFileName.cs b/src/Ninject.Test/Integration/ModuleLoadingTests/WhenLoadIsCalledWithFileName.cs
index 37961c66..f3a8f403 100644
--- a/src/Ninject.Test/Integration/ModuleLoadingTests/WhenLoadIsCalledWithFileName.cs
+++ b/src/Ninject.Test/Integration/ModuleLoadingTests/WhenLoadIsCalledWithFileName.cs
@@ -1,4 +1,4 @@
-#if !NO_ASSEMBLY_SCANNING && !NO_MOQ
+#if !NO_ASSEMBLY_SCANNING && !NO_MOQ && !DOTNET
namespace Ninject.Tests.Integration.ModuleLoadingTests
{
using System;
diff --git a/src/Ninject.Test/Integration/ThreadScopeTests.cs b/src/Ninject.Test/Integration/ThreadScopeTests.cs
index d7dcc68e..27622b75 100644
--- a/src/Ninject.Test/Integration/ThreadScopeTests.cs
+++ b/src/Ninject.Test/Integration/ThreadScopeTests.cs
@@ -1,4 +1,4 @@
-#if !WINRT
+#if !WINRT && !DNXCORE50
namespace Ninject.Tests.Integration.ThreadScopeTests
{
using System;
diff --git a/src/Ninject.Test/Unit/AssemblyNameRetrieverTests.cs b/src/Ninject.Test/Unit/AssemblyNameRetrieverTests.cs
index 060a4269..e5119bd9 100644
--- a/src/Ninject.Test/Unit/AssemblyNameRetrieverTests.cs
+++ b/src/Ninject.Test/Unit/AssemblyNameRetrieverTests.cs
@@ -1,5 +1,6 @@
#if !NO_MOQ
#if !NO_ASSEMBLY_SCANNING
+#if !DOTNET
namespace Ninject.Tests.Unit
{
using System;
@@ -68,5 +69,6 @@ public void WillBeIgnored()
}
}
}
+#endif //!DOTNET
#endif //!NO_ASSEMBLY_SCANNING
#endif
\ No newline at end of file
diff --git a/src/Ninject.Test/Unit/CompiledModuleLoaderPluginTests.cs b/src/Ninject.Test/Unit/CompiledModuleLoaderPluginTests.cs
index 27a30a5e..983b91be 100644
--- a/src/Ninject.Test/Unit/CompiledModuleLoaderPluginTests.cs
+++ b/src/Ninject.Test/Unit/CompiledModuleLoaderPluginTests.cs
@@ -1,5 +1,6 @@
#if !NO_MOQ
#if !NO_ASSEMBLY_SCANNING
+#if !DOTNET
namespace Ninject.Tests.Unit.CompiledModuleLoaderPluginTests
{
using System;
@@ -51,5 +52,6 @@ public void DoesNotLoadAssembliesWithoutModules()
}
}
}
+#endif //!DOTNET
#endif //!NO_ASSEMBLY_SCANNING
#endif
\ No newline at end of file
diff --git a/src/Ninject.Test/Unit/ModuleLoaderTests.cs b/src/Ninject.Test/Unit/ModuleLoaderTests.cs
index 42d49ee0..6c9e2a45 100644
--- a/src/Ninject.Test/Unit/ModuleLoaderTests.cs
+++ b/src/Ninject.Test/Unit/ModuleLoaderTests.cs
@@ -36,6 +36,7 @@ public ModuleLoaderContext()
}
}
+#if !DOTNET
public class WhenLoadModulesIsCalled : ModuleLoaderContext
{
[Fact]
@@ -50,6 +51,7 @@ public void PassesMatchingFilesToAppropriatePlugin()
barPluginMock.Verify(x => x.LoadModules(It.Is>(e => e.SequenceEqual(barFiles))));
}
}
+#endif //!DOTNET
}
#endif //!NO_ASSEMBLY_SCANNING
#endif
\ No newline at end of file
diff --git a/src/Ninject.dotnet.Tests/Ninject.dotnet/Ninject.dotnet.Tests.xproj b/src/Ninject.dotnet.Tests/Ninject.dotnet/Ninject.dotnet.Tests.xproj
new file mode 100644
index 00000000..2a423586
--- /dev/null
+++ b/src/Ninject.dotnet.Tests/Ninject.dotnet/Ninject.dotnet.Tests.xproj
@@ -0,0 +1,24 @@
+
+
+
+ 14.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+
+ f177d383-f30f-4e09-b5c8-034525582fa8
+ Ninject.dotnet
+ ..\..\..\artifacts\obj\$(MSBuildProjectName)
+ ..\..\..\artifacts\bin\$(MSBuildProjectName)\
+
+
+ 2.0
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Ninject.dotnet.Tests/Ninject.dotnet/project.json b/src/Ninject.dotnet.Tests/Ninject.dotnet/project.json
new file mode 100644
index 00000000..2a04b439
--- /dev/null
+++ b/src/Ninject.dotnet.Tests/Ninject.dotnet/project.json
@@ -0,0 +1,29 @@
+{
+ "version": "1.0.0-*",
+ "description": "Ninject dotnet Tests",
+ "compile": [
+ "../../Ninject.Test/**/*.cs"
+ ],
+
+ "dependencies": {
+ "xunit": "2.1.0",
+ "xunit.runner.dnx": "2.1.0-beta6-build191"
+ },
+
+ "commands": {
+ "test": "xunit.runner.dnx"
+ },
+
+ "frameworks": {
+ "dnxcore50": {
+ "compilationOptions": {
+ "define": [ "DOTNET", "NO_MOQ" ]
+ },
+ "dependencies": {
+ "FluentAssertions": "4.0.1",
+ "moq.netcore": "4.4.0-beta8",
+ "Ninject": "99.99.99-dev"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Ninject.dotnet/Ninject-dotnet.csproj b/src/Ninject.dotnet/Ninject-dotnet.csproj
new file mode 100644
index 00000000..764ca645
--- /dev/null
+++ b/src/Ninject.dotnet/Ninject-dotnet.csproj
@@ -0,0 +1,246 @@
+
+
+
+
+ 14.0
+ Debug
+ AnyCPU
+ {00A3D52F-BA8F-49A3-BDF8-FA457E866F3A}
+ Library
+ Properties
+ Ninject
+ Ninject
+ en-US
+ 512
+ {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+
+
+ v5.0
+
+
+
+
+ False
+
+
+
+ true
+ full
+ false
+ ..\Ninject\bin\dotnet\Debug\
+ TRACE;DEBUG;DOTNET
+ prompt
+ 4
+
+
+ true
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ ..\Ninject\bin\dotnet\Release\
+ TRACE;DOTNET
+ prompt
+ 4
+ ..\Ninject\bin\dotnet\Release\Ninject.xml
+ true
+
+
+ true
+
+
+ ..\Ninject.snk
+
+
+
+ Properties\SharedAssemblyInfo.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Ninject.snk
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Ninject.dotnet/project.json b/src/Ninject.dotnet/project.json
new file mode 100644
index 00000000..bf6e4e2d
--- /dev/null
+++ b/src/Ninject.dotnet/project.json
@@ -0,0 +1,19 @@
+{
+ "supports": {
+ "net46.app": {},
+ "uwp.10.0.app": {},
+ "dnxcore50.app": {}
+ },
+ "dependencies": {
+ "Microsoft.NETCore": "5.0.0",
+ "Microsoft.NETCore.Portable.Compatibility": "1.0.0",
+ "NuSpec.ReferenceGenerator": "1.3.6",
+ "System.Reflection.Emit.ILGeneration": "4.0.0",
+ "System.Reflection.Emit.LightWeight": "4.0.0"
+ },
+ "frameworks": {
+ "dotnet": {
+ "imports": "portable-net452+win81"
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Ninject/Activation/Caching/GarbageCollectionCachePruner.cs b/src/Ninject/Activation/Caching/GarbageCollectionCachePruner.cs
index d8934df1..bfbc9bea 100644
--- a/src/Ninject/Activation/Caching/GarbageCollectionCachePruner.cs
+++ b/src/Ninject/Activation/Caching/GarbageCollectionCachePruner.cs
@@ -99,9 +99,11 @@ public void Stop()
using (var signal = new ManualResetEvent(false))
{
-#if !WINRT
+#if !WINRT && !DOTNET
this.timer.Dispose(signal);
signal.WaitOne();
+#elif DOTNET
+ this.timer.Dispose();
#else
this.timer.Cancel();
#endif
diff --git a/src/Ninject/Activation/InstanceReference.cs b/src/Ninject/Activation/InstanceReference.cs
index a2621cbc..c412e62b 100644
--- a/src/Ninject/Activation/InstanceReference.cs
+++ b/src/Ninject/Activation/InstanceReference.cs
@@ -37,7 +37,7 @@ public class InstanceReference
[SecuritySafeCritical]
public bool Is()
{
-#if !SILVERLIGHT && !WINDOWS_PHONE && !MONO && !PCL && !WINRT
+#if !SILVERLIGHT && !WINDOWS_PHONE && !MONO && !PCL && !WINRT && !DOTNET
if (System.Runtime.Remoting.RemotingServices.IsTransparentProxy(Instance)
&& System.Runtime.Remoting.RemotingServices.GetRealProxy(Instance).GetType().Name == "RemotingProxy")
{
diff --git a/src/Ninject/GlobalKernelRegistration.cs b/src/Ninject/GlobalKernelRegistration.cs
index 3fe19918..c75a7ec3 100644
--- a/src/Ninject/GlobalKernelRegistration.cs
+++ b/src/Ninject/GlobalKernelRegistration.cs
@@ -32,7 +32,7 @@ namespace Ninject
///
public abstract class GlobalKernelRegistration
{
-#if !WINRT && !PCL
+#if !WINRT && !PCL && !DOTNET
private static readonly ReaderWriterLock kernelRegistrationsLock = new ReaderWriterLock();
#elif !PCL
private static readonly ReaderWriterLockSlim kernelRegistrationsLock = new ReaderWriterLockSlim();
@@ -45,7 +45,7 @@ internal static void RegisterKernelForType(IReadonlyKernel kernel, Type type)
throw new NotImplementedException();
#else
var registration = GetRegistrationForType(type);
-#if !WINRT
+#if !WINRT && !DOTNET
registration.KernelLock.AcquireReaderLock(Timeout.Infinite);
#else
registration.KernelLock.EnterReadLock();
@@ -56,7 +56,7 @@ internal static void RegisterKernelForType(IReadonlyKernel kernel, Type type)
}
finally
{
-#if !WINRT
+#if !WINRT && !DOTNET
registration.KernelLock.ReleaseReaderLock();
#else
registration.KernelLock.ExitReadLock();
@@ -86,7 +86,7 @@ protected void MapKernels(Action action)
#else
bool requiresCleanup = false;
var registration = GetRegistrationForType(this.GetType());
-#if !WINRT
+#if !WINRT && !DOTNET
registration.KernelLock.AcquireReaderLock(Timeout.Infinite);
#else
registration.KernelLock.EnterReadLock();
@@ -110,7 +110,7 @@ protected void MapKernels(Action action)
}
finally
{
-#if !WINRT
+#if !WINRT && !DOTNET
registration.KernelLock.ReleaseReaderLock();
#else
registration.KernelLock.ExitReadLock();
@@ -129,7 +129,7 @@ private static void RemoveKernels(Registration registration, IEnumerable();
}
-#if !WINRT
+#if !WINRT && !DOTNET
public ReaderWriterLock KernelLock { get; private set; }
#else
- public ReaderWriterLockSlim KernelLock { get; private set; }
+ public ReaderWriterLockSlim KernelLock { get; private set; }
#endif
public IList Kernels { get; private set; }
diff --git a/src/Ninject/Infrastructure/Introspection/FormatExtensions.cs b/src/Ninject/Infrastructure/Introspection/FormatExtensions.cs
index 02dc91b2..b8712791 100644
--- a/src/Ninject/Infrastructure/Introspection/FormatExtensions.cs
+++ b/src/Ninject/Infrastructure/Introspection/FormatExtensions.cs
@@ -14,7 +14,7 @@
using System.Reflection;
using System.Text;
#if WINRT
-using System.Diagnostics;
+using System.Diagnostics;
#endif
using Ninject.Activation;
using Ninject.Planning.Bindings;
@@ -122,7 +122,7 @@ public static string Format(this IRequest request)
#endif
}
-#if WINRT
+#if WINRT || DOTNET
private static MemberTypes GetMemberType(this MemberInfo member)
{
if (member is FieldInfo)
@@ -166,12 +166,12 @@ private enum MemberTypes
/// The target formatted as string.
public static string Format(this ITarget target)
{
-#if PCL
+#if PCL && !DOTNET
throw new NotImplementedException();
#else
using (var sw = new StringWriter())
{
-#if !WINRT
+#if !WINRT && !DOTNET
switch (target.Member.MemberType)
#else
switch(target.Member.GetMemberType())
@@ -193,9 +193,9 @@ public static string Format(this ITarget target)
throw new ArgumentOutOfRangeException();
}
-#if !WINRT
+#if !WINRT && !DOTNET
sw.Write(" of type {0}", target.Member.ReflectedType.Format());
- #else
+#else
#endif
return sw.ToString();
@@ -212,7 +212,7 @@ public static string Format(this ITarget target)
/// The type formatted as string.
public static string Format(this Type type)
{
-#if PCL
+#if PCL && !DOTNET
throw new NotImplementedException();
#else
var friendlyName = GetFriendlyName(type);
@@ -226,7 +226,7 @@ public static string Format(this Type type)
return "AnonymousType";
#endif
-#if !WINRT
+#if !WINRT && !DOTNET
switch (friendlyName.ToLower(CultureInfo.InvariantCulture))
#else
switch (friendlyName.ToLower())
diff --git a/src/Ninject/Infrastructure/Language/ExtensionsForICustomAttributeProvider.cs b/src/Ninject/Infrastructure/Language/ExtensionsForICustomAttributeProvider.cs
index 565e9540..0ef50c59 100644
--- a/src/Ninject/Infrastructure/Language/ExtensionsForICustomAttributeProvider.cs
+++ b/src/Ninject/Infrastructure/Language/ExtensionsForICustomAttributeProvider.cs
@@ -16,13 +16,13 @@ namespace Ninject.Infrastructure.Language
using System;
using System.Reflection;
-#if WINRT
+#if WINRT || DOTNET
using Ninject.Planning.Targets;
#endif
internal static class ExtensionsForICustomAttributeProvider
{
-#if !WINRT
+#if !WINRT && !DOTNET
public static bool HasAttribute(this ICustomAttributeProvider member, Type type)
{
diff --git a/src/Ninject/Infrastructure/StandardScopeCallbacks.cs b/src/Ninject/Infrastructure/StandardScopeCallbacks.cs
index 41153922..323aa7e8 100644
--- a/src/Ninject/Infrastructure/StandardScopeCallbacks.cs
+++ b/src/Ninject/Infrastructure/StandardScopeCallbacks.cs
@@ -29,7 +29,7 @@ public class StandardScopeCallbacks
///
public static readonly Func Singleton = ctx => ctx.Kernel;
-#if !PCL && !WINRT
+#if !PCL && !WINRT && !DOTNET
///
/// Gets the callback for thread scope.
///
diff --git a/src/Ninject/Injection/DynamicMethodInjectorFactory.cs b/src/Ninject/Injection/DynamicMethodInjectorFactory.cs
index 4bee6f7d..f93f00fc 100644
--- a/src/Ninject/Injection/DynamicMethodInjectorFactory.cs
+++ b/src/Ninject/Injection/DynamicMethodInjectorFactory.cs
@@ -45,7 +45,7 @@ public ConstructorInjector Create(ConstructorInfo constructor)
EmitLoadMethodArguments(il, constructor);
il.Emit(OpCodes.Newobj, constructor);
-#if !WINRT
+#if !WINRT && !DOTNET
if (constructor.ReflectedType.IsValueType)
il.Emit(OpCodes.Box, constructor.ReflectedType);
#else
@@ -159,7 +159,7 @@ private static void EmitMethodCall(ILGenerator il, MethodInfo method)
private static void EmitUnboxOrCast(ILGenerator il, Type type)
{
OpCode opCode = type
-#if WINRT
+#if WINRT || DOTNET
.GetTypeInfo()
#endif
.IsValueType ? OpCodes.Unbox_Any : OpCodes.Castclass;
diff --git a/src/Ninject/Modules/AssemblyNameRetriever.cs b/src/Ninject/Modules/AssemblyNameRetriever.cs
index 476cc1b2..994968c6 100644
--- a/src/Ninject/Modules/AssemblyNameRetriever.cs
+++ b/src/Ninject/Modules/AssemblyNameRetriever.cs
@@ -30,7 +30,7 @@ namespace Ninject.Modules
using Ninject.Components;
-#if WINRT
+#if WINRT || DOTNET
using System.Threading.Tasks;
#endif
@@ -46,17 +46,17 @@ public class AssemblyNameRetriever : NinjectComponent, IAssemblyNameRetriever
/// The filter.
/// All assembly names of the assemblies in the given files that match the filter.
public
-#if !WINRT
+#if !WINRT && !DOTNET
IEnumerable
#else
- System.Threading.Tasks.Task>
+ System.Threading.Tasks.Task>
#endif
- GetAssemblyNames(IEnumerable filenames, Predicate filter)
+ GetAssemblyNames(IEnumerable filenames, Predicate filter)
{
#if PCL
throw new NotImplementedException();
#else
-#if !WINRT
+#if !WINRT && !DOTNET
var assemblyCheckerType = typeof(AssemblyChecker);
var temporaryDomain = CreateTemporaryAppDomain();
try
@@ -66,12 +66,15 @@ public class AssemblyNameRetriever : NinjectComponent, IAssemblyNameRetriever
assemblyCheckerType.FullName ?? string.Empty);
return checker.GetAssemblyNames(filenames.ToArray(), filter);
+#elif DOTNET
+ var checker = new AssemblyCheckerDotNet();
+ return checker.GetAssemblyListAsync(filenames, filter);
#else
var checker = new AssemblyCheckerWinRT();
return checker.GetAssemblyListAsync(filenames.ToArray(), filter);
#endif
-#if !WINRT
+#if !WINRT && !DOTNET
}
finally
{
@@ -82,7 +85,7 @@ public class AssemblyNameRetriever : NinjectComponent, IAssemblyNameRetriever
}
#if !PCL
-#if !WINRT
+#if !WINRT && !DOTNET
///
/// Creates a temporary app domain.
///
@@ -141,6 +144,38 @@ public IEnumerable GetAssemblyNames(IEnumerable filenames,
}
}
+ return result;
+ }
+ }
+#elif DOTNET
+ private sealed class AssemblyCheckerDotNet
+ {
+ public async Task> GetAssemblyListAsync(IEnumerable filenames, Predicate filter)
+ {
+ await Task.Yield(); // to get rid of CS1998 warning: ...lacks 'await' operators...
+ var result = new List();
+ foreach (var filename in filenames)
+ {
+ Assembly assembly = null;
+ if (File.Exists(filename))
+ {
+ try
+ {
+ string simpleName = Path.GetFileNameWithoutExtension(filename);
+ assembly = Assembly.Load(new AssemblyName(simpleName));
+ }
+ catch (BadImageFormatException)
+ {
+ continue;
+ }
+ }
+
+ if (filter(assembly))
+ {
+ result.Add(new AssemblyName() { Name = assembly.GetName().Name });
+ }
+ }
+
return result;
}
}
diff --git a/src/Ninject/Modules/CompiledModuleLoaderPlugin.cs b/src/Ninject/Modules/CompiledModuleLoaderPlugin.cs
index b7512b52..e834cc77 100644
--- a/src/Ninject/Modules/CompiledModuleLoaderPlugin.cs
+++ b/src/Ninject/Modules/CompiledModuleLoaderPlugin.cs
@@ -77,7 +77,7 @@ public IEnumerable SupportedExtensions
///
/// The names of the files to load modules from.
public
-#if !WINRT
+#if !WINRT && !DOTNET
void
#else
async System.Threading.Tasks.Task
@@ -88,7 +88,7 @@ async System.Threading.Tasks.Task
throw new NotImplementedException();
#else
var assembliesWithModules =
-#if WINRT
+#if WINRT || DOTNET
await
#endif
this.assemblyNameRetriever.GetAssemblyNames(filenames, asm => asm.HasNinjectModules());
diff --git a/src/Ninject/Modules/IAssemblyNameRetriever.cs b/src/Ninject/Modules/IAssemblyNameRetriever.cs
index d54ea216..270eead6 100644
--- a/src/Ninject/Modules/IAssemblyNameRetriever.cs
+++ b/src/Ninject/Modules/IAssemblyNameRetriever.cs
@@ -39,7 +39,7 @@ public interface IAssemblyNameRetriever : INinjectComponent
/// The filenames.
/// The filter.
/// All assembly names of the assemblies in the given files that match the filter.
-#if !WINRT
+#if !WINRT && !DOTNET
IEnumerable
#else
System.Threading.Tasks.Task>
diff --git a/src/Ninject/Modules/IModuleLoader.cs b/src/Ninject/Modules/IModuleLoader.cs
index 26bed80c..c4a6688f 100644
--- a/src/Ninject/Modules/IModuleLoader.cs
+++ b/src/Ninject/Modules/IModuleLoader.cs
@@ -27,7 +27,7 @@ public interface IModuleLoader : INinjectComponent
///
/// The patterns to search.
-#if !WINRT
+#if !WINRT && !DOTNET
void
#else
System.Threading.Tasks.Task
diff --git a/src/Ninject/Modules/IModuleLoaderPlugin.cs b/src/Ninject/Modules/IModuleLoaderPlugin.cs
index 77863815..22aae7a0 100644
--- a/src/Ninject/Modules/IModuleLoaderPlugin.cs
+++ b/src/Ninject/Modules/IModuleLoaderPlugin.cs
@@ -30,7 +30,7 @@ public interface IModuleLoaderPlugin : INinjectComponent
/// Loads modules from the specified files.
///
/// The names of the files to load modules from.
-#if !WINRT
+#if !WINRT && !DOTNET
void
#else
System.Threading.Tasks.Task
diff --git a/src/Ninject/Modules/ModuleLoader.cs b/src/Ninject/Modules/ModuleLoader.cs
index f050ed3f..773ecdad 100644
--- a/src/Ninject/Modules/ModuleLoader.cs
+++ b/src/Ninject/Modules/ModuleLoader.cs
@@ -45,7 +45,7 @@ public ModuleLoader(IKernelConfiguration kernelConfiguration)
///
/// The patterns to search.
public
-#if !WINRT
+#if !WINRT && !DOTNET
void
#else
async System.Threading.Tasks.Task
@@ -58,7 +58,7 @@ async System.Threading.Tasks.Task
var plugins = KernelConfiguration.Components.GetAll();
var fileGroups = patterns
-#if !WINRT
+#if !WINRT && !DOTNET
.SelectMany(pattern => GetFilesMatchingPattern(pattern))
.GroupBy(filename => Path.GetExtension(filename).ToLowerInvariant());
#else
@@ -71,7 +71,7 @@ async System.Threading.Tasks.Task
IModuleLoaderPlugin plugin = plugins.Where(p => p.SupportedExtensions.Contains(extension)).FirstOrDefault();
if (plugin != null)
-#if WINRT
+#if WINRT || DOTNET
await
#endif
plugin.LoadModules(fileGroup);
@@ -81,14 +81,14 @@ async System.Threading.Tasks.Task
#endif
#if !PCL
-#if WINRT
+#if WINRT || DOTNET
private static string GetExtension(string filename)
{
var i = filename.LastIndexOf('.');
return filename.Substring(i);
}
#endif
-#if !WINRT
+#if !WINRT && !DOTNET
private static IEnumerable GetFilesMatchingPattern(string pattern)
{
return NormalizePaths(Path.GetDirectoryName(pattern))
diff --git a/src/Ninject/Planning/Bindings/BindingConfigurationBuilder.cs b/src/Ninject/Planning/Bindings/BindingConfigurationBuilder.cs
index f4685aed..12f23dc3 100644
--- a/src/Ninject/Planning/Bindings/BindingConfigurationBuilder.cs
+++ b/src/Ninject/Planning/Bindings/BindingConfigurationBuilder.cs
@@ -432,7 +432,7 @@ public IBindingNamedWithOrOnSyntax InTransientScope()
return this;
}
-#if !PCL && !WINRT
+#if !PCL && !WINRT && !DOTNET
///
/// Indicates that instances activated via the binding should be re-used within the same thread.
///
@@ -525,6 +525,12 @@ public IBindingWithOrOnSyntax WithConstructorArgument(Type type, Func callback(context));
}
+ ///
+ /// Indicates that the specified constructor argument should be overridden with the specified value.
+ ///
+ /// Specifies the argument type to override.
+ /// The callback to invoke to get the value for the argument.
+ /// The fluent syntax.
public IBindingWithOrOnSyntax WithConstructorArgument(Func callback)
{
return this.WithConstructorArgument(typeof(TValue), (context, target) => callback(context));
@@ -542,6 +548,12 @@ public IBindingWithOrOnSyntax WithConstructorArgument(Type type, Func
+ /// Indicates that the specified constructor argument should be overridden with the specified value.
+ ///
+ /// Specifies the argument type to override.
+ /// The callback to invoke to get the value for the argument.
+ /// The fluent syntax.
public IBindingWithOrOnSyntax WithConstructorArgument(Func callback)
{
this.WithConstructorArgument(typeof (TValue), callback);
diff --git a/src/Ninject/Planning/Planner.cs b/src/Ninject/Planning/Planner.cs
index bb45d7af..275b4eb1 100644
--- a/src/Ninject/Planning/Planner.cs
+++ b/src/Ninject/Planning/Planner.cs
@@ -37,10 +37,10 @@ namespace Ninject.Planning
///
public class Planner : NinjectComponent, IPlanner
{
-#if !WINRT && !PCL
+#if !WINRT && !PCL && !DOTNET
private readonly ReaderWriterLock plannerLock = new ReaderWriterLock();
#elif !PCL
- private readonly ReaderWriterLockSlim plannerLock = new ReaderWriterLockSlim();
+ private readonly ReaderWriterLockSlim plannerLock = new ReaderWriterLockSlim();
#endif
private readonly Dictionary plans = new Dictionary();
@@ -68,8 +68,8 @@ public IPlan GetPlan(Type type)
#if PCL
throw new NotImplementedException();
#else
-
-#if !WINRT
+
+#if !WINRT && !DOTNET
this.plannerLock.AcquireReaderLock(Timeout.Infinite);
#else
this.plannerLock.EnterUpgradeableReadLock();
@@ -81,7 +81,7 @@ public IPlan GetPlan(Type type)
}
finally
{
-#if !WINRT
+#if !WINRT && !DOTNET
this.plannerLock.ReleaseReaderLock();
#else
this.plannerLock.ExitUpgradeableReadLock();
@@ -111,7 +111,7 @@ private IPlan CreateNewPlan(Type type)
#if PCL
throw new NotImplementedException();
#else
-#if !WINRT
+#if !WINRT && !DOTNET
var lockCookie = this.plannerLock.UpgradeToWriterLock(Timeout.Infinite);
#else
this.plannerLock.EnterWriteLock();
@@ -132,7 +132,7 @@ private IPlan CreateNewPlan(Type type)
}
finally
{
-#if !WINRT
+#if !WINRT && !DOTNET
this.plannerLock.DowngradeFromWriterLock(ref lockCookie);
#else
this.plannerLock.ExitWriteLock();
diff --git a/src/Ninject/Planning/Targets/ParameterTarget.cs b/src/Ninject/Planning/Targets/ParameterTarget.cs
index 5b8adbba..000303cb 100644
--- a/src/Ninject/Planning/Targets/ParameterTarget.cs
+++ b/src/Ninject/Planning/Targets/ParameterTarget.cs
@@ -11,7 +11,7 @@
using System;
using System.Reflection;
using Ninject.Infrastructure;
-#if WINRT
+#if WINRT || DOTNET
using Ninject.Infrastructure.Language;
using System.Collections.Generic;
#endif
@@ -24,7 +24,7 @@ namespace Ninject.Planning.Targets
/// Represents an injection target for a .
///
public class ParameterTarget :
-#if !WINRT
+#if !WINRT && !DOTNET
Target
#else
Target
@@ -60,7 +60,7 @@ public override bool HasDefaultValue
#if PCL
throw new NotImplementedException();
#else
-#if WINRT
+#if WINRT || DOTNET
var val = defaultValue.Value;
if (val != null)
@@ -94,19 +94,19 @@ public override object DefaultValue
/// The method that defines the parameter.
/// The parameter that this target represents.
public ParameterTarget(MethodBase method, ParameterInfo site) : base(method
-#if !WINRT
+#if !WINRT && !DOTNET
, site
#endif
)
{
defaultValue = new Future