Page 1 of 1

GetManifestResourceStream returns Nothing (null)

Posted: Sat May 03, 2014 2:06 am
by sanyock
Hello,

Following code works fine outside of Enigma in a ILmerged assembly, but after Enigma it fails to read a resource

Function AddMappingFromMergedExecutableResource(ByVal Cfg As NHibernate.Cfg.Configuration, ByVal BLNamespace As String)
Dim MergedExecutable = Assembly.GetExecutingAssembly
MsgBox("MergedExecutable: " & MergedExecutable.ToString)

Dim ResourceName = BLNamespace & ".HibernatedObjects.hbm.xml"
MsgBox("ResourceName: " & ResourceName)

Dim Stream As System.IO.Stream = MergedExecutable.GetManifestResourceStream(ResourceName)
MsgBox("Stream: " & TypeName(Stream))


Dim MappingText = New IO.StreamReader(Stream).ReadToEnd()

'Replace in <hibernate-mapping xxx assembly="Aulix.Common7.BL" xxx>
Dim RegEx = CreateRegex("(?<Before>[<\s].*assembly="")(?<AN>[\S]*)(?<After>"".*[>\s])")
MappingText = RegEx.Replace(MappingText, "${Before}" & MergedExecutable.FullName & "${After}")

Cfg.AddXml(MappingText)
End Function

Please let me know your suggestions

Re: GetManifestResourceStream returns Nothing (null)

Posted: Mon May 05, 2014 11:05 am
by Enigma
Hi sanyock, can you please post here compiled executable with the sources that reproduces the problem?

Re: GetManifestResourceStream returns Nothing (null)

Posted: Mon May 05, 2014 1:50 pm
by sanyock
Hi Vladimir,

The problem has been solved

Please let me know, when do you plan to release a new version with "Tagant" feature or something like this to make executables antivirus friendly?