0

I am producing a very simple application in VB.Net using VS 2017.

After I have added code to use a message box to get a user response, when I run the app Kaspersky Anti-Virus treats the application as Malware and deletes the '.exe' file.

Dim intResponse1 As Integer = MsgBox("Strip Metadata from selected image?" & vbCr & vbCr & "Warning this cannot be undone!", vbExclamation + vbYesNo, "Strip Metadata")

If I 'REM' the line of code associated with the msgbox it works okay?

This occurs when starting the app? Also the same happens in VS2015.

Has anyone else had this problem?

I am running WIN10x64 build 16299, Kaspersky 170.0.0.611. My VS 2017 is 15.5.6

Thanks

John C
  • 21
  • 7
  • does the messagebox show when the app starts? – Ken Tucker Feb 11 '18 at 13:12
  • Aggressive anti-malware products often get their underwear in a bundle when an executable file seemingly appears from no-where and starts executing immediately. Make an exclusion for your project directories. Or favor the one that comes included with your OS, it never bugs you. – Hans Passant Feb 11 '18 at 13:16
  • Message box does not show when app starts, it should operate on a command button. – John C Feb 11 '18 at 13:35
  • You could submit the application to Kaspersky as a false positive. It might help them to refine their algorithms. – Andrew Morton Feb 11 '18 at 13:35
  • Thanks Hans. Strange thing is that I have quite a few different apps that all have similar message box responses, they all run okay, they are in the same directory? – John C Feb 11 '18 at 13:37
  • Andrew - I have done that and I'm waiting for a response from them. – John C Feb 11 '18 at 13:38
  • I even deleted the original project and re-wrote it, luckily it was almost right at the start of the project! – John C Feb 11 '18 at 13:39
  • I find it odd that it's only when the code is added to the project and not when it's used. – John C Feb 11 '18 at 13:45
  • I tried declaring the 'response' variable within the form Class section, rather than in the command button section and it now works??? – John C Feb 11 '18 at 13:51
  • Dont use leftovers from `vb6`, use the new `MessageBox` class... then all the vb syntax stuff you can rip out. `MsgBox` simply ends up delegating to `MessageBox` anyways, in professional development using old classes for new development is not good practice and frowned upon when there is a new version. – Trevor Feb 11 '18 at 18:08
  • I'm wonder if it might be that your return variable is an integer and the `MsgBox` result is a `MsgBoxResult` enum. Try changing `Dim intResponse1 As Integer` to `Dim intResponse1 As MsgBoxResult`. I know it sounds daft, but what the heck. – David Wilson Feb 11 '18 at 19:51
  • Not that it should have any impact on virus detection, but try adding `Option Strict On` to your files (or use it project wide) also fix _all_ errors and warnings that Visual Studio tells you about... Maybe the detection in Kaspersky is based on seeing late bindings in the IL that is generated. – NiKiZe Feb 11 '18 at 22:54
  • Codexer - I have used the 'MessageBox' class, this runs fine from a command button event procedure. Thanks for the heads up. – John C Feb 12 '18 at 13:00
  • Thank you all for your input, appreciated. – John C Feb 25 '18 at 13:47

1 Answers1

0

Do you still have the problem if you change your VB6 code to the VB.NET equivalent?

Dim Response1 As DialogResult = MessageBox.Show("Strip Metadata from selected image?" & Environment.NewLine & Environment.NewLine & "Warning this cannot be undone!", "Strip Metadata", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
video.baba
  • 817
  • 2
  • 6
  • 11
  • I didn't have the same problem. The odd thing was that as mentioned above when I declared the 'Response' variable outside the button click event it was okay. Subsequently when I have tried to replicate this it doesn't happen??? – John C Feb 25 '18 at 13:46