There have been some fairly large code changes on moving from
SharpDevelop 2.2 to 3.0 and addins written for 2.2 are unlikely to
work without some modification. We will look at the changes in the
core parts of SharpDevelop and then look at one way to do the
porting.
Not all the differences are covered in the next section just
those types and methods that are likely to have been used by an
addin.
| Type | Description |
|---|
| ICSharpCode.Core.AddInReference |
|
| bool RequirePreload |
New property that specifies that when a type from an addin is
created any addins that are needed by this addin will be
preloaded if this flag is set to true. This corresponds to
the new requirePreload attribute in an .addin file.
<Dependency addin="ICSharpCode.XmlEditor"
requirePreload="true"/> |
| ICSharpCode.Core.AddInTreeNode.TopologicalSort | Type is no longer public. |
| ICSharpCode.Core.FileUtility |
|
| bool IsValidPath(string path) | New method that determines whether a full or relative path
is valid. This replaces the IsValidFileName method. |
| bool IsValidFileName(string
fileName) | Renamed to IsValidPath. |
| static string NormalizePath(string
fileName) | New method that gets the normalized version of the
filename. Slashes are replaced with backslashes, backreferences
"." and ".." are 'evaluated'. |
| ICSharpCode.Core.Properties |
|
| void ReadProperties(XmlReader reader,
string endElement) | Method is no longer public but internal. |
| Type | Description |
|---|
| ICSharpCode.NRefactory.Ast.ArrayInitializerExpression | Replaced by the CollectionInitializerExpression type. |
| ICSharpCode.NRefactory.Ast.BlockStatement |
|
| BlockStatement Null | The Null property now returns a BlockStatement instead of a
NullStatement type. |
| ICSharpCode.NRefactory.Ast.FieldReferenceExpression | Replaced by the MemberReferenceExpression type. |
| ICSharpCode.NRefactory.Ast.MemberReferenceExpression | Replaces the FieldReferenceExpression type. |
| ICSharpCode.NRefactory.Ast.InvocationExpression |
|
| List<TypeReference>
TypeArguments | This property has been removed. |
| ICSharpCode.NRefactory.Ast.NullArrayInitializerExpression | This type has been removed. |
| ICSharpCode.NRefactory.Ast.NullBlockStatement | No longer a public type instead it is now internal. |
|
ICSharpCode.NRefactory.Ast.NullConstructorInitializer | No longer a public type instead it is now internal. |
|
ICSharpCode.NRefactory.Ast.NullEventAddRegion | No longer a public type instead it is now internal. |
|
ICSharpCode.NRefactory.Ast.NullEventRaiseStatement | No longer a public type instead it is now internal. |
|
ICSharpCode.NRefactory.Ast.NullEventRemoveStatement | No longer a public type instead it is now internal. |
|
ICSharpCode.NRefactory.Ast.NullExpression | No longer a public type instead it is now internal. |
|
ICSharpCode.NRefactory.Ast.NullPropertyGetRegion | No longer a public type instead it is now internal. |
|
ICSharpCode.NRefactory.Ast.NullPropertySetRegion | No longer a public type instead it is now internal. |
|
ICSharpCode.NRefactory.Ast.NullStatement | No longer a public type instead it is now internal. |
| ICSharpCode.NRefactory.IAstVisitor | Various new methods on this interface to support new
types. |
| object
VisitArrayInitializerExpression(...) | Method removed along with the ArrayInitializerExpression
type. Replaced by the VisitCollectionInitializerExpression
method. |
| object
VisitFieldReferenceExpression(...) | Method removed along with the ArrayInitializerExpression
type. Replaced by the VisitMemberReferenceExpression
method. |
| ICSharpCode.NRefactory.Visitors.NodeTrackingAstVisitor | All TrackedVisit methods have been renamed and now include
the name of the type being tracked (e.g.
TrackedVisitAddHandlerStatement). |
| Type | Description |
|---|
| ICSharpCode.SharpDevelop.Dom.AbstractAmbience |
|
| bool IncludeBodies | Replaced by the new IncludeBody property. |
| bool IncludeBody | Replaces the IncludeBodies property. |
| bool IncludeHTMLMarkup | Replaced by the new IncludeHtmlMarkup property. |
| bool IncludeHtmlMarkup | Replaces the old IncludeHTMLMarkup property. |
| bool UseFullyQualifiedMemberNames | Replaced by the new UseFullyQualifiedMemberTypeNames
property. |
| bool
UseFullyQualifiedMemberTypeNames | Replaces the old UseFullyQualifiedMemberNames property. |
| String Convert(ModifierEnum) | Method removed. |
| ICSharpCode.SharpDevelop.Dom.AbstractReturnType |
|
| int TypeArgumentCount | Replaces the old TypeParameterCount property. |
| int TypeParameterCount | Replaced by the new TypeArgumentCount property. |
|
ICSharpCode.SharpDevelop.Dom.AttributeArgument | Type has been removed. |
| ICSharpCode.SharpDevelop.Dom.ClassFinder | The constructors now take a ParseInformation type instead
of a filename. |
| ICSharpCode.SharpDevelop.Dom.ConversionFlags |
|
| IncludeBodies | Replaced by IncludeBody. |
| IncludeBody | Replaces IncludeBodies. |
| IncludeHTMLMarkup | Replaced by IncludeHtmlMarkup. |
| IncludeHtmlMarkup | Replaces IncludeHTMLMarkup. |
| QualifiedNamesOnlyForReturnTypes | Enum value removed. |
| UseFullyQualifiedNames | Replaced by two new enums UseFullyQualifiedMemberNames and
UseFullyQualifedTypeNames. |
| UseFullyQualifiedMemberNames | Replaces the UseFullyQualifiedNames enum value. |
| UseFullyQualifiedTypeNames | Replaces the UseFullyQualifiedNames enum value. |
| ICSharpCode.SharpDevelop.Dom.CSharpExpressionFinder |
|
| int LastExpressionStartPosition | Property has been removed. |
| string FindExpressionInternal(string
inText, int offset) | Method has been removed. |
| ctor(string fileName) | Constructor now takes a ParseInformation type instead of
the filename. |
| ICSharpCode.SharpDevelop.Dom.CtrlSpaceResolveHelper |
|
| ResolveResult
GetResultFromDeclarationLine(IClass callingClass,
IMethodOrProperty callingMember, int caretLine, int
caretColumn, string expression) | Obsolete method removed. Should use the
GetResultFromDeclarationLine method that takes an
ExpressionResult instead of a string. |
| ICSharpCode.SharpDevelop.Dom.DefaultAttribute |
|
| int CompareTo(IAttribute
attribute) | Method removed. |
| string Name | Property has been removed. The attribute name can now be
obtained from the Name property of the AttributeReturnType. |
| ICSharpCode.SharpDevelop.Dom.DefaultCompilationUnit |
|
| List<IClass> GetOuterClasses(int
caretLine, int caretColumn) | Method removed. |
| ICSharpCode.SharpDevelop.DomRegion |
|
| int CompareTo(DomRegion region) | Method removed and replaced by the Equals method. |
| ctor(Location start, Location end) | Replaced by the static FromLocation method. |
| ICSharpCode.SharpDevelop.ExpressionContext |
|
| bool IsAttributeContext | Property has been removed. Instead compare the
ExpressionContext against the ExpressionContext.Attribute. |
| ExpressionContext
GetAttribute(IProjectContent projectContent) | Method removed. To indicate that an expression is an
attribute use the ExpressionContext.Attribute type. |
| ExpressionContext
TypeDerivingFrom(IClass baseClass, bool isObjectCreation) | Method now requires an IReturnType instead of an IClass
type. |
| ICSharpCode.SharpDevelop.ExpressionResult |
|
| ctor(string expression,
ExpressionContext context, object tag) | Replaced by the new constructor that also takes a
DomRegion. |
| ctor(string expression, object
tag) | Replaced by the new constructor that also takes a DomRegion
and ExpressionContext. |
| ICSharpCode.SharpDevelop.GacAssemblyName | Type removed. Code should use the DomAssemblyName
instead. |
| ICSharpCode.SharpDevelop.GacInterop |
|
| GacAssemblyName
FindBestMatchingAssemblyName(GacAssemblyName name) | Method now uses DomAssemblyName types. |
| GacAssemblyName
FindBestMatchingAssemblyName(string name) | Method now returns a DomAssemblyName type. |
| ICSharpCode.SharpDevelop.GacInterop.AssemblyListEntry | Type has been removed. Code should now use a
DomAssemblyName type. |
| ICSharpCode.SharpDevelop.Dom.IAmbience |
|
| String Convert(ModifierEnum) | Method removed. |
| ICSharpCode.SharpDevelop.Dom.IAttribute |
|
| string Name | Property has been removed. The attribute name can now be
obtained from the Name property of the AttributeReturnType. |
| ICSharpCode.SharpDevelop.Dom.ICompilationUnit |
|
| List<IClass> GetOuterClasses(int
caretLine, int caretColumn) |
Method removed. Code should now use the IClass's
DeclaringType property. For example:
IClass type = callingClass.DeclaringType; while (type != null) { ... type = type.DeclaringType; } |
| ICSharpCode.SharpDevelop.Dom.IProjectContent |
|
| IClass GetClass(string typeName) | Method removed. Code should now use GetClass(string
typeName, int typeParameterCount) and pass 0 for the
typeParameterCount. |
| ICSharpCode.SharpDevelop.Dom.IResolver |
|
| ArrayList CtrlSpace(int caretLine, int
caretColumn, string fileName, string fileContent,
ExpressionContext context) | Method changed to use a ParseInformation type instead of a
filename. |
| ResolveResult Resolve(ExpressionResult
expressionResult, int line, int col, string fileName, string
fileContent) | Method changed to take a ParseInformation type instead of a
filename and the line and column parameters have been
removed. |
| ICSharpCode.SharpDevelop.Dom.IReturnType |
|
| int TypeArgumentCount | Replaces the old TypeParameterCount property. |
| int TypeParameterCount | Replaced by the new TypeArgumentCount property. |
| ICSharpCode.SharpDevelop.Dom.MemberLookupHelper |
|
| IMethod
FindOverload(IList<IMethod> methods, IReturnType[]
typeParameters, IReturnType[] arguments) | Method now has an extra out parameter called
resultIsAcceptable. This parameter is true if the resulting
method is an acceptable match, false if the resulting method is
just a guess and will lead to a compile error. |
| ICSharpCode.SharpDevelop.Dom.NRefactoryResolver |
|
| bool Initialize(string fileName, int
line, int column) | Method now takes a ParseInformation type instead of a
filename. |
| IClass SearchClass(string name) | Method now takes an extra Location parameter which is used
to search for a class at a particular location in the file.
Code that does not need to specify a location should use
Location.Empty. |
| IReturnType DynamicLookup(string
identifier) | Method now takes an extra Location parameter. Use
Location.Empty if no location can be specified. |
| IReturnType SearchMember(IReturnType
type, string memberName) | Method removed. Instead of using this method call GetMember
and then use the IMember's ReturnType. |
| IReturnType SearchType(string
name) | Method now takes an extra Location parameter. Use
Location.Empty if no location can be specified. |
| ResolveResult Resolve(ExpressionResult
expressionResult, int line, int column, string fileName, string
fileContent) | Method now takes a ParseInformation type instead of the
filename. The line and column parameters are no longer
required. |
| ArrayList CtrlSpace(int caretLine, int
caretColumn, string fileName, string fileContent,
ExpressionContext context) | Method changed to use a ParseInformation type instead of a
filename. |
| ICSharpCode.SharpDevelop.Dom.ProjectContentRegistry |
|
| IProjectContent
GetExistingProjectContent(AssemblyName assembly) | Obsolete method has been removed. Use the overloaded method
that takes a DomAssemblyName type instead. |
| IProjectContent
GetExistingProjectContent(string itemInclude, string
itemFileName) | Method removed. Use the overloaded method that takes a
single string parameter. |
| ICSharpCode.SharpDevelop.Dom.ReflectionProjectContent |
|
| AssemblyName[]
ReferencedAssemblies | Property removed and replaced by the
ReferencedAssemblyNames property which returns a list of
DomAssemblyNames. |
| IList<DomAssemblyName>
ReferencedAssemblyNames | Replaces the old ReferencedAssemblies property. |
| Type | Description |
|---|
| ICSharpCode.SharpDevelop.ClassBrowserIconService |
|
| int CombineIndex | Field removed and replaced with SolutionIndex. |
| ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.CtrlSpaceCompletionDataProvider |
|
| bool ForceNewExpression | Property removed. |
| ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.SharpDevelopTextEditorProperties |
|
| bool CreateBackupCopy | Property removed. |
| bool UseAntiAliasedFont | Property removed. |
| ICSharpCode.SharpDevelop.FileService |
|
| IWorkbenchWindow GetOpenFile(string
fileName) | Method now returns an IViewContent type. |
| IWorkbenchWindow NewFile(string
defaultName, string language, string content) | Method now returns an IViewContent type and the language
parameter has been removed. |
| IWorkbenchWindow OpenFile(string
fileName) | Method now returns an IViewContent type. |
| ICSharpCode.SharpDevelop.Gui.AbstractBaseViewContent | Class has been removed. |
| ICSharpCode.SharpDevelop.Gui.AbstractSecondaryViewContent |
|
| void NotifyAfterSave(bool
successful) | Method removed. |
| void NotifyBeforeSave() | Method removed. |
| void NotifyFileNameChanged() | Method removed. Code should either use the TitleNameChanged
event or the FileNameChanged event on the PrimaryFile. |
| ICSharpCode.SharpDevelop.Gui.AbstractViewContent |
|
| event DirtyChanged | Event renamed to IsDirtyChanged. |
| string FileName | Property renamed to PrimaryFileName. |
| bool IsUntitled | Property removed. The property has been moved to the
OpenedFile type which can be accessed via the view
content's PrimaryFile property. |
| void Load(string fileName) | Method replaced by the Load method that takes an OpenedFile
and a Stream. |
| void Load(OpenedFile file, Stream
stream) | New method that is used to open a file in a view. The
OpenedFile type contains information about the file, whilst the
stream is the actual file data. |
| event Saved | Event removed. |
| event Saving | Event removed. |
| string UntitledName | Property removed. The untitled name is now stored as the
filename. |
| ICSharpCode.SharpDevelop.Gui.DefaultWorkbench | Class is now private and no longer publicly accessible. |
| ICSharpCode.SharpDevelop.Gui.DriveObject | Class is now private and no longer publicly accessible. |
| ICSharpCode.SharpDevelop.Gui.ExtTreeView |
|
| void ApplyViewStateString(string
state, TreeView tree) | Method moved to the TreeViewHelper class. |
| string GetViewStateString(TreeView
tree) | Method moved to the TreeViewHelper class. |
| ICSharpCode.SharpDevelop.Gui.FileList | Class is now private and no longer publicly accessible. |
| ICSharpCode.SharpDevelop.Gui.IBaseViewContent |
Interface has been removed. Most of the interface has been
moved to the IViewContent interface apart from the following
methods which no longer exist.
void Deselected() void Deselecting() void Selected() void SwitchedTo() |
| ICSharpCode.SharpDevelop.Gui.ICanBeDirty |
|
| event DirtyChanged | Event renamed to IsDirtyChanged. |
| bool IsDirty | Property setter is no longer defined in the interface. Only
the getter is defined. |
| ICSharpCode.SharpDevelop.Gui.IParseableContent | Interface removed. |
| ICSharpCode.SharpDevelop.Gui.ISecondaryViewContent | Interface removed. All secondary view contents now
implement the IViewContent interface. |
| ICSharpCode.SharpDevelop.Gui.IViewContent |
|
| bool IsDisposed | New property that indicates whether the view has been
disposed. |
| bool IsUntitled | Property removed. Code should check the PrimaryFile's
Untitled property instead. |
| event Saved | Event removed. |
| bool
SupportsSwitchFromThisWithoutSaveLoad(OpenedFile file,
IViewContent newView) | New method. Determines whether switching without a
Save/Load is supported when switching from this view to another
view. |
| bool
SupportsSwitchToThisWithoutSaveLoad(OpenedFile file,
IViewContent oldView) | New method. Determines whether switching without a
Save/Load is supported when switching to this view from another
view. |
| IWorkbenchWindow WorkbenchWindow | Property moved from the now obsolete IBaseViewContent
interface. Gives access to the workbench window associated with
this view. |
| List<ISecondaryViewContent>
SecondaryViewContents | Property now returns an ICollection instead of a list. |
| event FileNameChanged | Event moved to the OpenedFile class which is accessible via
the PrimaryFile property. |
| event Saving | Event removed. |
| OpenedFile PrimaryFile | New property that gives access to information about the
primary file associated with this view. |
| IList<OpenedFile> Files | New property that returns a list of files that are
associated with this view. |
| event Disposed | New event raised when the view is disposed. |
| event TabPageTextChanged | New event raised when the tab page text at the bottom of
the window is changed. |
| string FileName | The filename associated with a view is now accessible from
the PrimaryFileName property. |
| string TabPageText | Gets or sets the tab page text at the bottom of the window.
This property was originally on the now obsolete
IBaseViewContent interface. |
| string UntitledName | Property removed. The UntitledName is now the same as the
PrimaryFileName. |
| Control Control | Gets or sets the control associated with this view.
Originally part of the IBaseViewContent interface. |
| void Load(string fileName) | Replaced by the Load method that takes an OpenedFile and a
Stream. |
| void Load(OpenedFile file, Stream
stream) | New method that is used to open a file in a view. The
OpenedFile type contains information about the file, whilst the
stream is the actual file data.. |
| void Save() | Replaced by the Save method that takes an OpenedFile and a
Stream. |
| void Save(string fileName) | Replaced by the Save method that takes an OpenedFile and a
Stream. |
| void Save(OpenedFile file, Stream
stream) | New method that is used to save a file in a view. |
| ICSharpCode.SharpDevelop.Gui.IViewContentMemento | Class removed. |
| ICSharpCode.SharpDevelop.Gui.IViewContentMementoCreator | Class removed. |
| ICSharpCode.SharpDevelop.Gui.IWorkbenchWindow |
|
| IBaseViewContent ActiveViewContent | The ActiveViewContent property is now an IViewContent. |
| IViewContent ViewContent | Property removed. Use the ActiveViewContent property
instead. |
| ICSharpCode.SharpDevelop.IDisplayBinding |
|
| bool CanCreateContentForFile(string
fileName) | Method now takes an OpenedFile type instead of a
string. |
| bool
CanCreateContentForLanguage(string language) | Method removed. |
| ICSharpCode.SharpDevelop.ISecondaryDisplayBinding |
|
| ISecondaryViewContent[]
CreateSecondaryViewContent(IViewContent view) | Method now returns an IViewContent array since the
ISecondaryViewContent interface is obsolete. |
| Type | Description |
|---|
| ICSharpCode.TextEditor.Caret |
|
| Point Position | The Position property now uses the
ICSharpCode.TextEditor.TextLocation type instead of the
System.Drawing.Point type. |
| Point ValidatePosition(Position
pos) | The method now returns and uses the
ICSharpCode.TextEditor.TextLocation type instead of the
System.Drawing.Point type. |
| ICSharpCode.TextEditor.Document.Bookmark |
|
| event LineNumberChanged | Event removed. |
| ICSharpCode.TextEditor.Document.BookmarkManager |
|
| event Changed | Event removed. |
| ICSharpCode.TextEditor.Document.DefaultFormattingStrategy |
|
| int FormatLine(TextArea textArea, int
line, int caretOffset, char charTyped) | Method now no longer returns anything. |
| ICSharpCode.TextEditor.Document.DefaultTextEditorProperties |
|
| bool UseAntiAliasedFont | Property removed. |
| ICSharpCode.TextEditor.Document.IDocument |
|
| LineSegment GetLineSegment(int line) | The default implementation in the DefaultLineSegment class
no longer allows the line number to be equal to the number of
items in the IDocument's LineSegment collection. |
| Point OffsetToPosition(int offset) | Method now returns a TextLocation type. |
| int PositionToOffset(Point point) | Method now takes a TextLocation type. |
| ICSharpCode.TextEditor.Document.IFormattingStrategy |
|
| int FormatLine(TextArea textArea, int
line, int caretOffset, char charTyped) | Method now no longer returns anything. |
| ICSharpCode.TextEditor.Document.ILineManager | Interface has been removed. |
| ICSharpCode.TextEditor.Document.ISelection |
|
| bool ContainsPosition(Point point) | Method now uses a TextLocation type. |
| Point EndPosition | Property now uses a TextLocation type. |
| Point StartPosition | Property now uses a TextLocation type. |
| ICSharpCode.TextEditor.Document.ITextEditorProperties |
|
| bool CreateBackupCopy | Property removed. |
| bool UseAntiAliasedFont | Property removed. |
| ICSharpCode.TextEditor.Document.LineLengthEventArgs | Replaced by the LineLengthChangedEventArgs type. |
| ICSharpCode.TextEditor.Gui.InsightWindow.IInsightDataProvider |
|
| char CharTyped | Property removed. |
| ICSharpCode.TextEditor.TextEditorControlBase |
|
| event Changed | Event renamed to TextChanged. |
| bool CreateBackupCopy | Property removed. |
| bool IsUpdating | Property removed. |
| bool UseAntiAliasedFont | Property removed. |
| ICSharpCode.TextEditor.ToolTipRequestEventArgs |
|
| Point LogicalPosition | Property now uses a TextLocation type. |
| ICSharpCode.TextEditor.Undo.UndoStack |
|
| void CombineLast(int actionCount) | Method removed. Similar functionality can be obtained by
using the StartUndoGroup and EndUndoGroup method. |
| void UndoLast(int actionCount) | Method removed. Similar functionality can be obtained by
using the StartUndoGroup and EndUndoGroup method. |
This section looks at one way to port an addin. This is the way
that the IronPython addin was ported from SharpDevelop 2.2 to
SharpDevelop 3.
Download the source code for SharpDevelop 3.0 and 2.2.
Copy the source code of your addin to a folder inside
SharpDevelop 3.0.
Run three copies of SharpDevelop, one to view SharpDevelop
2.2's source, one to view SharpDevelop 3.0's source, one
with your addin. In the other copies of SharpDevelop you should
open SharpDevelop.sln for 2.2 and 3.0. This will allow you to
quickly search for SharpDevelop classes when you find your addin
code will not compile.
Compile your code and fix the code or comment it out as you try
to work out what is wrong.
You do not have to convert the project to use .NET 3.5.
SharpDevelop itself uses it, but some of the addins do not. With
the IronPython addin I needed to change it to use .NET 3.5 since
there were some assembly conflicts between what SharpDevelop was
using and what the addin was using. Obviously changing to use .NET
3.5 will allow you to use any new features of this framework.
One change in .NET 3.5 caused me a few problems when porting the
IronPython addin. This was a change in MSBuild.
After finally getting the IronPython addin to compile with the
modified SharpDevelop 3 assemblies there was an assembly conflict
for MSBuild. The ICSharpCode.SharpDevelop assembly now uses MSBuild
3.5 assemblies whilst the IronPython build task project and test
project were using MSBuild 2.0. This was fixed by converting these
two projects so they use the .NET Framework 3.5. This can be done
by opening the project's properties, selecting the Compiling
tab, then clicking the Convert Project to C# 3.0 button. In the
dialog that opens we select the "Change target framework to
.NET 3.5" and click the OK button. After making this change
the addin compiled and worked however all the unit tests for the
IronPython build tasks were failing with the error:
System.ArrayTypeMismatchException : Attempted to access an
element as a type incompatible with the array.
The last line was failing when the unit test was run. The
TaskItem type implements the ITaskItem interface so the code should
have worked. The reason for this error is that both the build task
and build task tests project were referencing the MSBuild libraries
just using the reference name.
Running MSBuild from the command line the actual assemblies
being used were a mix of 3.5 and 2.0 versions.
Printing out the code base of the TaskItem and ITaskItem types
whilst running the unit tests showed that the TaskItem was being
taken from Microsoft.Build.Utilities assembly version 2.0 and the
ITaskItem was being taken the Microsoft.Build.Framework 3.5
assembly. The TaskItem we actually needed was in the new
Microsoft.Build.Utilities assembly version 3.5. Changing the
project references so they used this new 3.5 assembly fixed the
problem.