If your microwave oven is sparking or ‘arcing’ during cooking it may be that the waveguide cover is damaged. Usually the cover is made of a material called mica. Although strong and tough when new, over a period of time this cover absorbs moisture and food debris and becomes soft or breaks. If moisture or food embedded in it starts burning it will go from bad to worse quite quickly and if not replaced can cause irreparable damage to the microwave. It is advisable to replace the cover as soon as possible to prevent damage.
Note: In the interest of safety, please make sure your appliance is unplugged from the mains and that the area you are working in is safe.