Domanda

Sembra che abbia commesso un errore piuttosto grande quando fai alcuni test con un progetto di SharePoint di esempio. Ironia della sorte, stavo cercando di raccogliere una soluzione testabile unitario, senza scrivere prima molti dei test. Sono ancora abbastanza nuovo per Sharepoint, e volevo esplorare cosa posso / non posso fare con SP e IOC.

Quindi senza entrare in troppi dettagli, ho scritto accidentalmente qualche codice che è ricorsivo e finisce per lanciare un stackoverflowexception. Non è un grosso problema, giusto? Basta ritrarre la soluzione e rimuoverlo. Il problema è che questo codice viene chiamato durante il metodo FeatureUninstalling della funzione di soluzione in un SPFeatureReceiver.

(beh, non esattamente. Il codice finisce per essere chiamato durante il costruttore statico del SPFeatureReceiver. Se ti stai chiedendo perché, stavo cercando di comporre la radice usando il windsore del castello per iniettare le dipendenze che possono essere utilizzate durante la lungometraggio e featureSinstalling Methods.)

Quindi cosa succede quando si cerca di utilizzare l'amministratore centrale o la disinstallazione-spsolution è:

    .
  1. Un lavoro è programmato per ritrarre la soluzione.
  2. Il lavoro esegue e tenta di ritrarre la soluzione.
  3. Il lavoro costruisce un nuovo SPFeatureReceiver per richiamare la featureSinstalling.
  4. Il costruttore SpfeatureReceCeiver (Static) richiama il codice che cercherà di comporre la radice, e nel suo interno, finisce per lanciare un stackoverflowexception.
  5. Ricevo un messaggio popup che indica che OWstimer.exe ha riscontrato un'eccezione e chiede se voglio eseguire il debug.
  6. Owstimer.exe riavvia e loop torna al punto 2.

    Da qui la domanda: come ritrarre una soluzione non irriristabile?

È stato utile?

Soluzione

Have you tried commenting out the offending code, rebuilding/repackaging, and then running an Update-SPSolution command?

The FeatureUninstalling event occurs on removal, and, I believe, it will not be called when upgrading (that's what the FeatureUpgrading event is for).

If you can upgrade successfully and replace the offending code, you would then be able to safely remove the solution.

On second thought, my suggestion above wouldn't work, because if this exception is occurring in the constructor, rather than the event, obviously that would still be called regardless of the solution modification method (Upgrade vs. Uninstall). You could manually replace the .dll in the GAC after removing the offending code though, and then trying a retraction.

Altri suggerimenti

I'd had a similar idea to @RJ Cuthbertson's answer regarding the GAC, but it would not let me uninstall anything from there. Until I found this:

IMPORTANT! Never ever do this on a production system, and always turn it back on afterwards.

  1. Open Local Security Policy MMC

  2. Goto Security Settings -> Local Policies -> Security Options

  3. Locate "User Account Control: Run all administrators in Admin Approval" and change the setting from Enabled to Disabled

  4. Reboot and now the assemblies can be deleted.

  5. Follow steps above to re-enable the local security policy setting and reboot again to reapply it.

After step #4 above I was able to remove Castle.Windsor.dll from the GAC, and after that, the retract / uninstall / remove all worked.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top