SBarnes wrote:Do you have any other ideas?
Either post here or email me a plugin which exhibits the issue and I'll be able to work it out.
I suspect it's something quirky with the Assembly - we had that with one of the ServiceStack assemblies at one point, so we resorted to deploying those with the application - it was something to do with signed assemblies in that case.
For reference, this is the code we use to attempt to resolve embedded references:
- Code: Select all
Public Sub ResolveReference()
If EmbeddedReferenceCollection IsNot Nothing AndAlso EmbeddedReferenceCollection.Plugin IsNot Nothing Then
Try
' Extract binary to plugin location
' It is possible the folder we need to write to does not exist yet - so we may need to create it first.
If System.IO.Directory.Exists(EmbeddedReferenceCollection.Plugin.CompilationFolder) = False Then
System.IO.Directory.CreateDirectory(EmbeddedReferenceCollection.Plugin.CompilationFolder)
End If
Dim pathAndFileName As String = System.IO.Path.Combine(EmbeddedReferenceCollection.Plugin.CompilationFolder, AssemblyName)
Dim FileStream As System.IO.FileStream = Nothing
Try
If System.IO.File.Exists(pathAndFileName) Then
System.IO.File.Delete(pathAndFileName)
End If
FileStream = New System.IO.FileStream(pathAndFileName, System.IO.FileMode.Create)
FileStream.Write(FileBinary, 0, FileBinary.Length)
Catch fileWriteException As Exception
'Debug.WriteLine(fileWriteException.Message)
Finally
If Not FileStream Is Nothing Then
FileStream.Flush()
FileStream.Close()
End If
End Try
If System.IO.File.Exists(pathAndFileName) Then
Dim Assembly As System.Reflection.Assembly
Assembly = System.Reflection.Assembly.LoadFile(pathAndFileName)
Assembly = System.Reflection.Assembly.Load(Assembly.FullName) ' Need to load using FullName otherwise we might get an exception on GetCustomAttribute further down in this method
AssemblyName = Assembly.ManifestModule.Name
_AssemblyLocation = Assembly.Location
_RuntimeVersion = Assembly.ImageRuntimeVersion
_AssemblyFullName = Assembly.FullName
Resolved = True
Try
Dim objDescriptionAttribute As System.Reflection.AssemblyDescriptionAttribute = System.Reflection.AssemblyDescriptionAttribute.GetCustomAttribute(Assembly, GetType(System.Reflection.AssemblyDescriptionAttribute))
If Not objDescriptionAttribute Is Nothing Then
_Description = objDescriptionAttribute.Description
End If
Dim objVersionAttribute As System.Reflection.AssemblyFileVersionAttribute = System.Reflection.AssemblyFileVersionAttribute.GetCustomAttribute(Assembly, GetType(System.Reflection.AssemblyFileVersionAttribute))
If Not (objVersionAttribute Is Nothing) Then
_FileVersion = objVersionAttribute.Version
End If
Catch metaDataException As Exception
' swallow
'Console.WriteLine(metaDataException.Message)
End Try
End If
Catch ex As Exception
' swallow failures to resolve
_AssemblyFullName = ex.Message
End Try
End If
End Sub
I'm really leaning now towards providing the debug symbols for our assemblies to assist developers with these kind of issues.