TL;DR
Avast antivirus sometimes incorrectly flags your own code as a threat. This guide shows you how to add exceptions (whitelists) in Avast so it stops bothering you, and how to check what’s triggering the alerts.
Why is this happening?
When you write code, especially if it interacts with the system or network, Avast might see it as suspicious. This is because malicious software often does similar things. It’s a false positive – Avast thinks something’s wrong when it isn’t.
How to Fix It
- Add Your Code Folder to the Exception List: This tells Avast to ignore everything in that folder.
- Open Avast Antivirus.
- Go to Menu > Settings.
- Click on General > Exceptions.
- Click Add Exception.
- Select ‘Folder’.
- Browse to the folder where your code is stored and select it.
- Click OK, then Save Changes.
- Add Specific Files to the Exception List: If you only want to exclude certain files (e.g., a compiled executable).
- Repeat steps above, but select ‘File’ instead of ‘Folder’.
- Browse to and select the specific file.
- Click OK, then Save Changes.
- Temporarily Disable Avast (Use with Caution!): This is a quick test to confirm if Avast is causing the problem.
- Right-click the Avast icon in your system tray.
- Select ‘Avast shields control’.
- Choose how long you want to disable protection (e.g., 10 minutes, 1 hour).
- Important: Re-enable Avast as soon as possible after testing!
If your code runs fine with Avast disabled, it confirms the antivirus is interfering.
- Check Avast’s Virus Chest: Sometimes Avast moves files it thinks are threats to a ‘Virus Chest’. You can restore them if they’re false positives.
- Open Avast Antivirus.
- Go to Protection > Virus Chest.
- If you find your file, select it and click Restore.
- Avast may ask if you trust the file – choose ‘Trust this file’.
- Submit a False Positive Report to Avast: Help improve Avast by letting them know about incorrect detections.
- If your file was incorrectly flagged, right-click it in Virus Chest (or wherever Avast alerted you).
- Select ‘Report as false positive’.
- Follow the on-screen instructions.
Advanced Troubleshooting
If adding exceptions doesn’t work, consider these points:
- Code Signing: If you distribute your code, signing it with a digital certificate can help Avast (and other antivirus programs) verify its authenticity.
- Network Connections: If your code makes network connections, ensure those connections are legitimate and not blocked by firewalls or other security software.
- Check Your Code for Suspicious Patterns: While unlikely if it’s *your* code, review it for anything that might resemble malicious activity (e.g., attempts to modify system files without a good reason).