If we assume that the law is being followed to the letter, for a situation like this to arise, something about the discovery has to be illegal.
Discovering that someone had committed a crime basically means acquiring certain information about their actions. There's two ways in which this could be illegal:
The crime is such that any evidence includes information which is illegal to possess.
* The heroine discovers that the prince has been carrying out some dark ritual and memorizes the procedure. If any woman who knows how to perform mystical rituals is considered a witch, she has now officially become one.
* Or the fact that she recognized it as a dark ritual (say, it was performed in public, but perceived by everyone as an innocuous action) incriminates her.
* The crime involved some kind of secret government information, which is crucial for national security. 821
Or the action itself is secret government information. In which case possessing such information without proper clearance could be considered evidence of espionage.
The evidence has been / could only have been obtained in an illegal way
* The crime in question has been carried out in a private room inside the royal palace and our heroine witnesses it. In that case she has to have also been in/near that room, which is presumably off-limits to everyone but a select few.
* It happened at night, while it is forbidden to be out at night.
* The evidence was the prince talking in another room, and she could only have heard it if she were eavesdropping at the door, which is probably frowned upon.
* The evidence is written down in a forbidden/restricted book. It might even be just written in a book, if reading in general is somehow restricted to a certain circle of which our heroine is not a member of.
* The evidence is a certain object belonging to the prince, or something about that object.
* The act of taking it may be considered stealing from the crown
* Examining it may be likewise illegal
* Reporting the find to anyone but the crown may be considered a violation of a citizen's duty
* as above, the object may have been found in a location which is off-limits to the public. 821