I've got an assembly, which works just fine on my own pc, but when I try to reference it on a virtual machine, I'm getting following error:
System.IO.FileNotFoundException: Could not load file or assembly 'X.dll' or one of its ependencies. The specified module could not be found.
File name: 'X.dll'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm,Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at kernelLoader.Program.Main(String[] args)
I'm absolutely sure that the file is at the location specified, and the code works fine on my own machine (where it has been developed). It, together with all referenced assemblies, are compiled for x86 platform.
I think, that the error may be caused by the assembly not being fully trusted.
I can't strong sing the assembly, because it references several assemblies, which are not singed, and to which I don't have the code or the rights to modify.
I suspect that there is a good way of making an assembly trusted on the mashine where I run it.
How do I mark an assembly as trusted so it can be loaded and executed?
That exception is usually caused by a missing dll. One thing that can be used is ProcMon. When the missing dll is loaded and an error is through, the file name should show up in ProcMon.
Related
Every time I compile the project, I get this error. My AssemblyInfo.cs file does not have the attributes ExcelLocale1033 or SecurityTransparent. There is no VisualStudio folder in C:\Program Files (x86)\MSBuild\Microsoft.
The "FindRibbons" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'ProjectName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
File name: 'ProjectName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
Server stack trace:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
Fixed. It's because of a new project that I added to the VSTO solution. This other project's output type (right click project > Properties) used to be Windows Application. I changed that to Class Library and deleted Program.cs which contained this code:
class Program
{
static void Main(string[] args)
{
}
}
The error never showed up again.
For some reason, after recycle, some applications keeps throwing the error below:
Thread was being aborted.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
What is it means ?
It means in your code somewhere a thread is being created that took longer than the shutdown timeout allows to finish its work. That thread had to be forcefully shut down and the way that forceful shutdown is done is via a Thread.Abort() call.
So check your code for infinite while loops or for for loops that have improper ending conditions. However this could just be caused by any slow code that takes more than 30 sec or so to finish its work.
I have a project that worked fine but today i get this error... even when I creating new project i get same message... I can't understand what is the problem...
Error 1 The "CompileXaml" task failed unexpectedly.
System.IO.FileLoadException: Could not load file or assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
File name: 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)
The Zone of the assembly that failed was:
MyComputer
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at Microsoft.Silverlight.Build.Tasks.CompileXaml.LoadSilverlightAssemblies(String[] frameworkPaths)
at Microsoft.Silverlight.Build.Tasks.CompileXaml.GenerateCode(ITaskItem item, Boolean isApplication)
at Microsoft.Silverlight.Build.Tasks.CompileXaml.Execute()
at Microsoft.Build.Framework.ITask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)
Best Answer of Carl Saldanha (read comments)
Need re-installation...
any idea why I am getting this in my logs on startup?
Blockquote
ERROR NHibernate.Util.ReflectHelper - Could not load type MySql.Data.MySqlClient.MySqlConnection, MySql.Data.
System.IO.FileNotFoundException: Could not load file or assembly 'MySql.Data' or one of its dependencies. The system cannot find the file specified.
File name: 'MySql.Data'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName name, Boolean throwOnError) in c:\Users\oskar.berggren\Documents\Projects\nhibernate-core-3\src\NHibernate\Util\ReflectHelper.cs:line 280
Blockquote
but it works perfectly fine. I am using FluentNhibernate to config my app
NHibernate uses DBProviderFactories as a fall back if loaing using reflection does not work. it could be that it logs the failing attempt even when it is able to load it.
Using New Atlanta's BlueDragon.NET implementation of ColdFusion, we have the ability to create instances of C# .NET objects using the cold fusion tag. For example:
<cfobject name="list" type=".net" action="CREATE"
class="System.Collections.ArrayList">
In one case, however, we need to create an instance of a generic type. This works for internal types like System.Int32:
<cfobject name="list" type=".net" action="CREATE"
class="System.Collections.Generic.List`1[[System.Int32]]">
But, when using our own assembly-qualified class, like the following:
namespace Foo.Bar.Bam
{
public class MyClassName
}
that is compiled to the assembly Foo.Bar.dll and used like so:
<cfobject name="list" type=".net" action="CREATE"
class="System.Collections.Generic.List`1[[Foo.Bar.Bam.MyClassName,Foo.Bar]]">
it fails with an "BlueDragon Internal Server Error" with the following stack trace:
java.lang.ClassNotFoundException: Could not load file or assembly 'Foo.Bar]]' or one of its dependencies. The system cannot find the file specified.
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.AppDomain.Load(String assemblyString)
at com.nary.util.ClassUtils.forName(String className)
at com.naryx.tagfusion.cfm.tag.cfOBJECT.render(cfSession session)
at com.naryx.tagfusion.cfm.tag.cfTag.coreRender(cfSession _Session)
at com.naryx.tagfusion.cfm.engine.cfSession.onRequest(cfFile requestFile)
at com.naryx.tagfusion.cfm.engine.cfEngine.service(cfSession _Session)
Without the assembly qualification, it fails with a CFML error:
Failed to load class, System.Collections.Generic.List`1[[Foo.Bar.Bam.MyClassName]]
Is there any way to create an instance of a generic type using ?
You must specify the name of your Assembly (dll) not the keyword Assembly.
Given:
namespace Me
{
public class Foo { }
}
and compiling to MyStuff.Dll; the class would be
class="System.Collections.Generic.List`1[[Me.Foo, MyStuff]]">