Debugging System.TypeLoadException - mono

I'm trying to compile Boo on the mono-4.0 Nant profile and am getting the following error, which I'm having trouble debugging.
booi:
Invalid type Boo.Lang.Compiler.CompilerParameters for instance field Boo.Lang.Compiler.CompilerContext:_parameters
Missing method .ctor in assembly /Users/tristanz/Projects/boo/build/Boo.Lang.Compiler.dll, type System.Security.SecurityRulesAttribute
Can't find custom attr constructor image: /Users/tristanz/Projects/boo/build/Boo.Lang.Compiler.dll mtoken: 0x0a00097b
BUILD FAILED - 0 non-fatal error(s), 2 warning(s)
INTERNAL ERROR
System.TypeLoadException: Could not load type 'System.Security.SecurityRulesAttribute' from assembly 'Boo.Lang.Compiler'.
at Boo.NAnt.BooTask.ExecuteTask () [0x00000] in <filename unknown>:0
at NAnt.Core.Task.Execute () [0x00000] in <filename unknown>:0
Any thoughts would be greatly appreciated.

The problem is that NAnt itself must run under 4. for the BooTask to correctly work, so mono --runtime=v4.0 is the fix.

Related

How to fix 'UnityEngine.UI.dll is not allowed to be included or could not' in Unity?

This errors occur on Build, even with an empty project:
ArgumentException: The Assembly UnityEditor is referenced by UnityEngine.UI ('F:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/Standalone/UnityEngine.UI.dll'). But the dll is not allowed to be included or could not be found.
UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1[T] alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2[TKey,TValue] cache, UnityEditor.BuildTarget target) (at C:/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:150)
UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1[T] alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2[TKey,TValue] cache, UnityEditor.BuildTarget target) (at C:/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:156)
UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch, UnityEditor.BuildTarget target) (at C:/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:190)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
I have tried changing the Api Compatibility Level as suggested in some forums and stack overflow questions, but nothing seems to work.
Looks like not getting any references of UnityEditor.dll try adding it in dependency.

NServiceBus - Scanning all assemblies

