GetManifestResourceStream returns Nothing (null)

Post here messages if you have any problems with working of Enigma Protector
Post Reply
sanyock
Posts: 60
Joined: Sat May 12, 2012 7:36 am
Contact:

GetManifestResourceStream returns Nothing (null)

Post 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
Enigma
Site Admin
Posts: 3085
Joined: Wed Aug 20, 2008 2:24 pm

Re: GetManifestResourceStream returns Nothing (null)

Post by Enigma »

Hi sanyock, can you please post here compiled executable with the sources that reproduces the problem?
sanyock
Posts: 60
Joined: Sat May 12, 2012 7:36 am
Contact:

Re: GetManifestResourceStream returns Nothing (null)

Post 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?
Post Reply