NServiceBus.dll - Version 5.2.9 & NServiceBus.Host - Version 6.0.0
I am developing a workflow application with pluggable addins.
In my solution I have a NServiceBus host assembly which I host using the NServiceBus.Host.exe. To prevent scanning I have defined the EndpointConfigurationType in the NServiceBus.Host.exe.config.
<appSettings>
<add key="EndpointConfigurationType" value="Libra.Workflow.Host.EndpointConfig, Libra.Workflow.Host" />
</appSettings>
I have verified that this config is being used because if I put some unknown type I get an error and also because me EndpointConfig class is instantiated before any scanning happens.
In the Customize method of this class I have added
public void Customize(BusConfiguration cfg)
{
cfg.AssembliesToScan(AllAssemblies.Matching("Libra.Workflow.Messages.dll"));
...
}
Now when I run this project I get an error because NServiceBus is scanning all assemblies and do to the nature of System.AddIn some assemblies cannot be scanned!
This scanning happens right after Libra.Workflow.Host has been instantiated but before the Customize method is called. Here is the call stack for this scan:
at NServiceBus.Hosting.Helpers.AssemblyScanner.ScanAssembly(String assemblyPath, AssemblyScannerResults results) in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Hosting\Helpers\AssemblyScanner.cs:line 153
at NServiceBus.Hosting.Helpers.AssemblyScanner.GetScannableAssemblies() in C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Hosting\Helpers\AssemblyScanner.cs:line 63
at NServiceBus.GenericHost..ctor(IConfigureThisEndpoint specifier, String[] args, List`1 defaultProfiles, String endpointName, IEnumerable`1 scannableAssembliesFullName) in c:\BuildAgent\work\a3de8759ee491634\src\NServiceBus.Hosting.Windows\GenericHost.cs:line 33
at NServiceBus.Hosting.Windows.WindowsHost..ctor(Type endpointType, String[] args, String endpointName, IEnumerable`1 scannableAssembliesFullName) in c:\BuildAgent\work\a3de8759ee491634\src\NServiceBus.Hosting.Windows\WindowsHost.cs:line 21
at NServiceBus.Hosting.Windows.HostServiceLocator.DoGetInstance(Type serviceType, String key) in c:\BuildAgent\work\a3de8759ee491634\src\NServiceBus.Hosting.Windows\HostServiceLocator.cs:line 31
at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) in c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs:line 49
The error message I get is:
Could not enumerate all types for
'C:\msc\Trunk\Libra.Workflow\Build\Libra.Workflow.Host\AddIns\Libra.Workflow\Libra.Workflow.Processors.dll'
Why is NServiceBus scanning this DLL and how can I prevent it?
Note: Since this is an AddIn DLL, there isn't even a reference to it in the Libra.Workflow.Host nor any other related assemblies so there should be absolutely no reason for NServiceBus to have to touch it.
One way of limiting assembly scanning done by NServiceBus.Host is to use the /scannedAssemblies switch. One caveat is to pass NServiceBus.Core and NServiceBus.Host assemblies explicitly:
NServiceBus.Host.exe /scannedAssemblies:"NServiceBus.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c" /scannedAssemblies:"NServiceBus.Host, Version=6.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c"
This command will scan those NServiceBus assemblies and the assembly specified via EndpointConfigurationType app setting. If you want to specify additional assemblies (like your Libra.Workflow.Messages) you may add additional /scannedAssemblies switch.
Please see this documentation page for details: http://docs.particular.net/nservicebus/hosting/nservicebus-host/#configuring-the-endpoint-controlling-assembly-scanning-using-the-command-line.

Raven.Server.exe exception

I've never used RavenDb it looks interesting but I'm falling at the first hurdle.
I've downloaded, unzipped and I run C:\RavenDB\Server\Raven.Server.exe
and it flashes up and disappears.
I tried running from a dos prompt and I got this exception:
C:\RavenDB\Server>Raven.Server.exe
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the
requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.Assembly.GetTypes()
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog
()
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetExports(Impor
tDefinition definition)
at System.ComponentModel.Composition.Hosting.AggregateCatalog.GetExports(Impo
rtDefinition definition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExports
Core(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(Import
Definition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.AggregateExportProvider.GetExpor
tsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore
(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1
& exports)
at System.ComponentModel.Composition.Hosting.CompositionContainer.GetExportsC
ore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(Import
Definition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ImportEngine.TryGetExports(Expor
tProvider provider, ComposablePart part, ImportDefinition definition, AtomicComp
osition atomicComposition)
at System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImportSub
set(PartManager partManager, IEnumerable`1 imports, AtomicComposition atomicComp
osition)
at System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImportsSt
ateMachine(PartManager partManager, ComposablePart part)
at System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImports(P
artManager partManager, ComposablePart part, Boolean shouldTrackImports)
at System.ComponentModel.Composition.Hosting.ImportEngine.SatisfyImportsOnce(
ComposablePart part)
at System.ComponentModel.Composition.AttributedModelServices.SatisfyImportsOn
ce(ICompositionService compositionService, Object attributedPart)
at Raven.Database.DocumentDatabase..ctor(InMemoryRavenConfiguration configura
tion)
at Raven.Server.RavenDbServer..ctor(RavenConfiguration settings)
at Raven.Server.Program.RunServer(RavenConfiguration ravenConfiguration)
at Raven.Server.Program.RunInDebugMode(Nullable`1 anonymousUserAccessMode, Ra
venConfiguration ravenConfiguration)
at Raven.Server.Program.InteractiveRun(String[] args)
at Raven.Server.Program.Main(String[] args)
- - - -
System.TypeLoadException: Method 'WriteJson' in type 'JsonToJsonConverter' from
assembly 'Raven.Http, Version=1.0.0.0, Culture=neutral, PublicKeyToken=37f41c7f9
9471593' does not have an implementation.
C:\RavenDB\Server>
I'm a total nub when it comes to this software.
Any ideas ?
Thanks
It seems to be an issue with version 206 I've gone back to 193 and it works fine.

Ninject Intermittent exception thrown related to OnePerRequestModule

I just upgraded an existing implementation of Ninject from 1.5 to 2.0. I'm now seeing an intermittent exception getting thrown when many requests are happening in a short period of time.
Here's the exception that is being thrown.
Type: System.ArgumentException
Message: An item with the same key has already been added.
Source: Ninject
Stack Trace: at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at Ninject.Components.ComponentContainer.CreateNewInstance(Type component, Type implementation)
at Ninject.Components.ComponentContainer.ResolveInstance(Type component, Type implementation)
at Ninject.Components.ComponentContainer.Get(Type component)
at Ninject.Components.ComponentContainer.<CreateNewInstance>b__6(ParameterInfo parameter)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Ninject.Components.ComponentContainer.CreateNewInstance(Type component, Type implementation)
at Ninject.Components.ComponentContainer.ResolveInstance(Type component, Type implementation)
at Ninject.Components.ComponentContainer.Get(Type component)
at Ninject.Components.ComponentContainer.GetT
at Ninject.KernelBase.CreateContext(IRequest request, IBinding binding)
at Ninject.KernelBase.<>c__DisplayClassa.<Resolve>b__6(IBinding binding)
at System.Linq.Enumerable.<>c__DisplayClass12`3.<CombineSelectors>b__11(TSource x)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.<CastIterator>d__aa`1.MoveNext()
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
at Ninject.ResolutionExtensions.Get[T](IResolutionRoot root, IParameter[] parameters)
at NameOfConsumingSite.Application_BeginRequest(Object sender, EventArgs e)...
The exception does not get thrown if I remove the OnePerRequestModule item from httpModules in web.config, but that is adding a ton of overhead.
I thank anyone in advance if they can help!
There was a multithreading problem. Try to use the 2.2 RC1 found at https://github.com/ninject . Please tell me if this problem still occurs with this version to make sure we have no further issue we have to fix before release.

Problems with Castle DynamicProxy2 on .Net 3.5 SP1 on Win2003 Server

I've an mvc + nh asp.net application. On my dev machine (win 7 Ent) all works fine, if deployed on a Win 2k3 (tried 2 different vm and one phisical machine) I got the following error..
anyone can help? Cannot explain this issue (tried the same build, so i think it'a machine configuration issue)..
Derived method 'set_ID' in type 'CustomerProxy75950979a2a048e889584c21696f7f1b' from assembly 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' cannot reduce access
[TypeLoadException: Derived method 'set_ID' in type 'CustomerProxy75950979a2a048e889584c21696f7f1b' from assembly 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' cannot reduce access.]
System.Reflection.Emit.TypeBuilder._TermCreateClass(Int32 handle, Module module) +0
System.Reflection.Emit.TypeBuilder.CreateTypeNoLock() +915
System.Reflection.Emit.TypeBuilder.CreateType() +108
Castle.DynamicProxy.Generators.Emitters.AbstractTypeEmitter.BuildType() +48
Castle.DynamicProxy.Generators.ClassProxyGenerator.GenerateCode(Type[] interfaces, ProxyGenerationOptions options) +3821
Castle.DynamicProxy.DefaultProxyBuilder.CreateClassProxy(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options) +84
Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type classToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options, Object[] constructorArguments, IInterceptor[] interceptors) +92
Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type classToProxy, Type[] additionalInterfacesToProxy, IInterceptor[] interceptors) +21
NHibernate.ByteCode.Castle.ProxyFactory.GetProxy(Object id, ISessionImplementor session) +283
found the issue. I had a duplicate property in my derived class (same as the base class defined with a template).
just had this error, and again this issue was having a duplicate property of id in my derived classes.