code
stringlengths 2
1.05M
| repo_name
stringlengths 5
101
| path
stringlengths 4
991
| language
stringclasses 3
values | license
stringclasses 5
values | size
int64 2
1.05M
|
|---|---|---|---|---|---|
Namespace Account
Public Class Revenue
Inherits Base
Friend Overrides Function GetTransactionsBalanceCalculator() As Func(Of Decimal, Decimal)
Return (Function(D) -D)
End Function
End Class
End Namespace
|
Senrozoi/Accounting
|
Accounting/Account/Revenue.vb
|
Visual Basic
|
mit
| 251
|
Partial Class stopemails
Inherits System.Web.UI.Page
Dim cf As New comonfunctions
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim rtn As String = ""
Dim sql As String = ""
sql = "update invites set isdeleted='Y' where email='" & TextBox1.Text & "'"
rtn = cf.TaskmembSql(sql)
If rtn > 0 Then
Label2.Text = "Email Blocked Sucessfully"
Else
Label2.Text = "Email Address not found, kindly contact us using contact us page"
End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Dim rtn As String = ""
'Dim sql As String = ""
''sql = "select email from invites where inviteid=" & Request.QueryString("id")
''rtn = cf.CountRs(sql)
'' TextBox1.Text = Request.QueryString("email")
End Sub
End Class
|
aminnagpure/matrimonydatingcommunity1.0
|
lovenmarry - EmptyFreeCode/stopemails.aspx.vb
|
Visual Basic
|
mit
| 956
|
Imports System.Runtime.CompilerServices
Imports System.Collections.ObjectModel
Imports kintoneDotNET.API.Types
Imports System.Linq.Expressions
Namespace API
''' <summary>
''' データ型の性質上List型となる項目について、メソッド拡張を行う
''' </summary>
''' <remarks></remarks>
Public Module kintoneTypeExtension
<Extension()>
Public Sub UploadFile(ByVal item As List(Of kintoneFile), ByVal file As HttpPostedFile)
UploadFile(item, file.ToHttpPostedFileBase)
End Sub
<Extension()>
Public Sub UploadFile(ByVal item As List(Of kintoneFile), ByVal files As ReadOnlyCollection(Of HttpPostedFile))
UploadFile(item, files.ToHttpPostedFileBaseList)
End Sub
<Extension()>
Public Sub UploadFile(ByVal item As List(Of kintoneFile), ByVal file As HttpPostedFileBase)
UploadFile(item, New ReadOnlyCollection(Of HttpPostedFileBase)(New List(Of HttpPostedFileBase) From {file}))
End Sub
<Extension()>
Public Sub UploadFile(ByVal item As List(Of kintoneFile), ByVal files As ReadOnlyCollection(Of HttpPostedFileBase))
Dim fKey As String = kintoneAPI.UploadFile(files)
If Not String.IsNullOrEmpty(fKey) Then
item.Add(New kintoneFile(fKey))
End If
End Sub
<Extension()>
Public Function ToHttpPostedFileBaseList(ByVal files As ReadOnlyCollection(Of HttpPostedFile)) As ReadOnlyCollection(Of HttpPostedFileBase)
Dim baseList As New ReadOnlyCollection(Of HttpPostedFileBase)( _
(From f As HttpPostedFile In files
Select f.ToHttpPostedFileBase).ToList)
Return baseList
End Function
<Extension()>
Public Function ToHttpPostedFileBase(ByVal file As HttpPostedFile) As HttpPostedFileBase
Return New HttpPostedFileWrapper(file)
End Function
End Module
End Namespace
|
icoxfog417/kintoneDotNET
|
kintoneDotNET/kintoneTypeExtension.vb
|
Visual Basic
|
apache-2.0
| 2,004
|
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' Общие сведения об этой сборке предоставляются следующим набором
' атрибутов. Отредактируйте значения этих атрибутов, чтобы изменить
' общие сведения об этой сборке.
' Проверьте значения атрибутов сборки
<Assembly: AssemblyTitle("bwl.Translator.One")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("bwl.Translator.One")>
<Assembly: AssemblyCopyright("Copyright © 2012")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
<Assembly: Guid("7842ce96-e8f2-4cf3-b101-8aaaab46cb85")>
' Сведения о версии сборки состоят из следующих четырех значений:
'
' Основной номер версии
' Дополнительный номер версии
' Номер построения
' Редакция
'
' Можно задать все значения или принять номер построения и номер редакции по умолчанию,
' используя "*", как показано ниже:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
Lifemotion/Bwl.Translator.One
|
Bwl.Translator.One/My Project/AssemblyInfo.vb
|
Visual Basic
|
apache-2.0
| 1,661
|
'------------------------------------------------------------------------------
' <auto-generated>
' Ce code a été généré par un outil.
' Version du runtime :4.0.30319.42000
'
' Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
' le code est régénéré.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "Fonctionnalité Enregistrement automatique My.Settings"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public Property MinecraftFolderLocation() As String
Get
Return CType(Me("MinecraftFolderLocation"),String)
End Get
Set
Me("MinecraftFolderLocation") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public Property BackupsFolderLocation() As String
Get
Return CType(Me("BackupsFolderLocation"),String)
End Get
Set
Me("BackupsFolderLocation") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public Property SavesFolderLocation() As String
Get
Return CType(Me("SavesFolderLocation"),String)
End Get
Set
Me("SavesFolderLocation") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("100")> _
Public Property InterfaceOpacity() As Integer
Get
Return CType(Me("InterfaceOpacity"),Integer)
End Get
Set
Me("InterfaceOpacity") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public Property BackgroundImageLocation() As String
Get
Return CType(Me("BackgroundImageLocation"),String)
End Get
Set
Me("BackgroundImageLocation") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property BackgroundImageStretch() As Integer
Get
Return CType(Me("BackgroundImageStretch"),Integer)
End Get
Set
Me("BackgroundImageStretch") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("True")> _
Public Property CheckForUpdates() As Boolean
Get
Return CType(Me("CheckForUpdates"),Boolean)
End Get
Set
Me("CheckForUpdates") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("True")> _
Public Property ShowBalloonTips() As Boolean
Get
Return CType(Me("ShowBalloonTips"),Boolean)
End Get
Set
Me("ShowBalloonTips") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("False")> _
Public Property CloseToTray() As Boolean
Get
Return CType(Me("CloseToTray"),Boolean)
End Get
Set
Me("CloseToTray") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("False")> _
Public Property SaveCloseState() As Boolean
Get
Return CType(Me("SaveCloseState"),Boolean)
End Get
Set
Me("SaveCloseState") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("True")> _
Public Property CreateThumbOnWorld() As Boolean
Get
Return CType(Me("CreateThumbOnWorld"),Boolean)
End Get
Set
Me("CreateThumbOnWorld") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public Property Language() As String
Get
Return CType(Me("Language"),String)
End Get
Set
Me("Language") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("#FF000000")> _
Public Property StatusLabelColor() As Global.System.Windows.Media.Color
Get
Return CType(Me("StatusLabelColor"),Global.System.Windows.Media.Color)
End Get
Set
Me("StatusLabelColor") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("Cyan")> _
Public Property Theme() As String
Get
Return CType(Me("Theme"),String)
End Get
Set
Me("Theme") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("125")> _
Public Property ListViewTextColorIntensity() As String
Get
Return CType(Me("ListViewTextColorIntensity"),String)
End Get
Set
Me("ListViewTextColorIntensity") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("Type")> _
Public Property ListViewGroupBy() As Global.MCBackup.BackupsListView.GroupBy
Get
Return CType(Me("ListViewGroupBy"),Global.MCBackup.BackupsListView.GroupBy)
End Get
Set
Me("ListViewGroupBy") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("DateCreated")> _
Public Property ListViewSortBy() As Global.MCBackup.BackupsListView.SortBy
Get
Return CType(Me("ListViewSortBy"),Global.MCBackup.BackupsListView.SortBy)
End Get
Set
Me("ListViewSortBy") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("Descending")> _
Public Property ListViewSortByDirection() As Global.System.ComponentModel.ListSortDirection
Get
Return CType(Me("ListViewSortByDirection"),Global.System.ComponentModel.ListSortDirection)
End Get
Set
Me("ListViewSortByDirection") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("True")> _
Public Property FirstCloseToTray() As Boolean
Get
Return CType(Me("FirstCloseToTray"),Boolean)
End Get
Set
Me("FirstCloseToTray") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("980,600")> _
Public Property WindowSize() As Global.System.Windows.Size
Get
Return CType(Me("WindowSize"),Global.System.Windows.Size)
End Get
Set
Me("WindowSize") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("False")> _
Public Property IsWindowMaximized() As Boolean
Get
Return CType(Me("IsWindowMaximized"),Boolean)
End Get
Set
Me("IsWindowMaximized") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("240*")> _
Public Property SidebarWidth() As Global.System.Windows.GridLength
Get
Return CType(Me("SidebarWidth"),Global.System.Windows.GridLength)
End Get
Set
Me("SidebarWidth") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("716*")> _
Public Property ListViewWidth() As Global.System.Windows.GridLength
Get
Return CType(Me("ListViewWidth"),Global.System.Windows.GridLength)
End Get
Set
Me("ListViewWidth") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("True")> _
Public Property SendAnonymousData() As Boolean
Get
Return CType(Me("SendAnonymousData"),Boolean)
End Get
Set
Me("SendAnonymousData") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(),
Global.System.Diagnostics.DebuggerNonUserCodeAttribute()>
Public Property Launcher() As Global.MCBackup.Launcher
Get
Return CType(Me("Launcher"), Global.MCBackup.Launcher)
End Get
Set
Me("Launcher") = Value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("True")> _
Public Property ShowDeleteDialog() As Boolean
Get
Return CType(Me("ShowDeleteDialog"),Boolean)
End Get
Set
Me("ShowDeleteDialog") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("False")> _
Public Property IgnoreSystemLocalizationWhenFormatting() As Boolean
Get
Return CType(Me("IgnoreSystemLocalizationWhenFormatting"),Boolean)
End Get
Set
Me("IgnoreSystemLocalizationWhenFormatting") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public Property DefaultBackupName() As String
Get
Return CType(Me("DefaultBackupName"),String)
End Get
Set
Me("DefaultBackupName") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public Property DefaultAutoBackupName() As String
Get
Return CType(Me("DefaultAutoBackupName"),String)
End Get
Set
Me("DefaultAutoBackupName") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("True")> _
Public Property CallUpgrade() As Boolean
Get
Return CType(Me("CallUpgrade"),Boolean)
End Get
Set
Me("CallUpgrade") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("<?xml version=""1.0"" encoding=""utf-16""?>"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"<ArrayOfString xmlns:xsi=""http://www.w3."& _
"org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" />")> _
Public Property BackupGroups() As Global.System.Collections.Specialized.StringCollection
Get
Return CType(Me("BackupGroups"),Global.System.Collections.Specialized.StringCollection)
End Get
Set
Me("BackupGroups") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("BaseLight")> _
Public Property ThemeShade() As String
Get
Return CType(Me("ThemeShade"),String)
End Get
Set
Me("ThemeShade") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("Center")> _
Public Property BackgroundImageXAlign() As Global.System.Windows.Media.AlignmentX
Get
Return CType(Me("BackgroundImageXAlign"),Global.System.Windows.Media.AlignmentX)
End Get
Set
Me("BackgroundImageXAlign") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("Center")> _
Public Property BackgroundImageYAlign() As Global.System.Windows.Media.AlignmentY
Get
Return CType(Me("BackgroundImageYAlign"),Global.System.Windows.Media.AlignmentY)
End Get
Set
Me("BackgroundImageYAlign") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("True")> _
Public Property ShowNewsOnStartup() As Boolean
Get
Return CType(Me("ShowNewsOnStartup"),Boolean)
End Get
Set
Me("ShowNewsOnStartup") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("")> _
Public Property LastBackupGroupUsed() As String
Get
Return CType(Me("LastBackupGroupUsed"),String)
End Get
Set
Me("LastBackupGroupUsed") = value
End Set
End Property
End Class
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.MCBackup.MySettings
Get
Return Global.MCBackup.MySettings.Default
End Get
End Property
End Module
End Namespace
|
nicoco007/MCBackup-3
|
MCBackup 3/My Project/Settings.Designer.vb
|
Visual Basic
|
apache-2.0
| 19,288
|
Imports System.IO
Public Class Patch
Inherits Switcher
Private _name As String
Private _path As String
Private _lenght As Integer
Private _list As List(Of String)
Public Sub New()
_lenght = 0
_name = Nothing
_path = Nothing
_list = New List(Of String)
End Sub
Public Property Name As String
Get
Return _name
End Get
Set(value As String)
_name = value
_path = FolderApp & Slash & FolderPatch & Slash & _name
End Set
End Property
Public ReadOnly Property Path As String
Get
Return _path
End Get
End Property
Public ReadOnly Property List As List(Of String)
Get
Return _list
End Get
End Property
Public ReadOnly Property Lenght As Integer
Get
Return _lenght
End Get
End Property
Public Function Read() As Boolean
Dim folder As String
Dim msgText As String
Dim msgTitle As New Title()
_lenght = 0
_list.Clear()
folder = FolderApp & Slash & FolderPatch
If Directory.Exists(folder) Then
For Each dirName As String In Directory.GetDirectories(folder)
Dim dirInfo As New DirectoryInfo(dirName)
_lenght += 1
_list.Add(dirInfo.Name)
'_lenght = _lenght + 1; _lenght++; ++_lenght;
Next
If _lenght = 0 Then
msgText = "In the main directory there is no patch." & Environment.NewLine
msgText &= "Switcher is not installed properly or is damaged."
MessageBox.Show(msgText, msgTitle.Mistake, MessageBoxButtons.OK, MessageBoxIcon.Error)
Return False
End If
'Success read
Return True
Else
msgText = "The main patch directory does not exist." & Environment.NewLine
msgText &= "Switcher is not installed properly or is damaged."
MessageBox.Show(msgText, msgTitle.Mistake, MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Return False
End Function
'Public Function Save() As Boolean
' If Check() Then
' Return True
' End If
' Dim msgText As String
' Dim msgTitle As New Title()
' msgText = "The selected patch does not exist." & Environment.NewLine
' msgText &= "Shollym Switcher is not installed properly or is damaged."
' MessageBox.Show(msgText, msgTitle.Mistake, MessageBoxButtons.OK, MessageBoxIcon.Error)
' Return False
'End Function
Public Function Check() As Boolean
If Not Directory.Exists(_path) Then
Dim msgText As String
Dim msgTitle As New Title()
msgText = "The selected patch form the list does not exist." & Environment.NewLine
msgText &= "Shollym Switcher is not installed properly or is damaged."
MessageBox.Show(msgText, msgTitle.Mistake, MessageBoxButtons.OK, MessageBoxIcon.Error)
Return False
End If
Return True
End Function
End Class
|
jasarsoft/shollymswitcher
|
Class/Patch.vb
|
Visual Basic
|
apache-2.0
| 3,218
|
Public Partial Class Insert3
Inherits System.Web.UI.Page
Protected _db As New Samples.ApplicationDbContext()
Protected Sub Page_Load(sender As Object, e As EventArgs)
End Sub
' This is the Insert method to insert the entered Product item
' USAGE: <asp:FormView InsertMethod="InsertItem">
Public Sub InsertItem()
Using _db
Dim item = New Samples.Product()
TryUpdateModel(item)
If ModelState.IsValid Then
' Save changes
_db.Products.Add(item)
_db.SaveChanges()
Response.Redirect("Default")
End If
End Using
End Sub
Protected Sub ItemCommand(sender As Object, e As FormViewCommandEventArgs)
If e.CommandName.Equals("Cancel", StringComparison.OrdinalIgnoreCase) Then
Response.Redirect("Default")
End If
End Sub
End Class
|
neozhu/WebFormsScaffolding
|
Samples.VB/3_Associations/Products/Insert.aspx.vb
|
Visual Basic
|
apache-2.0
| 777
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Threading
Imports Microsoft.CodeAnalysis.Options
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.Simplification
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Simplification
Partial Friend Class VisualBasicCallReducer
Inherits AbstractVisualBasicReducer
Private Shared ReadOnly s_pool As ObjectPool(Of IReductionRewriter) =
New ObjectPool(Of IReductionRewriter)(Function() New Rewriter(s_pool))
Public Sub New()
MyBase.New(s_pool)
End Sub
Private Shared ReadOnly s_simplifyCallStatement As Func(Of CallStatementSyntax, SemanticModel, OptionSet, CancellationToken, SyntaxNode) = AddressOf SimplifyCallStatement
Private Shared Function SimplifyCallStatement(
callStatement As CallStatementSyntax,
semanticModel As SemanticModel,
optionSet As OptionSet,
cancellationToken As CancellationToken
) As ExecutableStatementSyntax
If callStatement.CanRemoveCallKeyword(semanticModel) Then
Dim leading = callStatement.GetLeadingTrivia()
Dim resultNode = SyntaxFactory.ExpressionStatement(callStatement.Invocation) _
.WithLeadingTrivia(leading)
resultNode = SimplificationHelpers.CopyAnnotations(callStatement, resultNode)
Return resultNode
End If
' We don't know how to simplify this.
Return callStatement
End Function
End Class
End Namespace
|
abock/roslyn
|
src/Workspaces/VisualBasic/Portable/Simplification/Reducers/VisualBasicCallReducer.vb
|
Visual Basic
|
mit
| 1,822
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Text.Shared.Extensions
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.EndConstructGeneration
Partial Friend Class EndConstructStatementVisitor
Public Overrides Function VisitLambdaHeader(node As LambdaHeaderSyntax) As AbstractEndConstructResult
Dim singleLineExpressionSyntax = TryCast(node.Parent, SingleLineLambdaExpressionSyntax)
If singleLineExpressionSyntax IsNot Nothing Then
Return TransformSingleLineLambda(singleLineExpressionSyntax)
Else
Return SpitNormalLambdaEnding(node)
End If
End Function
Private Function TransformSingleLineLambda(originalNode As SingleLineLambdaExpressionSyntax) As AbstractEndConstructResult
' If there is newline trivia on the end of the node, we need to pull that off to stick it back on at the very end of this transformation
Dim newLineTrivia = originalNode.GetTrailingTrivia().SkipWhile(Function(t) Not t.IsKind(SyntaxKind.EndOfLineTrivia))
Dim node = originalNode.WithTrailingTrivia(originalNode.GetTrailingTrivia().TakeWhile(Function(t) Not t.IsKind(SyntaxKind.EndOfLineTrivia)))
Dim tokenNextToLambda = originalNode.GetLastToken().GetNextToken()
Dim isNextToXmlEmbeddedExpression = tokenNextToLambda.IsKind(SyntaxKind.PercentGreaterThanToken) AndAlso tokenNextToLambda.Parent.IsKind(SyntaxKind.XmlEmbeddedExpression)
Dim aligningWhitespace = _subjectBuffer.CurrentSnapshot.GetAligningWhitespace(originalNode.SpanStart)
Dim indentedWhitespace = aligningWhitespace & " "
' Generate the end statement since we can easily share that code
Dim endStatementKind = If(originalNode.Kind = SyntaxKind.SingleLineSubLambdaExpression, SyntaxKind.EndSubStatement, SyntaxKind.EndFunctionStatement)
Dim endStatement = SyntaxFactory.EndBlockStatement(endStatementKind, SyntaxFactory.Token(originalNode.SubOrFunctionHeader.DeclarationKeyword.Kind).WithLeadingTrivia(SyntaxFactory.WhitespaceTrivia(" "))) _
.WithLeadingTrivia(SyntaxFactory.WhitespaceTrivia(aligningWhitespace)) _
.WithTrailingTrivia(If(isNextToXmlEmbeddedExpression, SyntaxFactory.TriviaList(SyntaxFactory.WhitespaceTrivia(" ")), newLineTrivia))
' We are hitting enter after a single line. Let's transform it to a multi-line form
If node.Kind = SyntaxKind.SingleLineSubLambdaExpression Then
' If we have Sub() End Sub as a lambda, we're better off just doing nothing smart
If node.Body.IsKind(SyntaxKind.EndSubStatement) Then
Return Nothing
End If
' Update the new header
Dim newHeader = node.SubOrFunctionHeader
If newHeader.ParameterList Is Nothing OrElse
(newHeader.ParameterList.OpenParenToken.IsMissing AndAlso newHeader.ParameterList.CloseParenToken.IsMissing) Then
newHeader = newHeader.WithParameterList(SyntaxFactory.ParameterList())
End If
newHeader = newHeader.WithTrailingTrivia(SyntaxFactory.EndOfLineTrivia(_state.NewLineCharacter))
' Update the body with a newline
Dim newBody = DirectCast(node.Body, StatementSyntax).WithAppendedTrailingTrivia(SyntaxFactory.EndOfLineTrivia(_state.NewLineCharacter))
Dim newBodyHasCode = False
' If it actually contains something, intent it too. Otherwise, we'll just let the smart indenter position
If Not String.IsNullOrWhiteSpace(newBody.ToFullString()) Then
newBody = newBody.WithPrependedLeadingTrivia(SyntaxFactory.WhitespaceTrivia(indentedWhitespace))
newBodyHasCode = True
End If
Dim newExpression = SyntaxFactory.MultiLineSubLambdaExpression(
subOrFunctionHeader:=newHeader,
statements:=SyntaxFactory.SingletonList(newBody),
endSubOrFunctionStatement:=endStatement)
Return New ReplaceSpanResult(originalNode.FullSpan.ToSnapshotSpan(_subjectBuffer.CurrentSnapshot),
newExpression.ToFullString(),
If(newBodyHasCode, CType(newExpression.Statements.First().SpanStart, Integer?), Nothing))
Else
If node.Body.IsMissing Then
If node.Body.GetTrailingTrivia().Any(Function(t) t.IsKind(SyntaxKind.SkippedTokensTrivia)) Then
' If we had to skip tokens, we're probably just going to break more than we fix
Return Nothing
End If
' It's still missing entirely, so just spit normally
Return CreateSpitLinesForLambdaHeader(node.SubOrFunctionHeader, isNextToXmlEmbeddedExpression, originalNode.SpanStart)
End If
Dim newHeader = node.SubOrFunctionHeader.WithTrailingTrivia(SyntaxFactory.EndOfLineTrivia(_state.NewLineCharacter))
Dim newBody = SyntaxFactory.ReturnStatement(SyntaxFactory.Token(SyntaxKind.ReturnKeyword).WithTrailingTrivia(SyntaxFactory.WhitespaceTrivia(" ")),
DirectCast(node.Body, ExpressionSyntax)) _
.WithPrependedLeadingTrivia(SyntaxFactory.WhitespaceTrivia(indentedWhitespace)) _
.WithAppendedTrailingTrivia(SyntaxFactory.EndOfLineTrivia(_state.NewLineCharacter))
Dim newExpression = SyntaxFactory.MultiLineSubLambdaExpression(
subOrFunctionHeader:=newHeader,
statements:=SyntaxFactory.SingletonList(Of StatementSyntax)(newBody),
endSubOrFunctionStatement:=endStatement)
' Fish our body back out so we can figure out relative spans
newBody = DirectCast(newExpression.Statements.First(), ReturnStatementSyntax)
Return New ReplaceSpanResult(originalNode.FullSpan.ToSnapshotSpan(_subjectBuffer.CurrentSnapshot),
newExpression.ToFullString(),
newBody.ReturnKeyword.FullSpan.End)
End If
Return Nothing
End Function
Private Function SpitNormalLambdaEnding(node As LambdaHeaderSyntax) As AbstractEndConstructResult
Dim needsEnd = node.GetAncestorsOrThis(Of MultiLineLambdaExpressionSyntax)().Any(Function(block) block.EndSubOrFunctionStatement.IsMissing AndAlso block.IsMultiLineLambda())
' We have to be careful here: just because the Lambda's End isn't missing doesn't mean we shouldn't spit a
' End Sub / End Function. A good example is an unterminated multi-line sub in a sub, like this:
'
' Sub foo()
' Dim x = Sub()
' End Sub
'
' Obviously the parser has an ambiguity here, and so it chooses to parse the End Sub as being the terminator
' for the lambda. In this case, we'll notice that this lambda has a parent method body that uses the same
' Sub/Function keyword and is missing it's end construct, indicating that we should still spit.
Dim containingMethodBlock = node.GetAncestor(Of MethodBlockBaseSyntax)()
If containingMethodBlock IsNot Nothing AndAlso containingMethodBlock.EndBlockStatement.IsMissing Then
' Is this containing method the same type (Sub/Function) as the lambda?
If containingMethodBlock.BlockStatement.DeclarationKeyword.Kind = node.DeclarationKeyword.Kind Then
needsEnd = True
End If
End If
If needsEnd Then
Return CreateSpitLinesForLambdaHeader(node)
Else
Return Nothing
End If
End Function
Private Function CreateSpitLinesForLambdaHeader(node As LambdaHeaderSyntax, Optional isNextToXmlEmbeddedExpression As Boolean = False, Optional originalNodeSpanStart? As Integer = Nothing) As AbstractEndConstructResult
Dim spanStart As Integer = If(originalNodeSpanStart.HasValue, originalNodeSpanStart.Value, node.SpanStart)
Dim endConstruct = _subjectBuffer.CurrentSnapshot.GetAligningWhitespace(spanStart) & "End " & node.DeclarationKeyword.ToString()
' We may wish to spit () at the end of if we are missing our parenthesis
If node.ParameterList Is Nothing OrElse (node.ParameterList.OpenParenToken.IsMissing AndAlso node.ParameterList.CloseParenToken.IsMissing) Then
Return New SpitLinesResult({"()", "", endConstruct}, startOnCurrentLine:=True)
Else
Return New SpitLinesResult({"", If(isNextToXmlEmbeddedExpression, endConstruct & " ", endConstruct)})
End If
End Function
End Class
End Namespace
|
Pvlerick/roslyn
|
src/EditorFeatures/VisualBasic/EndConstructGeneration/EndConstructStatementVisitor_LambdaHeader.vb
|
Visual Basic
|
apache-2.0
| 9,326
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports Microsoft.CodeAnalysis.VisualBasic
Namespace Microsoft.CodeAnalysis.Diagnostics.VisualBasic
''' <summary>
''' DiagnosticAnalyzer for VB compiler's syntax/semantic/compilation diagnostics.
''' </summary>
<DiagnosticAnalyzer(LanguageNames.VisualBasic)>
Friend Class VisualBasicCompilerDiagnosticAnalyzer
Inherits CompilerDiagnosticAnalyzer
Friend Overrides ReadOnly Property MessageProvider As CommonMessageProvider
Get
Return CodeAnalysis.VisualBasic.MessageProvider.Instance
End Get
End Property
Friend Overrides Function GetSupportedErrorCodes() As ImmutableArray(Of Integer)
Dim errorCodes As Array = [Enum].GetValues(GetType(ERRID))
Dim builder = ImmutableArray.CreateBuilder(Of Integer)
For Each errorCode As Integer In errorCodes
' these errors are not supported by live analysis
If errorCode = ERRID.ERR_TypeRefResolutionError3 OrElse
errorCode = ERRID.ERR_MissingRuntimeHelper OrElse
errorCode = ERRID.ERR_CannotGotoNonScopeBlocksWithClosure Then
Continue For
End If
If errorCode > ERRID.ERR_None AndAlso errorCode < ERRID.ERRWRN_NextAvailable Then
builder.Add(errorCode)
End If
Next
Return builder.ToImmutable
End Function
End Class
End Namespace
|
mmitche/roslyn
|
src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilerDiagnosticAnalyzer.vb
|
Visual Basic
|
apache-2.0
| 1,692
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Threading
Imports Microsoft.CodeAnalysis.Completion.Providers
Imports Microsoft.CodeAnalysis.VisualBasic.Extensions.ContextQuery
Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.KeywordRecommenders.OnErrorStatements
''' <summary>
''' Recommends "Error" after "On" in a "On Error" statement.
''' </summary>
Friend Class ErrorKeywordRecommender
Inherits AbstractKeywordRecommender
Protected Overrides Function RecommendKeywords(context As VisualBasicSyntaxContext, cancellationToken As CancellationToken) As IEnumerable(Of RecommendedKeyword)
Dim targetToken = context.TargetToken
If targetToken.IsKind(SyntaxKind.OnKeyword) AndAlso IsOnErrorStatement(targetToken.Parent) Then
Return {New RecommendedKeyword("Error Resume Next", VBFeaturesResources.OnErrorResumeNextKeywordToolTip),
New RecommendedKeyword("Error GoTo", VBFeaturesResources.OnErrorGotoKeywordToolTip)}
End If
' The Error statement (i.e. "Error 11" to raise an error)
If context.IsMultiLineStatementContext OrElse context.IsSingleLineStatementContext Then
Return SpecializedCollections.SingletonEnumerable(New RecommendedKeyword("Error",
VBFeaturesResources.ErrorKeywordToolTip))
End If
Return SpecializedCollections.EmptyEnumerable(Of RecommendedKeyword)()
End Function
End Class
End Namespace
|
KevinRansom/roslyn
|
src/Features/VisualBasic/Portable/Completion/KeywordRecommenders/OnErrorStatements/ErrorKeywordRecommender.vb
|
Visual Basic
|
apache-2.0
| 1,719
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form12
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.BackColor = System.Drawing.Color.Transparent
Me.Label1.Location = New System.Drawing.Point(12, 82)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(81, 13)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Enter Password"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(113, 79)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.PasswordChar = Global.Microsoft.VisualBasic.ChrW(42)
Me.TextBox1.Size = New System.Drawing.Size(218, 20)
Me.TextBox1.TabIndex = 1
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(231, 27)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(100, 20)
Me.TextBox2.TabIndex = 2
Me.TextBox2.Visible = False
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(256, 105)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(75, 23)
Me.Button1.TabIndex = 3
Me.Button1.Text = "Cancel"
Me.Button1.UseVisualStyleBackColor = True
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(175, 105)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(75, 23)
Me.Button2.TabIndex = 4
Me.Button2.Text = "Ok"
Me.Button2.UseVisualStyleBackColor = True
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(62, 105)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(107, 23)
Me.Button3.TabIndex = 5
Me.Button3.Text = "Change Password"
Me.Button3.UseVisualStyleBackColor = True
'
'Form12
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackgroundImage = Global.Autorun_Processor.My.Resources.Resources.form4_background
Me.ClientSize = New System.Drawing.Size(343, 160)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Me.Name = "Form12"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Form12"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
End Class
|
pratheeshrussell/Autorun-Processor
|
Autorun Processor/Form12.Designer.vb
|
Visual Basic
|
mit
| 4,426
|
Imports System
Imports System.Drawing
Imports System.Collections
Imports System.Windows.Forms
Public Class PaintCommandWithOther
'¥»Ãþ§O¹ê§@¤u¨ã¦C¤¤©|¥¼³B²zªº³¡¥÷(¶ñ¦â,¨ú¦â,©ñ¤jÃè)
Inherits PaintCommandWithText
Private clrWork As Color
Protected Overrides Sub ToolbarRadbtnSelect(ByVal obj As Object, ByVal ea As EventArgs)
MyBase.ToolbarRadbtnSelect(obj, ea)
Select Case LastCommand
Case 4
RemoveHandler pnWorkarea.MouseDown, AddressOf FillColorOnMouseDown
RemoveHandler pnWorkarea.MouseMove, AddressOf FillColorOnMouseMove
Case 5
RemoveHandler pnWorkarea.MouseDown, AddressOf GetPointColorOnMouseDown
RemoveHandler pnWorkarea.MouseMove, AddressOf GetPointColorOnMouseMove
RemoveHandler pnWorkarea.MouseUp, AddressOf GetPointColorOnMouseUp
Case 6
RemoveHandler pnWorkarea.MouseMove, AddressOf ZoomChangeOnMouseMove
RemoveHandler pnWorkarea.MouseUp, AddressOf ZoomChangeOnMouseUp
End Select
Select Case ToolbarCommand
Case 4 '¶ñ¥RÃC¦â
AddHandler pnWorkarea.MouseDown, AddressOf FillColorOnMouseDown
AddHandler pnWorkarea.MouseMove, AddressOf FillColorOnMouseMove
Case 5 '¨ú±oÃC¦â
AddHandler pnWorkarea.MouseDown, AddressOf GetPointColorOnMouseDown
AddHandler pnWorkarea.MouseMove, AddressOf GetPointColorOnMouseMove
AddHandler pnWorkarea.MouseUp, AddressOf GetPointColorOnMouseUp
Case 6 '©ñ¤jÃè
AddHandler pnWorkarea.MouseMove, AddressOf ZoomChangeOnMouseMove
AddHandler pnWorkarea.MouseUp, AddressOf ZoomChangeOnMouseUp
End Select
End Sub
Private Sub GetPointColorOnMouseDown(ByVal obj As Object, ByVal mea As MouseEventArgs)
'®Ú¾Úø¹Ï±¡§Î¨ú¦â
Dim bmpback As Bitmap = WorkareaChangeBmp()
Dim GetPoint As Point = GetScalePoint(New Point(mea.X, mea.Y))
Select Case mea.Button
Case MouseButtons.Left
clrFore = bmpback.GetPixel(GetPoint.X, GetPoint.Y)
btnColorFore.BackColor = clrFore
Case MouseButtons.Right
clrBack = bmpback.GetPixel(GetPoint.X, GetPoint.Y)
btnColorBack.BackColor = clrBack
End Select
bmpback.Dispose()
End Sub
Private Sub GetPointColorOnMouseMove(ByVal obj As Object, ByVal mea As MouseEventArgs)
SetMousePosition()
End Sub
Private Sub GetPointColorOnMouseUp(ByVal obj As Object, ByVal mea As MouseEventArgs)
radbtnToolbar(LastCommand - 1).Checked = True
Dim ea As EventArgs
ToolbarRadbtnSelect(radbtnToolbar(LastCommand - 1), ea.Empty) '¿ï¾Ü¤W¤@Ó©R¥O
End Sub
Private Sub FillColorOnMouseDown(ByVal obj As Object, ByVal mea As MouseEventArgs)
'¶ñ¦â¥\¯à¹ê§@
Dim bmpback As Bitmap = WorkareaChangeBmp()
Dim ptPo As Point = GetScalePoint(New Point(mea.X, mea.Y))
Dim pt, ptSum As Point
Dim Width, Height As Integer
Width = bmpback.Width
Height = bmpback.Height
clrWork = SelectUserColor(mea)
Dim clrFill As Color = bmpback.GetPixel(ptPo.X, ptPo.Y)
If clrWork.ToArgb = clrFill.ToArgb Then Return
Dim Points As New Stack
Dim ptDirEction() As Point = {New Point(0, -1), New Point(1, 0), _
New Point(0, 1), New Point(-1, 0)} '©w¸q¤è¦V
Dim i As Integer
Points.Push(ptPo)
Do
pt = Points.Pop()
bmpback.SetPixel(pt.X, pt.Y, clrWork)
For i = 0 To 3
ptSum = New Point(pt.X + ptDirEction(i).X, pt.Y + ptDirEction(i).Y)
If ptSum.X >= 0 AndAlso ptSum.X < Width AndAlso _
ptSum.Y >= 0 AndAlso ptSum.Y < Height Then
If bmpback.GetPixel(ptSum.X, ptSum.Y).ToArgb = clrFill.ToArgb Then
Points.Push(ptSum)
End If
End If
Next i
Loop While Points.Count > 0
WorkareaAddGraphicsItem(bmpback)
'³o¬qµ{¦¡½X,²ª½¬O¶°¦X©Ò¦³µ{¦¡½XªºÃa³B¤F.
'³t«×·¥ºC,°O¾ÐÅé·l¥¢¤j.¦Û±q¼g³oÓµ{¦¡¥H¨Ó,³oùؤ@ª½¬O¦Û¤v¦Ò¼{ªº«ÂI.
'¦]¬° ExtFloodFill ³oÓAPI,¨Ã¨S¦³³Q¥]§t¦b .Net ¤¤.
'©Ò¥H¤@ª½¸¨¤J¥æ¾Ô¤¤,¨ì©³n¤£n©I¥s API¨Ó¹F¦¨³oÓ¥\¯à.
'«á¨Ó¸Õ¹Ï§Q¥Î API ¨Ó»s§@®Éµo²{,n§¹¦¨³oÓ¥\¯à.¦Ü¤Ön¨Ï¥Î CreateSolidBrush
'CreateCompatibleDC,CreateCompatibleBitmap,SelectObject,DeleteObject,¤Î
'ExtFloodFill.ÁöµM¥i¥H§¹¦¨,³t«×¤W¤]¬Û·í¤£¿ù,¦ý³o¼Ë¤w¸g¤£¬O¦b¾Ç²ß VB.Net.
'¤£¦ý§â»P¸Ë¸mµLÃöªº¯S©Ê¯}Ãa«åºÉ,¤]Åýµ{¦¡¤¤ grax = Graphics.FormImage()
'³o¼Ëªº¤@P©Ê®ø¥¢.©Ò¥H¥ý¥H³o¼Ëªº¤èªk¨Ó»s§@³oÓ¥\¯à.
End Sub
Private Sub FillColorOnMouseMove(ByVal obj As Object, ByVal mea As MouseEventArgs)
SetMousePosition()
End Sub
Private Sub ZoomChangeOnMouseMove(ByVal obj As Object, ByVal mea As MouseEventArgs)
SetMousePosition()
End Sub
Private Sub ZoomChangeOnMouseUp(ByVal obj As Object, ByVal mea As MouseEventArgs)
End Sub
Protected Overridable Sub WorkareaAddGraphicsItem(ByVal bmp As Bitmap)
'¥Ñ PaintWithMenuImage ¹ê§@,±N¥þ¼v¼v¦s¤Jø¹Ï¦æ¬°
End Sub
End Class
|
neville1/MSPaint
|
MsPaint Sub/PaintCommandWithOther.vb
|
Visual Basic
|
mit
| 5,359
|
Imports System.Runtime.CompilerServices
Imports System.Text.RegularExpressions
Public Module StringParser
<Extension()>
Public Function GetSequenceBuildStr(str As String) As String
Const pattern As String = "(A(S[123][0-9a-f]{2}[0-5][0-9a-f])+)"
Return Regex.Match(str, pattern).Value
End Function
<Extension()>
Public Function GetSymbolsBuildStr(str As String) As String
Const pattern As String = "[BLMR]([0-9]{3}x[0-9]{3})(S[123][0-9a-f]{2}[0-5][0-9a-f][0-9]{3}x[0-9]{3})*"
Dim signBoxResult = Regex.Match(str, pattern).Value
Return signBoxResult
End Function
<Extension()>
Public Function GetSytlingStr(str As String) As String
Const pattern As String = "(-.*)"
Dim result = Regex.Match(str, pattern).Value
Return result
End Function
<Extension()>
Public Function getSymbolsColors(stylingStr As String) As List(Of String)
Const pattern As String = "(C\d\d_([\da-f]{6}|[\da-f]{6},[\da-f]{6}|[^_]+,[^_]+|[^_]+)_)"
Dim result = Regex.Split(stylingStr, pattern)
Return result.Where(Function(s) s.Contains("C")).ToList()
End Function
<Extension()>
Public Function GetSymbolIndex(stylingStr As String, prefix As String) As Integer
Dim pattern As String = "(" & prefix & "\d\d)"
Dim result = Regex.Match(stylingStr, pattern).Value.Replace(prefix, "")
Return Convert.ToInt32(result)
End Function
<Extension()>
Public Function GetSize(stylingStr As String) As Double
Const pattern As String = "(,\d+(?:\.\d+)?)"
Dim result = Regex.Match(stylingStr, pattern).Value.Replace(",", "")
Return Convert.ToDouble(result)
End Function
<Extension()>
Public Function GetColorString(stylingStr As String) As String
Const pattern As String = "(_([\da-f]{6}|[\da-f]{6},[\da-f]{6}|[^_]+,[^_]+|[^_]+)_)"
Dim result = Regex.Match(stylingStr, pattern).Value.Replace("_", "")
Return result
End Function
<Extension()>
Public Function getSymbolsSizes(stylingStr As String) As List(Of String)
Const pattern As String = "(Z\d\d,\d+(?:\.\d+)?)"
Dim result = Regex.Split(stylingStr, pattern)
Return result.Where(Function(s) s.Contains("Z")).ToList()
End Function
Friend Function SplitSymbolBuildStr(ByVal buildStr As String) As List(Of String)
Dim arrStrings = buildStr.Split("S")
Return (From str1 In arrStrings Where str1.Length = 12 AndAlso Not str1.Contains("M") AndAlso Not str1.Contains("L") AndAlso Not str1.Contains("R") Select str1).ToList()
End Function
Friend Function SplitSequenceBuildStr(ByVal buildStr As String) As List(Of String)
Dim arrStrings = buildStr.Split("S")
Return (From str1 In arrStrings Where str1.Length = 5 Select str1).ToList()
End Function
Public Function IsSignBox(txt As String) As Boolean
Const pattern As String = "((A(S[123][0-9a-f]{2}[0-5][0-9a-f])+)?[BLMR]([0-9]{3}x[0-9]{3})(S[123][0-9a-f]{2}[0-5][0-9a-f][0-9]{3}x[0-9]{3})*|S38[7-9ab][0-5][0-9a-f][0-9]{3}x[0-9]{3})((A(S[123][0-9a-f]{2}[0-5][0-9a-f])+)?[BLMR]([0-9]{3}x[0-9]{3})(S[123][0-9a-f]{2}[0-5][0-9a-f][0-9]{3}x[0-9]{3})*|S38[7-9ab][0-5][0-9a-f][0-9]{3}x[0-9]{3})*"
Dim result = Text.RegularExpressions.Regex.IsMatch(txt, pattern)
Return result
End Function
Public Function GetBuildString(termRows As SPMLDataSet.termRow()) As String
For Each row In TermRows
'If isBuildString(row.term_Text) OrElse isPunctuation(row.term_Text) Then
If isBuildString(row.term_Text) OrElse IsSignBox(row.term_Text) Then
Return row.term_Text
End If
Next
Return ""
End Function
Public Function IsBuildString(str As String) As Boolean
Const pattern As String = "[BLMR]([0-9]{3}x[0-9]{3})(S[123][0-9a-f]{2}[0-5][0-9a-f][0-9]{3}x[0-9]{3})*"
Dim result = Text.RegularExpressions.Regex.IsMatch(str, pattern)
Return result
End Function
Public Function IsPunctuation(str As String) As Boolean
Const pattern As String = "S38[7-9ab][0-5][0-9a-f][0-9]{3}x[0-9]{3}"
Dim result = Text.RegularExpressions.Regex.IsMatch(str, pattern)
Return result
End Function
Public Function GetPunctuation(str As String) As String
Const pattern As String = "S38[7-9ab][0-5][0-9a-f][0-9]{3}x[0-9]{3}"
Dim result = Text.RegularExpressions.Regex.Match(str, pattern)
If result.Success Then
Return result.Value
Else
Return String.Empty
End If
End Function
Public Function GetTermsNonBuild(termRows As SPMLDataSet.termRow()) As List(Of String)
Return (From row In TermRows Where Not IsBuildString(row.term_Text) AndAlso Not IsSignBox(row.term_Text) Select row.term_Text).ToList()
End Function
Public Function EncodeXml(xml As String) As String
Return xml.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace("""", """).Replace("'", "'")
End Function
Public Function UnEncodeXml(xml As String) As String
Return xml.Replace("<", "<").Replace(">", ">").Replace(""", """").Replace("'", "'").Replace("&", "&")
End Function
End Module
|
JonathanDDuncan/SignWriterStudio
|
SPML/StringParser.vb
|
Visual Basic
|
mit
| 5,346
|
'-------------------------------------------------------------------------------------------'
' Inicio del codigo
'-------------------------------------------------------------------------------------------'
' Importando librerias
'-------------------------------------------------------------------------------------------'
Imports System.Data
'-------------------------------------------------------------------------------------------'
' Inicio de clase "fCotizaciones_SID"
'-------------------------------------------------------------------------------------------'
Partial Class fCotizaciones_SID
Inherits vis2formularios.frmReporte
Dim loObjetoReporte As CrystalDecisions.CrystalReports.Engine.ReportDocument
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim loComandoSeleccionar As New StringBuilder()
loComandoSeleccionar.AppendLine(" SELECT Cotizaciones.Cod_Cli, ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Clientes.Generico = 0 AND CAST (Cotizaciones.Nom_Cli AS VARCHAR) = '') THEN Clientes.Nom_Cli ELSE ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Cotizaciones.Nom_Cli = '') THEN Clientes.Nom_Cli ELSE Cotizaciones.Nom_Cli END) END) AS Nom_Cli, ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Clientes.Generico = 0 AND CAST (Cotizaciones.Nom_Cli AS VARCHAR) = '') THEN Clientes.Rif ELSE ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Cotizaciones.Rif = '') THEN Clientes.Rif ELSE Cotizaciones.Rif END) END) AS Rif, ")
loComandoSeleccionar.AppendLine(" Clientes.Nit, ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Clientes.Generico = 0 AND CAST (Cotizaciones.Nom_Cli AS VARCHAR) = '') THEN SUBSTRING(Clientes.Dir_Fis,1, 200) ELSE ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (SUBSTRING(Cotizaciones.Dir_Fis,1, 200) = '') THEN SUBSTRING(Clientes.Dir_Fis,1, 200) ELSE SUBSTRING(Cotizaciones.Dir_Fis,1, 200) END) END) AS Dir_Fis, ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Clientes.Generico = 0 AND CAST (Cotizaciones.Nom_Cli AS VARCHAR) = '') THEN Clientes.Telefonos ELSE ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Cotizaciones.Telefonos = '') THEN Clientes.Telefonos ELSE Cotizaciones.Telefonos END) END) AS Telefonos, ")
'loComandoSeleccionar.AppendLine(" Clientes.Nom_Cli, ")
'loComandoSeleccionar.AppendLine(" Clientes.Rif, ")
'loComandoSeleccionar.AppendLine(" Clientes.Nit, ")
'loComandoSeleccionar.AppendLine(" Clientes.Dir_Fis, ")
'loComandoSeleccionar.AppendLine(" Clientes.Telefonos, ")
loComandoSeleccionar.AppendLine(" Clientes.Fax, ")
loComandoSeleccionar.AppendLine(" Clientes.Contacto, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Nom_Cli As Nom_Gen, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Rif As Rif_Gen, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Nit As Nit_Gen, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Dir_Fis As Dir_Gen, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Telefonos As Tel_Gen, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Documento, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Fec_Ini, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Fec_Fin, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Mon_Bru, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Por_Des1, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Por_Rec1, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Mon_Des1, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Mon_Rec1, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Mon_Imp1, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Mon_Net, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Cod_For, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Dis_Imp, ")
loComandoSeleccionar.AppendLine(" SUBSTRING(Formas_Pagos.Nom_For,1,20) AS Nom_For, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Cod_Ven, ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Comentario, ")
loComandoSeleccionar.AppendLine(" Vendedores.Nom_Ven, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Cod_Art, ")
'loComandoSeleccionar.AppendLine(" Articulos.Nom_Art, ")
loComandoSeleccionar.AppendLine(" CASE WHEN Articulos.Generico = 0 THEN Articulos.Nom_Art ")
loComandoSeleccionar.AppendLine(" ELSE Renglones_Cotizaciones.Notas END AS Nom_Art, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Renglon, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Comentario AS Comentario_renglon, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Can_Art1, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Cod_Uni, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Precio1, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Por_Des, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Mon_Net As Neto, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Por_Imp1 As Por_Imp, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Cod_Imp, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones.Mon_Imp1 As Impuesto, ")
loComandoSeleccionar.AppendLine(" " & goServicios.mObtenerCampoFormatoSQL(goUsuario.pcNombre) & " As Operador")
loComandoSeleccionar.AppendLine(" FROM Cotizaciones, ")
loComandoSeleccionar.AppendLine(" Renglones_Cotizaciones, ")
loComandoSeleccionar.AppendLine(" Clientes, ")
loComandoSeleccionar.AppendLine(" Formas_Pagos, ")
loComandoSeleccionar.AppendLine(" Vendedores, ")
loComandoSeleccionar.AppendLine(" Articulos ")
loComandoSeleccionar.AppendLine(" WHERE Cotizaciones.Documento = Renglones_Cotizaciones.Documento AND ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Cod_Cli = Clientes.Cod_Cli AND ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Cod_For = Formas_Pagos.Cod_For AND ")
loComandoSeleccionar.AppendLine(" Cotizaciones.Cod_Ven = Vendedores.Cod_Ven AND ")
loComandoSeleccionar.AppendLine(" Articulos.Cod_Art = Renglones_Cotizaciones.Cod_Art AND " & cusAplicacion.goFormatos.pcCondicionPrincipal)
Dim loServicios As New cusDatos.goDatos
Dim laDatosReporte As DataSet = loServicios.mObtenerTodosSinEsquema(loComandoSeleccionar.ToString, "curReportes")
Dim lcXml As String = "<impuesto></impuesto>"
Dim lcPorcentajesImpueto As String
Dim loImpuestos As New System.Xml.XmlDocument()
lcPorcentajesImpueto = "("
'Recorre cada renglon de la tabla
For lnNumeroFila As Integer = 0 To laDatosReporte.Tables(0).Rows.Count - 1
lcXml = laDatosReporte.Tables(0).Rows(lnNumeroFila).Item("dis_imp")
If String.IsNullOrEmpty(lcXml.Trim()) Then
Continue For
End If
loImpuestos.LoadXml(lcXml)
'En cada renglón lee el contenido de la distribució de impuestos
For Each loImpuesto As System.Xml.XmlNode In loImpuestos.SelectNodes("impuestos/impuesto")
If lnNumeroFila = laDatosReporte.Tables(0).Rows.Count - 1 Then
If CDec(loImpuesto.SelectSingleNode("porcentaje").InnerText) <> 0 Then
lcPorcentajesImpueto = lcPorcentajesImpueto & ", " & CDec(loImpuesto.SelectSingleNode("porcentaje").InnerText) & "%"
End If
End If
Next loImpuesto
Next lnNumeroFila
lcPorcentajesImpueto = lcPorcentajesImpueto & ")"
lcPorcentajesImpueto = lcPorcentajesImpueto.Replace("(,", "(")
lcPorcentajesImpueto = lcPorcentajesImpueto.Replace(".", ",")
'--------------------------------------------------'
' Carga la imagen del logo en cusReportes '
'--------------------------------------------------'
Me.mCargarLogoEmpresa(laDatosReporte.Tables(0), "LogoEmpresa")
'-------------------------------------------------------------------------------------------------------
' Verificando si el select (tabla nº0) trae registros
'-------------------------------------------------------------------------------------------------------
If (laDatosReporte.Tables(0).Rows.Count <= 0) Then
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Información", _
"No se Encontraron Registros para los Parámetros Especificados. ", _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Informacion, _
"350px", _
"200px")
End If
loObjetoReporte = cusAplicacion.goFormatos.mCargarInforme("fCotizaciones_SID", laDatosReporte)
loObjetoReporte.SetParameterValue("Leyenda_Cotizaciones_Tipo1", goOpciones.mObtener("LEYCOTVEN1", "M"))
loObjetoReporte.SetParameterValue("Leyenda_Cotizaciones_Tipo2", goOpciones.mObtener("LEYCOTVEN2", "M"))
loObjetoReporte.SetParameterValue("Leyenda_Cotizaciones_Tipo3", goOpciones.mObtener("LEYCOTVEN3", "M"))
loObjetoReporte.SetParameterValue("Leyenda_Cotizaciones_Tipo4", goOpciones.mObtener("LEYCOTVEN4", "M"))
CType(loObjetoReporte.ReportDefinition.ReportObjects("Text38"), CrystalDecisions.CrystalReports.Engine.TextObject).Text = lcPorcentajesImpueto.ToString
Me.mTraducirReporte(loObjetoReporte)
Me.mFormatearCamposReporte(loObjetoReporte)
Me.crvfCotizaciones_SID.ReportSource = loObjetoReporte
Catch loExcepcion As Exception
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Error", _
"No se pudo Completar el Proceso: " & loExcepcion.Message, _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Error, _
"auto", _
"auto")
End Try
End Sub
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
Try
loObjetoReporte.Close()
Catch loExcepcion As Exception
End Try
End Sub
End Class
'-------------------------------------------------------------------------------------------'
' Fin del codigo
'-------------------------------------------------------------------------------------------'
' JJD: 13/12/08: Codigo inicial
'-------------------------------------------------------------------------------------------'
' JJD: 24/12/09: Se le incluyo los montos de descuentos y recargos.
'-------------------------------------------------------------------------------------------'
' JJD: 09/01/10: Se cambio para que leyera datos de genericos de la Cotizacion cuando aplique
'-------------------------------------------------------------------------------------------'
' CMS: 09/04/10: Se aplicaron los metodos carga de imagen y validacion de registro cero
'-------------------------------------------------------------------------------------------'
' CMS: 11/06/10: Se Agregaron los siguientes campos: Cotizaciones.Dis_Imp
' y Renglones_Cotizaciones.Por_des
'-------------------------------------------------------------------------------------------'
|
kodeitsolutions/ef-reports
|
fCotizaciones_SID.aspx.vb
|
Visual Basic
|
mit
| 12,775
|
Imports CodeCracker.VisualBasic.Design
Imports Xunit
Namespace Design
Public Class NameOfTests
Inherits CodeFixVerifier(Of NameOfAnalyzer, NameOfCodeFixProvider)
<Fact>
Public Async Function IgnoreIfStringLiteralIsWhitespace() As Task
Const test = "
Public Class TypeName
Sub Foo()
Dim whatever = """"
End Sub
End Class"
Await VerifyBasicHasNoDiagnosticsAsync(test)
End Function
<Fact>
Public Async Function IgnoreIfStringLiteralIsNothing() As Task
Const test = "
Public Class TypeName
Sub Foo()
Dim whatever = Nothing
End Sub
End Class"
Await VerifyBasicHasNoDiagnosticsAsync(test)
End Function
<Fact>
Public Async Function IgnoreIfConstructorHasNoParameters() As Task
Const test = "
Public Class TypeName
Public Sub New()
dim whatever = ""b""
End Sub
End Class"
Await VerifyBasicHasNoDiagnosticsAsync(test)
End Function
<Fact>
Public Async Function IgnoreIfMethodHasNoParameters() As Task
Const test = "
Public Class TypeName
Sub Foo()
Dim whatever = """"
End Sub
End Class"
Await VerifyBasicHasNoDiagnosticsAsync(test)
End Function
<Fact>
Public Async Function IgnoreIfMethodHasParametersUnlineOfStringLiteral() As Task
Const test = "
Public Class TypeName
Sub Foo(a As String)
Dim whatever = ""b""
End Sub
End Class"
Await VerifyBasicHasNoDiagnosticsAsync(test)
End Function
<Fact>
Public Async Function WhenUsingStringLiteralEqualsParameterNameReturnAnalyzerCreatesDiagnostic() As Task
Const test = "
Public Class TypeName
Sub Foo(b As String)
Dim whatever = ""b""
End Sub
End Class"
Dim expected = New DiagnosticResult With {
.Id = DiagnosticId.NameOf.ToDiagnosticId(),
.Message = "Use 'NameOf(b)' instead of specifying the parameter name.",
.Severity = Microsoft.CodeAnalysis.DiagnosticSeverity.Warning,
.Locations = {New DiagnosticResultLocation("Test0.vb", 4, 24)}
}
Await VerifyBasicDiagnosticAsync(test, expected)
End Function
<Fact>
Public Async Function WhenUsingStringLiteralEqualsParameterNameInConstructorFixItToNameof() As Task
Const test = "
Public Class TypeName
Sub New(b As String)
Dim whatever = ""b""
End Sub
End Class"
Const fixtest = "
Public Class TypeName
Sub New(b As String)
Dim whatever = NameOf(b)
End Sub
End Class"
Await VerifyBasicFixAsync(test, fixtest, 0)
End Function
<Fact>
Public Async Function WhenUsingStringLiteralEqualsParameterNameInConstructorFixItToNameofMustKeepComments() As Task
Const test = "
Public Class TypeName
Sub New(b As String)
'a
Dim whatever = ""b"" 'd
'b
End Sub
End Class"
Const fixtest = "
Public Class TypeName
Sub New(b As String)
'a
Dim whatever = NameOf(b) 'd
'b
End Sub
End Class"
Await VerifyBasicFixAsync(test, fixtest, 0)
End Function
<Fact>
Public Async Function WhenUsingStringLiteralEqualsParameterNameInMethodFixItToNameof() As Task
Const test = "
Public Class TypeName
Sub Foo(b As String)
Dim whatever = ""b""
End Sub
End Class"
Const fixtest = "
Public Class TypeName
Sub Foo(b As String)
Dim whatever = NameOf(b)
End Sub
End Class"
Await VerifyBasicFixAsync(test, fixtest, 0)
End Function
<Fact>
Public Async Function WhenUsingStringLiteralEqualsParameterNameInMethodMustKeepComments() As Task
Const test = "
Public Class TypeName
Sub Foo(b As String)
'a
Dim whatever = ""b""'d
'b
End Sub
End Class"
Const fixtest = "
Public Class TypeName
Sub Foo(b As String)
'a
Dim whatever = NameOf(b) 'd
'b
End Sub
End Class"
Await VerifyBasicFixAsync(test, fixtest, 0)
End Function
<Fact>
Public Async Function IgnoreAttributes() As Task
Const test = "
Public Class TypeName
<Whatever(""a"")>
Sub Foo(a as String)
End Sub
End Class"
Await VerifyBasicHasNoDiagnosticsAsync(test)
End Function
<Fact>
Public Async Function FixAllInDocument() As Task
Const source = "
Public Class TypeName
Sub Go(x As Integer, y As Integer, z As Integer)
Dim a = ""x""
Dim b = ""y""
Dim c = ""z""
End Sub
End Class"
Const fixtest = "
Public Class TypeName
Sub Go(x As Integer, y As Integer, z As Integer)
Dim a = NameOf(x)
Dim b = NameOf(y)
Dim c = NameOf(z)
End Sub
End Class"
Await VerifyBasicFixAllAsync(source, fixtest)
End Function
End Class
End Namespace
|
eirielson/code-cracker
|
test/VisualBasic/CodeCracker.Test/Design/NameOfTests.vb
|
Visual Basic
|
apache-2.0
| 5,143
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports System.IO
Imports System.Reflection.Metadata
Imports System.Reflection.PortableExecutable
Imports System.Xml.Linq
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Collections
Imports Microsoft.CodeAnalysis.Emit
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.UnitTests
Imports Roslyn.Test.Utilities
Partial Public Class InternalsVisibleToAndStrongNameTests
Inherits BasicTestBase
#Region "Helpers"
Public Sub New()
SigningTestHelpers.InstallKey()
End Sub
Private Shared ReadOnly s_keyPairFile As String = SigningTestHelpers.KeyPairFile
Private Shared ReadOnly s_publicKeyFile As String = SigningTestHelpers.PublicKeyFile
Private Shared ReadOnly s_publicKey As ImmutableArray(Of Byte) = SigningTestHelpers.PublicKey
Private Shared ReadOnly s_defaultProvider As DesktopStrongNameProvider = New SigningTestHelpers.VirtualizedStrongNameProvider(ImmutableArray.Create(Of String)())
Private Shared Function GetProviderWithPath(keyFilePath As String) As DesktopStrongNameProvider
Return New SigningTestHelpers.VirtualizedStrongNameProvider(ImmutableArray.Create(keyFilePath))
End Function
#End Region
#Region "Naming Tests"
<Fact>
Public Sub PubKeyFromKeyFileAttribute()
Dim x = s_keyPairFile
Dim s = "<Assembly: System.Reflection.AssemblyKeyFile(""" & x & """)>" & vbCrLf &
"Public Class C" & vbCrLf &
"End Class"
Dim g = Guid.NewGuid()
Dim other = VisualBasicCompilation.Create(
g.ToString(),
{VisualBasicSyntaxTree.ParseText(s)},
{MscorlibRef},
TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
other.VerifyDiagnostics()
Assert.True(ByteSequenceComparer.Equals(s_publicKey, other.Assembly.Identity.PublicKey))
End Sub
<Fact>
Public Sub PubKeyFromKeyFileAttribute_AssemblyKeyFileResolver()
Dim keyFileDir = Path.GetDirectoryName(s_keyPairFile)
Dim keyFileName = Path.GetFileName(s_keyPairFile)
Dim s = "<Assembly: System.Reflection.AssemblyKeyFile(""" & keyFileName & """)>" & vbCrLf &
"Public Class C" & vbCrLf &
"End Class"
Dim syntaxTree = ParseAndVerify(s)
' verify failure with default assembly key file resolver
Dim comp = CreateCompilationWithMscorlib({syntaxTree}, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
comp.VerifyDiagnostics(
Diagnostic(ERRID.ERR_PublicKeyFileFailure).WithArguments(keyFileName, CodeAnalysisResources.FileNotFound))
Assert.True(comp.Assembly.Identity.PublicKey.IsEmpty)
' verify success with custom assembly key file resolver with keyFileDir added to search paths
comp = VisualBasicCompilation.Create(
GetUniqueName(),
{syntaxTree},
{MscorlibRef},
TestOptions.ReleaseDll.WithStrongNameProvider(GetProviderWithPath(keyFileDir)))
comp.VerifyDiagnostics()
Assert.True(ByteSequenceComparer.Equals(s_publicKey, comp.Assembly.Identity.PublicKey))
End Sub
<Fact>
Public Sub PubKeyFromKeyFileAttribute_AssemblyKeyFileResolver_RelativeToCurrentParent()
Dim keyFileDir = Path.GetDirectoryName(s_keyPairFile)
Dim keyFileName = Path.GetFileName(s_keyPairFile)
Dim s = "<Assembly: System.Reflection.AssemblyKeyFile(""..\" & keyFileName & """)>" & vbCrLf &
"Public Class C" & vbCrLf &
"End Class"
Dim syntaxTree = ParseAndVerify(s)
' verify failure with default assembly key file resolver
Dim comp As Compilation = CreateCompilationWithMscorlib({syntaxTree}, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
comp.VerifyDiagnostics(
Diagnostic(ERRID.ERR_PublicKeyFileFailure).WithArguments("..\" & keyFileName, CodeAnalysisResources.FileNotFound))
Assert.True(comp.Assembly.Identity.PublicKey.IsEmpty)
' verify success with custom assembly key file resolver with keyFileDir\TempSubDir added to search paths
comp = VisualBasicCompilation.Create(
GetUniqueName(),
references:={MscorlibRef},
syntaxTrees:={syntaxTree},
options:=TestOptions.ReleaseDll.WithStrongNameProvider(GetProviderWithPath(PathUtilities.CombineAbsoluteAndRelativePaths(keyFileDir, "TempSubDir\"))))
comp.VerifyDiagnostics()
Assert.True(ByteSequenceComparer.Equals(s_publicKey, comp.Assembly.Identity.PublicKey))
End Sub
<Fact>
Public Sub PubKeyFromKeyContainerAttribute()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation>
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblyKeyName("roslynTestContainer")>
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
other.VerifyDiagnostics()
Assert.True(ByteSequenceComparer.Equals(s_publicKey, other.Assembly.Identity.PublicKey))
End Sub
<Fact>
Public Sub PubKeyFromKeyFileOptions()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation>
<file name="a.vb"><![CDATA[
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>,
options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_keyPairFile).WithStrongNameProvider(s_defaultProvider))
other.VerifyDiagnostics()
Assert.True(ByteSequenceComparer.Equals(s_publicKey, other.Assembly.Identity.PublicKey))
End Sub
<Fact>
Public Sub PubKeyFromKeyFileOptions_ReferenceResolver()
Dim keyFileDir = Path.GetDirectoryName(s_keyPairFile)
Dim keyFileName = Path.GetFileName(s_keyPairFile)
Dim source = <![CDATA[
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
Dim references = {MscorlibRef}
Dim syntaxTrees = {ParseAndVerify(source)}
' verify failure with default resolver
Dim comp = VisualBasicCompilation.Create(
GetUniqueName(),
references:=references,
syntaxTrees:=syntaxTrees,
options:=TestOptions.ReleaseDll.WithCryptoKeyFile(keyFileName).WithStrongNameProvider(s_defaultProvider))
comp.VerifyDiagnostics(
Diagnostic(ERRID.ERR_PublicKeyFileFailure).WithArguments(keyFileName, CodeAnalysisResources.FileNotFound))
Assert.True(comp.Assembly.Identity.PublicKey.IsEmpty)
' verify success with custom assembly key file resolver with keyFileDir added to search paths
comp = VisualBasicCompilation.Create(
GetUniqueName(),
references:=references,
syntaxTrees:=syntaxTrees,
options:=TestOptions.ReleaseDll.WithCryptoKeyFile(keyFileName).WithStrongNameProvider(GetProviderWithPath(keyFileDir)))
comp.VerifyDiagnostics()
Assert.True(ByteSequenceComparer.Equals(s_publicKey, comp.Assembly.Identity.PublicKey))
End Sub
<Fact>
Public Sub PubKeyFromKeyFileOptionsJustPublicKey()
Dim s =
<compilation>
<file name="Clavelle.vb"><![CDATA[
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>
Dim other = CreateCompilationWithMscorlib(s, options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_publicKeyFile).WithDelaySign(True).WithStrongNameProvider(s_defaultProvider))
Assert.Empty(other.GetDiagnostics())
Assert.True(ByteSequenceComparer.Equals(TestResources.General.snPublicKey.AsImmutableOrNull(), other.Assembly.Identity.PublicKey))
End Sub
<Fact>
Public Sub PubKeyFromKeyFileOptionsJustPublicKey_ReferenceResolver()
Dim publicKeyFileDir = Path.GetDirectoryName(s_publicKeyFile)
Dim publicKeyFileName = Path.GetFileName(s_publicKeyFile)
Dim source = <![CDATA[
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
Dim references = {MscorlibRef}
Dim syntaxTrees = {ParseAndVerify(source)}
' verify failure with default resolver
Dim comp = VisualBasicCompilation.Create(
GetUniqueName(),
references:=references,
syntaxTrees:=syntaxTrees,
options:=TestOptions.ReleaseDll.WithCryptoKeyFile(publicKeyFileName).WithDelaySign(True).WithStrongNameProvider(s_defaultProvider))
' error CS7027: Error extracting public key from file 'PublicKeyFile.snk' -- File not found.
' warning CS7033: Delay signing was specified and requires a public key, but no public key was specified
comp.VerifyDiagnostics(
Diagnostic(ERRID.ERR_PublicKeyFileFailure).WithArguments(publicKeyFileName, CodeAnalysisResources.FileNotFound),
Diagnostic(ERRID.WRN_DelaySignButNoKey))
Assert.True(comp.Assembly.Identity.PublicKey.IsEmpty)
' verify success with custom assembly key file resolver with publicKeyFileDir added to search paths
comp = VisualBasicCompilation.Create(
GetUniqueName(),
references:=references,
syntaxTrees:=syntaxTrees,
options:=TestOptions.ReleaseDll.WithCryptoKeyFile(publicKeyFileName).WithDelaySign(True).WithStrongNameProvider(GetProviderWithPath(publicKeyFileDir)))
comp.VerifyDiagnostics()
Assert.True(ByteSequenceComparer.Equals(s_publicKey, comp.Assembly.Identity.PublicKey))
End Sub
<Fact>
Public Sub PubKeyFileNotFoundOptions()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation>
<file name="a.vb"><![CDATA[
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>,
options:=TestOptions.ReleaseExe.WithCryptoKeyFile("foo").WithStrongNameProvider(s_defaultProvider))
CompilationUtils.AssertTheseDeclarationDiagnostics(other,
<errors>
BC36980: Error extracting public key from file 'foo': <%= CodeAnalysisResources.FileNotFound %>
</errors>)
Assert.True(other.Assembly.Identity.PublicKey.IsEmpty)
End Sub
<Fact>
Public Sub KeyFileAttributeEmpty()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation>
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblyKeyFile("")>
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
other.VerifyDiagnostics()
Assert.True(other.Assembly.Identity.PublicKey.IsEmpty)
End Sub
<Fact>
Public Sub KeyContainerEmpty()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation>
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblyKeyName("")>
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
other.VerifyDiagnostics()
Assert.True(other.Assembly.Identity.PublicKey.IsEmpty)
End Sub
<Fact>
Public Sub PublicKeyFromOptions_DelaySigned()
Dim source =
<compilation>
<file name="a.vb"><![CDATA[
<assembly: System.Reflection.AssemblyDelaySign(True)>
Public Class C
End Class
]]>
</file>
</compilation>
Dim c = CreateCompilationWithMscorlib(source, options:=TestOptions.ReleaseDll.WithCryptoPublicKey(s_publicKey))
c.VerifyDiagnostics()
Assert.True(ByteSequenceComparer.Equals(s_publicKey, c.Assembly.Identity.PublicKey))
Dim Metadata = ModuleMetadata.CreateFromImage(c.EmitToArray())
Dim identity = Metadata.Module.ReadAssemblyIdentityOrThrow()
Assert.True(identity.HasPublicKey)
AssertEx.Equal(identity.PublicKey, s_publicKey)
Assert.Equal(CorFlags.ILOnly, Metadata.Module.PEReaderOpt.PEHeaders.CorHeader.Flags)
End Sub
<Fact>
Public Sub PublicKeyFromOptions_OssSigned()
' attributes are ignored
Dim source =
<compilation>
<file name="a.vb"><![CDATA[
<assembly: System.Reflection.AssemblyKeyName("roslynTestContainer")>
<assembly: System.Reflection.AssemblyKeyFile("some file")>
Public Class C
End Class
]]>
</file>
</compilation>
Dim c = CreateCompilationWithMscorlib(source, options:=TestOptions.ReleaseDll.WithCryptoPublicKey(s_publicKey))
c.VerifyDiagnostics()
Assert.True(ByteSequenceComparer.Equals(s_publicKey, c.Assembly.Identity.PublicKey))
Dim Metadata = ModuleMetadata.CreateFromImage(c.EmitToArray())
Dim identity = Metadata.Module.ReadAssemblyIdentityOrThrow()
Assert.True(identity.HasPublicKey)
AssertEx.Equal(identity.PublicKey, s_publicKey)
Assert.Equal(CorFlags.ILOnly Or CorFlags.StrongNameSigned, Metadata.Module.PEReaderOpt.PEHeaders.CorHeader.Flags)
End Sub
<Fact>
Public Sub PublicKeyFromOptions_InvalidCompilationOptions()
Dim source =
<compilation>
<file name="a.vb"><![CDATA[
Public Class C
End Class
]]>
</file>
</compilation>
Dim c = CreateCompilationWithMscorlib(source, options:=TestOptions.ReleaseDll.
WithCryptoPublicKey(ImmutableArray.Create(Of Byte)(1, 2, 3)).
WithCryptoKeyContainer("roslynTestContainer").
WithCryptoKeyFile("file.snk").
WithStrongNameProvider(s_defaultProvider))
AssertTheseDiagnostics(c,
<error>
BC2014: the value '01-02-03' is invalid for option 'CryptoPublicKey'
BC2046: Compilation options 'CryptoPublicKey' and 'CryptoKeyContainer' can't both be specified at the same time.
BC2046: Compilation options 'CryptoPublicKey' and 'CryptoKeyFile' can't both be specified at the same time.
</error>)
End Sub
<Fact>
Public Sub PubKeyFileBogusOptions()
Dim tmp = Temp.CreateFile().WriteAllBytes(New Byte() {1, 2, 3, 4})
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation>
<file>
<![CDATA[
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>,
options:=TestOptions.ReleaseDll.WithCryptoKeyFile(tmp.Path).WithStrongNameProvider(New DesktopStrongNameProvider()))
other.VerifyDiagnostics(
Diagnostic(ERRID.ERR_PublicKeyFileFailure).WithArguments(tmp.Path, CodeAnalysisResources.InvalidPublicKey))
Assert.True(other.Assembly.Identity.PublicKey.IsEmpty)
End Sub
<ConditionalFact(GetType(IsEnglishLocal))>
Public Sub PubKeyContainerBogusOptions()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation>
<file name="a.vb"><![CDATA[
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, options:=TestOptions.ReleaseExe.WithCryptoKeyContainer("foo").WithStrongNameProvider(s_defaultProvider))
' CompilationUtils.AssertTheseDeclarationDiagnostics(other,
' <errors>
'BC36981: Error extracting public key from container 'foo': Keyset does not exist (Exception from HRESULT: 0x80090016)
' </errors>)
Dim err = other.GetDeclarationDiagnostics().Single()
Assert.Equal(ERRID.ERR_PublicKeyContainerFailure, err.Code)
Assert.Equal(2, err.Arguments.Count)
Assert.Equal("foo", DirectCast(err.Arguments(0), String))
Assert.True(DirectCast(err.Arguments(1), String).EndsWith(" HRESULT: 0x80090016)", StringComparison.Ordinal))
Assert.True(other.Assembly.Identity.PublicKey.IsEmpty)
End Sub
#End Region
#Region "IVT Access checking"
<Fact>
Public Sub IVTBasicCompilation()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation name="HasIVTToCompilation">
<file name="a.vb"><![CDATA[
<Assembly: System.Runtime.CompilerServices.InternalsVisibleTo("WantsIVTAccess")>
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
other.VerifyDiagnostics()
Dim c As VisualBasicCompilation = CreateCompilationWithMscorlibAndReferences(
<compilation name="WantsIVTAccessButCantHave">
<file name="a.vb"><![CDATA[
Public Class A
Friend Class B
Protected Sub New(o As C)
o.Foo()
End Sub
End Class
End Class
]]>
</file>
</compilation>, {New VisualBasicCompilationReference(other)}, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
'compilation should not succeed, and internals should not be imported.
c.GetDiagnostics()
CompilationUtils.AssertTheseDiagnostics(c, <error>
BC30390: 'C.Friend Sub Foo()' is not accessible in this context because it is 'Friend'.
o.Foo()
~~~~~
</error>)
Dim c2 As VisualBasicCompilation = CreateCompilationWithMscorlibAndReferences(
<compilation name="WantsIVTAccess">
<file name="a.vb"><![CDATA[
Public Class A
Friend Class B
Protected Sub New(o As C)
o.Foo()
End Sub
End Class
End Class
]]>
</file>
</compilation>, {New VisualBasicCompilationReference(other)}, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
c2.VerifyDiagnostics()
End Sub
<Fact>
Public Sub IVTBasicMetadata()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation name="HasIVTToCompilation">
<file name="a.vb"><![CDATA[
<Assembly: System.Runtime.CompilerServices.InternalsVisibleTo("WantsIVTAccess")>
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
Dim otherImage = other.EmitToArray()
Dim c As VisualBasicCompilation = CreateCompilationWithMscorlibAndReferences(
<compilation name="WantsIVTAccessButCantHave">
<file name="a.vb"><![CDATA[
Public Class A
Friend Class B
Protected Sub New(o As C)
o.Foo()
End Sub
End Class
End Class
]]>
</file>
</compilation>, {MetadataReference.CreateFromImage(otherImage)}, TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
'compilation should not succeed, and internals should not be imported.
c.GetDiagnostics()
'gives "is not a member" error because internals were not imported because no IVT was found
'on HasIVTToCompilation that referred to WantsIVTAccessButCantHave
CompilationUtils.AssertTheseDiagnostics(c, <error>
BC30456: 'Foo' is not a member of 'C'.
o.Foo()
~~~~~
</error>)
Dim c2 As VisualBasicCompilation = CreateCompilationWithMscorlibAndReferences(
<compilation name="WantsIVTAccess">
<file name="a.vb"><![CDATA[
Public Class A
Friend Class B
Protected Sub New(o As C)
o.Foo()
End Sub
End Class
End Class
]]>
</file>
</compilation>, {MetadataReference.CreateFromImage(otherImage)}, TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
c2.VerifyDiagnostics()
End Sub
<ConditionalFact(GetType(IsEnglishLocal))>
Public Sub SignModuleKeyContainerBogus()
Dim c1 As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation name="WantsIVTAccess">
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblyKeyName("bogus")>
Public Class A
End Class
]]>
</file>
</compilation>, TestOptions.ReleaseModule.WithStrongNameProvider(s_defaultProvider))
'shouldn't have an error. The attribute's contents are checked when the module is added.
Dim reference = c1.EmitToImageReference()
Dim c2 As VisualBasicCompilation = CreateCompilationWithMscorlibAndReferences(
(<compilation name="WantsIVTAccess">
<file name="a.vb"><![CDATA[
Public Class C
End Class
]]>
</file>
</compilation>), {reference}, TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
'c2.VerifyDiagnostics(Diagnostic(ERRID.ERR_PublicKeyContainerFailure).WithArguments("bogus", "Keyset does not exist (Exception from HRESULT: 0x80090016)"))
Dim err = c2.GetDiagnostics(CompilationStage.Emit).Single()
Assert.Equal(ERRID.ERR_PublicKeyContainerFailure, err.Code)
Assert.Equal(2, err.Arguments.Count)
Assert.Equal("bogus", DirectCast(err.Arguments(0), String))
Assert.True(DirectCast(err.Arguments(1), String).EndsWith(" HRESULT: 0x80090016)", StringComparison.Ordinal))
End Sub
<Fact>
Public Sub SignModuleKeyFileBogus()
Dim c1 As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation name="WantsIVTAccess">
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblyKeyFile("bogus")>
Public Class A
End Class
]]>
</file>
</compilation>, TestOptions.ReleaseModule.WithStrongNameProvider(s_defaultProvider))
'shouldn't have an error. The attribute's contents are checked when the module is added.
Dim reference = c1.EmitToImageReference()
Dim c2 As VisualBasicCompilation = CreateCompilationWithMscorlibAndReferences(
(<compilation name="WantsIVTAccess">
<file name="a.vb"><![CDATA[
Public Class C
End Class
]]>
</file>
</compilation>), {reference}, TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
c2.VerifyDiagnostics(Diagnostic(ERRID.ERR_PublicKeyFileFailure).WithArguments("bogus", CodeAnalysisResources.FileNotFound))
End Sub
<Fact>
Public Sub IVTSigned()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation name="Paul">
<file name="a.vb"><![CDATA[
<Assembly: System.Runtime.CompilerServices.InternalsVisibleTo("John, PublicKey=00240000048000009400000006020000002400005253413100040000010001002b986f6b5ea5717d35c72d38561f413e267029efa9b5f107b9331d83df657381325b3a67b75812f63a9436ceccb49494de8f574f8e639d4d26c0fcf8b0e9a1a196b80b6f6ed053628d10d027e032df2ed1d60835e5f47d32c9ef6da10d0366a319573362c821b5f8fa5abc5bb22241de6f666a85d82d6ba8c3090d01636bd2bb")>
Friend Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_keyPairFile).WithDelaySign(True).WithStrongNameProvider(s_defaultProvider))
other.VerifyDiagnostics()
Dim requestor As VisualBasicCompilation = CreateCompilationWithMscorlibAndReferences(
<compilation name="John">
<file name="a.vb"><![CDATA[
Public Class A
Private Sub New(o As C)
o.Foo()
End Sub
End Class
]]>
</file>
</compilation>,
{New VisualBasicCompilationReference(other)}, TestOptions.ReleaseDll.WithCryptoKeyContainer("roslynTestContainer").WithStrongNameProvider(s_defaultProvider))
Dim unused = requestor.Assembly.Identity
requestor.VerifyDiagnostics()
End Sub
<Fact>
Public Sub IVTErrorNotBothSigned()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation name="Paul">
<file name="a.vb"><![CDATA[
<Assembly: System.Runtime.CompilerServices.InternalsVisibleTo("John, PublicKey=00240000048000009400000006020000002400005253413100040000010001002b986f6b5ea5717d35c72d38561f413e267029efa9b5f107b9331d83df657381325b3a67b75812f63a9436ceccb49494de8f574f8e639d4d26c0fcf8b0e9a1a196b80b6f6ed053628d10d027e032df2ed1d60835e5f47d32c9ef6da10d0366a319573362c821b5f8fa5abc5bb22241de6f666a85d82d6ba8c3090d01636bd2bb")>
Friend Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
other.VerifyDiagnostics()
Dim requestor As VisualBasicCompilation = CreateCompilationWithMscorlibAndReferences(
<compilation name="John">
<file name="a.vb"><![CDATA[
Public Class A
Private Sub New(o As C)
o.Foo()
End Sub
End Class
]]>
</file>
</compilation>, {New VisualBasicCompilationReference(other)}, TestOptions.ReleaseDll.WithCryptoKeyFile(s_keyPairFile).WithDelaySign(True).WithStrongNameProvider(s_defaultProvider))
Dim unused = requestor.Assembly.Identity
'gives "is not accessible" error because internals were imported because IVT was found
CompilationUtils.AssertTheseDiagnostics(requestor, <error>BC30389: 'C' is not accessible in this context because it is 'Friend'.
Private Sub New(o As C)
~
</error>)
End Sub
<Fact>
Public Sub IVTDeferredSuccess()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation name="Paul">
<file name="a.vb"><![CDATA[
<Assembly: System.Runtime.CompilerServices.InternalsVisibleTo("John, PublicKey=00240000048000009400000006020000002400005253413100040000010001002b986f6b5ea5717d35c72d38561f413e267029efa9b5f107b9331d83df657381325b3a67b75812f63a9436ceccb49494de8f574f8e639d4d26c0fcf8b0e9a1a196b80b6f6ed053628d10d027e032df2ed1d60835e5f47d32c9ef6da10d0366a319573362c821b5f8fa5abc5bb22241de6f666a85d82d6ba8c3090d01636bd2bb")>
Friend Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_keyPairFile).WithDelaySign(True).WithStrongNameProvider(s_defaultProvider))
other.VerifyDiagnostics()
Dim requestor As VisualBasicCompilation = CreateCompilationWithMscorlibAndReferences(
<compilation name="John">
<file name="a.vb"><![CDATA[
Imports MyC=C 'causes optimistic granting
<Assembly: System.Reflection.AssemblyKeyName("roslynTestContainer")>
Public Class A
End Class
]]>
</file>
</compilation>, {New VisualBasicCompilationReference(other)}, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
Dim unused = requestor.Assembly.Identity
Assert.True(DirectCast(other.Assembly, IAssemblySymbol).GivesAccessTo(requestor.Assembly))
requestor.AssertNoDiagnostics()
End Sub
<Fact>
Public Sub IVTDeferredFailSignMismatch()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation name="Paul">
<file name="a.vb"><![CDATA[
<Assembly: System.Runtime.CompilerServices.InternalsVisibleTo("John, PublicKey=00240000048000009400000006020000002400005253413100040000010001002b986f6b5ea5717d35c72d38561f413e267029efa9b5f107b9331d83df657381325b3a67b75812f63a9436ceccb49494de8f574f8e639d4d26c0fcf8b0e9a1a196b80b6f6ed053628d10d027e032df2ed1d60835e5f47d32c9ef6da10d0366a319573362c821b5f8fa5abc5bb22241de6f666a85d82d6ba8c3090d01636bd2bb")>
Friend Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
other.VerifyDiagnostics()
Dim requestor As VisualBasicCompilation = CreateCompilationWithMscorlibAndReferences(
<compilation name="John">
<file name="a.vb"><![CDATA[
Imports MyC=C
<Assembly: System.Reflection.AssemblyKeyName("roslynTestContainer")>
Public Class A
End Class
]]>
</file>
</compilation>, {New VisualBasicCompilationReference(other)}, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
Dim unused = requestor.Assembly.Identity
CompilationUtils.AssertTheseDiagnostics(requestor,
<error>BC36958: Friend access was granted by 'Paul, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null', but the strong name signing state of the output assembly does not match that of the granting assembly.</error>)
End Sub
<Fact>
Public Sub IVTDeferredFailKeyMismatch()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation name="Paul">
<file name="a.vb"><![CDATA[
'key is wrong in the first digit
<Assembly: System.Runtime.CompilerServices.InternalsVisibleTo("John, PublicKey=10240000048000009400000006020000002400005253413100040000010001002b986f6b5ea5717d35c72d38561f413e267029efa9b5f107b9331d83df657381325b3a67b75812f63a9436ceccb49494de8f574f8e639d4d26c0fcf8b0e9a1a196b80b6f6ed053628d10d027e032df2ed1d60835e5f47d32c9ef6da10d0366a319573362c821b5f8fa5abc5bb22241de6f666a85d82d6ba8c3090d01636bd2bb")>
Friend Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, options:=TestOptions.ReleaseDll.WithCryptoKeyContainer("roslynTestContainer").WithStrongNameProvider(s_defaultProvider))
other.VerifyDiagnostics()
Dim requestor As VisualBasicCompilation = CreateCompilationWithMscorlibAndReferences(
<compilation name="John">
<file name="a.vb"><![CDATA[
Imports MyC=C
<Assembly: System.Reflection.AssemblyKeyName("roslynTestContainer")>
Public Class A
End Class
]]>
</file>
</compilation>, {New VisualBasicCompilationReference(other)}, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
Dim unused = requestor.Assembly.Identity
CompilationUtils.AssertTheseDiagnostics(requestor, <errors>BC36957: Friend access was granted by 'Paul, Version=0.0.0.0, Culture=neutral, PublicKeyToken=ce65828c82a341f2', but the public key of the output assembly does not match that specified by the attribute in the granting assembly.</errors>)
End Sub
<Fact>
Public Sub IVTSuccessThroughIAssembly()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation name="Paul">
<file name="a.vb"><![CDATA[
<Assembly: System.Runtime.CompilerServices.InternalsVisibleTo("John, PublicKey=00240000048000009400000006020000002400005253413100040000010001002b986f6b5ea5717d35c72d38561f413e267029efa9b5f107b9331d83df657381325b3a67b75812f63a9436ceccb49494de8f574f8e639d4d26c0fcf8b0e9a1a196b80b6f6ed053628d10d027e032df2ed1d60835e5f47d32c9ef6da10d0366a319573362c821b5f8fa5abc5bb22241de6f666a85d82d6ba8c3090d01636bd2bb")>
Friend Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_keyPairFile).WithDelaySign(True).WithStrongNameProvider(s_defaultProvider))
other.VerifyDiagnostics()
Dim requestor As VisualBasicCompilation = CreateCompilationWithMscorlibAndReferences(
<compilation name="John">
<file name="a.vb"><![CDATA[
Imports MyC=C 'causes optimistic granting
<Assembly: System.Reflection.AssemblyKeyName("roslynTestContainer")>
Public Class A
End Class
]]>
</file>
</compilation>, {New VisualBasicCompilationReference(other)}, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
Assert.True(DirectCast(other.Assembly, IAssemblySymbol).GivesAccessTo(requestor.Assembly))
End Sub
<Fact>
Public Sub IVTFailSignMismatchThroughIAssembly()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation name="Paul">
<file name="a.vb"><![CDATA[
<Assembly: System.Runtime.CompilerServices.InternalsVisibleTo("John, PublicKey=00240000048000009400000006020000002400005253413100040000010001002b986f6b5ea5717d35c72d38561f413e267029efa9b5f107b9331d83df657381325b3a67b75812f63a9436ceccb49494de8f574f8e639d4d26c0fcf8b0e9a1a196b80b6f6ed053628d10d027e032df2ed1d60835e5f47d32c9ef6da10d0366a319573362c821b5f8fa5abc5bb22241de6f666a85d82d6ba8c3090d01636bd2bb")>
Friend Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
other.VerifyDiagnostics()
Dim requestor As VisualBasicCompilation = CreateCompilationWithMscorlibAndReferences(
<compilation name="John">
<file name="a.vb"><![CDATA[
Imports MyC=C
<Assembly: System.Reflection.AssemblyKeyName("roslynTestContainer")>
Public Class A
End Class
]]>
</file>
</compilation>, {New VisualBasicCompilationReference(other)}, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
Assert.False(DirectCast(other.Assembly, IAssemblySymbol).GivesAccessTo(requestor.Assembly))
End Sub
<WorkItem(820450, "DevDiv")>
<Fact>
Public Sub IVTGivesAccessToUsingDifferentKeys()
Dim giver As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation name="Paul">
<file name="a.vb"><![CDATA[
<Assembly: System.Runtime.CompilerServices.InternalsVisibleTo("John, PublicKey=00240000048000009400000006020000002400005253413100040000010001002b986f6b5ea5717d35c72d38561f413e267029efa9b5f107b9331d83df657381325b3a67b75812f63a9436ceccb49494de8f574f8e639d4d26c0fcf8b0e9a1a196b80b6f6ed053628d10d027e032df2ed1d60835e5f47d32c9ef6da10d0366a319573362c821b5f8fa5abc5bb22241de6f666a85d82d6ba8c3090d01636bd2bb")>
Namespace ClassLibrary
Friend Class FriendClass
Public Sub Foo()
End Sub
End Class
end Namespace
]]>
</file>
</compilation>, options:=TestOptions.ReleaseDll.WithCryptoKeyFile(SigningTestHelpers.KeyPairFile2).WithStrongNameProvider(s_defaultProvider))
giver.VerifyDiagnostics()
Dim requestor As VisualBasicCompilation = CreateCompilationWithMscorlibAndReferences(
<compilation name="John">
<file name="a.vb"><![CDATA[
Public Class ClassWithFriendMethod
Friend Sub Test(A as ClassLibrary.FriendClass)
End Sub
End Class
]]>
</file>
</compilation>, {New VisualBasicCompilationReference(giver)}, options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_keyPairFile).WithStrongNameProvider(s_defaultProvider))
Assert.True(DirectCast(giver.Assembly, IAssemblySymbol).GivesAccessTo(requestor.Assembly))
Assert.Empty(requestor.GetDiagnostics())
End Sub
#End Region
#Region "IVT instantiations"
<Fact>
Public Sub IVTHasCulture()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation name="Sam">
<file name="a.vb"><![CDATA[
Imports System.Runtime.CompilerServices
<Assembly: InternalsVisibleTo("WantsIVTAccess, Culture=neutral")>
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
Dim expectedErrors = <error><![CDATA[
BC31534: Friend assembly reference 'WantsIVTAccess, Culture=neutral' is invalid. InternalsVisibleTo declarations cannot have a version, culture, public key token, or processor architecture specified.
<Assembly: InternalsVisibleTo("WantsIVTAccess, Culture=neutral")>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]></error>
CompilationUtils.AssertTheseDeclarationDiagnostics(other, expectedErrors)
End Sub
<Fact>
Public Sub IVTNoKey()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation name="Sam">
<file name="a.vb"><![CDATA[
Imports System.Runtime.CompilerServices
<Assembly: InternalsVisibleTo("WantsIVTAccess")>
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_keyPairFile).WithStrongNameProvider(s_defaultProvider))
Dim expectedErrors = <error><![CDATA[
BC31535: Friend assembly reference 'WantsIVTAccess' is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations.
<Assembly: InternalsVisibleTo("WantsIVTAccess")>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]></error>
CompilationUtils.AssertTheseDeclarationDiagnostics(other, expectedErrors)
End Sub
#End Region
#Region "Signing"
<Fact>
Public Sub SignIt()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation name="Sam">
<file name="a.vb"><![CDATA[
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>,
options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_keyPairFile).WithStrongNameProvider(s_defaultProvider))
Dim peHeaders = New PEHeaders(other.EmitToStream())
Assert.Equal(CorFlags.StrongNameSigned, peHeaders.CorHeader.Flags And CorFlags.StrongNameSigned)
End Sub
<Fact>
Public Sub SignItWithOnlyPublicKey()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation name="Sam">
<file name="a.vb"><![CDATA[
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>,
options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_publicKeyFile).WithStrongNameProvider(s_defaultProvider))
Using outStrm = New MemoryStream()
Dim emitResult = other.Emit(outStrm)
CompilationUtils.AssertTheseDiagnostics(emitResult.Diagnostics,
<errors>
BC36961: Key file '<%= s_publicKeyFile %>' is missing the private key needed for signing.
</errors>)
End Using
other = other.WithOptions(TestOptions.ReleaseModule.WithCryptoKeyFile(s_publicKeyFile))
Dim assembly As VisualBasicCompilation = CreateCompilationWithMscorlibAndReferences(
<compilation name="Sam2">
<file name="a.vb">
</file>
</compilation>,
{other.EmitToImageReference()},
options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
Using outStrm = New MemoryStream()
Dim emitResult = assembly.Emit(outStrm)
CompilationUtils.AssertTheseDiagnostics(emitResult.Diagnostics,
<errors>
BC36961: Key file '<%= s_publicKeyFile %>' is missing the private key needed for signing.
</errors>)
End Using
End Sub
<Fact>
Public Sub DelaySignItWithOnlyPublicKey()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation name="Sam">
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblyDelaySign(True)>
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>,
options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_publicKeyFile).WithStrongNameProvider(s_defaultProvider))
CompileAndVerify(other)
End Sub
<Fact>
Public Sub DelaySignButNoKey()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation>
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblyDelaySign(True)>
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
Dim outStrm = New MemoryStream()
Dim emitResult = other.Emit(outStrm)
' Dev11: vbc : warning BC40010: Possible problem detected while building assembly 'VBTestD': Delay signing was requested, but no key was given
' warning BC41008: Use command-line option '/delaysign' or appropriate project settings instead of 'System.Reflection.AssemblyDelaySignAttribute'.
CompilationUtils.AssertTheseDiagnostics(emitResult.Diagnostics, <errors>BC40060: Delay signing was specified and requires a public key, but no public key was specified.</errors>)
Assert.True(emitResult.Success)
End Sub
<Fact>
Public Sub SignInMemory()
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation>
<file name="a.vb"><![CDATA[
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_keyPairFile).WithStrongNameProvider(s_defaultProvider))
Dim outStrm = New MemoryStream()
Dim emitResult = other.Emit(outStrm)
Assert.True(emitResult.Success)
End Sub
<WorkItem(545720, "DevDiv")>
<WorkItem(530050, "DevDiv")>
<Fact>
Public Sub InvalidAssemblyName()
Dim il = <![CDATA[
.assembly extern mscorlib { }
.assembly asm1
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.InternalsVisibleToAttribute::.ctor(string) = ( 01 00 09 2F 5C 3A 2A 3F 27 3C 3E 7C 00 00 ) // .../\:*?'<>|..
}
.class private auto ansi beforefieldinit Base
extends [mscorlib]System.Object
{
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
]]>
Dim vb = <compilation>
<file name="a.vb"><![CDATA[
Public Class Derived
Inherits Base
End Class
]]>
</file>
</compilation>
Dim ilRef = CompileIL(il.Value, appendDefaultHeader:=False)
Dim comp = CreateCompilationWithMscorlibAndReferences(vb, {ilRef}, TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
' NOTE: dev10 reports ERR_FriendAssemblyNameInvalid, but Roslyn won't (DevDiv #15099).
comp.VerifyDiagnostics(
Diagnostic(ERRID.ERR_InaccessibleSymbol2, "Base").WithArguments("Base", "Friend"))
End Sub
<Fact>
Public Sub DelaySignWithAssemblySignatureKey()
'//Note that this SignatureKey is some random one that I found in the devdiv build.
'//It is not related to the other keys we use in these tests.
'//In the native compiler, when the AssemblySignatureKey attribute is present, and
'//the binary is configured for delay signing, the contents of the assemblySignatureKey attribute
'//(rather than the contents of the keyfile or container) are used to compute the size needed to
'//reserve in the binary for its signature. Signing using this key is only supported via sn.exe
Dim other = CreateCompilationWithReferences(
<compilation>
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblyDelaySign(True)>
<Assembly: System.Reflection.AssemblySignatureKey("002400000c800000140100000602000000240000525341310008000001000100613399aff18ef1a2c2514a273a42d9042b72321f1757102df9ebada69923e2738406c21e5b801552ab8d200a65a235e001ac9adc25f2d811eb09496a4c6a59d4619589c69f5baf0c4179a47311d92555cd006acc8b5959f2bd6e10e360c34537a1d266da8085856583c85d81da7f3ec01ed9564c58d93d713cd0172c8e23a10f0239b80c96b07736f5d8b022542a4e74251a5f432824318b3539a5a087f8e53d2f135f9ca47f3bb2e10aff0af0849504fb7cea3ff192dc8de0edad64c68efde34c56d302ad55fd6e80f302d5efcdeae953658d3452561b5f36c542efdbdd9f888538d374cef106acf7d93a4445c3c73cd911f0571aaf3d54da12b11ddec375b3", "a5a866e1ee186f807668209f3b11236ace5e21f117803a3143abb126dd035d7d2f876b6938aaf2ee3414d5420d753621400db44a49c486ce134300a2106adb6bdb433590fef8ad5c43cba82290dc49530effd86523d9483c00f458af46890036b0e2c61d077d7fbac467a506eba29e467a87198b053c749aa2a4d2840c784e6d")>
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, {MscorlibRef_v4_0_30316_17626}, TestOptions.ReleaseDll.WithDelaySign(True).WithCryptoKeyFile(s_keyPairFile).WithStrongNameProvider(s_defaultProvider))
' confirm header has expected SN signature size
Dim peHeaders = New PEHeaders(other.EmitToStream())
Assert.Equal(256, peHeaders.CorHeader.StrongNameSignatureDirectory.Size)
End Sub
''' <summary>
''' Won't fix (easy to be tested here)
''' </summary>
<Fact(), WorkItem(529953, "DevDiv"), WorkItem(530112, "DevDiv")>
Public Sub DeclareAssemblyKeyNameAndFile_BC41008()
Dim src = "<Assembly: System.Reflection.AssemblyKeyName(""Key1"")>" & vbCrLf &
"<Assembly: System.Reflection.AssemblyKeyFile(""" & s_keyPairFile & """)>" & vbCrLf &
"Public Class C" & vbCrLf &
"End Class"
Dim tree = ParseAndVerify(src)
Dim comp = CreateCompilationWithMscorlib({tree}, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
' Native Compiler:
'warning BC41008: Use command-line option '/keycontainer' or appropriate project settings instead of 'System.Reflection.AssemblyKeyNameAttribute() '.
' <Assembly: System.Reflection.AssemblyKeyName("Key1")>
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'warning BC41008: Use command-line option '/keyfile' or appropriate project settings instead of 'System.Reflection.AssemblyKeyFileAttribute() '.
'<Assembly: System.Reflection.AssemblyKeyFile("Key2.snk")>
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
comp.VerifyDiagnostics()
' Diagnostic(ERRID.WRN_UseSwitchInsteadOfAttribute, "System.Reflection.AssemblyKeyName(""Key1""").WithArguments("/keycontainer"),
' Diagnostic(ERRID.WRN_UseSwitchInsteadOfAttribute, "System.Reflection.AssemblyKeyFile(""Key2.snk""").WithArguments("/keyfile"))
Dim outStrm = New MemoryStream()
Dim emitResult = comp.Emit(outStrm)
Assert.True(emitResult.Success)
End Sub
Private Sub ConfirmModuleAttributePresentAndAddingToAssemblyResultsInSignedOutput(
moduleContents As Stream,
expectedModuleAttr As AttributeDescription
)
' a module doesn't get signed for real. It should have either a keyfile or keycontainer attribute
' parked on a typeRef named 'AssemblyAttributesGoHere.' When the module is added to an assembly, the
' resulting assembly is signed with the key referred to by the aforementioned attribute.
Dim success As EmitResult
Dim tempFile = Temp.CreateFile()
moduleContents.Position = 0
Using metadata = ModuleMetadata.CreateFromStream(moduleContents)
Dim flags = metadata.Module.PEReaderOpt.PEHeaders.CorHeader.Flags
' confirm file does not claim to be signed
Assert.Equal(0, CInt(flags And CorFlags.StrongNameSigned))
Dim token As EntityHandle = metadata.Module.GetTypeRef(metadata.Module.GetAssemblyRef("mscorlib"), "System.Runtime.CompilerServices", "AssemblyAttributesGoHere")
Assert.False(token.IsNil) ' could the magic type ref be located? If not then the attribute's not there.
Dim attrInfos = metadata.Module.FindTargetAttributes(token, expectedModuleAttr)
Assert.Equal(1, attrInfos.Count())
Dim source =
<compilation>
<file name="a.vb"><![CDATA[
Public Class Z
End Class
]]>
</file>
</compilation>
' now that the module checks out, ensure that adding it to a compilation outputting a dll
' results in a signed assembly.
Dim assemblyComp = CreateCompilationWithMscorlibAndReferences(source, {metadata.GetReference()}, TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
Using finalStrm = tempFile.Open()
success = assemblyComp.Emit(finalStrm)
End Using
End Using
success.Diagnostics.Verify()
Assert.True(success.Success)
AssertFileIsSigned(tempFile)
End Sub
Private Shared Sub AssertFileIsSigned(file As TempFile)
' TODO should check to see that the output was actually signed
Using peStream = New FileStream(file.Path, FileMode.Open)
Dim flags = New PEHeaders(peStream).CorHeader.Flags
Assert.Equal(CorFlags.StrongNameSigned, flags And CorFlags.StrongNameSigned)
End Using
End Sub
<Fact>
Public Sub SignModuleKeyFileAttr()
Dim x = s_keyPairFile
Dim source =
<compilation>
<file name="a.vb">
<![CDATA[<]]>Assembly: System.Reflection.AssemblyKeyFile("<%= x %>")>
Public Class C
End Class
</file>
</compilation>
Dim other = CreateCompilationWithMscorlib(source, TestOptions.ReleaseModule.WithStrongNameProvider(s_defaultProvider))
ConfirmModuleAttributePresentAndAddingToAssemblyResultsInSignedOutput(other.EmitToStream(), AttributeDescription.AssemblyKeyFileAttribute)
End Sub
<Fact>
Public Sub SignModuleKeyContainerAttr()
Dim source =
<compilation>
<file name="a.vb">
<![CDATA[<]]>Assembly: System.Reflection.AssemblyKeyName("roslynTestContainer")>
Public Class C
End Class
</file>
</compilation>
Dim other = CreateCompilationWithMscorlib(source, TestOptions.ReleaseModule.WithStrongNameProvider(s_defaultProvider))
Dim outStrm = New MemoryStream()
Dim success = other.Emit(outStrm)
Assert.True(success.Success)
ConfirmModuleAttributePresentAndAddingToAssemblyResultsInSignedOutput(outStrm, AttributeDescription.AssemblyKeyNameAttribute)
End Sub
<WorkItem(531195, "DevDiv")>
<Fact>
Public Sub SignModuleKeyContainerCmdLine()
Dim source =
<compilation>
<file name="a.vb">
Public Class C
End Class
</file>
</compilation>
Dim other = CreateCompilationWithMscorlib(source, TestOptions.ReleaseModule.WithCryptoKeyContainer("roslynTestContainer").WithStrongNameProvider(s_defaultProvider))
Dim outStrm = New MemoryStream()
Dim success = other.Emit(outStrm)
Assert.True(success.Success)
ConfirmModuleAttributePresentAndAddingToAssemblyResultsInSignedOutput(outStrm, AttributeDescription.AssemblyKeyNameAttribute)
End Sub
<WorkItem(531195, "DevDiv")>
<Fact>
Public Sub SignModuleKeyContainerCmdLine_1()
Dim source =
<compilation>
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblyKeyName("roslynTestContainer")>
Public Class C
End Class
]]></file>
</compilation>
Dim other = CreateCompilationWithMscorlib(source, TestOptions.ReleaseModule.WithCryptoKeyContainer("roslynTestContainer").WithStrongNameProvider(s_defaultProvider))
Dim outStrm = New MemoryStream()
Dim success = other.Emit(outStrm)
Assert.True(success.Success)
ConfirmModuleAttributePresentAndAddingToAssemblyResultsInSignedOutput(outStrm, AttributeDescription.AssemblyKeyNameAttribute)
End Sub
<WorkItem(531195, "DevDiv")>
<Fact>
Public Sub SignModuleKeyContainerCmdLine_2()
Dim source =
<compilation>
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblyKeyName("bogus")>
Public Class C
End Class
]]></file>
</compilation>
Dim other = CreateCompilationWithMscorlib(source, TestOptions.ReleaseModule.WithCryptoKeyContainer("roslynTestContainer").WithStrongNameProvider(s_defaultProvider))
AssertTheseDiagnostics(other,
<expected>
BC37207: Attribute 'System.Reflection.AssemblyKeyNameAttribute' given in a source file conflicts with option 'CryptoKeyContainer'.
</expected>)
End Sub
<WorkItem(531195, "DevDiv")>
<Fact>
Public Sub SignModuleKeyFileCmdLine()
Dim source =
<compilation>
<file name="a.vb">
Public Class C
End Class
</file>
</compilation>
Dim other = CreateCompilationWithMscorlib(source, TestOptions.ReleaseModule.WithCryptoKeyFile(s_keyPairFile).WithStrongNameProvider(s_defaultProvider))
Dim outStrm = New MemoryStream()
Dim success = other.Emit(outStrm)
Assert.True(success.Success)
ConfirmModuleAttributePresentAndAddingToAssemblyResultsInSignedOutput(outStrm, AttributeDescription.AssemblyKeyFileAttribute)
End Sub
<WorkItem(531195, "DevDiv")>
<Fact>
Public Sub SignModuleKeyFileCmdLine_1()
Dim x = s_keyPairFile
Dim source =
<compilation>
<file name="a.vb">
<![CDATA[<]]>assembly: System.Reflection.AssemblyKeyFile("<%= x %>")>
Public Class C
End Class
</file>
</compilation>
Dim other = CreateCompilationWithMscorlib(source, TestOptions.ReleaseModule.WithCryptoKeyFile(s_keyPairFile).WithStrongNameProvider(s_defaultProvider))
Dim outStrm = New MemoryStream()
Dim success = other.Emit(outStrm)
Assert.True(success.Success)
ConfirmModuleAttributePresentAndAddingToAssemblyResultsInSignedOutput(outStrm, AttributeDescription.AssemblyKeyFileAttribute)
End Sub
<Fact>
Public Sub SignModuleKeyFileCmdLine_2()
Dim source =
<compilation>
<file name="a.vb">
<![CDATA[<]]>assembly: System.Reflection.AssemblyKeyFile("bogus")>
Public Class C
End Class
</file>
</compilation>
Dim other = CreateCompilationWithMscorlib(source, TestOptions.ReleaseModule.WithCryptoKeyFile(s_keyPairFile).WithStrongNameProvider(s_defaultProvider))
AssertTheseDiagnostics(other,
<expected>
BC37207: Attribute 'System.Reflection.AssemblyKeyFileAttribute' given in a source file conflicts with option 'CryptoKeyFile'.
</expected>)
End Sub
<Fact> <WorkItem(529779, "DevDiv")>
Public Sub Bug529779_1()
Dim unsigned As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation>
<file name="a.vb"><![CDATA[
Public Class C1
End Class
]]>
</file>
</compilation>,
options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation>
<file name="a.vb"><![CDATA[
Public Class C
Friend Sub Foo()
Dim x as New System.Guid()
System.Console.WriteLine(x)
End Sub
End Class
]]>
</file>
</compilation>,
options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_keyPairFile).WithStrongNameProvider(s_defaultProvider))
CompileAndVerify(other.WithReferences({other.References(0), New VisualBasicCompilationReference(unsigned)})).VerifyDiagnostics()
CompileAndVerify(other.WithReferences({other.References(0), MetadataReference.CreateFromImage(unsigned.EmitToArray)})).VerifyDiagnostics()
End Sub
<Fact> <WorkItem(529779, "DevDiv")>
Public Sub Bug529779_2()
Dim unsigned As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation name="Unsigned">
<file name="a.vb"><![CDATA[
Public Class C1
End Class
]]>
</file>
</compilation>,
options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
Dim other As VisualBasicCompilation = CreateCompilationWithMscorlib(
<compilation>
<file name="a.vb"><![CDATA[
Public Class C
Friend Sub Foo()
Dim x as New C1()
System.Console.WriteLine(x)
End Sub
End Class
]]>
</file>
</compilation>,
options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_keyPairFile).WithStrongNameProvider(s_defaultProvider))
Dim comps = {other.WithReferences({other.References(0), New VisualBasicCompilationReference(unsigned)}),
other.WithReferences({other.References(0), MetadataReference.CreateFromImage(unsigned.EmitToArray)})}
For Each comp In comps
Dim outStrm = New MemoryStream()
Dim emitResult = comp.Emit(outStrm)
' Dev12 reports an error
Assert.True(emitResult.Success)
AssertTheseDiagnostics(emitResult.Diagnostics,
<expected>
BC41997: Referenced assembly 'Unsigned, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name.
</expected>)
Next
End Sub
<Fact>
Public Sub AssemblySignatureKeyAttribute_1()
Dim other As VisualBasicCompilation = CreateCompilationWithReferences(
<compilation>
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblySignatureKeyAttribute(
"00240000048000009400000006020000002400005253413100040000010001002b986f6b5ea5717d35c72d38561f413e267029efa9b5f107b9331d83df657381325b3a67b75812f63a9436ceccb49494de8f574f8e639d4d26c0fcf8b0e9a1a196b80b6f6ed053628d10d027e032df2ed1d60835e5f47d32c9ef6da10d0366a319573362c821b5f8fa5abc5bb22241de6f666a85d82d6ba8c3090d01636bd2bb",
"bc6402e37ad723580b576953f40475ceae4b784d3661b90c3c6f5a1f7283388a7880683e0821610bee977f70506bb75584080e01b2ec97483c4d601ce1c981752a07276b420d78594d0ef28f8ec016d0a5b6d56cfc22e9f25a2ed9545942ccbf2d6295b9528641d98776e06a3273ab233271a3c9f53099b4d4e029582a6d5819")>
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, {MscorlibRef_v4_0_30316_17626},
options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_keyPairFile).WithStrongNameProvider(s_defaultProvider))
Dim peHeaders = New PEHeaders(other.EmitToStream())
Assert.Equal(CorFlags.StrongNameSigned, peHeaders.CorHeader.Flags And CorFlags.StrongNameSigned)
End Sub
<Fact>
Public Sub AssemblySignatureKeyAttribute_2()
Dim other As VisualBasicCompilation = CreateCompilationWithReferences(
<compilation>
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblySignatureKeyAttribute(
"xxx 00240000048000009400000006020000002400005253413100040000010001002b986f6b5ea5717d35c72d38561f413e267029efa9b5f107b9331d83df657381325b3a67b75812f63a9436ceccb49494de8f574f8e639d4d26c0fcf8b0e9a1a196b80b6f6ed053628d10d027e032df2ed1d60835e5f47d32c9ef6da10d0366a319573362c821b5f8fa5abc5bb22241de6f666a85d82d6ba8c3090d01636bd2bb",
"bc6402e37ad723580b576953f40475ceae4b784d3661b90c3c6f5a1f7283388a7880683e0821610bee977f70506bb75584080e01b2ec97483c4d601ce1c981752a07276b420d78594d0ef28f8ec016d0a5b6d56cfc22e9f25a2ed9545942ccbf2d6295b9528641d98776e06a3273ab233271a3c9f53099b4d4e029582a6d5819")>
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, {MscorlibRef_v4_0_30316_17626},
options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_keyPairFile).WithStrongNameProvider(s_defaultProvider))
Dim outStrm = New MemoryStream()
Dim emitResult = other.Emit(outStrm)
Assert.False(emitResult.Success)
AssertTheseDiagnostics(emitResult.Diagnostics,
<expected>
BC37209: Invalid signature public key specified in AssemblySignatureKeyAttribute.
"xxx 00240000048000009400000006020000002400005253413100040000010001002b986f6b5ea5717d35c72d38561f413e267029efa9b5f107b9331d83df657381325b3a67b75812f63a9436ceccb49494de8f574f8e639d4d26c0fcf8b0e9a1a196b80b6f6ed053628d10d027e032df2ed1d60835e5f47d32c9ef6da10d0366a319573362c821b5f8fa5abc5bb22241de6f666a85d82d6ba8c3090d01636bd2bb",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
</expected>)
End Sub
<Fact>
Public Sub AssemblySignatureKeyAttribute_3()
Dim other As VisualBasicCompilation = CreateCompilationWithReferences(
<compilation>
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblySignatureKeyAttribute(
"00240000048000009400000006020000002400005253413100040000010001002b986f6b5ea5717d35c72d38561f413e267029efa9b5f107b9331d83df657381325b3a67b75812f63a9436ceccb49494de8f574f8e639d4d26c0fcf8b0e9a1a196b80b6f6ed053628d10d027e032df2ed1d60835e5f47d32c9ef6da10d0366a319573362c821b5f8fa5abc5bb22241de6f666a85d82d6ba8c3090d01636bd2bb",
"FFFFbc6402e37ad723580b576953f40475ceae4b784d3661b90c3c6f5a1f7283388a7880683e0821610bee977f70506bb75584080e01b2ec97483c4d601ce1c981752a07276b420d78594d0ef28f8ec016d0a5b6d56cfc22e9f25a2ed9545942ccbf2d6295b9528641d98776e06a3273ab233271a3c9f53099b4d4e029582a6d5819")>
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, {MscorlibRef_v4_0_30316_17626},
options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_keyPairFile).WithStrongNameProvider(s_defaultProvider))
Dim outStrm = New MemoryStream()
Dim emitResult = other.Emit(outStrm)
Assert.False(emitResult.Success)
' AssertTheseDiagnostics(emitResult.Diagnostics,
'<expected>
'BC36980: Error extracting public key from file '<%= KeyPairFile %>': Invalid countersignature specified in AssemblySignatureKeyAttribute. (Exception from HRESULT: 0x80131423)
'</expected>)
Dim err = emitResult.Diagnostics.Single()
Assert.Equal(ERRID.ERR_PublicKeyFileFailure, err.Code)
Assert.Equal(2, err.Arguments.Count)
Assert.Equal(s_keyPairFile, DirectCast(err.Arguments(0), String))
Assert.True(DirectCast(err.Arguments(1), String).EndsWith(" HRESULT: 0x80131423)", StringComparison.Ordinal))
End Sub
<Fact>
Public Sub AssemblySignatureKeyAttribute_4()
Dim other As VisualBasicCompilation = CreateCompilationWithReferences(
<compilation>
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblySignatureKeyAttribute(
"xxx 00240000048000009400000006020000002400005253413100040000010001002b986f6b5ea5717d35c72d38561f413e267029efa9b5f107b9331d83df657381325b3a67b75812f63a9436ceccb49494de8f574f8e639d4d26c0fcf8b0e9a1a196b80b6f6ed053628d10d027e032df2ed1d60835e5f47d32c9ef6da10d0366a319573362c821b5f8fa5abc5bb22241de6f666a85d82d6ba8c3090d01636bd2bb",
"bc6402e37ad723580b576953f40475ceae4b784d3661b90c3c6f5a1f7283388a7880683e0821610bee977f70506bb75584080e01b2ec97483c4d601ce1c981752a07276b420d78594d0ef28f8ec016d0a5b6d56cfc22e9f25a2ed9545942ccbf2d6295b9528641d98776e06a3273ab233271a3c9f53099b4d4e029582a6d5819")>
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, {MscorlibRef_v4_0_30316_17626},
options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_publicKeyFile).WithDelaySign(True).WithStrongNameProvider(s_defaultProvider))
Dim outStrm = New MemoryStream()
Dim emitResult = other.Emit(outStrm)
Assert.False(emitResult.Success)
AssertTheseDiagnostics(emitResult.Diagnostics,
<expected>
BC37209: Invalid signature public key specified in AssemblySignatureKeyAttribute.
"xxx 00240000048000009400000006020000002400005253413100040000010001002b986f6b5ea5717d35c72d38561f413e267029efa9b5f107b9331d83df657381325b3a67b75812f63a9436ceccb49494de8f574f8e639d4d26c0fcf8b0e9a1a196b80b6f6ed053628d10d027e032df2ed1d60835e5f47d32c9ef6da10d0366a319573362c821b5f8fa5abc5bb22241de6f666a85d82d6ba8c3090d01636bd2bb",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
</expected>)
End Sub
<Fact>
Public Sub AssemblySignatureKeyAttribute_5()
Dim other As VisualBasicCompilation = CreateCompilationWithReferences(
<compilation>
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblySignatureKeyAttribute(
"00240000048000009400000006020000002400005253413100040000010001002b986f6b5ea5717d35c72d38561f413e267029efa9b5f107b9331d83df657381325b3a67b75812f63a9436ceccb49494de8f574f8e639d4d26c0fcf8b0e9a1a196b80b6f6ed053628d10d027e032df2ed1d60835e5f47d32c9ef6da10d0366a319573362c821b5f8fa5abc5bb22241de6f666a85d82d6ba8c3090d01636bd2bb",
"FFFFbc6402e37ad723580b576953f40475ceae4b784d3661b90c3c6f5a1f7283388a7880683e0821610bee977f70506bb75584080e01b2ec97483c4d601ce1c981752a07276b420d78594d0ef28f8ec016d0a5b6d56cfc22e9f25a2ed9545942ccbf2d6295b9528641d98776e06a3273ab233271a3c9f53099b4d4e029582a6d5819")>
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, {MscorlibRef_v4_0_30316_17626},
options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_publicKeyFile).WithDelaySign(True).WithStrongNameProvider(s_defaultProvider))
CompileAndVerify(other)
End Sub
<Fact>
Public Sub AssemblySignatureKeyAttribute_6()
Dim other As VisualBasicCompilation = CreateCompilationWithReferences(
<compilation>
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblySignatureKeyAttribute(
Nothing,
"bc6402e37ad723580b576953f40475ceae4b784d3661b90c3c6f5a1f7283388a7880683e0821610bee977f70506bb75584080e01b2ec97483c4d601ce1c981752a07276b420d78594d0ef28f8ec016d0a5b6d56cfc22e9f25a2ed9545942ccbf2d6295b9528641d98776e06a3273ab233271a3c9f53099b4d4e029582a6d5819")>
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, {MscorlibRef_v4_0_30316_17626},
options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_publicKeyFile).WithDelaySign(True).WithStrongNameProvider(s_defaultProvider))
Dim outStrm = New MemoryStream()
Dim emitResult = other.Emit(outStrm)
Assert.False(emitResult.Success)
AssertTheseDiagnostics(emitResult.Diagnostics,
<expected>
BC37209: Invalid signature public key specified in AssemblySignatureKeyAttribute.
Nothing,
~~~~~~~
</expected>)
End Sub
<Fact>
Public Sub AssemblySignatureKeyAttribute_7()
Dim other As VisualBasicCompilation = CreateCompilationWithReferences(
<compilation>
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblySignatureKeyAttribute(
"00240000048000009400000006020000002400005253413100040000010001002b986f6b5ea5717d35c72d38561f413e267029efa9b5f107b9331d83df657381325b3a67b75812f63a9436ceccb49494de8f574f8e639d4d26c0fcf8b0e9a1a196b80b6f6ed053628d10d027e032df2ed1d60835e5f47d32c9ef6da10d0366a319573362c821b5f8fa5abc5bb22241de6f666a85d82d6ba8c3090d01636bd2bb",
Nothing)>
Public Class C
Friend Sub Foo()
End Sub
End Class
]]>
</file>
</compilation>, {MscorlibRef_v4_0_30316_17626},
options:=TestOptions.ReleaseDll.WithCryptoKeyFile(s_publicKeyFile).WithDelaySign(True).WithStrongNameProvider(s_defaultProvider))
CompileAndVerify(other)
End Sub
#End Region
Public Sub PublicSignCore(options As VisualBasicCompilationOptions)
Dim source =
<compilation>
<file name="a.vb"><![CDATA[
Public Class C
End Class
]]>
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, options:=options)
PublicSignCore(compilation)
End Sub
Public Sub PublicSignCore(compilation As Compilation)
Assert.True(compilation.Options.PublicSign)
Assert.Null(compilation.Options.DelaySign)
Dim stream As New MemoryStream()
Dim emitResult = compilation.Emit(stream)
Assert.True(emitResult.Success)
Assert.True(emitResult.Diagnostics.IsEmpty)
stream.Position = 0
Using reader As New PEReader(stream)
Assert.True(reader.HasMetadata)
Dim flags = reader.PEHeaders.CorHeader.Flags
Assert.True(flags.HasFlag(CorFlags.StrongNameSigned))
End Using
End Sub
<Fact>
Public Sub PublicSign_NoKey()
Dim options = TestOptions.ReleaseDll.WithPublicSign(True)
Dim comp = CreateCompilationWithMscorlib(
<compilation>
<file name="a.vb"><![CDATA[
Public Class C
End Class
]]>
</file>
</compilation>, options:=options
)
AssertTheseDiagnostics(comp,
<errors>
BC37254: Public sign was specified and requires a public key, but no public key was specified
</errors>)
Assert.True(comp.Options.PublicSign)
Assert.True(comp.Assembly.PublicKey.IsDefaultOrEmpty)
End Sub
<Fact>
Public Sub PublicSign_FromKeyFileNoStrongNameProvider()
Dim snk = Temp.CreateFile().WriteAllBytes(TestResources.General.snKey)
Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True)
PublicSignCore(options)
End Sub
<Fact>
Public Sub PublicSign_FromPublicKeyFileNoStrongNameProvider()
Dim snk = Temp.CreateFile().WriteAllBytes(TestResources.General.snPublicKey)
Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True)
PublicSignCore(options)
End Sub
<Fact>
Public Sub PublicSign_FromKeyFileAndStrongNameProvider()
Dim snk = Temp.CreateFile().WriteAllBytes(TestResources.General.snKey2)
Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True).WithStrongNameProvider(s_defaultProvider)
PublicSignCore(options)
End Sub
<Fact>
Public Sub PublicSign_FromKeyFileAndNoStrongNameProvider()
Dim snk = Temp.CreateFile().WriteAllBytes(TestResources.General.snPublicKey2)
Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True)
PublicSignCore(options)
End Sub
<Fact>
Public Sub PublicSign_IgnoreSourceAttributes()
Dim source =
<compilation>
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblyKeyName("roslynTestContainer")>
<Assembly: System.Reflection.AssemblyKeyFile("some file")>
Public Class C
End Class
]]>
</file>
</compilation>
Dim snk = Temp.CreateFile().WriteAllBytes(TestResources.General.snKey)
Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True)
Dim compilation = CreateCompilationWithMscorlib(source, options:=options)
PublicSignCore(compilation)
End Sub
<Fact>
Public Sub PublicSign_DelaySignAttribute()
Dim source =
<compilation>
<file name="a.vb"><![CDATA[
<Assembly: System.Reflection.AssemblyDelaySign(True)>
Public Class C
End Class
]]>
</file>
</compilation>
Dim snk = Temp.CreateFile().WriteAllBytes(TestResources.General.snKey)
Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True)
Dim comp = CreateCompilationWithMscorlib(source, options:=options)
AssertTheseDiagnostics(comp,
<errors>
BC37207: Attribute 'System.Reflection.AssemblyDelaySignAttribute' given in a source file conflicts with option 'PublicSign'.
</errors>)
Assert.True(comp.Options.PublicSign)
End Sub
<Fact>
Public Sub PublicSignAndDelaySign()
Dim snk = Temp.CreateFile().WriteAllBytes(TestResources.General.snKey)
Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True).WithDelaySign(True)
Dim comp = CreateCompilationWithMscorlib(
<compilation>
<file name="a.vb"><![CDATA[
Public Class C
End Class
]]>
</file>
</compilation>,
options:=options
)
AssertTheseDiagnostics(comp,
<errors>
BC2046: Compilation options 'PublicSign' and 'DelaySign' can't both be specified at the same time.
</errors>)
Assert.True(comp.Options.PublicSign)
Assert.True(comp.Options.DelaySign)
End Sub
<Fact, WorkItem(769840, "DevDiv")>
Public Sub Bug769840()
Dim ca = CreateCompilationWithMscorlib(
<compilation name="Bug769840_A">
<file name="a.vb"><![CDATA[
<Assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Bug769840_B, PublicKey=0024000004800000940000000602000000240000525341310004000001000100458a131798af87d9e33088a3ab1c6101cbd462760f023d4f41d97f691033649e60b42001e94f4d79386b5e087b0a044c54b7afce151b3ad19b33b332b83087e3b8b022f45b5e4ff9b9a1077b0572ff0679ce38f884c7bd3d9b4090e4a7ee086b7dd292dc20f81a3b1b8a0b67ee77023131e59831c709c81d11c6856669974cc4")>
Friend Class A
Public Value As Integer = 3
End Class
]]></file>
</compilation>, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
CompileAndVerify(ca)
Dim cb = CreateCompilationWithMscorlibAndReferences(
<compilation name="Bug769840_B">
<file name="a.vb"><![CDATA[
Friend Class B
Public Function GetA() As A
Return New A()
End Function
End Class
]]></file>
</compilation>, {New VisualBasicCompilationReference(ca)}, options:=TestOptions.ReleaseModule.WithStrongNameProvider(s_defaultProvider))
CompileAndVerify(cb, verify:=False).Diagnostics.Verify()
End Sub
<Fact, WorkItem(1072350, "DevDiv")>
Public Sub Bug1072350()
Dim sourceA As XElement =
<compilation name="ClassLibrary2">
<file name="a.vb"><![CDATA[
<Assembly: System.Runtime.CompilerServices.InternalsVisibleTo("X ")>
Friend Class A
Friend Shared I As Integer = 42
End Class]]>
</file>
</compilation>
Dim sourceB As XElement =
<compilation name="X">
<file name="b.vb"><![CDATA[
Class B
Shared Sub Main()
System.Console.Write(A.I)
End Sub
End Class]]>
</file>
</compilation>
Dim ca = CreateCompilationWithMscorlib(sourceA, options:=TestOptions.ReleaseDll)
CompileAndVerify(ca)
Dim cb = CreateCompilationWithMscorlib(sourceB, options:=TestOptions.ReleaseExe, references:={New VisualBasicCompilationReference(ca)})
CompileAndVerify(cb, expectedOutput:="42").Diagnostics.Verify()
End Sub
<Fact, WorkItem(1072339, "DevDiv")>
Public Sub Bug1072339()
Dim sourceA As XElement =
<compilation name="ClassLibrary2">
<file name="a.vb"><![CDATA[
<Assembly: System.Runtime.CompilerServices.InternalsVisibleTo("x")>
Friend Class A
Friend Shared I As Integer = 42
End Class]]>
</file>
</compilation>
Dim sourceB As XElement =
<compilation name="x">
<file name="b.vb"><![CDATA[
Class B
Shared Sub Main()
System.Console.Write(A.I)
End Sub
End Class]]>
</file>
</compilation>
Dim ca = CreateCompilationWithMscorlib(sourceA, options:=TestOptions.ReleaseDll)
CompileAndVerify(ca)
Dim cb = CreateCompilationWithMscorlib(sourceB, options:=TestOptions.ReleaseExe, references:={New VisualBasicCompilationReference(ca)})
CompileAndVerify(cb, expectedOutput:="42").Diagnostics.Verify()
End Sub
<Fact, WorkItem(1095618, "DevDiv")>
Public Sub Bug1095618()
Dim source As XElement =
<compilation name="a">
<file name="a.vb"><![CDATA[
<Assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Runtime.Serialization, PublicKey = 10000000000000000400000000000000")>
]]></file>
</compilation>
CreateCompilationWithMscorlib(source).VerifyDiagnostics(
Diagnostic(ERRID.ERR_FriendAssemblyNameInvalid, "Assembly: System.Runtime.CompilerServices.InternalsVisibleTo(""System.Runtime.Serialization, PublicKey = 10000000000000000400000000000000"")").WithArguments("System.Runtime.Serialization, PublicKey = 10000000000000000400000000000000").WithLocation(1, 2))
End Sub
End Class
|
HellBrick/roslyn
|
src/Compilers/VisualBasic/Test/Emit/Attributes/InternalsVisibleToAndStrongNameTests.vb
|
Visual Basic
|
apache-2.0
| 73,734
|
Imports BVSoftware.Bvc5.Core
Imports System.Collections.ObjectModel
Partial Class BVModules_Themes_Foundation4_Responsive_ContentBlocks_Product_Rotator_view
Inherits Content.BVModule
Public Event AddToCartClicked(ByVal productId As String)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
LoadProductImage()
End Sub
Private Sub LoadProductImage()
Dim myProducts As Collection(Of Content.ComponentSettingListItem) = SettingsManager.GetSettingList("Products")
If myProducts IsNot Nothing Then
If myProducts.Count > 0 Then
Dim displayIndex As Integer = GetImageIndex(myProducts.Count)
Dim bvin As String = myProducts(displayIndex).Setting1
Dim product As Catalog.Product = Catalog.InternalProduct.FindByBvin(bvin)
Dim count As Integer = 1
While (product Is Nothing OrElse (Not product.IsVisible)) AndAlso count <= 5
displayIndex = GetImageIndex(myProducts.Count - 1)
bvin = myProducts(displayIndex).Setting1
product = Catalog.InternalProduct.FindByBvin(bvin)
count += 1
End While
If product IsNot Nothing AndAlso product.IsVisible Then
SetImage(product)
End If
End If
End If
' Pre & Post-Content Columns
Me.PreHtml.Text = SettingsManager.GetSetting("PreContentHtml_HtmlData")
Me.PostHtml.Text = SettingsManager.GetSetting("PostContentHtml_HtmlData")
End Sub
Private Sub SetImage(ByVal product As Catalog.Product)
If ucSingleProductDisplay IsNot Nothing Then
ucSingleProductDisplay.DisplayMode = SettingsManager.GetIntegerSetting("DisplayMode")
ucSingleProductDisplay.CssClassPrefix = SettingsManager.GetSetting("CssClassPrefix")
ucSingleProductDisplay.DisplayName = SettingsManager.GetBooleanSetting("DisplayName")
ucSingleProductDisplay.DisplayImage = SettingsManager.GetBooleanSetting("DisplayImage")
ucSingleProductDisplay.DisplayNewBadge = SettingsManager.GetBooleanSetting("DisplayNewBadge")
ucSingleProductDisplay.DisplayDescription = SettingsManager.GetBooleanSetting("DisplayDescription")
ucSingleProductDisplay.DisplayPrice = SettingsManager.GetBooleanSetting("DisplayPrice")
ucSingleProductDisplay.DisplayAddToCartButton = SettingsManager.GetBooleanSetting("DisplayAddToCartButton")
ucSingleProductDisplay.DisplaySelectedCheckBox = SettingsManager.GetBooleanSetting("DisplaySelectedCheckBox")
ucSingleProductDisplay.DisplayQuantity = SettingsManager.GetBooleanSetting("DisplayQuantity")
ucSingleProductDisplay.RemainOnPageAfterAddToCart = SettingsManager.GetBooleanSetting("RemainOnPageAfterAddToCart")
ucSingleProductDisplay.LoadWithProduct(product)
End If
If product.Sku.Trim = String.Empty Then
lnkImage.NavigateUrl = ""
lnkImage.Target = ""
lnkProductName.NavigateUrl = ""
lnkProductName.Target = ""
Else
lnkImage.NavigateUrl = product.ProductURL
lnkProductName.NavigateUrl = product.ProductURL
End If
Me.lnkImage.ToolTip = product.ProductName
Me.lnkProductName.Text = product.ProductName
End Sub
Private Function GetImageIndex(ByVal maxIndex As Integer) As Integer
Dim result As Integer = 0
If SettingsManager.GetBooleanSetting("ShowInOrder") = True Then
' Find the next image index to show in sequence
Dim nextIndex As String = Me.NextImageIndex
' Make sure index is a valid integer
If nextIndex = String.Empty Then
result = 0
Else
result = Integer.Parse(nextIndex, System.Globalization.CultureInfo.InvariantCulture)
End If
' Make sure result is at least zero
If result < 0 Then
result = 0
End If
' Make sure result is not greater than the maximum allowed size
If result > maxIndex Then
result = maxIndex
End If
' We have a valid number now, save the next index for next time.
Dim saveIndex As Integer = result + 1
If saveIndex > maxIndex Then
saveIndex = 0
End If
Me.NextImageIndex = saveIndex.ToString(System.Globalization.CultureInfo.InvariantCulture)
Else
' Select Random Image
result = BVSoftware.Web.RandomNumbers.RandomInteger(maxIndex, 0)
End If
Return result
End Function
Private Property NextImageIndex() As String
Get
If Session(Me.BlockId & "BVSoftware.ProductRotator.NextImageIndex") Is Nothing Then
Return String.Empty
Else
Return CType(Session(Me.BlockId & "BVSoftware.ProductRotator.NextImageIndex"), String)
End If
End Get
Set(ByVal value As String)
Session(Me.BlockId & "BVSoftware.ProductRotator.NextImageIndex") = value
End Set
End Property
Protected Sub SingleProduct_AddToCartClicked(ByVal productId As String) Handles ucSingleProductDisplay.AddToCartClicked
RaiseEvent AddToCartClicked(productId)
End Sub
End Class
|
ajaydex/Scopelist_2015
|
BVModules/Themes/Foundation4 Responsive/ContentBlocks/Product Rotator/view.ascx.vb
|
Visual Basic
|
apache-2.0
| 5,517
|
Imports System.Data
Imports System.Data.Common
Imports bv.common.db.Core
Public Class RepositoryScheme_DB
Inherits BaseDbService
Public Sub New()
ObjectName = "RepositoryScheme"
End Sub
Public Const TableFreezer As String = "tlbFreezer"
Public Const TableSubdivision As String = "tlbFreezerSubdivision"
'Public Const TableLocation As String = "Location"
Dim RepositorySchemeDetail_Adapter As DbDataAdapter
Public Overrides Function GetDetail(ByVal ID As Object) As DataSet
Dim ds As New DataSet
Try
Dim cmd As IDbCommand = CreateSPCommand("spRepositoryScheme_SelectDetail")
AddParam(cmd, "@idfFreezer", ID, m_Error)
If Not m_Error Is Nothing Then
Return Nothing
End If
RepositorySchemeDetail_Adapter = CreateAdapter(cmd, True)
'm_Error = Lookup_Db.FillBaseLookup(ds, BaseReferenceType.rftStorageType, Connection)
'TODO: check if rftLabLocType is not used indeed
'm_Error = Lookup_Db.FillBaseLookup(ds, BaseReferenceType.rftLabLocType, Connection)
'm_Error = Lookup_Db.FillBaseLookup(ds, BaseReferenceType.rftSubdivisionType, Connection)
'If Not m_Error Is Nothing Then
'Return Nothing
'End If
RepositorySchemeDetail_Adapter.Fill(ds, TableFreezer)
Dim dataTable As DataTable = ds.Tables(TableFreezer)
ClearColumnsAttibutes(ds)
Dim FreezerDTable As DataTable
Dim SubdivisionDTable As DataTable
'Dim LocationDTable As DataTable
FreezerDTable = ds.Tables(TableFreezer)
SubdivisionDTable = ds.Tables(TableFreezer & 1)
SubdivisionDTable.TableName = TableSubdivision
SubdivisionDTable.PrimaryKey = New DataColumn() {SubdivisionDTable.Columns("idfSubdivision")}
'LocationDTable = ds.Tables(TableFreezer & 2)
'LocationDTable.TableName = TableLocation
'LocationDTable.PrimaryKey = New DataColumn() {LocationDTable.Columns("idfLocationID")}
ds.Relations.Add(TableSubdivision, _
FreezerDTable.Columns("idfFreezer"), _
SubdivisionDTable.Columns("idfFreezer"))
'ds.Relations.Add("SubdivisionLocation", _
'SubdivisionDTable.Columns("idfsSubdivisionID"), _
'LocationDTable.Columns("idfsSubdivisionID"))
ds.Relations.Add("SubdivisionTree", _
SubdivisionDTable.Columns("idfSubdivision"), _
SubdivisionDTable.Columns("idfParentSubdivision"))
'Process the new object creation
'It is assumed that if ID is nothing we should return
'the dataset containing empty row related with the mai obiect
If ID Is Nothing Then
m_IsNewObject = True
ID = NewIntID()
Dim r As DataRow = ds.Tables(TableFreezer).NewRow
r("idfFreezer") = ID
''''''''r("idfsSite") = EIDSS.model.Core.EidssSiteContext.Instance.SiteID
ds.Tables(TableFreezer).Rows.Add(r)
End If
m_ID = ID
Return ds
Catch ex As Exception
m_Error = New ErrorMessage(StandardError.FillDatasetError, ex)
Return Nothing
End Try
Return Nothing
End Function
Public Overrides Function PostDetail(ByVal ds As DataSet, ByVal PostType As Integer, Optional ByVal transaction As IDbTransaction = Nothing) As Boolean
If ds Is Nothing Then Return True
Try
'Dim LocationDetail_Adapter As DbDataAdapter = CreateAdapter(ds.Tables(TableLocation), "Lab_Location", Connection, True, transaction)
Dim FreezerSubdivisionDetail_Adapter As DbDataAdapter = CreateAdapter(ds.Tables(TableSubdivision), "tlbFreezerSubdivision", Connection, True, transaction)
'Update(LocationDetail_Adapter, ds.GetChanges(DataRowState.Deleted), TableLocation, transaction)
DeleteRec(Nothing, FreezerSubdivisionDetail_Adapter, ds.Tables(TableSubdivision).GetChanges(DataRowState.Deleted), transaction)
'Update(FreezerSubdivisionDetail_Adapter, ds.GetChanges(DataRowState.Deleted), TableSubdivision, transaction)
Update(RepositorySchemeDetail_Adapter, ds.GetChanges(DataRowState.Deleted), TableFreezer, transaction)
Update(RepositorySchemeDetail_Adapter, ds.GetChanges(DataRowState.Added Or DataRowState.Modified), TableFreezer, transaction)
Update(FreezerSubdivisionDetail_Adapter, ds.GetChanges(DataRowState.Added Or DataRowState.Modified), TableSubdivision, transaction)
'Update(LocationDetail_Adapter, ds.GetChanges(DataRowState.Added Or DataRowState.Modified), TableLocation, transaction)
Dim subdivision As DataTable = ds.Tables(TableSubdivision).GetChanges()
If Not (subdivision Is Nothing) Then
For Each row As DataRow In subdivision.Rows
Dim cmd As IDbCommand = CreateSPCommand("spFreezerSubdivision_Validate", Connection, transaction)
If row.RowState = DataRowState.Added OrElse row.RowState = DataRowState.Modified Then
AddParam(cmd, "@idfSubdivision", row("idfSubdivision"))
cmd.ExecuteNonQuery()
End If
If row.RowState = DataRowState.Deleted Then
AddParam(cmd, "@idfSubdivision", row("idfSubdivision", DataRowVersion.Original))
AddParam(cmd, "@intCapacity", 0)
cmd.ExecuteNonQuery()
End If
Next
End If
db.Core.LookupCache.NotifyChange("Freezer", transaction)
Catch ex As Exception
m_Error = HandleError.ErrorMessage(ex)
Return False
End Try
Return True
End Function
Protected Overridable Sub DeleteRec(ByVal DRow As DataRow, ByVal Adapter As DbDataAdapter, ByVal DTable As DataTable, Optional ByVal transaction As IDbTransaction = Nothing)
Dim TempDrow As DataRow
If DTable Is Nothing Then Exit Sub
DTable.RejectChanges()
Dim DView As DataView = New DataView(DTable)
While DTable.Rows.Count > 0
Dim i As Integer = 0
For i = 0 To DTable.Rows.Count - 1
TempDrow = DTable.Rows(i)
DView.RowFilter = "idfParentSubdivision = '" + TempDrow("idfSubdivision").ToString() + "'"
If DView.Count = 0 Then TempDrow.Delete()
Next
ApplyTransaction(Adapter, transaction)
Adapter.Update(DTable)
End While
End Sub
Public Shared Function CopySubdivsionRow(ByVal DRow As DataRow, Optional ByVal FreezerID As Object = Nothing) As DataRow
Dim ds As DataSet = DRow.Table.DataSet
Dim SubdivDTable As DataTable = ds.Tables(RepositoryScheme_DB.TableSubdivision)
'Dim LocationDTable As DataTable = ds.Tables(RepositoryScheme_DB.TableLocation)
If FreezerID Is Nothing Then
FreezerID = DRow("idfFreezer")
End If
Dim NewDRow As DataRow = SubdivDTable.NewRow()
Dim TempChildDrow, TempNewChildRow As DataRow
NewDRow("idfSubdivision") = BaseDbService.NewIntID()
NewDRow("idfFreezer") = FreezerID
NewDRow("strNameChars") = DRow("strNameChars")
NewDRow("idfParentSubdivision") = DRow("idfParentSubdivision")
NewDRow("idfsSubdivisionType") = DRow("idfsSubdivisionType")
NewDRow("intCapacity") = DRow("intCapacity")
NewDRow("strNote") = DRow("strNote")
'NewDRow("blnMovable") = DRow("blnMovable")
''''NewDRow("idfsSite") = EIDSS.model.Core.EidssSiteContext.Instance.SiteID
SubdivDTable.Rows.Add(NewDRow)
For Each TempChildDrow In DRow.GetChildRows("SubdivisionTree")
TempNewChildRow = CopySubdivsionRow(TempChildDrow, FreezerID)
TempNewChildRow.SetParentRow(NewDRow, ds.Relations("SubdivisionTree"))
Next
Return (NewDRow)
End Function
Public Function ValidateFreezerName(idfFreezer As Long, strFreezerName As String, Optional transaction As DbTransaction = Nothing) As Boolean
Dim cmd As IDbCommand = CreateSPCommand("spFreezer_ValidateName", transaction)
StoredProcParamsCache.CreateParameters(cmd)
SetParam(cmd, "@idfFreezer", idfFreezer)
SetParam(cmd, "@strFreezerName", strFreezerName)
ExecCommand(cmd, Connection, transaction, True)
Return 1.Equals(GetParamValue(cmd, "@RETURN_VALUE"))
End Function
End Class
|
EIDSS/EIDSS-Legacy
|
EIDSS v5/vb/EIDSS/EIDSS_Limps_db/Repository Scheme/RepositoryScheme_DB.vb
|
Visual Basic
|
bsd-2-clause
| 8,910
|
Imports System
Imports NUnit.Framework
Imports MyGeneration.dOOdads
Imports System.Data.OleDb
Namespace MyGeneration.dOOdads.Tests.Access
<TestFixture()> _
Public Class AccessGroupByFixture
Dim aggTest As AggregateTest = New AggregateTest
<TestFixtureSetUp()> _
Public Sub Init()
TransactionMgr.ThreadTransactionMgrReset()
aggTest.ConnectionString = Connections.AccessConnection
End Sub
<SetUp()> _
Public Sub Init2()
aggTest.FlushData()
End Sub
<Test()> _
Public Sub OneGroupBy()
aggTest.Query.CountAll = True
aggTest.Query.CountAllAlias = "Count"
aggTest.Query.AddResultColumn(AggregateTest.ColumnNames.IsActive)
aggTest.Query.AddGroupBy(AggregateTest.ColumnNames.IsActive)
Assert.IsTrue(aggTest.Query.Load())
Assert.AreEqual(2, aggTest.RowCount)
End Sub
<Test()> _
Public Sub TwoGroupBy()
aggTest.Query.CountAll = True
aggTest.Query.CountAllAlias = "Count"
aggTest.Query.AddResultColumn(AggregateTest.ColumnNames.IsActive)
aggTest.Query.AddResultColumn(AggregateTest.ColumnNames.DepartmentID)
aggTest.Query.AddGroupBy(AggregateTest.ColumnNames.IsActive)
aggTest.Query.AddGroupBy(AggregateTest.ColumnNames.DepartmentID)
Assert.IsTrue(aggTest.Query.Load())
Assert.AreEqual(12, aggTest.RowCount)
End Sub
<Test()> _
Public Sub GroupByWithWhere()
aggTest.Query.CountAll = True
aggTest.Query.CountAllAlias = "Count"
aggTest.Query.AddResultColumn(AggregateTest.ColumnNames.IsActive)
aggTest.Query.AddResultColumn(AggregateTest.ColumnNames.DepartmentID)
aggTest.Where.IsActive.Operator = WhereParameter.Operand.Equal
aggTest.Where.IsActive.Value = True
aggTest.Query.AddGroupBy(AggregateTest.ColumnNames.IsActive)
aggTest.Query.AddGroupBy(AggregateTest.ColumnNames.DepartmentID)
Assert.IsTrue(aggTest.Query.Load())
Assert.AreEqual(5, aggTest.RowCount)
End Sub
<Test()> _
Public Sub GroupByWithWhereAndOrderBy()
aggTest.Query.CountAll = True
aggTest.Query.CountAllAlias = "Count"
aggTest.Query.AddResultColumn(AggregateTest.ColumnNames.IsActive)
aggTest.Query.AddResultColumn(AggregateTest.ColumnNames.DepartmentID)
aggTest.Where.IsActive.Operator = WhereParameter.Operand.Equal
aggTest.Where.IsActive.Value = True
aggTest.Query.AddGroupBy(AggregateTest.ColumnNames.IsActive)
aggTest.Query.AddGroupBy(AggregateTest.ColumnNames.DepartmentID)
aggTest.Query.AddOrderBy(AggregateTest.ColumnNames.DepartmentID, WhereParameter.Dir.ASC)
aggTest.Query.AddOrderBy(AggregateTest.ColumnNames.IsActive, WhereParameter.Dir.ASC)
Assert.IsTrue(aggTest.Query.Load())
Assert.AreEqual(5, aggTest.RowCount)
End Sub
<Test()> _
Public Sub GroupByWithOrderByCountAll()
aggTest.Query.CountAll = True
aggTest.Query.CountAllAlias = "Count"
aggTest.Query.AddResultColumn(AggregateTest.ColumnNames.IsActive)
aggTest.Query.AddResultColumn(AggregateTest.ColumnNames.DepartmentID)
aggTest.Where.IsActive.Operator = WhereParameter.Operand.Equal
aggTest.Where.IsActive.Value = True
aggTest.Query.AddGroupBy(AggregateTest.ColumnNames.IsActive)
aggTest.Query.AddGroupBy(AggregateTest.ColumnNames.DepartmentID)
aggTest.Query.AddOrderBy(aggTest.Query, WhereParameter.Dir.DESC)
Assert.IsTrue(aggTest.Query.Load())
Assert.AreEqual(5, aggTest.RowCount)
End Sub
<Test()> _
Public Sub GroupByWithTop()
aggTest.Query.Top = 3
aggTest.Query.CountAll = True
aggTest.Query.CountAllAlias = "Count"
aggTest.Query.AddResultColumn(AggregateTest.ColumnNames.IsActive)
aggTest.Query.AddResultColumn(AggregateTest.ColumnNames.DepartmentID)
aggTest.Where.IsActive.Operator = WhereParameter.Operand.Equal
aggTest.Where.IsActive.Value = True
aggTest.Query.AddGroupBy(AggregateTest.ColumnNames.IsActive)
aggTest.Query.AddGroupBy(AggregateTest.ColumnNames.DepartmentID)
aggTest.Query.AddOrderBy(aggTest.Query, WhereParameter.Dir.DESC)
Assert.IsTrue(aggTest.Query.Load())
Assert.AreEqual(aggTest.Query.Top, aggTest.RowCount)
End Sub
<Test()> _
Public Sub GroupByWithDistinct()
aggTest.Query.Distinct = True
aggTest.Query.CountAll = True
aggTest.Query.CountAllAlias = "Count"
aggTest.Query.AddResultColumn(AggregateTest.ColumnNames.IsActive)
aggTest.Query.AddResultColumn(AggregateTest.ColumnNames.DepartmentID)
aggTest.Where.IsActive.Operator = WhereParameter.Operand.Equal
aggTest.Where.IsActive.Value = True
aggTest.Query.AddGroupBy(AggregateTest.ColumnNames.IsActive)
aggTest.Query.AddGroupBy(AggregateTest.ColumnNames.DepartmentID)
aggTest.Query.AddOrderBy(aggTest.Query, WhereParameter.Dir.DESC)
Assert.IsTrue(aggTest.Query.Load())
Assert.AreEqual(5, aggTest.RowCount)
End Sub
<Test()> _
Public Sub GroupByWithTearoff()
aggTest.Aggregate.Salary.Function = AggregateParameter.Func.Sum
aggTest.Aggregate.Salary.Alias = "Sum"
Dim ap As AggregateParameter = aggTest.Aggregate.TearOff.Salary
ap.Function = AggregateParameter.Func.Min
ap.Alias = "Min"
aggTest.Query.AddResultColumn(AggregateTest.ColumnNames.IsActive)
aggTest.Query.AddResultColumn(AggregateTest.ColumnNames.DepartmentID)
aggTest.Where.IsActive.Operator = WhereParameter.Operand.Equal
aggTest.Where.IsActive.Value = True
aggTest.Query.AddGroupBy(AggregateTest.ColumnNames.IsActive)
aggTest.Query.AddGroupBy(AggregateTest.ColumnNames.DepartmentID)
aggTest.Query.AddOrderBy(aggTest.Query, WhereParameter.Dir.DESC)
Assert.IsTrue(aggTest.Query.Load())
Assert.AreEqual(5, aggTest.RowCount)
End Sub
<Test(), ExpectedException(GetType(OleDbException))> _
Public Sub GroupByWithRollup()
aggTest.Query.WithRollup = True
aggTest.Query.CountAll = True
aggTest.Query.CountAllAlias = "Count"
aggTest.Query.AddResultColumn(AggregateTest.ColumnNames.IsActive)
aggTest.Query.AddResultColumn(AggregateTest.ColumnNames.DepartmentID)
aggTest.Query.AddGroupBy(AggregateTest.ColumnNames.IsActive)
aggTest.Query.AddGroupBy(AggregateTest.ColumnNames.DepartmentID)
aggTest.Query.AddOrderBy(aggTest.Query, WhereParameter.Dir.DESC)
aggTest.Query.Load()
End Sub
End Class
End Namespace
|
cafephin/mygeneration
|
src/doodads/Tests/VBNet/Access/AccessGroupByFixture.vb
|
Visual Basic
|
bsd-3-clause
| 6,305
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Collections.Immutable
Imports System.ComponentModel.Composition
Imports System.Threading
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Media
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Classification
Imports Microsoft.CodeAnalysis.CSharp.Syntax
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.Editor.FindUsages
Imports Microsoft.CodeAnalysis.Editor.UnitTests
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.Host
Imports Microsoft.CodeAnalysis.Shared.Extensions
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.VisualStudio.Composition
Imports Microsoft.VisualStudio.LanguageServices.CodeLens
Imports Microsoft.VisualStudio.LanguageServices.FindUsages
Imports Microsoft.VisualStudio.OLE.Interop
Imports Microsoft.VisualStudio.Shell
Imports Microsoft.VisualStudio.Shell.FindAllReferences
Imports Microsoft.VisualStudio.Shell.TableControl
Imports Microsoft.VisualStudio.Shell.TableManager
Imports Microsoft.VisualStudio.Text
Imports Roslyn.Test.Utilities
Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Venus
<UseExportProvider>
Public Class DocumentService_IntegrationTests
<WpfFact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestFindUsageIntegration() As System.Threading.Tasks.Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Original.cs">
class {|Original:C|}
{
[|C|]$$ c;
}
</Document>
<Document FilePath="Mapped.cs">
class {|Definition:C1|}
{
[|C1|] c;
}reference
</Document>
</Project>
</Workspace>
Dim exportProvider = ExportProviderCache _
.GetOrCreateExportProviderFactory(TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic() _
.WithParts(GetType(MockServiceProvider))) _
.CreateExportProvider()
Using workspace = TestWorkspace.Create(input, exportProvider:=exportProvider, documentServiceProvider:=TestDocumentServiceProvider.Instance)
Dim presenter = New StreamingFindUsagesPresenter(workspace, workspace.ExportProvider.AsExportProvider())
Dim context = presenter.StartSearch("test", supportsReferences:=True)
Dim cursorDocument = workspace.Documents.First(Function(d) d.CursorPosition.HasValue)
Dim cursorPosition = cursorDocument.CursorPosition.Value
Dim startDocument = workspace.CurrentSolution.GetDocument(cursorDocument.Id)
Assert.NotNull(startDocument)
Dim findRefsService = startDocument.GetLanguageService(Of IFindUsagesService)
Await findRefsService.FindReferencesAsync(startDocument, cursorPosition, context)
Dim definitionDocument = workspace.Documents.First(Function(d) d.AnnotatedSpans.ContainsKey("Definition"))
Dim definitionText = Await workspace.CurrentSolution.GetDocument(definitionDocument.Id).GetTextAsync()
Dim definitionSpan = definitionDocument.AnnotatedSpans("Definition").Single()
Dim referenceSpan = definitionDocument.SelectedSpans.First()
Dim expected = {
(definitionDocument.Name, definitionText.Lines.GetLinePositionSpan(definitionSpan).Start, definitionText.Lines.GetLineFromPosition(definitionSpan.Start).ToString().Trim()),
(definitionDocument.Name, definitionText.Lines.GetLinePositionSpan(referenceSpan).Start, definitionText.Lines.GetLineFromPosition(referenceSpan.Start).ToString().Trim())}
Dim factory = TestFindAllReferencesService.Instance.LastWindow.MyTableManager.LastSink.LastFactory
Dim snapshot = factory.GetCurrentSnapshot()
Dim actual = New List(Of (String, LinePosition, String))
For i = 0 To snapshot.Count - 1
Dim name As Object = Nothing
Dim line As Object = Nothing
Dim position As Object = Nothing
Dim content As Object = Nothing
Assert.True(snapshot.TryGetValue(i, StandardTableKeyNames.DocumentName, name))
Assert.True(snapshot.TryGetValue(i, StandardTableKeyNames.Line, line))
Assert.True(snapshot.TryGetValue(i, StandardTableKeyNames.Column, position))
Assert.True(snapshot.TryGetValue(i, StandardTableKeyNames.Text, content))
actual.Add((DirectCast(name, String), New LinePosition(CType(line, Integer), CType(position, Integer)), DirectCast(content, String)))
Next
' confirm that all FAR results are mapped to ones in mapped.cs file rather than ones in original.cs
AssertEx.SetEqual(expected, actual)
End Using
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCodeLensIntegration() As System.Threading.Tasks.Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Original.cs">
class {|Original:C|}
{
[|C|] c { get; };
}
</Document>
<Document FilePath="Mapped.cs">
class {|Definition:C1|}
{
[|C1|] c { get; };
}reference
</Document>
</Project>
</Workspace>
Using workspace = TestWorkspace.Create(input, documentServiceProvider:=TestDocumentServiceProvider.Instance)
Dim codelensService = New RemoteCodeLensReferencesService()
Dim originalDocument = workspace.Documents.First(Function(d) d.AnnotatedSpans.ContainsKey("Original"))
Dim startDocument = workspace.CurrentSolution.GetDocument(originalDocument.Id)
Assert.NotNull(startDocument)
Dim root = Await startDocument.GetSyntaxRootAsync()
Dim node = root.FindNode(originalDocument.AnnotatedSpans("Original").First()).AncestorsAndSelf().OfType(Of ClassDeclarationSyntax).First()
Dim results = Await codelensService.FindReferenceLocationsAsync(workspace.CurrentSolution, startDocument.Id, node, CancellationToken.None)
Dim definitionDocument = workspace.Documents.First(Function(d) d.AnnotatedSpans.ContainsKey("Definition"))
Dim definitionText = Await workspace.CurrentSolution.GetDocument(definitionDocument.Id).GetTextAsync()
Dim referenceSpan = definitionDocument.SelectedSpans.First()
Dim expected = {(definitionDocument.Name, definitionText.Lines.GetLinePositionSpan(referenceSpan).Start, definitionText.Lines.GetLineFromPosition(referenceSpan.Start).ToString())}
Dim actual = New List(Of (String, LinePosition, String))
For Each result In results
actual.Add((result.FilePath, New LinePosition(result.LineNumber, result.ColumnNumber), result.ReferenceLineText))
Next
' confirm that all FAR results are mapped to ones in mapped.cs file rather than ones in original.cs
AssertEx.SetEqual(expected, actual)
End Using
End Function
<InlineData(True)>
<InlineData(False)>
<WpfTheory, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestDocumentOperationCanApplyChange(ignoreUnchangeableDocuments As Boolean) As System.Threading.Tasks.Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Original.cs">
class C { }
</Document>
</Project>
</Workspace>
Using workspace = TestWorkspace.Create(input, documentServiceProvider:=TestDocumentServiceProvider.Instance, ignoreUnchangeableDocumentsWhenApplyingChanges:=ignoreUnchangeableDocuments)
Dim document = workspace.CurrentSolution.GetDocument(workspace.Documents.First().Id)
' made a change
Dim newDocument = document.WithText(SourceText.From(""))
' confirm the change
Assert.Equal(String.Empty, (Await newDocument.GetTextAsync()).ToString())
' confirm apply changes are not supported
Assert.False(document.CanApplyChange())
Assert.Equal(ignoreUnchangeableDocuments, workspace.IgnoreUnchangeableDocumentsWhenApplyingChanges)
' see whether changes can be applied to the solution
If ignoreUnchangeableDocuments Then
Assert.True(workspace.TryApplyChanges(newDocument.Project.Solution))
' Changes should not be made if Workspace.IgnoreUnchangeableDocumentsWhenApplyingChanges is true
Dim currentDocument = workspace.CurrentSolution.GetDocument(document.Id)
Assert.True(currentDocument.GetTextSynchronously(CancellationToken.None).ContentEquals(document.GetTextSynchronously(CancellationToken.None)))
Else
' should throw if Workspace.IgnoreUnchangeableDocumentsWhenApplyingChanges is false
Assert.Throws(Of NotSupportedException)(Sub() workspace.TryApplyChanges(newDocument.Project.Solution))
End If
End Using
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestDocumentOperationCanApplySupportDiagnostics() As System.Threading.Tasks.Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Original.cs">
class { }
</Document>
</Project>
</Workspace>
Using workspace = TestWorkspace.Create(input, documentServiceProvider:=TestDocumentServiceProvider.Instance)
Dim document = workspace.CurrentSolution.GetDocument(workspace.Documents.First().Id)
Dim model = Await document.GetSemanticModelAsync()
' confirm there are errors
Assert.True(model.GetDiagnostics().Any())
Dim diagnosticService = New TestDiagnosticAnalyzerService(DiagnosticExtensions.GetCompilerDiagnosticAnalyzersMap())
' confirm diagnostic support is off for the document
Assert.False(document.SupportsDiagnostics())
' register the workspace to the service
diagnosticService.CreateIncrementalAnalyzer(workspace)
' confirm that IDE doesn't report the diagnostics
Dim diagnostics = Await diagnosticService.GetDiagnosticsAsync(workspace.CurrentSolution, documentId:=document.Id)
Assert.False(diagnostics.Any())
End Using
End Function
Private Class TestDocumentServiceProvider
Implements IDocumentServiceProvider
Public Shared ReadOnly Instance As TestDocumentServiceProvider = New TestDocumentServiceProvider()
Public Function GetService(Of TService As {Class, IDocumentService})() As TService Implements IDocumentServiceProvider.GetService
If TypeOf SpanMapper.Instance Is TService Then
Return TryCast(SpanMapper.Instance, TService)
ElseIf TypeOf Excerpter.Instance Is TService Then
Return TryCast(Excerpter.Instance, TService)
ElseIf TypeOf DocumentOperations.Instance Is TService Then
Return TryCast(DocumentOperations.Instance, TService)
End If
Return Nothing
End Function
Private Class SpanMapper
Implements ISpanMappingService
Public Shared ReadOnly Instance As SpanMapper = New SpanMapper()
Public Async Function MapSpansAsync(document As Document, spans As IEnumerable(Of TextSpan), cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of MappedSpanResult)) Implements ISpanMappingService.MapSpansAsync
Dim testWorkspace = DirectCast(document.Project.Solution.Workspace, TestWorkspace)
Dim testDocument = testWorkspace.GetTestDocument(document.Id)
Dim mappedTestDocument = testWorkspace.Documents.First(Function(d) d.Id <> testDocument.Id)
Dim mappedDocument = testWorkspace.CurrentSolution.GetDocument(mappedTestDocument.Id)
Dim mappedSource = Await mappedDocument.GetTextAsync(cancellationToken).ConfigureAwait(False)
Dim results = New List(Of MappedSpanResult)
For Each span In spans
If testDocument.AnnotatedSpans("Original").First() = span Then
Dim mappedSpan = mappedTestDocument.AnnotatedSpans("Definition").First()
Dim lineSpan = mappedSource.Lines.GetLinePositionSpan(mappedSpan)
results.Add(New MappedSpanResult(mappedDocument.FilePath, lineSpan, mappedSpan))
ElseIf testDocument.SelectedSpans.First() = span Then
Dim mappedSpan = mappedTestDocument.SelectedSpans.First()
Dim lineSpan = mappedSource.Lines.GetLinePositionSpan(mappedSpan)
results.Add(New MappedSpanResult(mappedDocument.FilePath, lineSpan, mappedSpan))
Else
Throw New Exception("shouldn't reach here")
End If
Next
Return results.ToImmutableArray()
End Function
End Class
Private Class Excerpter
Implements IDocumentExcerptService
Public Shared ReadOnly Instance As Excerpter = New Excerpter()
Public Async Function TryExcerptAsync(document As Document, span As TextSpan, mode As ExcerptMode, cancellationToken As CancellationToken) As Task(Of ExcerptResult?) Implements IDocumentExcerptService.TryExcerptAsync
Dim testWorkspace = DirectCast(document.Project.Solution.Workspace, TestWorkspace)
Dim testDocument = testWorkspace.GetTestDocument(document.Id)
Dim mappedTestDocument = testWorkspace.Documents.First(Function(d) d.Id <> testDocument.Id)
Dim mappedDocument = testWorkspace.CurrentSolution.GetDocument(mappedTestDocument.Id)
Dim mappedSource = Await mappedDocument.GetTextAsync(cancellationToken).ConfigureAwait(False)
Dim mappedSpan As TextSpan
If testDocument.AnnotatedSpans("Original").First() = span Then
mappedSpan = mappedTestDocument.AnnotatedSpans("Definition").First()
ElseIf testDocument.SelectedSpans.First() = span Then
mappedSpan = mappedTestDocument.SelectedSpans.First()
Else
Throw New Exception("shouldn't reach here")
End If
Dim line = mappedSource.Lines.GetLineFromPosition(mappedSpan.Start)
Return New ExcerptResult(mappedSource.GetSubText(line.Span), New TextSpan(mappedSpan.Start - line.Start, mappedSpan.Length), ImmutableArray.Create(New ClassifiedSpan(New TextSpan(0, line.Span.Length), ClassificationTypeNames.Text)), document, span)
End Function
End Class
Private Class DocumentOperations
Implements IDocumentOperationService
Public Shared ReadOnly Instance As DocumentOperations = New DocumentOperations()
Public ReadOnly Property CanApplyChange As Boolean Implements IDocumentOperationService.CanApplyChange
Get
Return False
End Get
End Property
Public ReadOnly Property SupportDiagnostics As Boolean Implements IDocumentOperationService.SupportDiagnostics
Get
Return False
End Get
End Property
End Class
End Class
<PartNotDiscoverable>
<Export(GetType(SVsServiceProvider))>
Private Class MockServiceProvider
Implements SVsServiceProvider
<ImportingConstructor>
Public Sub New()
End Sub
Public Function GetService(serviceType As Type) As Object Implements SVsServiceProvider.GetService
If GetType(SVsFindAllReferences) = serviceType Then
Return TestFindAllReferencesService.Instance
End If
Return Nothing
End Function
End Class
Private Class TestFindAllReferencesService
Implements IFindAllReferencesService
Public Shared ReadOnly Instance As TestFindAllReferencesService = New TestFindAllReferencesService()
' this mock is not thread-safe. don't use it concurrently
Public LastWindow As FindAllReferencesWindow
Public Function StartSearch(label As String) As IFindAllReferencesWindow Implements IFindAllReferencesService.StartSearch
LastWindow = New FindAllReferencesWindow(label)
Return LastWindow
End Function
End Class
Private Class FindAllReferencesWindow
Implements IFindAllReferencesWindow
Public ReadOnly Label As String
Public ReadOnly MyTableControl As WpfTableControl = New WpfTableControl()
Public ReadOnly MyTableManager As TableManager = New TableManager()
Public Sub New(label As String)
Me.Label = label
End Sub
Public ReadOnly Property TableControl As IWpfTableControl Implements IFindAllReferencesWindow.TableControl
Get
Return MyTableControl
End Get
End Property
Public ReadOnly Property Manager As ITableManager Implements IFindAllReferencesWindow.Manager
Get
Return MyTableManager
End Get
End Property
Public Property Title As String Implements IFindAllReferencesWindow.Title
Public Event Closed As EventHandler Implements IFindAllReferencesWindow.Closed
#Region "Not Implemented"
Public Sub AddCommandTarget(target As IOleCommandTarget, ByRef [next] As IOleCommandTarget) Implements IFindAllReferencesWindow.AddCommandTarget
Throw New NotImplementedException()
End Sub
Public Sub SetProgress(progress As Double) Implements IFindAllReferencesWindow.SetProgress
Throw New NotImplementedException()
End Sub
Public Sub SetProgress(completed As Integer, maximum As Integer) Implements IFindAllReferencesWindow.SetProgress
Throw New NotImplementedException()
End Sub
#End Region
End Class
Private Class TableDataSink
Implements ITableDataSink
' not thread safe. it should never be used concurrently
Public LastFactory As ITableEntriesSnapshotFactory
Public Property IsStable As Boolean Implements ITableDataSink.IsStable
Public Sub AddFactory(newFactory As ITableEntriesSnapshotFactory, Optional removeAllFactories As Boolean = False) Implements ITableDataSink.AddFactory
LastFactory = newFactory
End Sub
Public Sub FactorySnapshotChanged(factory As ITableEntriesSnapshotFactory) Implements ITableDataSink.FactorySnapshotChanged
LastFactory = factory
End Sub
#Region "Not Implemented"
Public Sub AddEntries(newEntries As IReadOnlyList(Of ITableEntry), Optional removeAllEntries As Boolean = False) Implements ITableDataSink.AddEntries
Throw New NotImplementedException()
End Sub
Public Sub RemoveEntries(oldEntries As IReadOnlyList(Of ITableEntry)) Implements ITableDataSink.RemoveEntries
Throw New NotImplementedException()
End Sub
Public Sub ReplaceEntries(oldEntries As IReadOnlyList(Of ITableEntry), newEntries As IReadOnlyList(Of ITableEntry)) Implements ITableDataSink.ReplaceEntries
Throw New NotImplementedException()
End Sub
Public Sub RemoveAllEntries() Implements ITableDataSink.RemoveAllEntries
Throw New NotImplementedException()
End Sub
Public Sub AddSnapshot(newSnapshot As ITableEntriesSnapshot, Optional removeAllSnapshots As Boolean = False) Implements ITableDataSink.AddSnapshot
Throw New NotImplementedException()
End Sub
Public Sub RemoveSnapshot(oldSnapshot As ITableEntriesSnapshot) Implements ITableDataSink.RemoveSnapshot
Throw New NotImplementedException()
End Sub
Public Sub RemoveAllSnapshots() Implements ITableDataSink.RemoveAllSnapshots
Throw New NotImplementedException()
End Sub
Public Sub ReplaceSnapshot(oldSnapshot As ITableEntriesSnapshot, newSnapshot As ITableEntriesSnapshot) Implements ITableDataSink.ReplaceSnapshot
Throw New NotImplementedException()
End Sub
Public Sub RemoveFactory(oldFactory As ITableEntriesSnapshotFactory) Implements ITableDataSink.RemoveFactory
Throw New NotImplementedException()
End Sub
Public Sub ReplaceFactory(oldFactory As ITableEntriesSnapshotFactory, newFactory As ITableEntriesSnapshotFactory) Implements ITableDataSink.ReplaceFactory
Throw New NotImplementedException()
End Sub
Public Sub RemoveAllFactories() Implements ITableDataSink.RemoveAllFactories
Throw New NotImplementedException()
End Sub
#End Region
End Class
Private Class TableManager
Implements ITableManager
Private ReadOnly _sources As List(Of ITableDataSource) = New List(Of ITableDataSource)()
Public LastSink As TableDataSink
Public ReadOnly Property Identifier As String Implements ITableManager.Identifier
Get
Return "Test"
End Get
End Property
Public ReadOnly Property Sources As IReadOnlyList(Of ITableDataSource) Implements ITableManager.Sources
Get
Return _sources
End Get
End Property
Public Event SourcesChanged As EventHandler Implements ITableManager.SourcesChanged
Public Function AddSource(source As ITableDataSource, ParamArray columns() As String) As Boolean Implements ITableManager.AddSource
Return AddSource(source, columns.ToImmutableArray())
End Function
Public Function AddSource(source As ITableDataSource, columns As IReadOnlyCollection(Of String)) As Boolean Implements ITableManager.AddSource
LastSink = New TableDataSink()
source.Subscribe(LastSink)
_sources.Add(source)
Return True
End Function
Public Function RemoveSource(source As ITableDataSource) As Boolean Implements ITableManager.RemoveSource
Return _sources.Remove(source)
End Function
#Region "Not Implemented"
Public Function GetColumnsForSources(sources As IEnumerable(Of ITableDataSource)) As IReadOnlyList(Of String) Implements ITableManager.GetColumnsForSources
Throw New NotImplementedException()
End Function
#End Region
End Class
Private Class WpfTableControl
Implements IWpfTableControl2
Public Event GroupingsChanged As EventHandler Implements IWpfTableControl2.GroupingsChanged
Private _states As List(Of ColumnState) = New List(Of ColumnState)({New ColumnState2(StandardTableColumnDefinitions2.Definition, isVisible:=True, width:=10)})
Public ReadOnly Property ColumnStates As IReadOnlyList(Of ColumnState) Implements IWpfTableControl.ColumnStates
Get
Return _states
End Get
End Property
Public Sub SetColumnStates(states As IEnumerable(Of ColumnState)) Implements IWpfTableControl2.SetColumnStates
_states = states.ToList()
End Sub
Public ReadOnly Property ColumnDefinitionManager As ITableColumnDefinitionManager Implements IWpfTableControl.ColumnDefinitionManager
Get
Return Nothing
End Get
End Property
#Region "Not Implemented"
Public ReadOnly Property IsDataStable As Boolean Implements IWpfTableControl2.IsDataStable
Get
Throw New NotImplementedException()
End Get
End Property
Public Property NavigationBehavior As TableEntryNavigationBehavior Implements IWpfTableControl2.NavigationBehavior
Get
Throw New NotImplementedException()
End Get
Set(value As TableEntryNavigationBehavior)
Throw New NotImplementedException()
End Set
End Property
Public Property KeepSelectionInView As Boolean Implements IWpfTableControl2.KeepSelectionInView
Get
Throw New NotImplementedException()
End Get
Set(value As Boolean)
Throw New NotImplementedException()
End Set
End Property
Public Property ShowGroupingLine As Boolean Implements IWpfTableControl2.ShowGroupingLine
Get
Throw New NotImplementedException()
End Get
Set(value As Boolean)
Throw New NotImplementedException()
End Set
End Property
Public Property RaiseDataUnstableChangeDelay As TimeSpan Implements IWpfTableControl2.RaiseDataUnstableChangeDelay
Get
Throw New NotImplementedException()
End Get
Set(value As TimeSpan)
Throw New NotImplementedException()
End Set
End Property
Public Property SelectedItemActiveBackground As Brush Implements IWpfTableControl2.SelectedItemActiveBackground
Get
Throw New NotImplementedException()
End Get
Set(value As Brush)
Throw New NotImplementedException()
End Set
End Property
Public Property SelectedItemActiveForeground As Brush Implements IWpfTableControl2.SelectedItemActiveForeground
Get
Throw New NotImplementedException()
End Get
Set(value As Brush)
Throw New NotImplementedException()
End Set
End Property
Public Property SelectedItemInactiveBackground As Brush Implements IWpfTableControl2.SelectedItemInactiveBackground
Get
Throw New NotImplementedException()
End Get
Set(value As Brush)
Throw New NotImplementedException()
End Set
End Property
Public Property SelectedItemInactiveForeground As Brush Implements IWpfTableControl2.SelectedItemInactiveForeground
Get
Throw New NotImplementedException()
End Get
Set(value As Brush)
Throw New NotImplementedException()
End Set
End Property
Public ReadOnly Property Manager As ITableManager Implements IWpfTableControl.Manager
Get
Throw New NotImplementedException()
End Get
End Property
Public ReadOnly Property Control As FrameworkElement Implements IWpfTableControl.Control
Get
Throw New NotImplementedException()
End Get
End Property
Public ReadOnly Property AutoSubscribe As Boolean Implements IWpfTableControl.AutoSubscribe
Get
Throw New NotImplementedException()
End Get
End Property
Public Property SortFunction As Comparison(Of ITableEntryHandle) Implements IWpfTableControl.SortFunction
Get
Throw New NotImplementedException()
End Get
Set(value As Comparison(Of ITableEntryHandle))
Throw New NotImplementedException()
End Set
End Property
Public Property SelectionMode As SelectionMode Implements IWpfTableControl.SelectionMode
Get
Throw New NotImplementedException()
End Get
Set(value As SelectionMode)
Throw New NotImplementedException()
End Set
End Property
Public ReadOnly Property Entries As IEnumerable(Of ITableEntryHandle) Implements IWpfTableControl.Entries
Get
Throw New NotImplementedException()
End Get
End Property
Public Property SelectedEntries As IEnumerable(Of ITableEntryHandle) Implements IWpfTableControl.SelectedEntries
Get
Throw New NotImplementedException()
End Get
Set(value As IEnumerable(Of ITableEntryHandle))
Throw New NotImplementedException()
End Set
End Property
Public ReadOnly Property SelectedEntry As ITableEntryHandle Implements IWpfTableControl.SelectedEntry
Get
Throw New NotImplementedException()
End Get
End Property
Public ReadOnly Property SelectedOrFirstEntry As ITableEntryHandle Implements IWpfTableControl.SelectedOrFirstEntry
Get
Throw New NotImplementedException()
End Get
End Property
Public Event DataStabilityChanged As EventHandler Implements IWpfTableControl2.DataStabilityChanged
Public Event FiltersChanged As EventHandler(Of FiltersChangedEventArgs) Implements IWpfTableControl.FiltersChanged
Public Event PreEntriesChanged As EventHandler Implements IWpfTableControl.PreEntriesChanged
Public Event EntriesChanged As EventHandler(Of EntriesChangedEventArgs) Implements IWpfTableControl.EntriesChanged
Public Sub SubscribeToDataSource(source As ITableDataSource) Implements IWpfTableControl.SubscribeToDataSource
Throw New NotImplementedException()
End Sub
Public Sub SelectAll() Implements IWpfTableControl.SelectAll
Throw New NotImplementedException()
End Sub
Public Sub UnselectAll() Implements IWpfTableControl.UnselectAll
Throw New NotImplementedException()
End Sub
Public Sub RefreshUI() Implements IWpfTableControl.RefreshUI
Throw New NotImplementedException()
End Sub
Public Function GetAllFilters() As IEnumerable(Of Tuple(Of String, IEntryFilter)) Implements IWpfTableControl2.GetAllFilters
Throw New NotImplementedException()
End Function
Public Function UnsubscribeFromDataSource(source As ITableDataSource) As Boolean Implements IWpfTableControl.UnsubscribeFromDataSource
Throw New NotImplementedException()
End Function
Public Function SetFilter(key As String, newFilter As IEntryFilter) As IEntryFilter Implements IWpfTableControl.SetFilter
Throw New NotImplementedException()
End Function
Public Function GetFilter(key As String) As IEntryFilter Implements IWpfTableControl.GetFilter
Throw New NotImplementedException()
End Function
Public Function ForceUpdateAsync() As Task(Of EntriesChangedEventArgs) Implements IWpfTableControl.ForceUpdateAsync
Throw New NotImplementedException()
End Function
Public Sub Dispose() Implements IDisposable.Dispose
End Sub
#End Region
End Class
End Class
End Namespace
|
abock/roslyn
|
src/VisualStudio/Core/Test/Venus/DocumentService_IntegrationTests.vb
|
Visual Basic
|
mit
| 33,382
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.Demos.WPF.VisualBasic.GanttChartDataGrid.MainFeatures.MySettings
Get
Return Global.Demos.WPF.VisualBasic.GanttChartDataGrid.MainFeatures.MySettings.Default
End Get
End Property
End Module
End Namespace
|
DlhSoftTeam/GanttChartLightLibrary-Demos
|
GanttChartLightLibraryDemos/Demos/Samples/WPF-VisualBasic/GanttChartDataGrid/MainFeatures/My Project/Settings.Designer.vb
|
Visual Basic
|
mit
| 2,895
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Option Strict Off
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateConstructor
Imports Microsoft.CodeAnalysis.VisualBasic.Diagnostics
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics.GenerateConstructor
Public Class GenerateConstructorTests
Inherits AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest
Friend Overrides Function CreateDiagnosticProviderAndFixer(workspace As Workspace) As Tuple(Of DiagnosticAnalyzer, CodeFixProvider)
Return New Tuple(Of DiagnosticAnalyzer, CodeFixProvider)(Nothing, New GenerateConstructorCodeFixProvider())
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateIntoContainingType() As Task
Await TestAsync(
"Class C
Sub Main()
Dim f = New C([|4|], 5, 6)
End Sub
End Class",
"Class C
Private v1 As Integer
Private v2 As Integer
Private v3 As Integer
Public Sub New(v1 As Integer, v2 As Integer, v3 As Integer)
Me.v1 = v1
Me.v2 = v2
Me.v3 = v3
End Sub
Sub Main()
Dim f = New C(4, 5, 6)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestInvokingFromInsideAnotherConstructor() As Task
Await TestAsync(
"Class A
Private v As B
Public Sub New()
Me.v = New B([|5|])
End Sub
End Class
Friend Class B
End Class",
"Class A
Private v As B
Public Sub New()
Me.v = New B(5)
End Sub
End Class
Friend Class B
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestMissingGenerateDefaultConstructor() As Task
Await TestMissingAsync(
"Class Test
Sub Main()
Dim a = New [|A|]()
End Sub
End Class
Class A
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestMissingGenerateDefaultConstructorInStructure() As Task
Await TestMissingAsync(
"Class Test
Sub Main()
Dim a = New [|A|]()
End Sub
End Class
Structure A
End Structure")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestOfferDefaultConstructorWhenOverloadExists() As Task
Await TestAsync(
"Class Test
Sub Main()
Dim a = [|New A()|]
End Sub
End Class
Class A
Sub New(x As Integer)
End Sub
End Class",
"Class Test
Sub Main()
Dim a = New A()
End Sub
End Class
Class A
Public Sub New()
End Sub
Sub New(x As Integer)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestParameterizedConstructorOffered1() As Task
Await TestAsync(
"Class Test
Sub Main()
Dim a = New A([|1|])
End Sub
End Class
Class A
End Class",
"Class Test
Sub Main()
Dim a = New A(1)
End Sub
End Class
Class A
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestParameterizedConstructorOffered2() As Task
Await TestAsync(
"Class Test
Sub Main()
Dim a = New A([|1|])
End Sub
End Class
Class A
Public Sub New()
End Sub
End Class",
"Class Test
Sub Main()
Dim a = New A(1)
End Sub
End Class
Class A
Private v As Integer
Public Sub New()
End Sub
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class")
End Function
<WorkItem(527627, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/527627"), WorkItem(539735, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539735"), WorkItem(539735, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539735")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestInAsNewExpression() As Task
Await TestAsync(
"Class Test
Sub Main()
Dim a As New A([|1|])
End Sub
End Class
Class A
Public Sub New()
End Sub
End Class",
"Class Test
Sub Main()
Dim a As New A(1)
End Sub
End Class
Class A
Private v As Integer
Public Sub New()
End Sub
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateInPartialClass1() As Task
Await TestAsync(
"Public Partial Class Test
Public Sub S1()
End Sub
End Class
Public Class Test
Public Sub S2()
End Sub
End Class
Public Class A
Sub Main()
Dim s = New Test([|5|])
End Sub
End Class",
"Public Partial Class Test
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
Public Sub S1()
End Sub
End Class
Public Class Test
Public Sub S2()
End Sub
End Class
Public Class A
Sub Main()
Dim s = New Test(5)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateInPartialClassWhenArityDoesntMatch() As Task
Await TestAsync(
"Public Partial Class Test
Public Sub S1()
End Sub
End Class
Public Class Test(Of T)
Public Sub S2()
End Sub
End Class
Public Class A
Sub Main()
Dim s = New Test([|5|])
End Sub
End Class",
"Public Partial Class Test
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
Public Sub S1()
End Sub
End Class
Public Class Test(Of T)
Public Sub S2()
End Sub
End Class
Public Class A
Sub Main()
Dim s = New Test(5)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateInPartialClassWithConflicts() As Task
Await TestAsync(
"Public Partial Class Test2
End Class
Private Partial Class Test2
End Class
Public Class A
Sub Main()
Dim s = New Test2([|5|])
End Sub
End Class",
"Public Partial Class Test2
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class
Private Partial Class Test2
End Class
Public Class A
Sub Main()
Dim s = New Test2(5)
End Sub
End Class")
End Function
<WorkItem(528257, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528257")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateIntoInaccessibleType() As Task
Await TestMissingAsync(
"Class Foo
Private Class Bar
End Class
End Class
Class A
Sub Main()
Dim s = New Foo.Bar([|5|])
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestOnNestedTypes() As Task
Await TestAsync(
"Class Foo
Class Bar
End Class
End Class
Class A
Sub Main()
Dim s = New Foo.Bar([|5|])
End Sub
End Class",
"Class Foo
Class Bar
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class
End Class
Class A
Sub Main()
Dim s = New Foo.Bar(5)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestOnNestedPartialTypes() As Task
Await TestAsync(
"Public Partial Class Test
Public Partial Class NestedTest
Public Sub S1()
End Sub
End Class
End Class
Public Partial Class Test
Public Partial Class NestedTest
Public Sub S2()
End Sub
End Class
End Class
Class A
Sub Main()
Dim s = New Test.NestedTest([|5|])
End Sub
End Class",
"Public Partial Class Test
Public Partial Class NestedTest
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
Public Sub S1()
End Sub
End Class
End Class
Public Partial Class Test
Public Partial Class NestedTest
Public Sub S2()
End Sub
End Class
End Class
Class A
Sub Main()
Dim s = New Test.NestedTest(5)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestOnNestedGenericType() As Task
Await TestAsync(
"Class Outer(Of T)
Public Class Inner
End Class
Public i = New Inner([|5|])
End Class",
"Class Outer(Of T)
Public Class Inner
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class
Public i = New Inner(5)
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestOnGenericTypes1() As Task
Await TestAsync(
"Class Base(Of T, V)
End Class
Class Test
Sub Foo()
Dim a = New Base(Of Integer, Integer)([|5|], 5)
End Sub
End Class",
"Class Base(Of T, V)
Private v1 As Integer
Private v2 As Integer
Public Sub New(v1 As Integer, v2 As Integer)
Me.v1 = v1
Me.v2 = v2
End Sub
End Class
Class Test
Sub Foo()
Dim a = New Base(Of Integer, Integer)(5, 5)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestOnGenericTypes2() As Task
Await TestAsync(
"Class Base(Of T, V)
End Class
Class Derived(Of V)
Inherits Base(Of Integer, V)
End Class
Class Test
Sub Foo()
Dim a = New Base(Of Integer, Integer)(5, 5)
Dim b = New Derived(Of Integer)([|5|])
End Sub
End Class",
"Class Base(Of T, V)
End Class
Class Derived(Of V)
Inherits Base(Of Integer, V)
Private v1 As Integer
Public Sub New(v1 As Integer)
Me.v1 = v1
End Sub
End Class
Class Test
Sub Foo()
Dim a = New Base(Of Integer, Integer)(5, 5)
Dim b = New Derived(Of Integer)(5)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestOnGenericTypes3() As Task
Await TestAsync(
"Class Base(Of T, V)
End Class
Class Derived(Of V)
Inherits Base(Of Integer, V)
End Class
Class MoreDerived
Inherits Derived(Of Double)
End Class
Class Test
Sub Foo()
Dim a = New Base(Of Integer, Integer)(5, 5)
Dim b = New Derived(Of Integer)(5)
Dim c = New MoreDerived([|5.5|])
End Sub
End Class",
"Class Base(Of T, V)
End Class
Class Derived(Of V)
Inherits Base(Of Integer, V)
End Class
Class MoreDerived
Inherits Derived(Of Double)
Private v As Double
Public Sub New(v As Double)
Me.v = v
End Sub
End Class
Class Test
Sub Foo()
Dim a = New Base(Of Integer, Integer)(5, 5)
Dim b = New Derived(Of Integer)(5)
Dim c = New MoreDerived(5.5)
End Sub
End Class")
End Function
<WorkItem(528244, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528244")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestDateTypeForInference() As Task
Await TestAsync(
"Class Foo
End Class
Class A
Sub Main()
Dim s = New Foo([|Date.Now|])
End Sub
End Class",
"Class Foo
Private now As Date
Public Sub New(now As Date)
Me.now = now
End Sub
End Class
Class A
Sub Main()
Dim s = New Foo(Date.Now)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestBaseConstructor() As Task
Await TestAsync(
"Class Base
End Class
Class Derived
Inherits Base
Private x As Integer
Public Sub New(x As Integer)
MyBase.New([|x|])
Me.x = x
End Sub
End Class",
"Class Base
Private x As Integer
Public Sub New(x As Integer)
Me.x = x
End Sub
End Class
Class Derived
Inherits Base
Private x As Integer
Public Sub New(x As Integer)
MyBase.New(x)
Me.x = x
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestMustInheritBase() As Task
Await TestAsync(
"MustInherit Class Base
End Class
Class Derived
Inherits Base
Shared x As Integer
Public Sub New(x As Integer)
MyBase.New([|x|]) 'This should generate a protected ctor in Base
Derived.x = x
End Sub
Sub Test1()
Dim a As New Derived(1)
End Sub
End Class",
"MustInherit Class Base
Private x As Integer
Public Sub New(x As Integer)
Me.x = x
End Sub
End Class
Class Derived
Inherits Base
Shared x As Integer
Public Sub New(x As Integer)
MyBase.New(x) 'This should generate a protected ctor in Base
Derived.x = x
End Sub
Sub Test1()
Dim a As New Derived(1)
End Sub
End Class")
End Function
<WorkItem(540586, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540586")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestMissingOnNoCloseParen() As Task
Await TestMissingAsync(
"Imports System
Imports System.Collections.Generic
Imports System.Linq
Module Program
Sub Main(args As String())
Dim c = New [|foo|](
End Sub
End Module
Class foo
End Class")
End Function
<WorkItem(540545, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540545")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestConversionError() As Task
Await TestAsync(
"Imports System
Module Program
Sub Main(args As String())
Dim i As Char
Dim cObject As C = New C([|i|])
Console.WriteLine(cObject.v1)
End Sub
End Module
Class C
Public v1 As Integer
Public Sub New(v1 As Integer)
Me.v1 = v1
End Sub
End Class",
"Imports System
Module Program
Sub Main(args As String())
Dim i As Char
Dim cObject As C = New C(i)
Console.WriteLine(cObject.v1)
End Sub
End Module
Class C
Public v1 As Integer
Private i As Char
Public Sub New(i As Char)
Me.i = i
End Sub Public Sub New(v1 As Integer)
Me.v1 = v1
End Sub
End Class")
End Function
<WorkItem(540642, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540642")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestNotOnNestedConstructor() As Task
Await TestAsync(
"Module Program
Sub Main(args As String())
Dim x As C = New C([|New C()|])
End Sub
End Module
Friend Class C
End Class",
"Module Program
Sub Main(args As String())
Dim x As C = New C(New C())
End Sub
End Module
Friend Class C
Private c As C
Public Sub New(c As C)
Me.c = c
End Sub
End Class")
End Function
<WorkItem(540607, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540607")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestUnavailableTypeParameters() As Task
Await TestAsync(
"Class C(Of T1, T2)
Sub M(x As T1, y As T2)
Dim a As Test = New Test([|x|], y)
End Sub
End Class
Friend Class Test
End Class",
"Class C(Of T1, T2)
Sub M(x As T1, y As T2)
Dim a As Test = New Test(x, y)
End Sub
End Class
Friend Class Test
Private x As Object
Private y As Object
Public Sub New(x As Object, y As Object)
Me.x = x
Me.y = y
End Sub
End Class")
End Function
<WorkItem(540748, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540748")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestKeywordArgument1() As Task
Await TestAsync(
"Class Test
Private [Class] As Integer = 5
Sub Main()
Dim a = New A([|[Class]|])
End Sub
End Class
Class A
End Class",
"Class Test
Private [Class] As Integer = 5
Sub Main()
Dim a = New A([Class])
End Sub
End Class
Class A
Private [class] As Integer
Public Sub New([class] As Integer)
Me.class = [class]
End Sub
End Class")
End Function
<WorkItem(540747, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540747")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestKeywordArgument2() As Task
Await TestAsync(
"Class Test
Sub Main()
Dim a = New A([|Class|])
End Sub
End Class
Class A
End Class",
"Class Test
Sub Main()
Dim a = New A(Class)
End Sub
End Class
Class A
Private p As Object
Public Sub New(p As Object)
Me.p = p
End Sub
End Class")
End Function
<WorkItem(540746, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540746")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestConflictWithTypeParameterName() As Task
Await TestAsync(
"Class Test
Sub Foo()
Dim a = New Bar(Of Integer)([|5|])
End Sub
End Class
Class Bar(Of V)
End Class",
"Class Test
Sub Foo()
Dim a = New Bar(Of Integer)(5)
End Sub
End Class
Class Bar(Of V)
Private v1 As Integer
Public Sub New(v1 As Integer)
Me.v1 = v1
End Sub
End Class")
End Function
<WorkItem(541174, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541174")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestExistingReadonlyField() As Task
Await TestAsync(
"Class C
ReadOnly x As Integer
Sub Test()
Dim x As Integer = 1
Dim obj As New C([|x|])
End Sub
End Class",
"Class C
ReadOnly x As Integer
Public Sub New(x As Integer)
Me.x = x
End Sub
Sub Test()
Dim x As Integer = 1
Dim obj As New C(x)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestExistingProperty() As Task
Await TestAsync(
"Class Program
Sub Test()
Dim x = New A([|P|]:=5)
End Sub
End Class
Class A
Public Property P As Integer
End Class",
"Class Program
Sub Test()
Dim x = New A(P:=5)
End Sub
End Class
Class A
Public Sub New(P As Integer)
Me.P = P
End Sub
Public Property P As Integer
End Class")
End Function
<WorkItem(542055, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542055")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestExistingMethod() As Task
Await TestAsync(
"Class A
Sub Test()
Dim t As New C([|u|]:=5)
End Sub
End Class
Class C
Public Sub u()
End Sub
End Class",
"Class A
Sub Test()
Dim t As New C(u:=5)
End Sub
End Class
Class C
Private u1 As Integer
Public Sub New(u As Integer)
u1 = u
End Sub
Public Sub u()
End Sub
End Class")
End Function
<WorkItem(542055, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542055")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestDetectAssignmentToSharedFieldFromInstanceConstructor() As Task
Await TestAsync(
"Class Program
Sub Test()
Dim x = New A([|P|]:=5)
End Sub
End Class
Class A
Shared Property P As Integer
End Class",
"Class Program
Sub Test()
Dim x = New A(P:=5)
End Sub
End Class
Class A
Private P1 As Integer
Public Sub New(P As Integer)
P1 = P
End Sub
Shared Property P As Integer
End Class")
End Function
<WorkItem(542055, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542055")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestExistingFieldWithSameNameButIncompatibleType() As Task
Await TestAsync(
"Class A
Sub Test()
Dim t As New B([|x|]:=5)
End Sub
End Class
Class B
Private x As String
End Class",
"Class A
Sub Test()
Dim t As New B(x:=5)
End Sub
End Class
Class B
Private x As String
Private x1 As Integer
Public Sub New(x As Integer)
x1 = x
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestExistingFieldFromBaseClass() As Task
Await TestAsync(
"Class A
Sub Test()
Dim t As New C([|u|]:=5)
End Sub
End Class
Class C
Inherits B
Private x As String
End Class
Class B
Protected u As Integer
End Class",
"Class A
Sub Test()
Dim t As New C(u:=5)
End Sub
End Class
Class C
Inherits B
Private x As String
Public Sub New(u As Integer)
Me.u = u
End Sub
End Class
Class B
Protected u As Integer
End Class")
End Function
<WorkItem(542098, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542098")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestMeConstructorInitializer() As Task
Await TestAsync(
"Class C
Sub New
Me.New([|1|])
End Sub
End Class",
"Class C
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
Sub New
Me.New(1)
End Sub
End Class")
End Function
<WorkItem(542098, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542098")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestExistingMeConstructorInitializer() As Task
Await TestMissingAsync(
"Class C
Private v As Integer
Sub New
Me.[|New|](1)
End Sub
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class")
End Function
<WorkItem(542098, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542098")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestMyBaseConstructorInitializer() As Task
Await TestAsync(
"Class C
Sub New
MyClass.New([|1|])
End Sub
End Class",
"Class C
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
Sub New
MyClass.New(1)
End Sub
End Class")
End Function
<WorkItem(542098, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542098")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestExistingMyBaseConstructorInitializer() As Task
Await TestMissingAsync(
"Class C
Private v As Integer
Sub New
MyClass.[|New|](1)
End Sub
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class")
End Function
<WorkItem(542098, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542098")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestMyClassConstructorInitializer() As Task
Await TestAsync(
"Class C
Inherits B
Sub New
MyBase.New([|1|])
End Sub
End Class
Class B
End Class",
"Class C
Inherits B
Sub New
MyBase.New(1)
End Sub
End Class
Class B
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class")
End Function
<WorkItem(542098, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542098")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestExistingMyClassConstructorInitializer() As Task
Await TestMissingAsync(
"Class C
Inherits B
Sub New
MyBase.New([|1|])
End Sub
End Class
Class B
Protected Sub New(v As Integer)
End Sub
End Class")
End Function
<WorkItem(542056, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542056")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestConflictingFieldNameInSubclass() As Task
Await TestAsync(
"Class A
Sub Test()
Dim t As New C([|u|]:=5)
End Sub
End Class
Class C
Inherits B
Private x As String
End Class
Class B
Protected u As String
End Class",
"Class A
Sub Test()
Dim t As New C(u:=5)
End Sub
End Class
Class C
Inherits B
Private u1 As Integer
Private x As String
Public Sub New(u As Integer)
u1 = u
End Sub
End Class
Class B
Protected u As String
End Class")
End Function
<WorkItem(542442, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542442")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestNothingArgument() As Task
Await TestMissingAsync(
"Class C1
Public Sub New(ByVal accountKey As Integer)
Me.new()
Me.[|new|](accountKey, Nothing)
End Sub
Public Sub New(ByVal accountKey As Integer, ByVal accountName As String)
Me.New(accountKey, accountName, Nothing)
End Sub
Public Sub New(ByVal accountKey As Integer, ByVal accountName As String, ByVal accountNumber As String)
End Sub
End Class")
End Function
<WorkItem(540641, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540641")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestMissingOnExistingConstructor() As Task
Await TestMissingAsync(
"Module Program
Sub M()
Dim x As C = New [|C|](P)
End Sub
End Module
Class C
Private v As Object
Public Sub New(v As Object)
Me.v = v
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerationIntoVisibleType() As Task
Await TestAsync(
"#ExternalSource (""Default.aspx"", 1)
Class C
Sub Foo()
Dim x As New D([|5|])
End Sub
End Class
Class D
End Class
#End ExternalSource",
"#ExternalSource (""Default.aspx"", 1)
Class C
Sub Foo()
Dim x As New D(5)
End Sub
End Class
Class D
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class
#End ExternalSource")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestNoGenerationIntoEntirelyHiddenType() As Task
Await TestMissingAsync(
<Text>#ExternalSource (""Default.aspx"", 1)
Class C
Sub Foo()
Dim x As New D([|5|])
End Sub
End Class
#End ExternalSource
Class D
End Class
</Text>.Value)
End Function
<WorkItem(546030, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546030")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestConflictingDelegatedParameterNameAndNamedArgumentName1() As Task
Await TestAsync(
"Module Program
Sub Main(args As String())
Dim objc As New C(1, [|prop|]:=""Property"")
End Sub
End Module
Class C
Private prop As String
Public Sub New(prop As String)
Me.prop = prop
End Sub
End Class",
"Module Program
Sub Main(args As String())
Dim objc As New C(1, prop:=""Property"")
End Sub
End Module
Class C
Private prop As String
Private v As Integer
Public Sub New(prop As String)
Me.prop = prop
End Sub
Public Sub New(v As Integer, prop As String)
Me.v = v
Me.prop = prop
End Sub
End Class")
End Function
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestFormattingInGenerateConstructor() As Task
Await TestAsync(
<Text>Class C
Sub New()
MyClass.New([|1|])
End Sub
End Class</Text>.Value.Replace(vbLf, vbCrLf),
<Text>Class C
Private v As Integer
Sub New()
MyClass.New(1)
End Sub
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class</Text>.Value.Replace(vbLf, vbCrLf),
compareTokens:=False)
End Function
<WorkItem(530003, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530003")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestAttributesWithArgument() As Task
Await TestAsync(
"<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
End Class
[|<MyAttribute(123)>|]
Public Class D
End Class",
"<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class
<MyAttribute(123)>
Public Class D
End Class")
End Function
<WorkItem(530003, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530003")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestAttributesWithMultipleArguments() As Task
Await TestAsync(
"<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
End Class
[|<MyAttribute(true, 1, ""hello"")>|]
Public Class D
End Class",
"<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
Private v1 As Boolean
Private v2 As Integer
Private v3 As String
Public Sub New(v1 As Boolean, v2 As Integer, v3 As String)
Me.v1 = v1
Me.v2 = v2
Me.v3 = v3
End Sub
End Class
<MyAttribute(true, 1, ""hello"")>
Public Class D
End Class")
End Function
<WorkItem(530003, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530003")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestAttributesWithNamedArguments() As Task
Await TestAsync(
"<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
End Class
[|<MyAttribute(true, 1, Topic:=""hello"")>|]
Public Class D
End Class",
"<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
Private Topic As String
Private v1 As Boolean
Private v2 As Integer
Public Sub New(v1 As Boolean, v2 As Integer, Topic As String)
Me.v1 = v1
Me.v2 = v2
Me.Topic = Topic
End Sub
End Class
<MyAttribute(true, 1, Topic:=""hello"")>
Public Class D
End Class")
End Function
<WorkItem(530003, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530003")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestAttributesWithAdditionalConstructors() As Task
Await TestAsync(
"<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class
[|<MyAttribute(True, 2)>|]
Public Class D
End Class",
"<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
Private v As Integer
Private v1 As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
Public Sub New(v As Integer, v1 As Integer)
Me.New(v)
Me.v1 = v1
End Sub
End Class
<MyAttribute(True, 2)>
Public Class D
End Class")
End Function
<WorkItem(530003, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530003")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestAttributesWithAllValidArguments() As Task
Await TestAsync(
"Enum A
A1
End Enum
<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
End Class
[|<MyAttribute(New Short(1) {1, 2, 3}, A.A1, True, 1, ""Z""c, 5S, 1I, 5L, 6.0R, 2.1F, ""abc"")>|]
Public Class D End Class",
"Enum A
A1
End Enum
<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
Private a1 As A
Private v1 As Short()
Private v10 As String
Private v2 As Boolean
Private v3 As Integer
Private v4 As Char
Private v5 As Short
Private v6 As Integer
Private v7 As Long
Private v8 As Double
Private v9 As Single
Public Sub New(v1() As Short, a1 As A, v2 As Boolean, v3 As Integer, v4 As Char, v5 As Short, v6 As Integer, v7 As Long, v8 As Double, v9 As Single, v10 As String)
Me.v1 = v1
Me.a1 = a1
Me.v2 = v2
Me.v3 = v3
Me.v4 = v4
Me.v5 = v5
Me.v6 = v6
Me.v7 = v7
Me.v8 = v8
Me.v9 = v9
Me.v10 = v10
End Sub
End Class
<MyAttribute(New Short(1) {1, 2, 3}, A.A1, True, 1, ""Z""c, 5S, 1I, 5L, 6.0R, 2.1F, ""abc"")>
Public Class D
End Class")
End Function
<WorkItem(530003, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530003")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestAttributesWithLambda() As Task
Await TestMissingAsync(
"<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute End Class
[|<MyAttribute(Function(x) x + 1)>|]
Public Class D
End Class")
End Function
<WorkItem(889349, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/889349")>
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestConstructorGenerationForDifferentNamedParameter() As Task
Await TestAsync(
<Text>Class Program
Sub Main(args As String())
Dim a = New Program([|y:=4|])
End Sub
Sub New(x As Integer)
End Sub
End Class</Text>.Value.Replace(vbLf, vbCrLf),
<Text>Class Program
Private y As Integer
Sub Main(args As String())
Dim a = New Program(y:=4)
End Sub
Sub New(x As Integer)
End Sub
Public Sub New(y As Integer)
Me.y = y
End Sub
End Class</Text>.Value.Replace(vbLf, vbCrLf),
compareTokens:=False)
End Function
<WorkItem(897355, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/897355")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestOptionStrictOn() As Task
Await TestAsync(
"Option Strict On
Module Module1
Sub Main()
Dim int As Integer = 3
Dim obj As Object = New Object()
Dim c1 As Classic = New Classic(int)
Dim c2 As Classic = [|New Classic(obj)|]
End Sub
Class Classic
Private int As Integer
Public Sub New(int As Integer)
Me.int = int
End Sub
End Class
End Module",
"Option Strict On
Module Module1
Sub Main()
Dim int As Integer = 3
Dim obj As Object = New Object()
Dim c1 As Classic = New Classic(int)
Dim c2 As Classic = New Classic(obj)
End Sub
Class Classic
Private int As Integer
Private obj As Object
Public Sub New(obj As Object)
Me.obj = obj
End Sub
Public Sub New(int As Integer)
Me.int = int
End Sub
End Class
End Module")
End Function
<WorkItem(528257, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528257")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateInInaccessibleType() As Task
Await TestAsync(
"Class Foo
Private Class Bar
End Class
End Class
Class A
Sub Main()
Dim s = New [|Foo.Bar(5)|]
End Sub
End Class",
"Class Foo
Private Class Bar
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class
End Class
Class A
Sub Main()
Dim s = New Foo.Bar(5)
End Sub
End Class")
End Function
Public Class GenerateConstructorTestsWithFindMissingIdentifiersAnalyzer
Inherits AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest
Friend Overrides Function CreateDiagnosticProviderAndFixer(workspace As Workspace) As Tuple(Of DiagnosticAnalyzer, CodeFixProvider)
Return New Tuple(Of DiagnosticAnalyzer, CodeFixProvider)(New VisualBasicUnboundIdentifiersDiagnosticAnalyzer(), New GenerateConstructorCodeFixProvider())
End Function
<WorkItem(1241, "https://github.com/dotnet/roslyn/issues/1241")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateConstructorInIncompleteLambda() As Task
Await TestAsync(
"Imports System.Linq
Class C
Sub New()
Dim s As Action = Sub()
Dim a = New [|C|](0)",
"Imports System.Linq
Class C
Private v As Integer
Sub New()
Dim s As Action = Sub()
Dim a = New C(0)Public Sub New(v As Integer)
Me.v = v
End Sub
End Class")
End Function
<WorkItem(5920, "https://github.com/dotnet/roslyn/issues/5920")>
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateConstructorInIncompleteLambda2() As Task
Await TestAsync(
"Imports System.Linq
Class C
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
Sub New()
Dim s As Action = Sub()
Dim a = New [|C|](0, 0)",
"Imports System.Linq
Class C
Private v As Integer
Private v1 As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
Sub New()
Dim s As Action = Sub()
Dim a = New C(0, 0)
Public Sub New(v As Integer, v1 As Integer)
Me.New(v)
Me.v1 = v1
End Sub
End Class")
End Function
End Class
<WorkItem(6541, "https://github.com/dotnet/Roslyn/issues/6541")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateInDerivedType1() As Task
Await TestAsync(
"
Public Class Base
Public Sub New(a As String)
End Sub
End Class
Public Class [||]Derived
Inherits Base
End Class",
"
Public Class Base
Public Sub New(a As String)
End Sub
End Class
Public Class Derived
Inherits Base
Public Sub New(a As String)
MyBase.New(a)
End Sub
End Class")
End Function
<WorkItem(6541, "https://github.com/dotnet/Roslyn/issues/6541")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateInDerivedType2() As Task
Await TestAsync(
"
Public Class Base
Public Sub New(a As Integer, Optional b As String = Nothing)
End Sub
End Class
Public Class [||]Derived
Inherits Base
End Class",
"
Public Class Base
Public Sub New(a As Integer, Optional b As String = Nothing)
End Sub
End Class
Public Class Derived
Inherits Base
Public Sub New(a As Integer, Optional b As String = Nothing)
MyBase.New(a, b)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateInDerivedType_InvalidClassStatement() As Task
Await TestAsync(
"
Public Class Base
Public Sub New(a As Integer, Optional b As String = Nothing)
End Sub
End Class
Public Class [|;;|]Derived
Inherits Base
End Class",
"
Public Class Base
Public Sub New(a As Integer, Optional b As String = Nothing)
End Sub
End Class
Public Class ;;Derived
Inherits Base
Public Sub New(a As Integer, Optional b As String = Nothing)
MyBase.New(a, b)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateConstructorNotOfferedForDuplicate() As Task
Await TestMissingAsync(
"Imports System
Class X
Private v As String
Public Sub New(v As String)
Me.v = v
End Sub
Sub Test()
Dim x As X = New X(New [|String|]())
End Sub
End Class")
End Function
<WorkItem(9575, "https://github.com/dotnet/roslyn/issues/9575")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestMissingOnMethodCall() As Task
Await TestMissingAsync(
"class C
public sub new(int arg)
end sub
public function M(s as string, i as integer, b as boolean) as boolean
return [|M|](i, b)
end function
end class")
End Function
<WorkItem(13749, "https://github.com/dotnet/roslyn/issues/13749")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function Support_Readonly_Properties() As Task
Await TestAsync(
"Class C
ReadOnly Property Prop As Integer
End Class
Module P
Sub M()
Dim prop = 42
Dim c = New C([|prop|])
End Sub
End Module",
"Class C
Public Sub New(prop As Integer)
Me.Prop = prop
End Sub
ReadOnly Property Prop As Integer
End Class
Module P
Sub M()
Dim prop = 42
Dim c = New C(prop)
End Sub
End Module")
End Function
End Class
End Namespace
|
KevinH-MS/roslyn
|
src/EditorFeatures/VisualBasicTest/Diagnostics/GenerateConstructor/GenerateConstructorTests.vb
|
Visual Basic
|
apache-2.0
| 43,501
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols.Metadata.PE
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports System.Xml.Linq
Imports System.Text
Imports System.IO
Imports Roslyn.Test.Utilities
Imports Microsoft.CodeAnalysis.VisualBasic.VisualBasicCompilation
Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests
Public Class DocCommentTests
Inherits BasicTestBase
Private Shared ReadOnly s_optionsDiagnoseDocComments As VisualBasicParseOptions = VisualBasicParseOptions.Default.WithDocumentationMode(DocumentationMode.Diagnose)
<Fact>
Public Sub DocCommentWriteException()
Dim sources =
<compilation name="DocCommentException">
<file name="a.vb">
<![CDATA[
''' <summary>
''' Doc comment for <see href="C" />
''' </summary>
Public Class C
''' <summary>
''' Doc comment for method M
''' </summary>
Public Sub M()
End Sub
End Class
]]>
</file>
</compilation>
Using (new EnsureEnglishUICulture())
Dim comp = CreateCompilationWithMscorlib40(sources)
Dim diags = New DiagnosticBag()
Dim badStream = New BrokenStream()
badStream.BreakHow = BrokenStream.BreakHowType.ThrowOnWrite
DocumentationCommentCompiler.WriteDocumentationCommentXml(
comp,
assemblyName:=Nothing,
xmlDocStream:=badStream,
diagnostics:=diags,
cancellationToken:=Nothing)
AssertTheseDiagnostics(diags.ToReadOnlyAndFree(),
<errors><![CDATA[
BC37258: Error writing to XML documentation file: I/O error occurred.
]]></errors>)
End Using
End Sub
<Fact>
Public Sub NoXmlResolver()
Dim sources =
<compilation name="DocumentationMode">
<file name="a.vb">
<![CDATA[
''' <summary> <include file='abc' path='def' /> </summary>
Class C
End Class
]]>
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(
sources,
options:=TestOptions.ReleaseDll.WithXmlReferenceResolver(Nothing),
parseOptions:=TestOptions.Regular.WithDocumentationMode(DocumentationMode.Parse))
compilation.VerifyDiagnostics()
CheckXmlDocument(compilation, expectedDocXml:=
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
DocumentationMode
</name>
</assembly>
<members>
<member name="T:C">
<summary> <!--warning BC42321: Unable to include XML fragment 'def' of file 'abc'. References to XML documents are not supported.--> </summary>
</member>
</members>
</doc>
]]>
</xml>, ensureEnglishUICulture:=True)
End Sub
<Fact>
Public Sub DocumentationMode_None()
Dim sources =
<compilation name="DocumentationMode">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary> </summary
Module Module0
End Module
]]>
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime(
sources, parseOptions:=(New VisualBasicParseOptions()).WithDocumentationMode(DocumentationMode.None))
Dim tree = compilation.SyntaxTrees(0)
Dim moduleStatement = tree.FindNodeOrTokenByKind(SyntaxKind.ModuleStatement)
Assert.True(moduleStatement.IsNode)
Dim node = moduleStatement.AsNode()
Dim trivia = node.GetLeadingTrivia().ToArray()
Assert.True(trivia.Any(Function(x) x.Kind = SyntaxKind.CommentTrivia))
Assert.False(trivia.Any(Function(x) x.Kind = SyntaxKind.DocumentationCommentTrivia))
CompilationUtils.AssertTheseDiagnostics(compilation.GetSemanticModel(tree).GetDiagnostics(), <errors></errors>)
End Sub
<Fact>
Public Sub DocumentationMode_Parse()
Dim sources =
<compilation name="DocumentationMode">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary> </summary
Module Module0
End Module
]]>
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime(
sources, parseOptions:=(New VisualBasicParseOptions()).WithDocumentationMode(DocumentationMode.Parse))
Dim tree = compilation.SyntaxTrees(0)
Dim moduleStatement = tree.FindNodeOrTokenByKind(SyntaxKind.ModuleStatement)
Assert.True(moduleStatement.IsNode)
Dim node = moduleStatement.AsNode()
Dim trivia = node.GetLeadingTrivia().ToArray()
Assert.False(trivia.Any(Function(x) x.Kind = SyntaxKind.CommentTrivia))
Assert.True(trivia.Any(Function(x) x.Kind = SyntaxKind.DocumentationCommentTrivia))
CompilationUtils.AssertTheseDiagnostics(compilation.GetSemanticModel(tree).GetDiagnostics(), <errors></errors>)
End Sub
<Fact>
Public Sub DocumentationMode_ParseAndDiagnose()
Dim sources =
<compilation name="DocumentationMode">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary> </summary
Module Module0
End Module
]]>
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime(
sources, parseOptions:=s_optionsDiagnoseDocComments)
Dim tree = compilation.SyntaxTrees(0)
Dim moduleStatement = tree.FindNodeOrTokenByKind(SyntaxKind.ModuleStatement)
Assert.True(moduleStatement.IsNode)
Dim node = moduleStatement.AsNode()
Dim trivia = node.GetLeadingTrivia().ToArray()
Assert.False(trivia.Any(Function(x) x.Kind = SyntaxKind.CommentTrivia))
Assert.True(trivia.Any(Function(x) x.Kind = SyntaxKind.DocumentationCommentTrivia))
CompilationUtils.AssertTheseDiagnostics(compilation.GetSemanticModel(tree).GetDiagnostics(),
<errors>
<![CDATA[
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
''' <summary> </summary
~
]]>
</errors>)
End Sub
<Fact>
Public Sub DocCommentOnUnsupportedSymbol()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
Class E
ReadOnly Property quoteForTheDay() As String
''' <summary></summary>
Get
Return "hello"
End Get
End Property
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42312: XML documentation comments must precede member or type declarations.
''' <summary></summary>
~~~~~~~~~~~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
</members>
</doc>
]]>
</xml>)
End Sub
<WorkItem(720931, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/720931")>
<Fact>
Public Sub Bug720931()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
''' <see cref="Integer"/>
''' <see cref="UShort"/>
''' <see cref="Object"/>
''' <see cref="Date"/>
Public Class CLAZZ
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="T:CLAZZ">
<see cref="T:System.Int32"/>
<see cref="T:System.UInt16"/>
<see cref="T:System.Object"/>
<see cref="T:System.DateTime"/>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<WorkItem(705788, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/705788")>
<Fact>
Public Sub Bug705788()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="Bug705788">
<file name="a.vb">
<![CDATA[
Imports System
''' <c name="Scenario1"/>
''' <code name="Scenario1"/>
''' <example name="Scenario1"/>
''' <list name="Scenario1"/>
''' <paramref name="Scenario1"/>
''' <remarks name="Scenario1"/>
''' <summary name="Scenario1"/>
Module Scenario1
''' <para name="Scenario2"/>
''' <paramref name="Scenario2"/>
''' <permission cref="Scenario2" name="Scenario2"/>
''' <see cref="Scenario2" name="Scenario2"/>
''' <seealso cref="Scenario2" name="Scenario2"/>
Class Scenario2
End Class
Sub Main()
End Sub
End Module
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42306: XML comment tag 'paramref' is not permitted on a 'module' language element.
''' <paramref name="Scenario1"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'paramref' is not permitted on a 'class' language element.
''' <paramref name="Scenario2"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
Bug705788
</name>
</assembly>
<members>
<member name="T:Scenario1">
<c name="Scenario1"/>
<code name="Scenario1"/>
<example name="Scenario1"/>
<list name="Scenario1"/>
<paramref name="Scenario1"/>
<remarks name="Scenario1"/>
<summary name="Scenario1"/>
</member>
<member name="T:Scenario1.Scenario2">
<para name="Scenario2"/>
<paramref name="Scenario2"/>
<permission cref="T:Scenario1.Scenario2" name="Scenario2"/>
<see cref="T:Scenario1.Scenario2" name="Scenario2"/>
<seealso cref="T:Scenario1.Scenario2" name="Scenario2"/>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<WorkItem(658453, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/658453")>
<Fact>
Public Sub Bug658453()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
Namespace Microsoft.VisualBasic
''' <summary>
''' Provides core iterator implementation.
''' </summary>
''' <typeparam name="TState">Type of iterator state data.</typeparam>
''' <typeparam name="TItem">Type of items returned from the iterator.</typeparam>
''' <param name="state">Iteration data.</param>
''' <param name="item">Element produced at this step.</param>
''' <returns>Whether the step was successful.</returns>
Friend Delegate Function IteratorStep(Of TState, TItem)(
ByRef state As TState,
ByRef item As TItem) As Boolean
End Namespace
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="T:Microsoft.VisualBasic.IteratorStep`2">
<summary>
Provides core iterator implementation.
</summary>
<typeparam name="TState">Type of iterator state data.</typeparam>
<typeparam name="TItem">Type of items returned from the iterator.</typeparam>
<param name="state">Iteration data.</param>
<param name="item">Element produced at this step.</param>
<returns>Whether the step was successful.</returns>
</member>
</members>
</doc>
]]>
</xml>)
Dim tree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "TState").ToArray()
Assert.Equal(2, names.Length)
CheckSymbolInfoAndTypeInfo(model, names(0), "TState")
End Sub
<WorkItem(762687, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/762687")>
<Fact>
Public Sub Bug762687a()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="Bug762687">
<file name="a.vb">
<![CDATA[
Imports System
Class B
Public Property System As Object
End Class
Class D
Inherits B
''' <see cref="System.Console"/>
Public X As Integer
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
Bug762687
</name>
</assembly>
<members>
<member name="F:D.X">
<see cref="T:System.Console"/>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<WorkItem(762687, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/762687")>
<Fact>
Public Sub Bug762687b()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="Bug762687">
<file name="a.vb">
<![CDATA[
Imports System
Class B
Public Property System As Object
End Class
Class D
Inherits B
''' <see cref="System.Console.WriteLine()"/>
Public X As Integer
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
Bug762687
</name>
</assembly>
<members>
<member name="F:D.X">
<see cref="M:System.Console.WriteLine"/>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<WorkItem(664943, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/664943")>
<Fact>
Public Sub Bug664943()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary></summary>
'''
Class E
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="T:E">
<summary></summary>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<WorkItem(679833, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/679833")>
<Fact>
Public Sub Bug679833_DontCrash()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Public
Sub New()
d Sub
Public ''' As String
'''
summary>
End Enum
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC30203: Identifier expected.
Public
~
BC30026: 'End Sub' expected.
Sub New()
~~~~~~~~~
BC30451: 'd' is not declared. It may be inaccessible due to its protection level.
d Sub
~
BC36673: Multiline lambda expression is missing 'End Sub'.
d Sub
~~~
BC30800: Method arguments must be enclosed in parentheses.
d Sub
~~~~
BC30198: ')' expected.
d Sub
~
BC30199: '(' expected.
d Sub
~
BC30203: Identifier expected.
Public ''' As String
~
BC42302: XML comment must be the first statement on a line. XML comment will be ignored.
Public ''' As String
~~~~~~~~~~~~~
BC42303: XML comment cannot appear within a method or a property. XML comment will be ignored.
'''
~
BC30201: Expression expected.
summary>
~
BC30800: Method arguments must be enclosed in parentheses.
summary>
~
BC30201: Expression expected.
summary>
~
BC30184: 'End Enum' must be preceded by a matching 'Enum'.
End Enum
~~~~~~~~
]]>
</error>)
End Sub
<WorkItem(665883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/665883")>
<Fact>
Public Sub Bug665883()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
''' <see cref="Console.WriteLine"/>
Module M
End Module
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="T:M">
<see cref="M:System.Console.WriteLine"/>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<WorkItem(666241, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/666241")>
<Fact>
Public Sub Bug666241()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
Namespace System.Drawing
''' <summary>
''' Opt-In flag to look for resources in the another assembly
''' with the "bitmapSuffix" config setting
''' </summary>
<AttributeUsage(AttributeTargets.Assembly)>
Friend Class BitmapSuffixInSatelliteAssemblyAttribute
Inherits Attribute
End Class
End Namespace
]]>
</file>
<file name="b.vb">
<![CDATA[
Imports System.Diagnostics.CodeAnalysis
Namespace Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6
Public Module SystemColorConstants
''' <include file='doc\Constants.uex' path='docs/doc[@for="SystemColorConstants.vbScrollBars"]/*' />
<SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")> _
<SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")> _
Public Const vbScrollBars As Integer = &H80000000
End Module
End Namespace
]]>
</file>
</compilation>,
<error></error>)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
CompilationUtils.AssertTheseDiagnostics(model.GetDiagnostics(), <error></error>)
model = compilation.GetSemanticModel(compilation.SyntaxTrees(1))
CompilationUtils.AssertTheseDiagnostics(model.GetDiagnostics(), <error></error>)
End Sub
<WorkItem(658793, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/658793")>
<Fact>
Public Sub Bug658793()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary cref="(" />
'''
Class E
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute '(' that could not be resolved.
''' <summary cref="(" />
~~~~~~~~
]]>
</error>)
End Sub
<WorkItem(721582, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/721582")>
<Fact>
Public Sub Bug721582()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
''' <see cref="object"/>
''' <see cref="object.tostring"/>
''' <see cref="system.object"/>
''' <see cref="system.object.tostring"/>
''' <see cref="object.tostring()"/>
''' <see cref="system.object.tostring()"/>
Class E
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="T:E">
<see cref="T:System.Object"/>
<see cref="T:System.Object"/>
<see cref="T:System.Object"/>
<see cref="M:System.Object.ToString"/>
<see cref="T:System.Object"/>
<see cref="M:System.Object.ToString"/>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<WorkItem(657426, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/657426")>
<Fact>
Public Sub Bug657426()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary>
''' <see
''' cref="Int32"/>
''' </summary>
Class E
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="T:E">
<summary>
<see
cref="T:System.Int32"/>
</summary>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<WorkItem(658322, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/658322")>
<Fact>
Public Sub Bug658322a()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
Class E
''' <param name="next">The next binder.</param>
Public Sub New([next] As Integer)
End Sub
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="M:E.#ctor(System.Int32)">
<param name="next">The next binder.</param>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<WorkItem(658322, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/658322")>
<Fact>
Public Sub Bug658322b()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
Namespace Roslyn.Compilers.VisualBasic
Partial Class BoundAddressOfOperator
''' <returns>The <see cref="Binder.DelegateResolutionResult">Binder.DelegateResolutionResult</see> for the conversion </returns>
Friend Function GetDelegateResolutionResult(ByRef delegateResolutionResult As Binder.DelegateResolutionResult) As Boolean
Return Nothing
End Function
Public Property Binder As Binder
End Class
End Namespace
]]>
</file>
<file name="b.vb">
<![CDATA[
Imports System
Namespace Roslyn.Compilers.VisualBasic
Partial Friend Class Binder
Friend Structure DelegateResolutionResult
End Structure
End Class
End Namespace
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="M:Roslyn.Compilers.VisualBasic.BoundAddressOfOperator.GetDelegateResolutionResult(Roslyn.Compilers.VisualBasic.Binder.DelegateResolutionResult@)">
<returns>The <see cref="T:Roslyn.Compilers.VisualBasic.Binder.DelegateResolutionResult">Binder.DelegateResolutionResult</see> for the conversion </returns>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<WorkItem(658322, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/658322")>
<Fact>
Public Sub Bug658322c()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
Namespace Roslyn.Compilers.VisualBasic
Partial Class BoundAddressOfOperator
''' <returns>The <see cref="Binder.DelegateResolutionResult">Binder.DelegateResolutionResult</see> for the conversion </returns>
Friend Function GetDelegateResolutionResult(ByRef delegateResolutionResult As Binder.DelegateResolutionResult) As Boolean
Return Nothing
End Function
Public Binder As Binder
End Class
End Namespace
]]>
</file>
<file name="b.vb">
<![CDATA[
Imports System
Namespace Roslyn.Compilers.VisualBasic
Partial Friend Class Binder
Friend Structure DelegateResolutionResult
End Structure
End Class
End Namespace
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="M:Roslyn.Compilers.VisualBasic.BoundAddressOfOperator.GetDelegateResolutionResult(Roslyn.Compilers.VisualBasic.Binder.DelegateResolutionResult@)">
<returns>The <see cref="T:Roslyn.Compilers.VisualBasic.Binder.DelegateResolutionResult">Binder.DelegateResolutionResult</see> for the conversion </returns>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<WorkItem(658322, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/658322")>
<Fact>
Public Sub Bug658322d()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
Namespace Roslyn.Compilers.VisualBasic
Partial Class BoundAddressOfOperator
''' <returns>The <see cref="Binder.DelegateResolutionResult">Binder.DelegateResolutionResult</see> for the conversion </returns>
Friend Function GetDelegateResolutionResult(ByRef delegateResolutionResult As Binder.DelegateResolutionResult) As Boolean
Return Nothing
End Function
Public Function Binder() As Binder
Return Nothing
End Function
End Class
End Namespace
]]>
</file>
<file name="b.vb">
<![CDATA[
Imports System
Namespace Roslyn.Compilers.VisualBasic
Partial Friend Class Binder
Friend Structure DelegateResolutionResult
End Structure
End Class
End Namespace
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="M:Roslyn.Compilers.VisualBasic.BoundAddressOfOperator.GetDelegateResolutionResult(Roslyn.Compilers.VisualBasic.Binder.DelegateResolutionResult@)">
<returns>The <see cref="T:Roslyn.Compilers.VisualBasic.Binder.DelegateResolutionResult">Binder.DelegateResolutionResult</see> for the conversion </returns>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<WorkItem(658322, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/658322")>
<Fact()>
Public Sub Bug658322e()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Option Explicit On
Imports System
Public Class TAttribute : Inherits Attribute
End Class
''' <remarks cref="TAttribute">Clazz</remarks>
<TAttribute>
Public Class Clazz
''' <remarks cref="TAttribute">Clazz</remarks>
<TAttribute>
Public d As Integer
End Class
''' <remarks cref="TAttribute">Clazz</remarks>
<TAttribute>
Public Enum E1
''' <remarks cref="TAttribute">Clazz</remarks>
<TAttribute> Any
End Enum
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Clazz">
<remarks cref="T:TAttribute">Clazz</remarks>
</member>
<member name="F:Clazz.d">
<remarks cref="T:TAttribute">Clazz</remarks>
</member>
<member name="T:E1">
<remarks cref="T:TAttribute">Clazz</remarks>
</member>
<member name="F:E1.Any">
<remarks cref="T:TAttribute">Clazz</remarks>
</member>
</members>
</doc>
]]>
</xml>)
Dim tree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "TAttribute").ToArray()
Assert.Equal(8, names.Length)
CheckSymbolInfoAndTypeInfo(model, names(0), "TAttribute")
CheckSymbolInfoAndTypeInfo(model, names(2), "TAttribute")
CheckSymbolInfoAndTypeInfo(model, names(4), "TAttribute")
CheckSymbolInfoAndTypeInfo(model, names(6), "TAttribute")
End Sub
<WorkItem(665961, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/665961")>
<Fact()>
Public Sub Bug665961()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Module M
Sub Main()
''' <see cref="x"/>
Dim x
End Sub
End Module
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42303: XML comment cannot appear within a method or a property. XML comment will be ignored.
''' <see cref="x"/>
~~~~~~~~~~~~~~~~~
BC42024: Unused local variable: 'x'.
Dim x
~
]]>
</error>)
Dim tree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "x").ToArray()
Assert.Equal(1, names.Length)
CheckSymbolInfoAndTypeInfo(model, names(0))
Assert.Equal("Public Sub Main()", TryCast(model, SemanticModel).GetEnclosingSymbol(names(0).SpanStart).ToDisplayString())
End Sub
<WorkItem(685473, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/685473")>
<ConditionalFact(GetType(WindowsDesktopOnly), Reason:=ConditionalSkipReason.TestExecutionNeedsDesktopTypes)>
Public Sub Bug685473()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System.CodeDom
Namespace ABCD.PRODUCT.Current.SDK.Legacy.PackageGenerator
'''------------</------------------------------------------------
''' Project : ABCD.PRODUCT.Current.SDK.Legacy
''' Class : ProvideAutomationObject
'''
'''------------------------------------------------
''' <summary>
''' This class models the ProvideAutomationObject attribute
''' in Project : ABCD.PRODUCT.Current.SDK.Legacyry>
''' [user] 11/17/2004 Created
''' </history>
'''-------If---------------------------------------
P
lic Class ProvideAutomationObject : Inherits VsipCodeAttributeGenerator
Public ObjectName As String = Nothing
Public Description As String = Nothing
'''------------------------------------------------
''' <summary>
''' Generates the code for this element
''' </summary>
''' <returns>A string representing the code</returns>
'''------------------------------------------------
Public Overrides Function Generate() As String
ObjectNametr As New CodeAttributeDeclaration(Me.GetAttributeName())
attr.Arguments.Add(New CodeAttributeArgument(New CodePrimitiveExpressi=n(ObjectName)))
If Not Description = Nothing
hen
attr.Arguments.Add(New C------------------------------------------------itiveExpression(Description)))
End If
Return PackageCodeGenerator.GetAttributeCode(attr)
End Functio
End Class
End Namespace
]]>
</file>
</compilation>,
<error>
<![CDATA[BC42312: XML documentation comments must precede member or type declarations.
'''------------</------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42304: XML documentation parse error: XML end element must be preceded by a matching start element. XML comment will be ignored.
'''------------</------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42304: XML documentation parse error: Character '-' (&H2D) is not allowed at the beginning of an XML name. XML comment will be ignored.
'''------------</------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
'''------------</------------------------------------------------
~
BC42304: XML documentation parse error: Syntax error. XML comment will be ignored.
''' Project : ABCD.PRODUCT.Current.SDK.Legacy
~~~~~~~
BC42304: XML documentation parse error: Element is missing an end tag. XML comment will be ignored.
''' <summary>
~~~~~~~~~
BC42304: XML documentation parse error: End tag </summary> expected. XML comment will be ignored.
''' </history>
~~~~~~~~~~
BC30188: Declaration expected.
lic Class ProvideAutomationObject : Inherits VsipCodeAttributeGenerator
~~~
BC30002: Type 'VsipCodeAttributeGenerator' is not defined.
lic Class ProvideAutomationObject : Inherits VsipCodeAttributeGenerator
~~~~~~~~~~~~~~~~~~~~~~~~~~
BC30027: 'End Function' expected.
Public Overrides Function Generate() As String
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC30284: function 'Generate' cannot be declared 'Overrides' because it does not override a function in a base class.
Public Overrides Function Generate() As String
~~~~~~~~
BC30451: 'ObjectNametr' is not declared. It may be inaccessible due to its protection level.
ObjectNametr As New CodeAttributeDeclaration(Me.GetAttributeName())
~~~~~~~~~~~~
BC30201: Expression expected.
ObjectNametr As New CodeAttributeDeclaration(Me.GetAttributeName())
~
BC30800: Method arguments must be enclosed in parentheses.
ObjectNametr As New CodeAttributeDeclaration(Me.GetAttributeName())
~
BC30451: 'attr' is not declared. It may be inaccessible due to its protection level.
attr.Arguments.Add(New CodeAttributeArgument(New CodePrimitiveExpressi=n(ObjectName)))
~~~~
BC30002: Type 'CodePrimitiveExpressi' is not defined.
attr.Arguments.Add(New CodeAttributeArgument(New CodePrimitiveExpressi=n(ObjectName)))
~~~~~~~~~~~~~~~~~~~~~
BC30451: 'n' is not declared. It may be inaccessible due to its protection level.
attr.Arguments.Add(New CodeAttributeArgument(New CodePrimitiveExpressi=n(ObjectName)))
~
BC30451: 'hen' is not declared. It may be inaccessible due to its protection level.
hen
~~~
BC30451: 'attr' is not declared. It may be inaccessible due to its protection level.
attr.Arguments.Add(New C------------------------------------------------itiveExpression(Description)))
~~~~
BC30002: Type 'C' is not defined.
attr.Arguments.Add(New C------------------------------------------------itiveExpression(Description)))
~
BC30451: 'itiveExpression' is not declared. It may be inaccessible due to its protection level.
attr.Arguments.Add(New C------------------------------------------------itiveExpression(Description)))
~~~~~~~~~~~~~~~
BC30205: End of statement expected.
attr.Arguments.Add(New C------------------------------------------------itiveExpression(Description)))
~
BC30451: 'PackageCodeGenerator' is not declared. It may be inaccessible due to its protection level.
Return PackageCodeGenerator.GetAttributeCode(attr)
~~~~~~~~~~~~~~~~~~~~
BC30451: 'attr' is not declared. It may be inaccessible due to its protection level.
Return PackageCodeGenerator.GetAttributeCode(attr)
~~~~
BC30615: 'End' statement cannot be used in class library projects.
End Functio
~~~
BC30678: 'End' statement not valid.
End Functio
~~~
]]>
</error>)
End Sub
<Fact>
Public Sub DocCommentOnUnsupportedSymbol_ParseOnly()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
Class E
ReadOnly Property quoteForTheDay() As String
''' <summary></summary>
Get
Return "hello"
End Get
End Property
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
</members>
</doc>
]]>
</xml>, withDiagnostics:=False)
End Sub
<Fact>
Public Sub EmptyCref()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary>
''' See <see cref=""/>.
''' </summary>
''' <remarks></remarks>
Module Module0
End Module
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute '' that could not be resolved.
''' See <see cref=""/>.
~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="T:Module0">
<summary>
See <see cref="!:"/>.
</summary>
<remarks></remarks>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub Cref_Error()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary>
''' See <see cref="Module0."/>.
''' See <see cref="Module0.
''' "/>.
''' See <see cref="Module0
''' "/>.
''' See <see cref="Module0.'
''' "/>.
''' See <see cref="Module0. _
''' "/>.
''' </summary>
''' <remarks></remarks>
Module Module0
End Module
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Module0.' that could not be resolved.
''' See <see cref="Module0."/>.
~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Module0.
'''' that could not be resolved.
''' See <see cref="Module0.
~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Module0.'' that could not be resolved.
''' See <see cref="Module0.'
~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Module0. _' that could not be resolved.
''' See <see cref="Module0. _
~~~~~~~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="T:Module0">
<summary>
See <see cref="!:Module0."/>.
See <see cref="!:Module0.
"/>.
See <see cref="T:Module0"/>.
See <see cref="!:Module0.'
"/>.
See <see cref="!:Module0. _
"/>.
</summary>
<remarks></remarks>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub Cref_Me_MyBase_MyClass()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
Public Class BaseClass
Public Overridable Sub S()
End Sub
End Class
Public Class DerivedClass : Inherits BaseClass
Public Overrides Sub S()
End Sub
''' <summary>
''' <see cref="Me.S"/>
''' <see cref="MyClass.S"/>
''' <see cref="MyBase.S"/>
''' </summary>
Public F As Integer
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Me.S' that could not be resolved.
''' <see cref="Me.S"/>
~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'MyClass.S' that could not be resolved.
''' <see cref="MyClass.S"/>
~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'MyBase.S' that could not be resolved.
''' <see cref="MyBase.S"/>
~~~~~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="F:DerivedClass.F">
<summary>
<see cref="!:Me.S"/>
<see cref="!:MyClass.S"/>
<see cref="!:MyBase.S"/>
</summary>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub Cref_Type_Namespace_Alias()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
Imports ABC = System.Collections.Generic
Imports ABCD = System.Collections.Generic.IList(Of Integer)
Public Class BaseClass
''' <summary>
''' <see cref="System.Collections.Generic"/>
''' <see cref="System.Collections.Generic.IList(Of Integer)"/>
''' <see cref="ABC"/>
''' <see cref="ABC.IList(Of Integer)"/>
''' <see cref="ABCD"/>
''' </summary>
Public F As Integer
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="F:BaseClass.F">
<summary>
<see cref="N:System.Collections.Generic"/>
<see cref="T:System.Collections.Generic.IList`1"/>
<see cref="N:System.Collections.Generic"/>
<see cref="T:System.Collections.Generic.IList`1"/>
<see cref="T:System.Collections.Generic.IList`1"/>
</summary>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub Name_Error()
' NOTE: the first error is a breaking change
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
''' <typeparam name="X
''' "/>
''' <typeparam name="X 'abc
''' "/>
Class Clazz(Of X)
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42317: XML comment type parameter 'X ' does not match a type parameter on the corresponding 'class' statement.
''' <typeparam name="X
~~~~~~~~
BC42317: XML comment type parameter 'X 'abc ' does not match a type parameter on the corresponding 'class' statement.
''' <typeparam name="X 'abc
~~~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="T:Clazz`1">
<typeparam name="X
"/>
<typeparam name="X 'abc
"/>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub Cref_Error_ParseOnly()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary>
''' See <see cref="Module0."/>.
''' See <see cref="Module0.
''' "/>.
''' See <see cref="Module0
''' "/>.
''' See <see cref="Module0.'
''' "/>.
''' See <see cref="Module0. _
''' "/>.
''' </summary>
''' <remarks></remarks>
Module Module0
End Module
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="T:Module0">
<summary>
See <see cref="!:Module0."/>.
See <see cref="!:Module0.
"/>.
See <see cref="T:Module0"/>.
See <see cref="!:Module0.'
"/>.
See <see cref="!:Module0. _
"/>.
</summary>
<remarks></remarks>
</member>
</members>
</doc>
]]>
</xml>, withDiagnostics:=False)
End Sub
<Fact>
Public Sub Name_Error_ParseOnly()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
''' <typeparam name="X
''' "/>
''' <typeparam name="X 'abc
''' "/>
Class Clazz(Of X)
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="T:Clazz`1">
<typeparam name="X
"/>
<typeparam name="X 'abc
"/>
</member>
</members>
</doc>
]]>
</xml>, withDiagnostics:=False)
End Sub
<Fact>
Public Sub DiagnosticsWithoutEmit()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="DiagnosticsWithoutEmit">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary>
''' See <see cref=""/>.
''' </summary>
''' <remarks></remarks>
Module Module0
End Module
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute '' that could not be resolved.
''' See <see cref=""/>.
~~~~~~~
]]>
</error>, Nothing)
End Sub
<Fact>
Public Sub GeneralDocCommentOnTypes()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="GeneralDocCommentOnTypes">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary>
''' Module M
''' commented
''' </summary>
Module Module0
End Module
''' <summary>
''' Enum
''' ---======7777777%%%
''' </summary>
Enum E123
E1
End Enum
''' <summary>
''' Structure
''' <a></a> iusgdfas
'''ciii######
''' </summary>
Structure STR
End Structure
''' <summary>
''' ------ Class --------
''' With nested structure
''' ---------------------
''' </summary>
Class Clazz
''' <summary>
''' NestedStr
''' sadjghfcasl
''' asdf
''' 21398470912
'''ciii######
''' </summary>
Public Structure NestedStr
End Structure
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
GeneralDocCommentOnTypes
</name>
</assembly>
<members>
<member name="T:Module0">
<summary>
Module M
commented
</summary>
</member>
<member name="T:E123">
<summary>
Enum
---======7777777%%%
</summary>
</member>
<member name="T:STR">
<summary>
Structure
<a></a> iusgdfas
ciii######
</summary>
</member>
<member name="T:Clazz">
<summary>
------ Class --------
With nested structure
---------------------
</summary>
</member>
<member name="T:Clazz.NestedStr">
<summary>
NestedStr
sadjghfcasl
asdf
21398470912
ciii######
</summary>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub MultipartDocCommentOnTypes()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary>
''' Class Part #1
''' -=-=-=-=-=-=- <aaa> ' Error -- unended tag
''' (o)
''' </summary>
Public Partial Class Clazz
End Class
''' <summary>
''' (o)
''' Class Part #2
''' -=-=-=-=-=-=-
''' </summary>
Public Partial Class Clazz
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42314: XML comment cannot be applied more than once on a partial class. XML comments for this class will be ignored.
''' <summary>
~~~~~~~~~~~
BC42304: XML documentation parse error: Element is missing an end tag. XML comment will be ignored.
''' -=-=-=-=-=-=- <aaa> ' Error -- unended tag
~~~~~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
''' </summary>
~
BC42304: XML documentation parse error: Expected beginning '<' for an XML tag. XML comment will be ignored.
''' </summary>
~
BC42304: XML documentation parse error: XML name expected. XML comment will be ignored.
''' </summary>
~
BC42314: XML comment cannot be applied more than once on a partial class. XML comments for this class will be ignored.
''' <summary>
~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub DocCommentAndAccessibility()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary>
'''
''' -=( Clazz(Of X, Y) )=-
'''
''' </summary>
Public Class Clazz(Of X, Y)
''' <summary>
''' -=( Clazz(Of X, Y).PublicClazz )=-
''' </summary>
Public Class PublicClazz
End Class
''' <summary>
''' -=( Clazz(Of X, Y).PrivateClazz )=-
''' </summary>
Private Class PrivateClazz
End Class
End Class
''' <summary>
'''
''' -=( Clazz(Of X) )=-
'''
''' </summary>
Friend Class Clazz(Of X)
''' <summary>
''' -=( Clazz(Of X).PublicClazz )=-
''' </summary>
Public Class PublicClazz
End Class
''' <summary>
''' -=( Clazz(Of X).PrivateClazz )=-
''' </summary>
Private Class PrivateClazz
End Class
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Clazz`2">
<summary>
-=( Clazz(Of X, Y) )=-
</summary>
</member>
<member name="T:Clazz`2.PublicClazz">
<summary>
-=( Clazz(Of X, Y).PublicClazz )=-
</summary>
</member>
<member name="T:Clazz`2.PrivateClazz">
<summary>
-=( Clazz(Of X, Y).PrivateClazz )=-
</summary>
</member>
<member name="T:Clazz`1">
<summary>
-=( Clazz(Of X) )=-
</summary>
</member>
<member name="T:Clazz`1.PublicClazz">
<summary>
-=( Clazz(Of X).PublicClazz )=-
</summary>
</member>
<member name="T:Clazz`1.PrivateClazz">
<summary>
-=( Clazz(Of X).PrivateClazz )=-
</summary>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<ConditionalFact(GetType(DesktopOnly), Reason:="https://github.com/dotnet/roslyn/issues/18610")>
Public Sub IllegalXmlInDocComment()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary>
'''
''' -=( <a> )=-
'''
''' </summary>
Public Class Clazz(Of X, Y)
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42304: XML documentation parse error: Element is missing an end tag. XML comment will be ignored.
''' -=( <a> )=-
~~~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
''' </summary>
~
BC42304: XML documentation parse error: Expected beginning '<' for an XML tag. XML comment will be ignored.
''' </summary>
~
BC42304: XML documentation parse error: XML name expected. XML comment will be ignored.
''' </summary>
~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
</members>
</doc>
]]>
</xml>)
End Sub
<ConditionalFact(GetType(DesktopOnly), Reason:="https://github.com/dotnet/roslyn/issues/18610")>
Public Sub IllegalXmlInDocComment_Schema()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary>
'''
''' -=( <a x="1" x="2"/> )=-
'''
''' </summary>
Public Class Clazz(Of X, Y)
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42304: XML documentation parse error: 'x' is a duplicate attribute name. XML comment will be ignored.
''' <summary>
~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
</members>
</doc>
]]>
</xml>,
ensureEnglishUICulture:=True)
End Sub
<Fact>
Public Sub GeneralDocCommentOnFields()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary>
''' Class
''' Clazz(Of X, Y)
''' Comment
''' </summary>
Public Class Clazz(Of X, Y)
''' <summary> (* F1 *) </summary>
Public F1 As Integer
''' <summary>
''' F@ 2 %
''' </summary>
Private F2 As Integer
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Clazz`2">
<summary>
Class
Clazz(Of X, Y)
Comment
</summary>
</member>
<member name="F:Clazz`2.F1">
<summary> (* F1 *) </summary>
</member>
<member name="F:Clazz`2.F2">
<summary>
F@ 2 %
</summary>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub GeneralDocCommentOnEnumConstants()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary>
''' Some
''' documentation
''' comment
''' </summary>
''' <remarks></remarks>
Public Enum En
''' <summary> Just the first value </summary>
First
''' <summary>
''' Another value
''' </summary> ''' <remarks></remarks>
Second
End Enum
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:En">
<summary>
Some
documentation
comment
</summary>
<remarks></remarks>
</member>
<member name="F:En.First">
<summary> Just the first value </summary>
</member>
<member name="F:En.Second">
<summary>
Another value
</summary> ''' <remarks></remarks>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub GeneralDocCommentOnEvents()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary> Class Clazz(Of X, Y)
''' </summary>
Public Class ubClazz(Of X, Y)
''' <summary>
''' (* E(X) </summary>
''' <param name="f1"></param>
Public Event E(f1 As X)
''' <summary> Sub P(X,Y) </summary>
Private Shared Event P As Action(Of X, Y)
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:ubClazz`2">
<summary> Class Clazz(Of X, Y)
</summary>
</member>
<member name="E:ubClazz`2.E">
<summary>
(* E(X) </summary>
<param name="f1"></param>
</member>
<member name="E:ubClazz`2.P">
<summary> Sub P(X,Y) </summary>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub GeneralDocCommentOnProperties()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary> Class Clazz(Of X, Y) </summary>
Public Class ubClazz(Of X, Y)
''' <summary>
''' P1</summary>
Public Shared Property P1 As Integer
''' <summary>
''' S P(X,Y)
''' </summary>
''' <param name="A"></param>
Private ReadOnly Property P2(a As Integer) As String
Get
Return Nothing
End Get
End Property
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:ubClazz`2">
<summary> Class Clazz(Of X, Y) </summary>
</member>
<member name="P:ubClazz`2.P1">
<summary>
P1</summary>
</member>
<member name="P:ubClazz`2.P2(System.Int32)">
<summary>
S P(X,Y)
</summary>
<param name="A"></param>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub GeneralDocCommentOnMethods()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary> Class Clazz(Of X, Y) </summary>
Partial Public Class Clazz(Of X, Y)
''' <summary>.cctor()</summary>
Shared Sub New()
End Sub
''' <summary> F32(Integer) As Integer </summary>
''' <param name="a"></param>
''' <returns></returns>
Protected Function F32(a As Integer) As Integer
Return Nothing
End Function
''' <summary> a*b </summary>
Public Shared Operator *(a As Integer, b As Clazz(Of X, Y)) As Clazz(Of Integer, Integer)
Return Nothing
End Operator
''' <summary>DECL: Priv1(a As Integer)</summary>
Partial Private Sub Priv1(a As Integer)
End Sub
Partial Private Sub Priv2(a As Integer)
End Sub
''' <summary>DECL: Priv3(a As Integer)</summary>
Partial Private Sub Priv3(a As Integer)
End Sub
''' <summary>DECL: Priv4(a As Integer)</summary>
Partial Private Sub Priv4(a As Integer)
End Sub
End Class
Partial Public Class Clazz(Of X, Y)
''' <summary>.ctor()</summary>
Public Sub New()
End Sub
''' <summary> integer -> Clazz(Of X, Y) </summary>
Public Shared Narrowing Operator CType(a As Integer) As Clazz(Of X, Y)
Return Nothing
End Operator
''' <summary>IMPL: Priv1(a As Integer)</summary>
Private Sub Priv1(a As Integer)
End Sub
''' <summary>IMPL: Priv2(a As Integer)</summary>
Private Sub Priv2(a As Integer)
End Sub
Private Sub Priv3(a As Integer)
End Sub
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Clazz`2">
<summary> Class Clazz(Of X, Y) </summary>
</member>
<member name="M:Clazz`2.#cctor">
<summary>.cctor()</summary>
</member>
<member name="M:Clazz`2.F32(System.Int32)">
<summary> F32(Integer) As Integer </summary>
<param name="a"></param>
<returns></returns>
</member>
<member name="M:Clazz`2.op_Multiply(System.Int32,Clazz{`0,`1})">
<summary> a*b </summary>
</member>
<member name="M:Clazz`2.Priv1(System.Int32)">
<summary>IMPL: Priv1(a As Integer)</summary>
</member>
<member name="M:Clazz`2.Priv2(System.Int32)">
<summary>IMPL: Priv2(a As Integer)</summary>
</member>
<member name="M:Clazz`2.Priv3(System.Int32)">
<summary>DECL: Priv3(a As Integer)</summary>
</member>
<member name="M:Clazz`2.Priv4(System.Int32)">
<summary>DECL: Priv4(a As Integer)</summary>
</member>
<member name="M:Clazz`2.#ctor">
<summary>.ctor()</summary>
</member>
<member name="M:Clazz`2.op_Explicit(System.Int32)~Clazz{`0,`1}">
<summary> integer -> Clazz(Of X, Y) </summary>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub GeneralDocCommentOnDeclMethods()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary> Class [[Clazz]] </summary>
Public Class Clazz
''' <summary>
''' Declared function DeclareFtn
''' </summary>
Public Declare Function DeclareFtn Lib "bar" () As Integer
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Clazz">
<summary> Class [[Clazz]] </summary>
</member>
<member name="M:Clazz.DeclareFtn">
<summary>
Declared function DeclareFtn
</summary>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub Tags_Summary_C_Code_Example()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary>
''' Some comment here
''' and here
'''
''' <example> e.g.
''' <code>
''' ' No further processing
''' If docCommentXml Is Nothing Then
''' Debug.Assert(documentedParameters Is Nothing)
''' Debug.Assert(documentedTypeParameters Is Nothing)
''' Return False
''' End If
''' </code>
''' Returns <c>False</c> in the statement above.
''' </example>
'''
''' Done.
''' </summary>
''' <summary a="1">
''' </summary>
''' <code>
''' If docCommentXml Is Nothing Then
''' Return False
''' End If
''' </code>
''' <example> e.g. </example>
''' Returns <c>False</c> in the statement above.
Public Class Clazz
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Clazz">
<summary>
Some comment here
and here
<example> e.g.
<code>
' No further processing
If docCommentXml Is Nothing Then
Debug.Assert(documentedParameters Is Nothing)
Debug.Assert(documentedTypeParameters Is Nothing)
Return False
End If
</code>
Returns <c>False</c> in the statement above.
</example>
Done.
</summary>
<summary a="1">
</summary>
<code>
If docCommentXml Is Nothing Then
Return False
End If
</code>
<example> e.g. </example>
Returns <c>False</c> in the statement above.
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub Tags_Exception_Errors()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <exception cref="Exception">Module0</exception>
Public Module Module0
End Module
''' <summary><exception cref="Exception">E inside summary tag</exception></summary>
''' <exception cref="Exception">Clazz</exception>
Public Class Clazz(Of X)
''' <summary></summary>
''' <exception cref="11111">X1</exception>
Public Sub X1()
End Sub
''' <summary><exception cref="Exception">E inside summary tag</exception></summary>
''' <exception cref="Exception">E</exception>
Public Event E As Action
''' <summary></summary>
''' <exception cref="X">X2</exception>
Public Sub X2()
End Sub
''' <summary></summary>
''' <exception cref="Exception">F</exception>
Public F As Integer
''' <summary></summary>
''' <exception cref="Exception">P</exception>
Public Property P As Integer
''' <summary></summary>
''' <exception cref="Exception">FDelegate</exception>
Public Delegate Function FDelegate(a As Integer) As String
''' <summary></summary>
''' <exception cref="Exception">En</exception>
Public Enum En : A : End Enum
''' <summary></summary>
''' <exception cref="Exception">STR</exception>
Public Structure STR : End Structure
''' <summary></summary>
''' <exception cref="Exception">STR</exception>
Public ReadOnly Property A(x As String) As String
Get
Return x
End Get
End Property
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42306: XML comment tag 'exception' is not permitted on a 'module' language element.
''' <exception cref="Exception">Module0</exception>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'exception' is not permitted on a 'class' language element.
''' <summary><exception cref="Exception">E inside summary tag</exception></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'exception' is not permitted on a 'class' language element.
''' <exception cref="Exception">Clazz</exception>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute '11111' that could not be resolved.
''' <exception cref="11111">X1</exception>
~~~~~~~~~~~~
BC42375: XML comment has a tag with a 'cref' attribute 'X' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <exception cref="X">X2</exception>
~~~~~~~~
BC42306: XML comment tag 'exception' is not permitted on a 'variable' language element.
''' <exception cref="Exception">F</exception>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'exception' is not permitted on a 'delegate' language element.
''' <exception cref="Exception">FDelegate</exception>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'exception' is not permitted on a 'enum' language element.
''' <exception cref="Exception">En</exception>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'exception' is not permitted on a 'structure' language element.
''' <exception cref="Exception">STR</exception>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Module0">
<exception cref="T:System.Exception">Module0</exception>
</member>
<member name="T:Clazz`1">
<summary><exception cref="T:System.Exception">E inside summary tag</exception></summary>
<exception cref="T:System.Exception">Clazz</exception>
</member>
<member name="M:Clazz`1.X1">
<summary></summary>
<exception cref="!:11111">X1</exception>
</member>
<member name="E:Clazz`1.E">
<summary><exception cref="T:System.Exception">E inside summary tag</exception></summary>
<exception cref="T:System.Exception">E</exception>
</member>
<member name="M:Clazz`1.X2">
<summary></summary>
<exception cref="!:X">X2</exception>
</member>
<member name="F:Clazz`1.F">
<summary></summary>
<exception cref="T:System.Exception">F</exception>
</member>
<member name="P:Clazz`1.P">
<summary></summary>
<exception cref="T:System.Exception">P</exception>
</member>
<member name="T:Clazz`1.FDelegate">
<summary></summary>
<exception cref="T:System.Exception">FDelegate</exception>
</member>
<member name="T:Clazz`1.En">
<summary></summary>
<exception cref="T:System.Exception">En</exception>
</member>
<member name="T:Clazz`1.STR">
<summary></summary>
<exception cref="T:System.Exception">STR</exception>
</member>
<member name="P:Clazz`1.A(System.String)">
<summary></summary>
<exception cref="T:System.Exception">STR</exception>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub QualifiedCref()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class Clazz(Of X, Y)
Public Class MyException : Inherits Exception
''' <summary> </summary>
''' <exception cref="MyException">Clazz(Of Integer).MyException::S</exception>
Public Sub S()
End Sub
End Class
End Class
Public Class Clazz
Public Class MyException : Inherits Exception
''' <summary> </summary>
''' <exception cref="MyException">Clazz(Of Integer).MyException::S</exception>
Public Sub S()
End Sub
End Class
End Class
Public Module Module0
''' <summary> </summary>
''' <exception cref="Clazz.MyException">Module0::S0</exception>
Public Sub S0()
End Sub
''' <summary> </summary>
''' <exception cref="Clazz(Of ).MyException">Module0::S1</exception>
Public Sub S1()
End Sub
''' <summary> </summary>
''' <exception cref="Clazz(Of X).MyException">Module0::S2</exception>
Public Sub S2()
End Sub
''' <summary> </summary>
''' <exception cref="Clazz(Of X, Y).MyException">Module0::S2</exception>
Public Sub S2a()
End Sub
''' <summary> </summary>
''' <exception cref="Global">Module0::S3</exception>
''' <exception cref="oBjeCt">Module0::S3:OBJECT</exception>
Public Sub S3()
End Sub
''' <summary> </summary>
''' <exception cref="MyOuterException">Module0::S4</exception>
Public Sub S4()
End Sub
''' <summary> </summary>
''' <exception cref="MyOuterException(Of )">Module0::S5</exception>
Public Sub S5()
End Sub
''' <summary> </summary>
''' <exception cref="MyOuterException(Of T)">Module0::S6</exception>
Public Sub S6()
End Sub
''' <summary> </summary>
''' <exception cref="MyOuterException(Of T, Y)">Module0::S7</exception>
Public Sub S7()
End Sub
End Module
Public Class MyOuterException(Of T) : Inherits Exception
''' <summary> </summary>
''' <exception cref="MyOuterException">MyOuterException(Of )::S</exception>
Public Sub S()
End Sub
End Class
Public Class MyOuterException : Inherits Exception
''' <summary> </summary>
''' <exception cref="MyOuterException(Of X)">MyOuterException::S</exception>
Public Sub S()
End Sub
End Class
''' <summary><exception cref="Exception">E inside summary tag</exception></summary>
Public Class Clazz(Of X)
''' <summary> </summary>
''' <exception cref="MyException">Clazz::S1</exception>
Public Sub S1()
End Sub
''' <summary> </summary>
''' <exception cref="System.Exception">Clazz::S2</exception>
Public Sub S2()
End Sub
''' <summary> </summary>
''' <exception cref="Global.System.Exception">Clazz::S3</exception>
Public Sub S3()
End Sub
Public Class MyException : Inherits Exception
''' <summary> </summary>
''' <exception cref="MyException">MyException::S</exception>
Public Sub S()
End Sub
End Class
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Clazz(Of ).MyException' that could not be resolved.
''' <exception cref="Clazz(Of ).MyException">Module0::S1</exception>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Global' that could not be resolved.
''' <exception cref="Global">Module0::S3</exception>
~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'MyOuterException(Of )' that could not be resolved.
''' <exception cref="MyOuterException(Of )">Module0::S5</exception>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'MyOuterException(Of T, Y)' that could not be resolved.
''' <exception cref="MyOuterException(Of T, Y)">Module0::S7</exception>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'exception' is not permitted on a 'class' language element.
''' <summary><exception cref="Exception">E inside summary tag</exception></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="M:Clazz`2.MyException.S">
<summary> </summary>
<exception cref="T:Clazz`2.MyException">Clazz(Of Integer).MyException::S</exception>
</member>
<member name="M:Clazz.MyException.S">
<summary> </summary>
<exception cref="T:Clazz.MyException">Clazz(Of Integer).MyException::S</exception>
</member>
<member name="M:Module0.S0">
<summary> </summary>
<exception cref="T:Clazz.MyException">Module0::S0</exception>
</member>
<member name="M:Module0.S1">
<summary> </summary>
<exception cref="!:Clazz(Of ).MyException">Module0::S1</exception>
</member>
<member name="M:Module0.S2">
<summary> </summary>
<exception cref="T:Clazz`1.MyException">Module0::S2</exception>
</member>
<member name="M:Module0.S2a">
<summary> </summary>
<exception cref="T:Clazz`2.MyException">Module0::S2</exception>
</member>
<member name="M:Module0.S3">
<summary> </summary>
<exception cref="!:Global">Module0::S3</exception>
<exception cref="T:System.Object">Module0::S3:OBJECT</exception>
</member>
<member name="M:Module0.S4">
<summary> </summary>
<exception cref="T:MyOuterException">Module0::S4</exception>
</member>
<member name="M:Module0.S5">
<summary> </summary>
<exception cref="!:MyOuterException(Of )">Module0::S5</exception>
</member>
<member name="M:Module0.S6">
<summary> </summary>
<exception cref="T:MyOuterException`1">Module0::S6</exception>
</member>
<member name="M:Module0.S7">
<summary> </summary>
<exception cref="!:MyOuterException(Of T, Y)">Module0::S7</exception>
</member>
<member name="M:MyOuterException`1.S">
<summary> </summary>
<exception cref="T:MyOuterException">MyOuterException(Of )::S</exception>
</member>
<member name="M:MyOuterException.S">
<summary> </summary>
<exception cref="T:MyOuterException`1">MyOuterException::S</exception>
</member>
<member name="T:Clazz`1">
<summary><exception cref="T:System.Exception">E inside summary tag</exception></summary>
</member>
<member name="M:Clazz`1.S1">
<summary> </summary>
<exception cref="T:Clazz`1.MyException">Clazz::S1</exception>
</member>
<member name="M:Clazz`1.S2">
<summary> </summary>
<exception cref="T:System.Exception">Clazz::S2</exception>
</member>
<member name="M:Clazz`1.S3">
<summary> </summary>
<exception cref="T:System.Exception">Clazz::S3</exception>
</member>
<member name="M:Clazz`1.MyException.S">
<summary> </summary>
<exception cref="T:Clazz`1.MyException">MyException::S</exception>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub QualifiedCref_More()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Module Module1
Public Sub Main()
End Sub
Public Property PRST As String
Public Event EVNT As action
End Module
Public Class BaseClass
''' <summary>
''' <reference cref="Module1"/>
''' <reference cref="Module1.PRST"/>
''' <reference cref="Module1.get_PRST"/>
''' <reference cref="Module1.EVNT"/>
''' <reference cref="Module1.add_EVNT"/>
''' <reference cref="BaseClass.New"/>
''' <reference cref="BaseClass.op_multiply"/>
''' <reference cref="BaseClass.op_explicit"/>
''' </summary>
Public F As Integer
Public Shared Operator *(bc As BaseClass, i As Integer) As BaseClass
Return bc
End Operator
Public Shared Narrowing Operator CType(bc As BaseClass) As String
Return Nothing
End Operator
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Module1.get_PRST' that could not be resolved.
''' <reference cref="Module1.get_PRST"/>
~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Module1.add_EVNT' that could not be resolved.
''' <reference cref="Module1.add_EVNT"/>
~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'BaseClass.New' that could not be resolved.
''' <reference cref="BaseClass.New"/>
~~~~~~~~~~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="F:BaseClass.F">
<summary>
<reference cref="T:Module1"/>
<reference cref="P:Module1.PRST"/>
<reference cref="!:Module1.get_PRST"/>
<reference cref="E:Module1.EVNT"/>
<reference cref="!:Module1.add_EVNT"/>
<reference cref="!:BaseClass.New"/>
<reference cref="M:BaseClass.op_Multiply(BaseClass,System.Int32)"/>
<reference cref="M:BaseClass.op_Explicit(BaseClass)~System.String"/>
</summary>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub QualifiedCref_GenericMethod()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary>
''' 1) <see cref="Foo.Method"/>
''' 2) <see cref="Foo.Method(Of T)"/>
''' 3) <see cref="Foo.Method(Of T, U)"/>
''' 4) <see cref="Foo.Method(Of )"/>
''' 5) <see cref="Foo.Method(Of ,)"/>
''' </summary>
Public Class Foo
Public Sub Method()
End Sub
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Foo.Method(Of T)' that could not be resolved.
''' 2) <see cref="Foo.Method(Of T)"/>
~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Foo.Method(Of T, U)' that could not be resolved.
''' 3) <see cref="Foo.Method(Of T, U)"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Foo.Method(Of )' that could not be resolved.
''' 4) <see cref="Foo.Method(Of )"/>
~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Foo.Method(Of ,)' that could not be resolved.
''' 5) <see cref="Foo.Method(Of ,)"/>
~~~~~~~~~~~~~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Foo">
<summary>
1) <see cref="M:Foo.Method"/>
2) <see cref="!:Foo.Method(Of T)"/>
3) <see cref="!:Foo.Method(Of T, U)"/>
4) <see cref="!:Foo.Method(Of )"/>
5) <see cref="!:Foo.Method(Of ,)"/>
</summary>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub Cref_Scopes()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
' NOTE: The first "tostring" did not resolve in dev11.
''' <see cref="c.tostring"/>
''' <see cref="tostring"/>
Public Class C(Of X, Y)
''' <see cref="c.tostring"/>
''' <see cref="tostring"/>
Public Sub New()
End Sub
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:C`2">
<see cref="M:System.Object.ToString"/>
<see cref="M:System.Object.ToString"/>
</member>
<member name="M:C`2.#ctor">
<see cref="M:System.Object.ToString"/>
<see cref="M:System.Object.ToString"/>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<ConditionalFact(GetType(WindowsDesktopOnly), Reason:=ConditionalSkipReason.TestExecutionNeedsDesktopTypes)>
Public Sub Tags_Summary_Permission_See_SeeAlso_List_Para()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <summary>
''' This is the entry point of the Point class testing program.
''' <para>This program tests each method and operator, and
''' is intended to be run after any non-trivial maintenance has
''' been performed on the Point class.</para>
''' </summary>
''' <permission cref="System.Security.PermissionSet">
''' Everyone can access this class.<see cref="List(Of X)"/>
''' </permission>
Public Class TestClass
''' <remarks>
''' Here is an example of a bulleted list:
''' <list type="bullet">
''' <listheader>
''' <term>term</term>
''' <description>description</description>
''' </listheader>
''' <item>
''' <term>A</term>
''' <description>Item 1.</description>
''' </item>
''' <item>
''' <description>Item 2.</description>
''' </item>
''' </list>
''' </remarks>
''' <list type="bullet">
''' <item>
''' <description>Item 1.</description>
''' <seealso cref="TestClass"/>
''' </item>
''' </list>
Public Shared Sub Main()
Dim a As TestClass = Nothing
End Sub
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:TestClass">
<summary>
This is the entry point of the Point class testing program.
<para>This program tests each method and operator, and
is intended to be run after any non-trivial maintenance has
been performed on the Point class.</para>
</summary>
<permission cref="T:System.Security.PermissionSet">
Everyone can access this class.<see cref="T:System.Collections.Generic.List`1"/>
</permission>
</member>
<member name="M:TestClass.Main">
<remarks>
Here is an example of a bulleted list:
<list type="bullet">
<listheader>
<term>term</term>
<description>description</description>
</listheader>
<item>
<term>A</term>
<description>Item 1.</description>
</item>
<item>
<description>Item 2.</description>
</item>
</list>
</remarks>
<list type="bullet">
<item>
<description>Item 1.</description>
<seealso cref="T:TestClass"/>
</item>
</list>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub Tags_ParamRef()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <summary>
''' <paramref name="P1"></paramref>
''' </summary>
''' <paramref name="P2"></paramref>
Public Class TestClass
''' <summary>
''' <paramref name="P3"></paramref>
''' </summary>
''' <paramref name="P4"></paramref>
''' <paramref></paramref>
Public Shared Sub M(p3 As Integer, p4 As String)
Dim a As TestClass = Nothing
End Sub
''' <summary>
''' <paramref name="P5"></paramref>
''' </summary>
''' <paramref name="P6"></paramref>
Public F As Integer
''' <summary>
''' <paramref name="P7"></paramref>
''' </summary>
''' <paramref name="P8"></paramref>
Public Property P As Integer
''' <summary>
''' <paramref name="P9"></paramref>
''' </summary>
''' <paramref name="P10"></paramref>
Public ReadOnly Property P(P9 As String) As Integer
Get
Return Nothing
End Get
End Property
''' <summary>
''' <paramref name="P11"></paramref>
''' </summary>
''' <paramref name="P12"></paramref>
Public Event EE(p11 As String)
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42306: XML comment tag 'paramref' is not permitted on a 'class' language element.
''' <paramref name="P1"></paramref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'paramref' is not permitted on a 'class' language element.
''' <paramref name="P2"></paramref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'paramref' is not permitted on a 'variable' language element.
''' <paramref name="P5"></paramref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'paramref' is not permitted on a 'variable' language element.
''' <paramref name="P6"></paramref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42307: XML comment parameter 'P7' does not match a parameter on the corresponding 'property' statement.
''' <paramref name="P7"></paramref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42307: XML comment parameter 'P8' does not match a parameter on the corresponding 'property' statement.
''' <paramref name="P8"></paramref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42307: XML comment parameter 'P10' does not match a parameter on the corresponding 'property' statement.
''' <paramref name="P10"></paramref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42307: XML comment parameter 'P12' does not match a parameter on the corresponding 'event' statement.
''' <paramref name="P12"></paramref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:TestClass">
<summary>
<paramref name="P1"></paramref>
</summary>
<paramref name="P2"></paramref>
</member>
<member name="M:TestClass.M(System.Int32,System.String)">
<summary>
<paramref name="P3"></paramref>
</summary>
<paramref name="P4"></paramref>
<paramref></paramref>
</member>
<member name="F:TestClass.F">
<summary>
<paramref name="P5"></paramref>
</summary>
<paramref name="P6"></paramref>
</member>
<member name="P:TestClass.P">
<summary>
<paramref name="P7"></paramref>
</summary>
<paramref name="P8"></paramref>
</member>
<member name="P:TestClass.P(System.String)">
<summary>
<paramref name="P9"></paramref>
</summary>
<paramref name="P10"></paramref>
</member>
<member name="E:TestClass.EE">
<summary>
<paramref name="P11"></paramref>
</summary>
<paramref name="P12"></paramref>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub Tags_ParamRef_NoErrors()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <summary>
''' <paramref name="P1"></paramref>
''' </summary>
''' <paramref name="P2"></paramref>
Public Class TestClass
''' <summary>
''' <paramref name="P3"></paramref>
''' </summary>
''' <paramref name="P4"></paramref>
''' <paramref></paramref>
Public Shared Sub M(p3 As Integer, p4 As String)
Dim a As TestClass = Nothing
End Sub
''' <summary>
''' <paramref name="P5"></paramref>
''' </summary>
''' <paramref name="P6"></paramref>
Public F As Integer
''' <summary>
''' <paramref name="P7"></paramref>
''' </summary>
''' <paramref name="P8"></paramref>
Public Property P As Integer
''' <summary>
''' <paramref name="P9"></paramref>
''' </summary>
''' <paramref name="P10"></paramref>
Public ReadOnly Property P(P9 As String) As Integer
Get
Return Nothing
End Get
End Property
''' <summary>
''' <paramref name="P11"></paramref>
''' </summary>
''' <paramref name="P12"></paramref>
Public Event EE(p11 As String)
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:TestClass">
<summary>
<paramref name="P1"></paramref>
</summary>
<paramref name="P2"></paramref>
</member>
<member name="M:TestClass.M(System.Int32,System.String)">
<summary>
<paramref name="P3"></paramref>
</summary>
<paramref name="P4"></paramref>
<paramref></paramref>
</member>
<member name="F:TestClass.F">
<summary>
<paramref name="P5"></paramref>
</summary>
<paramref name="P6"></paramref>
</member>
<member name="P:TestClass.P">
<summary>
<paramref name="P7"></paramref>
</summary>
<paramref name="P8"></paramref>
</member>
<member name="P:TestClass.P(System.String)">
<summary>
<paramref name="P9"></paramref>
</summary>
<paramref name="P10"></paramref>
</member>
<member name="E:TestClass.EE">
<summary>
<paramref name="P11"></paramref>
</summary>
<paramref name="P12"></paramref>
</member>
</members>
</doc>
]]>
</xml>, withDiagnostics:=False)
End Sub
<Fact>
Public Sub Tags_Returns()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <summary>
''' <paramref name="P1"></paramref>
''' </summary>
''' <returns>TestClass</returns>
Public Class TestClass
''' <returns>EN</returns>
Public Enum EN : A : End Enum
''' <returns>DelSub</returns>
Public Delegate Sub DelSub(a As Integer)
''' <returns>DelFunc</returns>
Public Delegate Function DelFunc(a As Integer) As Integer
''' <returns>MSub</returns>
Public Shared Sub MSub(p3 As Integer, p4 As String)
End Sub
''' <returns>MFunc</returns>
Public Shared Function MFunc(p3 As Integer, p4 As String) As Integer
Return Nothing
End Function
''' <summary><returns nested="true">Field</returns></summary>
''' <returns>Field</returns>
Public Field As Integer
''' <returns>FieldWE</returns>
WithEvents FieldWE As TestClass
''' <returns>DeclareFtn</returns>
Public Declare Function DeclareFtn Lib "bar" () As Integer
''' <returns>DeclareSub</returns>
Public Declare Sub DeclareSub Lib "bar" ()
''' <returns>PReadOnly</returns>
Public ReadOnly Property PReadOnly As Integer
Get
Return Nothing
End Get
End Property
''' <returns>PReadWrite</returns>
Public Property PReadWrite As Integer
Get
Return Nothing
End Get
Set(value As Integer)
End Set
End Property
''' <returns>PWriteOnly</returns>
Public WriteOnly Property PWriteOnly As Integer
Set(value As Integer)
End Set
End Property
''' <returns>EE</returns>
Public Event EE(p11 As String)
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42306: XML comment tag 'paramref' is not permitted on a 'class' language element.
''' <paramref name="P1"></paramref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'returns' is not permitted on a 'class' language element.
''' <returns>TestClass</returns>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'returns' is not permitted on a 'enum' language element.
''' <returns>EN</returns>
~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'returns' is not permitted on a 'delegate sub' language element.
''' <returns>DelSub</returns>
~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'returns' is not permitted on a 'sub' language element.
''' <returns>MSub</returns>
~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'returns' is not permitted on a 'variable' language element.
''' <summary><returns nested="true">Field</returns></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'returns' is not permitted on a 'variable' language element.
''' <returns>Field</returns>
~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'returns' is not permitted on a 'WithEvents variable' language element.
''' <returns>FieldWE</returns>
~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42315: XML comment tag 'returns' is not permitted on a 'declare sub' language element.
''' <returns>DeclareSub</returns>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42313: XML comment tag 'returns' is not permitted on a 'WriteOnly' Property.
''' <returns>PWriteOnly</returns>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'returns' is not permitted on a 'event' language element.
''' <returns>EE</returns>
~~~~~~~~~~~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:TestClass">
<summary>
<paramref name="P1"></paramref>
</summary>
<returns>TestClass</returns>
</member>
<member name="T:TestClass.EN">
<returns>EN</returns>
</member>
<member name="T:TestClass.DelSub">
<returns>DelSub</returns>
</member>
<member name="T:TestClass.DelFunc">
<returns>DelFunc</returns>
</member>
<member name="M:TestClass.MSub(System.Int32,System.String)">
<returns>MSub</returns>
</member>
<member name="M:TestClass.MFunc(System.Int32,System.String)">
<returns>MFunc</returns>
</member>
<member name="F:TestClass.Field">
<summary><returns nested="true">Field</returns></summary>
<returns>Field</returns>
</member>
<member name="F:TestClass._FieldWE">
<returns>FieldWE</returns>
</member>
<member name="M:TestClass.DeclareFtn">
<returns>DeclareFtn</returns>
</member>
<member name="M:TestClass.DeclareSub">
<returns>DeclareSub</returns>
</member>
<member name="P:TestClass.PReadOnly">
<returns>PReadOnly</returns>
</member>
<member name="P:TestClass.PReadWrite">
<returns>PReadWrite</returns>
</member>
<member name="P:TestClass.PWriteOnly">
<returns>PWriteOnly</returns>
</member>
<member name="E:TestClass.EE">
<returns>EE</returns>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub Tags_Param()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <summary><param name="P_outer + aaa">@TestClass</param></summary>
''' <param name="P">@TestClass</param>
Public Class TestClass
''' <param name="P">@EN</param>
Public Enum EN : A : End Enum
''' <param name="a">@DelSub</param>
Public Delegate Sub DelSub(a As Integer)
''' <param name="a">@DelFunc</param>
''' <summary><param name="P_outer + aaa">@TestClass</param></summary>
Public Delegate Function DelFunc(a As Integer) As Integer
''' <param name="a">@MSub</param>
Public Shared Sub MSub(p3 As Integer, p4 As String)
End Sub
''' <param name="">@MSubWithErrors1</param>
Public Shared Sub MSubWithErrors1(p3 As Integer, p4 As String)
End Sub
''' <param name="1">@MSubWithErrors2</param>
Public Shared Sub MSubWithErrors2(p3 As Integer, p4 As String)
End Sub
''' <param>@MSubWithErrors3</param>
Public Shared Sub MSubWithErrors3(p3 As Integer, p4 As String)
End Sub
''' <param name="p3">@MFunc</param>
Public Shared Function MFunc(p3 As Integer, p4 As String) As Integer
Return Nothing
End Function
''' <param name="p3">@Field</param>
Public Field As Integer
''' <param name="p3">@DeclareFtn</param>
Public Declare Function DeclareFtn Lib "bar" (p3 As Integer) As Integer
''' <param name="p">@PReadOnly</param>
Public ReadOnly Property PReadOnly(p As Integer) As Integer
Get
Return Nothing
End Get
End Property
''' <param name="p">@PReadWrite</param>
Public Property PReadWrite As Integer
''' <param name="ppp">@EVE</param>
Public Event EVE(ppp As Integer)
''' <param name="paramName">@EVE2</param>
Public Event EVE2 As Action(Of Integer)
''' <param name="arg1">@EVE3</param>
''' <param name="arg2">@EVE3</param>
Public Event EVE3 As Action(Of Integer, Integer)
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42306: XML comment tag 'param' is not permitted on a 'class' language element.
''' <summary><param name="P_outer + aaa">@TestClass</param></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'param' is not permitted on a 'class' language element.
''' <param name="P">@TestClass</param>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'param' is not permitted on a 'enum' language element.
''' <param name="P">@EN</param>
~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42307: XML comment parameter 'P_outer + aaa' does not match a parameter on the corresponding 'function' statement.
''' <summary><param name="P_outer + aaa">@TestClass</param></summary>
~~~~~~~~~~~~~~~~~~~~
BC42307: XML comment parameter 'a' does not match a parameter on the corresponding 'sub' statement.
''' <param name="a">@MSub</param>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42307: XML comment parameter '' does not match a parameter on the corresponding 'sub' statement.
''' <param name="">@MSubWithErrors1</param>
~~~~~~~
BC42307: XML comment parameter '1' does not match a parameter on the corresponding 'sub' statement.
''' <param name="1">@MSubWithErrors2</param>
~~~~~~~~
BC42308: XML comment parameter must have a 'name' attribute.
''' <param>@MSubWithErrors3</param>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'param' is not permitted on a 'variable' language element.
''' <param name="p3">@Field</param>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42307: XML comment parameter 'p' does not match a parameter on the corresponding 'property' statement.
''' <param name="p">@PReadWrite</param>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42307: XML comment parameter 'paramName' does not match a parameter on the corresponding 'event' statement.
''' <param name="paramName">@EVE2</param>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:TestClass">
<summary><param name="P_outer + aaa">@TestClass</param></summary>
<param name="P">@TestClass</param>
</member>
<member name="T:TestClass.EN">
<param name="P">@EN</param>
</member>
<member name="T:TestClass.DelSub">
<param name="a">@DelSub</param>
</member>
<member name="T:TestClass.DelFunc">
<param name="a">@DelFunc</param>
<summary><param name="P_outer + aaa">@TestClass</param></summary>
</member>
<member name="M:TestClass.MSub(System.Int32,System.String)">
<param name="a">@MSub</param>
</member>
<member name="M:TestClass.MSubWithErrors1(System.Int32,System.String)">
<param name="">@MSubWithErrors1</param>
</member>
<member name="M:TestClass.MSubWithErrors2(System.Int32,System.String)">
<param name="1">@MSubWithErrors2</param>
</member>
<member name="M:TestClass.MSubWithErrors3(System.Int32,System.String)">
<param>@MSubWithErrors3</param>
</member>
<member name="M:TestClass.MFunc(System.Int32,System.String)">
<param name="p3">@MFunc</param>
</member>
<member name="F:TestClass.Field">
<param name="p3">@Field</param>
</member>
<member name="M:TestClass.DeclareFtn(System.Int32)">
<param name="p3">@DeclareFtn</param>
</member>
<member name="P:TestClass.PReadOnly(System.Int32)">
<param name="p">@PReadOnly</param>
</member>
<member name="P:TestClass.PReadWrite">
<param name="p">@PReadWrite</param>
</member>
<member name="E:TestClass.EVE">
<param name="ppp">@EVE</param>
</member>
<member name="E:TestClass.EVE2">
<param name="paramName">@EVE2</param>
</member>
<member name="E:TestClass.EVE3">
<param name="arg1">@EVE3</param>
<param name="arg2">@EVE3</param>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub Tags_Param_10Plus()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
Public Class TestClass
''' <param name="a1"/>
''' <param name="a14"/>
Private Sub PS(a0 As Integer, a1 As Integer, a2 As Integer, a3 As Integer, a4 As Integer,
a5 As Integer, a6 As Integer, a7 As Integer, a8 As Integer, a9 As Integer,
a10 As Integer, a11 As Integer, a12 As Integer, a13 As Integer, a14 As Integer)
End Sub
End Class
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="M:TestClass.PS(System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)">
<param name="a1"/>
<param name="a14"/>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub Tags_Value()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <summary><param name="P_outer + aaa"/>@TestClass</summary>
''' <value>@TestClass</value>
Public Class TestClass
''' <value>@EN</value>
Public Enum EN : A : End Enum
''' <value>@STR</value>
Public Structure STR : End Structure
''' <value>@INTERF</value>
Public Interface INTERF : End Interface
''' <value>@DelSub</value>
Public Delegate Sub DelSub(a As Integer)
''' <value>@DelFunc</value>
Public Delegate Function DelFunc(a As Integer) As Integer
''' <value>@MSub</value>
Public Shared Sub MSub(p3 As Integer, p4 As String)
End Sub
''' <value>@MFunc</value>
Public Shared Function MFunc(p3 As Integer, p4 As String) As Integer
Return Nothing
End Function
''' <value>@DeclareFtn</value>
Public Declare Function DeclareFtn Lib "bar" (p3 As Integer) As Integer
''' <value>@Field</value>
Public Field As Integer
''' <value>@PWriteOnly</value>
Public WriteOnly Property PWriteOnly(p As Integer) As Integer
Set(value As Integer)
End Set
End Property
''' <value>@PReadWrite</value>
Public Property PReadWrite As Integer
''' <value>@EVE</value>
Public Event EVE(ppp As Integer)
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42306: XML comment tag 'param' is not permitted on a 'class' language element.
''' <summary><param name="P_outer + aaa"/>@TestClass</summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'value' is not permitted on a 'class' language element.
''' <value>@TestClass</value>
~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'value' is not permitted on a 'enum' language element.
''' <value>@EN</value>
~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'value' is not permitted on a 'structure' language element.
''' <value>@STR</value>
~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'value' is not permitted on a 'interface' language element.
''' <value>@INTERF</value>
~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'value' is not permitted on a 'delegate' language element.
''' <value>@DelSub</value>
~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'value' is not permitted on a 'delegate' language element.
''' <value>@DelFunc</value>
~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'value' is not permitted on a 'sub' language element.
''' <value>@MSub</value>
~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'value' is not permitted on a 'function' language element.
''' <value>@MFunc</value>
~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'value' is not permitted on a 'declare' language element.
''' <value>@DeclareFtn</value>
~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'value' is not permitted on a 'variable' language element.
''' <value>@Field</value>
~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'value' is not permitted on a 'event' language element.
''' <value>@EVE</value>
~~~~~~~~~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:TestClass">
<summary><param name="P_outer + aaa"/>@TestClass</summary>
<value>@TestClass</value>
</member>
<member name="T:TestClass.EN">
<value>@EN</value>
</member>
<member name="T:TestClass.STR">
<value>@STR</value>
</member>
<member name="T:TestClass.INTERF">
<value>@INTERF</value>
</member>
<member name="T:TestClass.DelSub">
<value>@DelSub</value>
</member>
<member name="T:TestClass.DelFunc">
<value>@DelFunc</value>
</member>
<member name="M:TestClass.MSub(System.Int32,System.String)">
<value>@MSub</value>
</member>
<member name="M:TestClass.MFunc(System.Int32,System.String)">
<value>@MFunc</value>
</member>
<member name="M:TestClass.DeclareFtn(System.Int32)">
<value>@DeclareFtn</value>
</member>
<member name="F:TestClass.Field">
<value>@Field</value>
</member>
<member name="P:TestClass.PWriteOnly(System.Int32)">
<value>@PWriteOnly</value>
</member>
<member name="P:TestClass.PReadWrite">
<value>@PReadWrite</value>
</member>
<member name="E:TestClass.EVE">
<value>@EVE</value>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub Tags_TypeParam()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <typeparam name="X">@Module0</typeparam>
Public Module Module0
End Module
''' <summary><param name="P_outer + aaa"/>@TestClass</summary>
''' <typeparam>@TestClass</typeparam>
Public Class TestClass
''' <typeparam name="X">@EN</typeparam>
Public Enum EN : A : End Enum
''' <typeparam name="X">@STR</typeparam>
Public Structure STR(Of X) : End Structure
''' <typeparam name="Y">@INTERF</typeparam>
Public Interface INTERF(Of X, Y) : End Interface
''' <typeparam name="W">@DelSub</typeparam>
Public Delegate Sub DelSub(Of W)(a As Integer)
''' <typeparam name="UV">@DelFunc</typeparam>
Public Delegate Function DelFunc(Of W)(a As Integer) As Integer
''' <typeparam name="TT">@MSub</typeparam>
Public Shared Sub MSub(Of TT)(p3 As Integer, p4 As String)
End Sub
''' <typeparam name="TT">@MFunc</typeparam>
Public Shared Function MFunc(p3 As Integer, p4 As String) As Integer
Return Nothing
End Function
''' <typeparam name="TT">@Field</typeparam>
Public Field As Integer
''' <typeparam name="TT">@DeclareFtn</typeparam>
Public Declare Function DeclareFtn Lib "bar" (p3 As Integer) As Integer
''' <typeparam name="TT">@PWriteOnly</typeparam>
Public WriteOnly Property PWriteOnly(p As Integer) As Integer
Set(value As Integer)
End Set
End Property
''' <typeparam name="TT">@PReadWrite</typeparam>
Public Property PReadWrite As Integer
''' <typeparam name="TT">@EVE</typeparam>
Public Event EVE(ppp As Integer)
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42306: XML comment tag 'typeparam' is not permitted on a 'module' language element.
''' <typeparam name="X">@Module0</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'param' is not permitted on a 'class' language element.
''' <summary><param name="P_outer + aaa"/>@TestClass</summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42318: XML comment type parameter must have a 'name' attribute.
''' <typeparam>@TestClass</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'enum' language element.
''' <typeparam name="X">@EN</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42317: XML comment type parameter 'UV' does not match a type parameter on the corresponding 'delegate' statement.
''' <typeparam name="UV">@DelFunc</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42317: XML comment type parameter 'TT' does not match a type parameter on the corresponding 'function' statement.
''' <typeparam name="TT">@MFunc</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'variable' language element.
''' <typeparam name="TT">@Field</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'declare' language element.
''' <typeparam name="TT">@DeclareFtn</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'property' language element.
''' <typeparam name="TT">@PWriteOnly</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'property' language element.
''' <typeparam name="TT">@PReadWrite</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'event' language element.
''' <typeparam name="TT">@EVE</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Module0">
<typeparam name="X">@Module0</typeparam>
</member>
<member name="T:TestClass">
<summary><param name="P_outer + aaa"/>@TestClass</summary>
<typeparam>@TestClass</typeparam>
</member>
<member name="T:TestClass.EN">
<typeparam name="X">@EN</typeparam>
</member>
<member name="T:TestClass.STR`1">
<typeparam name="X">@STR</typeparam>
</member>
<member name="T:TestClass.INTERF`2">
<typeparam name="Y">@INTERF</typeparam>
</member>
<member name="T:TestClass.DelSub`1">
<typeparam name="W">@DelSub</typeparam>
</member>
<member name="T:TestClass.DelFunc`1">
<typeparam name="UV">@DelFunc</typeparam>
</member>
<member name="M:TestClass.MSub``1(System.Int32,System.String)">
<typeparam name="TT">@MSub</typeparam>
</member>
<member name="M:TestClass.MFunc(System.Int32,System.String)">
<typeparam name="TT">@MFunc</typeparam>
</member>
<member name="F:TestClass.Field">
<typeparam name="TT">@Field</typeparam>
</member>
<member name="M:TestClass.DeclareFtn(System.Int32)">
<typeparam name="TT">@DeclareFtn</typeparam>
</member>
<member name="P:TestClass.PWriteOnly(System.Int32)">
<typeparam name="TT">@PWriteOnly</typeparam>
</member>
<member name="P:TestClass.PReadWrite">
<typeparam name="TT">@PReadWrite</typeparam>
</member>
<member name="E:TestClass.EVE">
<typeparam name="TT">@EVE</typeparam>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub BC42300WRN_XMLDocBadXMLLine()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Option Explicit On
Imports System
Class C1
'''<remarks>this XML comment does not immediately appear before any type</remarks>
'''<remarks>Line#2</remarks>
' this is a regular comment
Interface I1
End Interface
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42301: Only one XML comment block is allowed per language element.
'''<remarks>this XML comment does not immediately appear before any type</remarks>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42300: XML comment block must immediately precede the language element to which it applies. XML comment will be ignored.
'''<remarks>Line#2</remarks>
~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub BC42301WRN_XMLDocMoreThanOneCommentBlock()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Option Explicit On
Imports System
'''<remarks>Line#1</remarks>
'comment
'''<remarks>Line#2</remarks>
Class C1
' this is a regular comment
'''<remarks>this XML comment does not immediately appear before any type</remarks>
'''<remarks>Line#2</remarks>
Interface I1
End Interface
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42301: Only one XML comment block is allowed per language element.
'''<remarks>Line#1</remarks>
~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42301: Only one XML comment block is allowed per language element.
'''<remarks>this XML comment does not immediately appear before any type</remarks>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:C1">
<remarks>Line#2</remarks>
</member>
<member name="T:C1.I1">
<remarks>Line#2</remarks>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub WRN_XMLDocInsideMethod()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Option Explicit On
Imports System
Module Module11
Public x As Object = Function()
'''
Return 1
End Function
Public y As Object = Function() _
''' _
Sub Main2()
'''
End Sub
Public Property PPP As Object = Function() 1 ''' 1
Public Property PPP2 As Object = Function()
'''
Return 1
End Function
End Module
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42303: XML comment cannot appear within a method or a property. XML comment will be ignored.
'''
~
BC36674: Multiline lambda expression is missing 'End Function'.
Public y As Object = Function() _
~~~~~~~~~~
BC42105: Function '<anonymous method>' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.
Public y As Object = Function() _
~
BC42303: XML comment cannot appear within a method or a property. XML comment will be ignored.
'''
~
BC42302: XML comment must be the first statement on a line. XML comment will be ignored.
Public Property PPP As Object = Function() 1 ''' 1
~~~~~
BC42303: XML comment cannot appear within a method or a property. XML comment will be ignored.
'''
~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="M:Module11.Main2">
_
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub WRN_XMLDocInsideMethod_NoError()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Option Explicit On
Imports System
Module Module11
Public x As Object = Function()
'''
Return 1
End Function
Public y As Object = Function() _
''' _
Sub Main2()
'''
End Sub
Public Property PPP As Object = Function() 1 ''' 1
Public Property PPP2 As Object = Function()
'''
Return 1
End Function
End Module
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC36674: Multiline lambda expression is missing 'End Function'.
Public y As Object = Function() _
~~~~~~~~~~
BC42105: Function '<anonymous method>' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.
Public y As Object = Function() _
~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="M:Module11.Main2">
_
</member>
</members>
</doc>
]]>
</xml>,
withDiagnostics:=False)
End Sub
<ConditionalFact(GetType(WindowsDesktopOnly), Reason:=ConditionalSkipReason.TestExecutionNeedsDesktopTypes)>
Public Sub BC42305WRN_XMLDocDuplicateXMLNode()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Option Explicit On
Imports System
''' <summary cref="a b">
''' </summary>
''' <typeparam name="X"></typeparam>
''' <typeparam name=" X " />
''' <typeparam name="Y"></typeparam>
''' <typeparam name="X"></typeparam>
''' <summary cref="a B "/>
''' <summary cref=" a b "/>
Public Class C(Of X, Y)
''' <include file=" a.vb" path=" c:\ww "/>
''' <include path="c:\ww" file="a.vb"/>
Public FLD As String
''' <mysummary cref="SSS"></mysummary>
Public FLD2 As String
''' <param name="x"></param>
''' <param name="x"></param>
Public Sub SSS(x As Integer)
End Sub
''' <remarks x=" A" y="" z = "B"></remarks>
''' <remarks y="" z = "B" x="A "/>
''' <remarks y=" " z = "B" x="a"/>
''' <remarks y=" " x="A" z = "B"/>
Public F As Integer
''' <returns what="a"></returns>
''' <returns what="b"></returns>
''' <returns what=" b "/>
Public Shared Operator -(a As C(Of X, Y), b As Integer) As C(Of X, Y)
Return Nothing
End Operator
''' <permission cref="System.Security.PermissionSet"/>
''' <permission cref="System.Security.PermissionSet "></permission>
''' <permission cref="System.Security. PermissionSet"></permission>
Public Shared Narrowing Operator CType(a As C(Of X, Y)) As Integer
Return Nothing
End Operator
End Class
''' <remarks x=" A" y=""></remarks>
''' <remarks y="" x="A "/>
Module M
''' <remarks></remarks>
''' <remarks/>
''' <param name="x"></param>
''' <param name="x"></param>
Public Event A(x As Integer, x As Integer)
''' <param name="a" noname="b"></param>
''' <param noname=" b " name="a"></param>
''' <value></value>
''' <value/>
Public WriteOnly Property PROP(a As String) As String
Set(value As String)
End Set
End Property
End Module
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'a b' that could not be resolved.
''' <summary cref="a b">
~~~~~~~~~~
BC42305: XML comment tag 'typeparam' appears with identical attributes more than once in the same XML comment block.
''' <typeparam name=" X " />
~~~~~~~~~~~~~~~~~~~~~~~~
BC42305: XML comment tag 'typeparam' appears with identical attributes more than once in the same XML comment block.
''' <typeparam name="X"></typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'a B' that could not be resolved.
''' <summary cref="a B "/>
~~~~~~~~~~~
BC42305: XML comment tag 'summary' appears with identical attributes more than once in the same XML comment block.
''' <summary cref=" a b "/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute ' a b' that could not be resolved.
''' <summary cref=" a b "/>
~~~~~~~~~~~~~~~~
BC42305: XML comment tag 'include' appears with identical attributes more than once in the same XML comment block.
''' <include path="c:\ww" file="a.vb"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42305: XML comment tag 'param' appears with identical attributes more than once in the same XML comment block.
''' <param name="x"></param>
~~~~~~~~~~~~~~~~~~~~~~~~
BC42305: XML comment tag 'remarks' appears with identical attributes more than once in the same XML comment block.
''' <remarks y="" z = "B" x="A "/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42305: XML comment tag 'remarks' appears with identical attributes more than once in the same XML comment block.
''' <remarks y=" " x="A" z = "B"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42305: XML comment tag 'returns' appears with identical attributes more than once in the same XML comment block.
''' <returns what=" b "/>
~~~~~~~~~~~~~~~~~~~~~~
BC42305: XML comment tag 'permission' appears with identical attributes more than once in the same XML comment block.
''' <permission cref="System.Security.PermissionSet "></permission>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42305: XML comment tag 'remarks' appears with identical attributes more than once in the same XML comment block.
''' <remarks y="" x="A "/>
~~~~~~~~~~~~~~~~~~~~~~~~~
BC42305: XML comment tag 'remarks' appears with identical attributes more than once in the same XML comment block.
''' <remarks/>
~~~~~~~~~~
BC42305: XML comment tag 'param' appears with identical attributes more than once in the same XML comment block.
''' <param noname=" b " name="a"></param>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42305: XML comment tag 'value' appears with identical attributes more than once in the same XML comment block.
''' <value/>
~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:C`2">
<summary cref="!:a b">
</summary>
<typeparam name="X"></typeparam>
<typeparam name=" X " />
<typeparam name="Y"></typeparam>
<typeparam name="X"></typeparam>
<summary cref="!:a B "/>
<summary cref="!: a b "/>
</member>
<member name="F:C`2.FLD">
<!--warning BC42321: Unable to include XML fragment ' c:\ww ' of file ' a.vb'. File not found.-->
<!--warning BC42321: Unable to include XML fragment 'c:\ww' of file 'a.vb'. File not found.-->
</member>
<member name="F:C`2.FLD2">
<mysummary cref="M:C`2.SSS(System.Int32)"></mysummary>
</member>
<member name="M:C`2.SSS(System.Int32)">
<param name="x"></param>
<param name="x"></param>
</member>
<member name="F:C`2.F">
<remarks x=" A" y="" z = "B"></remarks>
<remarks y="" z = "B" x="A "/>
<remarks y=" " z = "B" x="a"/>
<remarks y=" " x="A" z = "B"/>
</member>
<member name="M:C`2.op_Subtraction(C{`0,`1},System.Int32)">
<returns what="a"></returns>
<returns what="b"></returns>
<returns what=" b "/>
</member>
<member name="M:C`2.op_Explicit(C{`0,`1})~System.Int32">
<permission cref="T:System.Security.PermissionSet"/>
<permission cref="T:System.Security.PermissionSet"></permission>
<permission cref="T:System.Security.PermissionSet"></permission>
</member>
<member name="T:M">
<remarks x=" A" y=""></remarks>
<remarks y="" x="A "/>
</member>
<member name="E:M.A">
<remarks></remarks>
<remarks/>
<param name="x"></param>
<param name="x"></param>
</member>
<member name="P:M.PROP(System.String)">
<param name="a" noname="b"></param>
<param noname=" b " name="a"></param>
<value></value>
<value/>
</member>
</members>
</doc>
]]>
</xml>, ensureEnglishUICulture:=True)
End Sub
<ConditionalFact(GetType(WindowsDesktopOnly), Reason:=ConditionalSkipReason.TestExecutionNeedsDesktopTypes)>
Public Sub BC42305WRN_XMLDocDuplicateXMLNode_NoError()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Option Explicit On
Imports System
''' <summary cref="a b">
''' </summary>
''' <typeparam name="X"></typeparam>
''' <typeparam name=" X " />
''' <typeparam name="Y"></typeparam>
''' <typeparam name="X"></typeparam>
''' <summary cref="a B "/>
''' <summary cref=" a b "/>
Public Class C(Of X, Y)
''' <include file=" a.vb" path=" c:\ww "/>
''' <include path="c:\ww" file="a.vb"/>
Public FLD As String
''' <mysummary cref="SSS"></mysummary>
Public FLD2 As String
''' <param name="x"></param>
''' <param name="x"></param>
Public Sub SSS(x As Integer)
End Sub
''' <remarks x=" A" y="" z = "B"></remarks>
''' <remarks y="" z = "B" x="A "/>
''' <remarks y=" " z = "B" x="a"/>
''' <remarks y=" " x="A" z = "B"/>
Public F As Integer
''' <returns what="a"></returns>
''' <returns what="b"></returns>
''' <returns what=" b "/>
Public Shared Operator -(a As C(Of X, Y), b As Integer) As C(Of X, Y)
Return Nothing
End Operator
''' <permission cref="System.Security.PermissionSet"/>
''' <permission cref="System.Security.PermissionSet "></permission>
''' <permission cref="System.Security. PermissionSet"></permission>
Public Shared Narrowing Operator CType(a As C(Of X, Y)) As Integer
Return Nothing
End Operator
End Class
''' <remarks x=" A" y=""></remarks>
''' <remarks y="" x="A "/>
Module M
''' <remarks></remarks>
''' <remarks/>
''' <param name="x"></param>
''' <param name="x"></param>
Public Event A(x As Integer, x As Integer)
''' <param name="a" noname="b"></param>
''' <param noname=" b " name="a"></param>
''' <value></value>
''' <value/>
Public WriteOnly Property PROP(a As String) As String
Set(value As String)
End Set
End Property
End Module
]]>
</file>
</compilation>,
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:C`2">
<summary cref="!:a b">
</summary>
<typeparam name="X"></typeparam>
<typeparam name=" X " />
<typeparam name="Y"></typeparam>
<typeparam name="X"></typeparam>
<summary cref="!:a B "/>
<summary cref="!: a b "/>
</member>
<member name="F:C`2.FLD">
<!--warning BC42321: Unable to include XML fragment ' c:\ww ' of file ' a.vb'. File not found.-->
<!--warning BC42321: Unable to include XML fragment 'c:\ww' of file 'a.vb'. File not found.-->
</member>
<member name="F:C`2.FLD2">
<mysummary cref="M:C`2.SSS(System.Int32)"></mysummary>
</member>
<member name="M:C`2.SSS(System.Int32)">
<param name="x"></param>
<param name="x"></param>
</member>
<member name="F:C`2.F">
<remarks x=" A" y="" z = "B"></remarks>
<remarks y="" z = "B" x="A "/>
<remarks y=" " z = "B" x="a"/>
<remarks y=" " x="A" z = "B"/>
</member>
<member name="M:C`2.op_Subtraction(C{`0,`1},System.Int32)">
<returns what="a"></returns>
<returns what="b"></returns>
<returns what=" b "/>
</member>
<member name="M:C`2.op_Explicit(C{`0,`1})~System.Int32">
<permission cref="T:System.Security.PermissionSet"/>
<permission cref="T:System.Security.PermissionSet"></permission>
<permission cref="T:System.Security.PermissionSet"></permission>
</member>
<member name="T:M">
<remarks x=" A" y=""></remarks>
<remarks y="" x="A "/>
</member>
<member name="E:M.A">
<remarks></remarks>
<remarks/>
<param name="x"></param>
<param name="x"></param>
</member>
<member name="P:M.PROP(System.String)">
<param name="a" noname="b"></param>
<param noname=" b " name="a"></param>
<value></value>
<value/>
</member>
</members>
</doc>
]]>
</xml>, withDiagnostics:=False, ensureEnglishUICulture:=True)
End Sub
<Fact>
Public Sub ByRefByValOverloading()
CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Structure TestStruct
''' <see cref="S1(ByVal TestStruct)"/>
''' <see cref="S1(ByRef TestStruct)"/>
''' <see cref="S2(ByVal TestStruct)"/>
''' <see cref="S2(ByRef TestStruct)"/>
Public Shared field As Integer
Public Sub S1(i As TestStruct)
End Sub
Public Sub S2(ByRef i As TestStruct)
End Sub
End Structure
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'S1(ByRef TestStruct)' that could not be resolved.
''' <see cref="S1(ByRef TestStruct)"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'S2(ByVal TestStruct)' that could not be resolved.
''' <see cref="S2(ByVal TestStruct)"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="F:TestStruct.field">
<see cref="M:TestStruct.S1(TestStruct)"/>
<see cref="!:S1(ByRef TestStruct)"/>
<see cref="!:S2(ByVal TestStruct)"/>
<see cref="M:TestStruct.S2(TestStruct@)"/>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<WorkItem(751828, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/751828")>
<Fact()>
Public Sub GetSymbolInfo_Bug_751828()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Option Explicit On
Imports System
Imports <xmlns="http://www.w3.org/2005/Atom">
Public Class C
End Class
]]>
</file>
</compilation>, <error></error>)
Dim tree = compilation.SyntaxTrees(0)
Dim names = FindNodesOfTypeFromText(Of XmlStringSyntax)(tree, "http://www.w3.org/2005/Atom").ToArray()
Assert.Equal(1, names.Length)
Dim model = compilation.GetSemanticModel(tree)
Dim expSymInfo1 = model.GetSymbolInfo(names(0))
Assert.True(expSymInfo1.IsEmpty)
End Sub
<WorkItem(768639, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/768639")>
<Fact()>
Public Sub GetSymbolInfo_Bug_768639a()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Interface I
Sub Bar()
End Interface
MustInherit Class C
Public MustOverride Sub Bar()
End Class
Class B : Inherits C : Implements I
''' <see cref="Bar"/>
Public Overrides Sub Bar() Implements I.Bar
End Sub
End Class
]]>
</file>
</compilation>, <error></error>)
Dim tree = compilation.SyntaxTrees(0)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "Bar").ToArray()
Assert.Equal(2, names.Length)
Dim model = compilation.GetSemanticModel(tree)
Dim expSymInfo1 = model.GetSymbolInfo(names(0))
Assert.NotNull(expSymInfo1.Symbol)
End Sub
<WorkItem(768639, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/768639")>
<Fact()>
Public Sub GetSymbolInfo_Bug_768639b()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
MustInherit Class C
Public MustOverride Property PPP
End Class
Class B : Inherits C
''' <see cref="PPP"/>
Public Overrides Property PPP As Object
Get
Return Nothing
End Get
Set(value As Object)
End Set
End Property
End Class
]]>
</file>
</compilation>, <error></error>)
Dim tree = compilation.SyntaxTrees(0)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "PPP").ToArray()
Assert.Equal(1, names.Length)
Dim model = compilation.GetSemanticModel(tree)
Dim expSymInfo1 = model.GetSymbolInfo(names(0))
Assert.NotNull(expSymInfo1.Symbol)
End Sub
<WorkItem(768639, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/768639")>
<Fact()>
Public Sub GetSymbolInfo_Bug_768639c()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Interface I
Sub Bar()
End Interface
MustInherit Class C
Public MustOverride Sub Bar()
End Class
Class B : Inherits C : Implements I
''' <see cref="Bar()"/>
Public Overrides Sub Bar() Implements I.Bar
End Sub
End Class
]]>
</file>
</compilation>, <error></error>)
Dim tree = compilation.SyntaxTrees(0)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "Bar").ToArray()
Assert.Equal(2, names.Length)
Dim model = compilation.GetSemanticModel(tree)
Dim expSymInfo1 = model.GetSymbolInfo(names(0))
Assert.NotNull(expSymInfo1.Symbol)
End Sub
<WorkItem(768639, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/768639")>
<Fact()>
Public Sub GetSymbolInfo_Bug_768639d()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
MustInherit Class C
Public MustOverride Property PPP
End Class
Class B : Inherits C
''' <see cref="PPP()"/>
Public Overrides Property PPP As Object
Get
Return Nothing
End Get
Set(value As Object)
End Set
End Property
End Class
]]>
</file>
</compilation>, <error></error>)
Dim tree = compilation.SyntaxTrees(0)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "PPP").ToArray()
Assert.Equal(1, names.Length)
Dim model = compilation.GetSemanticModel(tree)
Dim expSymInfo1 = model.GetSymbolInfo(names(0))
Assert.NotNull(expSymInfo1.Symbol)
End Sub
<Fact()>
Public Sub GetSymbolInfo_PredefinedTypeSyntax_UShort()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Option Explicit On
Imports System
''' <see cref="UShort"/>
''' <see cref="UShort.ToString()S"/>
Public Class C
End Class
]]>
</file>
</compilation>,
<error></error>)
Dim tree = compilation.SyntaxTrees(0)
Dim names = FindNodesOfTypeFromText(Of PredefinedTypeSyntax)(tree, "UShort").ToArray()
Assert.Equal(2, names.Length)
Dim model = compilation.GetSemanticModel(tree)
TestSymbolAndTypeInfoForType(model, names(0), compilation.GetSpecialType(SpecialType.System_UInt16))
TestSymbolAndTypeInfoForType(model, names(1), compilation.GetSpecialType(SpecialType.System_UInt16))
End Sub
<Fact()>
Public Sub GetSymbolInfo_PredefinedTypeSyntax_String()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Option Explicit On
Imports System
''' <see cref="String"/>
''' <see cref="String.GetHashCode()S"/>
Public Class C
End Class
]]>
</file>
</compilation>,
<error></error>)
Dim tree = compilation.SyntaxTrees(0)
Dim names = FindNodesOfTypeFromText(Of PredefinedTypeSyntax)(tree, "String").ToArray()
Assert.Equal(2, names.Length)
Dim model = compilation.GetSemanticModel(tree)
TestSymbolAndTypeInfoForType(model, names(0), compilation.GetSpecialType(SpecialType.System_String))
TestSymbolAndTypeInfoForType(model, names(1), compilation.GetSpecialType(SpecialType.System_String))
End Sub
<Fact()>
Public Sub GetSymbolInfo_NameSyntax_Type()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Option Explicit On
Imports System
Public Class C(Of X)
End Class
''' <see cref="Y"/> ' failed in dev11
''' <see cref="S"/> ' failed in dev11
Public Class C(Of X, Y)
Public FLD As String
''' <see cref="X"/>
''' <see cref="T"/>
''' <see cref="C"/>
''' <see cref="C(of x)"/>
''' <see cref="C(of x, y)"/>
''' <see cref="C(of x, y).s"/>
Public Shared Sub S(Of T)()
C(Of X, Y).S(Of Integer)()
Dim a As C(Of X, Y) = Nothing
Dim b As C(Of X) = Nothing
End Sub
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42375: XML comment has a tag with a 'cref' attribute 'Y' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <see cref="Y"/> ' failed in dev11
~~~~~~~~
BC42375: XML comment has a tag with a 'cref' attribute 'X' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <see cref="X"/>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'T' that could not be resolved.
''' <see cref="T"/>
~~~~~~~~
]]>
</error>)
Dim tree = compilation.SyntaxTrees(0)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "C").ToArray()
Assert.Equal(7, names.Length)
Dim model = compilation.GetSemanticModel(tree)
Dim expSymInfo1 = model.GetSymbolInfo(names(4))
Assert.NotNull(expSymInfo1.Symbol)
TestSymbolAndTypeInfoForType(model, names(5), expSymInfo1.Symbol.OriginalDefinition)
Dim expSymInfo3 = model.GetSymbolInfo(names(6))
Assert.NotNull(expSymInfo3.Symbol)
Assert.NotSame(expSymInfo1.Symbol.OriginalDefinition, expSymInfo3.Symbol.OriginalDefinition)
Dim actSymInfo1 = model.GetSymbolInfo(names(0))
Assert.Equal(CandidateReason.Ambiguous, actSymInfo1.CandidateReason)
Assert.Equal(2, actSymInfo1.CandidateSymbols.Length)
Dim list = actSymInfo1.CandidateSymbols.ToArray()
Array.Sort(list, Function(x As ISymbol, y As ISymbol) compilation.CompareSourceLocations(x.Locations(0), y.Locations(0)))
Assert.Same(expSymInfo3.Symbol.OriginalDefinition, list(0).OriginalDefinition)
Assert.Same(expSymInfo1.Symbol.OriginalDefinition, list(1).OriginalDefinition)
TestSymbolAndTypeInfoForType(model, names(1), expSymInfo3.Symbol.OriginalDefinition)
TestSymbolAndTypeInfoForType(model, names(2), expSymInfo1.Symbol.OriginalDefinition)
TestSymbolAndTypeInfoForType(model, names(3), expSymInfo1.Symbol.OriginalDefinition)
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "X").ToArray()
Assert.Equal(4, names.Length)
Dim typeParamSymInfo = model.GetSymbolInfo(names(0))
Assert.Null(typeParamSymInfo.Symbol)
Assert.Equal(SymbolKind.TypeParameter, typeParamSymInfo.CandidateSymbols.Single().Kind)
Assert.Equal(CandidateReason.NotReferencable, typeParamSymInfo.CandidateReason)
End Sub
<Fact()>
Public Sub GetSymbolInfo_NameSyntax()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Option Explicit On
Imports System
Class OuterClass
Public Class C(Of X)
End Class
Public Class C(Of X, Y)
Public F As Integer
End Class
End Class
Public Class OtherClass
''' <see cref="OuterClass.C"/>
''' <see cref="OuterClass.C(of x)"/>
''' <see cref="OuterClass.C(of x, y)"/>
''' <see cref="OuterClass.C(of x, y).f"/>
''' <see cref="OuterClass.C(of x, y).X"/>
Public Shared Sub S(Of T)()
End Sub
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'OuterClass.C(of x, y).X' that could not be resolved.
''' <see cref="OuterClass.C(of x, y).X"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</error>)
Dim tree = compilation.SyntaxTrees(0)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "C").ToArray()
Assert.Equal(5, names.Length)
Dim model = compilation.GetSemanticModel(tree)
CheckSymbolInfoAndTypeInfo(model, names(0), "OuterClass.C(Of X)", "OuterClass.C(Of X, Y)")
CheckSymbolInfoAndTypeInfo(model, names(1), "OuterClass.C(Of x)")
CheckSymbolInfoAndTypeInfo(model, names(2), "OuterClass.C(Of x, y)")
CheckSymbolInfoAndTypeInfo(model, names(3), "OuterClass.C(Of x, y)")
CheckSymbolInfoAndTypeInfo(model, names(4), "OuterClass.C(Of x, y)")
End Sub
<Fact()>
Public Sub GetSymbolInfo_LegacyMode_1()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Option Explicit On
Imports System
Public Class OtherClass
''' <see cref="New"/>
''' <see cref="OtherClass.New"/>
''' <see cref="Operator"/>
''' <see cref="Operator+"/>
''' <see cref="OtherClass.Operator"/>
''' <see cref="OtherClass.Operator+"/>
Public Shared Sub S(Of T)()
End Sub
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'New' that could not be resolved.
''' <see cref="New"/>
~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'OtherClass.New' that could not be resolved.
''' <see cref="OtherClass.New"/>
~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Operator' that could not be resolved.
''' <see cref="Operator"/>
~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Operator+' that could not be resolved.
''' <see cref="Operator+"/>
~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'OtherClass.Operator' that could not be resolved.
''' <see cref="OtherClass.Operator"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'OtherClass.Operator+' that could not be resolved.
''' <see cref="OtherClass.Operator+"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</error>)
Dim tree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "New").ToArray()
Assert.Equal(2, names.Length)
CheckSymbolInfoAndTypeInfo(model, names(0))
CheckSymbolInfoAndTypeInfo(model, names(1))
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "OtherClass").ToArray()
Assert.Equal(3, names.Length)
CheckSymbolInfoAndTypeInfo(model, names(0), "OtherClass")
CheckSymbolInfoAndTypeInfo(model, names(1), "OtherClass")
CheckSymbolInfoAndTypeInfo(model, names(2), "OtherClass")
Dim crefOperator = FindNodesOfTypeFromText(Of CrefOperatorReferenceSyntax)(tree, "Operator").ToArray()
Assert.Equal(4, crefOperator.Length)
CheckSymbolInfoAndTypeInfo(model, crefOperator(0))
CheckSymbolInfoAndTypeInfo(model, crefOperator(1))
CheckSymbolInfoAndTypeInfo(model, crefOperator(2))
CheckSymbolInfoAndTypeInfo(model, crefOperator(3))
End Sub
<Fact()>
Public Sub GetSymbolInfo_LegacyMode_2()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Option Explicit On
Imports System
Public Class OtherClass
''' <see cref="New
Public Shared Sub S0(Of T)()
End Sub
''' <see cref="OtherClass.New
Public Shared Sub S1(Of T)()
End Sub
''' <see cref="Operator
Public Shared Sub S2(Of T)()
End Sub
''' <see cref="Operator+
Public Shared Sub S3(Of T)()
End Sub
''' <see cref="OtherClass.Operator
Public Shared Sub S4(Of T)()
End Sub
''' <see cref="OtherClass.Operator+
Public Shared Sub S5(Of T)()
End Sub
End Class
]]>
</file>
</compilation>,
<error>
<![CDATA[
BC42304: XML documentation parse error: Element is missing an end tag. XML comment will be ignored.
''' <see cref="New
~~~~~~~~~~~~~~~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
Public Shared Sub S0(Of T)()
~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
Public Shared Sub S0(Of T)()
~
BC42304: XML documentation parse error: Expected beginning '<' for an XML tag. XML comment will be ignored.
Public Shared Sub S0(Of T)()
~
BC42304: XML documentation parse error: Element is missing an end tag. XML comment will be ignored.
''' <see cref="OtherClass.New
~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
Public Shared Sub S1(Of T)()
~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
Public Shared Sub S1(Of T)()
~
BC42304: XML documentation parse error: Expected beginning '<' for an XML tag. XML comment will be ignored.
Public Shared Sub S1(Of T)()
~
BC42304: XML documentation parse error: Element is missing an end tag. XML comment will be ignored.
''' <see cref="Operator
~~~~~~~~~~~~~~~~~~~~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
Public Shared Sub S2(Of T)()
~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
Public Shared Sub S2(Of T)()
~
BC42304: XML documentation parse error: Expected beginning '<' for an XML tag. XML comment will be ignored.
Public Shared Sub S2(Of T)()
~
BC42304: XML documentation parse error: Element is missing an end tag. XML comment will be ignored.
''' <see cref="Operator+
~~~~~~~~~~~~~~~~~~~~~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
Public Shared Sub S3(Of T)()
~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
Public Shared Sub S3(Of T)()
~
BC42304: XML documentation parse error: Expected beginning '<' for an XML tag. XML comment will be ignored.
Public Shared Sub S3(Of T)()
~
BC42304: XML documentation parse error: Element is missing an end tag. XML comment will be ignored.
''' <see cref="OtherClass.Operator
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
Public Shared Sub S4(Of T)()
~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
Public Shared Sub S4(Of T)()
~
BC42304: XML documentation parse error: Expected beginning '<' for an XML tag. XML comment will be ignored.
Public Shared Sub S4(Of T)()
~
BC42304: XML documentation parse error: Element is missing an end tag. XML comment will be ignored.
''' <see cref="OtherClass.Operator+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
Public Shared Sub S5(Of T)()
~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
Public Shared Sub S5(Of T)()
~
BC42304: XML documentation parse error: Expected beginning '<' for an XML tag. XML comment will be ignored.
Public Shared Sub S5(Of T)()
~
]]>
</error>)
Dim tree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "New").ToArray()
Assert.Equal(2, names.Length)
CheckSymbolInfoAndTypeInfo(model, names(0))
CheckSymbolInfoAndTypeInfo(model, names(1))
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "OtherClass").ToArray()
Assert.Equal(3, names.Length)
CheckSymbolInfoAndTypeInfo(model, names(0), "OtherClass")
CheckSymbolInfoAndTypeInfo(model, names(1), "OtherClass")
CheckSymbolInfoAndTypeInfo(model, names(2), "OtherClass")
Dim crefOperator = FindNodesOfTypeFromText(Of CrefOperatorReferenceSyntax)(tree, "Operator").ToArray()
Assert.Equal(4, crefOperator.Length)
CheckSymbolInfoAndTypeInfo(model, crefOperator(0))
CheckSymbolInfoAndTypeInfo(model, crefOperator(1))
CheckSymbolInfoAndTypeInfo(model, crefOperator(2))
CheckSymbolInfoAndTypeInfo(model, crefOperator(3))
End Sub
<Fact()>
Public Sub GetSymbolInfo_NameSyntax_Method_1()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class C(Of X)
Public Shared Sub Sub1(a As Integer)
End Sub
Public Shared Sub Sub1(a As Integer, b As Integer)
End Sub
End Class
''' <see cref="C.Sub1"/>
''' <see cref="C.Sub1(Of A)"/>
''' <see cref="C.Sub1(Of A, B)"/>
Public Class OtherClass
End Class
]]>
</file>
</compilation>,
<errors>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'C.Sub1(Of A)' that could not be resolved.
''' <see cref="C.Sub1(Of A)"/>
~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'C.Sub1(Of A, B)' that could not be resolved.
''' <see cref="C.Sub1(Of A, B)"/>
~~~~~~~~~~~~~~~~~~~~~~
]]>
</errors>)
Dim tree = compilation.SyntaxTrees(0)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "C").ToArray()
Assert.Equal(3, names.Length)
Dim model = compilation.GetSemanticModel(tree)
CheckSymbolInfoOnly(model,
DirectCast(names(0).Parent, ExpressionSyntax),
"Sub C(Of X).Sub1(a As System.Int32)",
"Sub C(Of X).Sub1(a As System.Int32, b As System.Int32)")
CheckSymbolInfoOnly(model, DirectCast(names(1).Parent, ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(2).Parent, ExpressionSyntax))
End Sub
<Fact()>
Public Sub GetSymbolInfo_NameSyntax_Method_2()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class C(Of X)
Public Shared Sub Sub1(a As Integer)
End Sub
Public Shared Sub Sub1(Of Y)(a As Integer)
End Sub
End Class
''' <see cref="C.Sub1"/>
''' <see cref="C.Sub1(Of A)"/>
''' <see cref="C.Sub1(Of A, B)"/>
Public Class OtherClass
End Class
]]>
</file>
</compilation>,
<errors>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'C.Sub1(Of A, B)' that could not be resolved.
''' <see cref="C.Sub1(Of A, B)"/>
~~~~~~~~~~~~~~~~~~~~~~
]]>
</errors>)
Dim tree = compilation.SyntaxTrees(0)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "C").ToArray()
Assert.Equal(3, names.Length)
Dim model = compilation.GetSemanticModel(tree)
CheckSymbolInfoOnly(model,
DirectCast(names(0).Parent, ExpressionSyntax),
"Sub C(Of X).Sub1(a As System.Int32)")
CheckSymbolInfoOnly(model,
DirectCast(names(1).Parent, ExpressionSyntax),
"Sub C(Of X).Sub1(Of A)(a As System.Int32)")
CheckSymbolInfoOnly(model, DirectCast(names(2).Parent, ExpressionSyntax))
End Sub
<Fact()>
Public Sub GetSymbolInfo_NameSyntax_Method_3()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class C(Of X)
Public Shared Sub Sub1(Of Y, Z)(a As Integer)
End Sub
Public Shared Sub Sub1(Of Y)(a As Integer)
End Sub
End Class
''' <see cref="C.Sub1"/>
''' <see cref="C.Sub1(Of A)"/>
''' <see cref="C.Sub1(Of A, B)"/>
Public Class OtherClass
End Class
]]>
</file>
</compilation>,
<errors></errors>)
Dim tree = compilation.SyntaxTrees(0)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "C").ToArray()
Assert.Equal(3, names.Length)
Dim model = compilation.GetSemanticModel(tree)
CheckSymbolInfoOnly(model,
DirectCast(names(0).Parent, ExpressionSyntax),
"Sub C(Of X).Sub1(Of Y)(a As System.Int32)",
"Sub C(Of X).Sub1(Of Y, Z)(a As System.Int32)")
CheckSymbolInfoOnly(model,
DirectCast(names(1).Parent, ExpressionSyntax),
"Sub C(Of X).Sub1(Of A)(a As System.Int32)")
CheckSymbolInfoOnly(model,
DirectCast(names(2).Parent, ExpressionSyntax),
"Sub C(Of X).Sub1(Of A, B)(a As System.Int32)")
End Sub
<Fact()>
Public Sub GetSymbolInfo_NameSyntax_Event_Field_Property()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class C(Of X)
Public ReadOnly Property Prop1(a As Integer) As String
Get
Return Nothing
End Get
End Property
Public Property Prop1 As String
Public Event Ev1 As Action
Public Dim Fld As String
End Class
''' <see cref="C.Fld"/>
''' <see cref="C.Fld(Of Integer)"/>
''' <see cref="C.Ev1"/>
''' <see cref="C.Ev1(Of X)"/>
''' <see cref="C.Prop1"/>
''' <see cref="C.Prop1(Of A)"/>
Public Class OtherClass
End Class
]]>
</file>
</compilation>,
<errors>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'C.Fld(Of Integer)' that could not be resolved.
''' <see cref="C.Fld(Of Integer)"/>
~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'C.Ev1(Of X)' that could not be resolved.
''' <see cref="C.Ev1(Of X)"/>
~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'C.Prop1(Of A)' that could not be resolved.
''' <see cref="C.Prop1(Of A)"/>
~~~~~~~~~~~~~~~~~~~~
]]>
</errors>)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "C")
Assert.Equal(6, names.Length)
Dim model = compilation.GetSemanticModel(tree)
CheckSymbolInfoOnly(model,
DirectCast(names(0).Parent, ExpressionSyntax),
"C(Of X).Fld As System.String")
CheckSymbolInfoOnly(model, DirectCast(names(1).Parent, ExpressionSyntax))
CheckSymbolInfoOnly(model,
DirectCast(names(2).Parent, ExpressionSyntax),
"Event C(Of X).Ev1 As System.Action")
CheckSymbolInfoOnly(model, DirectCast(names(3).Parent, ExpressionSyntax))
CheckSymbolInfoOnly(model,
DirectCast(names(4).Parent, ExpressionSyntax),
"Property C(Of X).Prop1 As System.String",
"ReadOnly Property C(Of X).Prop1(a As System.Int32) As System.String")
CheckSymbolInfoOnly(model, DirectCast(names(5).Parent, ExpressionSyntax))
End Sub
<Fact()>
Public Sub SemanticInfo_InsideCref()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class Clazz(Of T)
''' <see cref="X(Of T, T(Of T, X, InnerClazz(Of X)))"/>
Public Class InnerClazz(Of X)
End Class
End Class
]]>
</file>
</compilation>,
<errors>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'X(Of T, T(Of T, X, InnerClazz(Of X)))' that could not be resolved.
''' <see cref="X(Of T, T(Of T, X, InnerClazz(Of X)))"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</errors>)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "InnerClazz")
Assert.Equal(1, names.Length)
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(0), ExpressionSyntax), "Clazz(Of T).InnerClazz(Of X)")
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "T")
Assert.Equal(3, names.Length)
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(0), ExpressionSyntax), "T")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(1), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(2), ExpressionSyntax), "T")
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "X")
Assert.Equal(3, names.Length)
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(0), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(1), ExpressionSyntax), "X") ' Did not bind in dev11.
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(2), ExpressionSyntax), "X") ' Did not bind in dev11.
End Sub
<Fact()>
Public Sub SemanticInfo_InsideParam()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary><param name="a" nested="true">@OuterClass(Of X)</param></summary>
''' <param name="a">@OuterClass(Of X)</param>
Public MustInherit Class OuterClass(Of X)
''' <summary><param name="a" nested="true">@F</param></summary>
''' <param name="a">@F</param>
Public F As String
''' <summary><param name="a" nested="true">@S(Of T)</param></summary>
''' <param name="a">@S(Of T)</param>
Public Shared Sub S(Of T)(a As Integer)
End Sub
''' <summary><param name="a" nested="true">@FUN(Of T)</param></summary>
''' <param name="a">@FUN(Of T)</param>
Public MustOverride Function FUN(Of T)(a As T) As String
''' <summary><param name="a" nested="true">@Operator +</param></summary>
''' <param name="a">@Operator +</param>
Public Shared Operator +(a As OuterClass(Of X), b As Integer) As Integer
Return Nothing
End Operator
''' <summary><param name="a" nested="true">@Operator CType</param></summary>
''' <param name="a">@Operator CType</param>
Public Shared Narrowing Operator CType(a As Integer) As OuterClass(Of X)
Return Nothing
End Operator
''' <summary><param name="obj" nested="true">@E</param></summary>
''' <param name="obj">@E</param>
Public Event E As Action(Of Integer)
''' <summary><param name="a" nested="true">@E2</param></summary>
''' <param name="a">@E2</param>
Public Event E2(a As Integer)
''' <summary><param name="a" nested="true">@P</param></summary>
''' <param name="a">@P</param>
Property P As String
''' <summary><param name="a" nested="true">@P(a As String)</param></summary>
''' <param name="a">@P(a As String)</param>
ReadOnly Property P(a As String) As String
Get
Return Nothing
End Get
End Property
''' <summary><param name="a" nested="true">@D(a As Integer)</param></summary>
''' <param name="a">@D(a As Integer)</param>
Public Delegate Function D(a As Integer) As String
''' <summary><param name="a" nested="true">@SD(a As Integer)</param></summary>
''' <param name="a">@SD(a As Integer)</param>
Public Delegate Sub SD(a As Integer)
''' <summary><param name="a" nested="true">@ENM</param></summary>
''' <param name="a">@ENM</param>
Public Enum ENM
''' <summary><param name="a" nested="true">@DefaultValue</param></summary>
''' <param name="a">@DefaultValue</param>
DefaultValue
End Enum
''' <summary><param name="a" nested="true">@INT(Of INTT)</param></summary>
''' <param name="a">@INT(Of INTT)</param>
Public Interface INT(Of INTT)
''' <summary><param name="a" nested="true">@INTS(a As Integer)</param></summary>
''' <param name="a">@INTS(a As Integer)</param>
Sub INTS(a As Integer)
End Interface
End Class
''' <param name="a" nested="true">@M0</param>
''' <summary><param name="a">@M0</param></summary>
Public Module M0
Public a As Integer
End Module
]]>
</file>
</compilation>,
<errors>
<![CDATA[
BC42306: XML comment tag 'param' is not permitted on a 'class' language element.
''' <summary><param name="a" nested="true">@OuterClass(Of X)</param></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'param' is not permitted on a 'class' language element.
''' <param name="a">@OuterClass(Of X)</param>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'param' is not permitted on a 'variable' language element.
''' <summary><param name="a" nested="true">@F</param></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'param' is not permitted on a 'variable' language element.
''' <param name="a">@F</param>
~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42307: XML comment parameter 'a' does not match a parameter on the corresponding 'property' statement.
''' <summary><param name="a" nested="true">@P</param></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42307: XML comment parameter 'a' does not match a parameter on the corresponding 'property' statement.
''' <param name="a">@P</param>
~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'param' is not permitted on a 'enum' language element.
''' <summary><param name="a" nested="true">@ENM</param></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'param' is not permitted on a 'enum' language element.
''' <param name="a">@ENM</param>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'param' is not permitted on a 'variable' language element.
''' <summary><param name="a" nested="true">@DefaultValue</param></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'param' is not permitted on a 'variable' language element.
''' <param name="a">@DefaultValue</param>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'param' is not permitted on a 'interface' language element.
''' <summary><param name="a" nested="true">@INT(Of INTT)</param></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'param' is not permitted on a 'interface' language element.
''' <param name="a">@INT(Of INTT)</param>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'param' is not permitted on a 'module' language element.
''' <param name="a" nested="true">@M0</param>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'param' is not permitted on a 'module' language element.
''' <summary><param name="a">@M0</param></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</errors>)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "obj")
Assert.Equal(2, names.Length)
CheckSymbolInfoOnly(model, DirectCast(names(0), ExpressionSyntax), "obj As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(1), ExpressionSyntax), "obj As System.Int32")
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "a")
Assert.Equal(32, names.Length)
CheckSymbolInfoOnly(model, DirectCast(names(0), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(1), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(2), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(3), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(4), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(5), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(6), ExpressionSyntax), "a As T")
CheckSymbolInfoOnly(model, DirectCast(names(7), ExpressionSyntax), "a As T")
CheckSymbolInfoOnly(model, DirectCast(names(8), ExpressionSyntax), "a As OuterClass(Of X)")
CheckSymbolInfoOnly(model, DirectCast(names(9), ExpressionSyntax), "a As OuterClass(Of X)")
CheckSymbolInfoOnly(model, DirectCast(names(10), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(11), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(12), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(13), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(14), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(15), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(16), ExpressionSyntax), "a As System.String")
CheckSymbolInfoOnly(model, DirectCast(names(17), ExpressionSyntax), "a As System.String")
CheckSymbolInfoOnly(model, DirectCast(names(18), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(19), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(20), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(21), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(22), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(23), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(24), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(25), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(26), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(27), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(28), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(29), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(30), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(31), ExpressionSyntax))
End Sub
<Fact()>
Public Sub SemanticInfo_InsideParamRef()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary><paramref name="a" nested="true">@OuterClass(Of X)</paramref></summary>
''' <paramref name="a">@OuterClass(Of X)</paramref>
Public MustInherit Class OuterClass(Of X)
''' <summary><paramref name="a" nested="true">@F</paramref></summary>
''' <paramref name="a">@F</paramref>
Public F As String
''' <summary><paramref name="a" nested="true">@S(Of T)</paramref></summary>
''' <paramref name="a">@S(Of T)</paramref>
Public Shared Sub S(Of T)(a As Integer)
End Sub
''' <summary><paramref name="a" nested="true">@FUN(Of T)</paramref></summary>
''' <paramref name="a">@FUN(Of T)</paramref>
Public MustOverride Function FUN(Of T)(a As T) As String
''' <summary><paramref name="a" nested="true">@Operator +</paramref></summary>
''' <paramref name="a">@Operator +</paramref>
Public Shared Operator +(a As OuterClass(Of X), b As Integer) As Integer
Return Nothing
End Operator
''' <summary><paramref name="a" nested="true">@Operator CType</paramref></summary>
''' <paramref name="a">@Operator CType</paramref>
Public Shared Narrowing Operator CType(a As Integer) As OuterClass(Of X)
Return Nothing
End Operator
''' <summary><paramref name="obj" nested="true">@E</paramref></summary>
''' <paramref name="obj">@E</paramref>
Public Event E As Action(Of Integer)
''' <summary><paramref name="a" nested="true">@E2</paramref></summary>
''' <paramref name="a">@E2</paramref>
Public Event E2(a As Integer)
''' <summary><paramref name="a" nested="true">@P</paramref></summary>
''' <paramref name="a">@P</paramref>
Property P As String
''' <summary><paramref name="a" nested="true">@P(a As String)</paramref></summary>
''' <paramref name="a">@P(a As String)</paramref>
ReadOnly Property P(a As String) As String
Get
Return Nothing
End Get
End Property
''' <summary><paramref name="a" nested="true">@D(a As Integer)</paramref></summary>
''' <paramref name="a">@D(a As Integer)</paramref>
Public Delegate Function D(a As Integer) As String
''' <summary><paramref name="a" nested="true">@SD(a As Integer)</paramref></summary>
''' <paramref name="a">@SD(a As Integer)</paramref>
Public Delegate Sub SD(a As Integer)
''' <summary><paramref name="a" nested="true">@ENM</paramref></summary>
''' <paramref name="a">@ENM</paramref>
Public Enum ENM
''' <summary><paramref name="a" nested="true">@DefaultValue</paramref></summary>
''' <paramref name="a">@DefaultValue</paramref>
DefaultValue
End Enum
''' <summary><paramref name="a" nested="true">@INT(Of INTT)</paramref></summary>
''' <paramref name="a">@INT(Of INTT)</paramref>
Public Interface INT(Of INTT)
''' <summary><paramref name="a" nested="true">@INTS(a As Integer)</paramref></summary>
''' <paramref name="a">@INTS(a As Integer)</paramref>
Sub INTS(a As Integer)
End Interface
End Class
''' <paramref name="a" nested="true">@M0</paramref>
''' <summary><paramref name="a">@M0</paramref></summary>
Public Module M0
Public a As Integer
End Module
]]>
</file>
</compilation>,
<errors>
<![CDATA[
BC42306: XML comment tag 'paramref' is not permitted on a 'class' language element.
''' <summary><paramref name="a" nested="true">@OuterClass(Of X)</paramref></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'paramref' is not permitted on a 'class' language element.
''' <paramref name="a">@OuterClass(Of X)</paramref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'paramref' is not permitted on a 'variable' language element.
''' <summary><paramref name="a" nested="true">@F</paramref></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'paramref' is not permitted on a 'variable' language element.
''' <paramref name="a">@F</paramref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42307: XML comment parameter 'a' does not match a parameter on the corresponding 'property' statement.
''' <summary><paramref name="a" nested="true">@P</paramref></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42307: XML comment parameter 'a' does not match a parameter on the corresponding 'property' statement.
''' <paramref name="a">@P</paramref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'paramref' is not permitted on a 'enum' language element.
''' <summary><paramref name="a" nested="true">@ENM</paramref></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'paramref' is not permitted on a 'enum' language element.
''' <paramref name="a">@ENM</paramref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'paramref' is not permitted on a 'variable' language element.
''' <summary><paramref name="a" nested="true">@DefaultValue</paramref></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'paramref' is not permitted on a 'variable' language element.
''' <paramref name="a">@DefaultValue</paramref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'paramref' is not permitted on a 'interface' language element.
''' <summary><paramref name="a" nested="true">@INT(Of INTT)</paramref></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'paramref' is not permitted on a 'interface' language element.
''' <paramref name="a">@INT(Of INTT)</paramref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'paramref' is not permitted on a 'module' language element.
''' <paramref name="a" nested="true">@M0</paramref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'paramref' is not permitted on a 'module' language element.
''' <summary><paramref name="a">@M0</paramref></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</errors>)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "obj")
Assert.Equal(2, names.Length)
CheckSymbolInfoOnly(model, DirectCast(names(0), ExpressionSyntax), "obj As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(0), ExpressionSyntax), "obj As System.Int32")
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "a")
Assert.Equal(32, names.Length)
CheckSymbolInfoOnly(model, DirectCast(names(0), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(1), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(2), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(3), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(4), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(5), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(6), ExpressionSyntax), "a As T")
CheckSymbolInfoOnly(model, DirectCast(names(7), ExpressionSyntax), "a As T")
CheckSymbolInfoOnly(model, DirectCast(names(8), ExpressionSyntax), "a As OuterClass(Of X)")
CheckSymbolInfoOnly(model, DirectCast(names(9), ExpressionSyntax), "a As OuterClass(Of X)")
CheckSymbolInfoOnly(model, DirectCast(names(10), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(11), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(12), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(13), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(14), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(15), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(16), ExpressionSyntax), "a As System.String")
CheckSymbolInfoOnly(model, DirectCast(names(17), ExpressionSyntax), "a As System.String")
CheckSymbolInfoOnly(model, DirectCast(names(18), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(19), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(20), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(21), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(22), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(23), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(24), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(25), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(26), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(27), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(28), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(29), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(30), ExpressionSyntax))
CheckSymbolInfoOnly(model, DirectCast(names(31), ExpressionSyntax))
End Sub
<Fact()>
Public Sub SemanticInfo_InsideTypeParam()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary><typeparam name="x" nested="true">@OuterClass(Of X)</typeparam></summary>
''' <typeparam name="x">@OuterClass(Of X)</typeparam>
Public MustInherit Class OuterClass(Of X)
''' <summary><typeparam name="x" nested="true">@F</typeparam></summary>
''' <typeparam name="x">@F</typeparam>
Public F As String
''' <summary><typeparam name="t" nested="true">@S(Of T)</typeparam></summary>
''' <typeparam name="t">@S(Of T)</typeparam>
Public Shared Sub S(Of T)(a As Integer)
End Sub
''' <summary><typeparam name="tt" nested="true">@FUN(Of T)</typeparam></summary>
''' <typeparam name="tt">@FUN(Of T)</typeparam>
Public MustOverride Function FUN(Of TT)(a As Integer) As String
''' <summary><typeparam name="x" nested="true">@Operator +</typeparam></summary>
''' <typeparam name="x">@Operator +</typeparam>
Public Shared Operator +(a As OuterClass(Of X), b As Integer) As Integer
Return Nothing
End Operator
''' <summary><typeparam name="x" nested="true">@Operator CType</typeparam></summary>
''' <typeparam name="x">@Operator CType</typeparam>
Public Shared Narrowing Operator CType(a As Integer) As OuterClass(Of X)
Return Nothing
End Operator
''' <summary><typeparam name="t" nested="true">@E</typeparam></summary>
''' <typeparam name="t">@E</typeparam>
Public Event E As Action(Of Integer)
''' <summary><typeparam name="x" nested="true">@E2</typeparam></summary>
''' <typeparam name="x">@E2</typeparam>
Public Event E2(a As Integer)
''' <summary><typeparam name="x" nested="true">@P</typeparam></summary>
''' <typeparam name="x">@P</typeparam>
Property P As String
''' <summary><typeparam name="x" nested="true">@P(a As String)</typeparam></summary>
''' <typeparam name="x">@P(a As String)</typeparam>
ReadOnly Property P(a As String) As String
Get
Return Nothing
End Get
End Property
''' <summary><typeparam name="tt" nested="true">@D(a As Integer)</typeparam></summary>
''' <typeparam name="tt">@D(a As Integer)</typeparam>
Public Delegate Function D(Of TT)(a As Integer) As String
''' <summary><typeparam name="t" nested="true">@SD(a As Integer)</typeparam></summary>
''' <typeparam name="t">@SD(a As Integer)</typeparam>
Public Delegate Sub SD(Of T)(a As Integer)
''' <summary><typeparam name="x" nested="true">@ENM</typeparam></summary>
''' <typeparam name="x">@ENM</typeparam>
Public Enum ENM
''' <summary><typeparam name="x" nested="true">@DefaultValue</typeparam></summary>
''' <typeparam name="x">@DefaultValue</typeparam>
DefaultValue
End Enum
''' <summary><typeparam name="tt" nested="true">@INT(Of TT)</typeparam></summary>
''' <typeparam name="tt">@INT(Of TT)</typeparam>
Public Interface INT(Of TT)
''' <summary><typeparam name="t" nested="true">@INTS(a As Integer)</typeparam></summary>
''' <typeparam name="t">@INTS(a As Integer)</typeparam>
Sub INTS(Of T)(a As Integer)
End Interface
End Class
''' <typeparam name="x" nested="true">@M0</typeparam>
''' <summary><typeparam name="x">@M0</typeparam></summary>
Public Module M0
Public a As Integer
End Module
]]>
</file>
</compilation>,
<errors>
<![CDATA[
BC42306: XML comment tag 'typeparam' is not permitted on a 'variable' language element.
''' <summary><typeparam name="x" nested="true">@F</typeparam></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'variable' language element.
''' <typeparam name="x">@F</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'operator' language element.
''' <summary><typeparam name="x" nested="true">@Operator +</typeparam></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'operator' language element.
''' <typeparam name="x">@Operator +</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42317: XML comment type parameter 'x' does not match a type parameter on the corresponding 'operator' statement.
''' <summary><typeparam name="x" nested="true">@Operator CType</typeparam></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42317: XML comment type parameter 'x' does not match a type parameter on the corresponding 'operator' statement.
''' <typeparam name="x">@Operator CType</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'event' language element.
''' <summary><typeparam name="t" nested="true">@E</typeparam></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'event' language element.
''' <typeparam name="t">@E</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'event' language element.
''' <summary><typeparam name="x" nested="true">@E2</typeparam></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'event' language element.
''' <typeparam name="x">@E2</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'property' language element.
''' <summary><typeparam name="x" nested="true">@P</typeparam></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'property' language element.
''' <typeparam name="x">@P</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'property' language element.
''' <summary><typeparam name="x" nested="true">@P(a As String)</typeparam></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'property' language element.
''' <typeparam name="x">@P(a As String)</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'enum' language element.
''' <summary><typeparam name="x" nested="true">@ENM</typeparam></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'enum' language element.
''' <typeparam name="x">@ENM</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'variable' language element.
''' <summary><typeparam name="x" nested="true">@DefaultValue</typeparam></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'variable' language element.
''' <typeparam name="x">@DefaultValue</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'module' language element.
''' <typeparam name="x" nested="true">@M0</typeparam>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparam' is not permitted on a 'module' language element.
''' <summary><typeparam name="x">@M0</typeparam></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</errors>)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "t")
Assert.Equal(8, names.Length)
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(0), ExpressionSyntax), "T")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(1), ExpressionSyntax), "T")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(2), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(3), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(4), ExpressionSyntax), "T")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(5), ExpressionSyntax), "T")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(6), ExpressionSyntax), "T")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(7), ExpressionSyntax), "T")
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "tt")
Assert.Equal(6, names.Length)
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(0), ExpressionSyntax), "TT")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(1), ExpressionSyntax), "TT")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(2), ExpressionSyntax), "TT")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(3), ExpressionSyntax), "TT")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(4), ExpressionSyntax), "TT")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(5), ExpressionSyntax), "TT")
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "x")
Assert.Equal(20, names.Length)
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(0), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(1), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(2), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(3), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(4), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(5), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(6), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(7), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(8), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(9), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(10), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(11), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(12), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(13), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(14), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(15), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(16), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(17), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(18), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(19), ExpressionSyntax))
End Sub
<Fact()>
Public Sub SemanticInfo_InsideTypeParamRef()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary><typeparamref name="x" nested="true">@OuterClass(Of X)</typeparamref></summary>
''' <typeparamref name="x">@OuterClass(Of X)</typeparamref>
Public MustInherit Class OuterClass(Of X)
''' <summary><typeparamref name="x" nested="true">@F</typeparamref></summary>
''' <typeparamref name="x">@F</typeparamref>
Public F As String
''' <summary><typeparamref name="t" nested="true">@S(Of T)</typeparamref></summary>
''' <typeparamref name="t">@S(Of T)</typeparamref>
Public Shared Sub S(Of T)(a As Integer)
End Sub
''' <summary><typeparamref name="tt" nested="true">@FUN(Of T)</typeparamref></summary>
''' <typeparamref name="tt">@FUN(Of T)</typeparamref>
Public MustOverride Function FUN(Of TT)(a As Integer) As String
''' <summary><typeparamref name="x" nested="true">@Operator +</typeparamref></summary>
''' <typeparamref name="x">@Operator +</typeparamref>
Public Shared Operator +(a As OuterClass(Of X), b As Integer) As Integer
Return Nothing
End Operator
''' <summary><typeparamref name="x" nested="true">@Operator CType</typeparamref></summary>
''' <typeparamref name="x">@Operator CType</typeparamref>
Public Shared Narrowing Operator CType(a As Integer) As OuterClass(Of X)
Return Nothing
End Operator
''' <summary><typeparamref name="t" nested="true">@E</typeparamref></summary>
''' <typeparamref name="t">@E</typeparamref>
Public Event E As Action(Of Integer)
''' <summary><typeparamref name="x" nested="true">@E2</typeparamref></summary>
''' <typeparamref name="x">@E2</typeparamref>
Public Event E2(a As Integer)
''' <summary><typeparamref name="x" nested="true">@P</typeparamref></summary>
''' <typeparamref name="x">@P</typeparamref>
Property P As String
''' <summary><typeparamref name="x" nested="true">@P(a As String)</typeparamref></summary>
''' <typeparamref name="x">@P(a As String)</typeparamref>
ReadOnly Property P(a As String) As String
Get
Return Nothing
End Get
End Property
''' <summary><typeparamref name="tt" nested="true">@D(a As Integer)</typeparamref></summary>
''' <typeparamref name="tt">@D(a As Integer)</typeparamref>
Public Delegate Function D(Of TT)(a As Integer) As String
''' <summary><typeparamref name="t" nested="true">@SD(a As Integer)</typeparamref></summary>
''' <typeparamref name="t">@SD(a As Integer)</typeparamref>
Public Delegate Sub SD(Of T)(a As Integer)
''' <summary><typeparamref name="x" nested="true">@ENM</typeparamref></summary>
''' <typeparamref name="x">@ENM</typeparamref>
Public Enum ENM
''' <summary><typeparamref name="x" nested="true">@DefaultValue</typeparamref></summary>
''' <typeparamref name="x">@DefaultValue</typeparamref>
DefaultValue
End Enum
''' <summary><typeparamref name="tt" nested="true">@INT(Of TT)</typeparamref></summary>
''' <typeparamref name="tt">@INT(Of TT)</typeparamref>
Public Interface INT(Of TT)
''' <summary><typeparamref name="t" nested="true">@INTS(a As Integer)</typeparamref></summary>
''' <typeparamref name="t">@INTS(a As Integer)</typeparamref>
Sub INTS(Of T)(a As Integer)
End Interface
End Class
''' <typeparamref name="x" nested="true">@M0</typeparamref>
''' <summary><typeparamref name="x">@M0</typeparamref></summary>
Public Module M0
''' <typeparamref name="x" nested="true">@M0.a</typeparamref>
''' <summary><typeparamref name="x">@M0.a</typeparamref></summary>
''' <typeparamref>@M0.a -- no-name</typeparamref>
Public a As Integer
End Module
]]>
</file>
</compilation>,
<errors>
<![CDATA[
BC42317: XML comment type parameter 't' does not match a type parameter on the corresponding 'event' statement.
''' <summary><typeparamref name="t" nested="true">@E</typeparamref></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42317: XML comment type parameter 't' does not match a type parameter on the corresponding 'event' statement.
''' <typeparamref name="t">@E</typeparamref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparamref' is not permitted on a 'module' language element.
''' <typeparamref name="x" nested="true">@M0</typeparamref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42306: XML comment tag 'typeparamref' is not permitted on a 'module' language element.
''' <summary><typeparamref name="x">@M0</typeparamref></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42317: XML comment type parameter 'x' does not match a type parameter on the corresponding 'variable' statement.
''' <typeparamref name="x" nested="true">@M0.a</typeparamref>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42317: XML comment type parameter 'x' does not match a type parameter on the corresponding 'variable' statement.
''' <summary><typeparamref name="x">@M0.a</typeparamref></summary>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</errors>)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "t")
Assert.Equal(8, names.Length)
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(0), ExpressionSyntax), "T")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(1), ExpressionSyntax), "T")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(2), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(3), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(4), ExpressionSyntax), "T")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(5), ExpressionSyntax), "T")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(6), ExpressionSyntax), "T")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(7), ExpressionSyntax), "T")
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "tt")
Assert.Equal(6, names.Length)
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(0), ExpressionSyntax), "TT")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(1), ExpressionSyntax), "TT")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(2), ExpressionSyntax), "TT")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(3), ExpressionSyntax), "TT")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(4), ExpressionSyntax), "TT")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(5), ExpressionSyntax), "TT")
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "x")
Assert.Equal(22, names.Length)
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(0), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(1), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(2), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(3), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(4), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(5), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(6), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(7), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(8), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(9), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(10), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(11), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(12), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(13), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(14), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(15), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(16), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(17), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(18), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(19), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(20), ExpressionSyntax))
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(21), ExpressionSyntax))
End Sub
<Fact()>
Public Sub SemanticInfo_RightBinderAndSymbol()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <see cref="X">@OuterClass</see> ' Failed in dev11.
''' <see cref="S">@OuterClass</see> ' Failed in dev11.
Public MustInherit Class OuterClass(Of X)
''' <see cref="X">@F</see>
''' <see cref="S">@F</see>
''' <see cref="T">@F</see>
Public F As String
''' <see cref="X">@S</see>
''' <see cref="F">@S</see>
''' <see cref="a">@S</see>
''' <see cref="T">@S</see>
Public Shared Sub S(Of T)(a As Integer)
End Sub
''' <see cref="X">@FUN</see>
''' <see cref="F">@FUN</see>
''' <see cref="a">@FUN</see>
''' <see cref="T">@FUN</see>
Public MustOverride Function FUN(Of T)(a As Integer) As String
''' <see cref="X">@InnerClass</see>
''' <see cref="F">@InnerClass</see>
''' <see cref="T">@InnerClass</see>
''' <see cref="Y">@InnerClass</see> ' Failed in dev11.
Public Class InnerClass(Of Y)
End Class
''' <see cref="X">@E</see>
''' <see cref="F">@E</see>
''' <see cref="T">@E</see>
''' <see cref="obj">@E</see>
Public Event E As Action(Of Integer)
''' <see cref="X">@E2</see>
''' <see cref="F">@E2</see>
''' <see cref="a">@E2</see>
''' <see cref="T">@E2</see>
Public Event E2(a As Integer)
''' <see cref="X">@P</see>
''' <see cref="F">@P</see>
''' <see cref="T">@P</see>
Property P As String
''' <see cref="X">@P(a)</see>
''' <see cref="F">@P(a)</see>
''' <see cref="a">@P(a)</see>
''' <see cref="T">@P(a)</see>
ReadOnly Property P(a As String) As String
Get
Return Nothing
End Get
End Property
''' <see cref="X">@D</see>
''' <see cref="F">@D</see>
''' <see cref="a">@D</see>
''' <see cref="T">@D</see>
Public Delegate Function D(a As Integer) As String
''' <see cref="X">@SD</see>
''' <see cref="F">@SD</see>
''' <see cref="a">@SD</see>
''' <see cref="T">@SD</see>
Public Delegate Sub SD(a As Integer)
''' <see cref="X">@ENM</see>
''' <see cref="F">@ENM</see>
''' <see cref="DefaultValue">@ENM</see> ' Failed in dev11.
Public Enum ENM
''' <see cref="F">@DefaultValue</see>
DefaultValue
End Enum
''' <see cref="X">@INT</see>
''' <see cref="F">@INT</see>
''' <see cref="INTT">@INT</see> ' Failed in dev11.
''' <see cref="INTS">@INT</see> ' Failed in dev11.
Public Interface INT(Of INTT)
''' <see cref="F">@INTS</see>
Sub INTS(a As Integer)
End Interface
End Class
''' <see cref="Fun02">@M0</see>
Public Module M0
''' <see cref="Fun02">@Fun02</see>
Public Function Fun02() As Integer
Return Nothing
End Function
End Module
]]>
</file>
</compilation>,
<errors>
<![CDATA[
BC42375: XML comment has a tag with a 'cref' attribute 'X' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <see cref="X">@OuterClass</see> ' Failed in dev11.
~~~~~~~~
BC42375: XML comment has a tag with a 'cref' attribute 'X' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <see cref="X">@F</see>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'T' that could not be resolved.
''' <see cref="T">@F</see>
~~~~~~~~
BC42375: XML comment has a tag with a 'cref' attribute 'X' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <see cref="X">@S</see>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'a' that could not be resolved.
''' <see cref="a">@S</see>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'T' that could not be resolved.
''' <see cref="T">@S</see>
~~~~~~~~
BC42375: XML comment has a tag with a 'cref' attribute 'X' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <see cref="X">@FUN</see>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'a' that could not be resolved.
''' <see cref="a">@FUN</see>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'T' that could not be resolved.
''' <see cref="T">@FUN</see>
~~~~~~~~
BC42375: XML comment has a tag with a 'cref' attribute 'X' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <see cref="X">@InnerClass</see>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'T' that could not be resolved.
''' <see cref="T">@InnerClass</see>
~~~~~~~~
BC42375: XML comment has a tag with a 'cref' attribute 'Y' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <see cref="Y">@InnerClass</see> ' Failed in dev11.
~~~~~~~~
BC42375: XML comment has a tag with a 'cref' attribute 'X' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <see cref="X">@E</see>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'T' that could not be resolved.
''' <see cref="T">@E</see>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'obj' that could not be resolved.
''' <see cref="obj">@E</see>
~~~~~~~~~~
BC42375: XML comment has a tag with a 'cref' attribute 'X' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <see cref="X">@E2</see>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'a' that could not be resolved.
''' <see cref="a">@E2</see>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'T' that could not be resolved.
''' <see cref="T">@E2</see>
~~~~~~~~
BC42375: XML comment has a tag with a 'cref' attribute 'X' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <see cref="X">@P</see>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'T' that could not be resolved.
''' <see cref="T">@P</see>
~~~~~~~~
BC42375: XML comment has a tag with a 'cref' attribute 'X' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <see cref="X">@P(a)</see>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'a' that could not be resolved.
''' <see cref="a">@P(a)</see>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'T' that could not be resolved.
''' <see cref="T">@P(a)</see>
~~~~~~~~
BC42375: XML comment has a tag with a 'cref' attribute 'X' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <see cref="X">@D</see>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'a' that could not be resolved.
''' <see cref="a">@D</see>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'T' that could not be resolved.
''' <see cref="T">@D</see>
~~~~~~~~
BC42375: XML comment has a tag with a 'cref' attribute 'X' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <see cref="X">@SD</see>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'a' that could not be resolved.
''' <see cref="a">@SD</see>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'T' that could not be resolved.
''' <see cref="T">@SD</see>
~~~~~~~~
BC42375: XML comment has a tag with a 'cref' attribute 'X' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <see cref="X">@ENM</see>
~~~~~~~~
BC42375: XML comment has a tag with a 'cref' attribute 'X' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <see cref="X">@INT</see>
~~~~~~~~
BC42375: XML comment has a tag with a 'cref' attribute 'INTT' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <see cref="INTT">@INT</see> ' Failed in dev11.
~~~~~~~~~~~
]]>
</errors>)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "X")
Assert.Equal(13, names.Length)
CheckTypeParameterCrefSymbolInfoAndTypeInfo(model, names(0), "X")
CheckTypeParameterCrefSymbolInfoAndTypeInfo(model, names(1), "X")
CheckTypeParameterCrefSymbolInfoAndTypeInfo(model, names(2), "X")
CheckTypeParameterCrefSymbolInfoAndTypeInfo(model, names(3), "X")
CheckTypeParameterCrefSymbolInfoAndTypeInfo(model, names(4), "X")
CheckTypeParameterCrefSymbolInfoAndTypeInfo(model, names(5), "X")
CheckTypeParameterCrefSymbolInfoAndTypeInfo(model, names(6), "X")
CheckTypeParameterCrefSymbolInfoAndTypeInfo(model, names(7), "X")
CheckTypeParameterCrefSymbolInfoAndTypeInfo(model, names(8), "X")
CheckTypeParameterCrefSymbolInfoAndTypeInfo(model, names(9), "X")
CheckTypeParameterCrefSymbolInfoAndTypeInfo(model, names(10), "X")
CheckTypeParameterCrefSymbolInfoAndTypeInfo(model, names(11), "X")
CheckTypeParameterCrefSymbolInfoAndTypeInfo(model, names(12), "X")
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "S")
Assert.Equal(2, names.Length)
CheckSymbolInfoOnly(model, names(0), "Sub OuterClass(Of X).S(Of T)(a As System.Int32)")
CheckSymbolInfoOnly(model, names(1), "Sub OuterClass(Of X).S(Of T)(a As System.Int32)")
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "T")
Assert.Equal(10, names.Length)
CheckSymbolInfoOnly(model, names(0))
CheckSymbolInfoOnly(model, names(1))
CheckSymbolInfoOnly(model, names(2))
CheckSymbolInfoOnly(model, names(3))
CheckSymbolInfoOnly(model, names(4))
CheckSymbolInfoOnly(model, names(5))
CheckSymbolInfoOnly(model, names(6))
CheckSymbolInfoOnly(model, names(7))
CheckSymbolInfoOnly(model, names(8))
CheckSymbolInfoOnly(model, names(9))
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "F")
Assert.Equal(13, names.Length)
CheckSymbolInfoOnly(model, names(0), "OuterClass(Of X).F As System.String")
CheckSymbolInfoOnly(model, names(1), "OuterClass(Of X).F As System.String")
CheckSymbolInfoOnly(model, names(2), "OuterClass(Of X).F As System.String")
CheckSymbolInfoOnly(model, names(3), "OuterClass(Of X).F As System.String")
CheckSymbolInfoOnly(model, names(4), "OuterClass(Of X).F As System.String")
CheckSymbolInfoOnly(model, names(5), "OuterClass(Of X).F As System.String")
CheckSymbolInfoOnly(model, names(6), "OuterClass(Of X).F As System.String")
CheckSymbolInfoOnly(model, names(7), "OuterClass(Of X).F As System.String")
CheckSymbolInfoOnly(model, names(8), "OuterClass(Of X).F As System.String")
CheckSymbolInfoOnly(model, names(9), "OuterClass(Of X).F As System.String")
CheckSymbolInfoOnly(model, names(10), "OuterClass(Of X).F As System.String")
CheckSymbolInfoOnly(model, names(11), "OuterClass(Of X).F As System.String")
CheckSymbolInfoOnly(model, names(12), "OuterClass(Of X).F As System.String")
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "a")
Assert.Equal(6, names.Length)
CheckSymbolInfoOnly(model, names(0))
CheckSymbolInfoOnly(model, names(1))
CheckSymbolInfoOnly(model, names(2))
CheckSymbolInfoOnly(model, names(3))
CheckSymbolInfoOnly(model, names(4))
CheckSymbolInfoOnly(model, names(5))
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "obj")
Assert.Equal(1, names.Length)
CheckSymbolInfoOnly(model, names(0))
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "DefaultValue")
Assert.Equal(1, names.Length)
CheckSymbolInfoOnly(model, names(0), "OuterClass(Of X).ENM.DefaultValue") ' Did not bind in dev11.
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "Fun02")
Assert.Equal(2, names.Length)
CheckSymbolInfoOnly(model, names(0), "Function M0.Fun02() As System.Int32")
CheckSymbolInfoOnly(model, names(0), "Function M0.Fun02() As System.Int32")
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "INTT")
Assert.Equal(1, names.Length)
CheckTypeParameterCrefSymbolInfoAndTypeInfo(model, names(0), "INTT")
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "INTS")
Assert.Equal(1, names.Length)
CheckSymbolInfoOnly(model, names(0), "Sub OuterClass(Of X).INT(Of INTT).INTS(a As System.Int32)")
End Sub
<Fact()>
Public Sub SemanticInfo_SquareBrackets()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <typeparam name="X"></typeparam>
''' <typeparam name="[X]"></typeparam>
''' <typeparamref name="X"></typeparamref>
''' <typeparamref name="[X]"></typeparamref>
Public MustInherit Class OuterClass(Of X)
''' <typeparamref name="X"></typeparamref>
''' <typeparamref name="[X]"></typeparamref>
''' <typeparam name="t"></typeparam>
''' <typeparam name="[t]"></typeparam>
''' <typeparamref name="t"></typeparamref>
''' <typeparamref name="[t]"></typeparamref>
''' <param name="a"></param>
''' <param name="[a]"></param>
''' <paramref name="A"></paramref>
''' <paramref name="[A]"></paramref>
Public Shared Sub S(Of T)(a As Integer)
End Sub
End Class
]]>
</file>
</compilation>,
<errors></errors>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:OuterClass`1">
<typeparam name="X"></typeparam>
<typeparam name="[X]"></typeparam>
<typeparamref name="X"></typeparamref>
<typeparamref name="[X]"></typeparamref>
</member>
<member name="M:OuterClass`1.S``1(System.Int32)">
<typeparamref name="X"></typeparamref>
<typeparamref name="[X]"></typeparamref>
<typeparam name="t"></typeparam>
<typeparam name="[t]"></typeparam>
<typeparamref name="t"></typeparamref>
<typeparamref name="[t]"></typeparamref>
<param name="a"></param>
<param name="[a]"></param>
<paramref name="A"></paramref>
<paramref name="[A]"></paramref>
</member>
</members>
</doc>
]]>
</xml>)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "X")
Assert.Equal(6, names.Length)
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(0), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(1), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(2), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(3), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(4), ExpressionSyntax), "X")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(5), ExpressionSyntax), "X")
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "t")
Assert.Equal(4, names.Length)
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(0), ExpressionSyntax), "T")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(1), ExpressionSyntax), "T")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(2), ExpressionSyntax), "T")
CheckSymbolInfoAndTypeInfo(model, DirectCast(names(3), ExpressionSyntax), "T")
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "a")
Assert.Equal(2, names.Length)
CheckSymbolInfoOnly(model, DirectCast(names(0), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(1), ExpressionSyntax), "a As System.Int32")
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "A")
Assert.Equal(2, names.Length)
CheckSymbolInfoOnly(model, DirectCast(names(0), ExpressionSyntax), "a As System.Int32")
CheckSymbolInfoOnly(model, DirectCast(names(1), ExpressionSyntax), "a As System.Int32")
End Sub
<Fact()>
Public Sub SemanticModel_Accessibility()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class OuterClass
''' <see cref="Other.S" />
''' <see cref="c.n1.n2.t.C.c" />
Public Shared Sub Su(Of T)(a As Integer)
End Sub
End Class
Public Class Other(Of OT)
Private Shared Sub S(a As Integer)
End Sub
End Class
Public Class C(Of T)
Private Class N1
Private Class N2
Public Class T
Public Class C
''' <see cref="t" />
Private C As T
''' <typeparamref name="t"/>
Public Shared Sub XYZ(Of T)(a As Integer)
End Sub
End Class
End Class
End Class
End Class
End Class
]]>
</file>
</compilation>, Nothing)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim text = tree.ToString()
' Other.S
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "Other")
Assert.Equal(1, names.Length)
Dim symbols = CheckSymbolInfoAndTypeInfo(model, DirectCast(names(0), ExpressionSyntax),
"Other(Of OT)")
' BREAK: dev11 includes "Sub Other(Of OT).S(a As System.Int32)"
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("Other.S""", StringComparison.Ordinal) + 5, container:=DirectCast(symbols(0), NamedTypeSymbol)),
SymbolKind.Method),
"Function System.Object.Equals(obj As System.Object) As System.Boolean",
"Function System.Object.Equals(objA As System.Object, objB As System.Object) As System.Boolean",
"Function System.Object.GetHashCode() As System.Int32",
"Function System.Object.GetType() As System.Type",
"Function System.Object.MemberwiseClone() As System.Object",
"Function System.Object.ReferenceEquals(objA As System.Object, objB As System.Object) As System.Boolean",
"Function System.Object.ToString() As System.String",
"Sub System.Object.Finalize()")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("Other.S""", StringComparison.Ordinal) + 5,
container:=DirectCast(symbols(0), NamedTypeSymbol),
name:="S"),
SymbolKind.Method))
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("Other.S""", StringComparison.Ordinal) + 5,
container:=DirectCast(symbols(0), NamedTypeSymbol),
name:="GetHashCode"),
SymbolKind.Method),
"Function System.Object.GetHashCode() As System.Int32")
' c.n1.n2.t.C
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "C")
Assert.Equal(1, names.Length)
' BREAK: works in dev11.
symbols = CheckSymbolInfoAndTypeInfo(model,
DirectCast(names(0), ExpressionSyntax),
"C(Of T).N1.N2.T.C")
Assert.Equal(1, symbols.Length)
' "t"
names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "t")
Assert.Equal(3, names.Length)
' cref="t"
symbols = CheckSymbolInfoAndTypeInfo(model,
DirectCast(names(1), ExpressionSyntax),
"C(Of T).N1.N2.T")
Dim firstIndex = text.IndexOf("""t""", StringComparison.Ordinal) + 1
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(firstIndex,
name:="T"),
SymbolKind.NamedType, SymbolKind.TypeParameter),
"C(Of T).N1.N2.T")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(firstIndex,
name:="T",
container:=symbols(0).ContainingType),
SymbolKind.NamedType, SymbolKind.TypeParameter),
"C(Of T).N1.N2.T")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(firstIndex,
name:="T",
container:=symbols(0).ContainingType.ContainingType),
SymbolKind.NamedType, SymbolKind.TypeParameter))
' name="t"
Dim secondSymbols = CheckSymbolInfoAndTypeInfo(model,
DirectCast(names(2), ExpressionSyntax),
"T")
Dim secondIndex = text.IndexOf("""t""", firstIndex + 5, StringComparison.Ordinal) + 1
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(secondIndex,
name:="T"),
SymbolKind.NamedType, SymbolKind.TypeParameter),
"T")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(secondIndex,
name:="T",
container:=symbols(0).ContainingType),
SymbolKind.NamedType, SymbolKind.TypeParameter),
"C(Of T).N1.N2.T")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(secondIndex,
name:="T",
container:=secondSymbols(0).ContainingType),
SymbolKind.NamedType, SymbolKind.TypeParameter))
End Sub
<Fact>
<WorkItem(4719, "https://github.com/dotnet/roslyn/issues/4719")>
Public Sub CrefLookup()
Dim source =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
''' <summary>
''' See <see cref="C(Of U)" />
''' </summary>
Class C(Of T)
Sub M()
End Sub
End Class
Class Outer
Private Class Inner
End Class
End Class
]]>
</file>
</compilation>
Dim comp = CompileCheckDiagnosticsAndXmlDocument(source, <errors/>)
Dim syntaxTree = comp.SyntaxTrees(0)
Dim model = comp.GetSemanticModel(syntaxTree)
Dim outer = comp.GlobalNamespace.GetMember(Of NamedTypeSymbol)("Outer")
Dim inner = outer.GetMember(Of NamedTypeSymbol)("Inner")
Dim position = syntaxTree.ToString().IndexOf("(Of U)", StringComparison.Ordinal)
Const bug4719IsFixed = False
If bug4719IsFixed Then
Assert.Equal(inner, model.LookupSymbols(position, outer, inner.Name).Single())
Else
Assert.False(model.LookupSymbols(position, outer, inner.Name).Any())
End If
End Sub
<Fact()>
Public Sub SemanticInfo_ErrorsInXmlGenerating_NoneInSemanticMode()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary>
''' <a>sss
''' </summary>
Public Class TestClass
Dim x As TestClass
End Class
]]>
</file>
</compilation>,
<errors>
<![CDATA[
BC42304: XML documentation parse error: Element is missing an end tag. XML comment will be ignored.
''' <a>sss
~~~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
''' </summary>
~
BC42304: XML documentation parse error: Expected beginning '<' for an XML tag. XML comment will be ignored.
''' </summary>
~
BC42304: XML documentation parse error: XML name expected. XML comment will be ignored.
''' </summary>
~
]]>
</errors>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
</members>
</doc>
]]>
</xml>)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "TestClass")
Assert.Equal(1, names.Length)
Dim symbols = CheckSymbolInfoAndTypeInfo(model, DirectCast(names(0), ExpressionSyntax), "TestClass")
Assert.Equal(1, symbols.Length)
Dim type = symbols(0)
Assert.Equal(SymbolKind.NamedType, type.Kind)
Dim docComment = type.GetDocumentationCommentXml()
Assert.False(String.IsNullOrWhiteSpace(docComment))
Assert.Equal(
<![CDATA[
<member name="T:TestClass">
<summary>
<a>sss
</summary>
</member>
]]>.Value.Trim().Replace(vbLf, "").Replace(vbCr, ""),
docComment.Trim().Replace(vbLf, "").Replace(vbCr, ""))
End Sub
<Fact()>
Public Sub SemanticInfo_ErrorsInXmlGenerating_NoneInSemanticMode_PartialMethod()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Partial Public Class TestClass
''' <summary> Declaration </summary>
Partial Private Sub PS()
End Sub
End Class
Partial Public Class TestClass
''' <summary> Implementation
Private Sub PS()
PS()
End Sub
End Class
]]>
</file>
</compilation>,
<errors>
<![CDATA[
BC42304: XML documentation parse error: Element is missing an end tag. XML comment will be ignored.
''' <summary> Implementation
~~~~~~~~~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
''' <summary> Implementation
~
BC42304: XML documentation parse error: Expected beginning '<' for an XML tag. XML comment will be ignored.
''' <summary> Implementation
~
]]>
</errors>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="M:TestClass.PS">
<summary> Declaration </summary>
</member>
</members>
</doc>
]]>
</xml>)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "PS")
Assert.Equal(1, names.Length)
Dim symbols = CheckSymbolInfoOnly(model, DirectCast(names(0), ExpressionSyntax), "Sub TestClass.PS()")
Assert.Equal(1, symbols.Length)
Dim method = symbols(0)
Assert.Equal(SymbolKind.Method, method.Kind)
Dim docComment = method.GetDocumentationCommentXml()
Assert.False(String.IsNullOrWhiteSpace(docComment))
Assert.Equal("<member name=""M:TestClass.PS""> <summary> Implementation</member>".Trim(), docComment.Trim().Replace(vbLf, "").Replace(vbCr, ""))
End Sub
<Fact()>
Public Sub Lookup_InsideParam()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class OuterClass
''' <param name="a."/>
''' <param name="a"/>
''' <param name="[a]"/>
''' <typeparam name="[b]"/>
''' <see name="b"/>
''' <see cref="c"/>
Public Shared Sub S(Of T)(a As Integer)
End Sub
End Class
]]>
</file>
</compilation>, Nothing)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim text = tree.ToString()
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""a.""", StringComparison.Ordinal) + 2),
SymbolKind.Parameter),
"a As System.Int32")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""a""", StringComparison.Ordinal) + 1),
SymbolKind.Parameter),
"a As System.Int32")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""[a]""", StringComparison.Ordinal) + 1),
SymbolKind.Parameter),
"a As System.Int32")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""[a]""", StringComparison.Ordinal) + 1),
SymbolKind.TypeParameter))
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""[b]""", StringComparison.Ordinal) + 1),
SymbolKind.Parameter))
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""b""", StringComparison.Ordinal) + 1),
SymbolKind.Parameter))
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""c""", StringComparison.Ordinal) + 1),
SymbolKind.Parameter))
End Sub
<Fact()>
Public Sub Lookup_InsideParamRef()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class OuterClass
''' <paramref name="a."></paramref>
''' <paramref name="a"></paramref>
''' <paramref name="[a]"></paramref>
''' <typeparam name="[b]"/>
''' <see name="b"/>
''' <see cref="c"/>
Public Shared Sub S(Of T)(a As Integer)
End Sub
End Class
]]>
</file>
</compilation>, Nothing)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim text = tree.ToString()
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""a.""", StringComparison.Ordinal) + 2),
SymbolKind.Parameter),
"a As System.Int32")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""a""", StringComparison.Ordinal) + 1),
SymbolKind.Parameter),
"a As System.Int32")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""[a]""", StringComparison.Ordinal) + 1),
SymbolKind.Parameter),
"a As System.Int32")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""[a]""", StringComparison.Ordinal) + 1),
SymbolKind.TypeParameter))
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""[b]""", StringComparison.Ordinal) + 1),
SymbolKind.Parameter))
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""b""", StringComparison.Ordinal) + 1),
SymbolKind.Parameter))
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""c""", StringComparison.Ordinal) + 1),
SymbolKind.Parameter))
End Sub
<Fact()>
Public Sub Lookup_InsideTypeParam()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class OuterClass(Of X)
''' <typeparam name="a."></typeparam>
''' <typeparam name="a"></typeparam>
''' <typeparam name="[a]"></typeparam>
''' <param name="[b]"/>
''' <see name="b"/>
''' <see cref="c"/>
Public Shared Sub S(Of T)(a As Integer)
End Sub
End Class
]]>
</file>
</compilation>, Nothing)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim text = tree.ToString()
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""a.""", StringComparison.Ordinal) + 2),
SymbolKind.TypeParameter),
"T", "X")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""a""", StringComparison.Ordinal) + 1),
SymbolKind.TypeParameter),
"T", "X")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""[a]""", StringComparison.Ordinal) + 1),
SymbolKind.TypeParameter),
"T", "X")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""[a]""", StringComparison.Ordinal) + 1),
SymbolKind.Parameter))
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""[b]""", StringComparison.Ordinal) + 1),
SymbolKind.TypeParameter),
"X")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""b""", StringComparison.Ordinal) + 1),
SymbolKind.TypeParameter),
"X")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""b""", StringComparison.Ordinal) + 1),
SymbolKind.TypeParameter),
"X")
End Sub
<Fact()>
Public Sub Lookup_InsideTypeParamRef()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class OuterClass(Of X)
''' <typeparamref name="a."/>
''' <typeparamref name="a"/>
''' <typeparamref name="[a]"/>
''' <param name="[b]"/>
''' <see name="b"/>
''' <see cref="c"/>
Public Shared Sub S(Of T)(a As Integer)
End Sub
End Class
]]>
</file>
</compilation>, Nothing)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim text = tree.ToString()
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""a.""", StringComparison.Ordinal) + 2),
SymbolKind.TypeParameter),
"T", "X")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""a""", StringComparison.Ordinal) + 1),
SymbolKind.TypeParameter),
"T", "X")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""[a]""", StringComparison.Ordinal) + 1),
SymbolKind.TypeParameter),
"T", "X")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""[a]""", StringComparison.Ordinal) + 1),
SymbolKind.Parameter))
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""[b]""", StringComparison.Ordinal) + 1),
SymbolKind.TypeParameter),
"X")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""b""", StringComparison.Ordinal) + 1),
SymbolKind.TypeParameter),
"X")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""b""", StringComparison.Ordinal) + 1),
SymbolKind.TypeParameter),
"X")
End Sub
<Fact()>
Public Sub Lookup_Cref()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <see cref="d"/>
''' <see cref="d."/>
Public Class OuterClass(Of X)
''' <param name="[b]"/>
''' <see name="b"/>
''' <see cref="c"/>
''' <see cref="c."/>
Public Shared Sub S(Of T)(a As Integer)
End Sub
End Class
]]>
</file>
</compilation>, Nothing)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim text = tree.ToString()
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""d.""", StringComparison.Ordinal) + 2),
SymbolKind.TypeParameter, SymbolKind.Parameter),
"X")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""d""", StringComparison.Ordinal) + 1),
SymbolKind.TypeParameter, SymbolKind.Parameter),
"X")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""[b]""", StringComparison.Ordinal) + 1),
SymbolKind.TypeParameter, SymbolKind.Parameter),
"a As System.Int32", "X")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""b""", StringComparison.Ordinal) + 1),
SymbolKind.TypeParameter, SymbolKind.Parameter),
"X")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""c""", StringComparison.Ordinal) + 1),
SymbolKind.TypeParameter, SymbolKind.Parameter),
"X")
AssertLookupResult(FilterOfSymbolKindOnly(
model.LookupSymbols(text.IndexOf("""c.""", StringComparison.Ordinal) + 1),
SymbolKind.TypeParameter, SymbolKind.Parameter),
"X")
End Sub
<Fact()>
Public Sub Lookup_ParameterAndFieldConflict()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class OuterClass
Public X As String
''' <param name="X" cref="X"></param>
Public Sub SSS(x As Integer)
End Sub
End Class
]]>
</file>
</compilation>, Nothing)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim text = tree.ToString()
' X
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "X")
Assert.Equal(2, names.Length)
CheckSymbolInfoOnly(model,
DirectCast(names(0), ExpressionSyntax),
"x As System.Int32")
CheckSymbolInfoOnly(model,
DirectCast(names(1), ExpressionSyntax),
"OuterClass.X As System.String")
AssertLookupResult(
FilterOfSymbolKindOnly(
model.LookupSymbols(
text.IndexOf("name=""X""", StringComparison.Ordinal) + 6), SymbolKind.Field, SymbolKind.Parameter),
"x As System.Int32")
AssertLookupResult(
FilterOfSymbolKindOnly(
model.LookupSymbols(
text.IndexOf("cref=""X""", StringComparison.Ordinal) + 6), SymbolKind.Field, SymbolKind.Parameter),
"OuterClass.X As System.String")
End Sub
<Fact()>
Public Sub Lookup_TypeParameterAndFieldConflict()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class OuterClass
Public X As String
''' <typeparamref name="X" cref="X"/>
Public Sub SSS(Of X)()
End Sub
End Class
]]>
</file>
</compilation>, Nothing)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim text = tree.ToString()
' X
Dim names = FindNodesOfTypeFromText(Of NameSyntax)(tree, "X")
Assert.Equal(2, names.Length)
CheckSymbolInfoAndTypeInfo(model,
DirectCast(names(0), ExpressionSyntax),
"X")
CheckSymbolInfoOnly(model,
DirectCast(names(1), ExpressionSyntax),
"OuterClass.X As System.String")
AssertLookupResult(
FilterOfSymbolKindOnly(
model.LookupSymbols(
text.IndexOf("name=""X""", StringComparison.Ordinal) + 6), SymbolKind.Field, SymbolKind.TypeParameter),
"X")
AssertLookupResult(
FilterOfSymbolKindOnly(
model.LookupSymbols(
text.IndexOf("cref=""X""", StringComparison.Ordinal) + 6), SymbolKind.Field, SymbolKind.TypeParameter),
"OuterClass.X As System.String")
End Sub
<Fact()>
Public Sub Lookup_DoesNotDependOnContext()
' This test just proves that lookup result does not depend on
' context and returns, for example, fields in places where only
' type is expected
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class OuterClass(Of W)
Public X As String
Public Sub SSS()
Dim a As OuterClass(Of Integer) = Nothing
End Sub
End Class
]]>
</file>
</compilation>, Nothing)
Dim tree As SyntaxTree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim text = tree.ToString()
AssertLookupResult(
FilterOfSymbolKindOnly(
model.LookupSymbols(
text.IndexOf("Of Integer", StringComparison.Ordinal) + 3), SymbolKind.Field),
"OuterClass(Of W).X As System.String")
Dim symInteger =
FilterOfSymbolKindOnly(
model.LookupSymbols(
text.IndexOf("Of Integer", StringComparison.Ordinal) + 3,
name:="Int32"), SymbolKind.NamedType)
AssertLookupResult(symInteger, "System.Int32")
AssertLookupResult(
FilterOfSymbolKindOnly(
model.LookupSymbols(
text.IndexOf("Of Integer", StringComparison.Ordinal) + 3,
name:="Parse",
container:=DirectCast(symInteger(0), NamedTypeSymbol)), SymbolKind.Method),
"Function System.Int32.Parse(s As System.String) As System.Int32",
"Function System.Int32.Parse(s As System.String, provider As System.IFormatProvider) As System.Int32",
"Function System.Int32.Parse(s As System.String, style As System.Globalization.NumberStyles) As System.Int32",
"Function System.Int32.Parse(s As System.String, style As System.Globalization.NumberStyles, provider As System.IFormatProvider) As System.Int32")
End Sub
<Fact(Skip:="https://github.com/dotnet/roslyn/issues/8807")>
Public Sub Include_XPathNotFound_WRN_XMLDocInvalidXMLFragment()
Dim xmlText = <root/>
Dim xmlFile = Temp.CreateFile(extension:=".xml").WriteAllText(xmlText.ToString)
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <summary>
''' <include file='{0}' path='//target' />
''' </summary>
Class C
End Class
]]>
</file>
</compilation>
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, xmlFile),
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:C">
<summary>
<!--warning BC42320: Unable to include XML fragment '//target' of file '**FILE**'.-->
</summary>
</member>
</members>
</doc>
]]>
</xml>,
stringMapper:=Function(o) StringReplace(o, AsXmlCommentText(xmlFile), "**FILE**"), ensureEnglishUICulture:=True)
End Sub
<WorkItem(684184, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/684184")>
<Fact(Skip:="https://github.com/dotnet/roslyn/issues/8807")>
Public Sub Bug684184()
Dim xmlText =
<docs>
<doc for="DataRepeaterLayoutStyles">
<summary></summary>
</doc>
</docs>
Dim xmlFile = Temp.CreateFile(extension:=".xml").WriteAllText(xmlText.ToString)
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <include file='{0}' path='docs2/doc[@for="DataRepeater"]/*' />
Public Class Clazz
End Class
]]>
</file>
</compilation>
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, xmlFile),
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Clazz">
<!--warning BC42320: Unable to include XML fragment 'docs2/doc[@for="DataRepeater"]/*' of file '**FILE**'.-->
</member>
</members>
</doc>
]]>
</xml>,
stringMapper:=Function(o) StringReplace(o, AsXmlCommentText(xmlFile), "**FILE**"), ensureEnglishUICulture:=True)
End Sub
<Fact(Skip:="https://github.com/dotnet/roslyn/issues/8807")>
Public Sub Include_FileNotFound_WRN_XMLDocBadFormedXML()
Dim xmlText = <root/>
Dim xmlFile = Temp.CreateFile(extension:=".xml").WriteAllText(xmlText.ToString)
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <summary>
''' <include file='{0}5' path='//target' />
''' </summary>
Class C
End Class
]]>
</file>
</compilation>
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, xmlFile),
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:C">
<summary>
<!--warning BC42321: Unable to include XML fragment '//target' of file '**FILE**5'. File not found.-->
</summary>
</member>
</members>
</doc>
]]>
</xml>,
stringMapper:=Function(o) StringReplace(o, AsXmlCommentText(xmlFile), "**FILE**"), ensureEnglishUICulture:=True)
End Sub
<Fact(Skip:="https://github.com/dotnet/roslyn/issues/8807")>
Public Sub Include_IOError_WRN_XMLDocBadFormedXML()
Dim xmlText = <root>
<target>Included</target>
</root>
Dim xmlFile = Temp.CreateFile(extension:=".xml").WriteAllText(xmlText.ToString)
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <summary>
''' <include file='{0}' path='//target' />
''' </summary>
Class C
End Class
]]>
</file>
</compilation>
Using _stream = New FileStream(xmlFile.Path, FileMode.Open, FileAccess.ReadWrite)
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, xmlFile),
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:C">
<summary>
<!--warning BC42321: Unable to include XML fragment '//target' of file '**FILE**'. The process cannot access the file '**FILE**' because it is being used by another process.-->
</summary>
</member>
</members>
</doc>
]]>
</xml>,
stringMapper:=Function(o) StringReplace(o, AsXmlCommentText(xmlFile), "**FILE**"),
ensureEnglishUICulture:=True)
End Using
End Sub
<Fact(Skip:="https://github.com/dotnet/roslyn/issues/8807")>
Public Sub Include_XmlError_WRN_XMLDocBadFormedXML()
Dim xmlText =
<![CDATA[
<root>
<target>Included<target>
</root>
]]>
Dim xmlFile = Temp.CreateFile(extension:=".xml").WriteAllText(xmlText.Value.ToString)
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <summary>
''' <include file='{0}' path='//target' />
''' </summary>
Class C
End Class
]]>
</file>
</compilation>
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, xmlFile),
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:C">
<summary>
<!--warning BC42320: Unable to include XML fragment '//target' of file '**FILE**'.-->
</summary>
</member>
</members>
</doc>
]]>
</xml>,
stringMapper:=Function(o) StringReplace(o, AsXmlCommentText(xmlFile), "**FILE**"), ensureEnglishUICulture:=True)
End Sub
<Fact(Skip:="https://github.com/dotnet/roslyn/issues/8807")>
Public Sub Include_XDocument_WRN_XMLDocInvalidXMLFragment()
Dim xmlText =
<![CDATA[
<root>
<target>Included</target>
</root>
]]>
Dim xmlFile = Temp.CreateFile(extension:=".xml").WriteAllText(xmlText.Value.ToString)
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <summary>
''' <include file='{0}' path='//target/../..' />
''' </summary>
Class C
End Class
]]>
</file>
</compilation>
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, xmlFile),
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:C">
<summary>
<!--warning BC42320: Unable to include XML fragment '//target/../..' of file '**FILE**'.-->
</summary>
</member>
</members>
</doc>
]]>
</xml>,
stringMapper:=Function(o) StringReplace(o, AsXmlCommentText(xmlFile), "**FILE**"), ensureEnglishUICulture:=True)
End Sub
<Fact>
Public Sub Include_Cycle_WRN_XMLDocInvalidXMLFragment()
Dim xmlText =
<root>
<target>
<nested>
<include file='{0}' path='//target'/>
</nested>
</target>
</root>
Dim xmlFile = Temp.CreateFile(extension:=".xml")
xmlFile.WriteAllText(String.Format(xmlText.ToString, xmlFile.ToString))
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <summary>
''' <include file='{0}' path='//target' />
''' </summary>
Class C
End Class
]]>
</file>
</compilation>
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, xmlFile),
<error><%= $"BC42320: Unable to include XML fragment '{xmlFile.ToString()}' of file '//target'." %></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:C">
<summary>
<target>
<nested>
<target>
<nested>
<!--warning BC42320: Unable to include XML fragment '**FILE**' of file '//target'.-->
</nested>
</target>
</nested>
</target>
</summary>
</member>
</members>
</doc>
]]>
</xml>,
stringMapper:=Function(o) StringReplace(o, AsXmlCommentText(xmlFile), "**FILE**"), ensureEnglishUICulture:=True)
End Sub
<Fact(Skip:="https://github.com/dotnet/roslyn/issues/8807")>
Public Sub Include_XPathError_WRN_XMLDocBadFormedXML()
Dim xmlText =
<![CDATA[
<root>
<target>Included</target>
</root>
]]>
Dim xmlFile = Temp.CreateFile(extension:=".xml").WriteAllText(xmlText.Value.ToString)
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <summary>
''' <include file='{0}' path='//target/%^' />
''' </summary>
Class C
End Class
]]>
</file>
</compilation>
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, xmlFile),
<error></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:C">
<summary>
<!--warning BC42320: Unable to include XML fragment '//target/%^' of file '**FILE**'.-->
</summary>
</member>
</members>
</doc>
]]>
</xml>,
stringMapper:=Function(o) StringReplace(o, AsXmlCommentText(xmlFile), "**FILE**"), ensureEnglishUICulture:=True)
End Sub
<Fact>
Public Sub Include_CrefHandling()
Dim xmlText =
<![CDATA[
<root>
<target>
Included section
<summary>
See <see cref="Module0"/>.
See <see cref="Module0."/>.
See <see cref="Module0.
"/>.
See <see cref="Module0
"/>.
</summary>
<remarks></remarks>
</target>
<target>
Included section
<summary>
See <see cref="T:A.B.C"/>.
See <see cref="Module1"/>.
See <see cref="Module0.'
"/>.
See <see cref="Module0. _
"/>.
</summary>
<remarks></remarks>
</target>
</root>
]]>
Dim xmlFile = Temp.CreateFile(extension:=".xml").WriteAllText(xmlText.Value.ToString)
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <summary>
''' <include file='{0}' path='//target' />
''' </summary>
Class Module0
End Class
]]>
</file>
</compilation>
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, xmlFile),
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Module0. _' that could not be resolved.
BC42309: XML comment has a tag with a 'cref' attribute 'Module0.' that could not be resolved.
BC42309: XML comment has a tag with a 'cref' attribute 'Module0.' that could not be resolved.
BC42309: XML comment has a tag with a 'cref' attribute 'Module0.'' that could not be resolved.
BC42309: XML comment has a tag with a 'cref' attribute 'Module1' that could not be resolved.
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Module0">
<summary>
<target>
Included section
<summary>
See <see cref="T:Module0" />.
See <see cref="?:Module0." />.
See <see cref="?:Module0. " />.
See <see cref="T:Module0" />.
</summary>
<remarks />
</target><target>
Included section
<summary>
See <see cref="T:A.B.C" />.
See <see cref="?:Module1" />.
See <see cref="?:Module0.' " />.
See <see cref="?:Module0. _ " />.
</summary>
<remarks />
</target>
</summary>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Public Sub Include_ParamAndParamRefHandling()
Dim xmlText =
<![CDATA[
<root>
<target>
Included section
<summary>
See <param/>.
See <param name="PARAMA"/>.
See <param name="PARAMb"/>.
See <param name="b"/>.
See <param name="B' comment
"/>.
See <param name="Parama
"/>.
</summary>
<remarks></remarks>
</target>
<target>
Included section
<summary>
See <paramref/>.
See <paramref name="PARAMA"/>.
See <paramref name="PARAMb"/>.
See <paramref name="b"/>.
See <paramref name="B' comment
"/>.
See <paramref name="Parama
"/>.
</summary>
<remarks></remarks>
</target>
</root>
]]>
Dim xmlFile = Temp.CreateFile(extension:=".xml").WriteAllText(xmlText.Value.ToString)
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
Class Module0
''' <summary>
''' <include file='{0}' path='//target' />
''' </summary>
Sub S(paramA As String, B As Integer)
End Sub
End Class
]]>
</file>
</compilation>
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, xmlFile),
<error>
<![CDATA[
BC42307: XML comment parameter 'B' comment' does not match a parameter on the corresponding 'sub' statement.
BC42307: XML comment parameter 'B' comment' does not match a parameter on the corresponding 'sub' statement.
BC42307: XML comment parameter 'PARAMb' does not match a parameter on the corresponding 'sub' statement.
BC42307: XML comment parameter 'PARAMb' does not match a parameter on the corresponding 'sub' statement.
BC42308: XML comment parameter must have a 'name' attribute.
BC42308: XML comment parameter must have a 'name' attribute.
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="M:Module0.S(System.String,System.Int32)">
<summary>
<target>
Included section
<summary>
See <!--warning BC42308: XML comment parameter must have a 'name' attribute.--><param />.
See <param name="PARAMA" />.
See <!--warning BC42307: XML comment parameter 'PARAMb' does not match a parameter on the corresponding 'sub' statement.--><param name="PARAMb" />.
See <param name="b" />.
See <!--warning BC42307: XML comment parameter 'B' comment' does not match a parameter on the corresponding 'sub' statement.--><param name="B' comment " />.
See <param name="Parama " />.
</summary>
<remarks />
</target><target>
Included section
<summary>
See <!--warning BC42308: XML comment parameter must have a 'name' attribute.--><paramref />.
See <paramref name="PARAMA" />.
See <!--warning BC42307: XML comment parameter 'PARAMb' does not match a parameter on the corresponding 'sub' statement.--><paramref name="PARAMb" />.
See <paramref name="b" />.
See <!--warning BC42307: XML comment parameter 'B' comment' does not match a parameter on the corresponding 'sub' statement.--><paramref name="B' comment " />.
See <paramref name="Parama " />.
</summary>
<remarks />
</target>
</summary>
</member>
</members>
</doc>
]]>
</xml>, ensureEnglishUICulture:=True)
End Sub
<Fact>
Public Sub Include_TypeParamAndTypeParamRefHandling()
Dim xmlText =
<![CDATA[
<root>
<target>
Included section
<summary>
See <typeparam/>.
See <typeparam name="X"/>.
See <typeparam name="Y"/>.
See <typeparam name="XY"/>.
See <typeparam name="Y' comment
"/>.
See <typeparam name="Y
"/>.
</summary>
<remarks></remarks>
</target>
<target>
Included section
<summary>
See <typeparamref/>.
See <typeparamref name="X"/>.
See <typeparamref name="Y"/>.
See <typeparamref name="XY"/>.
See <typeparamref name="Y' comment
"/>.
See <typeparamref name="Y
"/>.
</summary>
<remarks></remarks>
</target>
</root>
]]>
Dim xmlFile = Temp.CreateFile(extension:=".xml").WriteAllText(xmlText.Value.ToString)
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
Class OuterClass(Of X)
''' <summary>
''' <include file='{0}' path='//target' />
''' </summary>
Class InnerClass(Of Y)
End Class
End Class
]]>
</file>
</compilation>
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, xmlFile),
<error>
<![CDATA[
BC42317: XML comment type parameter 'X' does not match a type parameter on the corresponding 'class' statement.
BC42317: XML comment type parameter 'XY' does not match a type parameter on the corresponding 'class' statement.
BC42317: XML comment type parameter 'XY' does not match a type parameter on the corresponding 'class' statement.
BC42317: XML comment type parameter 'Y' comment' does not match a type parameter on the corresponding 'class' statement.
BC42317: XML comment type parameter 'Y' comment' does not match a type parameter on the corresponding 'class' statement.
BC42318: XML comment type parameter must have a 'name' attribute.
BC42318: XML comment type parameter must have a 'name' attribute.
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:OuterClass`1.InnerClass`1">
<summary>
<target>
Included section
<summary>
See <!--warning BC42318: XML comment type parameter must have a 'name' attribute.--><typeparam />.
See <!--warning BC42317: XML comment type parameter 'X' does not match a type parameter on the corresponding 'class' statement.--><typeparam name="X" />.
See <typeparam name="Y" />.
See <!--warning BC42317: XML comment type parameter 'XY' does not match a type parameter on the corresponding 'class' statement.--><typeparam name="XY" />.
See <!--warning BC42317: XML comment type parameter 'Y' comment' does not match a type parameter on the corresponding 'class' statement.--><typeparam name="Y' comment " />.
See <typeparam name="Y " />.
</summary>
<remarks />
</target><target>
Included section
<summary>
See <!--warning BC42318: XML comment type parameter must have a 'name' attribute.--><typeparamref />.
See <typeparamref name="X" />.
See <typeparamref name="Y" />.
See <!--warning BC42317: XML comment type parameter 'XY' does not match a type parameter on the corresponding 'class' statement.--><typeparamref name="XY" />.
See <!--warning BC42317: XML comment type parameter 'Y' comment' does not match a type parameter on the corresponding 'class' statement.--><typeparamref name="Y' comment " />.
See <typeparamref name="Y " />.
</summary>
<remarks />
</target>
</summary>
</member>
</members>
</doc>
]]>
</xml>, ensureEnglishUICulture:=True)
End Sub
<Fact>
Public Sub Include_Exception()
Dim xmlText =
<![CDATA[
<root>
<target>
<exception cref="Exception"/>
<exception cref=""/>
<exception/>
</target>
<targeterror>
<exception cref="Exception"/>
</targeterror>
</root>
]]>
Dim xmlFile = Temp.CreateFile(extension:=".xml").WriteAllText(xmlText.Value.ToString)
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <include file='{0}' path='//targeterror' />
Public Module Module0
End Module
''' <include file='{0}' path='//targeterror' />
Public Class Clazz(Of X)
''' <include file='{0}' path='//target' />
Public Sub X1()
End Sub
''' <include file='{0}' path='//target' />
Public Event E As Action
''' <include file='{0}' path='//targeterror' />
Public F As Integer
''' <include file='{0}' path='//target' />
Public Property P As Integer
''' <include file='{0}' path='//targeterror' />
Public Delegate Function FDelegate(a As Integer) As String
''' <include file='{0}' path='//targeterror' />
Public Enum En : A : End Enum
''' <include file='{0}' path='//targeterror' />
Public Structure STR : End Structure
''' <include file='{0}' path='//target' />
Public ReadOnly Property A(x As String) As String
Get
Return x
End Get
End Property
End Class
]]>
</file>
</compilation>
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, xmlFile),
<error>
<![CDATA[
BC42306: XML comment tag 'exception' is not permitted on a 'class' language element.
BC42306: XML comment tag 'exception' is not permitted on a 'delegate' language element.
BC42306: XML comment tag 'exception' is not permitted on a 'enum' language element.
BC42306: XML comment tag 'exception' is not permitted on a 'module' language element.
BC42306: XML comment tag 'exception' is not permitted on a 'structure' language element.
BC42306: XML comment tag 'exception' is not permitted on a 'variable' language element.
BC42309: XML comment has a tag with a 'cref' attribute '' that could not be resolved.
BC42309: XML comment has a tag with a 'cref' attribute '' that could not be resolved.
BC42309: XML comment has a tag with a 'cref' attribute '' that could not be resolved.
BC42309: XML comment has a tag with a 'cref' attribute '' that could not be resolved.
BC42319: XML comment exception must have a 'cref' attribute.
BC42319: XML comment exception must have a 'cref' attribute.
BC42319: XML comment exception must have a 'cref' attribute.
BC42319: XML comment exception must have a 'cref' attribute.
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Module0">
<targeterror>
<!--warning BC42306: XML comment tag 'exception' is not permitted on a 'module' language element.--><exception cref="Exception" />
</targeterror>
</member>
<member name="T:Clazz`1">
<targeterror>
<!--warning BC42306: XML comment tag 'exception' is not permitted on a 'class' language element.--><exception cref="Exception" />
</targeterror>
</member>
<member name="M:Clazz`1.X1">
<target>
<exception cref="T:System.Exception" />
<exception cref="?:" />
<!--warning BC42319: XML comment exception must have a 'cref' attribute.--><exception />
</target>
</member>
<member name="E:Clazz`1.E">
<target>
<exception cref="T:System.Exception" />
<exception cref="?:" />
<!--warning BC42319: XML comment exception must have a 'cref' attribute.--><exception />
</target>
</member>
<member name="F:Clazz`1.F">
<targeterror>
<!--warning BC42306: XML comment tag 'exception' is not permitted on a 'variable' language element.--><exception cref="Exception" />
</targeterror>
</member>
<member name="P:Clazz`1.P">
<target>
<exception cref="T:System.Exception" />
<exception cref="?:" />
<!--warning BC42319: XML comment exception must have a 'cref' attribute.--><exception />
</target>
</member>
<member name="T:Clazz`1.FDelegate">
<targeterror>
<!--warning BC42306: XML comment tag 'exception' is not permitted on a 'delegate' language element.--><exception cref="Exception" />
</targeterror>
</member>
<member name="T:Clazz`1.En">
<targeterror>
<!--warning BC42306: XML comment tag 'exception' is not permitted on a 'enum' language element.--><exception cref="Exception" />
</targeterror>
</member>
<member name="T:Clazz`1.STR">
<targeterror>
<!--warning BC42306: XML comment tag 'exception' is not permitted on a 'structure' language element.--><exception cref="Exception" />
</targeterror>
</member>
<member name="P:Clazz`1.A(System.String)">
<target>
<exception cref="T:System.Exception" />
<exception cref="?:" />
<!--warning BC42319: XML comment exception must have a 'cref' attribute.--><exception />
</target>
</member>
</members>
</doc>
]]>
</xml>, ensureEnglishUICulture:=True)
End Sub
<Fact>
Public Sub Include_Returns()
Dim xmlText =
<![CDATA[
<root>
<target>
<returns/>
</target>
</root>
]]>
Dim xmlFile = Temp.CreateFile(extension:=".xml").WriteAllText(xmlText.Value.ToString)
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <include file='{0}' path='//target' />
Public Class TestClass
''' <include file='{0}' path='//target' />
Public Enum EN : A : End Enum
''' <include file='{0}' path='//target' />
Public Delegate Sub DelSub(a As Integer)
''' <include file='{0}' path='//target' />
Public Delegate Function DelFunc(a As Integer) As Integer
''' <include file='{0}' path='//target' />
Public Shared Sub MSub(p3 As Integer, p4 As String)
End Sub
''' <include file='{0}' path='//target' />
Public Shared Function MFunc(p3 As Integer, p4 As String) As Integer
Return Nothing
End Function
''' <include file='{0}' path='//target' />
Public Field As Integer
''' <include file='{0}' path='//target' />
WithEvents FieldWE As TestClass
''' <include file='{0}' path='//target' />
Public Declare Function DeclareFtn Lib "bar" () As Integer
''' <include file='{0}' path='//target' />
Public Declare Sub DeclareSub Lib "bar" ()
''' <include file='{0}' path='//target' />
Public ReadOnly Property PReadOnly As Integer
Get
Return Nothing
End Get
End Property
''' <include file='{0}' path='//target' />
Public Property PReadWrite As Integer
Get
Return Nothing
End Get
Set(value As Integer)
End Set
End Property
''' <include file='{0}' path='//target' />
Public WriteOnly Property PWriteOnly As Integer
Set(value As Integer)
End Set
End Property
''' <include file='{0}' path='//target' />
Public Event EE(p11 As String)
End Class
]]>
</file>
</compilation>
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, xmlFile),
<error>
<![CDATA[
BC42306: XML comment tag 'returns' is not permitted on a 'class' language element.
BC42306: XML comment tag 'returns' is not permitted on a 'delegate sub' language element.
BC42306: XML comment tag 'returns' is not permitted on a 'enum' language element.
BC42306: XML comment tag 'returns' is not permitted on a 'event' language element.
BC42306: XML comment tag 'returns' is not permitted on a 'sub' language element.
BC42306: XML comment tag 'returns' is not permitted on a 'variable' language element.
BC42306: XML comment tag 'returns' is not permitted on a 'WithEvents variable' language element.
BC42313: XML comment tag 'returns' is not permitted on a 'WriteOnly' Property.
BC42315: XML comment tag 'returns' is not permitted on a 'declare sub' language element.
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:TestClass">
<target>
<!--warning BC42306: XML comment tag 'returns' is not permitted on a 'class' language element.--><returns />
</target>
</member>
<member name="T:TestClass.EN">
<target>
<!--warning BC42306: XML comment tag 'returns' is not permitted on a 'enum' language element.--><returns />
</target>
</member>
<member name="T:TestClass.DelSub">
<target>
<!--warning BC42306: XML comment tag 'returns' is not permitted on a 'delegate sub' language element.--><returns />
</target>
</member>
<member name="T:TestClass.DelFunc">
<target>
<returns />
</target>
</member>
<member name="M:TestClass.MSub(System.Int32,System.String)">
<target>
<!--warning BC42306: XML comment tag 'returns' is not permitted on a 'sub' language element.--><returns />
</target>
</member>
<member name="M:TestClass.MFunc(System.Int32,System.String)">
<target>
<returns />
</target>
</member>
<member name="F:TestClass.Field">
<target>
<!--warning BC42306: XML comment tag 'returns' is not permitted on a 'variable' language element.--><returns />
</target>
</member>
<member name="F:TestClass._FieldWE">
<target>
<!--warning BC42306: XML comment tag 'returns' is not permitted on a 'WithEvents variable' language element.--><returns />
</target>
</member>
<member name="M:TestClass.DeclareFtn">
<target>
<returns />
</target>
</member>
<member name="M:TestClass.DeclareSub">
<target>
<!--warning BC42315: XML comment tag 'returns' is not permitted on a 'declare sub' language element.--><returns />
</target>
</member>
<member name="P:TestClass.PReadOnly">
<target>
<returns />
</target>
</member>
<member name="P:TestClass.PReadWrite">
<target>
<returns />
</target>
</member>
<member name="P:TestClass.PWriteOnly">
<target>
<!--warning BC42313: XML comment tag 'returns' is not permitted on a 'WriteOnly' Property.--><returns />
</target>
</member>
<member name="E:TestClass.EE">
<target>
<!--warning BC42306: XML comment tag 'returns' is not permitted on a 'event' language element.--><returns />
</target>
</member>
</members>
</doc>
]]>
</xml>, ensureEnglishUICulture:=True)
End Sub
<ConditionalFact(GetType(WindowsOnly), Reason:="https://github.com/dotnet/roslyn/issues/29531")>
Public Sub Include_Value()
Dim xmlText =
<![CDATA[
<root>
<target>
<value/>
</target>
</root>
]]>
Dim xmlFile = Temp.CreateFile(extension:=".xml").WriteAllText(xmlText.Value.ToString)
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <include file='{0}' path='//target' />
Public Class TestClass
''' <include file='{0}' path='//target' />
Public Enum EN : A : End Enum
''' <include file='{0}' path='//target' />
Public Structure STR : End Structure
''' <include file='{0}' path='//target' />
Public Interface INTERF : End Interface
''' <include file='{0}' path='//target' />
Public Delegate Sub DelSub(a As Integer)
''' <include file='{0}' path='//target' />
Public Delegate Function DelFunc(a As Integer) As Integer
''' <include file='{0}' path='//target' />
Public Shared Sub MSub(p3 As Integer, p4 As String)
End Sub
''' <include file='{0}' path='//target' />
Public Shared Function MFunc(p3 As Integer, p4 As String) As Integer
Return Nothing
End Function
''' <include file='{0}' path='//target' />
Public Declare Function DeclareFtn Lib "bar" (p3 As Integer) As Integer
''' <include file='{0}' path='//target' />
Public Field As Integer
''' <include file='{0}' path='//target' />
Public WriteOnly Property PWriteOnly(p As Integer) As Integer
Set(value As Integer)
End Set
End Property
''' <include file='{0}' path='//target' />
Public Property PReadWrite As Integer
''' <include file='{0}' path='//target' />
Public Event EVE(ppp As Integer)
End Class
]]>
</file>
</compilation>
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, xmlFile),
<error>
<![CDATA[
BC42306: XML comment tag 'value' is not permitted on a 'class' language element.
BC42306: XML comment tag 'value' is not permitted on a 'declare' language element.
BC42306: XML comment tag 'value' is not permitted on a 'delegate' language element.
BC42306: XML comment tag 'value' is not permitted on a 'delegate sub' language element.
BC42306: XML comment tag 'value' is not permitted on a 'enum' language element.
BC42306: XML comment tag 'value' is not permitted on a 'event' language element.
BC42306: XML comment tag 'value' is not permitted on a 'function' language element.
BC42306: XML comment tag 'value' is not permitted on a 'interface' language element.
BC42306: XML comment tag 'value' is not permitted on a 'structure' language element.
BC42306: XML comment tag 'value' is not permitted on a 'sub' language element.
BC42306: XML comment tag 'value' is not permitted on a 'variable' language element.
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:TestClass">
<target>
<!--warning BC42306: XML comment tag 'value' is not permitted on a 'class' language element.--><value />
</target>
</member>
<member name="T:TestClass.EN">
<target>
<!--warning BC42306: XML comment tag 'value' is not permitted on a 'enum' language element.--><value />
</target>
</member>
<member name="T:TestClass.STR">
<target>
<!--warning BC42306: XML comment tag 'value' is not permitted on a 'structure' language element.--><value />
</target>
</member>
<member name="T:TestClass.INTERF">
<target>
<!--warning BC42306: XML comment tag 'value' is not permitted on a 'interface' language element.--><value />
</target>
</member>
<member name="T:TestClass.DelSub">
<target>
<!--warning BC42306: XML comment tag 'value' is not permitted on a 'delegate sub' language element.--><value />
</target>
</member>
<member name="T:TestClass.DelFunc">
<target>
<!--warning BC42306: XML comment tag 'value' is not permitted on a 'delegate' language element.--><value />
</target>
</member>
<member name="M:TestClass.MSub(System.Int32,System.String)">
<target>
<!--warning BC42306: XML comment tag 'value' is not permitted on a 'sub' language element.--><value />
</target>
</member>
<member name="M:TestClass.MFunc(System.Int32,System.String)">
<target>
<!--warning BC42306: XML comment tag 'value' is not permitted on a 'function' language element.--><value />
</target>
</member>
<member name="M:TestClass.DeclareFtn(System.Int32)">
<target>
<!--warning BC42306: XML comment tag 'value' is not permitted on a 'declare' language element.--><value />
</target>
</member>
<member name="F:TestClass.Field">
<target>
<!--warning BC42306: XML comment tag 'value' is not permitted on a 'variable' language element.--><value />
</target>
</member>
<member name="P:TestClass.PWriteOnly(System.Int32)">
<target>
<value />
</target>
</member>
<member name="P:TestClass.PReadWrite">
<target>
<value />
</target>
</member>
<member name="E:TestClass.EVE">
<target>
<!--warning BC42306: XML comment tag 'value' is not permitted on a 'event' language element.--><value />
</target>
</member>
</members>
</doc>
]]>
</xml>, ensureEnglishUICulture:=True)
End Sub
<Fact>
Public Sub Include_ParamAndParamRef()
Dim xmlText =
<![CDATA[
<root>
<target>
<param name="P9"/>
<paramref name="P9"/>
</target>
</root>
]]>
Dim xmlFile = Temp.CreateFile(extension:=".xml").WriteAllText(xmlText.Value.ToString)
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <include file='{0}' path='//target' />
Public Class TestClass
''' <include file='{0}' path='//target' />
Public Shared Sub M(P9 As Integer, p4 As String)
Dim a As TestClass = Nothing
End Sub
''' <include file='{0}' path='//target' />
Public F As Integer
''' <include file='{0}' path='//target' />
Public Property P As Integer
''' <include file='{0}' path='//target' />
Public ReadOnly Property P(P9 As String) As Integer
Get
Return Nothing
End Get
End Property
''' <include file='{0}' path='//target' />
Public Event EE(P9 As String)
End Class
]]>
</file>
</compilation>
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, xmlFile),
<error>
<![CDATA[
BC42306: XML comment tag 'param' is not permitted on a 'class' language element.
BC42306: XML comment tag 'param' is not permitted on a 'variable' language element.
BC42306: XML comment tag 'paramref' is not permitted on a 'class' language element.
BC42306: XML comment tag 'paramref' is not permitted on a 'variable' language element.
BC42307: XML comment parameter 'P9' does not match a parameter on the corresponding 'property' statement.
BC42307: XML comment parameter 'P9' does not match a parameter on the corresponding 'property' statement.
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:TestClass">
<target>
<!--warning BC42306: XML comment tag 'param' is not permitted on a 'class' language element.--><param name="P9" />
<!--warning BC42306: XML comment tag 'paramref' is not permitted on a 'class' language element.--><paramref name="P9" />
</target>
</member>
<member name="M:TestClass.M(System.Int32,System.String)">
<target>
<param name="P9" />
<paramref name="P9" />
</target>
</member>
<member name="F:TestClass.F">
<target>
<!--warning BC42306: XML comment tag 'param' is not permitted on a 'variable' language element.--><param name="P9" />
<!--warning BC42306: XML comment tag 'paramref' is not permitted on a 'variable' language element.--><paramref name="P9" />
</target>
</member>
<member name="P:TestClass.P">
<target>
<!--warning BC42307: XML comment parameter 'P9' does not match a parameter on the corresponding 'property' statement.--><param name="P9" />
<!--warning BC42307: XML comment parameter 'P9' does not match a parameter on the corresponding 'property' statement.--><paramref name="P9" />
</target>
</member>
<member name="P:TestClass.P(System.String)">
<target>
<param name="P9" />
<paramref name="P9" />
</target>
</member>
<member name="E:TestClass.EE">
<target>
<param name="P9" />
<paramref name="P9" />
</target>
</member>
</members>
</doc>
]]>
</xml>, ensureEnglishUICulture:=True)
End Sub
<ConditionalFact(GetType(WindowsOnly), Reason:="https://github.com/dotnet/roslyn/issues/29531")>
Public Sub Include_TypeParamAndTypeParamRef()
Dim xmlText =
<![CDATA[
<root>
<target>
<typeparam name="P9"/>
<typeparamref name="P9"/>
</target>
</root>
]]>
Dim xmlFile = Temp.CreateFile(extension:=".xml").WriteAllText(xmlText.Value.ToString)
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <include file='{0}' path='//target' />
Public Module Module0
''' <include file='{0}' path='//target' />
Public Declare Function DeclareFtn Lib "bar" (p3 As Integer) As Integer
End Module
''' <include file='{0}' path='//target' />
Public Class TestClass(Of P9)
''' <include file='{0}' path='//target' />
Public Enum EN : A : End Enum
''' <include file='{0}' path='//target' />
Public Structure STR(Of X) : End Structure
''' <include file='{0}' path='//target' />
Public Interface INTERF(Of X, Y) : End Interface
''' <include file='{0}' path='//target' />
Public Delegate Sub DelSub(Of W)(a As Integer)
''' <include file='{0}' path='//target' />
Public Delegate Function DelFunc(Of W)(a As Integer) As Integer
''' <include file='{0}' path='//target' />
Public Shared Sub MSub(Of TT)(p3 As Integer, p4 As String)
End Sub
''' <include file='{0}' path='//target' />
Public Shared Function MFunc(p3 As Integer, p4 As String) As Integer
Return Nothing
End Function
''' <include file='{0}' path='//target' />
Public Field As Integer
''' <include file='{0}' path='//target' />
Public WriteOnly Property PWriteOnly(p As Integer) As Integer
Set(value As Integer)
End Set
End Property
''' <include file='{0}' path='//target' />
Public Property PReadWrite As Integer
''' <include file='{0}' path='//target' />
Public Event EVE(ppp As Integer)
End Class
]]>
</file>
</compilation>
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, xmlFile),
<error>
<![CDATA[
BC42306: XML comment tag 'typeparam' is not permitted on a 'declare' language element.
BC42306: XML comment tag 'typeparam' is not permitted on a 'enum' language element.
BC42306: XML comment tag 'typeparam' is not permitted on a 'event' language element.
BC42306: XML comment tag 'typeparam' is not permitted on a 'module' language element.
BC42306: XML comment tag 'typeparam' is not permitted on a 'property' language element.
BC42306: XML comment tag 'typeparam' is not permitted on a 'property' language element.
BC42306: XML comment tag 'typeparam' is not permitted on a 'variable' language element.
BC42306: XML comment tag 'typeparamref' is not permitted on a 'module' language element.
BC42317: XML comment type parameter 'P9' does not match a type parameter on the corresponding 'declare' statement.
BC42317: XML comment type parameter 'P9' does not match a type parameter on the corresponding 'delegate' statement.
BC42317: XML comment type parameter 'P9' does not match a type parameter on the corresponding 'delegate sub' statement.
BC42317: XML comment type parameter 'P9' does not match a type parameter on the corresponding 'function' statement.
BC42317: XML comment type parameter 'P9' does not match a type parameter on the corresponding 'interface' statement.
BC42317: XML comment type parameter 'P9' does not match a type parameter on the corresponding 'structure' statement.
BC42317: XML comment type parameter 'P9' does not match a type parameter on the corresponding 'sub' statement.
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Module0">
<target>
<!--warning BC42306: XML comment tag 'typeparam' is not permitted on a 'module' language element.--><typeparam name="P9" />
<!--warning BC42306: XML comment tag 'typeparamref' is not permitted on a 'module' language element.--><typeparamref name="P9" />
</target>
</member>
<member name="M:Module0.DeclareFtn(System.Int32)">
<target>
<!--warning BC42306: XML comment tag 'typeparam' is not permitted on a 'declare' language element.--><typeparam name="P9" />
<!--warning BC42317: XML comment type parameter 'P9' does not match a type parameter on the corresponding 'declare' statement.--><typeparamref name="P9" />
</target>
</member>
<member name="T:TestClass`1">
<target>
<typeparam name="P9" />
<typeparamref name="P9" />
</target>
</member>
<member name="T:TestClass`1.EN">
<target>
<!--warning BC42306: XML comment tag 'typeparam' is not permitted on a 'enum' language element.--><typeparam name="P9" />
<typeparamref name="P9" />
</target>
</member>
<member name="T:TestClass`1.STR`1">
<target>
<!--warning BC42317: XML comment type parameter 'P9' does not match a type parameter on the corresponding 'structure' statement.--><typeparam name="P9" />
<typeparamref name="P9" />
</target>
</member>
<member name="T:TestClass`1.INTERF`2">
<target>
<!--warning BC42317: XML comment type parameter 'P9' does not match a type parameter on the corresponding 'interface' statement.--><typeparam name="P9" />
<typeparamref name="P9" />
</target>
</member>
<member name="T:TestClass`1.DelSub`1">
<target>
<!--warning BC42317: XML comment type parameter 'P9' does not match a type parameter on the corresponding 'delegate sub' statement.--><typeparam name="P9" />
<typeparamref name="P9" />
</target>
</member>
<member name="T:TestClass`1.DelFunc`1">
<target>
<!--warning BC42317: XML comment type parameter 'P9' does not match a type parameter on the corresponding 'delegate' statement.--><typeparam name="P9" />
<typeparamref name="P9" />
</target>
</member>
<member name="M:TestClass`1.MSub``1(System.Int32,System.String)">
<target>
<!--warning BC42317: XML comment type parameter 'P9' does not match a type parameter on the corresponding 'sub' statement.--><typeparam name="P9" />
<typeparamref name="P9" />
</target>
</member>
<member name="M:TestClass`1.MFunc(System.Int32,System.String)">
<target>
<!--warning BC42317: XML comment type parameter 'P9' does not match a type parameter on the corresponding 'function' statement.--><typeparam name="P9" />
<typeparamref name="P9" />
</target>
</member>
<member name="F:TestClass`1.Field">
<target>
<!--warning BC42306: XML comment tag 'typeparam' is not permitted on a 'variable' language element.--><typeparam name="P9" />
<typeparamref name="P9" />
</target>
</member>
<member name="P:TestClass`1.PWriteOnly(System.Int32)">
<target>
<!--warning BC42306: XML comment tag 'typeparam' is not permitted on a 'property' language element.--><typeparam name="P9" />
<typeparamref name="P9" />
</target>
</member>
<member name="P:TestClass`1.PReadWrite">
<target>
<!--warning BC42306: XML comment tag 'typeparam' is not permitted on a 'property' language element.--><typeparam name="P9" />
<typeparamref name="P9" />
</target>
</member>
<member name="E:TestClass`1.EVE">
<target>
<!--warning BC42306: XML comment tag 'typeparam' is not permitted on a 'event' language element.--><typeparam name="P9" />
<typeparamref name="P9" />
</target>
</member>
</members>
</doc>
]]>
</xml>, ensureEnglishUICulture:=True)
End Sub
<Fact>
Public Sub Include_TypeParameterCref()
Dim xmlText =
<![CDATA[
<root>
<target>
<see cref="P9"/>
</target>
</root>
]]>
Dim xmlFile = Temp.CreateFile(extension:=".xml").WriteAllText(xmlText.Value.ToString)
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <include file='{0}' path='//target' />
Public Module Module0
''' <include file='{0}' path='//target' />
Public Declare Function DeclareFtn Lib "bar" (p3 As Integer) As Integer
End Module
''' <include file='{0}' path='//target' />
Public Class TestClass(Of P9)
''' <include file='{0}' path='//target' />
Public Enum EN : A : End Enum
''' <include file='{0}' path='//target' />
Public Structure STR(Of X) : End Structure
''' <include file='{0}' path='//target' />
Public Interface INTERF(Of X, Y) : End Interface
''' <include file='{0}' path='//target' />
Public Delegate Sub DelSub(Of W)(a As Integer)
''' <include file='{0}' path='//target' />
Public Delegate Function DelFunc(Of W)(a As Integer) As Integer
''' <include file='{0}' path='//target' />
Public Shared Sub MSub(Of TT)(p3 As Integer, p4 As String)
End Sub
''' <include file='{0}' path='//target' />
Public Shared Function MFunc(p3 As Integer, p4 As String) As Integer
Return Nothing
End Function
''' <include file='{0}' path='//target' />
Public Field As Integer
''' <include file='{0}' path='//target' />
Public WriteOnly Property PWriteOnly(p As Integer) As Integer
Set(value As Integer)
End Set
End Property
''' <include file='{0}' path='//target' />
Public Property PReadWrite As Integer
''' <include file='{0}' path='//target' />
Public Event EVE(ppp As Integer)
End Class
]]>
</file>
</compilation>
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, xmlFile),
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'P9' that could not be resolved.
BC42309: XML comment has a tag with a 'cref' attribute 'P9' that could not be resolved.
BC42375: XML comment has a tag with a 'cref' attribute 'P9' that bound to a type parameter. Use the <typeparamref> tag instead.
BC42375: XML comment has a tag with a 'cref' attribute 'P9' that bound to a type parameter. Use the <typeparamref> tag instead.
BC42375: XML comment has a tag with a 'cref' attribute 'P9' that bound to a type parameter. Use the <typeparamref> tag instead.
BC42375: XML comment has a tag with a 'cref' attribute 'P9' that bound to a type parameter. Use the <typeparamref> tag instead.
BC42375: XML comment has a tag with a 'cref' attribute 'P9' that bound to a type parameter. Use the <typeparamref> tag instead.
BC42375: XML comment has a tag with a 'cref' attribute 'P9' that bound to a type parameter. Use the <typeparamref> tag instead.
BC42375: XML comment has a tag with a 'cref' attribute 'P9' that bound to a type parameter. Use the <typeparamref> tag instead.
BC42375: XML comment has a tag with a 'cref' attribute 'P9' that bound to a type parameter. Use the <typeparamref> tag instead.
BC42375: XML comment has a tag with a 'cref' attribute 'P9' that bound to a type parameter. Use the <typeparamref> tag instead.
BC42375: XML comment has a tag with a 'cref' attribute 'P9' that bound to a type parameter. Use the <typeparamref> tag instead.
BC42375: XML comment has a tag with a 'cref' attribute 'P9' that bound to a type parameter. Use the <typeparamref> tag instead.
BC42375: XML comment has a tag with a 'cref' attribute 'P9' that bound to a type parameter. Use the <typeparamref> tag instead.
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Module0">
<target>
<see cref="?:P9" />
</target>
</member>
<member name="M:Module0.DeclareFtn(System.Int32)">
<target>
<see cref="?:P9" />
</target>
</member>
<member name="T:TestClass`1">
<target>
<see cref="?:P9" />
</target>
</member>
<member name="T:TestClass`1.EN">
<target>
<see cref="?:P9" />
</target>
</member>
<member name="T:TestClass`1.STR`1">
<target>
<see cref="?:P9" />
</target>
</member>
<member name="T:TestClass`1.INTERF`2">
<target>
<see cref="?:P9" />
</target>
</member>
<member name="T:TestClass`1.DelSub`1">
<target>
<see cref="?:P9" />
</target>
</member>
<member name="T:TestClass`1.DelFunc`1">
<target>
<see cref="?:P9" />
</target>
</member>
<member name="M:TestClass`1.MSub``1(System.Int32,System.String)">
<target>
<see cref="?:P9" />
</target>
</member>
<member name="M:TestClass`1.MFunc(System.Int32,System.String)">
<target>
<see cref="?:P9" />
</target>
</member>
<member name="F:TestClass`1.Field">
<target>
<see cref="?:P9" />
</target>
</member>
<member name="P:TestClass`1.PWriteOnly(System.Int32)">
<target>
<see cref="?:P9" />
</target>
</member>
<member name="P:TestClass`1.PReadWrite">
<target>
<see cref="?:P9" />
</target>
</member>
<member name="E:TestClass`1.EVE">
<target>
<see cref="?:P9" />
</target>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Private Sub ExtendedCref_IdentifierInName_IdentifierAndGenericInSignature()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
Public Structure TestStruct
''' <see cref="T(List(Of Int32), TestStruct)"/>
Public Shared field As Integer
Sub T(p As List(Of Int32), i as TestStruct)
End Sub
End Structure
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="F:TestStruct.field">
<see cref="M:TestStruct.T(System.Collections.Generic.List{System.Int32},TestStruct)"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNodes = CrefFinder.FindAllCrefs(compilation.SyntaxTrees(0))
Assert.Equal(1, crefNodes.Count)
Dim info = model.GetSymbolInfo(crefNodes(0))
Assert.NotNull(info.Symbol)
Assert.Equal("Sub TestStruct.T(p As System.Collections.Generic.List(Of System.Int32), i As TestStruct)", info.Symbol.ToTestDisplayString())
CheckAllNames(model, crefNodes(0),
New NameSyntaxInfo("T", {"Sub TestStruct.T(p As System.Collections.Generic.List(Of System.Int32), i As TestStruct)"}, {}),
New NameSyntaxInfo("List(Of Int32)", {"System.Collections.Generic.List(Of System.Int32)"}, {"System.Collections.Generic.List(Of System.Int32)"}),
New NameSyntaxInfo("Int32", {"System.Int32"}, {"System.Int32"}),
New NameSyntaxInfo("TestStruct", {"TestStruct"}, {"TestStruct"}))
End Sub
<WorkItem(703587, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/703587")>
<Fact()>
Private Sub ObjectMemberViaInterfaceA()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' Comment
Public Class C
Implements IEquatable(Of C)
''' Implements <see cref="IEquatable(Of T).Equals"/>.
''' Implements <see cref="IEquatable(Of T).GetHashCode"/>.
''' Implements <see cref="IEquatable(Of T).Equals(T)"/>.
''' Implements <see cref="IEquatable(Of T).GetHashCode()"/>.
Public Function IEquals(c As C) As Boolean Implements IEquatable(Of C).Equals
Return False
End Function
End Class
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:C">
Comment
</member>
<member name="M:C.IEquals(C)">
Implements <see cref="M:System.IEquatable`1.Equals(`0)"/>.
Implements <see cref="!:IEquatable(Of T).GetHashCode"/>.
Implements <see cref="M:System.IEquatable`1.Equals(`0)"/>.
Implements <see cref="!:IEquatable(Of T).GetHashCode()"/>.
</member>
</members>
</doc>
]]>
</xml>
CompileCheckDiagnosticsAndXmlDocument(xmlSource,
<errors>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'IEquatable(Of T).GetHashCode' that could not be resolved.
''' Implements <see cref="IEquatable(Of T).GetHashCode"/>.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'IEquatable(Of T).GetHashCode()' that could not be resolved.
''' Implements <see cref="IEquatable(Of T).GetHashCode()"/>.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</errors>,
xmlDoc)
End Sub
<WorkItem(703587, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/703587")>
<Fact()>
Private Sub ObjectMemberViaInterfaceB()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' Comment
Public Interface INT
Inherits IEquatable(Of Integer)
''' Implements <see cref="Equals"/>.
''' Implements <see cref="IEquals(Integer)"/>.
''' Implements <see cref="Equals(Object)"/>.
''' Implements <see cref="Equals(Integer)"/>.
''' Implements <see cref="GetHashCode"/>.
''' Implements <see cref="GetHashCode()"/>.
Function IEquals(c As Integer) As Boolean
End Interface
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:INT">
Comment
</member>
<member name="M:INT.IEquals(System.Int32)">
Implements <see cref="M:System.IEquatable`1.Equals(`0)"/>.
Implements <see cref="M:INT.IEquals(System.Int32)"/>.
Implements <see cref="!:Equals(Object)"/>.
Implements <see cref="M:System.IEquatable`1.Equals(`0)"/>.
Implements <see cref="!:GetHashCode"/>.
Implements <see cref="!:GetHashCode()"/>.
</member>
</members>
</doc>
]]>
</xml>
CompileCheckDiagnosticsAndXmlDocument(xmlSource,
<errors>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Equals(Object)' that could not be resolved.
''' Implements <see cref="Equals(Object)"/>.
~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'GetHashCode' that could not be resolved.
''' Implements <see cref="GetHashCode"/>.
~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'GetHashCode()' that could not be resolved.
''' Implements <see cref="GetHashCode()"/>.
~~~~~~~~~~~~~~~~~~~~
]]>
</errors>,
xmlDoc)
End Sub
<Fact>
Private Sub ExtendedCref_GenericInName_IdentifierInSignature()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Structure TestStruct
''' <see cref="T(Of T)(T, TestStruct)"/>
Public Shared field As Integer
Sub T(Of T)(p As T, i as TestStruct)
End Sub
End Structure
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="F:TestStruct.field">
<see cref="M:TestStruct.T``1(``0,TestStruct)"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNodes = CrefFinder.FindAllCrefs(compilation.SyntaxTrees(0))
Assert.Equal(1, crefNodes.Count)
Dim info = model.GetSymbolInfo(crefNodes(0))
Assert.NotNull(info.Symbol)
Assert.Equal("Sub TestStruct.T(Of T)(p As T, i As TestStruct)", info.Symbol.ToTestDisplayString())
CheckAllNames(model, crefNodes(0),
New NameSyntaxInfo("T(Of T)", {"Sub TestStruct.T(Of T)(p As T, i As TestStruct)"}, {}),
New NameSyntaxInfo("T", {"T"}, {"T"}),
New NameSyntaxInfo("T", {"T"}, {"T"}),
New NameSyntaxInfo("TestStruct", {"TestStruct"}, {"TestStruct"}))
End Sub
<Fact>
Private Sub ExtendedCref_GenericInName_GlobalInSignature()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Structure TestStruct
''' <see cref="T(Of T)(T, Global.TestStruct)"/>
Public Shared field As Integer
Sub T(Of T)(p As T, i as TestStruct)
End Sub
End Structure
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="F:TestStruct.field">
<see cref="M:TestStruct.T``1(``0,TestStruct)"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNodes = CrefFinder.FindAllCrefs(compilation.SyntaxTrees(0))
Assert.Equal(1, crefNodes.Count)
Dim info = model.GetSymbolInfo(crefNodes(0))
Assert.NotNull(info.Symbol)
Assert.Equal("Sub TestStruct.T(Of T)(p As T, i As TestStruct)", info.Symbol.ToTestDisplayString())
CheckAllNames(model, crefNodes(0),
New NameSyntaxInfo("T(Of T)", {"Sub TestStruct.T(Of T)(p As T, i As TestStruct)"}, {}),
New NameSyntaxInfo("T", {"T"}, {"T"}),
New NameSyntaxInfo("T", {"T"}, {"T"}),
New NameSyntaxInfo("Global.TestStruct", {"TestStruct"}, {"TestStruct"}),
New NameSyntaxInfo("Global", {"Global"}, {}),
New NameSyntaxInfo("TestStruct", {"TestStruct"}, {"TestStruct"}))
End Sub
<Fact>
Private Sub ExtendedCref_GlobalAndQualifiedInName_TypeParamInSignature()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Structure TestStruct
''' <see cref="Global.TestStruct.T(Of T)(T, TestStruct)"/>
Public Shared field As Integer
Sub T(Of T)(p As T, i as TestStruct)
End Sub
End Structure
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="F:TestStruct.field">
<see cref="M:TestStruct.T``1(``0,TestStruct)"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNodes = CrefFinder.FindAllCrefs(compilation.SyntaxTrees(0))
Assert.Equal(1, crefNodes.Count)
Dim info = model.GetSymbolInfo(crefNodes(0))
Assert.NotNull(info.Symbol)
Assert.Equal("Sub TestStruct.T(Of T)(p As T, i As TestStruct)", info.Symbol.ToTestDisplayString())
CheckAllNames(model, crefNodes(0),
New NameSyntaxInfo("Global.TestStruct.T(Of T)", {"Sub TestStruct.T(Of T)(p As T, i As TestStruct)"}, {}),
New NameSyntaxInfo("Global.TestStruct", {"TestStruct"}, {"TestStruct"}),
New NameSyntaxInfo("Global", {"Global"}, {}),
New NameSyntaxInfo("TestStruct", {"TestStruct"}, {"TestStruct"}),
New NameSyntaxInfo("T(Of T)", {"Sub TestStruct.T(Of T)(p As T, i As TestStruct)"}, {}),
New NameSyntaxInfo("T", {"T"}, {"T"}),
New NameSyntaxInfo("T", {"T"}, {"T"}),
New NameSyntaxInfo("TestStruct", {"TestStruct"}, {"TestStruct"}))
End Sub
<Fact>
Private Sub ExtendedCref_QualifiedOperatorReference()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Structure TestStruct(Of X)
''' <see cref="Global.TestStruct(Of ZZZ). operator+(integer, TestStruct(Of zzz))"/>
Public Shared field As Integer
Public Shared Operator +(a As Integer, b As TestStruct(Of X)) As String
Return Nothing
End Operator
End Structure]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="F:TestStruct`1.field">
<see cref="M:TestStruct`1.op_Addition(System.Int32,TestStruct{`0})"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNodes = CrefFinder.FindAllCrefs(compilation.SyntaxTrees(0))
Assert.Equal(1, crefNodes.Count)
Dim info = model.GetSymbolInfo(crefNodes(0))
Assert.NotNull(info.Symbol)
Assert.Equal("Function TestStruct(Of ZZZ).op_Addition(a As System.Int32, b As TestStruct(Of ZZZ)) As System.String", info.Symbol.ToTestDisplayString())
CheckAllNames(model, crefNodes(0),
New NameSyntaxInfo("Global.TestStruct(Of ZZZ). operator+", {"Function TestStruct(Of ZZZ).op_Addition(a As System.Int32, b As TestStruct(Of ZZZ)) As System.String"}, {}),
New NameSyntaxInfo("Global.TestStruct(Of ZZZ)", {"TestStruct(Of ZZZ)"}, {"TestStruct(Of ZZZ)"}),
New NameSyntaxInfo("Global", {"Global"}, {}),
New NameSyntaxInfo("TestStruct(Of ZZZ)", {"TestStruct(Of ZZZ)"}, {"TestStruct(Of ZZZ)"}),
New NameSyntaxInfo("ZZZ", {"ZZZ"}, {"ZZZ"}),
New NameSyntaxInfo("operator+", {"Function TestStruct(Of ZZZ).op_Addition(a As System.Int32, b As TestStruct(Of ZZZ)) As System.String"}, {}),
New NameSyntaxInfo("TestStruct(Of zzz)", {"TestStruct(Of ZZZ)"}, {"TestStruct(Of ZZZ)"}),
New NameSyntaxInfo("zzz", {"ZZZ"}, {"ZZZ"}))
End Sub
<Fact>
Private Sub ExtendedCref_OperatorReference()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class Clazz
Public Structure TestStruct
''' <see cref="operator+(integer, Global.Clazz.TestStruct)"/>
Public Shared field As Integer
Public Shared Operator +(a As Integer, b As TestStruct) As String
Return Nothing
End Operator
End Structure
End Class
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="F:Clazz.TestStruct.field">
<see cref="M:Clazz.TestStruct.op_Addition(System.Int32,Clazz.TestStruct)"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNodes = CrefFinder.FindAllCrefs(compilation.SyntaxTrees(0))
Assert.Equal(1, crefNodes.Count)
Dim info = model.GetSymbolInfo(crefNodes(0))
Assert.NotNull(info.Symbol)
Assert.Equal("Function Clazz.TestStruct.op_Addition(a As System.Int32, b As Clazz.TestStruct) As System.String", info.Symbol.ToTestDisplayString())
CheckAllNames(model, crefNodes(0),
New NameSyntaxInfo("operator+", {"Function Clazz.TestStruct.op_Addition(a As System.Int32, b As Clazz.TestStruct) As System.String"}, {}),
New NameSyntaxInfo("Global.Clazz.TestStruct", {"Clazz.TestStruct"}, {"Clazz.TestStruct"}),
New NameSyntaxInfo("Global.Clazz", {"Clazz"}, {"Clazz"}),
New NameSyntaxInfo("Global", {"Global"}, {}),
New NameSyntaxInfo("Clazz", {"Clazz"}, {"Clazz"}),
New NameSyntaxInfo("TestStruct", {"Clazz.TestStruct"}, {"Clazz.TestStruct"}))
End Sub
<Fact>
Private Sub ExtendedCref_ReturnType()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class GenericClazz(Of T)
End Class
Public Class Clazz(Of X)
Public Structure TestStruct
''' <see cref="operator ctype(Integer)"/>
''' <see cref="operator ctype(Integer) As TestStruct"/>
''' <see cref="Global.Clazz(Of A) . TestStruct. operator ctype(Clazz(Of A).TestStruct) As A"/>
''' <see cref="Global.Clazz(Of B) . TestStruct. operator ctype(B)"/>
''' <see cref="operator ctype(TestStruct) As Global.Clazz(Of Integer)"/>
''' <see cref="Clazz(Of C).TestStruct.operator ctype(Clazz(Of C). TestStruct) As GenericClazz(Of C)"/>
Public Shared field As Integer
Public Shared Narrowing Operator CType(a As Integer) As TestStruct
Return Nothing
End Operator
Public Shared Narrowing Operator CType(a As TestStruct) As X
Return Nothing
End Operator
Public Shared Narrowing Operator CType(a As TestStruct) As GenericClazz(Of X)
Return Nothing
End Operator
Public Shared Narrowing Operator CType(a As X) As TestStruct
Return Nothing
End Operator
Public Shared Narrowing Operator CType(a As TestStruct) As Global.Clazz(Of Integer)
Return Nothing
End Operator
End Structure
End Class
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="F:Clazz`1.TestStruct.field">
<see cref="M:Clazz`1.TestStruct.op_Explicit(System.Int32)~Clazz{`0}.TestStruct"/>
<see cref="M:Clazz`1.TestStruct.op_Explicit(System.Int32)~Clazz{`0}.TestStruct"/>
<see cref="M:Clazz`1.TestStruct.op_Explicit(Clazz{`0}.TestStruct)~`0"/>
<see cref="M:Clazz`1.TestStruct.op_Explicit(`0)~Clazz{`0}.TestStruct"/>
<see cref="M:Clazz`1.TestStruct.op_Explicit(Clazz{`0}.TestStruct)~Clazz{System.Int32}"/>
<see cref="M:Clazz`1.TestStruct.op_Explicit(Clazz{`0}.TestStruct)~GenericClazz{`0}"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNodes = CrefFinder.FindAllCrefs(compilation.SyntaxTrees(0))
Assert.Equal(6, crefNodes.Count)
Dim index As Integer = 0
For Each name In {"Function Clazz(Of X).TestStruct.op_Explicit(a As System.Int32) As Clazz(Of X).TestStruct",
"Function Clazz(Of X).TestStruct.op_Explicit(a As System.Int32) As Clazz(Of X).TestStruct",
"Function Clazz(Of A).TestStruct.op_Explicit(a As Clazz(Of A).TestStruct) As A",
"Function Clazz(Of B).TestStruct.op_Explicit(a As B) As Clazz(Of B).TestStruct",
"Function Clazz(Of X).TestStruct.op_Explicit(a As Clazz(Of X).TestStruct) As Clazz(Of System.Int32)",
"Function Clazz(Of C).TestStruct.op_Explicit(a As Clazz(Of C).TestStruct) As GenericClazz(Of C)"}
Dim info = model.GetSymbolInfo(crefNodes(index))
If name Is Nothing Then
Assert.True(info.IsEmpty)
Else
Assert.NotNull(info.Symbol)
Assert.Equal(name, info.Symbol.ToTestDisplayString())
End If
index += 1
Next
CheckAllNames(model, crefNodes(0),
New NameSyntaxInfo("operator ctype",
{"Function Clazz(Of X).TestStruct.op_Explicit(a As Clazz(Of X).TestStruct) As Clazz(Of System.Int32)",
"Function Clazz(Of X).TestStruct.op_Explicit(a As Clazz(Of X).TestStruct) As GenericClazz(Of X)",
"Function Clazz(Of X).TestStruct.op_Explicit(a As Clazz(Of X).TestStruct) As X",
"Function Clazz(Of X).TestStruct.op_Explicit(a As System.Int32) As Clazz(Of X).TestStruct",
"Function Clazz(Of X).TestStruct.op_Explicit(a As X) As Clazz(Of X).TestStruct"},
{}))
CheckAllNames(model, crefNodes(1),
New NameSyntaxInfo("operator ctype",
{"Function Clazz(Of X).TestStruct.op_Explicit(a As Clazz(Of X).TestStruct) As Clazz(Of System.Int32)",
"Function Clazz(Of X).TestStruct.op_Explicit(a As Clazz(Of X).TestStruct) As GenericClazz(Of X)",
"Function Clazz(Of X).TestStruct.op_Explicit(a As Clazz(Of X).TestStruct) As X",
"Function Clazz(Of X).TestStruct.op_Explicit(a As System.Int32) As Clazz(Of X).TestStruct",
"Function Clazz(Of X).TestStruct.op_Explicit(a As X) As Clazz(Of X).TestStruct"},
{}),
New NameSyntaxInfo("TestStruct", {"Clazz(Of X).TestStruct"}, {"Clazz(Of X).TestStruct"}))
CheckAllNames(model, crefNodes(2),
New NameSyntaxInfo("Global.Clazz(Of A) . TestStruct. operator ctype",
{"Function Clazz(Of A).TestStruct.op_Explicit(a As Clazz(Of A).TestStruct) As Clazz(Of System.Int32)",
"Function Clazz(Of A).TestStruct.op_Explicit(a As Clazz(Of A).TestStruct) As GenericClazz(Of A)",
"Function Clazz(Of A).TestStruct.op_Explicit(a As Clazz(Of A).TestStruct) As A",
"Function Clazz(Of A).TestStruct.op_Explicit(a As System.Int32) As Clazz(Of A).TestStruct",
"Function Clazz(Of A).TestStruct.op_Explicit(a As A) As Clazz(Of A).TestStruct"},
{}),
New NameSyntaxInfo("Global.Clazz(Of A) . TestStruct", {"Clazz(Of A).TestStruct"}, {"Clazz(Of A).TestStruct"}),
New NameSyntaxInfo("Global.Clazz(Of A)", {"Clazz(Of A)"}, {"Clazz(Of A)"}),
New NameSyntaxInfo("Global", {"Global"}, {}),
New NameSyntaxInfo("Clazz(Of A)", {"Clazz(Of A)"}, {"Clazz(Of A)"}),
New NameSyntaxInfo("A", {"A"}, {"A"}),
New NameSyntaxInfo("TestStruct", {"Clazz(Of A).TestStruct"}, {"Clazz(Of A).TestStruct"}),
New NameSyntaxInfo("operator ctype",
{"Function Clazz(Of A).TestStruct.op_Explicit(a As Clazz(Of A).TestStruct) As Clazz(Of System.Int32)",
"Function Clazz(Of A).TestStruct.op_Explicit(a As Clazz(Of A).TestStruct) As GenericClazz(Of A)",
"Function Clazz(Of A).TestStruct.op_Explicit(a As Clazz(Of A).TestStruct) As A",
"Function Clazz(Of A).TestStruct.op_Explicit(a As System.Int32) As Clazz(Of A).TestStruct",
"Function Clazz(Of A).TestStruct.op_Explicit(a As A) As Clazz(Of A).TestStruct"},
{}),
New NameSyntaxInfo("Clazz(Of A).TestStruct", {"Clazz(Of A).TestStruct"}, {"Clazz(Of A).TestStruct"}),
New NameSyntaxInfo("Clazz(Of A)", {"Clazz(Of A)"}, {"Clazz(Of A)"}),
New NameSyntaxInfo("A", {"A"}, {"A"}),
New NameSyntaxInfo("TestStruct", {"Clazz(Of A).TestStruct"}, {"Clazz(Of A).TestStruct"}),
New NameSyntaxInfo("A", {"A"}, {"A"}))
CheckAllNames(model, crefNodes(3),
New NameSyntaxInfo("Global.Clazz(Of B) . TestStruct. operator ctype",
{"Function Clazz(Of B).TestStruct.op_Explicit(a As Clazz(Of B).TestStruct) As Clazz(Of System.Int32)",
"Function Clazz(Of B).TestStruct.op_Explicit(a As Clazz(Of B).TestStruct) As GenericClazz(Of B)",
"Function Clazz(Of B).TestStruct.op_Explicit(a As Clazz(Of B).TestStruct) As B",
"Function Clazz(Of B).TestStruct.op_Explicit(a As System.Int32) As Clazz(Of B).TestStruct",
"Function Clazz(Of B).TestStruct.op_Explicit(a As B) As Clazz(Of B).TestStruct"},
{}),
New NameSyntaxInfo("Global.Clazz(Of B) . TestStruct", {"Clazz(Of B).TestStruct"}, {"Clazz(Of B).TestStruct"}),
New NameSyntaxInfo("Global.Clazz(Of B)", {"Clazz(Of B)"}, {"Clazz(Of B)"}),
New NameSyntaxInfo("Global", {"Global"}, {}),
New NameSyntaxInfo("Clazz(Of B)", {"Clazz(Of B)"}, {"Clazz(Of B)"}),
New NameSyntaxInfo("B", {"B"}, {"B"}),
New NameSyntaxInfo("TestStruct", {"Clazz(Of B).TestStruct"}, {"Clazz(Of B).TestStruct"}),
New NameSyntaxInfo("operator ctype",
{"Function Clazz(Of B).TestStruct.op_Explicit(a As Clazz(Of B).TestStruct) As Clazz(Of System.Int32)",
"Function Clazz(Of B).TestStruct.op_Explicit(a As Clazz(Of B).TestStruct) As GenericClazz(Of B)",
"Function Clazz(Of B).TestStruct.op_Explicit(a As Clazz(Of B).TestStruct) As B",
"Function Clazz(Of B).TestStruct.op_Explicit(a As System.Int32) As Clazz(Of B).TestStruct",
"Function Clazz(Of B).TestStruct.op_Explicit(a As B) As Clazz(Of B).TestStruct"},
{}),
New NameSyntaxInfo("B", {"B"}, {"B"}))
CheckAllNames(model, crefNodes(4),
New NameSyntaxInfo("operator ctype",
{"Function Clazz(Of X).TestStruct.op_Explicit(a As Clazz(Of X).TestStruct) As Clazz(Of System.Int32)",
"Function Clazz(Of X).TestStruct.op_Explicit(a As Clazz(Of X).TestStruct) As GenericClazz(Of X)",
"Function Clazz(Of X).TestStruct.op_Explicit(a As Clazz(Of X).TestStruct) As X",
"Function Clazz(Of X).TestStruct.op_Explicit(a As System.Int32) As Clazz(Of X).TestStruct",
"Function Clazz(Of X).TestStruct.op_Explicit(a As X) As Clazz(Of X).TestStruct"},
{}),
New NameSyntaxInfo("TestStruct", {"Clazz(Of X).TestStruct"}, {"Clazz(Of X).TestStruct"}),
New NameSyntaxInfo("Global.Clazz(Of Integer)", {"Clazz(Of System.Int32)"}, {"Clazz(Of System.Int32)"}),
New NameSyntaxInfo("Global", {"Global"}, {}),
New NameSyntaxInfo("Clazz(Of Integer)", {"Clazz(Of System.Int32)"}, {"Clazz(Of System.Int32)"}))
CheckAllNames(model, crefNodes(5),
New NameSyntaxInfo("Clazz(Of C).TestStruct.operator ctype",
{"Function Clazz(Of C).TestStruct.op_Explicit(a As Clazz(Of C).TestStruct) As Clazz(Of System.Int32)",
"Function Clazz(Of C).TestStruct.op_Explicit(a As Clazz(Of C).TestStruct) As GenericClazz(Of C)",
"Function Clazz(Of C).TestStruct.op_Explicit(a As Clazz(Of C).TestStruct) As C",
"Function Clazz(Of C).TestStruct.op_Explicit(a As System.Int32) As Clazz(Of C).TestStruct",
"Function Clazz(Of C).TestStruct.op_Explicit(a As C) As Clazz(Of C).TestStruct"},
{}),
New NameSyntaxInfo("Clazz(Of C).TestStruct", {"Clazz(Of C).TestStruct"}, {"Clazz(Of C).TestStruct"}),
New NameSyntaxInfo("Clazz(Of C)", {"Clazz(Of C)"}, {"Clazz(Of C)"}),
New NameSyntaxInfo("C", {"C"}, {"C"}),
New NameSyntaxInfo("TestStruct", {"Clazz(Of C).TestStruct"}, {"Clazz(Of C).TestStruct"}),
New NameSyntaxInfo("operator ctype",
{"Function Clazz(Of C).TestStruct.op_Explicit(a As Clazz(Of C).TestStruct) As Clazz(Of System.Int32)",
"Function Clazz(Of C).TestStruct.op_Explicit(a As Clazz(Of C).TestStruct) As GenericClazz(Of C)",
"Function Clazz(Of C).TestStruct.op_Explicit(a As Clazz(Of C).TestStruct) As C",
"Function Clazz(Of C).TestStruct.op_Explicit(a As System.Int32) As Clazz(Of C).TestStruct",
"Function Clazz(Of C).TestStruct.op_Explicit(a As C) As Clazz(Of C).TestStruct"},
{}),
New NameSyntaxInfo("Clazz(Of C). TestStruct", {"Clazz(Of C).TestStruct"}, {"Clazz(Of C).TestStruct"}),
New NameSyntaxInfo("Clazz(Of C)", {"Clazz(Of C)"}, {"Clazz(Of C)"}),
New NameSyntaxInfo("C", {"C"}, {"C"}),
New NameSyntaxInfo("TestStruct", {"Clazz(Of C).TestStruct"}, {"Clazz(Of C).TestStruct"}),
New NameSyntaxInfo("GenericClazz(Of C)", {"GenericClazz(Of C)"}, {"GenericClazz(Of C)"}),
New NameSyntaxInfo("C", {"C"}, {"C"}))
End Sub
<Fact>
Private Sub ExtendedCref_ColorColor()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class SomeClass
Public Sub SB()
End Sub
End Class
Public Class Clazz
Public someClass As SomeClass
Public Structure TestStruct
''' <see cref="someclass.sb()"/>
''' <see cref="operator ctype(SomeClass) As TestStruct"/>
''' <see cref="operator ctype(TestStruct) As SomeClass"/>
Public Shared field As Integer
Public Shared Narrowing Operator CType(a As TestStruct) As SomeClass
Return Nothing
End Operator
Public Shared Narrowing Operator CType(a As SomeClass) As TestStruct
Return Nothing
End Operator
End Structure
End Class
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="F:Clazz.TestStruct.field">
<see cref="M:SomeClass.SB"/>
<see cref="M:Clazz.TestStruct.op_Explicit(SomeClass)~Clazz.TestStruct"/>
<see cref="M:Clazz.TestStruct.op_Explicit(Clazz.TestStruct)~SomeClass"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNodes = CrefFinder.FindAllCrefs(compilation.SyntaxTrees(0))
Assert.Equal(3, crefNodes.Count)
Dim index As Integer = 0
For Each name In {"Sub SomeClass.SB()",
"Function Clazz.TestStruct.op_Explicit(a As SomeClass) As Clazz.TestStruct",
"Function Clazz.TestStruct.op_Explicit(a As Clazz.TestStruct) As SomeClass"}
Dim info = model.GetSymbolInfo(crefNodes(index))
If name Is Nothing Then
Assert.True(info.IsEmpty)
Else
Assert.NotNull(info.Symbol)
Assert.Equal(name, info.Symbol.ToTestDisplayString())
End If
index += 1
Next
CheckAllNames(model, crefNodes(0),
New NameSyntaxInfo("someclass.sb", {"Sub SomeClass.SB()"}, {}),
New NameSyntaxInfo("someclass", {"SomeClass"}, {"SomeClass"}),
New NameSyntaxInfo("sb", {"Sub SomeClass.SB()"}, {}))
CheckAllNames(model, crefNodes(1),
New NameSyntaxInfo("operator ctype",
{"Function Clazz.TestStruct.op_Explicit(a As SomeClass) As Clazz.TestStruct",
"Function Clazz.TestStruct.op_Explicit(a As Clazz.TestStruct) As SomeClass"},
{}),
New NameSyntaxInfo("SomeClass", {"SomeClass"}, {"SomeClass"}),
New NameSyntaxInfo("TestStruct", {"Clazz.TestStruct"}, {"Clazz.TestStruct"}))
CheckAllNames(model, crefNodes(2),
New NameSyntaxInfo("operator ctype",
{"Function Clazz.TestStruct.op_Explicit(a As SomeClass) As Clazz.TestStruct",
"Function Clazz.TestStruct.op_Explicit(a As Clazz.TestStruct) As SomeClass"},
{}),
New NameSyntaxInfo("TestStruct", {"Clazz.TestStruct"}, {"Clazz.TestStruct"}),
New NameSyntaxInfo("SomeClass", {"SomeClass"}, {"SomeClass"}))
End Sub
<Fact>
Private Sub ExtendedCref_ReferencingConversionByMethodName()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class SomeClass
End Class
Public Structure TestStruct
''' <see cref="op_Implicit(SomeClass)"/>
''' <see cref="op_Explicit(TestStruct)"/>
Public Shared field As Integer
Public Shared Narrowing Operator CType(a As TestStruct) As SomeClass
Return Nothing
End Operator
Public Shared Widening Operator CType(a As SomeClass) As TestStruct
Return Nothing
End Operator
End Structure
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="F:TestStruct.field">
<see cref="M:TestStruct.op_Implicit(SomeClass)~TestStruct"/>
<see cref="M:TestStruct.op_Explicit(TestStruct)~SomeClass"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNodes = CrefFinder.FindAllCrefs(compilation.SyntaxTrees(0))
Assert.Equal(2, crefNodes.Count)
Dim index As Integer = 0
For Each name In {"Function TestStruct.op_Implicit(a As SomeClass) As TestStruct",
"Function TestStruct.op_Explicit(a As TestStruct) As SomeClass"}
Dim info = model.GetSymbolInfo(crefNodes(index))
If name Is Nothing Then
Assert.True(info.IsEmpty)
Else
Assert.NotNull(info.Symbol)
Assert.Equal(name, info.Symbol.ToTestDisplayString())
End If
index += 1
Next
End Sub
<Fact>
Private Sub ExtendedCref_ReferencingConversionByMethodName_ReturnTypeOverloading()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class SomeClass
End Class
Public Structure TestStruct
''' <see cref="op_Implicit(TestStruct) As SomeClass"/>
''' <see cref="op_Implicit(TestStruct) As String"/>
Public Shared field As Integer
Public Shared Widening Operator CType(a As TestStruct) As SomeClass
Return Nothing
End Operator
Public Shared Widening Operator CType(a As TestStruct) As String
Return Nothing
End Operator
End Structure
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="F:TestStruct.field">
<see cref="M:TestStruct.op_Implicit(TestStruct)~SomeClass"/>
<see cref="M:TestStruct.op_Implicit(TestStruct)~System.String"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNodes = CrefFinder.FindAllCrefs(compilation.SyntaxTrees(0))
Assert.Equal(2, crefNodes.Count)
Dim index As Integer = 0
For Each name In {"Function TestStruct.op_Implicit(a As TestStruct) As SomeClass",
"Function TestStruct.op_Implicit(a As TestStruct) As System.String"}
Dim info = model.GetSymbolInfo(crefNodes(index))
If name Is Nothing Then
Assert.True(info.IsEmpty)
Else
Assert.NotNull(info.Symbol)
Assert.Equal(name, info.Symbol.ToTestDisplayString())
End If
index += 1
Next
End Sub
<Fact>
Private Sub ExtendedCref_MemberAndTypeParamConflict()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Structure T(Of X)
Class T(Of Y)
Sub T(Of T)(p As T, i as TestStruct)
End Sub
End Class
End Structure
Public Structure TestStruct
''' <see cref="Global.T(Of T).T(Of T).T(Of T)(T, TestStruct)"/>
Public Shared field As Integer
End Structure
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="F:TestStruct.field">
<see cref="M:T`1.T`1.T``1(``0,TestStruct)"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNodes = CrefFinder.FindAllCrefs(compilation.SyntaxTrees(0))
Assert.Equal(1, crefNodes.Count)
Dim info = model.GetSymbolInfo(crefNodes(0))
Assert.NotNull(info.Symbol)
Assert.Equal("Sub T(Of T).T(Of T).T(Of T)(p As T, i As TestStruct)", info.Symbol.ToTestDisplayString())
CheckAllNames(model, crefNodes(0),
New NameSyntaxInfo("Global.T(Of T).T(Of T).T(Of T)", {"Sub T(Of T).T(Of T).T(Of T)(p As T, i As TestStruct)"}, {}),
New NameSyntaxInfo("Global.T(Of T).T(Of T)", {"T(Of T).T(Of T)"}, {"T(Of T).T(Of T)"}),
New NameSyntaxInfo("Global.T(Of T)", {"T(Of T)"}, {"T(Of T)"}),
New NameSyntaxInfo("Global", {"Global"}, {}),
New NameSyntaxInfo("T(Of T)", {"T(Of T)"}, {"T(Of T)"}),
New NameSyntaxInfo("T", {"T"}, {"T"}),
New NameSyntaxInfo("T(Of T)", {"T(Of T).T(Of T)"}, {"T(Of T).T(Of T)"}),
New NameSyntaxInfo("T", {"T"}, {"T"}),
New NameSyntaxInfo("T(Of T)", {"Sub T(Of T).T(Of T).T(Of T)(p As T, i As TestStruct)"}, {}),
New NameSyntaxInfo("T", {"T"}, {"T"}),
New NameSyntaxInfo("T", {"T"}, {"T"}),
New NameSyntaxInfo("TestStruct", {"TestStruct"}, {"TestStruct"}))
End Sub
Private Structure NameSyntaxInfo
Public ReadOnly Syntax As String
Public ReadOnly Symbols As String()
Public ReadOnly Types As String()
Public Sub New(syntax As String, symbols As String(), types As String())
Me.Syntax = syntax
Me.Symbols = symbols
Me.Types = types
End Sub
End Structure
Private Sub CheckAllNames(model As SemanticModel, cref As CrefReferenceSyntax, ParamArray expected As NameSyntaxInfo())
Dim names = NameSyntaxFinder.FindNames(cref)
Assert.Equal(expected.Length, names.Count)
For i = 0 To names.Count - 1
Dim e = expected(i)
Dim sym = names(i)
Assert.Equal(e.Syntax, sym.ToString().Trim())
Dim actual = model.GetSymbolInfo(sym)
If e.Symbols.Length = 0 Then
Assert.True(actual.IsEmpty)
ElseIf e.Symbols.Length = 1 Then
Assert.NotNull(actual.Symbol)
Assert.Equal(e.Symbols(0), actual.Symbol.ToTestDisplayString)
Else
Assert.Equal(CandidateReason.Ambiguous, actual.CandidateReason)
AssertStringArraysEqual(e.Symbols, (From s In actual.CandidateSymbols Select s.ToTestDisplayString()).ToArray)
End If
Dim typeInfo = model.GetTypeInfo(sym)
If e.Types.Length = 0 Then
Assert.Null(typeInfo.Type)
ElseIf e.Types.Length = 1 Then
Assert.NotNull(typeInfo.Type)
Assert.Equal(e.Types(0), typeInfo.Type.ToTestDisplayString())
Else
Assert.Null(typeInfo.Type)
End If
Next
End Sub
<Fact>
Private Sub ExtendedCref_UnaryOperatorsAndConversion()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class Clazz
Public Shared Operator Like(a As Clazz, b As Integer) As Clazz
Return Nothing
End Operator
Public Shared Operator And(a As Clazz, b As Integer) As Clazz
Return Nothing
End Operator
Public Shared Operator Or(a As Clazz, b As Integer) As Clazz
Return Nothing
End Operator
Public Shared Operator Xor(a As Clazz, b As Integer) As Clazz
Return Nothing
End Operator
Public Shared Operator Mod(a As Clazz, b As Integer) As Clazz
Return Nothing
End Operator
Public Shared Operator Not(a As Clazz) As Boolean
Return Nothing
End Operator
Public Shared Operator IsTrue(a As Clazz) As Boolean
Return Nothing
End Operator
Public Shared Operator IsFalse(a As Clazz) As Boolean
Return Nothing
End Operator
Public Shared Narrowing Operator CType(a As Clazz) As String
Return Nothing
End Operator
Public Shared Widening Operator CType(a As Clazz) As Integer?
Return Nothing
End Operator
Public Shared Widening Operator CType(a As Integer?) As Clazz
Return Nothing
End Operator
Public Shared Narrowing Operator CType(a As Integer) As Clazz
Return Nothing
End Operator
''' <see cref="operator Like (Clazz, Int32)"/>
''' <see cref="Clazz. operator And (Clazz, Int32)"/>
''' <see cref="operator Or (Clazz, Int32)"/>
''' <see cref=" Clazz. operator Xor (Clazz, Int32)"/>
''' <see cref="operator Mod (Clazz, Int32)"/>
''' <see cref="Global . Clazz. operator Not (Clazz)"/>
''' <see cref=" operator istrue (Clazz)"/>
''' <see cref=" Clazz. operator isfalse (Clazz)"/>
''' <see cref=" operator ctype (Clazz) as string"/>
''' <see cref=" Clazz. operator ctype (Clazz) as integer?"/>
''' <see cref=" operator ctype (integer?) as clazz"/>
''' <see cref=" operator ctype (integer) as clazz"/>
''' <see cref=" Global . Clazz. operator ctype (integer) as clazz"/>
Public Shared field As Integer
End Class
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="F:Clazz.field">
<see cref="M:Clazz.op_Like(Clazz,System.Int32)"/>
<see cref="M:Clazz.op_BitwiseAnd(Clazz,System.Int32)"/>
<see cref="M:Clazz.op_BitwiseOr(Clazz,System.Int32)"/>
<see cref="M:Clazz.op_ExclusiveOr(Clazz,System.Int32)"/>
<see cref="M:Clazz.op_Modulus(Clazz,System.Int32)"/>
<see cref="M:Clazz.op_OnesComplement(Clazz)"/>
<see cref="M:Clazz.op_True(Clazz)"/>
<see cref="M:Clazz.op_False(Clazz)"/>
<see cref="M:Clazz.op_Explicit(Clazz)~System.String"/>
<see cref="M:Clazz.op_Implicit(Clazz)~System.Nullable{System.Int32}"/>
<see cref="M:Clazz.op_Implicit(System.Nullable{System.Int32})~Clazz"/>
<see cref="M:Clazz.op_Explicit(System.Int32)~Clazz"/>
<see cref="M:Clazz.op_Explicit(System.Int32)~Clazz"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNodes = CrefFinder.FindAllCrefs(compilation.SyntaxTrees(0))
Assert.Equal(13, crefNodes.Count)
Dim index As Integer = 0
For Each name In {"Function Clazz.op_Like(a As Clazz, b As System.Int32) As Clazz",
"Function Clazz.op_BitwiseAnd(a As Clazz, b As System.Int32) As Clazz",
"Function Clazz.op_BitwiseOr(a As Clazz, b As System.Int32) As Clazz",
"Function Clazz.op_ExclusiveOr(a As Clazz, b As System.Int32) As Clazz",
"Function Clazz.op_Modulus(a As Clazz, b As System.Int32) As Clazz",
"Function Clazz.op_OnesComplement(a As Clazz) As System.Boolean",
"Function Clazz.op_True(a As Clazz) As System.Boolean",
"Function Clazz.op_False(a As Clazz) As System.Boolean",
"Function Clazz.op_Explicit(a As Clazz) As System.String",
"Function Clazz.op_Implicit(a As Clazz) As System.Nullable(Of System.Int32)",
"Function Clazz.op_Implicit(a As System.Nullable(Of System.Int32)) As Clazz",
"Function Clazz.op_Explicit(a As System.Int32) As Clazz",
"Function Clazz.op_Explicit(a As System.Int32) As Clazz"}
Dim info = model.GetSymbolInfo(crefNodes(index))
Assert.NotNull(info.Symbol)
Assert.Equal(name, info.Symbol.ToTestDisplayString())
index += 1
Next
End Sub
<Fact>
Private Sub ExtendedCref_StandaloneSimpleName()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<(s As Integer)
End Sub
Public Sub [New](Of T)(s As Clazz)
End Sub
Public Sub [New](Of T)(s As T)
End Sub
Public Sub S0(s As Integer)
End Sub
Public Sub S0(s As String)
End Sub
Public Sub S0(s As STR)
End Sub
''' <see cref="New(Clazz)"/>
''' <see cref="New(Int32)"/>
''' <see cref="New()"/>
''' <see cref="New(STR)"/>
''' <see cref="[New](Clazz)"/>
''' <see cref="[New](Of T)(Clazz)"/>
''' <see cref="[New](Of T)(T)"/>
''' <see cref="[New](Of T, W)(T)"/>
''' <see cref="S0(Of T)(T)"/>
''' <see cref="S0(STR)"/>
Public Shared field As Integer
End Class
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<"/>
<see cref="M:Clazz.New``1(Clazz)"/>
<see cref="M:Clazz.New``1(``0)"/>
<see cref="!:[New](Of T, W)(T)"/>
<see cref="!:S0(Of T)(T)"/>
<see cref="M:Clazz.S0(Clazz.STR)"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource,
<errors>
<' that could not be resolved.
''' <see cref="[New](Clazz)"/>
~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute '[New](Of T, W)(T)' that could not be resolved.
''' <see cref="[New](Of T, W)(T)"/>
~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'S0(Of T)(T)' that could not be resolved.
''' <see cref="S0(Of T)(T)"/>
~~~~~~~~~~~~~~~~~~
]]>
</errors>,
xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNodes = CrefFinder.FindAllCrefs(compilation.SyntaxTrees(0))
Assert.Equal(10, crefNodes.Count)
Dim index As Integer = 0
For Each name In {"Sub Clazz..ctor(s As Clazz)",
"Sub Clazz..ctor(s As System.Int32)",
"Sub Clazz..ctor()",
Nothing,
Nothing,
"Sub Clazz.[New](Of T)(s As Clazz)",
"Sub Clazz.[New](Of T)(s As T)",
Nothing,
Nothing,
"Sub Clazz.S0(s As Clazz.STR)"}
Dim info = model.GetSymbolInfo(crefNodes(index))
If name Is Nothing Then
Assert.True(info.IsEmpty)
Else
Assert.NotNull(info.Symbol)
Assert.Equal(name, info.Symbol.ToTestDisplayString())
End If
index += 1
Next
End Sub
<Fact>
Private Sub ExtendedCref_QualifiedName_A()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<(s As Integer)
End Sub
Public Sub [New](Of T)(s As Clazz)
End Sub
Public Sub [New](Of T)(s As T)
End Sub
Public Sub S0(s As Integer)
End Sub
Public Sub S0(s As String)
End Sub
Public Sub S0(s As STR)
End Sub
End Class
Public Structure TestStruct
''' <see cref="Clazz.New(Clazz)"/>
''' <see cref="Global.Clazz.New(Int32)"/>
''' <see cref="Clazz.New()"/>
''' <see cref="Clazz.New(Clazz.STR)"/>
''' <see cref="Clazz.[New](Clazz)"/>
''' <see cref="Clazz.[New](Of T)(Clazz)"/>
''' <see cref="Global.Clazz.[New](Of T)(T)"/>
''' <see cref="Clazz.[New](Of T, W)(T)"/>
''' <see cref="Clazz.S0(Of T)(T)"/>
''' <see cref="Global.Clazz.S0(Clazz.STR)"/>
Public Shared field As Integer
End Structure
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<"/>
<see cref="M:Clazz.New``1(Clazz)"/>
<see cref="M:Clazz.New``1(``0)"/>
<see cref="!:Clazz.[New](Of T, W)(T)"/>
<see cref="!:Clazz.S0(Of T)(T)"/>
<see cref="M:Clazz.S0(Clazz.STR)"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource,
<errors>
<' that could not be resolved.
''' <see cref="Clazz.[New](Clazz)"/>
~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Clazz.[New](Of T, W)(T)' that could not be resolved.
''' <see cref="Clazz.[New](Of T, W)(T)"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Clazz.S0(Of T)(T)' that could not be resolved.
''' <see cref="Clazz.S0(Of T)(T)"/>
~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</errors>,
xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNodes = CrefFinder.FindAllCrefs(compilation.SyntaxTrees(0))
Assert.Equal(10, crefNodes.Count)
Dim index As Integer = 0
For Each name In {"Sub Clazz..ctor(s As Clazz)",
"Sub Clazz..ctor(s As System.Int32)",
"Sub Clazz..ctor()",
Nothing,
Nothing,
"Sub Clazz.[New](Of T)(s As Clazz)",
"Sub Clazz.[New](Of T)(s As T)",
Nothing,
Nothing,
"Sub Clazz.S0(s As Clazz.STR)"}
Dim info = model.GetSymbolInfo(crefNodes(index))
If name Is Nothing Then
Assert.True(info.IsEmpty)
Else
Assert.NotNull(info.Symbol)
Assert.Equal(name, info.Symbol.ToTestDisplayString())
End If
index += 1
Next
End Sub
<Fact>
Private Sub ExtendedCref_QualifiedName_B()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<(s As Integer)
End Sub
Public Sub [New](Of T)(s As Clazz(Of T, T))
End Sub
Public Sub [New](Of T)(s As Clazz(Of T, B))
End Sub
Public Sub [New](Of T)(s As T)
End Sub
Public Sub S0(s As Integer)
End Sub
Public Sub S0(s As String)
End Sub
Public Sub S0(Of X, Y)(a As A, b As B, c As X, d As Y)
End Sub
End Class
Public Structure TestStruct
''' <see cref="Clazz.New(Integer)"/>
''' <see cref="Global.Clazz(Of X, Y).New(Int32)"/>
''' <see cref="Global.Clazz(Of X, Y).New(Clazz(Of X, Y))"/>
''' <see cref="Global.Clazz(Of X, Y).New(Clazz(Of Int32, Y))"/>
''' <see cref="Global.Clazz(Of X, Y).New(Clazz(Of Int32, Struct))"/>
''' <see cref="Clazz(Of X, Y).New()"/>
''' <see cref="Clazz(Of [Integer], Y).New([Integer])"/>
''' <see cref="Clazz(Of X, Y).[New](Clazz)"/>
''' <see cref="Clazz(Of X(Of D), Y).[New](Of T)(Int32)"/>
''' <see cref="Clazz(Of X, Y).[New](Of X)(X)"/>
''' <see cref="Clazz(Of X, Y).[New](Of X)(Y)"/>
''' <see cref="Clazz(Of X, Y).[New](Of T)(T)"/>
''' <see cref="Clazz(Of X, Y).[New](Of X)(Clazz(Of X, X))"/>
''' <see cref="Clazz(Of X, Y).[New](Of X)(Clazz(Of X, Y))"/>
''' <see cref="Clazz(Of X, Y).S0(Of T, U)(X, Y, T, U)"/>
''' <see cref="Global.Clazz(Of X, Y).S0(Of X, Y)(X, Y, X, Y)"/>
Public Shared field As Integer
End Structure
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="F:TestStruct.field">
<see cref="!:Clazz.New(Integer)"/>
<see cref="M:Clazz`2.#ctor(System.Int32)"/>
<see cref="M:Clazz`2.#ctor(Clazz{`0,`1})"/>
<see cref="!:Global.Clazz(Of X, Y).New(Clazz(Of Int32, Y))"/>
<see cref="M:Clazz`2.#ctor(Clazz{System.Int32,Struct})"/>
<see cref="M:Clazz`2.#ctor"/>
<see cref="!:Clazz(Of [Integer], Y).New([Integer])"/>
<see cref="!:Clazz(Of X, Y).[New](Clazz)"/>
<see cref="!:Clazz(Of X(Of D), Y).[New](Of T)(Int32)"/>
<see cref="M:Clazz`2.New``1(``0)"/>
<see cref="!:Clazz(Of X, Y).[New](Of X)(Y)"/>
<see cref="M:Clazz`2.New``1(``0)"/>
<see cref="M:Clazz`2.New``1(Clazz{``0,``0})"/>
<see cref="M:Clazz`2.New``1(Clazz{``0,`1})"/>
<see cref="M:Clazz`2.S0``2(`0,`1,``0,``1)"/>
<see cref="!:Global.Clazz(Of X, Y).S0(Of X, Y)(X, Y, X, Y)"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource,
<errors>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Clazz.New(Integer)' that could not be resolved.
''' <see cref="Clazz.New(Integer)"/>
~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Global.Clazz(Of X, Y).New(Clazz(Of Int32, Y))' that could not be resolved.
''' <see cref="Global.Clazz(Of X, Y).New(Clazz(Of Int32, Y))"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Clazz(Of [Integer], Y).New([Integer])' that could not be resolved.
''' <see cref="Clazz(Of [Integer], Y).New([Integer])"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Clazz(Of X, Y).[New](Clazz)' that could not be resolved.
''' <see cref="Clazz(Of X, Y).[New](Clazz)"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Clazz(Of X(Of D), Y).[New](Of T)(Int32)' that could not be resolved.
''' <see cref="Clazz(Of X(Of D), Y).[New](Of T)(Int32)"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Clazz(Of X, Y).[New](Of X)(Y)' that could not be resolved.
''' <see cref="Clazz(Of X, Y).[New](Of X)(Y)"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Global.Clazz(Of X, Y).S0(Of X, Y)(X, Y, X, Y)' that could not be resolved.
''' <see cref="Global.Clazz(Of X, Y).S0(Of X, Y)(X, Y, X, Y)"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</errors>,
xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNodes = CrefFinder.FindAllCrefs(compilation.SyntaxTrees(0))
Assert.Equal(16, crefNodes.Count)
Dim index As Integer = 0
For Each name In {Nothing,
"Sub Clazz(Of X, Y)..ctor(s As System.Int32)",
"Sub Clazz(Of X, Y)..ctor(s As Clazz(Of X, Y))",
Nothing,
"Sub Clazz(Of X, Y)..ctor(s As Clazz(Of System.Int32, Struct))",
"Sub Clazz(Of X, Y)..ctor()",
Nothing,
Nothing,
Nothing,
"Sub Clazz(Of X, Y).[New](Of X)(s As X)",
Nothing,
"Sub Clazz(Of X, Y).[New](Of T)(s As T)",
"Sub Clazz(Of X, Y).[New](Of X)(s As Clazz(Of X, X))",
"Sub Clazz(Of X, Y).[New](Of X)(s As Clazz(Of X, Y))",
"Sub Clazz(Of X, Y).S0(Of T, U)(a As X, b As Y, c As T, d As U)",
Nothing}
Dim info = model.GetSymbolInfo(crefNodes(index))
If name Is Nothing Then
Assert.True(info.IsEmpty)
Else
Assert.NotNull(info.Symbol)
Assert.Equal(name, info.Symbol.ToTestDisplayString())
End If
index += 1
Next
End Sub
<Fact>
Public Sub Include_AttrMissing_XMLMissingFileOrPathAttribute1()
Dim xmlText = <root><target>Included</target></root>
Dim xmlFile = Temp.CreateFile(extension:=".xml").WriteAllText(xmlText.Value.ToString)
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports System.Collections.Generic
''' <summary>
''' <include file='**FILE**' />
''' <include path='//target' />
''' <include/>
''' </summary>
Class C
End Class
]]>
</file>
</compilation>
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, xmlFile),
<error>
<![CDATA[
BC42310: XML comment tag 'include' must have a 'path' attribute. XML comment will be ignored.
''' <include file='**FILE**' />
~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42310: XML comment tag 'include' must have a 'file' attribute. XML comment will be ignored.
''' <include path='//target' />
~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42310: XML comment tag 'include' must have a 'file' attribute. XML comment will be ignored.
''' <include/>
~~~~~~~~~~
BC42310: XML comment tag 'include' must have a 'path' attribute. XML comment will be ignored.
''' <include/>
~~~~~~~~~~
]]>
</error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:C">
<summary>
<!--warning BC42310: XML comment tag 'include' must have a 'path' attribute. XML comment will be ignored.-->
<!--warning BC42310: XML comment tag 'include' must have a 'file' attribute. XML comment will be ignored.-->
<!--warning BC42310: XML comment tag 'include' must have a 'file' attribute. XML comment will be ignored. warning BC42310: XML comment tag 'include' must have a 'path' attribute. XML comment will be ignored.-->
</summary>
</member>
</members>
</doc>
]]>
</xml>, ensureEnglishUICulture:=True)
End Sub
<Fact>
Public Sub ExtendedCref_BinaryOperator()
ExtendedCref_BinaryOperatorCore(" &", "op_Concatenate", <errors></errors>)
ExtendedCref_BinaryOperatorCore("+", "op_Addition",
<errors>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Operator+(Clazz, String)' that could not be resolved.
''' <see cref="Operator+(Clazz, String)"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Operator+(Clazz)' that could not be resolved.
''' <see cref="Operator+(Clazz)"/>
~~~~~~~~~~~~~~~~~~~~~~~
]]>
</errors>)
ExtendedCref_BinaryOperatorCore("-", "op_Subtraction",
<errors>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Operator-(Clazz, String)' that could not be resolved.
''' <see cref="Operator-(Clazz, String)"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Operator-(Clazz)' that could not be resolved.
''' <see cref="Operator-(Clazz)"/>
~~~~~~~~~~~~~~~~~~~~~~~
]]>
</errors>)
ExtendedCref_BinaryOperatorCore("*", "op_Multiply",
<errors>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Operator*(Clazz, String)' that could not be resolved.
''' <see cref="Operator*(Clazz, String)"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Operator*(Clazz)' that could not be resolved.
''' <see cref="Operator*(Clazz)"/>
~~~~~~~~~~~~~~~~~~~~~~~
]]>
</errors>)
ExtendedCref_BinaryOperatorCore("/", "op_Division",
<errors>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Operator/(Clazz, String)' that could not be resolved.
''' <see cref="Operator/(Clazz, String)"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Operator/(Clazz)' that could not be resolved.
''' <see cref="Operator/(Clazz)"/>
~~~~~~~~~~~~~~~~~~~~~~~
]]>
</errors>)
ExtendedCref_BinaryOperatorCore("\", "op_IntegerDivision",
<errors>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Operator\(Clazz, String)' that could not be resolved.
''' <see cref="Operator\(Clazz, String)"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Operator\(Clazz)' that could not be resolved.
''' <see cref="Operator\(Clazz)"/>
~~~~~~~~~~~~~~~~~~~~~~~
]]>
</errors>)
ExtendedCref_BinaryOperatorCore("^", "op_Exponent",
<errors>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Operator^(Clazz, String)' that could not be resolved.
''' <see cref="Operator^(Clazz, String)"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Operator^(Clazz)' that could not be resolved.
''' <see cref="Operator^(Clazz)"/>
~~~~~~~~~~~~~~~~~~~~~~~
]]>
</errors>)
ExtendedCref_BinaryOperatorCore("<<", "op_LeftShift", <errors></errors>)
ExtendedCref_BinaryOperatorCore(">>", "op_RightShift", <errors></errors>)
ExtendedCref_BinaryOperatorCore("=", "op_Equality",
<errors>
<![CDATA[
BC33033: Matching '<>' operator is required for 'Public Shared Operator =(a As Clazz, b As Integer) As Clazz'.
Public Shared Operator =(a As Clazz, b As Integer) As Clazz
~
BC33033: Matching '<>' operator is required for 'Public Shared Operator =(a As Clazz, b As Integer?) As Clazz'.
Public Shared Operator =(a As Clazz, b As Integer?) As Clazz
~
BC42309: XML comment has a tag with a 'cref' attribute 'Operator=(Clazz, String)' that could not be resolved.
''' <see cref="Operator=(Clazz, String)"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Operator=(Clazz)' that could not be resolved.
''' <see cref="Operator=(Clazz)"/>
~~~~~~~~~~~~~~~~~~~~~~~
]]>
</errors>)
ExtendedCref_BinaryOperatorCore("<>", "op_Inequality",
<errors>
<![CDATA[
BC33033: Matching '=' operator is required for 'Public Shared Operator <>(a As Clazz, b As Integer) As Clazz'.
Public Shared Operator <>(a As Clazz, b As Integer) As Clazz
~~
BC33033: Matching '=' operator is required for 'Public Shared Operator <>(a As Clazz, b As Integer?) As Clazz'.
Public Shared Operator <>(a As Clazz, b As Integer?) As Clazz
~~
]]>
</errors>)
ExtendedCref_BinaryOperatorCore("<", "op_LessThan",
<errors>
<![CDATA[
BC33033: Matching '>' operator is required for 'Public Shared Operator <(a As Clazz, b As Integer) As Clazz'.
Public Shared Operator <(a As Clazz, b As Integer) As Clazz
~
BC33033: Matching '>' operator is required for 'Public Shared Operator <(a As Clazz, b As Integer?) As Clazz'.
Public Shared Operator <(a As Clazz, b As Integer?) As Clazz
~
]]>
</errors>)
ExtendedCref_BinaryOperatorCore(">", "op_GreaterThan",
<errors>
<![CDATA[
BC33033: Matching '<' operator is required for 'Public Shared Operator >(a As Clazz, b As Integer) As Clazz'.
Public Shared Operator >(a As Clazz, b As Integer) As Clazz
~
BC33033: Matching '<' operator is required for 'Public Shared Operator >(a As Clazz, b As Integer?) As Clazz'.
Public Shared Operator >(a As Clazz, b As Integer?) As Clazz
~
]]>
</errors>)
ExtendedCref_BinaryOperatorCore("<=", "op_LessThanOrEqual",
<errors>
<![CDATA[
BC33033: Matching '>=' operator is required for 'Public Shared Operator <=(a As Clazz, b As Integer) As Clazz'.
Public Shared Operator <=(a As Clazz, b As Integer) As Clazz
~~
BC33033: Matching '>=' operator is required for 'Public Shared Operator <=(a As Clazz, b As Integer?) As Clazz'.
Public Shared Operator <=(a As Clazz, b As Integer?) As Clazz
~~
]]>
</errors>)
ExtendedCref_BinaryOperatorCore(">=", "op_GreaterThanOrEqual",
<errors>
<![CDATA[
BC33033: Matching '<=' operator is required for 'Public Shared Operator >=(a As Clazz, b As Integer) As Clazz'.
Public Shared Operator >=(a As Clazz, b As Integer) As Clazz
~~
BC33033: Matching '<=' operator is required for 'Public Shared Operator >=(a As Clazz, b As Integer?) As Clazz'.
Public Shared Operator >=(a As Clazz, b As Integer?) As Clazz
~~
]]>
</errors>)
End Sub
Private Sub ExtendedCref_BinaryOperatorCore(op As String, opName As String, errors As XElement)
Dim invalidChars = op.Contains("<") OrElse op.Contains(">") OrElse op.Contains("&")
Dim xmlSource =
If(Not invalidChars,
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class Clazz
Public Shared Operator {0}(a As Clazz, b As Integer) As Clazz
Return Nothing
End Operator
Public Shared Operator {0}(a As Clazz, b As Integer?) As Clazz
Return Nothing
End Operator
''' <see cref="{1}(Clazz, Integer) As Clazz"/>
''' <see cref="Operator{0}(Clazz, Integer)"/>
''' <see cref="Operator{0}(Clazz, String)"/>
''' <see cref="Operator{0}(Clazz, Int32?)"/>
''' <see cref="Operator{0}(Clazz)"/>
''' <see cref="Clazz.Operator{0}(Clazz, Integer)"/>
''' <see cref="Global.Clazz.Operator{0}(Clazz, Integer?)"/>
Public Shared field As Integer
End Class
]]>
</file>
</compilation>,
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class Clazz
Public Shared Operator {0}(a As Clazz, b As Integer) As Clazz
Return Nothing
End Operator
Public Shared Operator {0}(a As Clazz, b As Integer?) As Clazz
Return Nothing
End Operator
''' <see cref="{1}(Clazz, Integer) As Clazz"/>
''' <see cref="Operator{0}(Clazz, Integer)"/>
''' <see cref="Operator{0}(Clazz, Int32?)"/>
''' <see cref="Clazz.Operator{0}(Clazz, Integer)"/>
''' <see cref="Global.Clazz.Operator{0}(Clazz, Integer?)"/>
Public Shared field As Integer
End Class
]]>
</file>
</compilation>)
Dim xmlDoc = If(Not invalidChars,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="F:Clazz.field">
<see cref="M:Clazz.{0}(Clazz,System.Int32)"/>
<see cref="M:Clazz.{0}(Clazz,System.Int32)"/>
<see cref="!:Operator{1}(Clazz, String)"/>
<see cref="M:Clazz.{0}(Clazz,System.Nullable{{System.Int32}})"/>
<see cref="!:Operator{1}(Clazz)"/>
<see cref="M:Clazz.{0}(Clazz,System.Int32)"/>
<see cref="M:Clazz.{0}(Clazz,System.Nullable{{System.Int32}})"/>
</member>
</members>
</doc>
]]>
</xml>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="F:Clazz.field">
<see cref="M:Clazz.{0}(Clazz,System.Int32)"/>
<see cref="M:Clazz.{0}(Clazz,System.Int32)"/>
<see cref="M:Clazz.{0}(Clazz,System.Nullable{{System.Int32}})"/>
<see cref="M:Clazz.{0}(Clazz,System.Int32)"/>
<see cref="M:Clazz.{0}(Clazz,System.Nullable{{System.Int32}})"/>
</member>
</members>
</doc>
]]>
</xml>)
Dim compilation =
CompileCheckDiagnosticsAndXmlDocument(
FormatSourceXml(xmlSource, op, opName),
FormatXmlSimple(errors, op, If(op.Length = 1, "~", "~~")),
FormatXmlSimple(xmlDoc, opName, op))
Dim crefNode = CrefFinder.FindCref(compilation.SyntaxTrees(0))
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Assert.NotNull(crefNode)
Dim info = model.GetSymbolInfo(crefNode)
Assert.NotNull(info.Symbol)
Assert.Equal(String.Format("Function Clazz.{0}(a As Clazz, b As System.Int32) As Clazz", opName),
info.Symbol.ToTestDisplayString())
End Sub
<Fact>
Public Sub ExtendedCrefParsingTest()
ParseExtendedCref("Int32.ToString", forceNoErrors:=True)
ParseExtendedCref("Int32.ToString()", forceNoErrors:=False)
ParseExtendedCref("Int32.ToString(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Int32.ToString(ByVal String, ByRef Integer)", forceNoErrors:=False)
ParseExtendedCref("Int32.ToString(ByVal ByRef String, Integer) As Integer", checkErrors:=
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Int32.ToString(ByVal ByRef String, Integer) As Integer' that could not be resolved.
''' <see cref="Int32.ToString(ByVal ByRef String, Integer) As Integer"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</error>)
ParseExtendedCref("Int32.ToString(String, Integer) As Integer", checkErrors:=
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Int32.ToString(String, Integer) As Integer' that could not be resolved.
''' <see cref="Int32.ToString(String, Integer) As Integer"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</error>)
ParseExtendedCref("Operator IsTrue(String)", forceNoErrors:=False)
ParseExtendedCref("Operator IsFalse(String)", forceNoErrors:=False)
ParseExtendedCref("Operator Not(String)", forceNoErrors:=False)
ParseExtendedCref("Operator+(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator -(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator*(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator /(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator^(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator \(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator&(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator<<(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator >> (String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator Mod(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator Or(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator Xor(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator And(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator Like(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator =(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator <>(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator <(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator <=(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator >(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator >=(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Operator \(String, Integer) As Integer", checkErrors:=
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Operator \(String, Integer) As Integer' that could not be resolved.
''' <see cref="Operator \(String, Integer) As Integer"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</error>)
ParseExtendedCref("Operator Or(String, Integer).Name", checkErrors:=
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Operator Or(String, Integer).Name' that could not be resolved.
''' <see cref="Operator Or(String, Integer).Name"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]>
</error>, overrideCrefText:="Operator Or(String, Integer)")
ParseExtendedCref("Clazz.Operator >=(String, Integer)", forceNoErrors:=False)
ParseExtendedCref("Clazz.Operator ctype(String)", forceNoErrors:=False)
ParseExtendedCref("Clazz.Operator ctype(String) as Integer", forceNoErrors:=False)
ParseExtendedCref("New", forceNoErrors:=False)
ParseExtendedCref("[new]", forceNoErrors:=False)
ParseExtendedCref("New()", forceNoErrors:=False)
ParseExtendedCref("[new]()", forceNoErrors:=False)
ParseExtendedCref("Clazz.New", forceNoErrors:=False)
ParseExtendedCref("Clazz.[new]", forceNoErrors:=False)
ParseExtendedCref("Clazz.New()", forceNoErrors:=False)
ParseExtendedCref("Clazz.[new]()", forceNoErrors:=False)
ParseExtendedCref("Clazz.[new]() As Integer", forceNoErrors:=False)
ParseExtendedCref("String.ToString", overrideCrefText:="String", forceNoErrors:=True)
ParseExtendedCref("String.ToString()", overrideCrefText:="String", forceNoErrors:=True)
ParseExtendedCref("String.ToString(String, Integer)", overrideCrefText:="String", forceNoErrors:=True)
ParseExtendedCref("sYSTEM.String")
ParseExtendedCref("sYSTEM.String.", checkErrors:=
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'sYSTEM.String.' that could not be resolved.
''' <see cref="sYSTEM.String."/>
~~~~~~~~~~~~~~~~~~~~~
]]>
</error>)
ParseExtendedCref("Global.sYSTEM.String")
ParseExtendedCref("Global", checkErrors:=
<error>
<![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'Global' that could not be resolved.
''' <see cref="Global"/>
~~~~~~~~~~~~~
]]>
</error>)
End Sub
Private Sub ParseExtendedCref(cref As String,
Optional checkErrors As XElement = Nothing,
Optional overrideCrefText As String = Nothing,
Optional forceNoErrors As Boolean = False)
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
''' <see cref="{0}"/>
Module Program
End Module
]]>
</file>
</compilation>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(xmlSource, cref), If(forceNoErrors, <errors></errors>, checkErrors))
Dim crefNode = CrefFinder.FindCref(compilation.SyntaxTrees(0))
Assert.NotNull(crefNode)
Assert.Equal(If(overrideCrefText, cref.Trim).Trim, crefNode.ToString())
End Sub
<Fact>
Private Sub GetAliasInfo_Namespace()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports aNamespace = System.Collections.Generic
''' <see cref="aNamespace"/>
Public Class Clazz
End Class
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Clazz">
<see cref="N:System.Collections.Generic"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNode = CrefFinder.FindCref(compilation.SyntaxTrees(0))
Assert.NotNull(crefNode)
Dim info = model.GetSymbolInfo(crefNode)
Assert.NotNull(info.Symbol)
Assert.Equal("System.Collections.Generic", info.Symbol.ToTestDisplayString())
CheckAllAliases(model, crefNode,
New AliasInfo("aNamespace", "System.Collections.Generic"))
End Sub
<WorkItem(757110, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/757110")>
<Fact>
Public Sub NoAssemblyElementForNetModule()
Dim comp = CreateCompilationWithMscorlib40AndVBRuntime(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
Imports System
''' <summary>
''' Test
''' </summary>
Class E
End Class
]]>
</file>
</compilation>,
TestOptions.ReleaseModule)
CheckXmlDocument(comp,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<members>
<member name="T:E">
<summary>
Test
</summary>
</member>
</members>
</doc>
]]>
</xml>)
End Sub
<Fact>
Private Sub GetAliasInfo_Type()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports aType = System.Collections.Generic.List(Of Integer)
''' <see cref="aType"/>
Public Class Clazz
End Class
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Clazz">
<see cref="T:System.Collections.Generic.List`1"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNode = CrefFinder.FindCref(compilation.SyntaxTrees(0))
Assert.NotNull(crefNode)
Dim info = model.GetSymbolInfo(crefNode)
Assert.NotNull(info.Symbol)
Assert.Equal("System.Collections.Generic.List(Of System.Int32)", info.Symbol.ToTestDisplayString())
CheckAllAliases(model, crefNode,
New AliasInfo("aType", "System.Collections.Generic.List(Of Integer)"))
End Sub
<Fact>
Private Sub GetAliasInfo_NamespaceAndType()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports aNamespace = System.Collections.Generic
''' <see cref="aNamespace.List(Of T)"/>
Public Class Clazz
End Class
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Clazz">
<see cref="T:System.Collections.Generic.List`1"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNode = CrefFinder.FindCref(compilation.SyntaxTrees(0))
Assert.NotNull(crefNode)
Dim info = model.GetSymbolInfo(crefNode)
Assert.NotNull(info.Symbol)
Assert.Equal("System.Collections.Generic.List(Of T)", info.Symbol.ToTestDisplayString())
CheckAllAliases(model, crefNode,
New AliasInfo("aNamespace", "System.Collections.Generic"),
New AliasInfo("T", Nothing))
End Sub
<Fact>
Private Sub GetAliasInfo_TypeAndMethodWithSignature()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports aType = System.Collections.Generic.List(Of Integer)
''' <see cref="aType.ToString()"/>
Public Class Clazz
End Class
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Clazz">
<see cref="M:System.Object.ToString"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNode = CrefFinder.FindCref(compilation.SyntaxTrees(0))
Assert.NotNull(crefNode)
Dim info = model.GetSymbolInfo(crefNode)
Assert.NotNull(info.Symbol)
Assert.Equal("Function System.Object.ToString() As System.String", info.Symbol.ToTestDisplayString())
CheckAllAliases(model, crefNode,
New AliasInfo("aType", "System.Collections.Generic.List(Of Integer)"),
New AliasInfo("ToString", Nothing))
End Sub
<Fact>
Private Sub GetAliasInfo_TypeAndMethodCompat()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Imports aType = System.Collections.Generic.List(Of Integer)
''' <see cref="aType.ToString"/>
Public Class Clazz
End Class
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:Clazz">
<see cref="M:System.Object.ToString"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc)
Dim model = compilation.GetSemanticModel(compilation.SyntaxTrees(0))
Dim crefNode = CrefFinder.FindCref(compilation.SyntaxTrees(0))
Assert.NotNull(crefNode)
Dim info = model.GetSymbolInfo(crefNode)
Assert.NotNull(info.Symbol)
Assert.Equal("Function System.Object.ToString() As System.String", info.Symbol.ToTestDisplayString())
CheckAllAliases(model, crefNode,
New AliasInfo("aType", "System.Collections.Generic.List(Of Integer)"),
New AliasInfo("ToString", Nothing))
End Sub
<WorkItem(568006, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/568006")>
<Fact>
Public Sub Inaccessible1()
Dim source =
<compilation>
<file name="test.vb"><![CDATA[
''' <summary>
''' See <see cref="C.M"/>.
''' </summary>
Class A
End Class
Class C
Private Sub M()
End Sub
End Class
]]>
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, parseOptions:=s_optionsDiagnoseDocComments)
' Compat fix: match dev11 with inaccessible lookup
compilation.AssertNoDiagnostics()
End Sub
<WorkItem(568006, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/568006")>
<Fact>
Public Sub Inaccessible2()
Dim source =
<compilation>
<file name="test.vb"><![CDATA[
''' <summary>
''' See <see cref="C.Inner.M"/>.
''' </summary>
Class A
End Class
Class C
Private Class Inner
Private Sub M()
End Sub
End Class
End Class
]]>
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, parseOptions:=s_optionsDiagnoseDocComments)
' Compat fix: match dev11 with inaccessible lookup
compilation.AssertNoDiagnostics()
End Sub
<WorkItem(568006, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/568006")>
<Fact>
Public Sub Inaccessible3()
Dim lib1Source =
<compilation name="A">
<file name="a.vb">
Friend Class C
End Class
</file>
</compilation>
Dim lib2Source =
<compilation name="B">
<file name="b.vb">
Public Class C
End Class
</file>
</compilation>
Dim source =
<compilation>
<file name="test.vb"><![CDATA[
''' <summary>
''' See <see cref="C"/>.
''' </summary>
Public Class Test
End Class
]]>
</file>
</compilation>
Dim lib1Ref = CreateCompilationWithMscorlib40(lib1Source).EmitToImageReference()
Dim lib2Ref = CreateCompilationWithMscorlib40(lib2Source).EmitToImageReference()
Dim compilation = CreateCompilationWithMscorlib40AndReferences(source, {lib1Ref, lib2Ref}, parseOptions:=s_optionsDiagnoseDocComments)
Dim tree = compilation.SyntaxTrees.Single()
Dim model = compilation.GetSemanticModel(tree)
Dim crefSyntax = tree.GetRoot().DescendantNodes(descendIntoTrivia:=True).OfType(Of CrefReferenceSyntax).Single()
' Break: In dev11 the accessible symbol is preferred. We produce an ambiguity
Dim symbolInfo = model.GetSymbolInfo(crefSyntax)
Dim symbols = symbolInfo.CandidateSymbols
Assert.Equal(CandidateReason.Ambiguous, symbolInfo.CandidateReason)
Assert.Equal(2, symbols.Length)
Assert.Equal("A", symbols(0).ContainingAssembly.Name)
Assert.Equal("B", symbols(1).ContainingAssembly.Name)
End Sub
<WorkItem(568006, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/568006")>
<WorkItem(709199, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/709199")>
<Fact>
Public Sub ProtectedInstanceBaseMember()
Dim source =
<compilation>
<file name="test.vb"><![CDATA[
Class Base
Protected F As Integer
End Class
''' Accessible: <see cref="Base.F"/>
Class Derived : Inherits Base
End Class
''' Inaccessible: <see cref="Base.F"/>
Class Other
End Class
]]>
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, parseOptions:=s_optionsDiagnoseDocComments)
compilation.AssertNoDiagnostics()
Dim tree = compilation.SyntaxTrees.Single()
Dim model = compilation.GetSemanticModel(tree)
Dim crefSyntax = tree.GetRoot().DescendantNodes(descendIntoTrivia:=True).OfType(Of CrefReferenceSyntax).First()
Dim expectedSymbol = compilation.GlobalNamespace.GetMember(Of NamedTypeSymbol)("Base").GetMember(Of FieldSymbol)("F")
Dim actualSymbol = model.GetSymbolInfo(crefSyntax).Symbol
Assert.Equal(expectedSymbol, actualSymbol)
End Sub
<WorkItem(568006, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/568006")>
<WorkItem(709199, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/709199")>
<Fact>
Public Sub ProtectedSharedBaseMember()
Dim source =
<compilation>
<file name="test.vb"><![CDATA[
Class Base
Protected Shared F As Integer
End Class
''' Accessible: <see cref="Base.F"/>
Class Derived : Inherits Base
End Class
''' Inaccessible: <see cref="Base.F"/>
Class Other
End Class
]]>
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, parseOptions:=s_optionsDiagnoseDocComments)
compilation.AssertNoDiagnostics()
Dim tree = compilation.SyntaxTrees.Single()
Dim model = compilation.GetSemanticModel(tree)
Dim crefSyntax = tree.GetRoot().DescendantNodes(descendIntoTrivia:=True).OfType(Of CrefReferenceSyntax).First()
Dim expectedSymbol = compilation.GlobalNamespace.GetMember(Of NamedTypeSymbol)("Base").GetMember(Of FieldSymbol)("F")
Dim actualSymbol = model.GetSymbolInfo(crefSyntax).Symbol
Assert.Equal(expectedSymbol, actualSymbol)
End Sub
<WorkItem(768624, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/768624")>
<Fact>
Public Sub CrefsOnDelegate()
Dim source =
<compilation>
<file name="test.vb"><![CDATA[
''' <see cref="T"/>
''' <see cref="p"/>
''' <see cref="Invoke"/>
''' <see cref="ToString"/>
Delegate Sub D(Of T)(p As T)
]]>
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, parseOptions:=s_optionsDiagnoseDocComments)
compilation.AssertTheseDiagnostics(<errors><![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'T' that could not be resolved.
''' <see cref="T"/>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'p' that could not be resolved.
''' <see cref="p"/>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'Invoke' that could not be resolved.
''' <see cref="Invoke"/>
~~~~~~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'ToString' that could not be resolved.
''' <see cref="ToString"/>
~~~~~~~~~~~~~~~
]]></errors>)
End Sub
<WorkItem(768624, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/768624")>
<Fact>
Public Sub TypeParametersOfAssociatedSymbol()
Dim source =
<compilation>
<file name="test.vb"><![CDATA[
''' <see cref='T'/>
Class C(Of T)
''' <see cref='U'/>
Sub M(Of U)()
End Sub
End Class
''' <see cref='V'/>
Delegate Sub D(Of V)()
]]>
</file>
</compilation>
' NOTE: Unlike C#, VB allows crefs to type parameters.
Dim compilation = CreateCompilationWithMscorlib40(source, parseOptions:=s_optionsDiagnoseDocComments)
compilation.AssertTheseDiagnostics(<errors><![CDATA[
BC42375: XML comment has a tag with a 'cref' attribute 'T' that bound to a type parameter. Use the <typeparamref> tag instead.
''' <see cref='T'/>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'U' that could not be resolved.
''' <see cref='U'/>
~~~~~~~~
BC42309: XML comment has a tag with a 'cref' attribute 'V' that could not be resolved.
''' <see cref='V'/>
~~~~~~~~
]]></errors>)
Dim tree = compilation.SyntaxTrees.Single()
Dim model = compilation.GetSemanticModel(tree)
Dim crefSyntaxes = tree.GetRoot().DescendantNodes(descendIntoTrivia:=True).OfType(Of CrefReferenceSyntax).ToArray()
Dim [class] = compilation.GlobalNamespace.GetMember(Of NamedTypeSymbol)("C")
Dim method = [class].GetMember(Of MethodSymbol)("M")
Dim [delegate] = compilation.GlobalNamespace.GetMember(Of NamedTypeSymbol)("D")
Dim info0 As SymbolInfo = model.GetSymbolInfo(crefSyntaxes(0))
Assert.Null(info0.Symbol) ' As in dev11.
Assert.Equal([class].TypeParameters.Single(), info0.CandidateSymbols.Single())
Assert.Equal(CandidateReason.NotReferencable, info0.CandidateReason)
Assert.True(model.GetSymbolInfo(crefSyntaxes(1)).IsEmpty)
Assert.True(model.GetSymbolInfo(crefSyntaxes(2)).IsEmpty)
End Sub
<WorkItem(768624, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/768624")>
<Fact>
Public Sub MembersOfAssociatedSymbol()
Dim source =
<compilation>
<file name="test.vb"><![CDATA[
''' <see cref='F'/>
Class C
Private F As Integer
End Class
''' <see cref='F'/>
Structure S
Private F As Integer
End Structure
''' <see cref='P'/>
Interface I
Property P As Integer
End Interface
''' <see cref='F'/>
Module M
Private F As Integer
End Module
''' <see cref='F'/>
Enum E
F
End Enum
]]>
</file>
</compilation>
' None of these work in dev11.
Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime(source, parseOptions:=s_optionsDiagnoseDocComments)
compilation.AssertNoDiagnostics()
Dim tree = compilation.SyntaxTrees.Single()
Dim model = compilation.GetSemanticModel(tree)
Dim crefSyntaxes = tree.GetRoot().DescendantNodes(descendIntoTrivia:=True).OfType(Of CrefReferenceSyntax).ToArray()
Assert.Equal("C.F As System.Int32", model.GetSymbolInfo(crefSyntaxes(0)).Symbol.ToTestDisplayString())
Assert.Equal("S.F As System.Int32", model.GetSymbolInfo(crefSyntaxes(1)).Symbol.ToTestDisplayString())
Assert.Equal("Property I.P As System.Int32", model.GetSymbolInfo(crefSyntaxes(2)).Symbol.ToTestDisplayString())
Assert.Equal("M.F As System.Int32", model.GetSymbolInfo(crefSyntaxes(3)).Symbol.ToTestDisplayString())
Assert.Equal("E.F", model.GetSymbolInfo(crefSyntaxes(4)).Symbol.ToTestDisplayString())
End Sub
<WorkItem(768624, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/768624")>
<Fact>
Public Sub InnerVersusOuter()
Dim source =
<compilation>
<file name="test.vb"><![CDATA[
Class Outer
Private F As Integer
''' <see cref='F'/>
Class Inner
Private F As Integer
End Class
End Class
]]>
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime(source, parseOptions:=s_optionsDiagnoseDocComments)
compilation.AssertNoDiagnostics()
Dim tree = compilation.SyntaxTrees.Single()
Dim model = compilation.GetSemanticModel(tree)
Dim crefSyntax = tree.GetRoot().DescendantNodes(descendIntoTrivia:=True).OfType(Of CrefReferenceSyntax).Single()
' BREAK: In dev11, it refers to Outer.F.
Assert.Equal("Outer.Inner.F As System.Int32", model.GetSymbolInfo(crefSyntax).Symbol.ToTestDisplayString())
End Sub
<WorkItem(531505, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531505")>
<Fact>
Private Sub Pia()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
''' <see cref='FooStruct'/>
''' <see cref='FooStruct.NET'/>
Public Class C
End Class
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:C">
<see cref='T:FooStruct'/>
<see cref='F:FooStruct.NET'/>
</member>
</members>
</doc>
]]>
</xml>
Dim reference1 = TestReferences.SymbolsTests.NoPia.GeneralPia.WithEmbedInteropTypes(False)
Dim reference2 = TestReferences.SymbolsTests.NoPia.GeneralPia.WithEmbedInteropTypes(True)
Dim comp1 = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc, additionalRefs:={reference1})
Dim comp2 = CompileCheckDiagnosticsAndXmlDocument(xmlSource, <errors></errors>, xmlDoc, additionalRefs:={reference2})
Dim validator As Action(Of ModuleSymbol) =
Sub(m As ModuleSymbol)
DirectCast(m, PEModuleSymbol).Module.PretendThereArentNoPiaLocalTypes()
' No reference added.
AssertEx.None(m.GetReferencedAssemblies(), Function(id) id.Name.Contains("GeneralPia"))
' No type embedded.
Assert.Equal(0, m.GlobalNamespace.GetMembers("FooStruct").Length)
End Sub
CompileAndVerify(comp1, symbolValidator:=validator)
CompileAndVerify(comp2, symbolValidator:=validator)
End Sub
<WorkItem(790978, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/790978")>
<Fact>
Public Sub SingleSymbol()
Dim source =
<compilation>
<file name="a.vb">
<![CDATA[
''' <summary>
''' summary information
''' </summary>
''' <remarks>nothing</remarks>
Public Class C
End Class
]]>
</file>
</compilation>
Dim comp = CreateCompilationWithMscorlib40AndVBRuntime(source, parseOptions:=s_optionsDiagnoseDocComments)
comp.VerifyDiagnostics()
Dim expectedXmlText = <![CDATA[
<member name="T:C">
<summary>
summary information
</summary>
<remarks>nothing</remarks>
</member>
]]>.Value.Replace(vbLf, Environment.NewLine).Trim
Dim sourceSymbol = comp.GlobalNamespace.GetMember(Of NamedTypeSymbol)("C")
Assert.Equal(expectedXmlText, sourceSymbol.GetDocumentationCommentXml())
Dim metadataRef = comp.EmitToImageReference()
Dim comp2 = CreateEmptyCompilationWithReferences(<source/>, {metadataRef})
Dim metadataSymbol = comp.GlobalNamespace.GetMember(Of NamedTypeSymbol)("C")
Assert.Equal(expectedXmlText, metadataSymbol.GetDocumentationCommentXml())
End Sub
<Fact, WorkItem(908893, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/908893")>
Private Sub GenericTypeWithinGenericType()
Dim xmlSource =
<compilation name="AssemblyName">
<file name="a.vb">
<![CDATA[
Imports System
Public Class ClazzA(Of A)
''' <see cref="Test"/>
Public Class ClazzB(Of B)
Public Sub Test(x as ClazzB(Of B))
End Sub
End Class
End Class
]]>
</file>
</compilation>
Dim xmlDoc =
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
AssemblyName
</name>
</assembly>
<members>
<member name="T:ClazzA`1.ClazzB`1">
<see cref="M:ClazzA`1.ClazzB`1.Test(ClazzA{`0}.ClazzB{`1})"/>
</member>
</members>
</doc>
]]>
</xml>
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(xmlSource,
<errors>
</errors>,
xmlDoc)
End Sub
#Region "Helpers"
Private Structure AliasInfo
Public ReadOnly Name As String
Public ReadOnly Target As String
Public Sub New(name As String, target As String)
Me.Name = name
Me.Target = target
End Sub
End Structure
Private Sub CheckAllAliases(model As SemanticModel, cref As CrefReferenceSyntax, ParamArray expected As AliasInfo())
Dim names = SyntaxNodeFinder.FindNodes(Of IdentifierNameSyntax)(cref, SyntaxKind.IdentifierName)
Assert.Equal(expected.Length, names.Count)
For i = 0 To names.Count - 1
Dim e = expected(i)
Dim sym = names(i)
Assert.Equal(e.Name, sym.ToString().Trim())
Dim actual = model.GetAliasInfo(sym)
If e.Target Is Nothing Then
Assert.Null(actual)
Else
Assert.Equal(e.Target, actual.Target.ToDisplayString)
End If
Next
End Sub
Private Class CrefFinder
Public Shared Function FindCref(tree As SyntaxTree) As CrefReferenceSyntax
Dim crefs = SyntaxNodeFinder.FindNodes(Of CrefReferenceSyntax)(tree.GetRoot(), SyntaxKind.CrefReference)
Return If(crefs.Count > 0, crefs(0), Nothing)
End Function
Public Shared Function FindAllCrefs(tree As SyntaxTree) As List(Of CrefReferenceSyntax)
Return SyntaxNodeFinder.FindNodes(Of CrefReferenceSyntax)(tree.GetRoot(), SyntaxKind.CrefReference)
End Function
End Class
Private Shared Function StringReplace(obj As Object, what As String, [with] As String) As Object
Dim str = TryCast(obj, String)
Return If(str Is Nothing, obj, str.Replace(what, [with]))
End Function
Private Shared Function AsXmlCommentText(file As TempFile) As String
Return TestHelpers.AsXmlCommentText(file.ToString())
End Function
Private Function FormatSourceXml(xml As XElement, ParamArray obj() As Object) As XElement
For Each file In xml.<file>
file.Value = String.Format(file.Value, obj)
Next
Return xml
End Function
Private Function FormatXmlSimple(xml As XElement, ParamArray obj() As Object) As XElement
xml.Value = String.Format(xml.Value, obj)
Return xml
End Function
Private Shared Function FilterOfSymbolKindOnly(symbols As ImmutableArray(Of ISymbol), ParamArray kinds() As SymbolKind) As ImmutableArray(Of ISymbol)
Dim filter As New HashSet(Of SymbolKind)(kinds)
Return (From s In symbols
Where filter.Contains(s.Kind)
Select s).AsImmutable()
End Function
Private Shared Sub AssertLookupResult(actual As ImmutableArray(Of ISymbol), ParamArray expected() As String)
AssertStringArraysEqual(expected, (From s In actual Select s.ToTestDisplayString()).ToArray)
End Sub
Private Function CheckSymbolInfoOnly(model As SemanticModel, syntax As ExpressionSyntax, ParamArray expected() As String) As ImmutableArray(Of ISymbol)
EnsureSymbolInfoOnCrefReference(model, syntax)
Dim actual = model.GetSymbolInfo(syntax)
If expected.Length = 0 Then
Assert.True(actual.IsEmpty)
ElseIf expected.Length = 1 Then
Assert.NotNull(actual.Symbol)
Assert.Equal(expected(0), actual.Symbol.ToTestDisplayString)
Else
Assert.Equal(CandidateReason.Ambiguous, actual.CandidateReason)
AssertStringArraysEqual(expected, (From s In actual.CandidateSymbols Select s.ToTestDisplayString()).ToArray)
End If
Dim typeInfo = model.GetTypeInfo(syntax)
If actual.Symbol IsNot Nothing AndAlso actual.Symbol.Kind = SymbolKind.TypeParameter Then ' Works everywhere since we want it to work in name attributes.
Assert.Equal(actual.Symbol, typeInfo.Type)
Else
Assert.Null(typeInfo.Type)
End If
Return actual.GetAllSymbols()
End Function
Private Function GetEnclosingCrefReference(syntax As ExpressionSyntax) As CrefReferenceSyntax
Dim node As VisualBasicSyntaxNode = syntax
While node IsNot Nothing AndAlso node.Kind <> SyntaxKind.CrefReference
node = node.Parent
End While
Return DirectCast(node, CrefReferenceSyntax)
End Function
Private Sub EnsureSymbolInfoOnCrefReference(model As SemanticModel, syntax As ExpressionSyntax)
Dim cref = GetEnclosingCrefReference(syntax)
If cref Is Nothing Then
Return
End If
Debug.Assert(cref.Signature IsNot Nothing OrElse cref.AsClause Is Nothing)
If cref.Signature IsNot Nothing Then
Return
End If
Dim fromName = model.GetSymbolInfo(cref.Name)
Dim fromCref = model.GetSymbolInfo(cref)
Assert.Equal(fromCref.CandidateReason, fromName.CandidateReason)
AssertStringArraysEqual((From s In fromName.GetAllSymbols() Select s.ToTestDisplayString()).ToArray,
(From s In fromCref.GetAllSymbols() Select s.ToTestDisplayString()).ToArray)
End Sub
Private Function CheckTypeParameterCrefSymbolInfoAndTypeInfo(model As SemanticModel, syntax As ExpressionSyntax, Optional expected As String = Nothing) As ImmutableArray(Of Symbol)
EnsureSymbolInfoOnCrefReference(model, syntax)
Dim actual = model.GetSymbolInfo(syntax)
Dim typeInfo = model.GetTypeInfo(syntax)
If expected Is Nothing Then
Assert.True(actual.IsEmpty)
Assert.Null(typeInfo.Type)
Return ImmutableArray.Create(Of Symbol)()
Else
Assert.Equal(CandidateReason.NotReferencable, actual.CandidateReason)
Dim symbol = actual.CandidateSymbols.Single()
Assert.NotNull(symbol)
Assert.Equal(expected, symbol.ToTestDisplayString)
Assert.NotNull(typeInfo.Type)
Assert.Equal(typeInfo.Type, symbol)
Return ImmutableArray.Create(DirectCast(symbol, Symbol))
End If
End Function
Private Function CheckSymbolInfoAndTypeInfo(model As SemanticModel, syntax As ExpressionSyntax, ParamArray expected() As String) As ImmutableArray(Of Symbol)
EnsureSymbolInfoOnCrefReference(model, syntax)
Dim actual = model.GetSymbolInfo(syntax)
Dim typeInfo = model.GetTypeInfo(syntax)
If expected.Length = 0 Then
Assert.True(actual.IsEmpty)
Assert.Null(typeInfo.Type)
Return ImmutableArray.Create(Of Symbol)()
ElseIf expected.Length = 1 Then
Assert.NotNull(actual.Symbol)
Assert.Equal(expected(0), actual.Symbol.ToTestDisplayString)
Assert.NotNull(typeInfo.Type)
Assert.Equal(typeInfo.Type, actual.Symbol)
Return ImmutableArray.Create(Of Symbol)(DirectCast(actual.Symbol, Symbol))
Else
Assert.Equal(CandidateReason.Ambiguous, actual.CandidateReason)
AssertStringArraysEqual(expected, (From s In actual.CandidateSymbols Select s.ToTestDisplayString()).ToArray)
Assert.Null(typeInfo.Type)
Return actual.CandidateSymbols.Cast(Of Symbol).ToImmutableArray()
End If
End Function
Private Shared Sub AssertStringArraysEqual(a() As String, b() As String)
Assert.NotNull(a)
Assert.NotNull(b)
Assert.Equal(StringArraysToSortedString(a), StringArraysToSortedString(b))
End Sub
Private Shared Function StringArraysToSortedString(a() As String) As String
Dim builder As New StringBuilder
Array.Sort(a)
For Each s In a
builder.AppendLine(s)
Next
Return builder.ToString()
End Function
Private Sub TestSymbolAndTypeInfoForType(model As SemanticModel, syntax As TypeSyntax, expected As ISymbol)
EnsureSymbolInfoOnCrefReference(model, syntax)
Dim expSymInfo = model.GetSymbolInfo(syntax)
Assert.NotNull(expSymInfo.Symbol)
Assert.Same(expected, expSymInfo.Symbol.OriginalDefinition)
Dim expTypeInfo = model.GetTypeInfo(syntax)
Assert.Equal(expected, expTypeInfo.Type.OriginalDefinition)
Dim conversion = model.GetConversion(syntax)
Assert.Equal(ConversionKind.Identity, conversion.Kind)
End Sub
Private Shared Function FindNodesOfTypeFromText(Of TNode As VisualBasicSyntaxNode)(tree As SyntaxTree, textToFind As String) As TNode()
Dim text As String = tree.GetText().ToString()
Dim list As New List(Of TNode)
Dim position As Integer = text.IndexOf(textToFind, StringComparison.Ordinal)
While position >= 0
Dim token As SyntaxToken = tree.GetRoot().FindToken(position, True)
If token.ValueText = textToFind Then
Dim node = TryCast(token.Parent, TNode)
If node IsNot Nothing Then
list.Add(node)
End If
End If
position = text.IndexOf(textToFind, position + 1, StringComparison.Ordinal)
End While
Return list.ToArray()
End Function
Private Shared Function CompileCheckDiagnosticsAndXmlDocument(
sources As XElement,
errors As XElement,
Optional expectedDocXml As XElement = Nothing,
Optional withDiagnostics As Boolean = True,
Optional stringMapper As Func(Of Object, Object) = Nothing,
Optional additionalRefs As MetadataReference() = Nothing,
Optional ensureEnglishUICulture As Boolean = False
) As VisualBasicCompilation
Dim parseOptions As VisualBasicParseOptions =
VisualBasicParseOptions.Default.WithDocumentationMode(
If(withDiagnostics,
DocumentationMode.Diagnose,
DocumentationMode.Parse))
Dim compilation = CreateCompilation(sources,
additionalRefs,
TestOptions.ReleaseDll.WithXmlReferenceResolver(XmlFileResolver.Default),
parseOptions)
If errors IsNot Nothing Then
Dim diagnostics As Diagnostic()
Dim saveUICulture As Globalization.CultureInfo = Nothing
If ensureEnglishUICulture Then
Dim preferred = Roslyn.Test.Utilities.EnsureEnglishUICulture.PreferredOrNull
If preferred Is Nothing Then
ensureEnglishUICulture = False
Else
saveUICulture = Threading.Thread.CurrentThread.CurrentUICulture
Threading.Thread.CurrentThread.CurrentUICulture = preferred
End If
End If
Try
diagnostics = compilation.GetDiagnostics(CompilationStage.Compile).ToArray()
Finally
If ensureEnglishUICulture Then
Threading.Thread.CurrentThread.CurrentUICulture = saveUICulture
End If
End Try
CompilationUtils.AssertTheseDiagnostics(diagnostics.AsImmutable(), errors)
End If
If expectedDocXml IsNot Nothing Then
CheckXmlDocument(compilation, expectedDocXml, stringMapper, ensureEnglishUICulture)
End If
Return compilation
End Function
Private Shared Sub CheckXmlDocument(
compilation As VisualBasicCompilation,
expectedDocXml As XElement,
Optional stringMapper As Func(Of Object, Object) = Nothing,
Optional ensureEnglishUICulture As Boolean = False
)
Assert.NotNull(expectedDocXml)
Using output = New MemoryStream()
Using xml = New MemoryStream()
Dim emitResult As CodeAnalysis.Emit.EmitResult
Dim saveUICulture As Globalization.CultureInfo = Nothing
If ensureEnglishUICulture Then
Dim preferred = Roslyn.Test.Utilities.EnsureEnglishUICulture.PreferredOrNull
If preferred Is Nothing Then
ensureEnglishUICulture = False
Else
saveUICulture = Threading.Thread.CurrentThread.CurrentUICulture
Threading.Thread.CurrentThread.CurrentUICulture = preferred
End If
End If
Try
emitResult = compilation.Emit(output, xmlDocumentationStream:=xml)
Finally
If ensureEnglishUICulture Then
Threading.Thread.CurrentThread.CurrentUICulture = saveUICulture
End If
End Try
xml.Seek(0, SeekOrigin.Begin)
Dim xmlDoc = New StreamReader(xml).ReadToEnd().Trim()
If stringMapper IsNot Nothing Then
xmlDoc = CStr(stringMapper(xmlDoc))
End If
Assert.Equal(
expectedDocXml.Value.Trim(),
xmlDoc.Replace(vbCrLf, vbLf).Trim())
End Using
End Using
End Sub
#End Region
<WorkItem(1087447, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1087447"), WorkItem(436, "CodePlex")>
<Fact>
Public Sub Bug1087447_01()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
''' <summary>
''' <see cref="C(Of Integer).f()"/>
''' </summary>
Class C(Of T)
Sub f()
End Sub
End Class
]]>
</file>
</compilation>,
<error><![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'C(Of Integer).f()' that could not be resolved.
''' <see cref="C(Of Integer).f()"/>
~~~~~~~~~~~~~~~~~~~~~~~~
]]></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="T:C`1">
<summary>
<see cref="!:C(Of Integer).f()"/>
</summary>
</member>
</members>
</doc>
]]>
</xml>)
Dim tree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim node1 = tree.GetRoot().DescendantNodes(descendIntoTrivia:=True).OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "f").Single()
Dim symbolInfo1 = model.GetSymbolInfo(node1.Parent)
Assert.Equal("Sub C(Of ?).f()", symbolInfo1.Symbol.ToTestDisplayString())
Dim node = tree.GetRoot().DescendantNodes(descendIntoTrivia:=True).OfType(Of TypeSyntax)().Where(Function(n) n.ToString() = "Integer").Single()
Dim symbolInfo = model.GetSymbolInfo(node)
Assert.Equal("?", symbolInfo.Symbol.ToTestDisplayString())
End Sub
<WorkItem(1087447, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1087447"), WorkItem(436, "CodePlex")>
<Fact>
Public Sub Bug1087447_02()
Dim compilation = CompileCheckDiagnosticsAndXmlDocument(
<compilation name="EmptyCref">
<file name="a.vb">
<![CDATA[
''' <summary>
''' <see cref="C(Of System.Int32).f()"/>
''' </summary>
Class C(Of T)
Sub f()
End Sub
End Class
]]>
</file>
</compilation>,
<error><![CDATA[
BC42309: XML comment has a tag with a 'cref' attribute 'C(Of System.Int32).f()' that could not be resolved.
''' <see cref="C(Of System.Int32).f()"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]]></error>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
EmptyCref
</name>
</assembly>
<members>
<member name="T:C`1">
<summary>
<see cref="!:C(Of System.Int32).f()"/>
</summary>
</member>
</members>
</doc>
]]>
</xml>)
Dim tree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim node1 = tree.GetRoot().DescendantNodes(descendIntoTrivia:=True).OfType(Of IdentifierNameSyntax)().Where(Function(n) n.Identifier.ValueText = "f").Single()
Dim symbolInfo1 = model.GetSymbolInfo(node1.Parent)
Assert.Equal("Sub C(Of ?).f()", symbolInfo1.Symbol.ToTestDisplayString())
Dim node = tree.GetRoot().DescendantNodes(descendIntoTrivia:=True).OfType(Of TypeSyntax)().Where(Function(n) n.ToString() = "System.Int32").Single()
Dim symbolInfo = model.GetSymbolInfo(node)
Assert.Equal("?", symbolInfo.Symbol.ToTestDisplayString())
End Sub
<Fact, WorkItem(1115058, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1115058")>
Public Sub UnterminatedElement()
Dim sources =
<compilation>
<file name="a.vb">
<![CDATA[
Module Module1
'''<summary>
''' Something
'''<summary>
Sub Main()
System.Console.WriteLine("Here")
End Sub
End Module
]]>
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime(
sources,
options:=TestOptions.ReleaseExe,
parseOptions:=TestOptions.Regular.WithDocumentationMode(DocumentationMode.Diagnose))
' Compilation should succeed with warnings
AssertTheseDiagnostics(CompileAndVerify(compilation, expectedOutput:="Here").Diagnostics, <![CDATA[
BC42304: XML documentation parse error: Element is missing an end tag. XML comment will be ignored.
'''<summary>
~~~~~~~~~
BC42304: XML documentation parse error: Element is missing an end tag. XML comment will be ignored.
'''<summary>
~~~~~~~~~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
'''<summary>
~
BC42304: XML documentation parse error: '>' expected. XML comment will be ignored.
'''<summary>
~
BC42304: XML documentation parse error: Expected beginning '<' for an XML tag. XML comment will be ignored.
'''<summary>
~
BC42304: XML documentation parse error: Expected beginning '<' for an XML tag. XML comment will be ignored.
'''<summary>
~
]]>)
End Sub
''' <summary>
''' "--" is not valid within an XML comment.
''' </summary>
<WorkItem(8807, "https://github.com/dotnet/roslyn/issues/8807")>
<Fact>
Public Sub IncludeErrorDashDashInName()
Dim dir = Temp.CreateDirectory()
Dim path = dir.Path
Dim xmlFile = dir.CreateFile("---.xml").WriteAllText("<summary attrib="""" attrib=""""/>")
Dim source =
<compilation name="DashDash">
<file name="a.vb">
<![CDATA[
''' <include file='{0}' path='//param'/>
Class C
End Class
]]>
</file>
</compilation>
CompileCheckDiagnosticsAndXmlDocument(FormatSourceXml(source, System.IO.Path.Combine(path, "---.xml")),
<error/>,
<xml>
<![CDATA[
<?xml version="1.0"?>
<doc>
<assembly>
<name>
DashDash
</name>
</assembly>
<members>
<member name="T:C">
<!--warning BC42320: Unable to include XML fragment '//param' of file '**FILE**'.-->
</member>
</members>
</doc>
]]>
</xml>,
stringMapper:=Function(o) StringReplace(o, System.IO.Path.Combine(TestHelpers.AsXmlCommentText(path), "- - -.xml"), "**FILE**"), ensureEnglishUICulture:=True)
End Sub
<Fact>
<WorkItem(410932, "https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems?id=410932")>
Public Sub LookupOnCrefTypeParameter()
Dim sources =
<compilation>
<file name="a.vb">
<![CDATA[
Public Class Test
Function F(Of T)() As T
End Function
''' <summary>
''' <see cref="F(Of U)()"/>
''' </summary>
Public Sub S()
End Sub
End Class
]]>
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40AndVBRuntime(
sources,
options:=TestOptions.ReleaseDll)
Dim tree = compilation.SyntaxTrees(0)
Dim model = compilation.GetSemanticModel(tree)
Dim name = FindNodesOfTypeFromText(Of NameSyntax)(tree, "U").Single()
Dim typeParameter = DirectCast(model.GetSymbolInfo(name).Symbol, TypeParameterSymbol)
Assert.Empty(model.LookupSymbols(name.SpanStart, typeParameter, "GetAwaiter"))
End Sub
<Fact>
Public Sub LookupOnCrefOfTupleType()
Dim sources =
<compilation>
<file name="a.vb">
<![CDATA[
Imports System
''' <summary>
''' <see cref="ValueTuple(Of U,U)"/>
''' </summary>
Public Class Test
End Class
]]>
</file>
</compilation>
Dim references = TargetFrameworkUtil.GetReferences(TargetFramework.StandardAndVBRuntime)
Dim compilation = CreateEmptyCompilationWithReferences(
sources,
references)
Dim cMember = compilation.GetMember(Of NamedTypeSymbol)("Test")
Dim xmlDocumentationString = cMember.GetDocumentationCommentXml()
Dim xml = System.Xml.Linq.XDocument.Parse(xmlDocumentationString)
Dim cref = xml.Descendants("see").Single().Attribute("cref").Value
Assert.Equal("T:System.ValueTuple`2", cref)
End Sub
<Fact>
Public Sub LookupOnCrefOfTupleTypeField()
Dim sources =
<compilation>
<file name="a.vb">
<![CDATA[
Imports System
''' <summary>
''' <see cref="ValueTuple(Of U,U).Item1"/>
''' </summary>
Public Class Test
End Class
]]>
</file>
</compilation>
Dim references = TargetFrameworkUtil.GetReferences(TargetFramework.StandardAndVBRuntime)
Dim compilation = CreateEmptyCompilationWithReferences(
sources,
references)
Dim cMember = compilation.GetMember(Of NamedTypeSymbol)("Test")
Dim xmlDocumentationString = cMember.GetDocumentationCommentXml()
Dim xml = System.Xml.Linq.XDocument.Parse(xmlDocumentationString)
Dim cref = xml.Descendants("see").Single().Attribute("cref").Value
Assert.Equal("F:System.ValueTuple`2.Item1", cref)
End Sub
End Class
End Namespace
|
MichalStrehovsky/roslyn
|
src/Compilers/VisualBasic/Test/Symbol/DocumentationComments/DocCommentTests.vb
|
Visual Basic
|
apache-2.0
| 415,304
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Threading
Imports Microsoft.CodeAnalysis.Completion.Providers
Imports Microsoft.CodeAnalysis.VisualBasic.Extensions.ContextQuery
Imports Microsoft.CodeAnalysis.VisualBasic.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.KeywordRecommenders.Declarations
''' <summary>
''' Recommends the "Delegate" keyword in member declaration contexts
''' </summary>
Friend Class DelegateKeywordRecommender
Inherits AbstractKeywordRecommender
Protected Overrides Function RecommendKeywords(context As VisualBasicSyntaxContext, cancellationToken As CancellationToken) As IEnumerable(Of RecommendedKeyword)
If context.IsTypeDeclarationKeywordContext Then
Dim modifiers = context.ModifierCollectionFacts
If modifiers.CouldApplyToOneOf(PossibleDeclarationTypes.Delegate) Then
Return SpecializedCollections.SingletonEnumerable(
New RecommendedKeyword("Delegate", VBFeaturesResources.Used_to_declare_a_delegate_A_delegate_is_a_reference_type_that_refers_to_a_shared_method_of_a_type_or_to_an_instance_method_of_an_object_Any_procedure_that_is_convertible_or_that_has_matching_parameter_types_and_return_type_may_be_used_to_create_an_instance_of_this_delegate_class))
End If
End If
Return SpecializedCollections.EmptyEnumerable(Of RecommendedKeyword)()
End Function
End Class
End Namespace
|
jmarolf/roslyn
|
src/Features/VisualBasic/Portable/Completion/KeywordRecommenders/Declarations/DelegateKeywordRecommender.vb
|
Visual Basic
|
mit
| 1,687
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Collections.Immutable
Imports System.Diagnostics
Imports System.Runtime.InteropServices
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports TypeKind = Microsoft.CodeAnalysis.TypeKind
Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Friend NotInheritable Class LocalRewriter
Public Overrides Function VisitLateAddressOfOperator(node As BoundLateAddressOfOperator) As BoundNode
If _inExpressionLambda Then
' just preserve the node to report an error in ExpressionLambdaRewriter
Return MyBase.VisitLateAddressOfOperator(node)
End If
Dim targetType = DirectCast(node.Type, NamedTypeSymbol)
Dim lambda = BuildDelegateRelaxationLambda(node.Syntax, targetType, node.MemberAccess, node.Binder, Me._diagnostics)
Return Me.VisitExpressionNode(lambda)
End Function
Private Shared Function BuildDelegateRelaxationLambda(
syntaxNode As SyntaxNode,
targetType As NamedTypeSymbol,
boundMember As BoundLateMemberAccess,
binder As Binder,
diagnostics As BindingDiagnosticBag
) As BoundExpression
Dim delegateInvoke = targetType.DelegateInvokeMethod
Debug.Assert(delegateInvoke.MethodKind = MethodKind.DelegateInvoke)
' build lambda symbol parameters matching the invocation method exactly. To do this,
' we'll create a BoundLambdaParameterSymbol for each parameter of the invoke method.
Dim delegateInvokeReturnType = delegateInvoke.ReturnType
Dim invokeParameters = delegateInvoke.Parameters
Dim invokeParameterCount = invokeParameters.Length
Dim lambdaSymbolParameters(invokeParameterCount - 1) As BoundLambdaParameterSymbol
Dim addressOfLocation As Location = syntaxNode.GetLocation()
For parameterIndex = 0 To invokeParameterCount - 1
Dim parameter = invokeParameters(parameterIndex)
lambdaSymbolParameters(parameterIndex) = New BoundLambdaParameterSymbol(GeneratedNames.MakeDelegateRelaxationParameterName(parameterIndex),
parameter.Ordinal,
parameter.Type,
parameter.IsByRef,
syntaxNode,
addressOfLocation)
Next
' even if the return value is dropped, we're using the delegate's return type for
' this lambda symbol.
Dim lambdaSymbol = New SynthesizedLambdaSymbol(SynthesizedLambdaKind.LateBoundAddressOfLambda,
syntaxNode,
lambdaSymbolParameters.AsImmutableOrNull,
delegateInvokeReturnType,
binder)
' the body of the lambda only contains a call to the target (or a return of the return value of
' the call in case of a function)
' for each parameter of the lambda symbol/invoke method we will create a bound parameter, except
' we are implementing a zero argument relaxation.
' These parameters will be used in the method invocation as passed parameters.
Dim lambdaBoundParameters(invokeParameterCount - 1) As BoundExpression
For parameterIndex = 0 To lambdaSymbolParameters.Length - 1
Dim lambdaSymbolParameter = lambdaSymbolParameters(parameterIndex)
Dim boundParameter = New BoundParameter(syntaxNode,
lambdaSymbolParameter,
lambdaSymbolParameter.Type)
boundParameter.SetWasCompilerGenerated()
lambdaBoundParameters(parameterIndex) = boundParameter
Next
'The invocation of the target method must be bound in the context of the lambda
'The reason is that binding the invoke may introduce local symbols and they need
'to be properly parented to the lambda and not to the outer method.
Dim lambdaBinder = New LambdaBodyBinder(lambdaSymbol, binder)
' Dev10 ignores the type characters used in the operand of an AddressOf operator.
' NOTE: we suppress suppressAbstractCallDiagnostics because it
' should have been reported already
Dim boundInvocationExpression As BoundExpression = lambdaBinder.BindLateBoundInvocation(syntaxNode,
Nothing,
boundMember,
lambdaBoundParameters.AsImmutableOrNull,
Nothing,
diagnostics,
suppressLateBindingResolutionDiagnostics:=True)
boundInvocationExpression.SetWasCompilerGenerated()
' In case of a function target that got assigned to a sub delegate, the return value will be dropped
Dim statementList As ImmutableArray(Of BoundStatement) = Nothing
If lambdaSymbol.IsSub Then
If boundInvocationExpression.IsLateBound() Then
boundInvocationExpression = boundInvocationExpression.SetLateBoundAccessKind(LateBoundAccessKind.Call)
End If
Dim statements(1) As BoundStatement
Dim boundStatement As BoundStatement = New BoundExpressionStatement(syntaxNode, boundInvocationExpression)
boundStatement.SetWasCompilerGenerated()
statements(0) = boundStatement
boundStatement = New BoundReturnStatement(syntaxNode, Nothing, Nothing, Nothing)
boundStatement.SetWasCompilerGenerated()
statements(1) = boundStatement
statementList = statements.AsImmutableOrNull
Else
' process conversions between the return types of the target and invoke function if needed.
boundInvocationExpression = lambdaBinder.ApplyImplicitConversion(syntaxNode,
delegateInvokeReturnType,
boundInvocationExpression,
diagnostics)
Dim returnstmt As BoundStatement = New BoundReturnStatement(syntaxNode,
boundInvocationExpression,
Nothing,
Nothing)
returnstmt.SetWasCompilerGenerated()
statementList = ImmutableArray.Create(returnstmt)
End If
Dim lambdaBody = New BoundBlock(syntaxNode,
Nothing,
ImmutableArray(Of LocalSymbol).Empty,
statementList)
lambdaBody.SetWasCompilerGenerated()
Dim boundLambda = New BoundLambda(syntaxNode,
lambdaSymbol,
lambdaBody,
ImmutableBindingDiagnostic(Of AssemblySymbol).Empty,
Nothing,
ConversionKind.DelegateRelaxationLevelWidening,
MethodConversionKind.Identity)
boundLambda.SetWasCompilerGenerated()
Dim result = New BoundDirectCast(syntaxNode,
boundLambda,
ConversionKind.DelegateRelaxationLevelWidening,
targetType)
Return result
End Function
End Class
End Namespace
|
AlekseyTs/roslyn
|
src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_LateAddressOf.vb
|
Visual Basic
|
mit
| 9,295
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports Microsoft.CodeAnalysis.CSharp
Imports Microsoft.CodeAnalysis.Test.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Symbols.Metadata
Public Class InAttributeModifierTests
Inherits BasicTestBase
<Fact>
Public Sub ReadOnlySignaturesAreRead_Methods_Parameters_Static()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
public static void M(in int x)
{
System.Console.WriteLine(x);
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim x = 5
TestRef.M(x)
End Sub
End Class
</file>
</compilation>
CompileAndVerify(source, references:={reference}, expectedOutput:="5")
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreRead_Methods_Parameters_NoModifiers()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
public void M(in int x)
{
System.Console.WriteLine(x);
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim x = 5
Dim obj = New TestRef()
obj.M(x)
End Sub
End Class
</file>
</compilation>
CompileAndVerify(source, references:={reference}, expectedOutput:="5")
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreRead_Indexers_Parameters_NoModifiers()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
public int this[in int p]
{
set
{
System.Console.WriteLine(p);
}
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim x = 5
Dim obj = New TestRef()
obj(x) = 0
End Sub
End Class
</file>
</compilation>
CompileAndVerify(source, references:={reference}, expectedOutput:="5")
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreRead_Constructors()
Dim reference = CreateCSharpCompilation("
public struct TestRef
{
public TestRef(in int value)
{
System.Console.WriteLine(value);
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim obj1 = New TestRef(4)
End Sub
End Class
</file>
</compilation>
CompileAndVerify(source, references:={reference}, expectedOutput:="4")
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Methods_Parameters_Virtual()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
public virtual void M(in int x)
{
System.Console.WriteLine(x);
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim x = 5
Dim obj = New TestRef()
obj.M(x)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'M' has a return type that is not supported or parameter types that are not supported.
obj.M(x)
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Methods_Parameters_Abstract()
Dim reference = CreateCSharpCompilation("
public abstract class TestRef
{
public abstract void M(in int x);
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(obj As TestRef)
Dim x = 5
obj.M(x)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'M' has a return type that is not supported or parameter types that are not supported.
obj.M(x)
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Methods_ReturnTypes_Virtual()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private int value = 0;
public virtual ref readonly int M()
{
return ref value;
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim obj = New TestRef()
obj.M()
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'M' has a return type that is not supported or parameter types that are not supported.
obj.M()
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Methods_ReturnTypes_Abstract()
Dim reference = CreateCSharpCompilation("
public abstract class TestRef
{
public abstract ref readonly int M();
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(obj As TestRef)
obj.M()
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'M' has a return type that is not supported or parameter types that are not supported.
obj.M()
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Methods_ReturnTypes_Static()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private static int value = 0;
public static ref readonly int M()
{
return ref value;
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
TestRef.M()
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'M' has a return type that is not supported or parameter types that are not supported.
TestRef.M()
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Methods_ReturnTypes_NoModifiers()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private int value = 0;
public ref readonly int M()
{
return ref value;
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim obj = New TestRef()
obj.M()
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'M' has a return type that is not supported or parameter types that are not supported.
obj.M()
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Properties_Virtual()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private int value = 0;
public virtual ref readonly int P => ref value;
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim obj = New TestRef()
Dim value = obj.P
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30643: Property 'TestRef.P' is of an unsupported type.
Dim value = obj.P
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Properties_Static()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private static int value = 0;
public static ref readonly int P => ref value;
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim value = TestRef.P
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30643: Property 'TestRef.P' is of an unsupported type.
Dim value = TestRef.P
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Properties_NoModifiers()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private int value = 0;
public ref readonly int P => ref value;
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim obj = New TestRef()
Dim value = obj.P
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30643: Property 'TestRef.P' is of an unsupported type.
Dim value = obj.P
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Properties_Abstract()
Dim reference = CreateCSharpCompilation("
public abstract class TestRef
{
public abstract ref readonly int P { get; }
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(obj As TestRef)
Dim value = obj.P
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30643: Property 'TestRef.P' is of an unsupported type.
Dim value = obj.P
~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Indexers_Parameters_Virtual()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
public virtual int this[in int p] => 0;
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim p = 0
Dim obj = New TestRef()
Dim value = obj(p)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30643: Property 'TestRef.Item(ByRef p As Integer)' is of an unsupported type.
Dim value = obj(p)
~~~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Indexers_Parameters_Abstract()
Dim reference = CreateCSharpCompilation("
public abstract class TestRef
{
public abstract int this[in int p] { set; }
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(obj As TestRef)
Dim p = 0
Dim value = obj(p)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30643: Property 'TestRef.Item(ByRef p As Integer)' is of an unsupported type.
Dim value = obj(p)
~~~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Indexers_ReturnTypes_Virtual()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private int value = 0;
public virtual ref readonly int this[int p] => ref value;
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim obj = New TestRef()
Dim value = obj(0)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30643: Property 'TestRef.Item(p As Integer)' is of an unsupported type.
Dim value = obj(0)
~~~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Indexers_ReturnTypes_Abstract()
Dim reference = CreateCSharpCompilation("
public abstract class TestRef
{
public abstract ref readonly int this[int p] { get; }
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(obj As TestRef)
Dim value = obj(0)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30643: Property 'TestRef.Item(p As Integer)' is of an unsupported type.
Dim value = obj(0)
~~~
</expected>)
End Sub
<Fact>
Public Sub ReadOnlySignaturesAreNotSupported_Indexers_ReturnTypes_NoModifiers()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private int value = 0;
public ref readonly int this[int p] => ref value;
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim obj = New TestRef()
Dim value = obj(0)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30643: Property 'TestRef.Item(p As Integer)' is of an unsupported type.
Dim value = obj(0)
~~~
</expected>)
End Sub
<Fact>
Public Sub UsingLambdasOfInDelegatesIsNotSupported_Invoke_Parameters()
Dim reference = CreateCSharpCompilation("
public delegate void D(in int p);
", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(lambda As D)
Dim x = 0
lambda(x)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'D' has a return type that is not supported or parameter types that are not supported.
lambda(x)
~~~~~~
</expected>)
End Sub
<Fact>
Public Sub UsingLambdasOfInDelegatesIsNotSupported_BeginInvoke_Parameters()
Dim reference = CreateCSharpCompilation("
public delegate void D(in int p);
", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(lambda As D)
Dim x = 0
lambda.BeginInvoke(x, Nothing, Nothing)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'BeginInvoke' has a return type that is not supported or parameter types that are not supported.
lambda.BeginInvoke(x, Nothing, Nothing)
~~~~~~~~~~~
</expected>)
End Sub
<Fact>
Public Sub UsingLambdasOfInDelegatesIsNotSupported_EndInvoke_Parameters()
Dim reference = CreateCSharpCompilation("
public delegate void D(in int p);
", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(lambda As D)
Dim x = 0
lambda.EndInvoke(x)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'EndInvoke' has a return type that is not supported or parameter types that are not supported.
lambda.EndInvoke(x)
~~~~~~~~~
</expected>)
End Sub
<Fact>
Public Sub UsingLambdasOfRefReadOnlyDelegatesIsNotSupported_Invoke_ReturnTypes()
Dim reference = CreateCSharpCompilation("
public delegate ref readonly int D();
", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(lambda As D)
Dim x = lambda()
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'D' has a return type that is not supported or parameter types that are not supported.
Dim x = lambda()
~~~~~~
</expected>)
End Sub
<Fact>
Public Sub UsingLambdasOfRefReadOnlyDelegatesIsNotSupported_EndInvoke_ReturnTypes()
Dim reference = CreateCSharpCompilation("
public delegate ref readonly int D();
", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main(lambda As D)
lambda.EndInvoke()
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30657: 'EndInvoke' has a return type that is not supported or parameter types that are not supported.
lambda.EndInvoke()
~~~~~~~~~
</expected>)
End Sub
<Fact>
Public Sub InOperatorsAreNotSupported_Binary()
Dim reference = CreateCSharpCompilation("
public class Test
{
public int Value { get; set; }
public static int operator +(in Test a, in Test b)
{
return a.Value + b.Value;
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Program
Shared Sub Main()
Dim a = New Test With { .Value = 3 }
Dim b = New Test With { .Value = 6 }
System.Console.WriteLine(a + b)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30452: Operator '+' is not defined for types 'Test' and 'Test'.
System.Console.WriteLine(a + b)
~~~~~
</expected>)
End Sub
<Fact>
Public Sub InOperatorsAreNotSupported_Binary_Left()
Dim reference = CreateCSharpCompilation("
public class Test
{
public int Value { get; set; }
public static int operator +(in Test a, Test b)
{
return a.Value + b.Value;
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Program
Shared Sub Main()
Dim a = New Test With { .Value = 3 }
Dim b = New Test With { .Value = 6 }
System.Console.WriteLine(a + b)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30452: Operator '+' is not defined for types 'Test' and 'Test'.
System.Console.WriteLine(a + b)
~~~~~
</expected>)
End Sub
<Fact>
Public Sub InOperatorsAreNotSupported_Binary_Right()
Dim reference = CreateCSharpCompilation("
public class Test
{
public int Value { get; set; }
public static int operator +(Test a, in Test b)
{
return a.Value + b.Value;
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Program
Shared Sub Main()
Dim a = New Test With { .Value = 3 }
Dim b = New Test With { .Value = 6 }
System.Console.WriteLine(a + b)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30452: Operator '+' is not defined for types 'Test' and 'Test'.
System.Console.WriteLine(a + b)
~~~~~
</expected>)
End Sub
<Fact>
Public Sub InOperatorsAreNotSupported_Unary()
Dim reference = CreateCSharpCompilation("
public class Test
{
public bool Value { get; set; }
public static bool operator !(in Test a)
{
return !a.Value;
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Program
Shared Sub Main()
Dim a = New Test With { .Value = True }
System.Console.WriteLine(Not a)
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30487: Operator 'Not' is not defined for type 'Test'.
System.Console.WriteLine(Not a)
~~~~~
</expected>)
End Sub
<Fact>
Public Sub InOperatorsAreNotSupported_Conversion()
Dim reference = CreateCSharpCompilation("
public class Test
{
public bool Value { get; set; }
public static explicit operator int(in Test a)
{
return a.Value ? 3 : 5;
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Program
Shared Sub Main()
Dim a = New Test With { .Value = True }
System.Console.WriteLine(CType(a, Integer))
End Sub
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib40(source, references:={reference})
AssertTheseDiagnostics(compilation, <expected>
BC30311: Value of type 'Test' cannot be converted to 'Integer'.
System.Console.WriteLine(CType(a, Integer))
~
</expected>)
End Sub
<Fact>
Public Sub OverloadResolutionShouldBeAbleToPickOverloadsWithNoModreqsOverOnesWithModreq_Methods_Parameters()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
public virtual void PrintMul(in int x)
{
System.Console.WriteLine(x * 2);
}
public void PrintMul(in long x)
{
System.Console.WriteLine(x * 4);
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim value As Integer = 5
Dim obj = New TestRef()
obj.PrintMul(value)
End Sub
End Class
</file>
</compilation>
CompileAndVerify(source, references:={reference}, expectedOutput:="20")
End Sub
<Fact>
Public Sub OverloadResolutionShouldBeAbleToPickOverloadsWithNoModreqsOverOnesWithModreq_Methods_ReturnTypes()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private int value = 5;
public ref readonly int PrintMul(int x)
{
value = value * 2;
return ref value;
}
public int PrintMul(long x)
{
value = value * 4;
return value;
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim obj = New TestRef()
System.Console.WriteLine(obj.PrintMul(0))
End Sub
End Class
</file>
</compilation>
CompileAndVerify(source, references:={reference}, expectedOutput:="20")
End Sub
<Fact>
Public Sub OverloadResolutionShouldBeAbleToPickOverloadsWithNoModreqsOverOnesWithModreq_Indexers_Parameters()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
public virtual int this[in int x]
{
set
{
System.Console.WriteLine(x * 2);
}
}
public int this[in long x]
{
set
{
System.Console.WriteLine(x * 4);
}
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim value As Integer = 5
Dim obj = New TestRef()
obj(value) = 0
End Sub
End Class
</file>
</compilation>
CompileAndVerify(source, references:={reference}, expectedOutput:="20")
End Sub
<Fact>
Public Sub OverloadResolutionShouldBeAbleToPickOverloadsWithNoModreqsOverOnesWithModreq_Indexers_ReturnTypes()
Dim reference = CreateCSharpCompilation("
public class TestRef
{
private int value = 5;
public ref readonly int this[int x]
{
get
{
value = value * 2;
return ref value;
}
}
public int this[long x]
{
get
{
value = value * 4;
return value;
}
}
}", parseOptions:=New CSharpParseOptions(CSharp.LanguageVersion.Latest)).EmitToImageReference()
Dim source =
<compilation>
<file>
Class Test
Shared Sub Main()
Dim obj = New TestRef()
System.Console.WriteLine(obj(0))
End Sub
End Class
</file>
</compilation>
CompileAndVerify(source, references:={reference}, expectedOutput:="20")
End Sub
End Class
End Namespace
|
brettfo/roslyn
|
src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/Metadata/PE/InAttributeModifierTests.vb
|
Visual Basic
|
apache-2.0
| 30,614
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports Microsoft.CodeAnalysis.Collections
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Partial Friend NotInheritable Class AnonymousTypeManager
Partial Private Class AnonymousTypeConstructorSymbol
Inherits SynthesizedConstructorBase
Friend Overrides Function GetBoundMethodBody(compilationState As TypeCompilationState, diagnostics As DiagnosticBag, Optional ByRef methodBodyBinder As Binder = Nothing) As BoundBlock
methodBodyBinder = Nothing
Dim syntax As SyntaxNode = Me.Syntax
' List of statements
Dim statements = ArrayBuilder(Of BoundStatement).GetInstance()
Dim anonymousType = DirectCast(Me.ContainingType, AnonymousTypeTemplateSymbol)
Debug.Assert(anonymousType.Properties.Length = Me.ParameterCount)
' 'Me' reference
Dim boundMeReference = New BoundMeReference(syntax, anonymousType).MakeCompilerGenerated()
For index = 0 To Me.ParameterCount - 1
Dim [property] As AnonymousTypePropertySymbol = anonymousType.Properties(index)
Dim propertyType As TypeSymbol = [property].Type
' Generate 'field' = 'parameter' statement
Dim fieldAccess = New BoundFieldAccess(syntax, boundMeReference, [property].AssociatedField, True, propertyType).MakeCompilerGenerated()
Dim parameter = New BoundParameter(syntax, Me._parameters(index), isLValue:=False, type:=propertyType).MakeCompilerGenerated()
Dim assignment = New BoundAssignmentOperator(syntax, fieldAccess, parameter, False, propertyType).MakeCompilerGenerated()
statements.Add(New BoundExpressionStatement(syntax, assignment).MakeCompilerGenerated())
Next
' Final return statement
statements.Add(New BoundReturnStatement(syntax, Nothing, Nothing, Nothing).MakeCompilerGenerated())
' Create a bound block
Return New BoundBlock(syntax, Nothing, ImmutableArray(Of LocalSymbol).Empty, statements.ToImmutableAndFree()).MakeCompilerGenerated()
End Function
End Class
Partial Private NotInheritable Class AnonymousTypeEqualsMethodSymbol
Inherits SynthesizedRegularMethodBase
Friend Overrides Function GetBoundMethodBody(compilationState As TypeCompilationState, diagnostics As DiagnosticBag, Optional ByRef methodBodyBinder As Binder = Nothing) As BoundBlock
methodBodyBinder = Nothing
Dim syntax As SyntaxNode = Me.Syntax
' 'Me' reference
Dim boundMeReference As BoundMeReference = New BoundMeReference(syntax, AnonymousType).MakeCompilerGenerated()
' Argument 'obj' reference
Dim boundObjReference As BoundParameter = New BoundParameter(syntax, Me._parameters(0), isLValue:=False,
type:=AnonymousType.Manager.System_Object).MakeCompilerGenerated()
' TryCast(obj, <anonymous-type>)
Dim boundTryCast As BoundExpression = New BoundTryCast(syntax, boundObjReference, ConversionKind.NarrowingReference,
AnonymousType, Nothing).MakeCompilerGenerated()
' Call Me.Equals(TryCast(obj, <anonymous-type>))
Dim boundCallToEquals As BoundExpression = New BoundCall(syntax, Me._iEquatableEqualsMethod, Nothing,
boundMeReference, ImmutableArray.Create(Of BoundExpression)(boundTryCast),
Nothing, AnonymousType.Manager.System_Boolean).MakeCompilerGenerated()
' Create a bound block
Return New BoundBlock(syntax, Nothing, ImmutableArray(Of LocalSymbol).Empty,
ImmutableArray.Create(Of BoundStatement)(
New BoundReturnStatement(syntax, boundCallToEquals, Nothing, Nothing).MakeCompilerGenerated()))
End Function
End Class
Partial Private NotInheritable Class AnonymousTypeGetHashCodeMethodSymbol
Inherits SynthesizedRegularMethodBase
Friend Overrides Function GetBoundMethodBody(compilationState As TypeCompilationState, diagnostics As DiagnosticBag, Optional ByRef methodBodyBinder As Binder = Nothing) As BoundBlock
methodBodyBinder = Nothing
Dim syntax As SyntaxNode = Me.Syntax
Dim objectType As TypeSymbol = Me.AnonymousType.Manager.System_Object
Dim getHashCodeMethod As MethodSymbol = Me.AnonymousType.Manager.System_Object__GetHashCode
Dim integerType As TypeSymbol = Me.AnonymousType.Manager.System_Int32
Dim booleanType As TypeSymbol = Me.AnonymousType.Manager.System_Boolean
' Generate Hash base
#If False Then
' NOTE: Following Dev10 behavior we ensure all anonymous types with the same field
' names (case-insensitive) have the same hash base. Algorithm differs though...
Dim builder = PooledStringBuilder.GetInstance()
For Each [property] In Me.AnonymousType.Properties
If [property].IsReadOnly Then
builder.Builder.Append("|"c)
builder.Builder.Append([property].Name)
End If
Next
Dim hashBase As Integer = builder.ToStringAndFree().ToLower().GetHashCode()
#Else
Dim properties = Me.AnonymousType.Properties
Dim names(properties.Length - 1) As String
For i = 0 To properties.Length - 1
names(i) = properties(i).Name
Next
Dim hashBase As Integer = CInt(CRC32.ComputeCRC32(names))
#End If
' 'Me' reference
Dim boundMeReference = New BoundMeReference(syntax, AnonymousType).MakeCompilerGenerated()
' This variable accumulates the expression as we build it, final expression should be a bound
' expression representing the following expression (only readonly=key fields are processed):
' '((...(( <hashBase> )*&HA5555529 + IF(field0 Is Nothing, 0, field0.GetHashCode())
' )*&HA5555529 + IF(field1 Is Nothing, 0, field1.GetHashCode())
' ...
' )*&HA5555529 + IF(lastField Is Nothing, 0, lastField.GetHashCode()))'
Dim expression As BoundExpression = Nothing
' <expression> ::= <hashBase>
expression = New BoundLiteral(syntax, ConstantValue.Create(hashBase), integerType).MakeCompilerGenerated()
Dim factorLiteral = New BoundLiteral(syntax, ConstantValue.Create(&HA5555529), integerType).MakeCompilerGenerated()
Dim zeroLiteral = New BoundLiteral(syntax, ConstantValue.Create(0), integerType).MakeCompilerGenerated()
Dim nothingLiteral = New BoundLiteral(syntax, ConstantValue.Nothing, objectType).MakeCompilerGenerated()
For Each [property] In Me.AnonymousType.Properties
If [property].IsReadOnly Then
' <expression> ::= <expression>*<factor>
expression = New BoundBinaryOperator(syntax, BinaryOperatorKind.Multiply,
expression, factorLiteral, False, integerType).MakeCompilerGenerated()
' boundCondition ::= 'DirectCast(field, System.Object) is nothing'
Dim boundCondition = New BoundBinaryOperator(syntax, BinaryOperatorKind.Is,
New BoundDirectCast(syntax,
New BoundFieldAccess(
syntax, boundMeReference,
[property].AssociatedField, False,
[property].Type).MakeCompilerGenerated(),
ConversionKind.WideningTypeParameter,
objectType, Nothing).MakeCompilerGenerated(),
nothingLiteral, False, booleanType).MakeCompilerGenerated()
' boundGetHashCode ::= 'field.GetHashCode()'
Dim boundGetHashCode = New BoundCall(syntax, getHashCodeMethod, Nothing,
New BoundFieldAccess(
syntax, boundMeReference,
[property].AssociatedField, False,
[property].Type).MakeCompilerGenerated(),
ImmutableArray(Of BoundExpression).Empty,
Nothing, integerType).MakeCompilerGenerated()
' boundTernaryConditional = IF(<boundCondition>, 0, <boundGetHashCode>)
Dim boundTernaryConditional = New BoundTernaryConditionalExpression(syntax,
boundCondition, zeroLiteral, boundGetHashCode,
Nothing, integerType).MakeCompilerGenerated()
' <expression> ::= <expression> + <boundTernaryConditional>
expression = New BoundBinaryOperator(syntax, BinaryOperatorKind.Add, expression,
boundTernaryConditional, False, integerType).MakeCompilerGenerated()
End If
Next
' Create a bound block
Return New BoundBlock(syntax, Nothing,
ImmutableArray(Of LocalSymbol).Empty,
ImmutableArray.Create(Of BoundStatement)(
New BoundReturnStatement(syntax, expression, Nothing, Nothing).MakeCompilerGenerated()))
End Function
End Class
Partial Private NotInheritable Class AnonymousType_IEquatable_EqualsMethodSymbol
Inherits SynthesizedRegularMethodBase
Friend Overrides Function GetBoundMethodBody(compilationState As TypeCompilationState, diagnostics As DiagnosticBag, Optional ByRef methodBodyBinder As Binder = Nothing) As BoundBlock
methodBodyBinder = Nothing
Dim syntax As SyntaxNode = Me.Syntax
Dim objectType As TypeSymbol = Me.AnonymousType.Manager.System_Object
Dim booleanType As TypeSymbol = Me.AnonymousType.Manager.System_Boolean
' Locals
Dim localMyFieldBoxed As LocalSymbol = New SynthesizedLocal(Me, objectType, SynthesizedLocalKind.LoweringTemp)
Dim localOtherFieldBoxed As LocalSymbol = New SynthesizedLocal(Me, objectType, SynthesizedLocalKind.LoweringTemp)
' 'Me' reference
Dim boundMeReference As BoundMeReference = New BoundMeReference(syntax, AnonymousType)
' Argument 'val' reference
Dim boundValReference As BoundParameter = New BoundParameter(syntax, Me._parameters(0), isLValue:=False, type:=AnonymousType)
' 'Nothing' Literal to be reused
Dim nothingLiteral = New BoundLiteral(syntax, ConstantValue.Nothing, objectType).MakeCompilerGenerated()
' Build combined condition for all fields
Dim combinedFieldCheck = BuildConditionsForFields(boundMeReference, boundValReference, nothingLiteral,
localMyFieldBoxed, localOtherFieldBoxed, booleanType)
' Build 'val IsNot Nothing' condition
Dim valIsNotNothing = BuildIsCheck(New BoundDirectCast(syntax, boundValReference,
ConversionKind.WideningReference, objectType, Nothing).MakeCompilerGenerated(),
nothingLiteral, booleanType, reverse:=True)
' Final equality check: <valIsNotNothing> AndAlso <combinedFieldCheck>
Dim finalEqualityCheck = BuildAndAlso(valIsNotNothing, combinedFieldCheck, booleanType)
' Create a bound block
Return New BoundBlock(syntax, Nothing,
ImmutableArray.Create(localMyFieldBoxed, localOtherFieldBoxed),
ImmutableArray.Create(Of BoundStatement)(
New BoundReturnStatement(syntax, finalEqualityCheck, Nothing, Nothing).MakeCompilerGenerated()))
End Function
Private Function BuildConditionsForFields(boundMe As BoundMeReference, boundOther As BoundParameter, boundNothing As BoundExpression,
localMyFieldBoxed As LocalSymbol, localOtherFieldBoxed As LocalSymbol, booleanType As TypeSymbol) As BoundExpression
' <expression> will be build in a form of (only key fields are reported)
' (<condition-for-field-1> AndAlso <condition-for-field-2> OrElse ... AndAlso <condition-for-field-N> )
Dim expression As BoundExpression = Nothing
' Process fields
For Each [property] In AnonymousType.Properties
If [property].IsReadOnly Then
Dim condition As BoundExpression = BuildConditionForField([property], boundMe, boundOther, boundNothing, localMyFieldBoxed, localOtherFieldBoxed, booleanType)
expression = If(expression Is Nothing, condition, BuildAndAlso(expression, condition, booleanType))
End If
Next
Return expression
End Function
''' <summary>
''' Builds a condition in the following form:
'''
''' [preaction: localMyFieldBoxed = DirectCast(Me.field, System.Object)]
''' [preaction: localOtherFieldBoxed = DirectCast(Other.field, System.Object)]
''' IF(localMyFieldBoxed IsNot Nothing AndAlso localOtherFieldBoxed IsNot Nothing,
''' localMyFieldBoxed.Equals(localOtherFieldBoxed),
''' localMyFieldBoxed Is localOtherFieldBoxed
''' )
''' </summary>
Private Function BuildConditionForField([property] As AnonymousTypePropertySymbol, boundMe As BoundMeReference, boundOther As BoundParameter,
boundNothing As BoundExpression, localMyFieldBoxed As LocalSymbol, localOtherFieldBoxed As LocalSymbol,
booleanType As TypeSymbol) As BoundExpression
Dim field As FieldSymbol = [property].AssociatedField
Dim syntax As SyntaxNode = Me.Syntax
Dim boundLocalMyFieldBoxed = New BoundLocal(syntax, localMyFieldBoxed,
False, localMyFieldBoxed.Type).MakeCompilerGenerated()
Dim boundLocalOtherFieldBoxed = New BoundLocal(syntax, localOtherFieldBoxed,
False, localOtherFieldBoxed.Type).MakeCompilerGenerated()
Dim condition As BoundExpression = BuildAndAlso(BuildIsCheck(boundLocalMyFieldBoxed, boundNothing, booleanType, reverse:=True),
BuildIsCheck(boundLocalOtherFieldBoxed, boundNothing, booleanType, reverse:=True),
booleanType)
' TODO: Make sure we don't call GetObjectValue here
Dim boundCallToEquals As BoundExpression = New BoundCall(syntax,
Me.AnonymousType.Manager.System_Object__Equals, Nothing,
boundLocalMyFieldBoxed,
ImmutableArray.Create(Of BoundExpression)(boundLocalOtherFieldBoxed),
Nothing, booleanType).MakeCompilerGenerated()
Dim ternary As BoundExpression = New BoundTernaryConditionalExpression(syntax,
condition, boundCallToEquals,
BuildIsCheck(boundLocalMyFieldBoxed, boundLocalOtherFieldBoxed, booleanType),
Nothing, booleanType).MakeCompilerGenerated()
Dim assignLocalMyField As BoundExpression = New BoundAssignmentOperator(syntax,
New BoundLocal(syntax, localMyFieldBoxed,
True, localMyFieldBoxed.Type),
BuildBoxedFieldAccess(boundMe, field),
True, localMyFieldBoxed.Type).MakeCompilerGenerated()
Dim assignLocalOtherField As BoundExpression = New BoundAssignmentOperator(syntax,
New BoundLocal(syntax, localOtherFieldBoxed,
True, localOtherFieldBoxed.Type),
BuildBoxedFieldAccess(boundOther, field),
True, localOtherFieldBoxed.Type).MakeCompilerGenerated()
Return New BoundSequence(syntax, ImmutableArray(Of LocalSymbol).Empty,
ImmutableArray.Create(Of BoundExpression)(assignLocalMyField, assignLocalOtherField),
ternary, ternary.Type).MakeCompilerGenerated()
End Function
Private Function BuildBoxedFieldAccess(receiver As BoundExpression, field As FieldSymbol) As BoundExpression
Return New BoundDirectCast(Syntax,
New BoundFieldAccess(Syntax, receiver, field, False, field.Type).MakeCompilerGenerated(),
ConversionKind.WideningTypeParameter,
Me.AnonymousType.Manager.System_Object, Nothing).MakeCompilerGenerated()
End Function
Private Function BuildIsCheck(left As BoundExpression, right As BoundExpression, booleanType As TypeSymbol, Optional reverse As Boolean = False) As BoundExpression
Return New BoundBinaryOperator(Syntax,
If(reverse, BinaryOperatorKind.IsNot, BinaryOperatorKind.Is),
left, right, False, booleanType).MakeCompilerGenerated()
End Function
Private Function BuildAndAlso(left As BoundExpression, right As BoundExpression, booleanType As TypeSymbol) As BoundExpression
Return New BoundBinaryOperator(Syntax, BinaryOperatorKind.AndAlso,
left, right, False, booleanType).MakeCompilerGenerated()
End Function
End Class
Partial Private NotInheritable Class AnonymousTypeToStringMethodSymbol
Inherits SynthesizedRegularMethodBase
Friend Overrides Function GetBoundMethodBody(compilationState As TypeCompilationState, diagnostics As DiagnosticBag, Optional ByRef methodBodyBinder As Binder = Nothing) As BoundBlock
methodBodyBinder = Nothing
Dim syntax As SyntaxNode = Me.Syntax
Dim objectType As TypeSymbol = Me.AnonymousType.Manager.System_Object
Dim stringType As TypeSymbol = Me.ReturnType
Dim arrayOfObjectsType As TypeSymbol = Me.AnonymousType.Manager.Compilation.CreateArrayTypeSymbol(objectType)
Dim numberOfFields As Integer = AnonymousType.Properties.Length
' Process all parameters, build string format pattern, build arguments
Dim boundMeReference = New BoundMeReference(syntax, AnonymousType).MakeCompilerGenerated()
Dim boundFieldAccessArray(numberOfFields - 1) As BoundExpression
Dim formatStringBuilder = PooledStringBuilder.GetInstance()
formatStringBuilder.Builder.Append("{{ ")
For index = 0 To numberOfFields - 1
Dim [property] As AnonymousTypePropertySymbol = AnonymousType.Properties(index)
' format pattern
formatStringBuilder.Builder.AppendFormat(If(index = 0, "{0} = {{{1}}}", ", {0} = {{{1}}}"), [property].MetadataName, index)
' put the field accessor to boundFieldAccessArray
boundFieldAccessArray(index) = New BoundDirectCast(syntax,
New BoundFieldAccess(syntax, boundMeReference, [property].AssociatedField,
False, [property].Type).MakeCompilerGenerated(),
ConversionKind.WideningTypeParameter, objectType, Nothing).MakeCompilerGenerated()
Next
formatStringBuilder.Builder.Append(" }}")
Dim formatString As String = formatStringBuilder.ToStringAndFree()
' array initializer: { field0, field1, ... }
Dim boundArrayInitializer As BoundArrayInitialization = New BoundArrayInitialization(syntax, boundFieldAccessArray.AsImmutableOrNull(),
arrayOfObjectsType).MakeCompilerGenerated()
' New Object(numberOfFields - 1) { field0, field1, ... }
Dim arrayInstantiation As BoundExpression = New BoundArrayCreation(syntax,
ImmutableArray.Create(Of BoundExpression)(
New BoundLiteral(syntax, ConstantValue.Create(numberOfFields),
Me.AnonymousType.Manager.System_Int32).MakeCompilerGenerated()),
boundArrayInitializer, arrayOfObjectsType).MakeCompilerGenerated()
' String.Format(<formatPattern>, New Object(numberOfFields - 1) { field0, field1, ... })
Dim formatMethod = Me.AnonymousType.Manager.System_String__Format_IFormatProvider
Dim [call] As BoundExpression = New BoundCall(syntax, formatMethod, Nothing, Nothing,
ImmutableArray.Create(Of BoundExpression)(
New BoundLiteral(syntax, ConstantValue.Nothing,
formatMethod.Parameters(0).Type).MakeCompilerGenerated(),
New BoundLiteral(syntax, ConstantValue.Create(formatString),
stringType).MakeCompilerGenerated(),
arrayInstantiation),
Nothing, stringType).MakeCompilerGenerated()
' Create a bound block
Return New BoundBlock(syntax, Nothing,
ImmutableArray(Of LocalSymbol).Empty,
ImmutableArray.Create(Of BoundStatement)(
New BoundReturnStatement(syntax, [call], Nothing, Nothing).MakeCompilerGenerated()))
End Function
End Class
End Class
End Namespace
|
robinsedlaczek/roslyn
|
src/Compilers/VisualBasic/Portable/Binding/SyntheticBoundTrees/AnonymousTypeSyntheticMethods.vb
|
Visual Basic
|
apache-2.0
| 26,457
|
Imports x8086NetEmu
Imports System.Threading
Public Class FormConsole
#If Win32 Then
<Runtime.InteropServices.DllImport("user32.dll")>
Public Shared Function LockWindowUpdate(hWndLock As IntPtr) As Boolean
End Function
#End If
Private mEmulator As X8086
Private Const rtfTextStd As String = "{\rtf1\ansi {\colortbl;" +
"\red000\green192\blue000;" +
"\red192\green192\blue000;" +
"\red192\green000\blue192;" +
"\red255\green000\blue000;" +
"\red255\green000\blue000;" +
"\red080\green080\blue255;" +
"}%\par}"
Private rtfText As String = ""
Private lastMesssage As String = ""
Private repeatCount As Integer = 0
Private lastArg() As Object = {""}
Private ReadOnly refreshTimer As New Timer(New TimerCallback(AddressOf UpdateRtf), Nothing, Timeout.Infinite, Timeout.Infinite)
Private Sub FormConsole_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
SyncLock Me
RemoveHandler X8086.Output, AddressOf Output
End SyncLock
refreshTimer.Dispose()
End Sub
Private Sub FormConsole_Load(sender As Object, e As EventArgs) Handles MyBase.Load
RichTextBoxConsole.Text = ""
AddHandler CopyToolStripMenuItem.Click, Sub()
If RichTextBoxConsole.SelectedText = "" Then
Clipboard.SetText(RichTextBoxConsole.Text)
Else
Clipboard.SetText(RichTextBoxConsole.SelectedText)
End If
End Sub
AddHandler ClearToolStripMenuItem.Click, Sub()
rtfText = ""
RichTextBoxConsole.Clear()
End Sub
End Sub
Public Property Emulator As X8086
Get
Return mEmulator
End Get
Set(value As X8086)
mEmulator = value
AddHandler X8086.Output, AddressOf Output
End Set
End Property
Private Sub Output(message As String, reason As X8086.NotificationReasons, arg() As Object)
If lastMesssage = message AndAlso HasSameArguments(arg) Then
repeatCount += 1
Exit Sub
End If
lastMesssage = message
lastArg = arg
If repeatCount > 0 Then
SendOutput($"^^^ Last message repeated {repeatCount} time{If(repeatCount > 1, "s", "")}", X8086.NotificationReasons.Dbg, arg)
repeatCount = 0
End If
SendOutput(message, reason, arg)
End Sub
Private Function HasSameArguments(arg() As Object) As Boolean
If arg.Length <> lastArg.Length Then Return False
If arg.Length = 0 Then Return True
For i As Integer = 0 To arg.Length - 1
If arg(i) <> lastArg(i) Then Return False
Next
Return True
End Function
Private Sub SendOutput(message As String, reason As X8086.NotificationReasons, arg() As Object)
message = message.Replace("\", "\\")
rtfText += "\cf1 " + MillTime + ": "
Select Case reason
Case X8086.NotificationReasons.Info : rtfText += "\cf2 "
Case X8086.NotificationReasons.Warn : rtfText += "\cf3 "
Case X8086.NotificationReasons.Err : rtfText += "\cf4 "
Case X8086.NotificationReasons.Fck : rtfText += "\cf5 "
Case X8086.NotificationReasons.Dbg : rtfText += "\cf6 "
End Select
rtfText += String.Format(message.Replace("{", "\b {").Replace("}", "}\b0 ") + " \par ", arg)
refreshTimer.Change(250, Timeout.Infinite)
End Sub
Private Sub UpdateRtf()
Me.BeginInvoke(Sub()
SyncLock Me
#If Win32 Then
LockWindowUpdate(RichTextBoxConsole.Handle)
#End If
RichTextBoxConsole.Rtf = rtfTextStd.Replace("%", rtfText)
RichTextBoxConsole.SelectionStart = RichTextBoxConsole.TextLength
RichTextBoxConsole.ScrollToCaret()
#If Win32 Then
LockWindowUpdate(0)
#End If
End SyncLock
End Sub)
End Sub
Private ReadOnly Property MillTime As String
Get
Return String.Format("{0:00}:{1:00}:{2:00}:{3:000}", Now.Hour, Now.Minute, Now.Second, Now.Millisecond)
End Get
End Property
End Class
|
morphx666/x8086NetEmu
|
x8086NetEmuWinForms/Tools/FormConsole.vb
|
Visual Basic
|
mit
| 4,973
|
Imports GemBox.Document
Module Program
Sub Main()
' If using Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY")
Dim document As New DocumentModel()
' Built-in styles can be created using Style.CreateStyle method.
Dim titleStyle = DirectCast(Style.CreateStyle(StyleTemplateType.Title, document), ParagraphStyle)
' We can also create our own custom styles.
Dim emphasisStyle As New CharacterStyle("Emphasis")
emphasisStyle.CharacterFormat.Italic = True
' To use styles, we first must add them to the document.
document.Styles.Add(titleStyle)
document.Styles.Add(emphasisStyle)
' Or we can use a utility method to get a built-in style or create and add a new one in a single statement.
Dim strongStyle = DirectCast(document.Styles.GetOrAdd(StyleTemplateType.Strong), CharacterStyle)
document.Sections.Add(
New Section(document,
New Paragraph(document, "Title (Title style)") With {.ParagraphFormat = New ParagraphFormat() With {.Style = titleStyle}},
New Paragraph(document,
New Run(document, "Text is written using Emphasis style.") With {.CharacterFormat = New CharacterFormat() With {.Style = emphasisStyle}},
New SpecialCharacter(document, SpecialCharacterType.LineBreak),
New Run(document, "Text is written using Strong style.") With {.CharacterFormat = New CharacterFormat() With {.Style = strongStyle}})))
document.Save("Styles.docx")
End Sub
End Module
|
gemboxsoftware-dev-team/GemBox.Document.Examples
|
VB.NET/Formatting/Styles/Program.vb
|
Visual Basic
|
mit
| 1,643
|
Imports System.Xml
Imports System.Text
Imports System.Text.RegularExpressions
Imports 버들라이브러리.ColorHelper
Imports System.IO
Public Class datapackworker
#Region "Structure"
Private Structure ControlSetting
Public name As String
Public text As String
Public src As String
Public tooltiptext As String
Public Shared left As Integer = 10
Public Shared top As Integer = 10
Public Shared width As Integer = 120
Public Shared height As Integer = 20
Public Shared BackColor As Color = Color.Transparent
Public Shared ForeColor As Color = Color.Black
Public Shared FlatStyle As FlatStyle = FlatStyle.Standard
Public Shared SizeMode As PictureBoxSizeMode = PictureBoxSizeMode.Normal
Public Shared TextAlign As ContentAlignment = ContentAlignment.TopLeft
Public Shared borderStyle As BorderStyle = borderStyle.Fixed3D
Public Shared enabled As Boolean = True
Public Shared multiline As Boolean = False
Public Sub setmultiline(ByVal bool As Boolean)
multiline = bool
End Sub
Public Function getmultiline()
Return multiline
End Function
Public Sub setEnabled(ByVal bool As Boolean)
enabled = bool
End Sub
Public Function getEnabled()
Return enabled
End Function
Public Sub setBorderStyle(ByVal bstyle As BorderStyle)
borderStyle = bstyle
End Sub
Public Function getBorderStyle()
Return borderStyle
End Function
Public Sub setLeft(ByVal int As Integer)
left = int
End Sub
Public Sub setTop(ByVal int As Integer)
top = int
End Sub
Public Sub setWidth(ByVal int As Integer)
width = int
End Sub
Public Sub setHeight(ByVal int As Integer)
height = int
End Sub
Public Sub setBackColor(ByVal color As Color)
BackColor = color
End Sub
Public Sub setForeColor(ByVal color As Color)
ForeColor = color
End Sub
Public Sub setFlatStyle(ByVal style As FlatStyle)
FlatStyle = style
End Sub
Public Sub setSizeMode(ByVal size As PictureBoxSizeMode)
SizeMode = size
End Sub
Public Sub setTextAlign(ByVal align As ContentAlignment)
TextAlign = align
End Sub
Public Function rleft()
Return left
End Function
Public Function rtop()
Return top
End Function
Public Function rwidth()
Return width
End Function
Public Function rheight()
Return height
End Function
Public Function rbc()
Return BackColor
End Function
Public Function rfc()
Return ForeColor
End Function
Public Function rfs()
Return FlatStyle
End Function
Public Function rsm()
Return SizeMode
End Function
Public Function rta()
Return TextAlign
End Function
End Structure
Private Function SettingReader(ByVal node As XmlElement)
Dim tmp As New ControlSetting
For Each attr As XmlAttribute In node.Attributes
Select Case attr.Name.ToLower
Case "name"
tmp.name = attr.Value.Trim
Case "left"
tmp.setLeft(Val(attr.Value))
Case "top"
tmp.setTop(Val(attr.Value))
Case "width"
tmp.setWidth(Val(attr.Value))
Case "height"
tmp.setHeight(Val(attr.Value))
Case "text"
tmp.text = attr.Value.Trim
Case "src"
tmp.src = attr.Value.Trim
Case "tooltiptext"
tmp.tooltiptext = attr.Value.Trim
Case "multiline"
If attr.Value.Trim.ToLower = "false" Then
tmp.setmultiline(False)
Else
tmp.setmultiline(True)
End If
Case "enabled"
If attr.Value.Trim.ToLower = "false" Then
tmp.setEnabled(False)
Else
tmp.setEnabled(True)
End If
Case "borderstyle"
Dim v As String = attr.Value.Trim.ToLower
If v = "fixedsingle" Then
tmp.setBorderStyle(BorderStyle.FixedSingle)
ElseIf v = "fixed3d" Then
tmp.setBorderStyle(BorderStyle.Fixed3D)
ElseIf v = "none" Then
tmp.setBorderStyle(BorderStyle.None)
End If
Case "backcolor", "배경색"
Try
tmp.setBackColor(HEXtoColor(attr.Value))
Catch ex As Exception
End Try
Case "forecolor", "전경색"
Try
tmp.setForeColor(HEXtoColor(attr.Value))
Catch ex As Exception
End Try
Case "flatstyle"
Dim v As String = attr.Value.ToLower
If v = "flat" Then
tmp.setFlatStyle(FlatStyle.Flat)
ElseIf v = "popup" Then
tmp.setFlatStyle(FlatStyle.Popup)
ElseIf v = "standard" Then
tmp.setFlatStyle(FlatStyle.Standard)
ElseIf v = "system" Then
tmp.setFlatStyle(FlatStyle.System)
End If
Case "text-align"
Dim v As String = attr.Value.ToLower
If v = "topleft" Then
tmp.setTextAlign(ContentAlignment.TopLeft)
ElseIf v = "topcenter" Then
tmp.setTextAlign(ContentAlignment.TopCenter)
ElseIf v = "topright" Then
tmp.setTextAlign(ContentAlignment.TopRight)
ElseIf v = "middleleft" Then
tmp.setTextAlign(ContentAlignment.MiddleLeft)
ElseIf v = "middlecenter" Then
tmp.setTextAlign(ContentAlignment.MiddleCenter)
ElseIf v = "middleright" Then
tmp.setTextAlign(ContentAlignment.MiddleRight)
ElseIf v = "bottomleft" Then
tmp.setTextAlign(ContentAlignment.BottomLeft)
ElseIf v = "bottomcenter" Then
tmp.setTextAlign(ContentAlignment.BottomCenter)
ElseIf v = "bottomright" Then
tmp.setTextAlign(ContentAlignment.BottomRight)
End If
Case "sizemode", "조정방식"
If attr.Value.ToLower = "resize" Then
tmp.setSizeMode(PictureBoxSizeMode.StretchImage)
ElseIf attr.Value.ToLower = "normal" Then
tmp.setSizeMode(PictureBoxSizeMode.Normal)
ElseIf attr.Value.ToLower = "zoom" Then
tmp.setSizeMode(PictureBoxSizeMode.Zoom)
ElseIf attr.Value.ToLower = "center" Then
tmp.setSizeMode(PictureBoxSizeMode.CenterImage)
End If
End Select
Next
Return tmp
End Function
#End Region
#Region "USERVAR"
Private Function USERVAR(ByVal doc As String, ByVal path As String) As String
doc = doc.Replace("%MY_PROJECT%", path.Substring(0, path.LastIndexOf(".")))
doc = doc.Replace("%OFFICIAL%", "http://lib.willowslab.com/")
doc = doc.Replace("%MABINOGI%", Setting.Mabi)
doc = doc.Replace("%MABINOGI_DATA%", Setting.Mabi & "\data")
doc = doc.Replace("%MABINOGI_PACK%", Setting.Mabi & "\package")
doc = doc.Replace("%MABINOGI_MP3%", Setting.Mabi & "\mp3")
doc = doc.Replace("%MABINOGI_DB%", Setting.Mabi & "\data\db")
doc = doc.Replace("%MABINOGI_GFX%", Setting.Mabi & "\data\gfx")
doc = doc.Replace("%MABINOGI_CHAR%", Setting.Mabi & "\data\gfx\char")
doc = doc.Replace("%MABINOGI_FONT%", Setting.Mabi & "\data\gfx\font")
doc = doc.Replace("%MABINOGI_FX%", Setting.Mabi & "\data\gfx\fx")
doc = doc.Replace("%MABINOGI_GUI%", Setting.Mabi & "\data\gfx\gui")
doc = doc.Replace("%MABINOGI_IMAGE%", Setting.Mabi & "\data\gfx\image")
doc = doc.Replace("%MABINOGI_IMAGE2%", Setting.Mabi & "\data\gfx\image2")
doc = doc.Replace("%MABINOGI_INTRO%", Setting.Mabi & "\data\gfx\intro")
doc = doc.Replace("%MABINOGI_SCENE%", Setting.Mabi & "\data\gfx\scene")
doc = doc.Replace("%MABINOGI_STYLE%", Setting.Mabi & "\data\gfx\style")
doc = doc.Replace("%MABINOGI_LOCAL%", Setting.Mabi & "\data\local")
doc = doc.Replace("%MABINOGI_CODE%", Setting.Mabi & "\data\local\code")
doc = doc.Replace("%MABINOGI_XML%", Setting.Mabi & "\data\local\xml")
doc = doc.Replace("%MABINOGI_LOCALE%", Setting.Mabi & "\data\locale")
doc = doc.Replace("%MABINOGI_MATERIAL%", Setting.Mabi & "\data\material")
doc = doc.Replace("%MABINOGI_SOUND%", Setting.Mabi & "\data\sound")
doc = doc.Replace("%MABINOGI_WORLD%", Setting.Mabi & "\data\world")
doc = doc.Replace("%MY_MABINOGI%", Setting.myDoc & "\마비노기")
doc = doc.Replace("%PROGRAMDIR%", Setting.Dir)
Return doc
End Function
#End Region
#Region "Component Adding"
Public Function NewCombobox(ByVal parent As Object, ByVal node As XmlElement)
Dim Component As New ComboBox
Dim tempList As New ListView
Dim setting As ControlSetting = SettingReader(node)
Component.Name = setting.name
For Each node2 As XmlElement In node.ChildNodes
Component.Items.Add(node2.InnerText.Trim)
tempList.Items.Add(node2.Attributes(0).Value.Trim)
Next
tempList.Location = New Point(-99, -99)
tempList.Size = New Size(0, 0)
tempList.Name = setting.name & "_list"
Component.BackColor = setting.rbc
Component.ForeColor = setting.rfc
Component.Location = New Point(setting.rleft, setting.rtop)
Component.Size = New Size(setting.rwidth, setting.rheight)
Component.MaxDropDownItems = 8
Component.DropDownStyle = ComboBoxStyle.DropDownList
Component.SelectedIndex = 0
Try
parent.Controls.add(Component)
parent.Controls.add(tempList)
Me.variablelist.Items.Add(New ListViewItem({"select", setting.name}))
Catch ex As Exception
Return False
End Try
Return True
End Function
Private Sub NewCheckBox(ByVal parent As Object, ByVal node As XmlElement)
Try
Dim tmpselect As New CheckBox
Dim setting As ControlSetting = SettingReader(node)
For Each nm As ListViewItem In Me.variablelist.Items
If nm.SubItems(0).Text = setting.name Then
MsgBox("이 실험 문서에 오류가 있습니다. 계속해서 이런 현상이 나타나면 입력된 실험 계획서를 수정하거나 문의하시기 바랍니다.", MsgBoxStyle.Critical, "오류")
Exit Sub
End If
Next
Me.variablelist.Items.Add(New ListViewItem({"checkbox", setting.name}))
tmpselect.Size = New Size(setting.rwidth, setting.rheight)
tmpselect.Location = New Drawing.Point(setting.rleft, setting.rtop)
tmpselect.Text = node.InnerText.Trim
tmpselect.Name = setting.name
Me.ToolTipText.SetToolTip(tmpselect, setting.tooltiptext)
parent.Controls.Add(tmpselect)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub NewLabel(ByVal parent As Object, ByVal node As XmlElement)
Dim tmpselect As New Label
Dim setting As ControlSetting = SettingReader(node)
tmpselect.AutoSize = True
tmpselect.BackColor = setting.rbc
tmpselect.ForeColor = setting.rfc
tmpselect.FlatStyle = setting.rfs
tmpselect.TextAlign = setting.rta
tmpselect.Location = New Point(setting.rleft, setting.rtop)
tmpselect.Size = New Size(setting.rwidth, setting.rheight)
Me.ToolTipText.SetToolTip(tmpselect, setting.tooltiptext)
tmpselect.Text = node.InnerText
parent.Controls.Add(tmpselect)
End Sub
Private Sub NewPicturebox(ByVal parent As Object, ByVal node As XmlElement)
Dim tmpselect As New PictureBox
Dim setting As ControlSetting = SettingReader(node)
tmpselect.SizeMode = setting.rsm
tmpselect.ImageLocation = setting.src
tmpselect.ErrorImage = My.Resources.Resources.image_crushed
tmpselect.Location = New Drawing.Point(setting.rleft, setting.rtop)
tmpselect.Size = New Size(setting.rwidth, setting.rheight)
Me.ToolTipText.SetToolTip(tmpselect, setting.tooltiptext)
parent.Controls.Add(tmpselect)
End Sub
Private Function AddContextMenuItem(ByVal node As XmlElement)
Dim cms As New MenuStrip
Dim list As New List(Of ToolStripMenuItem)
Dim i As Integer = 0
For Each node2 As XmlElement In node.ChildNodes
Dim cmsi As New ToolStripMenuItem
If node2.Name.ToLower = "item" Then
For Each attr As XmlAttribute In node2.Attributes
Select Case attr.Name.ToLower
Case "text"
cmsi.Text = attr.Value.Trim
End Select
Next
If node2.HasChildNodes = True Then
cmsi.DropDownItems.AddRange(AddContextMenuItem(node2))
End If
list.Add(cmsi)
End If
i += 1
Next
Dim listt As ToolStripMenuItem() = New ToolStripMenuItem(list.Count - 1) {}
For ii As Integer = 0 To list.Count - 1
listt(ii) = list(ii)
Next
Return listt
End Function
#End Region
Private variablelist As New ListView
Private xmldocument As New StringBuilder
Private nodeStarter As String = ""
Private Function addComponentWork(ByVal node As XmlElement, ByVal parent As Object)
Select Case node.Name.ToLower
Case "formsetting"
Dim width As Integer = 400
Dim height As Integer = 300
Dim windowstyle As String = ""
Dim buttonleft As Integer = 0
Dim buttontop As Integer = 0
Dim buttonwidth As Integer = 0
Dim buttonheight As Integer = 0
For Each args As XmlElement In node.ChildNodes
For Each attr As XmlAttribute In args.Attributes
If attr.Name.ToLower = "name" Then
Select Case attr.Value.ToLower
Case "x", "width"
width = Val(args.InnerText)
Case "y", "height"
height = Val(args.InnerText)
Case "title"
Me.Text = args.InnerText.Trim
Me.Label1.Text = args.InnerText.Trim
Case "backcolor"
Try
Me.BackColor = HEXtoColor(args.InnerText.Trim)
Catch ex As Exception
End Try
Case "forecolor"
Try
Me.ForeColor = HEXtoColor(args.InnerText.Trim)
Catch ex As Exception
End Try
Case "mainbackcolor"
Try
Me.mainPanel.BackColor = HEXtoColor(args.InnerText.Trim)
Catch ex As Exception
End Try
Case "mainforecolor"
Try
Me.mainPanel.ForeColor = HEXtoColor(args.InnerText.Trim)
Catch ex As Exception
End Try
Case "windowstyle"
windowstyle = args.InnerText.Trim.ToLower
Case "buttontop"
buttontop = Val(args.InnerText)
Case "buttonleft"
buttonleft = Val(args.InnerText)
Case "buttonwidth"
buttonwidth = Val(args.InnerText)
Case "buttonheight"
buttonheight = Val(args.InnerText)
Case "buttontext"
Me.Button1.Text = args.InnerText.Trim
End Select
End If
Next
Next
If buttonleft > 0 Or buttontop > 0 Then
Me.Button1.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.Button1.Location = New Point(buttonleft, buttontop)
End If
If buttonwidth > 0 And buttonheight > 0 Then
Me.Button1.Size = New Size(buttonwidth, buttonheight)
End If
If windowstyle = "default" Or windowstyle = "" Then
If width < 400 Then
width = 400
End If
If height < 240 Then
height = 240
End If
Me.titlebar.Size = New Size(width, 30)
Me.mainPanel.Size = New Size(width, height)
Me.mainPanel.Refresh()
Me.Size = New Size(width + 2, height + 32)
Me.Refresh()
Else
If windowstyle = "fixedsingle" Then
If width < 400 Then
width = 400
End If
If height < 240 Then
height = 240
End If
Me.titlebar.Visible = False
Me.Panel1.Visible = False
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.mainPanel.Size = New Size(width, height)
Me.mainPanel.Location = New Point(0, 0)
Me.mainPanel.Refresh()
Me.Size = New Size(width + 6, height + 29)
Me.Refresh()
End If
End If
Case "contextmenustrip"
Try
Dim cms As New MenuStrip
cms.BackColor = Color.WhiteSmoke
Dim list As New List(Of ToolStripMenuItem)
Dim i As Integer = 0
For Each node2 As XmlElement In node.ChildNodes
Dim cmsi As New ToolStripMenuItem
If node2.Name.ToLower = "item" Then
For Each attr As XmlAttribute In node2.Attributes
Select Case attr.Name.ToLower
Case "text"
cmsi.Text = attr.Value.Trim
End Select
Next
If node2.HasChildNodes = True Then
cmsi.DropDownItems.AddRange(AddContextMenuItem(node2))
End If
list.Add(cmsi)
End If
i += 1
Next
Dim listt As ToolStripMenuItem() = New ToolStripMenuItem(list.Count - 1) {}
For ii As Integer = 0 To list.Count - 1
listt(ii) = list(ii)
Next
cms.Items.AddRange(listt)
parent.Controls.Add(cms)
Catch ex As Exception
MsgBox(ex.GetBaseException.ToString)
End Try
Case "button"
Dim attr As ControlSetting = SettingReader(node)
Dim comp As New Button
comp.Size = New Size(attr.rwidth, attr.rheight)
comp.Location = New Point(attr.rleft, attr.rtop)
If attr.rbc = Color.Transparent Then
comp.BackColor = SystemColors.Control
Else
comp.BackColor = attr.rbc
End If
comp.FlatStyle = attr.rfs
comp.ForeColor = attr.rfc
comp.Enabled = attr.getEnabled
comp.Text = node.InnerText.Trim
Me.ToolTipText.SetToolTip(comp, attr.tooltiptext)
parent.controls.add(comp)
Case "textbox"
Dim attr As ControlSetting = SettingReader(node)
Dim comp As New TextBox
comp.Size = New Size(attr.rwidth, attr.rheight)
comp.Location = New Point(attr.rleft, attr.rtop)
comp.BorderStyle = attr.getBorderStyle
If attr.rbc = Color.Transparent Then
comp.BackColor = Color.White
Else
comp.BackColor = attr.rbc
End If
comp.ForeColor = attr.rfc
comp.ReadOnly = attr.getEnabled
comp.Text = node.InnerText.Trim
comp.Multiline = attr.getmultiline
Me.ToolTipText.SetToolTip(comp, attr.tooltiptext)
If attr.getmultiline Then
comp.ScrollBars = ScrollBars.Vertical
End If
parent.controls.add(comp)
Case "tabpage"
Try
Dim tabcontrol As New TabControl
Dim left As Integer = 10
Dim top As Integer = 10
Dim width As Integer = 200
Dim height As Integer = 200
tabcontrol.Font = New System.Drawing.Font("맑은 고딕", 9.0!)
For Each attr As XmlAttribute In node.Attributes
Select Case attr.Name.ToLower
Case "left"
left = Val(attr.Value)
Case "top"
top = Val(attr.Value)
Case "width"
width = Val(attr.Value)
Case "height"
height = Val(attr.Value)
Case "text"
tabcontrol.Text = attr.Value.Trim
Case "backcolor", "배경색"
Try
tabcontrol.BackColor = HEXtoColor(attr.Value)
Catch ex As Exception
End Try
Case "forecolor", "전경색"
Try
tabcontrol.ForeColor = HEXtoColor(attr.Value)
Catch ex As Exception
End Try
End Select
Next
Dim i As Integer = 1
For Each tabnode As XmlElement In node.ChildNodes
Select Case tabnode.Name.ToLower
Case "tab"
Dim tabpage As New TabPage
tabpage.BackColor = Color.White
tabpage.ForeColor = Color.Black
tabpage.Text = "TabPage " & i
For Each attr As XmlAttribute In tabnode.Attributes
Select Case attr.Name.ToLower
Case "name"
tabpage.Text = attr.Value.Trim
Case "backcolor"
Try
tabpage.BackColor = HEXtoColor(attr.Value)
Catch ex As Exception
End Try
Case "forecolor"
Try
tabpage.ForeColor = HEXtoColor(attr.Value)
Catch ex As Exception
End Try
End Select
Next
For Each tpnode As XmlElement In tabnode.ChildNodes
addComponentWork(tpnode, tabpage)
Next
tabcontrol.Controls.Add(tabpage)
i += 1
End Select
Next
tabcontrol.Location = New Point(left, top)
tabcontrol.Size = New Size(width, height)
parent.Controls.add(tabcontrol)
Catch ex As Exception
MsgBox(ex.GetBaseException.ToString)
End Try
Case "groupbox"
Try
Dim groupbox As New GroupBox
Dim left As Integer = 10
Dim top As Integer = 10
Dim width As Integer = 120
Dim height As Integer = 30
groupbox.Font = New System.Drawing.Font("맑은 고딕", 9.0!)
For Each attr As XmlAttribute In node.Attributes
Select Case attr.Name.ToLower
Case "left"
left = Val(attr.Value)
Case "top"
top = Val(attr.Value)
Case "width"
width = Val(attr.Value)
Case "height"
height = Val(attr.Value)
Case "text"
groupbox.Text = attr.Value.Trim
Case "backcolor", "배경색"
Try
groupbox.BackColor = HEXtoColor(attr.Value)
Catch ex As Exception
End Try
Case "forecolor", "전경색"
Try
groupbox.ForeColor = HEXtoColor(attr.Value)
Catch ex As Exception
End Try
Case "flatstyle"
Dim v As String = attr.Value.ToLower
If v = "flat" Then
groupbox.FlatStyle = FlatStyle.Flat
ElseIf v = "popup" Then
groupbox.FlatStyle = FlatStyle.Popup
ElseIf v = "standard" Then
groupbox.FlatStyle = FlatStyle.Standard
ElseIf v = "system" Then
groupbox.FlatStyle = FlatStyle.System
End If
End Select
Next
For Each tabnode As XmlElement In node.ChildNodes
addComponentWork(tabnode, groupbox)
Next
groupbox.Location = New Point(left, top)
groupbox.Size = New Size(width, height)
parent.Controls.add(groupbox)
Catch ex As Exception
MsgBox(ex.GetBaseException.ToString)
End Try
Case "checkbox"
NewCheckBox(parent, node)
Case "select"
NewCombobox(parent, node)
Case "label"
NewLabel(parent, node)
Case "img"
NewPicturebox(parent, node)
End Select
Return True
End Function
Public Sub New(ByVal document As String, ByVal url As String)
InitializeComponent()
Try
Dim str As String = document
Dim src As String = url
Dim XML As New XmlDocument
str = ErrorRemove(str)
While (str.IndexOf("<!--") > -1 And str.IndexOf("-->"))
Try
str = str.Replace(readCommand.ParseOuter(str, "<!--", "-->"), "")
Catch ex As Exception
Exit While
End Try
End While
xmldocument.Append(str)
str = USERVAR(str, src)
readedocument = str
XML.LoadXml(str)
Me.titlebar.Width = 300
Me.mainPanel.Width = 300
Me.width = 302
Me.mainPanel.Height = 180
Me.height = 212
Me.Label1.Text = "Selection Procedure"
For Each node As XmlElement In XML.SelectNodes("/Library_Command/Selector/*")
addComponentWork(node, Me.mainPanel)
Next
Me.RichTextBox1.Hide()
Me.Hide()
Catch ex As XmlException
Dim msg As String = ex.Message
Me.RichTextBox1.AppendText("※ 이 실험 계획서에 문제가 있습니다!" & vbCrLf)
Me.RichTextBox1.AppendText(msg.Substring(0, msg.LastIndexOf(".")) & vbCrLf & vbCrLf)
Dim linetmp As String = msg.Substring(msg.LastIndexOf("줄") + 1).Trim
linetmp = linetmp.Substring(0, linetmp.LastIndexOf(","))
Me.RichTextBox1.AppendText(" * 줄 : " & linetmp & vbCrLf)
Dim lentemp As String = msg.Substring(msg.LastIndexOf("위치") + 2).Trim
Me.RichTextBox1.AppendText(" * 위치 : " & lentemp & vbCrLf)
Dim doc As String = Me.xmldocument.ToString
doc.Replace(Chr(13), "")
Dim lines As String() = doc.ToString.Split(Chr(10))
Dim errorline As String = lines(Val(linetmp) - 1)
'MsgBox(errorline.Length)
Me.RichTextBox1.AppendText("문서 :" & vbCrLf & errorline & vbCrLf)
Catch ex As Exception
End Try
End Sub
Private Function ErrorRemove(ByVal xmlDoc As String)
Dim doc As New StringBuilder
xmlDoc = Regex.Replace(xmlDoc, "([=]{1}[\x22]{1})([^\x22]*)([\x22]{1})([^ ]{1})", "$1$2$3 $4", RegexOptions.Multiline)
doc.Append(xmlDoc)
doc.Replace("<<", "<")
doc.Replace(">>", ">")
doc.Replace("utf-8", "UTF-8")
doc.Replace("utf-16", "UTF-16")
doc.Replace("&qot;", """)
Return doc.ToString
End Function
Private Function compressd(ByVal str As String) As String
Dim stb As New StringBuilder
stb.Append(str)
stb.Replace(Chr(10), " ")
stb.Replace(Chr(13), "")
stb.Replace(Chr(9), "")
Return stb.ToString.Trim
End Function
Private Function ReturnNodeValue(ByVal vNode As XmlElement) As String
Dim Front As String = Mid(vNode.InnerXml, 1, 15)
If InStr(Mid(vNode.InnerXml, 1, 15), "<![CDATA[") > 0 Then
Return vNode.InnerText
Else
Dim Pattern As String = "^<!\[CDATA\[(.*)\]\]>$"
Return Regex.Replace(vNode.InnerXml, Pattern, "$1")
End If
End Function
Public document As String = ""
Private manual As New List(Of resultlist)
Private Sub components_calc(ByVal ctrl As Control)
For Each obj As Control In ctrl.Controls
'MsgBox(obj.Name.ToString)
For Each tmp As ListViewItem In Me.variablelist.Items
If obj.Name = tmp.SubItems(1).Text Then
Dim type As String = tmp.SubItems(0).Text
If type = "select" Then
Dim index As Integer = CType(obj, ComboBox).SelectedIndex
Dim value As String = ""
For Each obj2 As Control In ctrl.Controls
If obj2.Name = tmp.SubItems(1).Text & "_list" Then
value = CType(obj2, ListView).Items(index).SubItems(0).Text
End If
Next
'MsgBox(value)
resultDocument = resultDocument.Replace("[$_VAR[" & obj.Name & "]]", value.ToString)
ElseIf type = "checkbox" Then
resultDocument = resultDocument.Replace("[$_VAR[" & obj.Name & "]]", CType(obj, CheckBox).Checked.ToString)
End If
End If
Next
If obj.HasChildren Then
components_calc(obj)
End If
Next
End Sub
Private Structure resultlist
Public type As String
Public name As String
Public value As String
End Structure
Private Sub act()
xmldocument.Replace(readCommand.ParseOuter(xmldocument.ToString, "<Selector", "</Selector>"), "")
resultDocument = xmldocument.ToString
manual.Clear()
components_calc(Me.mainPanel)
End Sub
Public readedocument As String = ""
Public resultDocument As String = ""
Private Sub closebtn_enter(sender As Object, e As EventArgs) Handles closebtn.MouseEnter
closebtn.BackColor = Func.rgb(224, 67, 67)
End Sub
Private Sub closebtn_leave(sender As Object, e As EventArgs) Handles closebtn.MouseLeave
closebtn.BackColor = Func.rgb(199, 80, 80)
End Sub
Private Sub Button1_Click(sender As Control, e As EventArgs) Handles Button1.Click
act()
End Sub
Public dragable As Boolean = True
Dim drag As Boolean
Dim mousex As Integer
Dim mousey As Integer
Private Sub DragStart() Handles Label1.MouseDown, titlebar.MouseDown
If dragable Then
drag = True
mousex = Windows.Forms.Cursor.Position.X - Me.left
mousey = Windows.Forms.Cursor.Position.Y - Me.top
End If
End Sub
Private Sub Dragging() Handles Label1.MouseMove, titlebar.MouseMove
If drag And dragable Then
Me.top = Windows.Forms.Cursor.Position.Y - mousey
Me.left = Windows.Forms.Cursor.Position.X - mousex
End If
End Sub
Private Sub DragStop() Handles Label1.MouseUp, titlebar.MouseUp
drag = False
End Sub
Private Sub closebtn_Click(sender As Object, e As EventArgs) Handles closebtn.Click
If MsgBox("정말로 해당 실험을 중단하시겠습니까?", MsgBoxStyle.Exclamation Or MsgBoxStyle.OkCancel, "경고") = MsgBoxResult.Ok Then
Me.DialogResult = Windows.Forms.DialogResult.Cancel
Me.Close()
End If
End Sub
End Class
|
willowslaboratory/WLABV3
|
library.willowslab.net/Lab-Lib_Shared/Forms/datapackworker.vb
|
Visual Basic
|
mit
| 36,403
|
Option Infer On
Imports System
Imports System.Runtime.InteropServices
Namespace Examples
Friend Class Program
<STAThread>
Shared Sub Main(ByVal args() As String)
Dim application As SolidEdgeFramework.Application = Nothing
Dim partDocument As SolidEdgePart.PartDocument = Nothing
Dim models As SolidEdgePart.Models = Nothing
Dim model As SolidEdgePart.Model = Nothing
Dim body As SolidEdgeGeometry.Body = Nothing
Dim edges As SolidEdgeGeometry.Edges = Nothing
Dim edge As SolidEdgeGeometry.Edge = Nothing
Dim circle As SolidEdgeGeometry.Circle = Nothing
Try
' See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
OleMessageFilter.Register()
' Attempt to connect to a running instance of Solid Edge.
application = DirectCast(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)
partDocument = TryCast(application.ActiveDocument, SolidEdgePart.PartDocument)
If partDocument IsNot Nothing Then
models = partDocument.Models
model = models.Item(1)
body = CType(model.Body, SolidEdgeGeometry.Body)
Dim EdgeType = SolidEdgeGeometry.FeatureTopologyQueryTypeConstants.igQueryAll
edges = CType(body.Edges(EdgeType), SolidEdgeGeometry.Edges)
For i As Integer = 1 To edges.Count
edge = CType(edges.Item(i), SolidEdgeGeometry.Edge)
circle = TryCast(edge.Geometry, SolidEdgeGeometry.Circle)
If circle IsNot Nothing Then
Dim CenterPoint = Array.CreateInstance(GetType(Double), 0)
Dim AxisVector = Array.CreateInstance(GetType(Double), 0)
Dim Radius As Double = Nothing
circle.GetCircleData(CenterPoint, AxisVector, Radius)
End If
Next i
End If
Catch ex As System.Exception
Console.WriteLine(ex)
Finally
OleMessageFilter.Unregister()
End Try
End Sub
End Class
End Namespace
|
SolidEdgeCommunity/docs
|
docfx_project/snippets/SolidEdgeGeometry.Circle.GetCircleData.vb
|
Visual Basic
|
mit
| 2,397
|
Imports System.Data
Partial Class fLVentas_Clientes_Ingles
Inherits vis2formularios.frmReporte
Dim loObjetoReporte As CrystalDecisions.CrystalReports.Engine.ReportDocument
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim loComandoSeleccionar As New StringBuilder()
loComandoSeleccionar.AppendLine(" SELECT Libres_Ventas.Cod_Cli, ")
''loComandoSeleccionar.AppendLine(" Clientes.Nom_Cli, ")
'loComandoSeleccionar.AppendLine(" Clientes.Rif, ")
'loComandoSeleccionar.AppendLine(" Clientes.Nit, ")
'loComandoSeleccionar.AppendLine(" Clientes.Dir_Fis, ")
'loComandoSeleccionar.AppendLine(" Clientes.Telefonos, ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Clientes.Generico = 0 AND CAST (Libres_Ventas.Nom_Cli AS VARCHAR) = '') THEN Clientes.Nom_Cli ELSE ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (CAST (Libres_Ventas.Nom_Cli AS VARCHAR) = '') THEN Clientes.Nom_Cli ELSE Libres_Ventas.Nom_Cli END) END) AS Nom_Cli, ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Clientes.Generico = 0 AND CAST (Libres_Ventas.Nom_Cli AS VARCHAR) = '') THEN Clientes.Rif ELSE ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Libres_Ventas.Rif = '') THEN Clientes.Rif ELSE Libres_Ventas.Rif END) END) AS Rif, ")
loComandoSeleccionar.AppendLine(" Clientes.Nit, ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Clientes.Generico = 0 AND CAST (Libres_Ventas.Nom_Cli AS VARCHAR) = '') THEN SUBSTRING(Clientes.Dir_Fis,1, 200) ELSE ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (SUBSTRING(Libres_Ventas.Dir_Fis,1, 200) = '') THEN SUBSTRING(Clientes.Dir_Fis,1, 200) ELSE SUBSTRING(Libres_Ventas.Dir_Fis,1, 200) END) END) AS Dir_Fis, ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Clientes.Generico = 0 AND CAST (Libres_Ventas.Nom_Cli AS VARCHAR) = '') THEN Clientes.Telefonos ELSE ")
loComandoSeleccionar.AppendLine(" (CASE WHEN (Libres_Ventas.Telefonos = '') THEN Clientes.Telefonos ELSE Libres_Ventas.Telefonos END) END) AS Telefonos, ")
loComandoSeleccionar.AppendLine(" Clientes.Fax, ")
loComandoSeleccionar.AppendLine(" Libres_Ventas.Nom_Cli As Nom_Gen, ")
loComandoSeleccionar.AppendLine(" Libres_Ventas.Rif As Rif_Gen, ")
loComandoSeleccionar.AppendLine(" Libres_Ventas.Nit As Nit_Gen, ")
loComandoSeleccionar.AppendLine(" Libres_Ventas.Documento, ")
loComandoSeleccionar.AppendLine(" Libres_Ventas.Fec_Ini, ")
loComandoSeleccionar.AppendLine(" Libres_Ventas.Fec_Fin, ")
loComandoSeleccionar.AppendLine(" Libres_Ventas.Mon_Bru, ")
loComandoSeleccionar.AppendLine(" Libres_Ventas.Mon_Imp1, ")
loComandoSeleccionar.AppendLine(" Libres_Ventas.Dis_Imp, ")
loComandoSeleccionar.AppendLine(" Libres_Ventas.Mon_Net, ")
loComandoSeleccionar.AppendLine(" Libres_Ventas.Cod_For, ")
loComandoSeleccionar.AppendLine(" SUBSTRING(Formas_Pagos.Nom_For,1,20) AS Nom_For, ")
loComandoSeleccionar.AppendLine(" Libres_Ventas.Cod_Ven, ")
loComandoSeleccionar.AppendLine(" Libres_Ventas.Comentario, ")
loComandoSeleccionar.AppendLine(" Vendedores.Nom_Ven, ")
loComandoSeleccionar.AppendLine(" Renglones_LVentas.Cod_Art, ")
loComandoSeleccionar.AppendLine(" Articulos.Nom_Art, ")
loComandoSeleccionar.AppendLine(" Renglones_LVentas.Renglon, ")
loComandoSeleccionar.AppendLine(" Renglones_LVentas.Can_Art1, ")
loComandoSeleccionar.AppendLine(" Renglones_LVentas.Cod_Uni, ")
loComandoSeleccionar.AppendLine(" Renglones_LVentas.Precio1, ")
loComandoSeleccionar.AppendLine(" Renglones_LVentas.Mon_Net As Neto, ")
loComandoSeleccionar.AppendLine(" Renglones_LVentas.Por_Imp1 As Por_Imp, ")
loComandoSeleccionar.AppendLine(" Renglones_LVentas.Cod_Imp, ")
loComandoSeleccionar.AppendLine(" Renglones_LVentas.Mon_Imp1 As Impuesto ")
loComandoSeleccionar.AppendLine(" FROM Libres_Ventas, ")
loComandoSeleccionar.AppendLine(" Renglones_LVentas, ")
loComandoSeleccionar.AppendLine(" Clientes, ")
loComandoSeleccionar.AppendLine(" Formas_Pagos, ")
loComandoSeleccionar.AppendLine(" Vendedores, ")
loComandoSeleccionar.AppendLine(" Articulos ")
loComandoSeleccionar.AppendLine(" WHERE Libres_Ventas.Documento = Renglones_LVentas.Documento AND ")
loComandoSeleccionar.AppendLine(" Libres_Ventas.Cod_Cli = Clientes.Cod_Cli AND ")
loComandoSeleccionar.AppendLine(" Libres_Ventas.Cod_For = Formas_Pagos.Cod_For AND ")
loComandoSeleccionar.AppendLine(" Libres_Ventas.Cod_Ven = Vendedores.Cod_Ven AND ")
loComandoSeleccionar.AppendLine(" Articulos.Cod_Art = Renglones_LVentas.Cod_Art AND " & cusAplicacion.goFormatos.pcCondicionPrincipal)
Dim loServicios As New cusDatos.goDatos
Dim laDatosReporte As DataSet = loServicios.mObtenerTodosSinEsquema(loComandoSeleccionar.ToString, "curReportes")
'--------------------------------------------------'
' Carga la imagen del logo en cusReportes '
'--------------------------------------------------'
Me.mCargarLogoEmpresa(laDatosReporte.Tables(0), "LogoEmpresa")
Dim lcXml As String = "<impuesto></impuesto>"
Dim lcPorcentajesImpueto As String
Dim loImpuestos As New System.Xml.XmlDocument()
lcPorcentajesImpueto = "("
'Recorre cada renglon de la tabla
For lnNumeroFila As Integer = 0 To laDatosReporte.Tables(0).Rows.Count - 1
lcXml = laDatosReporte.Tables(0).Rows(lnNumeroFila).Item("dis_imp")
If String.IsNullOrEmpty(lcXml.Trim()) Then
Continue For
End If
loImpuestos.LoadXml(lcXml)
'En cada renglón lee el contenido de la distribució de impuestos
For Each loImpuesto As System.Xml.XmlNode In loImpuestos.SelectNodes("impuestos/impuesto")
If lnNumeroFila = laDatosReporte.Tables(0).Rows.Count - 1 Then
lcPorcentajesImpueto = lcPorcentajesImpueto & ", " & CDec(loImpuesto.SelectSingleNode("porcentaje").InnerText) & "%"
End If
Next loImpuesto
Next lnNumeroFila
lcPorcentajesImpueto = lcPorcentajesImpueto & ")"
lcPorcentajesImpueto = lcPorcentajesImpueto.Replace("(,", "(")
loObjetoReporte = cusAplicacion.goFormatos.mCargarInforme("fLVentas_Clientes_Ingles", laDatosReporte)
CType(loObjetoReporte.ReportDefinition.ReportObjects("Text29"), CrystalDecisions.CrystalReports.Engine.TextObject).Text = lcPorcentajesImpueto.ToString
Me.mTraducirReporte(loObjetoReporte)
Me.mFormatearCamposReporte(loObjetoReporte)
Me.crvfLVentas_Clientes_Ingles.ReportSource = loObjetoReporte
Catch loExcepcion As Exception
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Error", _
"No se pudo Completar el Proceso: " & loExcepcion.Message, _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Error, _
"auto", _
"auto")
End Try
End Sub
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
Try
loObjetoReporte.Close()
Catch loExcepcion As Exception
End Try
End Sub
End Class
'-------------------------------------------------------------------------------------------'
' Fin del codigo
'-------------------------------------------------------------------------------------------'
' Douglas Cortez: 06/05/2010: Codigo inicial
'-------------------------------------------------------------------------------------------'
' RAC: 24/03/2011: Se cambio la etiqueta Client por Customer en el archivo rpt.
'-------------------------------------------------------------------------------------------'
|
kodeitsolutions/ef-reports
|
fLVentas_Clientes_Ingles.aspx.vb
|
Visual Basic
|
mit
| 9,039
|
Imports System.Collections.Generic
Imports Grasshopper.Kernel
Imports Rhino.Geometry
Imports Grasshopper.Kernel.Types
Imports Grasshopper.Kernel.Data
Public Class TopologyMeshVertexFilter
Inherits GH_Component
''' <summary>
''' Initializes a new instance of the NakedPolygonVertices class.
''' </summary>
Public Sub New()
MyBase.New("Mesh Topology Vertex Filter", "Mesh Topo Vertex Filter", _
"Filter the vertices of a mesh based on their connectivity", _
"Sandbox", "Topology")
End Sub
''' <summary>
''' Registers all the input parameters for this component.
''' </summary>
Protected Overrides Sub RegisterInputParams(ByVal pManager As GH_Component.GH_InputParamManager)
pManager.AddPointParameter("Vertex list", "V", "Ordered list of points", GH_ParamAccess.list)
pManager.AddIntegerParameter("Vertex-Face structure", "VF", "For each vertex the list of adjacent face indices", GH_ParamAccess.tree)
pManager.AddIntegerParameter("Valency filter", "Val", "Filter vertices with the specified number of adjacent faces", GH_ParamAccess.item, 1)
End Sub
''' <summary>
''' Registers all the output parameters for this component.
''' </summary>
Protected Overrides Sub RegisterOutputParams(ByVal pManager As GH_Component.GH_OutputParamManager)
pManager.AddTextParameter("List of vertex IDs", "I", "List of vertex indices matching the valency criteria", GH_ParamAccess.list)
pManager.AddPointParameter("List of vertices", "P", "List of vertices matching the valency criteria", GH_ParamAccess.tree)
End Sub
''' <summary>
''' This is the method that actually does the work.
''' </summary>
''' <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
Protected Overrides Sub SolveInstance(ByVal DA As IGH_DataAccess)
'1. Declare placeholder variables and assign initial invalid data.
' This way, if the input parameters fail to supply valid data, we know when to abort.
Dim _P As New List(Of GH_Point)
Dim _PF As GH_Structure(Of GH_Integer) = Nothing
Dim _V As Int32 = 0
'2. Retrieve input data.
If (Not DA.GetDataList(0, _P)) Then Return
If (Not DA.GetDataTree(1, _PF)) Then Return
If (Not DA.GetData(2, _V)) Then Return
'3. Abort on invalid inputs.
'3.1. get the number of branches in the trees
If (Not _P.Count > 0) Then Return
If (Not _PF.PathCount > 0) Then Return
If (Not _V > 0) Then Return
'4. Do something useful.
Dim _idList As New List(Of Int32)
For i As Int32 = 0 To _PF.Branches.Count - 1
Dim _branch As List(Of GH_Integer) = _PF.Branches(i)
If _branch.Count = _V Then
_idList.Add(i)
End If
Next
Dim _ptList As New List(Of Point3d)
For Each _id As Int32 In _idList
_ptList.Add(_P.Item(_id).Value)
Next
DA.SetDataList(0, _idList)
DA.SetDataList(1, _ptList)
End Sub
''' <summary>
''' Provides an Icon for every component that will be visible in the User Interface.
''' Icons need to be 24x24 pixels.
''' </summary>
Protected Overrides ReadOnly Property Icon() As System.Drawing.Bitmap
Get
'You can add image files to your project resources and access them like this:
Return My.Resources.TopologyMeshPointFilter
End Get
End Property
''' <summary>
''' Gets the unique ID for this component. Do not change this ID after release.
''' </summary>
Public Overrides ReadOnly Property ComponentGuid() As Guid
Get
Return New Guid("{0d5dea63-930b-4842-92d6-6a81d9ea3fc9}")
End Get
End Property
Public Overrides ReadOnly Property Exposure As Grasshopper.Kernel.GH_Exposure
Get
Return GH_Exposure.quarternary
End Get
End Property
End Class
|
tobesch/Sandbox_Topology
|
Sandbox_Topology/TopologyMeshVertexFilter.vb
|
Visual Basic
|
mit
| 4,037
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class ActorPresets
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.ActorSelection = New System.Windows.Forms.TreeView
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Button1.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Button1.Location = New System.Drawing.Point(195, 447)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(75, 23)
Me.Button1.TabIndex = 0
Me.Button1.Text = "&Close"
Me.Button1.UseVisualStyleBackColor = True
'
'Button2
'
Me.Button2.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Button2.Location = New System.Drawing.Point(33, 447)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(75, 23)
Me.Button2.TabIndex = 1
Me.Button2.Text = "&Apply"
Me.Button2.UseVisualStyleBackColor = True
'
'Button3
'
Me.Button3.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Button3.Location = New System.Drawing.Point(114, 447)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(75, 23)
Me.Button3.TabIndex = 7
Me.Button3.Text = "&Refresh"
Me.Button3.UseVisualStyleBackColor = True
'
'ActorSelection
'
Me.ActorSelection.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.ActorSelection.Location = New System.Drawing.Point(12, 12)
Me.ActorSelection.Name = "ActorSelection"
Me.ActorSelection.Size = New System.Drawing.Size(284, 423)
Me.ActorSelection.TabIndex = 8
'
'ActorPresets
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.CancelButton = Me.Button1
Me.ClientSize = New System.Drawing.Size(308, 482)
Me.Controls.Add(Me.ActorSelection)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "ActorPresets"
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
Me.Text = "Actor Presets"
Me.ResumeLayout(False)
End Sub
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents ActorSelection As System.Windows.Forms.TreeView
End Class
|
iterami/uot
|
Utility of Time/Preset Dialogs/ActorPresets.Designer.vb
|
Visual Basic
|
cc0-1.0
| 4,348
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System
Imports System.Collections.Generic
Imports System.Collections.Immutable
Imports System.Diagnostics
Imports System.Linq
Imports System.Text
Imports Microsoft.Cci
Imports Microsoft.CodeAnalysis.RuntimeMembers
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Emit
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Friend MustInherit Class MethodToClassRewriter(Of TProxy)
Inherits BoundTreeRewriter
Private Function SubstituteMethodForMyBaseOrMyClassCall(receiverOpt As BoundExpression, originalMethodBeingCalled As MethodSymbol) As MethodSymbol
If (originalMethodBeingCalled.IsMetadataVirtual OrElse Me.IsInExpressionLambda) AndAlso
receiverOpt IsNot Nothing AndAlso (receiverOpt.Kind = BoundKind.MyBaseReference OrElse receiverOpt.Kind = BoundKind.MyClassReference) Then
' NOTE: We can only call a virtual method non-virtually if the type of Me reference
' we pass to this method IS or INHERITS FROM the type of the method we want to call;
'
' Thus, for MyBase/MyClass receivers we MAY need to replace
' the method with a wrapper one to be able to call it non-virtually;
'
Dim callingMethodType As TypeSymbol = Me.CurrentMethod.ContainingType
Dim topLevelMethodType As TypeSymbol = Me.TopLevelMethod.ContainingType
If callingMethodType IsNot topLevelMethodType OrElse Me.IsInExpressionLambda Then
Dim newMethod = GetOrCreateMyBaseOrMyClassWrapperFunction(receiverOpt, originalMethodBeingCalled)
' substitute type parameters if needed
If newMethod.IsGenericMethod Then
Debug.Assert(originalMethodBeingCalled.IsGenericMethod)
Dim typeArgs = originalMethodBeingCalled.TypeArguments
Debug.Assert(typeArgs.Length = newMethod.Arity)
Dim visitedTypeArgs(typeArgs.Length - 1) As TypeSymbol
For i = 0 To typeArgs.Length - 1
visitedTypeArgs(i) = VisitType(typeArgs(i))
Next
newMethod = newMethod.Construct(visitedTypeArgs.AsImmutableOrNull())
End If
Return newMethod
End If
End If
Return originalMethodBeingCalled
End Function
Private Function GetOrCreateMyBaseOrMyClassWrapperFunction(receiver As BoundExpression, method As MethodSymbol) As MethodSymbol
Debug.Assert(receiver IsNot Nothing)
Debug.Assert(receiver.IsMyClassReference() OrElse receiver.IsMyBaseReference())
Debug.Assert(method IsNot Nothing)
method = method.ConstructedFrom()
Dim methodWrapper As MethodSymbol = CompilationState.GetMethodWrapper(method)
If methodWrapper IsNot Nothing Then
Return methodWrapper
End If
' Disregarding what was passed as the receiver, we only need to create one wrapper
' method for a method _symbol_ being called. Thus, if topLevelMethod.ContainingType
' overrides the virtual method M1, 'MyClass.M1' will use a wrapper method for
' topLevelMethod.ContainingType.M1 method symbol and 'MyBase.M1' will use
' a wrapper method for topLevelMethod.ContainingType.BaseType.M1 method symbol.
' In case topLevelMethod.ContainingType DOES NOT override M1, both 'MyClass.M1' and
' 'MyBase.M1' will use a wrapper method for topLevelMethod.ContainingType.BaseType.M1.
Dim containingType As NamedTypeSymbol = Me.TopLevelMethod.ContainingType
Dim methodContainingType As NamedTypeSymbol = method.ContainingType
Dim isMyBase As Boolean = Not methodContainingType.Equals(containingType)
Debug.Assert(isMyBase OrElse receiver.Kind = BoundKind.MyClassReference)
Dim syntax As VisualBasicSyntaxNode = Me.CurrentMethod.Syntax
' generate and register wrapper method
Dim wrapperMethodName As String = GeneratedNames.MakeBaseMethodWrapperName(method.Name, isMyBase)
Dim wrapperMethod As New SynthesizedWrapperMethod(DirectCast(containingType, InstanceTypeSymbol), method, wrapperMethodName, syntax)
' register a new method
If Me.CompilationState.ModuleBuilderOpt IsNot Nothing Then
Me.CompilationState.ModuleBuilderOpt.AddSynthesizedDefinition(containingType, wrapperMethod)
End If
' generate method body
Dim wrappedMethod As MethodSymbol = wrapperMethod.WrappedMethod
Debug.Assert(wrappedMethod.ConstructedFrom() Is method)
Dim boundArguments(wrapperMethod.ParameterCount - 1) As BoundExpression
For argIndex = 0 To wrapperMethod.ParameterCount - 1
Dim parameterSymbol As ParameterSymbol = wrapperMethod.Parameters(argIndex)
boundArguments(argIndex) = New BoundParameter(syntax, parameterSymbol, isLValue:=parameterSymbol.IsByRef, type:=parameterSymbol.Type)
Next
Dim meParameter As ParameterSymbol = wrapperMethod.MeParameter
Dim newReceiver As BoundExpression = Nothing
If isMyBase Then
newReceiver = New BoundMyBaseReference(syntax, meParameter.Type)
Else
newReceiver = New BoundMyClassReference(syntax, meParameter.Type)
End If
Dim boundCall As New BoundCall(syntax, wrappedMethod, Nothing, newReceiver,
boundArguments.AsImmutableOrNull, Nothing, wrappedMethod.ReturnType)
Dim boundMethodBody As BoundStatement = If(Not wrappedMethod.ReturnType.IsVoidType(),
DirectCast(New BoundReturnStatement(syntax, boundCall, Nothing, Nothing), BoundStatement),
New BoundBlock(syntax, Nothing, ImmutableArray(Of LocalSymbol).Empty,
ImmutableArray.Create(Of BoundStatement)(
New BoundExpressionStatement(syntax, boundCall),
New BoundReturnStatement(syntax, Nothing, Nothing, Nothing))))
' add to generated method collection and return
CompilationState.AddMethodWrapper(method, wrapperMethod, boundMethodBody)
Return wrapperMethod
End Function
''' <summary>
''' A method that wraps the call to a method through MyBase/MyClass receiver.
''' </summary>
''' <remarks>
''' <example>
''' Class A
''' Protected Overridable Sub F(a As Integer)
''' End Sub
''' End Class
'''
''' Class B
''' Inherits A
'''
''' Public Sub M()
''' Dim b As Integer = 1
''' Dim f As System.Action = Sub() MyBase.F(b)
''' End Sub
''' End Class
''' </example>
''' </remarks>
Friend NotInheritable Class SynthesizedWrapperMethod
Inherits SynthesizedMethod
Private ReadOnly _wrappedMethod As MethodSymbol
Private ReadOnly _typeMap As TypeSubstitution
Private ReadOnly _typeParameters As ImmutableArray(Of TypeParameterSymbol)
Private ReadOnly _parameters As ImmutableArray(Of ParameterSymbol)
Private ReadOnly _returnType As TypeSymbol
Private ReadOnly _locations As ImmutableArray(Of Location)
''' <summary>
''' Creates a symbol for a method that wraps the call to a method through MyBase/MyClass receiver.
''' </summary>
''' <param name="containingType">Type that contains wrapper method.</param>
''' <param name="methodToWrap">Method to wrap</param>
''' <param name="wrapperName">Wrapper method name</param>
''' <param name="syntax">Syntax node.</param>
Friend Sub New(containingType As InstanceTypeSymbol,
methodToWrap As MethodSymbol,
wrapperName As String,
syntax As VisualBasicSyntaxNode)
MyBase.New(syntax, containingType, wrapperName, False)
Me._locations = ImmutableArray.Create(Of Location)(syntax.GetLocation())
Me._typeMap = Nothing
If Not methodToWrap.IsGenericMethod Then
Me._typeParameters = ImmutableArray(Of TypeParameterSymbol).Empty
Me._wrappedMethod = methodToWrap
Else
Me._typeParameters = SynthesizedClonedTypeParameterSymbol.MakeTypeParameters(methodToWrap.OriginalDefinition.TypeParameters, Me, CreateTypeParameter)
Dim typeArgs(Me._typeParameters.Length - 1) As TypeSymbol
For ind = 0 To Me._typeParameters.Length - 1
typeArgs(ind) = Me._typeParameters(ind)
Next
Dim newConstructedWrappedMethod As MethodSymbol = methodToWrap.Construct(typeArgs.AsImmutableOrNull())
Me._typeMap = TypeSubstitution.Create(newConstructedWrappedMethod.OriginalDefinition,
newConstructedWrappedMethod.OriginalDefinition.TypeParameters,
typeArgs.AsImmutableOrNull())
Me._wrappedMethod = newConstructedWrappedMethod
End If
Dim params(Me._wrappedMethod.ParameterCount - 1) As ParameterSymbol
For i = 0 To params.Length - 1
Dim curParam = Me._wrappedMethod.Parameters(i)
params(i) = SynthesizedMethod.WithNewContainerAndType(Me, curParam.Type.InternalSubstituteTypeParameters(Me._typeMap), curParam)
Next
Me._parameters = params.AsImmutableOrNull()
Me._returnType = Me._wrappedMethod.ReturnType.InternalSubstituteTypeParameters(Me._typeMap)
End Sub
Friend Overrides ReadOnly Property TypeMap As TypeSubstitution
Get
Return Me._typeMap
End Get
End Property
Friend Overrides Sub AddSynthesizedAttributes(compilationState as ModuleCompilationState, ByRef attributes As ArrayBuilder(Of SynthesizedAttributeData))
MyBase.AddSynthesizedAttributes(compilationState, attributes)
Dim compilation = Me.DeclaringCompilation
AddSynthesizedAttribute(attributes, compilation.TrySynthesizeAttribute(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor))
' Dev11 emits DebuggerNonUserCode. We emit DebuggerHidden to hide the method even if JustMyCode is off.
AddSynthesizedAttribute(attributes, compilation.SynthesizeDebuggerHiddenAttribute())
End Sub
Public ReadOnly Property WrappedMethod As MethodSymbol
Get
Return Me._wrappedMethod
End Get
End Property
Public Overrides ReadOnly Property TypeParameters As ImmutableArray(Of TypeParameterSymbol)
Get
Return _typeParameters
End Get
End Property
Public Overrides ReadOnly Property TypeArguments As ImmutableArray(Of TypeSymbol)
Get
' This is always a method definition, so the type arguments are the same as the type parameters.
If Arity > 0 Then
Return StaticCast(Of TypeSymbol).From(Me.TypeParameters)
Else
Return ImmutableArray(Of TypeSymbol).Empty
End If
End Get
End Property
Public Overrides ReadOnly Property Locations As ImmutableArray(Of Location)
Get
Return _locations
End Get
End Property
Public Overrides ReadOnly Property Parameters As ImmutableArray(Of ParameterSymbol)
Get
Return _parameters
End Get
End Property
Public Overrides ReadOnly Property ReturnType As TypeSymbol
Get
Return _returnType
End Get
End Property
Public Overrides ReadOnly Property IsShared As Boolean
Get
Return False
End Get
End Property
Public Overrides ReadOnly Property IsSub As Boolean
Get
Return Me._wrappedMethod.IsSub
End Get
End Property
Public Overrides ReadOnly Property IsVararg As Boolean
Get
Return Me._wrappedMethod.IsVararg
End Get
End Property
Public Overrides ReadOnly Property Arity As Integer
Get
Return _typeParameters.Length
End Get
End Property
Public Overrides ReadOnly Property DeclaredAccessibility As Accessibility
Get
Return Accessibility.Private
End Get
End Property
Friend Overrides ReadOnly Property ParameterCount As Integer
Get
Return Me._parameters.Length
End Get
End Property
Friend Overrides ReadOnly Property HasSpecialName As Boolean
Get
Return False
End Get
End Property
Friend Overrides Function IsMetadataNewSlot(Optional ignoreInterfaceImplementationChanges As Boolean = False) As Boolean
Return False
End Function
Friend Overrides ReadOnly Property GenerateDebugInfoImpl As Boolean
Get
Return False
End Get
End Property
Friend Overrides Function CalculateLocalSyntaxOffset(localPosition As Integer, localTree As SyntaxTree) As Integer
Throw ExceptionUtilities.Unreachable
End Function
End Class
End Class
End Namespace
|
tang7526/roslyn
|
src/Compilers/VisualBasic/Portable/Lowering/MethodToClassRewriter/MethodToClassRewriter.MyBaseMyClassWrapper.vb
|
Visual Basic
|
apache-2.0
| 15,104
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("ForceCapture.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set(ByVal value As Global.System.Globalization.CultureInfo)
resourceCulture = value
End Set
End Property
End Module
End Namespace
|
Cayan-LLC/developer-docs
|
examples/merchantware/Credit/vb/ForceCapture/ForceCapture/My Project/Resources.Designer.vb
|
Visual Basic
|
apache-2.0
| 2,717
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Composition
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.SimplifyInterpolation
Namespace Microsoft.CodeAnalysis.VisualBasic.SimplifyInterpolation
<ExportCodeFixProvider(LanguageNames.VisualBasic), [Shared]>
Friend Class VisualBasicSimplifyInterpolationCodeFixProvider
Inherits AbstractSimplifyInterpolationCodeFixProvider(Of
InterpolationSyntax, ExpressionSyntax, InterpolationAlignmentClauseSyntax,
InterpolationFormatClauseSyntax, InterpolatedStringExpressionSyntax)
Protected Overrides Function WithExpression(interpolation As InterpolationSyntax, expression As ExpressionSyntax) As InterpolationSyntax
Return interpolation.WithExpression(expression)
End Function
Protected Overrides Function WithAlignmentClause(interpolation As InterpolationSyntax, alignmentClause As InterpolationAlignmentClauseSyntax) As InterpolationSyntax
Return interpolation.WithAlignmentClause(alignmentClause)
End Function
Protected Overrides Function WithFormatClause(interpolation As InterpolationSyntax, formatClause As InterpolationFormatClauseSyntax) As InterpolationSyntax
Return interpolation.WithFormatClause(formatClause)
End Function
Protected Overrides Function Escape(interpolatedString As InterpolatedStringExpressionSyntax, formatString As String) As String
Return formatString.Replace("""", """""")
End Function
End Class
End Namespace
|
abock/roslyn
|
src/Features/VisualBasic/Portable/SimplifyInterpolation/VisualBasicSimplifyInterpolationCodeFixProvider.vb
|
Visual Basic
|
mit
| 1,788
|
Public NotInheritable Class AboutBoxApp
Private Sub AboutBoxApp_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Set the title of the form.
Dim ApplicationTitle As String
If My.Application.Info.Title <> "" Then
ApplicationTitle = My.Application.Info.Title
Else
ApplicationTitle = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName)
End If
Dim description As String = "This project demonstrates a practical application of knowledge gained in programming using Visual Basic during the course"
description += " including the basics of OOP, in particular encapsulation and inheritance."
description += " The application is designed to help a small business to manage their customer records. "
description += "The following features are present: adding, editing and deleting records; sorting records by different parameters; "
description += "displaying records for certain time periods; printing sales reports for chosen time period; "
description += "generating and printing invoices to customers"
Me.Text = String.Format("About {0}", ApplicationTitle + " Customer Registry")
' Initialize all of the text displayed on the About Box.
' TODO: Customize the application's assembly information in the "Application" pane of the project
' properties dialog (under the "Project" menu).
Me.LabelProductName.Text = My.Application.Info.ProductName + " Customer Registry"
Me.LabelVersion.Text = String.Format("Version {0}", My.Application.Info.Version.ToString)
Me.LabelCopyright.Text = My.Application.Info.Copyright + " by Evgeniya O'Regan Pevchikh"
Me.LabelCompanyName.Text = My.Application.Info.CompanyName
Me.TextBoxDescription.Text = My.Application.Info.Description + description
End Sub
Private Sub OKButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OKButton.Click
Me.Close()
End Sub
End Class
|
eorp/SalesRegistryVB
|
Project/AboutBoxApp.vb
|
Visual Basic
|
mit
| 2,106
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.Editor.Implementation.Interactive
Imports Microsoft.CodeAnalysis.Editor.UnitTests
Imports Microsoft.CodeAnalysis.Editor.UnitTests.ChangeSignature
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Extensions
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.Editor.VisualBasic.ChangeSignature
Imports Microsoft.VisualStudio.Text.Editor.Commanding.Commands
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.ChangeSignature
Partial Public Class ChangeSignatureTests
Inherits AbstractChangeSignatureTests
<WpfFact, Trait(Traits.Feature, Traits.Features.ChangeSignature)>
Public Async Function TestRemoveParameters1() As Task
Dim markup = <Text><![CDATA[
Module Program
''' <summary>
''' See <see cref="M(String, Integer, String, Boolean, Integer, String)"/>
''' </summary>
''' <param name="o">o!</param>
''' <param name="a">a!</param>
''' <param name="b">b!</param>
''' <param name="c">c!</param>
''' <param name="x">x!</param>
''' <param name="y">y!</param>
<System.Runtime.CompilerServices.Extension>
Sub $$M(ByVal o As String, a As Integer, b As String, c As Boolean, Optional x As Integer = 0, Optional y As String = "Zero")
Dim t = "Test"
M(t, 1, "Two", True, 3, "Four")
t.M(1, "Two", True, 3, "Four")
M(t, 1, "Two", True, 3)
M(t, 1, "Two", True)
M(t, 1, "Two", True, 3, y:="Four")
M(t, 1, "Two", c:=True)
M(t, 1, "Two", True, y:="Four")
M(t, 1, "Two", True, x:=3)
M(t, 1, "Two", True, y:="Four", x:=3)
M(t, 1, y:="Four", x:=3, b:="Two", c:=True)
M(t, y:="Four", x:=3, c:=True, b:="Two", a:=1)
M(y:="Four", x:=3, c:=True, b:="Two", a:=1, o:=t)
End Sub
End Module
]]></Text>.NormalizedValue()
Dim permutation = {0, 3, 1, 5}
Dim updatedCode = <Text><![CDATA[
Module Program
''' <summary>
''' See <see cref="M(String, Boolean, Integer, String)"/>
''' </summary>
''' <param name="o">o!</param>
''' <param name="c">c!</param>
''' <param name="a">a!</param>
''' <param name="y">y!</param>
'''
'''
<System.Runtime.CompilerServices.Extension>
Sub M(ByVal o As String, c As Boolean, a As Integer, Optional y As String = "Zero")
Dim t = "Test"
M(t, True, 1, "Four")
t.M(True, 1, "Four")
M(t, True, 1)
M(t, True, 1)
M(t, True, 1, y:="Four")
M(t, c:=True, a:=1)
M(t, True, 1, y:="Four")
M(t, True, 1)
M(t, True, 1, y:="Four")
M(t, a:=1, y:="Four", c:=True)
M(t, y:="Four", c:=True, a:=1)
M(y:="Four", c:=True, a:=1, o:=t)
End Sub
End Module
]]></Text>.NormalizedValue()
Await TestChangeSignatureViaCommandAsync(LanguageNames.VisualBasic, markup, updatedSignature:=permutation, expectedUpdatedInvocationDocumentCode:=updatedCode)
End Function
<WpfFact>
<Trait(Traits.Feature, Traits.Features.ChangeSignature)>
<Trait(Traits.Feature, Traits.Features.Interactive)>
Public Sub TestChangeSignatureCommandDisabledInSubmission()
Dim exportProvider = ExportProviderCache _
.GetOrCreateExportProviderFactory(TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithParts(GetType(InteractiveTextBufferSupportsFeatureService))) _
.CreateExportProvider()
Using workspace = TestWorkspace.Create(
<Workspace>
<Submission Language="Visual Basic" CommonReferences="true">
Class C
Sub M$$(x As Integer)
End Sub
End Class
</Submission>
</Workspace>,
workspaceKind:=WorkspaceKind.Interactive,
exportProvider:=exportProvider)
' Force initialization.
workspace.GetOpenDocumentIds().Select(Function(id) workspace.GetTestDocument(id).GetTextView()).ToList()
Dim textView = workspace.Documents.Single().GetTextView()
Dim handler = New VisualBasicChangeSignatureCommandHandler()
Dim state = handler.GetCommandState(New ReorderParametersCommandArgs(textView, textView.TextBuffer))
Assert.True(state.IsUnspecified)
state = handler.GetCommandState(New RemoveParametersCommandArgs(textView, textView.TextBuffer))
Assert.True(state.IsUnspecified)
End Using
End Sub
End Class
End Namespace
|
MichalStrehovsky/roslyn
|
src/EditorFeatures/VisualBasicTest/ChangeSignature/RemoveParametersTests.vb
|
Visual Basic
|
apache-2.0
| 4,869
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Threading.Tasks
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.FindSymbols
Namespace Microsoft.CodeAnalysis.Editor.UnitTests.FindReferences
Partial Public Class FindReferencesTests
<WpfFact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestLinkedFiles_Methods() As Task
Dim definition =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="CSProj1">
<Document FilePath="C.cs"><![CDATA[
class C
{
void $$M()
{
}
}]]>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSProj2">
<Document IsLinkFile="true" LinkAssemblyName="CSProj1" LinkFilePath="C.cs"/>
</Project>
</Workspace>
Using workspace = TestWorkspace.Create(definition)
Dim invocationDocument = workspace.Documents.Single(Function(d) Not d.IsLinkFile)
Dim invocationPosition = invocationDocument.CursorPosition.Value
Dim document = workspace.CurrentSolution.GetDocument(invocationDocument.Id)
Assert.NotNull(document)
Dim symbol = Await SymbolFinder.FindSymbolAtPositionAsync(document, invocationPosition)
Dim references = Await SymbolFinder.FindReferencesAsync(symbol, document.Project.Solution, progress:=Nothing, documents:=Nothing)
Assert.Equal(2, references.Count())
Assert.Equal("C.M()", references.ElementAt(0).Definition.ToString())
Assert.Equal("C.M()", references.ElementAt(1).Definition.ToString())
AssertEx.SetEqual(references.Select(Function(r) r.Definition.ContainingAssembly.Name), {"CSProj1", "CSProj2"})
End Using
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestLinkedFiles_ClassWithSameSpanAsCompilationUnit() As Task
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true" AssemblyName="VBProj1">
<Document FilePath="C.vb"><![CDATA[
Class $$C
End Class
]]>
</Document>
</Project>
<Project Language="Visual Basic" CommonReferences="true" AssemblyName="VBProj2">
<Document IsLinkFile="true" LinkAssemblyName="VBProj1" LinkFilePath="C.vb"/>
</Project>
</Workspace>
Using workspace = TestWorkspace.Create(definition)
Dim invocationDocument = workspace.Documents.Single(Function(d) Not d.IsLinkFile)
Dim invocationPosition = invocationDocument.CursorPosition.Value
Dim document = workspace.CurrentSolution.GetDocument(invocationDocument.Id)
Assert.NotNull(document)
Dim symbol = Await SymbolFinder.FindSymbolAtPositionAsync(document, invocationPosition)
Dim references = Await SymbolFinder.FindReferencesAsync(symbol, document.Project.Solution, progress:=Nothing, documents:=Nothing)
references = references.Where(Function(r) r.Definition.IsKind(SymbolKind.NamedType))
Assert.Equal(2, references.Count())
Assert.Equal("C", references.ElementAt(0).Definition.ToString())
Assert.Equal("C", references.ElementAt(1).Definition.ToString())
AssertEx.SetEqual(references.Select(Function(r) r.Definition.ContainingAssembly.Name), {"VBProj1", "VBProj2"})
End Using
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestLinkedFiles_ReferencesBeforeAndAfterRemovingLinkedDocument() As Task
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true" AssemblyName="VBProj1">
<Document FilePath="C.vb"><![CDATA[
Imports System
Class $$C
End Class
]]>
</Document>
</Project>
<Project Language="Visual Basic" CommonReferences="true" AssemblyName="VBProj2">
<Document IsLinkFile="true" LinkAssemblyName="VBProj1" LinkFilePath="C.vb"/>
</Project>
</Workspace>
Using workspace = TestWorkspace.Create(definition)
Dim invocationDocument = workspace.Documents.Single(Function(d) Not d.IsLinkFile)
Dim invocationPosition = invocationDocument.CursorPosition.Value
Dim linkedDocument = workspace.Documents.Single(Function(d) d.IsLinkFile)
Dim startingSolution = workspace.CurrentSolution
Dim updatedSolution = startingSolution.RemoveDocument(linkedDocument.Id)
' Original solution should still have a correct snapshot of the linked file state
Dim document = startingSolution.GetDocument(invocationDocument.Id)
Assert.NotNull(document)
Dim symbol = Await SymbolFinder.FindSymbolAtPositionAsync(document, invocationPosition)
Dim references = Await SymbolFinder.FindReferencesAsync(symbol, document.Project.Solution, progress:=Nothing, documents:=Nothing)
references = references.Where(Function(r) r.Definition.IsKind(SymbolKind.NamedType))
Assert.Equal(2, references.Count())
Assert.Equal("C", references.ElementAt(0).Definition.ToString())
Assert.Equal("C", references.ElementAt(1).Definition.ToString())
AssertEx.SetEqual(references.Select(Function(r) r.Definition.ContainingAssembly.Name), {"VBProj1", "VBProj2"})
' The updated solution should reflect the removal of the linked document
document = updatedSolution.GetDocument(invocationDocument.Id)
Assert.NotNull(document)
symbol = Await SymbolFinder.FindSymbolAtPositionAsync(document, invocationPosition)
references = Await SymbolFinder.FindReferencesAsync(symbol, document.Project.Solution, progress:=Nothing, documents:=Nothing)
references = references.Where(Function(r) r.Definition.IsKind(SymbolKind.NamedType))
Assert.Equal(1, references.Count())
Assert.Equal("C", references.ElementAt(0).Definition.ToString())
AssertEx.SetEqual(references.Select(Function(r) r.Definition.ContainingAssembly.Name), {"VBProj1"})
End Using
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Function TestLinkedFiles_LinkedFilesWithSameAssemblyNameNoReferences() As Task
Dim definition =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="LinkedProj" Name="CSProj.1">
<Document FilePath="C.cs"><![CDATA[
class {|Definition:$$C|}
{
}
]]>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="LinkedProj" Name="CSProj.2">
<Document IsLinkFile="true" LinkProjectName="CSProj.1" LinkFilePath="C.cs"/>
</Project>
</Workspace>
Return TestAPIAndFeature(definition)
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Function TestLinkedFiles_LinkedFilesWithSameAssemblyNameWithReferences() As Task
Dim definition =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="LinkedProj" Name="CSProj.1">
<Document FilePath="C.cs"><![CDATA[
public class {|Definition:$$C|}
{
}
]]>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="LinkedProj" Name="CSProj.2">
<Document IsLinkFile="true" LinkProjectName="CSProj.1" LinkFilePath="C.cs"/>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="ReferencingProject1">
<ProjectReference>CSProj.1</ProjectReference>
<Document FilePath="D.cs"><![CDATA[
public class D : [|$$C|]
{
}]]>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="ReferencingProject2">
<ProjectReference>CSProj.2</ProjectReference>
<Document FilePath="E.cs"><![CDATA[
public class D : [|$$C|]
{
}]]>
</Document>
</Project>
</Workspace>
Return TestAPIAndFeature(definition)
End Function
End Class
End Namespace
|
amcasey/roslyn
|
src/EditorFeatures/Test2/FindReferences/FindReferencesTests.LinkedFiles.vb
|
Visual Basic
|
apache-2.0
| 8,493
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.VisualStudio.Text
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.AutomaticEndConstructCorrection
''' <summary>
''' This is a workaround until Jason checkin actual custom tracking span
''' </summary>
Friend Class LetterOnlyTrackingSpan
Implements ITrackingSpan
' this is not thread safe. it is a workaround anyway.
' mutating underlying tracking span. we will adjust based on its content
Private _trackingSpan As ITrackingSpan
Private _version As ITextVersion
Public Sub New(span As SnapshotSpan)
Contract.ThrowIfNull(span.Snapshot)
Me._trackingSpan = span.Snapshot.CreateTrackingSpan(span.Span, SpanTrackingMode.EdgeInclusive, TrackingFidelityMode.Backward)
End Sub
Public Function GetEndPoint(snapshot As ITextSnapshot) As SnapshotPoint Implements ITrackingSpan.GetEndPoint
AdjustSpan(snapshot)
Return Me._trackingSpan.GetEndPoint(snapshot)
End Function
Public Function GetSpan(snapshot As ITextSnapshot) As SnapshotSpan Implements ITrackingSpan.GetSpan
AdjustSpan(snapshot)
Return Me._trackingSpan.GetSpan(snapshot)
End Function
Public Function GetSpan(version As ITextVersion) As Span Implements ITrackingSpan.GetSpan
Throw New NotSupportedException(VBEditorResources.NotSupported)
End Function
Public Function GetStartPoint(snapshot As ITextSnapshot) As SnapshotPoint Implements ITrackingSpan.GetStartPoint
AdjustSpan(snapshot)
Return Me._trackingSpan.GetStartPoint(snapshot)
End Function
Public Function GetText(snapshot As ITextSnapshot) As String Implements ITrackingSpan.GetText
AdjustSpan(snapshot)
Return Me._trackingSpan.GetText(snapshot)
End Function
Public ReadOnly Property TextBuffer As ITextBuffer Implements ITrackingSpan.TextBuffer
Get
Return Me._trackingSpan.TextBuffer
End Get
End Property
Public ReadOnly Property TrackingFidelity As TrackingFidelityMode Implements ITrackingSpan.TrackingFidelity
Get
Return TrackingFidelityMode.Backward
End Get
End Property
Public ReadOnly Property TrackingMode As SpanTrackingMode Implements ITrackingSpan.TrackingMode
Get
Return SpanTrackingMode.Custom
End Get
End Property
Private Sub GetNextWordIndex(text As String, startIndex As Integer, ByRef firstLetterIndex As Integer, ByRef lastLetterIndex As Integer)
firstLetterIndex = -1
lastLetterIndex = -1
For i = startIndex To 0 Step -1
If lastLetterIndex < 0 AndAlso Char.IsLetter(text(i)) Then
lastLetterIndex = i
End If
If Char.IsLetter(text(i)) Then
firstLetterIndex = i
End If
If lastLetterIndex >= 0 AndAlso Not Char.IsLetter(text(i)) Then
Exit For
End If
Next
End Sub
Private Function SameAsOriginal(span As SnapshotSpan, firstLetterIndex As Integer, lastLetterIndex As Integer) As Boolean
Return firstLetterIndex = 0 AndAlso span.Length - 1 = lastLetterIndex
End Function
Private Sub AdjustSpanForErrorCase(span As SnapshotSpan, text As String)
Dim snapshot = span.Snapshot
Dim trimedText = text.Trim()
If trimedText.Length = 0 Then
' all whitespace, make tracking span to stick to end
Me._trackingSpan = snapshot.CreateTrackingSpan(span.End.Position, 0, SpanTrackingMode.EdgeInclusive, TrackingFidelityMode.Backward)
Else
' something like punctuation is there
' make tracking span to stick after the punctuation
Dim position = span.Start.Position + text.IndexOf(trimedText, StringComparison.Ordinal) + trimedText.Length
Me._trackingSpan = snapshot.CreateTrackingSpan(position, 0, SpanTrackingMode.EdgeInclusive, TrackingFidelityMode.Backward)
End If
End Sub
Private Sub SetNewTrackingSpan(span As SnapshotSpan, firstLetterIndex As Integer, length As Integer)
' need to re-adjust
Dim startPosition = span.Start.Position + firstLetterIndex
Me._trackingSpan = span.Snapshot.CreateTrackingSpan(startPosition, length, SpanTrackingMode.EdgeInclusive, TrackingFidelityMode.Backward)
End Sub
Private Sub AdjustSpanWorker(snapshot As ITextSnapshot)
Dim span = Me._trackingSpan.GetSpan(snapshot)
Dim text = span.GetText()
If text.Length = 0 Then
Return
End If
' prefer word at the end
Dim firstLetterIndex = -1
Dim lastLetterIndex = -1
GetNextWordIndex(text, text.Length - 1, firstLetterIndex, lastLetterIndex)
' there are letters in the text. re-adjust tracking span if it is changed
If SameAsOriginal(span, firstLetterIndex, lastLetterIndex) Then
Return
End If
' no letter in the text
If lastLetterIndex < 0 Then
AdjustSpanForErrorCase(span, text)
Return
End If
Dim length = lastLetterIndex - firstLetterIndex + 1
' check whether we found a best one
If AutomaticEndConstructSet.Contains(text.Substring(firstLetterIndex, length)) Then
SetNewTrackingSpan(span, firstLetterIndex, length)
Return
End If
' we found a keyword but it is not something we are interested.
' check whether we have a better choice
While firstLetterIndex > 0
GetNextWordIndex(text, firstLetterIndex - 1, firstLetterIndex, lastLetterIndex)
' couldn't find better choice, leave tracking span as it is
If lastLetterIndex < 0 Then
Return
End If
length = lastLetterIndex - firstLetterIndex + 1
Dim candidate = text.Substring(firstLetterIndex, length)
' found a better one
If AutomaticEndConstructSet.Contains(candidate) Then
SetNewTrackingSpan(span, firstLetterIndex, length)
Return
End If
End While
End Sub
Private Sub AdjustSpan(snapshot As ITextSnapshot)
' we already processed this snapshot and re-adjusted the tracking span
' if needed.
If snapshot.Version.Equals(Me._version) Then
Return
End If
AdjustSpanWorker(snapshot)
Me._version = snapshot.Version
End Sub
End Class
End Namespace
|
furesoft/roslyn
|
src/EditorFeatures/VisualBasic/AutomaticEndConstructCorrection/LetterOnlyTrackingSpan.vb
|
Visual Basic
|
apache-2.0
| 7,197
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Collections.Immutable
Imports System.Threading
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
''' <summary>
''' Class to represent a synthesized attribute
''' </summary>
Friend NotInheritable Class SynthesizedAttributeData
Inherits SourceAttributeData
Friend Sub New(wellKnownMember As MethodSymbol,
arguments As ImmutableArray(Of TypedConstant),
namedArgs As ImmutableArray(Of KeyValuePair(Of String, TypedConstant)))
MyBase.New(Nothing,
wellKnownMember.ContainingType,
wellKnownMember,
arguments,
namedArgs,
isConditionallyOmitted:=False,
hasErrors:=False)
Debug.Assert(wellKnownMember IsNot Nothing AndAlso Not arguments.IsDefault)
End Sub
''' <summary>
''' Synthesizes attribute data for given constructor symbol.
''' If the constructor has UseSiteErrors and the attribute is optional returns Nothing.
''' </summary>
Friend Shared Function Create(
constructorSymbol As MethodSymbol,
constructor As WellKnownMember,
Optional arguments As ImmutableArray(Of TypedConstant) = Nothing,
Optional namedArguments As ImmutableArray(Of KeyValuePair(Of String, TypedConstant)) = Nothing) As SynthesizedAttributeData
' If we reach here, unlikely a VBCore scenario. Will result in ERR_MissingRuntimeHelper diagnostic
If Binder.GetUseSiteInfoForWellKnownTypeMember(constructorSymbol, constructor, False).DiagnosticInfo IsNot Nothing Then
If WellKnownMembers.IsSynthesizedAttributeOptional(constructor) Then
Return Nothing
Else
'UseSiteErrors for member have not been checked before emitting
Throw ExceptionUtilities.Unreachable
End If
Else
If arguments.IsDefault Then
arguments = ImmutableArray(Of TypedConstant).Empty
End If
If namedArguments.IsDefault Then
namedArguments = ImmutableArray(Of KeyValuePair(Of String, TypedConstant)).Empty
End If
Return New SynthesizedAttributeData(constructorSymbol, arguments, namedArguments)
End If
End Function
End Class
End Namespace
|
physhi/roslyn
|
src/Compilers/VisualBasic/Portable/Symbols/SynthesizedSymbols/SynthesizedAttributeData.vb
|
Visual Basic
|
apache-2.0
| 2,871
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.VisualBasic.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.Utilities
Friend Class NameSyntaxComparer
Implements IComparer(Of NameSyntax)
Private ReadOnly _tokenComparer As IComparer(Of SyntaxToken)
Friend typeComparer As TypeSyntaxComparer
Friend Sub New(tokenComparer As IComparer(Of SyntaxToken))
Me._tokenComparer = tokenComparer
End Sub
Public Shared Function Create() As IComparer(Of NameSyntax)
Return Create(TokenComparer.NormalInstance)
End Function
Public Shared Function Create(tokenComparer As IComparer(Of SyntaxToken)) As IComparer(Of NameSyntax)
Dim nameComparer = New NameSyntaxComparer(tokenComparer)
Dim typeComparer = New TypeSyntaxComparer(tokenComparer)
nameComparer.typeComparer = typeComparer
typeComparer.nameComparer = nameComparer
Return nameComparer
End Function
Public Function Compare(x As NameSyntax, y As NameSyntax) As Integer Implements IComparer(Of NameSyntax).Compare
If x Is y Then
Return 0
End If
If x.IsMissing AndAlso y.IsMissing Then
Return 0
End If
If x.IsMissing Then
Return -1
ElseIf y.IsMissing Then
Return 1
End If
' If we have a basic name, then it's simple to compare. Just
' check that token versus whatever the other name has as the
' first token.
If TypeOf x Is IdentifierNameSyntax AndAlso TypeOf y Is IdentifierNameSyntax Then
Return _tokenComparer.Compare(x.GetFirstToken(), y.GetFirstToken())
ElseIf TypeOf x Is GenericNameSyntax AndAlso TypeOf y Is GenericNameSyntax Then
' if both names are generic, then use a specialized routine
' that will check the names *and* the arguments.
Return Compare(DirectCast(x, GenericNameSyntax), DirectCast(y, GenericNameSyntax))
ElseIf TypeOf x Is IdentifierNameSyntax AndAlso TypeOf y Is GenericNameSyntax Then
Dim value = _tokenComparer.Compare(x.GetFirstToken(), y.GetFirstToken())
If (value <> 0) Then
Return value
End If
' Goo goes before Goo(of T)
Return -1
ElseIf TypeOf x Is GenericNameSyntax AndAlso TypeOf y Is IdentifierNameSyntax Then
Dim value = _tokenComparer.Compare(x.GetFirstToken(), y.GetFirstToken())
If (value <> 0) Then
Return value
End If
' Goo(of T) goes after Goo
Return 1
End If
' At this point one or both of the nodes is a dotted name or
' aliased name. Break them apart into individual pieces and
' compare those.
Dim xNameParts = DecomposeNameParts(x)
Dim yNameParts = DecomposeNameParts(y)
For i = 0 To Math.Min(xNameParts.Count, yNameParts.Count) - 1
Dim value = Compare(xNameParts(i), yNameParts(i))
If (value <> 0) Then
Return value
End If
Next
' they matched up to this point. The shorter one should come
' first.
Return xNameParts.Count - yNameParts.Count
End Function
Private Function DecomposeNameParts(name As NameSyntax) As IList(Of NameSyntax)
Dim result = New List(Of NameSyntax)()
DecomposeNameParts(name, result)
Return result
End Function
Private Sub DecomposeNameParts(name As NameSyntax, result As List(Of NameSyntax))
Select Case name.Kind
Case SyntaxKind.QualifiedName
Dim dottedName = DirectCast(name, QualifiedNameSyntax)
result.AddRange(DecomposeNameParts(dottedName.Left))
result.AddRange(DecomposeNameParts(SyntaxFactory.IdentifierName(dottedName.Right.Identifier)))
Return
Case SyntaxKind.IdentifierName,
SyntaxKind.GenericName
result.Add(name)
Case SyntaxKind.GlobalName
Dim globalName = DirectCast(name, GlobalNameSyntax)
result.Add(SyntaxFactory.IdentifierName(SyntaxFactory.Identifier(globalName.GlobalKeyword.ToString())))
End Select
End Sub
Private Function Compare(x As GenericNameSyntax, y As GenericNameSyntax) As Integer
Dim value = Compare(SyntaxFactory.IdentifierName(x.Identifier), SyntaxFactory.IdentifierName(y.Identifier))
If (value <> 0) Then
Return value
End If
' The one with less type params comes first.
value = x.TypeArgumentList.Arguments.Count - y.TypeArgumentList.Arguments.Count
If (value <> 0) Then
Return value
End If
' Same name, same parameter count. Compare each parameter.
For i = 0 To x.TypeArgumentList.Arguments.Count
Dim xArg = x.TypeArgumentList.Arguments(i)
Dim yArg = y.TypeArgumentList.Arguments(i)
value = typeComparer.Compare(xArg, yArg)
If (value <> 0) Then
Return value
End If
Next
Return 0
End Function
End Class
End Namespace
|
OmarTawfik/roslyn
|
src/Workspaces/VisualBasic/Portable/Utilities/NameSyntaxComparer.vb
|
Visual Basic
|
apache-2.0
| 6,101
|
Imports System.Drawing
Imports Rhino.Geometry
Public Class GetBounds
Inherits OwlComponentBase
Sub New()
MyBase.New("Bounds TSet", "Bounds", "Get TensorSet bounds.", SubCategoryTensorSet)
End Sub
Public Overrides ReadOnly Property ComponentGuid As Guid
Get
Return New Guid("{0DE7183A-7482-49AD-9007-68D062A127EA}")
End Get
End Property
Protected Overrides ReadOnly Property Icon As Bitmap
Get
Return My.Resources.icon_39
End Get
End Property
Public Overrides ReadOnly Property Exposure As GH_Exposure
Get
Return GH_Exposure.primary
End Get
End Property
Protected Overrides Sub RegisterInputParams(pManager As GH_InputParamManager)
pManager.AddParameter(New Param_OwlTensorSet)
pManager.AddIntegerParameter("Dimension", "D", "Dimension, -1 for all dimensions", GH_ParamAccess.item, -1)
End Sub
Protected Overrides Sub RegisterOutputParams(pManager As GH_OutputParamManager)
pManager.AddIntervalParameter("Bounds", "B", "Bounds", GH_ParamAccess.item)
End Sub
Protected Overrides Sub SolveInstance(DA As IGH_DataAccess)
Dim ts As New GH_OwlTensorSet
Dim d As Integer
If Not DA.GetData(0, ts) Then Return
If Not DA.GetData(1, d) Then Return
Dim rng As Range = If(d = -1, ts.Value.GetRange, ts.Value.GetRange(d))
DA.SetData(0, New Interval(rng.From, rng.To))
End Sub
End Class
|
mateuszzwierzycki/Owl
|
Owl.GH/Components/Owl/TensorSet/GetBounds.vb
|
Visual Basic
|
mit
| 1,510
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.269
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.GrafoveAlgoritmy.My.MySettings
Get
Return Global.GrafoveAlgoritmy.My.MySettings.Default
End Get
End Property
End Module
End Namespace
|
jakubjenis/lecture.net
|
Vb.Net/Skolenie2/GrafoveAlgoritmy/My Project/Settings.Designer.vb
|
Visual Basic
|
mit
| 2,936
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.34209
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")>
Friend ReadOnly Property Settings() As Global.P2P.OMSAdministration.Visualizations.My.MySettings
Get
Return Global.P2P.OMSAdministration.Visualizations.My.MySettings.Default
End Get
End Property
End Module
End Namespace
|
P2P-Nathan/OMS-Administration-Packs
|
OMS Administration Custom Visualizations/My Project/Settings.Designer.vb
|
Visual Basic
|
mit
| 2,951
|
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("ExactOnline.Client.Models")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("Exact Online Client SDK")>
<Assembly: AssemblyCopyright("")>
<Assembly: AssemblyTrademark("")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
RobTillie/exactonline-api-dotnet-client
|
src/ExactOnline.Client.Models/My Project/AssemblyInfo.vb
|
Visual Basic
|
mit
| 987
|
Imports System.Runtime.CompilerServices
Module Extensions
<Extension()>
Public Function IsEmpty(ByVal cell As DataGridViewCell) As Boolean
Return cell.Value Is Nothing OrElse cell.Value Is DBNull.Value OrElse String.IsNullOrWhiteSpace(cell.Value.ToString())
End Function
<Extension()>
Public Function IsNotEmpty(ByVal cell As DataGridViewCell) As Boolean
Return Not (cell.Value Is Nothing OrElse cell.Value Is DBNull.Value OrElse String.IsNullOrWhiteSpace(cell.Value.ToString()))
End Function
End Module
|
RiSearcher/VB.Net-snippets
|
Extensions.vb
|
Visual Basic
|
mit
| 556
|
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.Mail
Partial Class MASTER_Forgot_Password
Inherits System.Web.UI.Page
Dim conn As New SqlConnection(ConfigurationManager.AppSettings("conn"))
Dim acs As New HelperClass
Dim cmd As New SqlCommand
Dim prmUser As New SqlParameter("USERNAME", SqlDbType.VarChar)
Dim str_email As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Private Function check_user(ByVal Username As String) As String
Dim _count As Integer
Dim cmd As New SqlCommand("SELECT COUNT (*) " & _
" FROM admin_maps_user_master" & _
" WHERE Ltrim(Rtrim(User_name)) =UPPER(@USERNAME)", conn)
cmd.Parameters.Add(prmUser)
prmUser.Value = Username
If conn.State = ConnectionState.Closed Then conn.Open()
_count = cmd.ExecuteScalar
cmd.Parameters.Clear()
conn.Close()
Return _count
End Function
Protected Sub btn_frgtpswd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_frgtpswd.Click
Dim msg As String
Dim prmUserId As New SqlParameter("User_ID", SqlDbType.VarChar)
If txt_mid.Text.Trim = "" Then
Tell.text("Please enter your User Name...", Me)
Exit Sub
End If
If check_user(txt_mid.Text.Trim) < 1 Then
Tell.text("Please enter proper username.!!", Me)
txt_mid.Text = ""
Exit Sub
End If
msg = acs.ValidateText(txt_mid.Text.Trim, "User Name", 100)
If msg <> "Y" Then
Tell.text(msg, Me)
txt_mid.Text = ""
Exit Sub
End If
Dim retriveEmail As String = "Select top 1 email_id from admin_maps_user_master where UPPER(Ltrim(Rtrim(User_name))) =UPPER(Ltrim(Rtrim(@User_ID))) "
Dim cmd As New SqlCommand(retriveEmail, conn)
cmd.Parameters.Add(prmUserId)
prmUserId.Value = txt_mid.Text
Dim dr As SqlDataReader
If conn.State = ConnectionState.Closed Then conn.Open()
dr = cmd.ExecuteReader
If dr.HasRows = False Then
Tell.text("No corresponding email found ", Me)
Exit Sub
End If
While (dr.Read)
str_email = dr("EMAIL_ID")
End While
conn.Close()
cmd.Parameters.Clear()
'msg = acs.multiEmail(str_email)
If msg <> "Y" Then
Tell.text(msg, Me)
Exit Sub
End If
If conn.State = ConnectionState.Closed Then conn.Open()
Dim lck As String = "select count(*) from admin_maps_user_master where account_status='LOCKED' and UPPER(user_name)=UPPER(@User_ID)"
cmd.CommandText = lck
cmd.CommandType = CommandType.Text
cmd.Connection = conn
cmd.Parameters.Add(prmUserId)
prmUserId.Value = txt_mid.Text.Trim
Dim cnt0 As String = cmd.ExecuteScalar
cmd.Parameters.Clear()
If cnt0 > 0 Then
Tell.text("Your account is locked. Please contact Catalyst. customer care for unlocking your account", Me)
Exit Sub
End If
Dim str_chk As String = "select count(*) from admin_maps_user_master where user_name=@User_ID "
cmd.CommandText = str_chk
cmd.CommandType = CommandType.Text
cmd.Connection = conn
cmd.Parameters.Add(prmUserId)
prmUserId.Value = txt_mid.Text.Trim
Dim cnt As String = cmd.ExecuteScalar
cmd.Parameters.Clear()
If conn.State = ConnectionState.Open Then conn.Close()
If cnt > 0 Then
If conn.State = ConnectionState.Closed Then conn.Open()
cmd.Parameters.Clear()
Dim Pass As String = PasswordGenerator(8)
Dim prmPswd As New SqlParameter("PWD", SqlDbType.VarChar)
Dim StrUpdate As String = "UPDATE ADMIN_MAPS_USER_MASTER " & _
"SET user_password = @PWD " & _
"WHERE UPPER(user_name) = UPPER(@User_ID) "
Dim cmdUpdate As New SqlCommand(StrUpdate, conn)
cmdUpdate.Parameters.Add(prmUserId)
cmdUpdate.Parameters.Add(prmPswd)
prmPswd.Value = Pass
prmUserId.Value = txt_mid.Text.Trim
cmdUpdate.ExecuteNonQuery()
cmdUpdate.Parameters.Clear()
Dim login_updte As String = "update ADMIN_USER_LOGIN_COUNT SET Changed='N' where UPPER(user_name) = UPPER(@User_ID) "
Dim loginUpdate As New SqlCommand(login_updte, conn)
loginUpdate.Parameters.Add(prmUserId)
prmUserId.Value = txt_mid.Text.Trim
loginUpdate.ExecuteNonQuery()
SendMail(str_email, Pass, txt_mid.Text.Trim)
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "message", "alert('Your password has been sent to your registered email address...');location.href = '../MASTER/index.aspx';", True)
Session.Clear()
Session.Abandon()
Session.RemoveAll()
If Request.Cookies("ASP.NET_SessionId") IsNot Nothing Then
Response.Cookies("ASP.NET_SessionId").Value = String.Empty
Response.Cookies("ASP.NET_SessionId").Expires = DateTime.Now.AddMonths(-20)
End If
Response.Cookies.Clear()
End If
If conn.State = ConnectionState.Open Then conn.Close()
txt_mid.Text = ""
'Server.Transfer("~\master\Index.aspx")
End Sub
Public Function PasswordGenerator(ByVal lngLength As Long) As String
On Error GoTo Err_Proc
Dim iChr As Integer
Dim c As Long
Dim strResult As String = ""
Dim iAsc As String
For c = 1 To lngLength
' Randomly decide what set of ASCII chars we will use
iAsc = Int(3 * Rnd() + 1)
'Randomly pick a char from the random set
Select Case iAsc
Case 1
iChr = Int((Asc("Z") - Asc("A") + 1) * Rnd() + Asc("A"))
Case 2
iChr = Int((Asc("z") - Asc("a") + 1) * Rnd() + Asc("a"))
Case 3
iChr = Int((Asc("9") - Asc("0") + 1) * Rnd() + Asc("0"))
Case Else
Err.Raise(20000, , "PasswordGenerator has a problem.")
End Select
strResult = strResult & Chr(iChr)
Next c
PasswordGenerator = strResult
Exit_Proc:
Exit Function
Err_Proc:
PasswordGenerator = vbNullString
Resume Exit_Proc
End Function
Private Function SendMail(ByVal Emailids As String, ByVal pass As String, ByVal login As String) As String
Dim msg As New MailMessage()
msg.Subject = "User Password Reset Catalyst. Management"
msg.From = "Vcare@insolutionsglobal.com"
msg.To = Emailids
msg.Body = "<b>" & "Dear Merchant," & "</b>" & "<br>" & "<br>"
msg.Body = msg.Body & "Your user password for Catalyst. Management Frontend Login have been Reset as" & "<br>" & "<br>"
msg.Body = msg.Body & "USERNAME: " & login & "<br>"
msg.Body = msg.Body & "PWD: " & pass & "<br>" & "<br>"
msg.Body = msg.Body & " Please access below link to login " & "<br>"
msg.Body = msg.Body & "<U>" & "<h>" & "<href>" & "https://192.168.171.38:443/NPCI_Loyalty/master/index.aspx" & "</h>" & "</href>" & "</U>" & "<br>" & "<br>"
msg.Body = msg.Body & "<b>" & "Thanks & Regards" & "<br>"
msg.Body = msg.Body & "Admin" & "<br>" & "<br>" & "</b>"
msg.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = "192.168.22.22"
SmtpMail.Send(msg)
msg.Attachments.Clear()
Return 0
End Function
Protected Sub Page_Error(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Error
Dim PhyFilePath As String = System.AppDomain.CurrentDomain.BaseDirectory
Dim sUser As String = Session("UserCode")
Dim sLastError As String = Server.GetLastError.Message.ToString
Dim sStackTrace As String = Server.GetLastError.StackTrace.ToString
acs.WriteError(sLastError, "", sUser, PhyFilePath, "Merchant Web Services")
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Server.Transfer(acs.mapLink(Request.Path))
'Response.Redirect(acs.mapLink(Request.Path))
End Sub
End Class
|
prashantkakde31/Catalyst
|
admin/SRC/Catalyst/CatalystClientUI/Master/Forgot_Password.aspx.vb
|
Visual Basic
|
mit
| 8,629
|
Sub WorksheetLoop()
Dim WS_Count As Integer
Dim I As Integer
' Set WS_Count equal to the number of worksheets in the active
' workbook.
WS_Count = ActiveWorkbook.Worksheets.Count
' Begin the loop.
For I = 1 To WS_Count
' Insert your code here.
' The following line shows how to reference a sheet within
' the loop by displaying the worksheet name in a dialog box.
MsgBox ActiveWorkbook.Worksheets(I).Name
Next I
End Sub
|
Jonnokc/Excel_VBA
|
Validation_Form/Other/Loop_Through_Sheets.vb
|
Visual Basic
|
mit
| 494
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.18444
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("HalloVello.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set(ByVal value As Global.System.Globalization.CultureInfo)
resourceCulture = value
End Set
End Property
End Module
End Namespace
|
severinkaderli/gibb
|
Lehrjahr_2/Modul_303/HalloVello/HalloVello/My Project/Resources.Designer.vb
|
Visual Basic
|
mit
| 2,719
|
Imports SistFoncreagro.BussinessEntities
Public Interface ITipoBaseImponibleRepository
Function GetAllFromTIPOBASEIMPONIBLE() As List(Of TipoBaseImponible)
End Interface
|
crackper/SistFoncreagro
|
SistFoncreagro.DataAccess/ITipoBaseImponibleRepository.vb
|
Visual Basic
|
mit
| 182
|
'Copyright 2019 Esri
'Licensed under the Apache License, Version 2.0 (the "License");
'you may not use this file except in compliance with the License.
'You may obtain a copy of the License at
' http://www.apache.org/licenses/LICENSE-2.0
'Unless required by applicable law or agreed to in writing, software
'distributed under the License is distributed on an "AS IS" BASIS,
'WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
'See the License for the specific language governing permissions and
'limitations under the License.
Imports ESRI.ArcGIS.Analyst3D
Imports ESRI.ArcGIS.Controls
Imports ESRI.ArcGIS.ADF.BaseClasses
Imports ESRI.ArcGIS.ADF.CATIDs
Imports System.Runtime.InteropServices
<ComClass(FullExtent.ClassId, FullExtent.InterfaceId, FullExtent.EventsId)> _
Public NotInheritable Class FullExtent
Inherits BaseCommand
#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
Public Const ClassId As String = "6E79535D-C62B-4C4F-8693-F50E56EB4A62"
Public Const InterfaceId As String = "ECCFB42F-DFEF-4DDD-BB5B-6A6C4E7D26CA"
Public Const EventsId As String = "AE70E9E5-EDDA-4DB4-9C4B-069A55B7846D"
#End Region
#Region "COM Registration Function(s)"
<ComRegisterFunction(), ComVisibleAttribute(False)> _
Public Shared Sub RegisterFunction(ByVal registerType As Type)
' Required for ArcGIS Component Category Registrar support
ArcGISCategoryRegistration(registerType)
'Add any COM registration code after the ArcGISCategoryRegistration() call
End Sub
<ComUnregisterFunction(), ComVisibleAttribute(False)> _
Public Shared Sub UnregisterFunction(ByVal registerType As Type)
' Required for ArcGIS Component Category Registrar support
ArcGISCategoryUnregistration(registerType)
'Add any COM unregistration code after the ArcGISCategoryUnregistration() call
End Sub
#Region "ArcGIS Component Category Registrar generated code"
''' <summary>
''' Required method for ArcGIS Component Category registration -
''' Do not modify the contents of this method with the code editor.
''' </summary>
Private Shared Sub ArcGISCategoryRegistration(ByVal registerType As Type)
Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
ControlsCommands.Register(regKey)
End Sub
''' <summary>
''' Required method for ArcGIS Component Category unregistration -
''' Do not modify the contents of this method with the code editor.
''' </summary>
Private Shared Sub ArcGISCategoryUnregistration(ByVal registerType As Type)
Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
ControlsCommands.Unregister(regKey)
End Sub
#End Region
#End Region
Private m_pSceneHookHelper As ISceneHookHelper
' A creatable COM class must have a Public Sub New()
' with no parameters, otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
MyBase.m_category = "Sample_SceneControl(VB.NET)"
MyBase.m_caption = "Full Extent"
MyBase.m_toolTip = "Full Extent"
MyBase.m_name = "Sample_SceneControl(VB.NET)/FullExtent"
MyBase.m_message = "Displays the scene at full extent"
'Load resources
Dim res() As String = GetType(FullExtent).Assembly.GetManifestResourceNames()
If res.GetLength(0) > 0 Then
MyBase.m_bitmap = New System.Drawing.Bitmap(GetType(FullExtent).Assembly.GetManifestResourceStream("SceneToolsVB.fullextent.bmp"))
End If
m_pSceneHookHelper = New SceneHookHelperClass
End Sub
Public Overrides Sub OnCreate(ByVal hook As Object)
m_pSceneHookHelper.Hook = hook
End Sub
Public Overrides ReadOnly Property Enabled() As Boolean
Get
If (m_pSceneHookHelper.Hook Is Nothing Or m_pSceneHookHelper.Scene Is Nothing) Then
Return False
Else
Return True
End If
End Get
End Property
Public Overrides Sub OnClick()
'Get the scene graph
Dim pSceneGraph As ISceneGraph = CType(m_pSceneHookHelper.SceneGraph, ISceneGraph)
'Get the scene viewer's camera
Dim pCamera As ICamera = CType(m_pSceneHookHelper.Camera, ICamera)
'Position the camera to see the full extent of the scene graph
pCamera.SetDefaultsMBB(pSceneGraph.Extent)
'Redraw the scene viewer
pSceneGraph.ActiveViewer.Redraw(True)
End Sub
End Class
|
Esri/arcobjects-sdk-community-samples
|
Net/Controls/ControlsCommandsSceneCommands/VBNet/FullExtent.vb
|
Visual Basic
|
apache-2.0
| 4,778
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.RemoveUnnecessaryCast
Partial Public Class RemoveUnnecessaryCastTests
<Fact>
<Trait(Traits.Feature, Traits.Features.CodeActionsSimplifyTypeNames)>
<Trait(Traits.Feature, Traits.Features.CodeActionsFixAllOccurrences)>
Public Async Function TestFixAllInDocument() As Task
Dim input = <Workspace>
<Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
<Document><![CDATA[
Imports System
Class Program
Private f As Char = CChar("c"C)
Public Sub F(Optional x As Integer = CInt(0))
' unnecessary casts
Dim y As Integer = {|FixAllInDocument:CInt(0)|}
Dim z As Boolean = CBool(True)
' required cast
Dim l As Long = 1
Dim ll = CInt(l)
' required cast after cast removal in same statement
Dim s1 As String = Nothing, s2 As String = Nothing
Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
Dim prog = New Program
Dim x = ((DirectCast(Prog, Program)).F)
Dim x2 = ((DirectCast(Prog, Program)).F)
End Sub
End Class]]>
</Document>
<Document><![CDATA[
Imports System
Class Program2
Private f As Char = CChar("c"C)
Public Sub F(Optional x As Integer = CInt(0))
' unnecessary casts
Dim y As Integer = CInt(0)
Dim z As Boolean = CBool(True)
' required cast
Dim l As Long = 1
Dim ll = CInt(l)
' required cast after cast removal in same statement
Dim s1 As String = Nothing, s2 As String = Nothing
Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
Dim prog = New Program
Dim x = ((DirectCast(Prog, Program)).F)
Dim x2 = ((DirectCast(Prog, Program)).F)
End Sub
End Class]]>
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
<ProjectReference>Assembly1</ProjectReference>
<Document><![CDATA[
Imports System
Class Program3
Private f As Char = CChar("c"C)
Public Sub F(Optional x As Integer = CInt(0))
' unnecessary casts
Dim y As Integer = CInt(0)
Dim z As Boolean = CBool(True)
' required cast
Dim l As Long = 1
Dim ll = CInt(l)
' required cast after cast removal in same statement
Dim s1 As String = Nothing, s2 As String = Nothing
Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
Dim prog = New Program
Dim x = ((DirectCast(Prog, Program)).F)
Dim x2 = ((DirectCast(Prog, Program)).F)
End Sub
End Class]]>
</Document>
</Project>
</Workspace>.ToString()
Dim expected = <Workspace>
<Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
<Document><![CDATA[
Imports System
Class Program
Private f As Char = "c"C
Public Sub F(Optional x As Integer = 0)
' unnecessary casts
Dim y As Integer = 0
Dim z As Boolean = True
' required cast
Dim l As Long = 1
Dim ll = CInt(l)
' required cast after cast removal in same statement
Dim s1 As String = Nothing, s2 As String = Nothing
Dim s3 = CObj(If(z, s1, s2))
Dim prog = New Program
Dim x = ((Prog).F)
Dim x2 = ((Prog).F)
End Sub
End Class]]>
</Document>
<Document><![CDATA[
Imports System
Class Program2
Private f As Char = CChar("c"C)
Public Sub F(Optional x As Integer = CInt(0))
' unnecessary casts
Dim y As Integer = CInt(0)
Dim z As Boolean = CBool(True)
' required cast
Dim l As Long = 1
Dim ll = CInt(l)
' required cast after cast removal in same statement
Dim s1 As String = Nothing, s2 As String = Nothing
Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
Dim prog = New Program
Dim x = ((DirectCast(Prog, Program)).F)
Dim x2 = ((DirectCast(Prog, Program)).F)
End Sub
End Class]]>
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
<ProjectReference>Assembly1</ProjectReference>
<Document><![CDATA[
Imports System
Class Program3
Private f As Char = CChar("c"C)
Public Sub F(Optional x As Integer = CInt(0))
' unnecessary casts
Dim y As Integer = CInt(0)
Dim z As Boolean = CBool(True)
' required cast
Dim l As Long = 1
Dim ll = CInt(l)
' required cast after cast removal in same statement
Dim s1 As String = Nothing, s2 As String = Nothing
Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
Dim prog = New Program
Dim x = ((DirectCast(Prog, Program)).F)
Dim x2 = ((DirectCast(Prog, Program)).F)
End Sub
End Class]]>
</Document>
</Project>
</Workspace>.ToString()
Await TestInRegularAndScriptAsync(input, expected)
End Function
<Fact>
<Trait(Traits.Feature, Traits.Features.CodeActionsSimplifyTypeNames)>
<Trait(Traits.Feature, Traits.Features.CodeActionsFixAllOccurrences)>
Public Async Function TestFixAllInProject() As Task
Dim input = <Workspace>
<Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
<Document><![CDATA[
Imports System
Class Program
Private f As Char = CChar("c"C)
Public Sub F(Optional x As Integer = CInt(0))
' unnecessary casts
Dim y As Integer = {|FixAllInProject:CInt(0)|}
Dim z As Boolean = CBool(True)
' required cast
Dim l As Long = 1
Dim ll = CInt(l)
' required cast after cast removal in same statement
Dim s1 As String = Nothing, s2 As String = Nothing
Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
End Sub
End Class]]>
</Document>
<Document><![CDATA[
Imports System
Class Program2
Private f As Char = CChar("c"C)
Public Sub F(Optional x As Integer = CInt(0))
' unnecessary casts
Dim y As Integer = CInt(0)
Dim z As Boolean = CBool(True)
' required cast
Dim l As Long = 1
Dim ll = CInt(l)
' required cast after cast removal in same statement
Dim s1 As String = Nothing, s2 As String = Nothing
Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
End Sub
End Class]]>
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
<ProjectReference>Assembly1</ProjectReference>
<Document><![CDATA[
Imports System
Class Program3
Private f As Char = CChar("c"C)
Public Sub F(Optional x As Integer = CInt(0))
' unnecessary casts
Dim y As Integer = CInt(0)
Dim z As Boolean = CBool(True)
' required cast
Dim l As Long = 1
Dim ll = CInt(l)
' required cast after cast removal in same statement
Dim s1 As String = Nothing, s2 As String = Nothing
Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
End Sub
End Class]]>
</Document>
</Project>
</Workspace>.ToString()
Dim expected = <Workspace>
<Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
<Document><![CDATA[
Imports System
Class Program
Private f As Char = "c"C
Public Sub F(Optional x As Integer = 0)
' unnecessary casts
Dim y As Integer = 0
Dim z As Boolean = True
' required cast
Dim l As Long = 1
Dim ll = CInt(l)
' required cast after cast removal in same statement
Dim s1 As String = Nothing, s2 As String = Nothing
Dim s3 = CObj(If(z, s1, s2))
End Sub
End Class]]>
</Document>
<Document><![CDATA[
Imports System
Class Program2
Private f As Char = "c"C
Public Sub F(Optional x As Integer = 0)
' unnecessary casts
Dim y As Integer = 0
Dim z As Boolean = True
' required cast
Dim l As Long = 1
Dim ll = CInt(l)
' required cast after cast removal in same statement
Dim s1 As String = Nothing, s2 As String = Nothing
Dim s3 = CObj(If(z, s1, s2))
End Sub
End Class]]>
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
<ProjectReference>Assembly1</ProjectReference>
<Document><![CDATA[
Imports System
Class Program3
Private f As Char = CChar("c"C)
Public Sub F(Optional x As Integer = CInt(0))
' unnecessary casts
Dim y As Integer = CInt(0)
Dim z As Boolean = CBool(True)
' required cast
Dim l As Long = 1
Dim ll = CInt(l)
' required cast after cast removal in same statement
Dim s1 As String = Nothing, s2 As String = Nothing
Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
End Sub
End Class]]>
</Document>
</Project>
</Workspace>.ToString()
Await TestInRegularAndScriptAsync(input, expected)
End Function
<Fact>
<Trait(Traits.Feature, Traits.Features.CodeActionsSimplifyTypeNames)>
<Trait(Traits.Feature, Traits.Features.CodeActionsFixAllOccurrences)>
Public Async Function TestFixAllInSolution() As Task
Dim input = <Workspace>
<Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
<Document><![CDATA[
Imports System
Class Program
Private f As Char = CChar("c"C)
Public Sub F(Optional x As Integer = CInt(0))
' unnecessary casts
Dim y As Integer = {|FixAllInSolution:CInt(0)|}
Dim z As Boolean = CBool(True)
' required cast
Dim l As Long = 1
Dim ll = CInt(l)
' required cast after cast removal in same statement
Dim s1 As String = Nothing, s2 As String = Nothing
Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
End Sub
End Class]]>
</Document>
<Document><![CDATA[
Imports System
Class Program2
Private f As Char = CChar("c"C)
Public Sub F(Optional x As Integer = CInt(0))
' unnecessary casts
Dim y As Integer = CInt(0)
Dim z As Boolean = CBool(True)
' required cast
Dim l As Long = 1
Dim ll = CInt(l)
' required cast after cast removal in same statement
Dim s1 As String = Nothing, s2 As String = Nothing
Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
End Sub
End Class]]>
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
<ProjectReference>Assembly1</ProjectReference>
<Document><![CDATA[
Imports System
Class Program3
Private f As Char = CChar("c"C)
Public Sub F(Optional x As Integer = CInt(0))
' unnecessary casts
Dim y As Integer = CInt(0)
Dim z As Boolean = CBool(True)
' required cast
Dim l As Long = 1
Dim ll = CInt(l)
' required cast after cast removal in same statement
Dim s1 As String = Nothing, s2 As String = Nothing
Dim s3 = If(z, DirectCast(s1, Object), DirectCast(s2, Object))
End Sub
End Class]]>
</Document>
</Project>
</Workspace>.ToString()
Dim expected = <Workspace>
<Project Language="Visual Basic" AssemblyName="Assembly1" CommonReferences="true">
<Document><![CDATA[
Imports System
Class Program
Private f As Char = "c"C
Public Sub F(Optional x As Integer = 0)
' unnecessary casts
Dim y As Integer = 0
Dim z As Boolean = True
' required cast
Dim l As Long = 1
Dim ll = CInt(l)
' required cast after cast removal in same statement
Dim s1 As String = Nothing, s2 As String = Nothing
Dim s3 = CObj(If(z, s1, s2))
End Sub
End Class]]>
</Document>
<Document><![CDATA[
Imports System
Class Program2
Private f As Char = "c"C
Public Sub F(Optional x As Integer = 0)
' unnecessary casts
Dim y As Integer = 0
Dim z As Boolean = True
' required cast
Dim l As Long = 1
Dim ll = CInt(l)
' required cast after cast removal in same statement
Dim s1 As String = Nothing, s2 As String = Nothing
Dim s3 = CObj(If(z, s1, s2))
End Sub
End Class]]>
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="Assembly2" CommonReferences="true">
<ProjectReference>Assembly1</ProjectReference>
<Document><![CDATA[
Imports System
Class Program3
Private f As Char = "c"C
Public Sub F(Optional x As Integer = 0)
' unnecessary casts
Dim y As Integer = 0
Dim z As Boolean = True
' required cast
Dim l As Long = 1
Dim ll = CInt(l)
' required cast after cast removal in same statement
Dim s1 As String = Nothing, s2 As String = Nothing
Dim s3 = CObj(If(z, s1, s2))
End Sub
End Class]]>
</Document>
</Project>
</Workspace>.ToString()
Await TestInRegularAndScriptAsync(input, expected)
End Function
End Class
End Namespace
|
reaction1989/roslyn
|
src/Analyzers/VisualBasic/Tests/RemoveUnnecessaryCast/RemoveUnnecessaryCastTests_FixAllTests.vb
|
Visual Basic
|
apache-2.0
| 15,573
|
Imports BVSoftware.Bvc5.Core
Imports System.Collections.ObjectModel
Imports System.Data
Partial Class BVModules_Controls_ProductReviewDisplay
Inherits System.Web.UI.UserControl
Public Property ProductID() As String
Get
Return Me.bvinField.Value
End Get
Set(ByVal Value As String)
Me.bvinField.Value = Value
End Set
End Property
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If ProductID.Trim.Length < 1 Then
If ProductID.Trim = String.Empty Then
ProductID = Request.QueryString("ProductId")
End If
End If
ShowAppropriatePanels()
If WebAppSettings.ProductReviewShow = True Then
Dim p As Catalog.Product = Catalog.InternalProduct.FindByBvin(ProductID)
If Not p Is Nothing Then
' Amazon
'If p.ProductTypeId = -100 Then
' LoadAmazonReviews()
'Else
LoadReviews()
End If
If WebAppSettings.ProductReviewAllow = True Then
Dim destinationUrl As String = "~/ProductReviewPopup.aspx"
destinationUrl = Page.ResolveClientUrl(destinationUrl)
Me.lnkWriteAReview.Attributes.Add("onclick", "JavaScript:window.open('" & destinationUrl & "?productID=" & Server.UrlEncode(Request.QueryString("ProductID")) & "#Write','Images','width=600, height=400, menubar=no, scrollbars=yes, resizable=yes, status=no, toolbar=no')")
Me.lnkWriteAReview.Visible = True
Else
Me.lnkWriteAReview.Visible = False
End If
End If
'End If
End Sub
Private Sub ShowAppropriatePanels()
If WebAppSettings.ProductReviewShow = False Then
Me.pnlReviewDisplay.Visible = False
Else
Me.pnlReviewDisplay.Visible = True
End If
End Sub
Private Sub LoadReviews()
Me.dlReviews.Visible = True
Me.dlAmazonReviews.Visible = False
Me.lblRating.Visible = False
Me.imgAverageRating.Visible = False
Me.lnkAllReviews.Visible = False
Me.lblTitle.Text = Content.SiteTerms.GetTerm("CustomerReviews")
Dim reviews As Collection(Of Catalog.ProductReview)
If WebAppSettings.ProductReviewModerate = True Then
reviews = Catalog.ProductReview.FindByProductBvin(bvinField.Value, False)
Else
reviews = Catalog.ProductReview.FindByProductBvin(bvinField.Value, True)
End If
If Not reviews Is Nothing Then
If reviews.Count > 0 Then
'Average Rating Code
If WebAppSettings.ProductReviewShowRating = True Then
If (reviews.Count > 0) Then
Me.lblRating.Visible = True
Me.imgAverageRating.Visible = True
Dim destinationUrl As String = "~/ProductReviewPopup.aspx"
destinationUrl = Page.ResolveClientUrl(destinationUrl)
Me.lnkAllReviews.Visible = True
Me.lnkAllReviews.Text = "View All " & reviews.Count & " Reviews"
Me.lnkAllReviews.Attributes.Add("onclick", "JavaScript:window.open('" & destinationUrl & "?productID=" & Server.UrlEncode(Request.QueryString("ProductID")) & "','Images','width=600, height=400, menubar=no, scrollbars=yes, resizable=yes, status=no, toolbar=no')")
End If
Dim AverageRating As Integer = 3
Dim tempRating As Double = 3.0
Dim sumRatings As Double = 0.0
For i As Integer = 0 To reviews.Count - 1
sumRatings += reviews(i).Rating
Next
If sumRatings > 0 Then
tempRating = sumRatings / reviews.Count
AverageRating = Math.Ceiling(tempRating)
End If
Me.lblRating.Text = Content.SiteTerms.GetTerm("AverageRating")
Select Case AverageRating
Case 1
Me.imgAverageRating.ImageUrl = PersonalizationServices.GetThemedButton("Stars1")
Case 2
Me.imgAverageRating.ImageUrl = PersonalizationServices.GetThemedButton("Stars2")
Case 3
Me.imgAverageRating.ImageUrl = PersonalizationServices.GetThemedButton("Stars3")
Case 4
Me.imgAverageRating.ImageUrl = PersonalizationServices.GetThemedButton("Stars4")
Case 5
Me.imgAverageRating.ImageUrl = PersonalizationServices.GetThemedButton("Stars5")
End Select
Me.imgAverageRating.ImageUrl = Me.imgAverageRating.ImageUrl
End If
' Trim Reviews if more than count and display
If WebAppSettings.ProductReviewCount < reviews.Count Then
Me.dlReviews.DataSource = TrimReviewList(reviews, WebAppSettings.ProductReviewCount)
Else
Me.dlReviews.DataSource = reviews
End If
Me.dlReviews.DataBind()
End If
End If
End Sub
Private Sub LoadAmazonReviews()
Me.dlReviews.Visible = False
Me.dlAmazonReviews.Visible = True
Me.lblRating.Visible = False
Me.imgAverageRating.Visible = False
Me.lnkAllReviews.Visible = False
Me.lblTitle.Text = Content.SiteTerms.GetTerm("CustomerReviews")
'Dim ap As BVSoftware.AmazonWebServices4.AmazonProduct
'ap = AmazonCache.GetAmazonProduct(ViewState("ProductID"))
'If Not ap Is Nothing Then
' If ap.HasReviews = True Then
' Me.lnkAllReviews.Visible = True
' Me.lnkAllReviews.Text = "View All " & ap.Reviews.Count & " Reviews"
' Me.lnkAllReviews.Attributes.Add("onclick", "JavaScript:window.open('ProductReviewPopup.aspx?productID=" & Server.UrlEncode(ViewState("ProductID")) & "','Images','width=600, height=400, menubar=no, scrollbars=yes, resizable=yes, status=no, toolbar=no')")
' If ap.Reviews.Count <= WebAppSettings.ProductReviewCount Then
' Me.dlAmazonReviews.DataSource = ap.Reviews
' Me.dlAmazonReviews.DataBind()
' Else
' Dim trimmedReviews As New Collection(Of BVSoftware.AmazonWebServices4.AmazonReview)
' For i As Integer = 0 To WebAppSettings.ProductReviewCount - 1
' trimmedReviews.Add(ap.Reviews(i))
' Next
' Me.dlAmazonReviews.DataSource = trimmedReviews
' Me.dlAmazonReviews.DataBind()
' End If
' End If
'End If
'Dim AverageRating As Integer = 3
'Dim tempRating As Double = ap.AverageCustomerRating
'AverageRating = Math.Ceiling(tempRating)
''Me.lblRating.Text = Content.SiteTerm.FindSafeTermValue("AverageRating")
'Me.lblRating.Text = "Average Rating"
'Select Case AverageRating
' Case 1
' Me.imgAverageRating.ImageUrl = PersonalizationServices.GetThemedButton("Stars1")
' Case 2
' Me.imgAverageRating.ImageUrl = PersonalizationServices.GetThemedButton("Stars2")
' Case 3
' Me.imgAverageRating.ImageUrl = PersonalizationServices.GetThemedButton("Stars3")
' Case 4
' Me.imgAverageRating.ImageUrl = PersonalizationServices.GetThemedButton("Stars4")
' Case 5
' Me.imgAverageRating.ImageUrl = PersonalizationServices.GetThemedButton("Stars5")
'End Select
'Me.imgAverageRating.ImageUrl = Me.imgAverageRating.ImageUrl
End Sub
Private Function TrimReviewList(ByVal source As Collection(Of Catalog.ProductReview), ByVal maxReviews As Integer) As Collection(Of Catalog.ProductReview)
Dim result As New Collection(Of Catalog.ProductReview)
For i As Integer = 0 To source.Count - 1
If i < maxReviews Then
result.Add(source(i))
End If
Next
Return result
End Function
Private Sub dlReviews_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dlReviews.ItemDataBound
If e.Item.ItemType = ListItemType.AlternatingItem OrElse e.Item.ItemType = ListItemType.Item Then
Dim ratingImage As System.Web.UI.WebControls.Image
Dim ratingDescription As System.Web.UI.WebControls.Label
Dim karmaPanel As System.Web.UI.WebControls.Panel
Dim karmaLabel As System.Web.UI.WebControls.Label
Dim karmaYes As System.Web.UI.WebControls.ImageButton
Dim karmaNo As System.Web.UI.WebControls.ImageButton
ratingImage = e.Item.FindControl("imgReviewRating")
ratingDescription = e.Item.FindControl("lblReviewDescription")
karmaPanel = e.Item.FindControl("pnlKarma")
If Not ratingImage Is Nothing Then
If WebAppSettings.ProductReviewShowRating = True Then
ratingImage.Visible = True
Select Case CInt(DataBinder.Eval(e.Item.DataItem, "Rating"))
Case 1
ratingImage.ImageUrl = PersonalizationServices.GetThemedButton("Stars1")
Case 2
ratingImage.ImageUrl = PersonalizationServices.GetThemedButton("Stars2")
Case 3
ratingImage.ImageUrl = PersonalizationServices.GetThemedButton("Stars3")
Case 4
ratingImage.ImageUrl = PersonalizationServices.GetThemedButton("Stars4")
Case 5
ratingImage.ImageUrl = PersonalizationServices.GetThemedButton("Stars5")
End Select
Else
ratingImage.Visible = False
End If
End If
If Not ratingDescription Is Nothing Then
ratingDescription.Text = DataBinder.Eval(e.Item.DataItem, "Description")
End If
If Not karmaPanel Is Nothing Then
karmaPanel.Visible = False
If WebAppSettings.ProductReviewShowKarma = True Then
karmaPanel.Visible = True
karmaLabel = e.Item.FindControl("lblProductReviewKarma")
karmaYes = e.Item.FindControl("btnReviewKarmaYes")
karmaNo = e.Item.FindControl("btnReviewKarmaNo")
If Not karmaLabel Is Nothing Then
karmaLabel.Text = Content.SiteTerms.GetTerm("WasThisReviewHelpful")
End If
If Not karmaYes Is Nothing Then
karmaYes.ImageUrl = PersonalizationServices.GetThemedButton("Yes")
End If
If Not karmaNo Is Nothing Then
karmaNo.ImageUrl = PersonalizationServices.GetThemedButton("No")
End If
Else
karmaPanel.Visible = False
End If
End If
End If
End Sub
Private Sub dlReviews_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles dlReviews.EditCommand
Dim reviewID As String = dlReviews.DataKeys(e.Item.ItemIndex)
Catalog.ProductReview.UpdateKarma(reviewID, 1)
End Sub
Private Sub dlReviews_DeleteCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles dlReviews.DeleteCommand
Dim reviewID As String = dlReviews.DataKeys(e.Item.ItemIndex)
Catalog.ProductReview.UpdateKarma(reviewID, -1)
End Sub
Private Sub dlAmazonReviews_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dlAmazonReviews.ItemDataBound
'If e.Item.ItemType = ListItemType.AlternatingItem OrElse e.Item.ItemType = ListItemType.Item Then
' Dim ratingImage As System.Web.UI.WebControls.Image
' Dim amazonSummary As System.Web.UI.WebControls.Label
' Dim amazonComment As System.Web.UI.WebControls.Label
' ratingImage = e.Item.FindControl("imgAmazonRating")
' amazonSummary = e.Item.FindControl("lblAmazonSummary")
' amazonComment = e.Item.FindControl("lblAmazonComment")
' Dim rev As BVSoftware.AmazonWebServices4.AmazonReview
' rev = CType(e.Item.DataItem(), BVSoftware.AmazonWebServices4.AmazonReview)
' If Not rev Is Nothing Then
' If Not ratingImage Is Nothing Then
' ratingImage.Visible = True
' Select Case Math.Ceiling(Convert.ToDecimal(rev.Rating))
' Case 1
' ratingImage.ImageUrl = PersonalizationServices.GetThemedButton("Stars1")
' Case 2
' ratingImage.ImageUrl = PersonalizationServices.GetThemedButton("Stars2")
' Case 3
' ratingImage.ImageUrl = PersonalizationServices.GetThemedButton("Stars3")
' Case 4
' ratingImage.ImageUrl = PersonalizationServices.GetThemedButton("Stars4")
' Case 5
' ratingImage.ImageUrl = PersonalizationServices.GetThemedButton("Stars5")
' End Select
' End If
' If Not amazonSummary Is Nothing Then
' amazonSummary.Text = rev.Summary
' End If
' End If
'End If
End Sub
End Class
|
ajaydex/Scopelist_2015
|
BVModules/Controls/ProductReviewDisplay.ascx.vb
|
Visual Basic
|
apache-2.0
| 14,211
|
'*******************************************************************************************'
' '
' Download Free Evaluation Version From: https://bytescout.com/download/web-installer '
' '
' Also available as Web API! Get free API Key https://app.pdf.co/signup '
' '
' Copyright © 2017-2020 ByteScout, Inc. All rights reserved. '
' https://www.bytescout.com '
' https://www.pdf.co '
'*******************************************************************************************'
' import bytescout screen capturing activex object
Imports BytescoutScreenCapturingLib
Module Module1
Sub Main(ByVal args As String())
' Create new Capturer object
Dim capturer As New Capturer
' Merge WMV files that were previously created by the ByteScout Screen Capturer (must be of same size, FPS and type)
capturer.JoinWMVFiles("Sample1.wmv", "Sample2.wmv", "output.wmv")
Console.WriteLine("Files merged successfully!")
' Open output file with associated application
Process.Start("output.wmv")
End Sub
End Module
|
bytescout/ByteScout-SDK-SourceCode
|
Screen Capturing SDK/VB.NET/Merge WMV Video Files/Module1.vb
|
Visual Basic
|
apache-2.0
| 1,556
|
' Copyright 2011 Branden Coates
' Licensed under the Apache License, Version 2.0 (the "License");
' you may not use this file except in compliance with the License.
' You may obtain a copy of the License at
' http://www.apache.org/licenses/LICENSE-2.0
' Unless required by applicable law or agreed to in writing, software
' distributed under the License is distributed on an "AS IS" BASIS,
' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
' See the License for the specific language governing permissions and
' limitations under the License.
' Contact: Branden Coates
' branden.c.coates@gmail.com
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class COMRedirSVC
Inherits System.ServiceProcess.ServiceBase
'UserService overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
' The main entry point for the process
<MTAThread()> _
<System.Diagnostics.DebuggerNonUserCode()> _
Shared Sub Main()
Dim ServicesToRun() As System.ServiceProcess.ServiceBase
' More than one NT Service may run within the same process. To add
' another service to this process, change the following line to
' create a second service object. For example,
'
' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
'
ServicesToRun = New System.ServiceProcess.ServiceBase() {New COMRedirSVC}
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
' NOTE: The following procedure is required by the Component Designer
' It can be modified using the Component Designer.
' Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.EventLog1 = New System.Diagnostics.EventLog()
CType(Me.EventLog1, System.ComponentModel.ISupportInitialize).BeginInit()
'
'Service1
'
Me.ServiceName = "COMRedirSVC"
CType(Me.EventLog1, System.ComponentModel.ISupportInitialize).EndInit()
End Sub
End Class
|
GearheadRed/COMRedirSVC
|
COMRedirSVC/COMRedirSVC.Designer.vb
|
Visual Basic
|
apache-2.0
| 2,627
|
#If DEBUG Then
Public Class StarRater
Inherits RadioButtonList
#Else
<ToolboxData("<{0}:StarRater runat=""server""> </{0}:StarRater>")> _
<ComponentModel.EditorBrowsable(ComponentModel.EditorBrowsableState.Never), ComponentModel.ToolboxItem(False)> _
Public Class StarRater
Inherits RadioButtonList
#End If
Private _callback As String = ""
''' <summary>
''' Property to get/set the Callback Function
''' </summary>
''' <value>
''' String passed to the set method
''' Default Value:
''' </value>
''' <returns>
''' callback string returned by the get method
''' </returns>
''' <remarks></remarks>
<System.ComponentModel.Description("Property to get/set the Callback Function")> _
Public Property CallbackFunction() As String
Get
Return _callback
End Get
Set(ByVal value As String)
_callback = value
End Set
End Property
Private _number_of_stars As Integer = 5
''' <summary>
''' Property to get/set the number of stars
''' </summary>
''' <value>
''' Integer passed to the set method
''' Default Value:
''' </value>
''' <returns>
''' number_of_stars integer returned by the get method
''' </returns>
''' <remarks></remarks>
<System.ComponentModel.Description("Property to get/set the number of stars")> _
Public Property NumberOfStars() As Integer
Get
Return _number_of_stars
End Get
Set(ByVal value As Integer)
_number_of_stars = value
End Set
End Property
Private Sub StarRater_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
jQueryLibrary.jQueryInclude.addScriptFile(Me.Page, "DTIMiniControls/jquery.rating.js", , True)
jQueryLibrary.jQueryInclude.addScriptFile(Me.Page, "DTIMiniControls/jquery.MetaData.js", , True)
jQueryLibrary.jQueryInclude.addScriptFile(Me.Page, "DTIMiniControls/jqueryStar.css", "text/css", True)
Dim splitVal As Integer = Items.Count / NumberOfStars
Dim script As String = "function initStarRaters(ancestor) {if(!ancestor){ancestor='';}$(ancestor +' .DTIStarRater input:radio').attr('class', 'star {split:" & _
splitVal & "}').rating("
If CallbackFunction <> "" Then
script &= "{callback: " & CallbackFunction & "}"
End If
script &= ");$(ancestor +' .DTIStarRater').fadeIn();} $(function() {initStarRaters();});"
Me.Page.ClientScript.RegisterStartupScript(Me.GetType, "rate_class_init", script, True)
End Sub
Protected Overrides Sub RenderItem(ByVal itemType As System.Web.UI.WebControls.ListItemType, ByVal repeatIndex As Integer, ByVal repeatInfo As System.Web.UI.WebControls.RepeatInfo, ByVal writer As System.Web.UI.HtmlTextWriter)
Dim radioButton As New RadioButton()
radioButton.Page = Me.Page
radioButton.GroupName = Me.UniqueID
radioButton.ID = (Me.ClientID & "_") + repeatIndex.ToString()
radioButton.Attributes("value") = Me.Items(repeatIndex).Value
radioButton.Checked = Me.Items(repeatIndex).Selected
radioButton.TextAlign = Me.TextAlign
radioButton.AutoPostBack = Me.AutoPostBack
radioButton.TabIndex = Me.TabIndex
radioButton.Enabled = Me.Enabled
radioButton.Style.Add(HtmlTextWriterStyle.BackgroundColor, Me.Items(repeatIndex).Text)
radioButton.RenderControl(writer)
End Sub
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
Me.RepeatLayout = WebControls.RepeatLayout.Flow
Me.RepeatDirection = WebControls.RepeatDirection.Horizontal
Me.Style("display") = "none"
Me.CssClass = "DTIStarRater"
MyBase.Render(writer)
End Sub
End Class
|
Micmaz/DTIControls
|
DTIMiniControls/DTIMiniControls/StarRater.vb
|
Visual Basic
|
mit
| 4,158
|
Public Class frmQE
Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles txtB.TextChanged
End Sub
Private Sub cmdClearAll_Click(sender As Object, e As EventArgs) Handles cmdClearAll.Click
lblX1.Text = ""
lblX2.Text = ""
txtA.Text = ""
txtB.Text = ""
txtC.Text = ""
End Sub
Private Sub cmdAnswer_Click(sender As Object, e As EventArgs) Handles cmdAnswer.Click
If (Val(txtA.Text) = 0 And (txtA.Text <> "0" Or txtA.Text = "0")) Or (Val(txtB.Text) = 0 And txtB.Text <> "0") Or (Val(txtC.Text) = 0 And txtC.Text <> "0") Then
MsgBox("Please type in a real number in all the textboxes. Note that a cannot be zero")
Else
Dim A, B, C, D, M, F, G, H, X1, X2, UpOne, UpTwo, I, T, V As Double
A = CDbl(txtA.Text)
B = CDbl(txtB.Text)
C = CDbl(txtC.Text)
D = B ^ 2
M = 4 * A * C
F = D - M
txtNegative.Text = CStr(F)
If Microsoft.VisualBasic.Left(txtNegative.Text, 1) = "-" Then
T = Microsoft.VisualBasic.Right(txtNegative.Text, (Len(txtNegative.Text) - 1))
V = CDbl(T)
G = Math.Sqrt(V)
H = 2 * A
I = -B
UpOne = (I / H)
UpTwo = (G / H)
X1 = Math.Round(UpOne, 2)
X2 = Math.Round(UpTwo, 4)
If Microsoft.VisualBasic.Left(txtA.Text, 1) = "-" Then
lblX1.Text = "x1=" & X1 & "-" & (-1 * X2) & "i"
Else
lblX1.Text = "x1=" & X1 & "+" & X2 & "i"
End If
If Microsoft.VisualBasic.Left(txtA.Text, 1) = "-" Then
lblX2.Text = "x2=" & X1 & "+" & (-1 * X2) & "i"
Else
lblX2.Text = "x2=" & X1 & "-" & X2 & "i"
End If
Else
G = Math.Sqrt(F)
H = 2 * A
I = -B
UpOne = I + G
UpTwo = I - G
X1 = Math.Round((UpOne / H), 6)
X2 = Math.Round((UpTwo / H), 6)
lblX1.Text = "x1=" & X1
lblX2.Text = "x2=" & X2
End If
End If
End Sub
Private Sub frmQE_Load(sender As Object, e As EventArgs) Handles MyBase.Load
cboMode.SelectedIndex = 1
End Sub
Private Sub cboMode_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboMode.SelectedIndexChanged
If cboMode.SelectedIndex = 1 Then
Me.Show()
frmStandard.Hide()
frmSE.Hide()
Me.cboMode.SelectedIndex = 1
Me.lblX1.Text = ""
Me.lblX2.Text = ""
Me.txtA.Text = ""
Me.txtB.Text = ""
Me.txtC.Text = ""
Else
If cboMode.SelectedIndex = 0 Then
Me.Hide()
frmStandard.Show()
frmSE.Hide()
frmStandard.cboMode.SelectedIndex = 0
frmStandard.lblScreen.Text = ""
frmStandard.lblAnswer.Text = ""
Else
If cboMode.SelectedIndex = 2 Then
Me.Hide()
frmStandard.Hide()
frmSE.Show()
frmSE.cboMode.SelectedIndex = 2
frmSE.txtA1.Text = ""
frmSE.txtA2.Text = ""
frmSE.txtB1.Text = ""
frmSE.txtB2.Text = ""
frmSE.txtC1.Text = ""
frmSE.txtC2.Text = ""
frmSE.lblX.Text = ""
frmSE.lblY.Text = ""
End If
End If
End If
End Sub
End Class
|
lotannaokoli/All-Purpose-Scientific-Calculator
|
OKOLI Lotanna Uche Calculator Project/Quadratic Equation.vb
|
Visual Basic
|
mit
| 3,905
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Composition
Imports Microsoft.CodeAnalysis.Formatting
Imports Microsoft.CodeAnalysis.Formatting.Rules
Imports Microsoft.CodeAnalysis.Options
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Formatting
<ExportFormattingRule(ElasticTriviaFormattingRule.Name, LanguageNames.VisualBasic), [Shared]>
<ExtensionOrder(After:=StructuredTriviaFormattingRule.Name)>
Friend Class ElasticTriviaFormattingRule
Inherits BaseFormattingRule
Friend Const Name As String = "VisualBasic Elastic Trivia Formatting Rule"
Public Sub New()
End Sub
Public Overrides Sub AddSuppressOperations(list As List(Of SuppressOperation), node As SyntaxNode, lastToken As SyntaxToken, optionSet As OptionSet, nextOperation As NextAction(Of SuppressOperation))
nextOperation.Invoke(list)
End Sub
Public Overrides Sub AddIndentBlockOperations(list As List(Of IndentBlockOperation), node As SyntaxNode, optionSet As OptionSet, nextOperation As NextAction(Of IndentBlockOperation))
nextOperation.Invoke(list)
If node.Kind = SyntaxKind.ObjectMemberInitializer Then
Dim initializer = DirectCast(node, ObjectMemberInitializerSyntax)
If initializer.GetLeadingTrivia().HasAnyWhitespaceElasticTrivia() Then
AddIndentBlockOperation(list,
initializer.OpenBraceToken,
initializer.CloseBraceToken.GetPreviousToken(),
[option]:=IndentBlockOption.RelativePosition)
list.Add(FormattingOperations.CreateIndentBlockOperation(
initializer.CloseBraceToken, initializer.CloseBraceToken,
indentationDelta:=0,
[option]:=IndentBlockOption.RelativePosition))
End If
End If
If node.Kind = SyntaxKind.ObjectCollectionInitializer Then
Dim collectionInitializer = DirectCast(node, ObjectCollectionInitializerSyntax)
If collectionInitializer.GetLeadingTrivia().HasAnyWhitespaceElasticTrivia() Then
Dim initializer = collectionInitializer.Initializer
AddIndentBlockOperation(list,
initializer.OpenBraceToken,
initializer.CloseBraceToken.GetPreviousToken(),
[option]:=IndentBlockOption.RelativePosition)
list.Add(FormattingOperations.CreateIndentBlockOperation(
initializer.CloseBraceToken, initializer.CloseBraceToken,
indentationDelta:=0,
[option]:=IndentBlockOption.RelativePosition))
End If
End If
End Sub
Public Overrides Sub AddAlignTokensOperations(list As List(Of AlignTokensOperation),
node As SyntaxNode,
optionSet As OptionSet,
nextOperation As NextAction(Of AlignTokensOperation))
nextOperation.Invoke(list)
If node.Kind = SyntaxKind.ObjectMemberInitializer Then
Dim initializer = DirectCast(node, ObjectMemberInitializerSyntax)
If initializer.GetLeadingTrivia().HasAnyWhitespaceElasticTrivia() Then
list.Add(New AlignTokensOperation(
initializer.WithKeyword,
SpecializedCollections.SingletonEnumerable(initializer.CloseBraceToken),
[option]:=AlignTokensOption.AlignIndentationOfTokensToFirstTokenOfBaseTokenLine))
End If
End If
If node.Kind = SyntaxKind.ObjectCollectionInitializer Then
Dim collectionInitializer = DirectCast(node, ObjectCollectionInitializerSyntax)
If collectionInitializer.GetLeadingTrivia().HasAnyWhitespaceElasticTrivia() Then
list.Add(New AlignTokensOperation(
collectionInitializer.FromKeyword,
SpecializedCollections.SingletonEnumerable(collectionInitializer.Initializer.CloseBraceToken),
[option]:=AlignTokensOption.AlignIndentationOfTokensToFirstTokenOfBaseTokenLine))
End If
End If
End Sub
Public Overrides Function GetAdjustSpacesOperation(previousToken As SyntaxToken, currentToken As SyntaxToken, optionSet As OptionSet, nextOperation As Rules.NextOperation(Of AdjustSpacesOperation)) As AdjustSpacesOperation
' if it doesn't have elastic trivia, pass it through
If Not CommonFormattingHelpers.HasAnyWhitespaceElasticTrivia(previousToken, currentToken) Then
Return nextOperation.Invoke()
End If
' if it has one, check whether there is a forced one
Dim operation = nextOperation.Invoke()
If operation IsNot Nothing AndAlso operation.Option = AdjustSpacesOption.ForceSpaces Then
Return operation
End If
' remove blank lines between parameter lists and implements clauses
If currentToken.Kind = SyntaxKind.ImplementsKeyword AndAlso
(previousToken.GetAncestor(Of MethodStatementSyntax)() IsNot Nothing OrElse
previousToken.GetAncestor(Of PropertyStatementSyntax)() IsNot Nothing OrElse
previousToken.GetAncestor(Of EventStatementSyntax)() IsNot Nothing) Then
Return FormattingOperations.CreateAdjustSpacesOperation(1, AdjustSpacesOption.ForceSpaces)
End If
' handle comma separated lists in implements clauses
If previousToken.GetAncestor(Of ImplementsClauseSyntax)() IsNot Nothing AndAlso currentToken.Kind = SyntaxKind.CommaToken Then
Return FormattingOperations.CreateAdjustSpacesOperation(0, AdjustSpacesOption.ForceSpaces)
End If
If currentToken.Kind = SyntaxKind.OpenBraceToken AndAlso
currentToken.Parent.Kind = SyntaxKind.CollectionInitializer AndAlso
currentToken.Parent.Parent.Kind = SyntaxKind.ObjectCollectionInitializer Then
Return New AdjustSpacesOperation(1,
[option]:=AdjustSpacesOption.ForceSpaces)
End If
Return operation
End Function
Public Overrides Function GetAdjustNewLinesOperation(
previousToken As SyntaxToken,
currentToken As SyntaxToken,
optionSet As OptionSet,
nextOperation As NextOperation(Of AdjustNewLinesOperation)) As AdjustNewLinesOperation
' if it doesn't have elastic trivia, pass it through
If Not CommonFormattingHelpers.HasAnyWhitespaceElasticTrivia(previousToken, currentToken) Then
Return nextOperation.Invoke()
End If
' if it has one, check whether there is a forced one
Dim operation = nextOperation.Invoke()
If operation IsNot Nothing AndAlso operation.Option = AdjustNewLinesOption.ForceLines Then
Return operation
End If
If currentToken.Kind = SyntaxKind.DotToken AndAlso
currentToken.Parent.Kind = SyntaxKind.NamedFieldInitializer Then
Return New AdjustNewLinesOperation(line:=1,
[option]:=AdjustNewLinesOption.ForceLines)
End If
If previousToken.Kind = SyntaxKind.OpenBraceToken AndAlso
previousToken.Parent.Kind = SyntaxKind.CollectionInitializer AndAlso
previousToken.Parent.Parent.Kind = SyntaxKind.ObjectCollectionInitializer Then
Return New AdjustNewLinesOperation(line:=1,
[option]:=AdjustNewLinesOption.ForceLines)
End If
If previousToken.Kind = SyntaxKind.CommaToken AndAlso
previousToken.Parent.Kind = SyntaxKind.CollectionInitializer AndAlso
previousToken.Parent.Parent.Kind = SyntaxKind.ObjectCollectionInitializer Then
Return New AdjustNewLinesOperation(line:=1,
[option]:=AdjustNewLinesOption.ForceLines)
End If
If currentToken.Kind = SyntaxKind.OpenBraceToken AndAlso
currentToken.Parent.Kind = SyntaxKind.CollectionInitializer AndAlso
currentToken.Parent.Parent.Kind = SyntaxKind.CollectionInitializer Then
Return New AdjustNewLinesOperation(line:=1,
[option]:=AdjustNewLinesOption.ForceLines)
End If
If currentToken.Kind = SyntaxKind.CloseBraceToken Then
If currentToken.Parent.Kind = SyntaxKind.ObjectMemberInitializer Then
Return New AdjustNewLinesOperation(line:=1,
[option]:=AdjustNewLinesOption.ForceLines)
End If
If currentToken.Parent.Kind = SyntaxKind.CollectionInitializer AndAlso
currentToken.Parent.Parent.Kind = SyntaxKind.ObjectCollectionInitializer Then
Return New AdjustNewLinesOperation(line:=1,
[option]:=AdjustNewLinesOption.ForceLines)
End If
End If
' put attributes in its own line if it is top level attribute
Dim attributeNode = TryCast(previousToken.Parent, AttributeListSyntax)
If attributeNode IsNot Nothing AndAlso TypeOf attributeNode.Parent Is StatementSyntax AndAlso
attributeNode.GreaterThanToken = previousToken AndAlso currentToken.Kind <> SyntaxKind.LessThanToken Then
Return FormattingOperations.CreateAdjustNewLinesOperation(1, AdjustNewLinesOption.ForceLines)
End If
If Not previousToken.IsLastTokenOfStatement() Then
Return operation
End If
' The previous token may end a statement, but it could be in a lambda inside parens.
If currentToken.Kind = SyntaxKind.CloseParenToken AndAlso
TypeOf currentToken.Parent Is ParenthesizedExpressionSyntax Then
Return operation
End If
If AfterLastInheritsOrImplements(previousToken, currentToken) Then
If Not TypeOf currentToken.Parent Is EndBlockStatementSyntax Then
Return FormattingOperations.CreateAdjustNewLinesOperation(2, AdjustNewLinesOption.ForceLines)
End If
End If
If AfterLastImportStatement(previousToken, currentToken) Then
Return FormattingOperations.CreateAdjustNewLinesOperation(2, AdjustNewLinesOption.ForceLines)
End If
Dim lines = LineBreaksAfter(previousToken, currentToken)
If Not lines.HasValue Then
If TypeOf previousToken.Parent Is XmlNodeSyntax Then
' make sure next statement starts on its own line if previous statement ends with xml literals
Return FormattingOperations.CreateAdjustNewLinesOperation(1, AdjustNewLinesOption.PreserveLines)
End If
Return CreateAdjustNewLinesOperation(Math.Max(If(operation Is Nothing, 1, operation.Line), 0), AdjustNewLinesOption.PreserveLines)
End If
If lines = 0 Then
Return CreateAdjustNewLinesOperation(0, AdjustNewLinesOption.PreserveLines)
End If
Return CreateAdjustNewLinesOperation(lines.Value, AdjustNewLinesOption.ForceLines)
End Function
Private Function AfterLastImportStatement(token As SyntaxToken, nextToken As SyntaxToken) As Boolean
' in between two imports
If nextToken.Kind = SyntaxKind.ImportsKeyword Then
Return False
End If
' current one is not import statement
If Not TypeOf token.Parent Is NameSyntax Then
Return False
End If
Dim [imports] = token.GetAncestor(Of ImportsStatementSyntax)()
If [imports] Is Nothing Then
Return False
End If
Return True
End Function
Private Function AfterLastInheritsOrImplements(token As SyntaxToken, nextToken As SyntaxToken) As Boolean
Dim inheritsOrImplements = token.GetAncestor(Of InheritsOrImplementsStatementSyntax)()
Dim nextInheritsOrImplements = nextToken.GetAncestor(Of InheritsOrImplementsStatementSyntax)()
Return inheritsOrImplements IsNot Nothing AndAlso nextInheritsOrImplements Is Nothing
End Function
Private Function IsBeginStatement(Of TStatement As StatementSyntax, TBlock As StatementSyntax)(node As StatementSyntax) As Boolean
Return TryCast(node, TStatement) IsNot Nothing AndAlso TryCast(node.Parent, TBlock) IsNot Nothing
End Function
Private Function IsEndBlockStatement(node As StatementSyntax) As Boolean
Return TryCast(node, EndBlockStatementSyntax) IsNot Nothing OrElse
TryCast(node, LoopStatementSyntax) IsNot Nothing OrElse
TryCast(node, NextStatementSyntax) IsNot Nothing
End Function
Private Function LineBreaksAfter(previousToken As SyntaxToken, currentToken As SyntaxToken) As Integer?
If currentToken.Kind = SyntaxKind.None OrElse
previousToken.Kind = SyntaxKind.None Then
Return 0
End If
Dim previousStatement = previousToken.GetAncestor(Of StatementSyntax)()
Dim currentStatement = currentToken.GetAncestor(Of StatementSyntax)()
If previousStatement Is Nothing OrElse currentStatement Is Nothing Then
Return Nothing
End If
If TopLevelStatement(previousStatement) AndAlso Not TopLevelStatement(currentStatement) Then
Return GetActualLines(previousToken, currentToken, 1)
End If
' Early out of accessors, we don't force more lines between them.
If previousStatement.Kind = SyntaxKind.EndSetStatement OrElse
previousStatement.Kind = SyntaxKind.EndGetStatement OrElse
previousStatement.Kind = SyntaxKind.EndAddHandlerStatement OrElse
previousStatement.Kind = SyntaxKind.EndRemoveHandlerStatement OrElse
previousStatement.Kind = SyntaxKind.EndRaiseEventStatement Then
Return Nothing
End If
' Blank line after an end block, unless it's followed by another end or an else
If IsEndBlockStatement(previousStatement) Then
If IsEndBlockStatement(currentStatement) OrElse
currentStatement.Kind = SyntaxKind.ElseIfStatement OrElse
currentStatement.Kind = SyntaxKind.ElseStatement Then
Return GetActualLines(previousToken, currentToken, 1)
Else
Return GetActualLines(previousToken, currentToken, 2, 1)
End If
End If
' Blank line _before_ a block, unless it's the first thing in a type.
If IsBeginStatement(Of MethodStatementSyntax, MethodBlockSyntax)(currentStatement) OrElse
IsBeginStatement(Of SubNewStatementSyntax, ConstructorBlockSyntax)(currentStatement) OrElse
IsBeginStatement(Of OperatorStatementSyntax, OperatorBlockSyntax)(currentStatement) OrElse
IsBeginStatement(Of PropertyStatementSyntax, PropertyBlockSyntax)(currentStatement) OrElse
IsBeginStatement(Of EventStatementSyntax, EventBlockSyntax)(currentStatement) OrElse
IsBeginStatement(Of TypeStatementSyntax, TypeBlockSyntax)(currentStatement) OrElse
IsBeginStatement(Of EnumStatementSyntax, EnumBlockSyntax)(currentStatement) OrElse
IsBeginStatement(Of NamespaceStatementSyntax, NamespaceBlockSyntax)(currentStatement) OrElse
IsBeginStatement(Of DoStatementSyntax, DoLoopBlockSyntax)(currentStatement) OrElse
IsBeginStatement(Of ForStatementSyntax, ForOrForEachBlockSyntax)(currentStatement) OrElse
IsBeginStatement(Of ForEachStatementSyntax, ForOrForEachBlockSyntax)(currentStatement) OrElse
IsBeginStatement(Of IfStatementSyntax, MultiLineIfBlockSyntax)(currentStatement) OrElse
IsBeginStatement(Of SelectStatementSyntax, SelectBlockSyntax)(currentStatement) OrElse
IsBeginStatement(Of SyncLockStatementSyntax, SyncLockBlockSyntax)(currentStatement) OrElse
IsBeginStatement(Of TryStatementSyntax, TryBlockSyntax)(currentStatement) OrElse
IsBeginStatement(Of UsingStatementSyntax, UsingBlockSyntax)(currentStatement) OrElse
IsBeginStatement(Of WhileStatementSyntax, WhileBlockSyntax)(currentStatement) OrElse
IsBeginStatement(Of WithStatementSyntax, WithBlockSyntax)(currentStatement) Then
If TypeOf previousStatement Is NamespaceStatementSyntax OrElse
TypeOf previousStatement Is TypeStatementSyntax Then
Return GetActualLines(previousToken, currentToken, 1)
Else
Return GetActualLines(previousToken, currentToken, 2, 1)
End If
End If
Return Nothing
End Function
Private Function GetActualLines(token1 As SyntaxToken, token2 As SyntaxToken, lines As Integer, Optional leadingBlankLines As Integer = 0) As Integer
If leadingBlankLines = 0 Then
Return Math.Max(lines, 0)
End If
' see whether first non whitespace trivia after previous member is comment or not
Dim list = token1.TrailingTrivia.Concat(token2.LeadingTrivia)
Dim firstNonWhitespaceTrivia = list.FirstOrDefault(Function(t) Not t.IsWhitespaceOrEndOfLine())
If firstNonWhitespaceTrivia.IsKind(SyntaxKind.CommentTrivia, SyntaxKind.DocumentationCommentTrivia) Then
Dim totalLines = GetNumberOfLines(list)
Dim blankLines = GetNumberOfLines(list.TakeWhile(Function(t) t <> firstNonWhitespaceTrivia))
If totalLines < lines Then
Dim afterCommentWithBlank = (totalLines - blankLines) + leadingBlankLines
Return Math.Max(If(lines > afterCommentWithBlank, lines, afterCommentWithBlank), 0)
End If
If blankLines < leadingBlankLines Then
Return Math.Max(totalLines - blankLines + leadingBlankLines, 0)
End If
Return Math.Max(totalLines, 0)
End If
Return Math.Max(lines, 0)
End Function
Private Function GetNumberOfLines(list As IEnumerable(Of SyntaxTrivia)) As Integer
Return list.Sum(Function(t) t.ToFullString().Replace(vbCrLf, vbCr).OfType(Of Char).Count(Function(c) SyntaxFacts.IsNewLine(c)))
End Function
Private Function TopLevelStatement(statement As StatementSyntax) As Boolean
Return TypeOf statement Is MethodStatementSyntax OrElse
TypeOf statement Is SubNewStatementSyntax OrElse
TypeOf statement Is LambdaHeaderSyntax OrElse
TypeOf statement Is OperatorStatementSyntax OrElse
TypeOf statement Is PropertyStatementSyntax OrElse
TypeOf statement Is EventStatementSyntax OrElse
TypeOf statement Is TypeStatementSyntax OrElse
TypeOf statement Is EnumStatementSyntax OrElse
TypeOf statement Is NamespaceStatementSyntax
End Function
End Class
End Namespace
|
paulvanbrenk/roslyn
|
src/Workspaces/VisualBasic/Portable/Formatting/Rules/ElasticTriviaFormattingRule.vb
|
Visual Basic
|
apache-2.0
| 20,396
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.Structure
Imports Microsoft.CodeAnalysis.VisualBasic.Structure
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Outlining
Public Class UsingBlockStructureProviderTests
Inherits AbstractVisualBasicSyntaxNodeStructureProviderTests(Of UsingBlockSyntax)
Friend Overrides Function CreateProvider() As AbstractSyntaxStructureProvider
Return New UsingBlockStructureProvider()
End Function
<Fact, Trait(Traits.Feature, Traits.Features.Outlining)>
Public Async Function TestUsingBlock1() As Task
Const code = "
Class C
Sub M()
{|span:Using (goo) $$
End Using|}
End Sub
End Class
"
Await VerifyBlockSpansAsync(code,
Region("span", "Using (goo) ...", autoCollapse:=False))
End Function
End Class
End Namespace
|
VSadov/roslyn
|
src/EditorFeatures/VisualBasicTest/Structure/UsingBlockStructureTests.vb
|
Visual Basic
|
apache-2.0
| 1,093
|
Imports Microsoft.VisualBasic
Imports System.IO
Imports Aspose.Cells
Namespace Articles
Public Class UsePresentationPreferenceOption
Public Shared Sub Run()
' ExStart:1
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
' Instantiate the Workbook
' Load an Excel file
Dim workbook As New Workbook(dataDir & "sample.xlsx")
' Create HtmlSaveOptions object
Dim options As New HtmlSaveOptions()
' Set the Presenation preference option
options.PresentationPreference = True
' Save the Excel file to HTML with specified option
workbook.Save(dataDir & "output.html", options)
' ExEnd:1
End Sub
End Class
End Namespace
|
maria-shahid-aspose/Aspose.Cells-for-.NET
|
Examples/VisualBasic/Articles/UsePresentationPreferenceOption.vb
|
Visual Basic
|
mit
| 892
|
Namespace BusRodeDll
Public Class MonitorDll
Public Sub New()
DllDependBusRodeVersion = 9000
DllWriter = "Sample Name"
DllRegion = "Country-Province-City"
DllVersion = "1.0.0.0"
DllGetTick = 5000
End Sub
'here are some information which will read when bus_rode is initializing.
'you must know the mean of them and you need to read the book of develop bus_rode's mod.
#Region "information"
Public DllDependBusRodeVersion As Integer
Public DllRegion As String
Public DllGetTick As Integer
Public DllWriter As String
Public DllVersion As String
#End Region
''' <summary>
''' the value which main application send it order
''' </summary>
Public DllCommand As String
''' <summary>
''' the function which will be invoked when main application initialize this mode
''' </summary>
''' <returns></returns>
Public Function Initialize() As Boolean
'type your code here
Return True
End Function
''' <summary>
''' the main function of getting data
''' </summary>
''' <returns></returns>
Public Function GetData() As String
'type your code here
Return ""
End Function
End Class
End Namespace
|
yyc12345/bus_rode
|
DllSample/MonitorDll.vb
|
Visual Basic
|
mit
| 1,416
|
Namespace Security.BackStage_Help
Public Class ProductRegistration
Inherits SecurityItemBase
Public Sub New()
_ConceptItemName = "Product Registration"
_ConceptName = "BackStage_Help"
_Description = "Allows access to 'Product Registration'"
_IsEnterprise = True
_IsSmallBusiness = True
_IsViewer = False
_IsWeb = False
_IsWebPlus = False
End Sub
End Class
End Namespace
|
nublet/DMS
|
DMS.Forms.Shared/Security/Items/Backstage/Help/ProductRegistration.vb
|
Visual Basic
|
mit
| 507
|
' Channel information structure (contained in the file header).
' One-time information describing each channel. 64 bytes long.
' This Is data pertaining to each channel that will Not change
' during the course of a run.
''' <summary>
''' Channel information structure (contained in the file header).
''' One-time information describing each channel.
''' This is data pertaining to each channel that will NOT change during the course of a run.
''' </summary>
''' <remarks></remarks>
Public Class ChanInfo
Dim inChannelName As String ' Text describing channel. i.e., "Port 500"
''' <summary>
''' Type of the channel:
''' 0 = Subbottom
''' 1 = Port
''' 2 = Starboard
''' 3 = Bathymetry
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property TypeOfChannel As Byte 'xtfTypeOfChannel
''' <summary>
''' Index for which ChanInfo structure this is.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property SubChannelNumber As Byte
''' <summary>
''' Sonar imagery stored as:
''' 1 = Slant-range (Raw)
''' 2 = Ground-range (Corrected)
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property CorrectionFlags As UInt16
''' <summary>
''' Polarity of the data.
''' 0 = data is bipolar
''' 1 = data is unipolar
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Unipolar As UInt16
''' <summary>
''' Bytes per sample
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property BytesPerSample As UInt16
''' <summary>
''' Samples recorded in each ping of this channel. Usually a multiple of 1024 unless bathymetry.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks>To be used only for compability with some analog systems.</remarks>
Public Property SamplesPerChannel As UInt32
''' <summary>
''' Text describing channel.
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks>Max 16 chars.</remarks>
Public Property ChannelName As String
Get
Return inChannelName
End Get
Set(value As String)
If String.IsNullOrEmpty(value) Then value = " "c
Dim tmpvalue As String = value.Replace(ChrW(0), " "c)
If tmpvalue.Length > 16 Then
inChannelName = tmpvalue.Substring(0, 16)
Else
inChannelName = tmpvalue.PadRight(16)
End If
End Set
End Property
Public Property VoltScale As Single ' How many volts is represented by max sample value. Typically 5.0.
Public Property Frequency As Single ' Center transmit frequency
Public Property HorizontalBeamAngle As Single ' Typically 1 degree or so
Public Property TiltAngle As Single ' Typically 30 degrees
Public Property BeamWidth As Single ' 3dB beam width, Typically 50 degrees
' Orientation of these offsets:
' Positive Y is forward
' Positive X is to starboard
' Positive Z is down. Just like depth.
' Positive roll is lean to starboard
' Positive pitch is nose up
' Positive yaw is turn to right
Public Property OffsetX As Single ' These offsets are entered in the Multibeam setup dialog box.
Public Property OffsetY As Single
Public Property OffsetZ As Single
Public Property OffsetYaw As Single ' If the multibeam sensor is reverse mounted (facing backwards), then OffsetYaw will be around 180 degrees.
Public Property OffsetPitch As Single
Public Property OffsetRoll As Single
Public Property BeamsPerArray As UInt16
'Public Property SampleFormat As Byte 'xtfChannelSampleFormat
'Public Property Latency As Single
''' <summary>
''' Create an empty ChanInfo.
''' </summary>
''' <remarks></remarks>
Public Sub New()
TypeOfChannel = 0
SubChannelNumber = 0
CorrectionFlags = 0
Unipolar = 0
BytesPerSample = 0
SamplesPerChannel = 0
ChannelName = " "
VoltScale = 0
Frequency = 0
HorizontalBeamAngle = 0
TiltAngle = 0
BeamWidth = 0
OffsetX = 0
OffsetY = 0
OffsetZ = 0
OffsetYaw = 0
OffsetPitch = 0
OffsetRoll = 0
BeamsPerArray = 0
'Latency = 0
'SampleFormat = 0
End Sub
''' <summary>
''' Create the ChanInfo for header from the given bytes.
''' </summary>
''' <param name="ByteArray">128 bytes that contain the informations.</param>
''' <remarks></remarks>
Public Sub New(byteArray As Byte())
TypeOfChannel = 0
SubChannelNumber = 0
CorrectionFlags = 0
Unipolar = 0
BytesPerSample = 0
SamplesPerChannel = 0
ChannelName = " "
VoltScale = 0
Frequency = 0
HorizontalBeamAngle = 0
TiltAngle = 0
BeamWidth = 0
OffsetX = 0
OffsetY = 0
OffsetZ = 0
OffsetYaw = 0
OffsetPitch = 0
OffsetRoll = 0
BeamsPerArray = 0
'Latency = 0
'SampleFormat = 0
Using ip As New BinaryReader(ByteArrayToMemoryStream(byteArray))
TypeOfChannel = ip.ReadByte
SubChannelNumber = ip.ReadByte
CorrectionFlags = ip.ReadUInt16
Unipolar = ip.ReadUInt16
BytesPerSample = ip.ReadUInt16
SamplesPerChannel = ip.ReadUInt32
ChannelName = ip.ReadChars(16)
VoltScale = ip.ReadSingle
Frequency = ip.ReadSingle
HorizontalBeamAngle = ip.ReadSingle
TiltAngle = ip.ReadSingle
BeamWidth = ip.ReadSingle
OffsetX = ip.ReadSingle
OffsetY = ip.ReadSingle
OffsetZ = ip.ReadSingle
OffsetYaw = ip.ReadSingle
OffsetPitch = ip.ReadSingle
OffsetRoll = ip.ReadSingle
BeamsPerArray = ip.ReadUInt16
'Latency = ip.ReadSingle
End Using
End Sub
End Class
|
jaksg82/XtfViewer
|
jakxtflib/ChanInfo.vb
|
Visual Basic
|
mit
| 6,329
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmStatCalc
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.WarCalc_Btn = New System.Windows.Forms.Button()
Me.MageCalc_Btn = New System.Windows.Forms.Button()
Me.SeyanCalc_Btn = New System.Windows.Forms.Button()
Me.EquipCalc_Btn = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.Button1 = New System.Windows.Forms.Button()
Me.Label3 = New System.Windows.Forms.Label()
Me.Label4 = New System.Windows.Forms.Label()
Me.Label5 = New System.Windows.Forms.Label()
Me.SuspendLayout()
'
'WarCalc_Btn
'
Me.WarCalc_Btn.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.WarCalc_Btn.Location = New System.Drawing.Point(43, 45)
Me.WarCalc_Btn.Name = "WarCalc_Btn"
Me.WarCalc_Btn.Size = New System.Drawing.Size(117, 37)
Me.WarCalc_Btn.TabIndex = 0
Me.WarCalc_Btn.Text = "Warrior Calc"
Me.WarCalc_Btn.UseVisualStyleBackColor = True
'
'MageCalc_Btn
'
Me.MageCalc_Btn.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.MageCalc_Btn.Location = New System.Drawing.Point(43, 131)
Me.MageCalc_Btn.Name = "MageCalc_Btn"
Me.MageCalc_Btn.Size = New System.Drawing.Size(117, 37)
Me.MageCalc_Btn.TabIndex = 1
Me.MageCalc_Btn.Text = "Mage Calc"
Me.MageCalc_Btn.UseVisualStyleBackColor = True
'
'SeyanCalc_Btn
'
Me.SeyanCalc_Btn.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.SeyanCalc_Btn.Location = New System.Drawing.Point(43, 88)
Me.SeyanCalc_Btn.Name = "SeyanCalc_Btn"
Me.SeyanCalc_Btn.Size = New System.Drawing.Size(117, 37)
Me.SeyanCalc_Btn.TabIndex = 2
Me.SeyanCalc_Btn.Text = "Seyan Calc"
Me.SeyanCalc_Btn.UseVisualStyleBackColor = True
'
'EquipCalc_Btn
'
Me.EquipCalc_Btn.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.EquipCalc_Btn.Location = New System.Drawing.Point(43, 174)
Me.EquipCalc_Btn.Name = "EquipCalc_Btn"
Me.EquipCalc_Btn.Size = New System.Drawing.Size(117, 37)
Me.EquipCalc_Btn.TabIndex = 3
Me.EquipCalc_Btn.Text = "Equipment Calc"
Me.EquipCalc_Btn.UseVisualStyleBackColor = True
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.Label1.ForeColor = System.Drawing.Color.Blue
Me.Label1.Location = New System.Drawing.Point(45, 10)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(107, 17)
Me.Label1.TabIndex = 4
Me.Label1.Text = "Stat Calculators"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.Label2.ForeColor = System.Drawing.Color.Blue
Me.Label2.Location = New System.Drawing.Point(125, 257)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(46, 17)
Me.Label2.TabIndex = 5
Me.Label2.Text = "Slayin"
'
'Button1
'
Me.Button1.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.Button1.Location = New System.Drawing.Point(43, 217)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(117, 37)
Me.Button1.TabIndex = 6
Me.Button1.Text = "NPC Builder"
Me.Button1.UseVisualStyleBackColor = True
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.Label3.ForeColor = System.Drawing.Color.Blue
Me.Label3.Location = New System.Drawing.Point(35, 257)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(86, 17)
Me.Label3.TabIndex = 7
Me.Label3.Text = "Written By :-"
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.Label4.ForeColor = System.Drawing.Color.Blue
Me.Label4.Location = New System.Drawing.Point(29, 26)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(141, 17)
Me.Label4.TabIndex = 4
Me.Label4.Text = "For Astonia 3.5 (NW)"
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Font = New System.Drawing.Font("Arial Narrow", 7.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label5.ForeColor = System.Drawing.SystemColors.MenuHighlight
Me.Label5.Location = New System.Drawing.Point(116, 273)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(52, 14)
Me.Label5.TabIndex = 8
Me.Label5.Text = "Ver 1.0.101"
'
'frmStatCalc
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(204, 299)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.EquipCalc_Btn)
Me.Controls.Add(Me.SeyanCalc_Btn)
Me.Controls.Add(Me.MageCalc_Btn)
Me.Controls.Add(Me.WarCalc_Btn)
Me.MaximizeBox = False
Me.MaximumSize = New System.Drawing.Size(220, 337)
Me.MinimizeBox = False
Me.MinimumSize = New System.Drawing.Size(220, 337)
Me.Name = "frmStatCalc"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Stat Calculator"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents WarCalc_Btn As System.Windows.Forms.Button
Friend WithEvents MageCalc_Btn As System.Windows.Forms.Button
Friend WithEvents SeyanCalc_Btn As System.Windows.Forms.Button
Friend WithEvents EquipCalc_Btn As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label5 As System.Windows.Forms.Label
End Class
|
AstoniaDev/VB_StatCalc
|
vb_calc/StatCalc.Designer.vb
|
Visual Basic
|
mit
| 7,562
|
Imports System
Imports System.Runtime.InteropServices
Namespace Examples
Friend Class Program
<STAThread>
Shared Sub Main(ByVal args() As String)
Dim application As SolidEdgeFramework.Application = Nothing
Dim assemblyDocument As SolidEdgeAssembly.AssemblyDocument = Nothing
Dim occurrences As SolidEdgeAssembly.Occurrences = Nothing
Dim occurrence As SolidEdgeAssembly.Occurrence = Nothing
Dim relations3d As SolidEdgeAssembly.Relations3d = Nothing
Try
' See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
OleMessageFilter.Register()
' Attempt to connect to a running instance of Solid Edge.
application = DirectCast(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)
assemblyDocument = TryCast(application.ActiveDocument, SolidEdgeAssembly.AssemblyDocument)
If assemblyDocument IsNot Nothing Then
occurrences = assemblyDocument.Occurrences
For i As Integer = 1 To occurrences.Count
occurrence = occurrences.Item(i)
occurrence.RetrieveHoleLocation()
Next i
End If
Catch ex As System.Exception
Console.WriteLine(ex)
Finally
OleMessageFilter.Unregister()
End Try
End Sub
End Class
End Namespace
|
SolidEdgeCommunity/docs
|
docfx_project/snippets/SolidEdgeAssembly.Occurrence.RetrieveHoleLocation.vb
|
Visual Basic
|
mit
| 1,558
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'<summary>
' A strongly-typed resource class, for looking up localized strings, etc.
'</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'<summary>
' Returns the cached ResourceManager instance used by this class.
'</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("_03.Task3.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'<summary>
' Overrides the current thread's CurrentUICulture property for all
' resource lookups using this strongly typed resource class.
'</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set(ByVal value As Global.System.Globalization.CultureInfo)
resourceCulture = value
End Set
End Property
End Module
End Namespace
|
georgipyaramov/CSS
|
CSSOverview/CSS-Overview/03.Task3/My Project/Resources.Designer.vb
|
Visual Basic
|
mit
| 2,698
|
' Copyright 2016 Esri.
'
' Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
' You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
'
' Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
' language governing permissions and limitations under the License.
Imports Esri.ArcGISRuntime.Mapping
Imports Esri.ArcGISRuntime.Security
Imports Windows.UI.Core
Public NotInheritable Class MainPage
Inherits Page
' Constants for the public and secured map service URLs
Private Const PublicMapServiceUrl As String = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
Private Const SecureMapServiceUrl As String = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA_secure_user1/MapServer"
' Constants for the public and secured layer names
Private Const PublicLayerName As String = "World Street Map - Public"
Private Const SecureLayerName As String = "USA - Secure"
' Task completion source to track a login attempt
Private _loginTaskCompletionSource As TaskCompletionSource(Of Credential)
Public Sub New()
InitializeComponent()
' Define a method to challenge the user for credentials when a secured resource is encountered
AuthenticationManager.Current.ChallengeHandler = New ChallengeHandler(AddressOf Challenge)
' Call a function to create a map and add public and secure layers
Initialize()
End Sub
Private Sub Initialize()
' Create the public layer and provide a name
Dim publicLayer As ArcGISTiledLayer = New ArcGISTiledLayer(New Uri(PublicMapServiceUrl))
publicLayer.Name = PublicLayerName
' Set the data context for the public layer stack panel controls (to report name And load status)
PublicLayerPanel.DataContext = publicLayer
' Create the secured layer and provide a name
Dim tokenSecuredLayer As ArcGISMapImageLayer = New ArcGISMapImageLayer(New Uri(SecureMapServiceUrl))
tokenSecuredLayer.Name = SecureLayerName
' Set the data context for the secure layer stack panel controls (to report name and load status)
SecureLayerPanel.DataContext = tokenSecuredLayer
' Create a new map and add the layers
Dim myMap As Map = New Map()
myMap.OperationalLayers.Add(publicLayer)
myMap.OperationalLayers.Add(tokenSecuredLayer)
' Add the map to the map view
MyMapView.Map = myMap
End Sub
Private Async Function Challenge(info As CredentialRequestInfo) As Task(Of Credential)
' Call code to get user credentials
' Make sure it runs on the UI thread
If Me.Dispatcher Is Nothing Then
' No current dispatcher, code is already running on the UI thread
Return Await GetUserCredentialsFromUI(info)
Else
' Use the dispatcher to invoke the challenge UI
Await Me.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
Async Sub()
Try
Await GetUserCredentialsFromUI(info)
Catch
' Login was canceled or unsuccessful, dialog will close
End Try
End Sub)
End If
' Use the task completion source to return the results
Return Await _loginTaskCompletionSource.Task
End Function
Private Async Function GetUserCredentialsFromUI(info As CredentialRequestInfo) As Task(Of Credential)
' Show the login UI
Try
' Create a New LoginInfo to store the entered username And password
' Pass the CredentialRequestInfo object so the resource URI can be stored
Dim loginInputInfo As LoginInfo = New LoginInfo(info)
' Set the login UI data context with the LoginInfo
loginPanel.DataContext = loginInputInfo
' Show the login UI
loginPanel.Visibility = Visibility.Visible
' Create a new task completion source to return the user's login when complete
' Set the login UI data context (LoginInfo object) as the AsyncState so it can be retrieved later
_loginTaskCompletionSource = New TaskCompletionSource(Of Credential)(loginPanel.DataContext)
' Return the task from the completion source
' When the login button on the UI is clicked, the info will be returned for creating the credential
Return Await _loginTaskCompletionSource.Task
Finally
' Hide the login UI
loginPanel.Visibility = Visibility.Collapsed
End Try
End Function
' Handle the click event for the login button on the login UI
Private Async Sub LoginButtonClick(sender As Object, e As RoutedEventArgs)
' Make sure there's a task completion source for the login operation
If _loginTaskCompletionSource Is Nothing Or
_loginTaskCompletionSource.Task Is Nothing Or
_loginTaskCompletionSource.Task.AsyncState Is Nothing Then
Return
End If
' Get the login info from the task completion source
Dim loginEntry As LoginInfo = TryCast(_loginTaskCompletionSource.Task.AsyncState, LoginInfo)
Try
' Create a token credential using the provided username and password
Dim userCredentials As TokenCredential = Await AuthenticationManager.Current.GenerateCredentialAsync(New Uri(loginEntry.ServiceUrl),
loginEntry.UserName,
loginEntry.Password,
loginEntry.RequestInfo.GenerateTokenOptions)
' Set the result on the task completion source
_loginTaskCompletionSource.TrySetResult(userCredentials)
Catch ex As Exception
' Show exceptions on the login UI
loginEntry.ErrorMessage = ex.Message
' Increment the login attempt count
loginEntry.AttemptCount += 1
' Set an exception on the login task completion source after three login attempts
If (loginEntry.AttemptCount >= 3) Then
' This causes the login attempt to fail
_loginTaskCompletionSource.TrySetException(New Exception("Exceeded the number of allowed login attempts"))
End If
End Try
End Sub
End Class
' A helper class to hold information about a network credential
Friend Class LoginInfo
Implements INotifyPropertyChanged
' Credential request information (from the challenge handler)
Private _requestInfo As CredentialRequestInfo
Public Property RequestInfo As CredentialRequestInfo
Get
Return _requestInfo
End Get
Set
_requestInfo = Value
OnPropertyChanged()
End Set
End Property
' URL of the secure resource
Private _serviceUrl As String
Public Property ServiceUrl As String
Get
Return _serviceUrl
End Get
Set
_serviceUrl = Value
OnPropertyChanged()
End Set
End Property
' User name for the credential
Private _userName As String
Public Property UserName As String
Get
Return _userName
End Get
Set
_userName = Value
OnPropertyChanged()
End Set
End Property
' Password for the credential
Private _password As String
Public Property Password As String
Get
Return _password
End Get
Set
_password = Value
OnPropertyChanged()
End Set
End Property
' Login error messages
Private _errorMessage As String
Public Property ErrorMessage As String
Get
Return _errorMessage
End Get
Set
_errorMessage = Value
OnPropertyChanged()
End Set
End Property
' Number of login attempts
Private _attemptCount As Integer
Public Property AttemptCount As Integer
Get
Return _attemptCount
End Get
Set
_attemptCount = Value
OnPropertyChanged()
End Set
End Property
Public Sub New(info As CredentialRequestInfo)
' Store the request info
RequestInfo = info
' Build the service URL from the request info
ServiceUrl = RequestInfo.ServiceUri.AbsoluteUri
' Login info is empty by default, will be populated by the user
UserName = String.Empty
Password = String.Empty
ErrorMessage = String.Empty
AttemptCount = 0
End Sub
' Raise an event when properties change to make sure data bindings are updated
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Private Sub OnPropertyChanged(<CallerMemberName> Optional propertyName As String = Nothing)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName))
End Sub
End Class
|
Arc3D/arcgis-runtime-samples-dotnet
|
src/UWP/ArcGISRuntime.UWP.Samples/Samples/Security/TokenSecuredChallengeVB/TokenSecuredChallengeVB.xaml.vb
|
Visual Basic
|
apache-2.0
| 9,582
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.Demos.WPF.VisualBasic.GanttChartDataGrid.BuiltInScales.MySettings
Get
Return Global.Demos.WPF.VisualBasic.GanttChartDataGrid.BuiltInScales.MySettings.Default
End Get
End Property
End Module
End Namespace
|
DlhSoftTeam/GanttChartLightLibrary-Demos
|
GanttChartLightLibraryDemos/Demos/Samples/WPF-VisualBasic/GanttChartDataGrid/BuiltInScales/My Project/Settings.Designer.vb
|
Visual Basic
|
mit
| 2,897
|
Imports System, System.Collections.Generic, System.ComponentModel
Imports NUnit.Framework, Foq.Linq
<TestFixture>
Public Class Tests
<Test>
Public Sub TestSetupFunc()
Dim list =
New Mock(Of IList(Of Integer))() _
.SetupFunc(Function(mock) mock.Contains(1)).Returns(True) _
.Create()
Assert.AreEqual(True, list.Contains(1))
End Sub
<Test>
Public Sub TestSetupFuncWithAnyIntegerArgument()
Dim list =
New Mock(Of IList(Of Integer))() _
.SetupFunc(Function(mock) mock.Contains(It.IsAny(Of Integer)())).Returns(True) _
.Create()
Assert.AreEqual(True, list.Contains(1))
End Sub
<Test>
Public Sub TestSetupFuncWithLambdaArgument()
Dim list =
New Mock(Of IList(Of Integer))() _
.SetupFunc(Function(mock) mock.Contains(It.Is(Of Integer)(Function(x) x >= 0))).Returns(True) _
.Create()
Assert.AreEqual(True, list.Contains(1))
Assert.AreEqual(False, list.Contains(-1))
End Sub
<Test>
Public Sub TestSetupFuncWithAReturnsLambda()
Dim list =
New Mock(Of IList(Of Integer))() _
.SetupFunc(Function(mock) mock.Contains(1)).Returns(Function() True) _
.Create()
Assert.AreEqual(True, list.Contains(1))
End Sub
<Test>
Public Sub TestSetupSub()
Dim list =
New Mock(Of IList(Of Integer))() _
.SetupSub(Sub(mock) mock.Add(1)).Raises(Of ApplicationException) _
.Create()
Assert.Throws(Of ApplicationException)(Sub() list.Add(1))
End Sub
<Test>
Public Sub TestSetupPropertyGet()
Dim list =
New Mock(Of IList(Of Integer))() _
.SetupPropertyGet(Function(mock) mock.Count).Returns(1) _
.Create()
Assert.AreEqual(1, list.Count)
End Sub
<Test>
Public Sub TestSetupPropertyIndexer()
Dim list =
New Mock(Of IList(Of Integer))() _
.SetupPropertyGet(Function(mock) mock(1)).Returns(1) _
.Create()
Assert.AreEqual(1, list(1))
End Sub
<Test>
Public Sub TestSetupEvent()
Dim e = New Microsoft.FSharp.Control.FSharpEvent(Of PropertyChangedEventHandler, PropertyChangedEventArgs)()
Dim instance =
New Mock(Of INotifyPropertyChanged)() _
.SetupEvent("PropertyChanged").Publishes(e.Publish) _
.Create()
Dim triggered = False
AddHandler instance.PropertyChanged, Sub() triggered = True
e.Trigger(Me, New PropertyChangedEventArgs("Name"))
Assert.AreEqual(True, triggered)
End Sub
<Test>
Public Sub TestExpectSub()
Dim list = Mock.Of(Of IList(Of Integer))()
Mock.ExpectSub(Sub() list.Add(1), Times.Once)
list.Add(1)
End Sub
<Test>
Public Sub TestVerifySub()
Dim list = Mock.Of(Of IList(Of Integer))()
list.Add(1)
Mock.Verify(Sub() list.Add(1))
End Sub
<Test>
Public Sub TestExpectFunc()
Dim list = Mock.Of(Of IList(Of Integer))()
Mock.Expect(Function() list.Contains(1), Times.Once)
list.Contains(1)
End Sub
<Test>
Public Sub TestVerifyFunc()
Dim list = Mock.Of(Of IList(Of Integer))()
list.Contains(1)
Mock.Verify(Function() list.Contains(1))
End Sub
<Test>
Public Sub TestVerifyPropertyGet()
Dim list = Mock.Of(Of IList(Of Integer))()
Dim count = list.Count
Mock.VerifyPropertyGet(Function() list.Count)
End Sub
<Test>
Public Sub TestSetupProperties()
Dim list =
New Mock(Of IList(Of Integer))() _
.SetupProperties(New With {.Count = 1}) _
.Create()
Assert.AreEqual(1, list.Count)
End Sub
Public Interface IOrder
Property Price() As Decimal
Property Quantity() As Integer
End Interface
<Test>
Public Sub TestSetupPropertiesTwo()
Dim order =
New Mock(Of IOrder)() _
.SetupProperties(New With {.Price = 9.99D, .Quantity = 10}) _
.Create()
Assert.AreEqual(9.99, order.Price)
Assert.AreEqual(10, order.Quantity)
End Sub
<Test>
Public Sub TestExpectPropertySet()
Dim order = Mock.Of(Of IOrder)()
Mock.ExpectPropertySet(Function() order.Price, Times.Once)
order.Price = 1
End Sub
<Test>
Public Sub TestVerifyPropertySet()
Dim order = Mock.Of(Of IOrder)()
order.Price = 1
Mock.VerifyPropertySet(Function() order.Price)
End Sub
End Class
|
ptrelford/Foq
|
Tests/Tests.VisualBasic/Tests.vb
|
Visual Basic
|
apache-2.0
| 4,874
|
Imports FakeItEasy
Imports FakeItEasy.Examples.ExampleObjects
Public Class AssertingCalls
Public Sub Asserting_a_sub_using_lambda()
Dim widget = A.Fake(Of IWidget)()
A.CallTo(Sub() widget.Repair()).MustHaveHappened()
End Sub
Public Sub Asserting_a_function_using_lambda()
Dim factory = A.Fake(Of IWidgetFactory)()
A.CallTo(Function() factory.CreateWithColor(A(Of String).Ignored)).MustHaveHappened()
End Sub
Public Sub Asserting_ordered_function_calls()
Dim factory = A.Fake(Of IWidgetFactory)()
A.CallTo(Function() factory.CreateWithColor(A(Of String).Ignored)).MustHaveHappened() _
.Then(A.CallTo(Function() factory.CreateWithColor("orange")).MustHaveHappened())
End Sub
End Class
|
blairconrad/FakeItEasy
|
samples/FakeItEasy.Examples.VB/AssertingCalls.vb
|
Visual Basic
|
mit
| 799
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.ComponentModel.Composition.Hosting
Imports Microsoft.CodeAnalysis.Editor.UnitTests.SignatureHelp
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.SignatureHelp
Public Class RaiseEventStatementSignatureHelpProviderTests
Inherits AbstractVisualBasicSignatureHelpProviderTests
Public Sub New(workspaceFixture As VisualBasicTestWorkspaceFixture)
MyBase.New(workspaceFixture)
End Sub
Friend Overrides Function CreateSignatureHelpProvider() As ISignatureHelpProvider
Return New RaiseEventStatementSignatureHelpProvider()
End Function
#Region "Regular tests"
<WpfFact, Trait(Traits.Feature, Traits.Features.SignatureHelp)>
Public Sub TestRaiseEvent()
Dim markup = <a><![CDATA[
Class C
Event E(i As Integer, s As String)
Sub M()
RaiseEvent [|E($$
|]End Sub
End Class
]]></a>.Value
Dim expectedOrderedItems As New List(Of SignatureHelpTestItem) From {
New SignatureHelpTestItem("C.E(i As Integer, s As String)", String.Empty, String.Empty, currentParameterIndex:=0)
}
Test(markup, expectedOrderedItems)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.SignatureHelp)>
Public Sub TestRaiseEvent_NoDerivedEvents()
Dim markup = <a><![CDATA[
Class B
Event E1(i As Integer, s As String)
End Class
Class C
Inherits B
Event E2(i As Integer, s As String)
Sub M()
RaiseEvent E1($$
End Sub
End Class
]]></a>.Value
Dim expectedOrderedItems As New List(Of SignatureHelpTestItem)
Test(markup, expectedOrderedItems)
End Sub
<WorkItem(543558)>
<WpfFact, Trait(Traits.Feature, Traits.Features.SignatureHelp)>
Public Sub TestRaiseEvent_Shared()
Dim markup = <a><![CDATA[
Class C
Shared Event E(i As Integer, s As String)
Shared Sub M()
RaiseEvent E($$
End Sub
End Class
]]></a>.Value
Dim expectedOrderedItems As New List(Of SignatureHelpTestItem) From {
New SignatureHelpTestItem("C.E(i As Integer, s As String)", String.Empty, String.Empty, currentParameterIndex:=0)
}
Test(markup, expectedOrderedItems)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.SignatureHelp)>
Public Sub TestRaiseEvent_NoInstanceInSharedContext()
Dim markup = <a><![CDATA[
Class C
Event E(i As Integer, s As String)
Shared Sub M()
RaiseEvent E($$
End Sub
End Class
]]></a>.Value
Dim expectedOrderedItems As New List(Of SignatureHelpTestItem)
Test(markup, expectedOrderedItems)
End Sub
#End Region
End Class
End Namespace
|
jbhensley/roslyn
|
src/EditorFeatures/VisualBasicTest/SignatureHelp/RaiseEventStatementSignatureHelpProviderTests.vb
|
Visual Basic
|
apache-2.0
| 3,086
|
'*********************************************************
'
' Copyright (c) Microsoft. All rights reserved.
' This code is licensed under the MIT License (MIT).
' THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
' ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
' IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
' PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
'
'*********************************************************
Imports System
Imports System.Collections.Generic
Imports Windows.UI.Core
Imports Windows.UI.Xaml
Imports Windows.UI.Xaml.Controls
Imports Windows.UI.Xaml.Data
Imports Windows.UI.Xaml.Media
Imports Windows.UI.Xaml.Navigation
Namespace Global.SDKTemplate
''' <summary>
''' An empty page that can be used on its own or navigated to within a Frame.
''' </summary>
Partial Public NotInheritable Class MainPage
Inherits Page
Public Shared Current As MainPage
Public Sub New()
Me.InitializeComponent()
Current = Me
SampleTitle.Text = FEATURE_NAME
End Sub
Protected Overrides Sub OnNavigatedTo(e As NavigationEventArgs)
ScenarioControl.ItemsSource = scenarios
If Window.Current.Bounds.Width < 640 Then
ScenarioControl.SelectedIndex = -1
Else
ScenarioControl.SelectedIndex = 0
End If
End Sub
''' <summary>
''' Called whenever the user changes selection in the scenarios list. This method will navigate to the respective
''' sample scenario page.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub ScenarioControl_SelectionChanged(sender As Object, e As SelectionChangedEventArgs)
NotifyUser([String].Empty, NotifyType.StatusMessage)
Dim scenarioListBox As ListBox = TryCast(sender, ListBox)
Dim s As Scenario = TryCast(scenarioListBox.SelectedItem, Scenario)
If s IsNot Nothing Then
ScenarioFrame.Navigate(s.ClassType)
If Window.Current.Bounds.Width < 640 Then
Splitter.IsPaneOpen = False
End If
End If
End Sub
''' <summary>
''' Display a message to the user.
''' This method may be called from any thread.
''' </summary>
''' <param name="strMessage"></param>
''' <param name="type"></param>
Public Sub NotifyUser(strMessage As String, type As NotifyType)
''' If called from the UI thread, then update immediately.
''' Otherwise, schedule a task on the UI thread to perform the update.
If Dispatcher.HasThreadAccess
UpdateStatus(strMessage, type)
Else
Dim task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, Sub() UpdateStatus(strMessage, type))
End If
End Sub
Private Sub UpdateStatus(strMessage As String, type As NotifyType)
Select Case type
Case NotifyType.StatusMessage
StatusBorder.Background = New SolidColorBrush(Windows.UI.Colors.Green)
Case NotifyType.ErrorMessage
StatusBorder.Background = New SolidColorBrush(Windows.UI.Colors.Red)
End Select
StatusBlock.Text = strMessage
StatusBorder.Visibility = If((StatusBlock.Text <> [String].Empty), Visibility.Visible, Visibility.Collapsed)
If StatusBlock.Text <> [String].Empty Then
StatusBorder.Visibility = Visibility.Visible
StatusPanel.Visibility = Visibility.Visible
Else
StatusBorder.Visibility = Visibility.Collapsed
StatusPanel.Visibility = Visibility.Collapsed
End If
End Sub
Async Sub Footer_Click(sender As Object, e As RoutedEventArgs)
Await Windows.System.Launcher.LaunchUriAsync(New Uri((CType(sender, HyperlinkButton)).Tag.ToString()))
End Sub
Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
Splitter.IsPaneOpen = Not Splitter.IsPaneOpen
End Sub
End Class
Public Enum NotifyType
StatusMessage
ErrorMessage
End Enum
Public Class ScenarioBindingConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, language As String) As Object Implements IValueConverter.Convert
Dim s As Scenario = TryCast(value, Scenario)
Return (MainPage.Current.scenarios.IndexOf(s) + 1) & ") " & s.Title
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, language As String) As Object Implements IValueConverter.ConvertBack
Return True
End Function
End Class
End Namespace
|
Microsoft/Windows-universal-samples
|
SharedContent/vb/MainPage.xaml.vb
|
Visual Basic
|
mit
| 4,954
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Threading
Imports Microsoft.CodeAnalysis.Completion.Providers
Imports Microsoft.CodeAnalysis.VisualBasic.Extensions.ContextQuery
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.KeywordRecommenders.Expressions
''' <summary>
''' Recommends the "With" keyword when used in a New syntax (such as New goo With)
''' </summary>
Friend Class WithKeywordRecommender
Inherits AbstractKeywordRecommender
Protected Overrides Function RecommendKeywords(context As VisualBasicSyntaxContext, cancellationToken As CancellationToken) As IEnumerable(Of RecommendedKeyword)
If context.FollowsEndOfStatement Then
Return SpecializedCollections.EmptyEnumerable(Of RecommendedKeyword)()
End If
Dim token = context.TargetToken
If token.IsChildToken(Of AsNewClauseSyntax)(Function(asNewClause) asNewClause.NewExpression.NewKeyword) OrElse
token.IsFollowingCompleteAsNewClause() OrElse
token.IsChildToken(Of ObjectCreationExpressionSyntax)(Function(objectCreation) objectCreation.NewKeyword) OrElse
token.IsFollowingCompleteObjectCreation() Then
Return SpecializedCollections.SingletonEnumerable(New RecommendedKeyword("With",
VBFeaturesResources.Specifies_the_declaration_of_property_initializations_in_an_object_initializer_New_typeName_With_bracket_property_expression_bracket_bracket_bracket))
End If
Return SpecializedCollections.EmptyEnumerable(Of RecommendedKeyword)()
End Function
End Class
End Namespace
|
VSadov/roslyn
|
src/Features/VisualBasic/Portable/Completion/KeywordRecommenders/Expressions/WithKeywordRecommender.vb
|
Visual Basic
|
apache-2.0
| 1,911
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> Partial Class frmSetItem
#Region "Windows Form Designer generated code "
<System.Diagnostics.DebuggerNonUserCode()> Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
End Sub
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
If Disposing Then
If Not components Is Nothing Then
components.Dispose()
End If
End If
MyBase.Dispose(Disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
Public ToolTip1 As System.Windows.Forms.ToolTip
Public WithEvents _cmdClick_1 As System.Windows.Forms.Button
Public WithEvents _cmdClick_2 As System.Windows.Forms.Button
Public WithEvents _cmdClick_3 As System.Windows.Forms.Button
Public WithEvents cmdExit As System.Windows.Forms.Button
Public WithEvents lstStockItem As System.Windows.Forms.CheckedListBox
Public WithEvents txtSearch As System.Windows.Forms.TextBox
Public WithEvents _tbStockItem_Button1 As System.Windows.Forms.ToolStripButton
Public WithEvents _tbStockItem_Button2 As System.Windows.Forms.ToolStripButton
Public WithEvents _tbStockItem_Button3 As System.Windows.Forms.ToolStripButton
Public WithEvents tbStockItem As System.Windows.Forms.ToolStrip
Public WithEvents ilSelect As System.Windows.Forms.ImageList
Public WithEvents lblHeading As System.Windows.Forms.Label
Public WithEvents _lbl_2 As System.Windows.Forms.Label
'Public WithEvents cmdClick As Microsoft.VisualBasic.Compatibility.VB6.ButtonArray
'Public WithEvents lbl As Microsoft.VisualBasic.Compatibility.VB6.LabelArray
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmSetItem))
Me.components = New System.ComponentModel.Container()
Me.ToolTip1 = New System.Windows.Forms.ToolTip(components)
Me._cmdClick_1 = New System.Windows.Forms.Button
Me._cmdClick_2 = New System.Windows.Forms.Button
Me._cmdClick_3 = New System.Windows.Forms.Button
Me.cmdExit = New System.Windows.Forms.Button
Me.lstStockItem = New System.Windows.Forms.CheckedListBox
Me.txtSearch = New System.Windows.Forms.TextBox
Me.tbStockItem = New System.Windows.Forms.ToolStrip
Me._tbStockItem_Button1 = New System.Windows.Forms.ToolStripButton
Me._tbStockItem_Button2 = New System.Windows.Forms.ToolStripButton
Me._tbStockItem_Button3 = New System.Windows.Forms.ToolStripButton
Me.ilSelect = New System.Windows.Forms.ImageList
Me.lblHeading = New System.Windows.Forms.Label
Me._lbl_2 = New System.Windows.Forms.Label
'Me.cmdClick = New Microsoft.VisualBasic.Compatibility.VB6.ButtonArray(components)
'Me.lbl = New Microsoft.VisualBasic.Compatibility.VB6.LabelArray(components)
Me.tbStockItem.SuspendLayout()
Me.SuspendLayout()
Me.ToolTip1.Active = True
'CType(Me.cmdClick, System.ComponentModel.ISupportInitialize).BeginInit()
'CType(Me.lbl, System.ComponentModel.ISupportInitialize).BeginInit()
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.Text = "Allocate Stock Items to Set"
Me.ClientSize = New System.Drawing.Size(232, 458)
Me.Location = New System.Drawing.Point(3, 22)
Me.ControlBox = False
Me.KeyPreview = True
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.SystemColors.Control
Me.Enabled = True
Me.Cursor = System.Windows.Forms.Cursors.Default
Me.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.HelpButton = False
Me.WindowState = System.Windows.Forms.FormWindowState.Normal
Me.Name = "frmSetItem"
Me._cmdClick_1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdClick_1.Text = "&A"
Me._cmdClick_1.Size = New System.Drawing.Size(103, 34)
Me._cmdClick_1.Location = New System.Drawing.Point(303, 162)
Me._cmdClick_1.TabIndex = 8
Me._cmdClick_1.TabStop = False
Me._cmdClick_1.BackColor = System.Drawing.SystemColors.Control
Me._cmdClick_1.CausesValidation = True
Me._cmdClick_1.Enabled = True
Me._cmdClick_1.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdClick_1.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdClick_1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdClick_1.Name = "_cmdClick_1"
Me._cmdClick_2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdClick_2.Text = "&S"
Me._cmdClick_2.Size = New System.Drawing.Size(103, 34)
Me._cmdClick_2.Location = New System.Drawing.Point(306, 210)
Me._cmdClick_2.TabIndex = 7
Me._cmdClick_2.TabStop = False
Me._cmdClick_2.BackColor = System.Drawing.SystemColors.Control
Me._cmdClick_2.CausesValidation = True
Me._cmdClick_2.Enabled = True
Me._cmdClick_2.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdClick_2.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdClick_2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdClick_2.Name = "_cmdClick_2"
Me._cmdClick_3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdClick_3.Text = "&U"
Me._cmdClick_3.Size = New System.Drawing.Size(103, 34)
Me._cmdClick_3.Location = New System.Drawing.Point(297, 261)
Me._cmdClick_3.TabIndex = 6
Me._cmdClick_3.TabStop = False
Me._cmdClick_3.BackColor = System.Drawing.SystemColors.Control
Me._cmdClick_3.CausesValidation = True
Me._cmdClick_3.Enabled = True
Me._cmdClick_3.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdClick_3.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdClick_3.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdClick_3.Name = "_cmdClick_3"
Me.cmdExit.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me.cmdExit.Text = "E&xit"
Me.cmdExit.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(178, Byte))
Me.cmdExit.Size = New System.Drawing.Size(97, 52)
Me.cmdExit.Location = New System.Drawing.Point(126, 393)
Me.cmdExit.TabIndex = 4
Me.cmdExit.TabStop = False
Me.cmdExit.BackColor = System.Drawing.SystemColors.Control
Me.cmdExit.CausesValidation = True
Me.cmdExit.Enabled = True
Me.cmdExit.ForeColor = System.Drawing.SystemColors.ControlText
Me.cmdExit.Cursor = System.Windows.Forms.Cursors.Default
Me.cmdExit.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.cmdExit.Name = "cmdExit"
Me.lstStockItem.Size = New System.Drawing.Size(214, 304)
Me.lstStockItem.Location = New System.Drawing.Point(9, 81)
Me.lstStockItem.Sorted = True
Me.lstStockItem.TabIndex = 1
Me.lstStockItem.Tag = "0"
Me.lstStockItem.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.lstStockItem.BackColor = System.Drawing.SystemColors.Window
Me.lstStockItem.CausesValidation = True
Me.lstStockItem.Enabled = True
Me.lstStockItem.ForeColor = System.Drawing.SystemColors.WindowText
Me.lstStockItem.IntegralHeight = True
Me.lstStockItem.Cursor = System.Windows.Forms.Cursors.Default
Me.lstStockItem.SelectionMode = System.Windows.Forms.SelectionMode.One
Me.lstStockItem.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.lstStockItem.TabStop = True
Me.lstStockItem.Visible = True
Me.lstStockItem.MultiColumn = False
Me.lstStockItem.Name = "lstStockItem"
Me.txtSearch.AutoSize = False
Me.txtSearch.Size = New System.Drawing.Size(175, 19)
Me.txtSearch.Location = New System.Drawing.Point(48, 57)
Me.txtSearch.TabIndex = 0
Me.txtSearch.AcceptsReturn = True
Me.txtSearch.TextAlign = System.Windows.Forms.HorizontalAlignment.Left
Me.txtSearch.BackColor = System.Drawing.SystemColors.Window
Me.txtSearch.CausesValidation = True
Me.txtSearch.Enabled = True
Me.txtSearch.ForeColor = System.Drawing.SystemColors.WindowText
Me.txtSearch.HideSelection = True
Me.txtSearch.ReadOnly = False
Me.txtSearch.Maxlength = 0
Me.txtSearch.Cursor = System.Windows.Forms.Cursors.IBeam
Me.txtSearch.MultiLine = False
Me.txtSearch.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.txtSearch.ScrollBars = System.Windows.Forms.ScrollBars.None
Me.txtSearch.TabStop = True
Me.txtSearch.Visible = True
Me.txtSearch.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.txtSearch.Name = "txtSearch"
Me.tbStockItem.ShowItemToolTips = True
Me.tbStockItem.Size = New System.Drawing.Size(224, 40)
Me.tbStockItem.Location = New System.Drawing.Point(0, 18)
Me.tbStockItem.TabIndex = 2
Me.tbStockItem.ImageList = ilSelect
Me.tbStockItem.Name = "tbStockItem"
Me._tbStockItem_Button1.Size = New System.Drawing.Size(68, 41)
Me._tbStockItem_Button1.AutoSize = False
Me._tbStockItem_Button1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText
Me._tbStockItem_Button1.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None
Me._tbStockItem_Button1.Text = "&All"
Me._tbStockItem_Button1.Name = "All"
Me._tbStockItem_Button1.ImageIndex = 0
Me._tbStockItem_Button1.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
Me._tbStockItem_Button2.Size = New System.Drawing.Size(68, 41)
Me._tbStockItem_Button2.AutoSize = False
Me._tbStockItem_Button2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText
Me._tbStockItem_Button2.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None
Me._tbStockItem_Button2.Text = "&Selected"
Me._tbStockItem_Button2.Name = "Selected"
Me._tbStockItem_Button2.ImageIndex = 1
Me._tbStockItem_Button2.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
Me._tbStockItem_Button3.Size = New System.Drawing.Size(68, 41)
Me._tbStockItem_Button3.AutoSize = False
Me._tbStockItem_Button3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText
Me._tbStockItem_Button3.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None
Me._tbStockItem_Button3.Text = "&Unselected"
Me._tbStockItem_Button3.Name = "Unselected"
Me._tbStockItem_Button3.ImageIndex = 2
Me._tbStockItem_Button3.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
Me.ilSelect.ImageSize = New System.Drawing.Size(20, 20)
Me.ilSelect.TransparentColor = System.Drawing.Color.FromARGB(255, 0, 255)
Me.ilSelect.ImageStream = CType(resources.GetObject("ilSelect.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.ilSelect.Images.SetKeyName(0, "")
Me.ilSelect.Images.SetKeyName(1, "")
Me.ilSelect.Images.SetKeyName(2, "")
Me.lblHeading.Text = "Label1"
Me.lblHeading.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(178, Byte))
Me.lblHeading.Size = New System.Drawing.Size(226, 19)
Me.lblHeading.Location = New System.Drawing.Point(0, 0)
Me.lblHeading.TabIndex = 5
Me.lblHeading.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me.lblHeading.BackColor = System.Drawing.SystemColors.Control
Me.lblHeading.Enabled = True
Me.lblHeading.ForeColor = System.Drawing.SystemColors.ControlText
Me.lblHeading.Cursor = System.Windows.Forms.Cursors.Default
Me.lblHeading.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.lblHeading.UseMnemonic = True
Me.lblHeading.Visible = True
Me.lblHeading.AutoSize = False
Me.lblHeading.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.lblHeading.Name = "lblHeading"
Me._lbl_2.Text = "Search:"
Me._lbl_2.Size = New System.Drawing.Size(40, 13)
Me._lbl_2.Location = New System.Drawing.Point(6, 60)
Me._lbl_2.TabIndex = 3
Me._lbl_2.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me._lbl_2.BackColor = System.Drawing.Color.Transparent
Me._lbl_2.Enabled = True
Me._lbl_2.ForeColor = System.Drawing.SystemColors.ControlText
Me._lbl_2.Cursor = System.Windows.Forms.Cursors.Default
Me._lbl_2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lbl_2.UseMnemonic = True
Me._lbl_2.Visible = True
Me._lbl_2.AutoSize = False
Me._lbl_2.BorderStyle = System.Windows.Forms.BorderStyle.None
Me._lbl_2.Name = "_lbl_2"
Me.Controls.Add(_cmdClick_1)
Me.Controls.Add(_cmdClick_2)
Me.Controls.Add(_cmdClick_3)
Me.Controls.Add(cmdExit)
Me.Controls.Add(lstStockItem)
Me.Controls.Add(txtSearch)
Me.Controls.Add(tbStockItem)
Me.Controls.Add(lblHeading)
Me.Controls.Add(_lbl_2)
Me.tbStockItem.Items.Add(_tbStockItem_Button1)
Me.tbStockItem.Items.Add(_tbStockItem_Button2)
Me.tbStockItem.Items.Add(_tbStockItem_Button3)
'Me.cmdClick.SetIndex(_cmdClick_1, CType(1, Short))
'Me.cmdClick.SetIndex(_cmdClick_2, CType(2, Short))
'Me.cmdClick.SetIndex(_cmdClick_3, CType(3, Short))
'Me.lbl.SetIndex(_lbl_2, CType(2, Short))
'CType(Me.lbl, System.ComponentModel.ISupportInitialize).EndInit()
'CType(Me.cmdClick, System.ComponentModel.ISupportInitialize).EndInit()
Me.tbStockItem.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
End Class
|
nodoid/PointOfSale
|
VB/4PosBackOffice.NET/frmSetItem.Designer.vb
|
Visual Basic
|
mit
| 13,766
|
Imports System
Imports System.Collections
Imports System.Runtime.InteropServices
Imports System.Runtime.InteropServices.CustomMarshalers
Partial Public Module FirewallApi
Friend Const Lib_Firewallapi As String = "firewallapi.dll"
''' <summary>
''' The <c>PAC_CHANGES_CALLBACK_FN</c> function is used to add custom behavior to the app container change notification process.
''' </summary>
''' <param name="context">TOptional context pointer.</param>
''' <param name="pChange"/>
''' <remarks>Call NetworkIsolationRegisterForAppContainerChanges to register this callback function.</remarks>
<UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet:=CharSet.Unicode)>
<PInvokeData("netfw.h", MSDNShortId:="NC:netfw.PAC_CHANGES_CALLBACK_FN")>
Public Delegate Sub PAC_CHANGES_CALLBACK_FN(<[In], Out, [Optional]> ByVal context As IntPtr, <[In]> ByRef pChange As INET_FIREWALL_AC_CHANGE)
''' <summary>Callback used by <see cref="NetworkIsolationGetEnterpriseIdAsync"/>.</summary>
''' <param name="context">TOptional context pointer.</param>
''' <param name="wszEnterpriseId">The WSZ enterprise identifier.</param>
''' <param name="dwErr">The dw error.</param>
<UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet:=CharSet.Unicode)>
<PInvokeData("netfw.h", MSDNShortId:="NC:netfw.PAC_CHANGES_CALLBACK_FN")>
Public Delegate Sub PNETISO_EDP_ID_CALLBACK_FN(<[In], Out, [Optional]> ByVal context As IntPtr, <[In], [Optional], MarshalAs(UnmanagedType.LPWStr)> ByVal wszEnterpriseId As String, ByVal dwErr As Win32Error)
''' <summary>
''' The <c>INET_FIREWALL_AC_CREATION_TYPE</c> enumeration specifies the type of app container creation events for which notifications
''' will be delivered.
''' </summary>
<PInvokeData("netfw.h", MSDNShortId:="NE:netfw._INET_FIREWALL_AC_CREATION_TYPE")>
<Flags>
Public Enum INET_FIREWALL_AC_CREATION_TYPE
''' <summary>This value is reserved for system use.</summary>
INET_FIREWALL_AC_NONE = &H0
''' <summary>Notifications will be delivered when an app container is created with a package identifier.</summary>
INET_FIREWALL_AC_PACKAGE_ID_ONLY = &H1
''' <summary>Notifications will be delivered when an app container is created with a binary path.</summary>
INET_FIREWALL_AC_BINARY = &H2
''' <summary>Maximum value for testing purposes.</summary>
INET_FIREWALL_AC_MAX = &H4
End Enum
''' <summary>The <c>NETISO_ERROR_TYPE</c> enumerated type specifies the type of error related to a network isolation operation.</summary>
<PInvokeData("netfw.h", MSDNShortId:="NE:netfw._NETISO_ERROR_TYPE")>
Public Enum NETISO_ERROR_TYPE
''' <summary>No error.</summary>
NETISO_ERROR_TYPE_NONE
''' <summary>The failure was caused because the privateNetworkClientServer capability is missing.</summary>
NETISO_ERROR_TYPE_PRIVATE_NETWORK
''' <summary>The failure was caused because the internetClient capability is missing.</summary>
NETISO_ERROR_TYPE_INTERNET_CLIENT
''' <summary>The failure was caused because the internetClientServer capability is missing.</summary>
NETISO_ERROR_TYPE_INTERNET_CLIENT_SERVER
''' <summary>Maximum value for testing purposes.</summary>
NETISO_ERROR_TYPE_MAX
End Enum
''' <summary>The <c>NETISO_FLAG</c> enumerated type specifies whether binaries should be returned for app containers.</summary>
''' <remarks>
''' By default, binaries are not returned. <c>NETISO_FLAG_FORCE_COMPUTE_BINARIES</c> must be set in order for these to be returned.
''' </remarks>
<PInvokeData("netfw.h", MSDNShortId:="NE:netfw.NETISO_FLAG")>
<Flags>
Public Enum NETISO_FLAG
''' <summary>
''' Specifies that all binaries will be computed before the app container is returned.This flag should be set if the caller requires
''' up-to-date and complete information on app container binaries. If this flag is not set, returned data may be stale or incomplete.
''' </summary>
NETISO_FLAG_FORCE_COMPUTE_BINARIES = &H1
''' <summary>Maximum value for testing purposes.</summary>
NETISO_FLAG_MAX = &H2
End Enum
''' <summary>A bitmask value of control flags which specify the context of <see cref="NetworkIsolationGetEnterpriseIdAsync"/>.</summary>
<PInvokeData("netfw.h", MSDNShortId:="NF:netfw.NetworkIsolationGetEnterpriseIdAsync")>
Public Enum NETISO_GEID
''' <summary>
''' Default API behavior. Returns the Enterprise ID for Enterprise resources. Returns NULL for Personal resources. For Neutral
''' resources, returns Enterprise ID if it is called from an Enterprise context, or returns NULL if it is called from a Personal context.
''' </summary>
NETISO_GEID_DEFAULT = &H0
''' <summary>Used in the context of the Windows Defender Application Guard (WDAG) scenario.</summary>
NETISO_GEID_FOR_WDAG = &H1
''' <summary>
''' Used by applications that are aware of neutral resources. For Neutral resources the API will return L”*”. For Enterprise
''' resources the API will return the Enterprise ID. For Personal resources the API will return NULL.
''' </summary>
NETISO_GEID_FOR_NEUTRAL_AWARE = &H2
''' <summary>
''' Forces API to check the resource even in cases when neither Windows Information Protection nor Windows Defender Application
''' Guard are enabled.
''' </summary>
NETISO_GEID_FORCE_TO_CHECK = &H4
End Enum
''' <summary>
''' The <c>NetworkIsolationEnumAppContainers</c> function enumerates all of the app containers that have been created in the system.
''' </summary>
''' <param name="Flags">
''' <para>Type: <c>DWORD</c></para>
''' <para>
''' May be set to <c>NETISO_FLAG_FORCE_COMPUTE_BINARIES</c> to ensure that all binaries are computed before the app container is
''' returned. This flag should be set if the caller requires up-to-date and complete information on app container binaries. If this flag
''' is not set, returned data may be stale or incomplete.
''' </para>
''' <para>See NETISO_FLAG for more information.</para>
''' </param>
''' <param name="pdwNumPublicAppCs">
''' <para>Type: <c>DWORD*</c></para>
''' <para>The number of app containers in the <c>ppPublicAppCs</c> member.</para>
''' </param>
''' <param name="ppPublicAppCs">
''' <para>Type: <c>PINET_FIREWALL_APP_CONTAINER*</c></para>
''' <para>The list of app container structure elements.</para>
''' </param>
''' <returns>
''' <para>Type: <c>DWORD</c></para>
''' <para>Returns ERROR_SUCCESS if successful, or an error value otherwise.</para>
''' <para>ERROR_OUTOFMEMORY will be returned if memory is unavailable.</para>
''' </returns>
''' <remarks>If no app containers are installed on the system, ERROR_SUCCESS will still be returned (and ppPublicAppCs will be empty).</remarks>
<DllImport(Lib_Firewallapi, SetLastError:=False, ExactSpelling:=True)>
<PInvokeData("netfw.h", MSDNShortId:="NF:netfw.NetworkIsolationEnumAppContainers")>
Public Function NetworkIsolationEnumAppContainers(ByVal Flags As NETISO_FLAG, <Out> ByRef pdwNumPublicAppCs As UInteger, <Out> ByRef ppPublicAppCs As IntPtr) As Win32Error
End Function
''' <summary>The <c>NetworkIsolationEnumerateAppContainerRules</c> function enumerates all of the rules related to app containers.</summary>
''' <param name="newEnum">
''' <para>Type: <c>IEnumVARIANT**</c></para>
''' <para>Enumerator interface of an INetFwRule3 object that represents the rules enforcing app containers.</para>
''' </param>
''' <returns>
''' <para>Type: <c>HRESULT</c></para>
''' <para>If this function succeeds, it returns <c>S_OK</c>. Otherwise, it returns an <c>HRESULT</c> error code.</para>
''' </returns>
<DllImport(Lib_Firewallapi, SetLastError:=False, ExactSpelling:=True)>
<PInvokeData("netfw.h", MSDNShortId:="NF:netfw.NetworkIsolationEnumerateAppContainerRules")>
Public Function NetworkIsolationEnumerateAppContainerRules(<Out, MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef:=GetType(EnumeratorToEnumVariantMarshaler), MarshalCookie:="")> ByRef newEnum As IEnumerable) As HRESULT
End Function
''' <summary>
''' <para>
''' Gets the Enterprise ID based on Network Isolation endpoints in the context of the Windows Information Protection (WIP) or the
''' Windows Defender Application Guard (WDAG) scenarios. If neither WIP nor WDAG are on, the API returns NULL, unless the flag
''' <c>NETISO_GEID_FORCE_TO_CHECK</c> is passed. The Enterprise ID can be any string different from NULL or “*”.
''' </para>
''' <para>Example of NetworkIsolationGetEnterpriseIdAsync usage: https://github.com/microsoft/EnterpriseStateClassify</para>
''' </summary>
''' <param name="wszServerName">The name of the Enterprise Data Protection Server.</param>
''' <param name="dwFlags">
''' <para>A bitmask value of control flags which specify the context of the API call. May contain one or more of the following flags.</para>
''' <list type="table">
''' <listheader>
''' <term>Value</term>
''' <term>Meaning</term>
''' </listheader>
''' <item>
''' <term>NETISO_GEID_DEFAULT 0x00</term>
''' <term>
''' Default API behavior. Returns the Enterprise ID for Enterprise resources. Returns NULL for Personal resources. For Neutral
''' resources, returns Enterprise ID if it is called from an Enterprise context, or returns NULL if it is called from a Personal context.
''' </term>
''' </item>
''' <item>
''' <term>NETISO_GEID_FOR_WDAG 0x01</term>
''' <term>Used in the context of the Windows Defender Application Guard (WDAG) scenario.</term>
''' </item>
''' <item>
''' <term>NETISO_GEID_FOR_NEUTRAL_AWARE 0x02</term>
''' <term>
''' Used by applications that are aware of neutral resources. For Neutral resources the API will return L”*”. For Enterprise resources
''' the API will return the Enterprise ID. For Personal resources the API will return NULL.
''' </term>
''' </item>
''' <item>
''' <term>NETISO_GEID_FORCE_TO_CHECK 0x04</term>
''' <term>
''' Forces API to check the resource even in cases when neither Windows Information Protection nor Windows Defender Application Guard
''' are enabled.
''' </term>
''' </item>
''' </list>
''' </param>
''' <param name="context">Optional context pointer.</param>
''' <param name="callback">Function pointer that will be invoked when a notification is ready for delivery.</param>
''' <param name="hOperation">The handle for the Enterprise Data Protection Server endpoints.</param>
''' <returns>Returns ERROR_SUCCESS if successful, or an error value otherwise.</returns>
<DllImport(Lib_Firewallapi, SetLastError:=False, ExactSpelling:=True)>
<PInvokeData("netfw.h", MSDNShortId:="NF:netfw.NetworkIsolationGetEnterpriseIdAsync")>
Public Function NetworkIsolationGetEnterpriseIdAsync(<MarshalAs(UnmanagedType.LPWStr)> ByVal wszServerName As String, ByVal dwFlags As NETISO_GEID,
<[In], [Optional]> ByVal context As IntPtr, ByVal callback As PNETISO_EDP_ID_CALLBACK_FN, <Out> ByRef hOperation As HANDLE) As Win32Error
End Function
''' <summary>
''' <para>
''' This API is used for closing the handle returned by NetworkIsolationGetEnterpriseIdAsync as well as for synchronizing the operation.
''' </para>
''' <para>Example of NetworkIsolationGetEnterpriseIdClose usage: https://github.com/microsoft/EnterpriseStateClassify</para>
''' </summary>
''' <param name="hOperation">The handle to release.</param>
''' <param name="bWaitForOperation">Indicates whether to wait for synchronization.</param>
''' <returns>Returns ERROR_SUCCESS if successful, or an error value otherwise.</returns>
<DllImport(Lib_Firewallapi, SetLastError:=False, ExactSpelling:=True)>
<PInvokeData("netfw.h", MSDNShortId:="NF:netfw.NetworkIsolationGetEnterpriseIdClose")>
Public Function NetworkIsolationGetEnterpriseIdClose(ByVal hOperation As HANDLE, <MarshalAs(UnmanagedType.Bool)> ByVal bWaitForOperation As Boolean) As Win32Error
End Function
''' <summary>The <c>NetworkIsolationSetAppContainerConfig</c> function is used to set the configuration of one or more app containers.</summary>
''' <param name="dwNumPublicAppCs">
''' <para>Type: <c>DWORD</c></para>
''' <para>The number of app containers in the <c>appContainerSids</c> member.</para>
''' </param>
''' <param name="appContainerSids">
''' <para>Type: <c>PSID_AND_ATTRIBUTES</c></para>
''' <para>The security identifiers (SIDs) of app containers that are allowed to send loopback traffic. Used for debugging purposes.</para>
''' </param>
''' <returns>
''' <para>Type: <c>DWORD</c></para>
''' <para>Returns ERROR_SUCCESS if successful, or an error value otherwise.</para>
''' </returns>
''' <remarks>
''' Note that it is the calling program's responsibility to first call the <c>NetworkIsolationGetAppContainerConfig</c> function in
''' order to retrieve and preserve the app container SIDs already configured to send loopback traffic.
''' </remarks>
<DllImport(Lib_Firewallapi, SetLastError:=False, ExactSpelling:=True)>
<PInvokeData("netfw.h", MSDNShortId:="NF:netfw.NetworkIsolationSetAppContainerConfig")>
Public Function NetworkIsolationSetAppContainerConfig(ByVal dwNumPublicAppCs As UInteger, <[In]> ByVal appContainerSids As IntPtr) As Win32Error
End Function
''' <summary>
''' The <c>NetworkIsolationSetupAppContainerBinaries</c> function is used by software installers to provide information about the image
''' paths of applications that are running in an app container. This information is provided to third-party firewall applications about
''' the applications in order to enhance user experience and security decisions.
''' </summary>
''' <param name="applicationContainerSid">
''' <para>Type: <c>PSID</c></para>
''' <para>The package identifier of the app container.</para>
''' </param>
''' <param name="packageFullName">
''' <para>Type: <c>LPCWSTR</c></para>
''' <para>
''' A string representing the package identity of the app that owns this app container. Contains the 5-part tuple as individual fields
''' (name, version, architecture, resourceid, publisher).
''' </para>
''' </param>
''' <param name="packageFolder">
''' <para>Type: <c>LPCWSTR</c></para>
''' <para>The file location of the app that owns this app container.</para>
''' </param>
''' <param name="displayName">
''' <para>Type: <c>LPCWSTR</c></para>
''' <para>The friendly name of the app container.</para>
''' </param>
''' <param name="bBinariesFullyComputed">
''' <para>Type: <c>BOOL</c></para>
''' <para>True if the binary files are being provided by the caller; otherwise, false.</para>
''' </param>
''' <param name="binaries">
''' <para>Type: <c>LPCWSTR*</c></para>
''' <para>An array of paths to the applications running in the app container.</para>
''' </param>
''' <param name="binariesCount">
''' <para>Type: <c>DWORD</c></para>
''' <para>The number of paths contained in the binaries parameter.</para>
''' </param>
''' <returns>
''' <para>Type: <c>HRESULT</c></para>
''' <para>If the function succeeds, it returns S_OK.</para>
''' <para>
''' If the function fails, it returns an <c>HRESULT</c> value that indicates the error. For a list of common error codes, see Common
''' HRESULT Values.
''' </para>
''' </returns>
''' <remarks>
''' Applications creating an app container can use <c>NetworkIsolationSetupAppContainerBinaries</c> to provide third-party firewall
''' applications with the direct path to applications running inside that app container.
''' </remarks>
<DllImport(Lib_Firewallapi, SetLastError:=False, ExactSpelling:=True)>
<PInvokeData("netfw.h", MSDNShortId:="NF:netfw.NetworkIsolationSetupAppContainerBinaries")>
Public Function NetworkIsolationSetupAppContainerBinaries(ByVal applicationContainerSid As PSID, <MarshalAs(UnmanagedType.LPWStr)> ByVal packageFullName As String,
<MarshalAs(UnmanagedType.LPWStr)> ByVal packageFolder As String,
<MarshalAs(UnmanagedType.LPWStr)> ByVal displayName As String,
<MarshalAs(UnmanagedType.Bool)> ByVal bBinariesFullyComputed As Boolean,
<[In], MarshalAs(UnmanagedType.LPArray, ArraySubType:=UnmanagedType.LPWStr)> ByVal binaries As String(),
ByVal binariesCount As UInteger) As HRESULT
End Function
''' <summary>The <c>INET_FIREWALL_AC_BINARIES</c> structure contains the binary paths to applications running in an app container.</summary>
<PInvokeData("netfw.h", MSDNShortId:="NS:netfw._INET_FIREWALL_AC_BINARIES")>
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure INET_FIREWALL_AC_BINARIES
''' <summary>The number of paths in the <c>binaries</c> member.</summary>
Public count As UInteger
''' <summary>Paths to the applications running in the app container.</summary>
Public binaries As IntPtr
End Structure
''' <summary>The INET_FIREWALL_AC_CHANGE structure contains information about a change made to an app container.</summary>
<PInvokeData("netfw.h", MSDNShortId:="NS:netfw._INET_FIREWALL_AC_CHANGE")>
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure INET_FIREWALL_AC_CHANGE
''' <summary>
''' <para>Type: <c>INET_FIREWALL_AC_CHANGE_TYPE</c></para>
''' <para>The type of change made.</para>
''' </summary>
Public changeType As INET_FIREWALL_AC_CHANGE_TYPE
''' <summary>
''' <para>Type: <c>INET_FIREWALL_AC_CREATION_TYPE</c></para>
''' <para>The method by which the app container was created.</para>
''' </summary>
Public createType As INET_FIREWALL_AC_CREATION_TYPE
''' <summary>
''' <para>Type: <c>SID*</c></para>
''' <para>The package identifier of the app container</para>
''' </summary>
Public appContainerSid As PSID
''' <summary>
''' <para>Type: <c>SID*</c></para>
''' <para>The security identifier (SID) of the user to whom the app container belongs.</para>
''' </summary>
Public userSid As PSID
''' <summary>
''' <para>Type: <c>LPWSTR</c></para>
''' <para>Friendly name of the app container.</para>
''' </summary>
<MarshalAs(UnmanagedType.LPWStr)>
Public displayName As String
''' <summary/>
Public union As UNIONType
''' <summary/>
<StructLayout(LayoutKind.Explicit)>
Public Structure UNIONType
''' <summary>
''' <para>Type: <c>INET_FIREWALL_AC_CAPABILITIES</c></para>
''' <para>Information about the capabilities of the changed app container.</para>
''' </summary>
<FieldOffset(0)>
Public capabilities As INET_FIREWALL_AC_CAPABILITIES
''' <summary>
''' <para>Type: <c>INET_FIREWALL_AC_BINARIES</c></para>
''' <para>Binary paths to the applications running in the changed app container.</para>
''' </summary>
<FieldOffset(0)>
Public binaries As INET_FIREWALL_AC_BINARIES
End Structure
End Structure
End Module
|
dahall/vanara
|
PInvoke/FirewallApi/NetFW.Funcs.vb
|
Visual Basic
|
mit
| 19,843
|
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
Imports System.Globalization
Imports System.Resources
Imports System.Windows
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("PrintInWpf")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("GemBox d.o.o.")>
<Assembly: AssemblyProduct("PrintInWpf")>
<Assembly: AssemblyCopyright("Copyright © GemBox d.o.o.")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(false)>
'In order to begin building localizable applications, set
'<UICulture>CultureYouAreCodingWith</UICulture> in your .vbproj file
'inside a <PropertyGroup>. For example, if you are using US english
'in your source files, set the <UICulture> to "en-US". Then uncomment the
'NeutralResourceLanguage attribute below. Update the "en-US" in the line
'below to match the UICulture setting in the project file.
'<Assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)>
'The ThemeInfo attribute describes where any theme specific and generic resource dictionaries can be found.
'1st parameter: where theme specific resource dictionaries are located
'(used if a resource is not found in the page,
' or application resource dictionaries)
'2nd parameter: where the generic resource dictionary is located
'(used if a resource is not found in the page,
'app, and any theme specific resource dictionaries)
<Assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("078e6e91-12ab-4179-aa8f-6bfada911c96")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
gemboxsoftware-dev-team/GemBox.Document.Examples
|
VB.NET/Common Uses/Print/PrintInWpf/My Project/AssemblyInfo.vb
|
Visual Basic
|
mit
| 2,252
|
Imports System
Imports System.Collections.Generic
Imports System.Runtime.InteropServices
Namespace Examples
Friend Class Program
<STAThread>
Shared Sub Main(ByVal args() As String)
Dim application As SolidEdgeFramework.Application = Nothing
Dim documents As SolidEdgeFramework.Documents = Nothing
Dim partDocument As SolidEdgePart.PartDocument = Nothing
Dim refPlanes As SolidEdgePart.RefPlanes = Nothing
Dim profileSets As SolidEdgePart.ProfileSets = Nothing
Dim profileSet As SolidEdgePart.ProfileSet = Nothing
Dim profiles As SolidEdgePart.Profiles = Nothing
Dim profile As SolidEdgePart.Profile = Nothing
Dim ellipses2d As SolidEdgeFrameworkSupport.Ellipses2d = Nothing
Dim ellipse2d As SolidEdgeFrameworkSupport.Ellipse2d = Nothing
Try
' See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
OleMessageFilter.Register()
' Attempt to connect to a running instance of Solid Edge.
application = DirectCast(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)
documents = application.Documents
partDocument = CType(documents.Add("SolidEdge.PartDocument"), SolidEdgePart.PartDocument)
refPlanes = partDocument.RefPlanes
profileSets = partDocument.ProfileSets
profileSet = profileSets.Add()
profiles = profileSet.Profiles
profile = profiles.Add(refPlanes.Item(1))
ellipses2d = profile.Ellipses2d
Dim Orientation = SolidEdgeFrameworkSupport.Geom2dOrientationConstants.igGeom2dOrientClockwise
ellipse2d = ellipses2d.AddByCenter(0, 0, 0.01, 0, 0.5, Orientation)
Dim minorMajorRatio = ellipse2d.MinorMajorRatio
Catch ex As System.Exception
Console.WriteLine(ex)
Finally
OleMessageFilter.Unregister()
End Try
End Sub
End Class
End Namespace
|
SolidEdgeCommunity/docs
|
docfx_project/snippets/SolidEdgeFrameworkSupport.Ellipse2d.MinorMajorRatio.vb
|
Visual Basic
|
mit
| 2,175
|
Imports System.Runtime.InteropServices
Imports NetOffice.Tools
Imports NetOffice.WordApi.Tools
'
'Custom Addin Object Example
'Demonstrate how to spend a callable instance to VBA
'
<COMAddin("Word06 Sample Addin VB4", "Custom Addin Object Example", LoadBehavior.LoadAtStartup)>
<ProgId("Word06AddinVB4.Connect"), Guid("C3D40A14-3845-4616-A2CF-EE6CF909B251"), Codebase, Timestamp>
Public Class Addin
Inherits COMAddin
Protected Overrides Function OnCreateObjectInstance() As Object
Return New TimeComponent()
End Function
End Class
|
NetOfficeFw/NetOffice
|
Examples/Word/VB/NetOffice COMAddin Examples/06 Custom Addin Object/Addin.vb
|
Visual Basic
|
mit
| 558
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Async
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics.Async
Public Class AddAwaitTests
Inherits AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddAwait)>
Public Async Function TaskNotAwaited() As Task
Await TestInRegularAndScriptAsync(
"Imports System
Imports System.Threading.Tasks
Module Program
Async Sub MySub()
[|Task.Delay(3)|]
End Sub
End Module",
"Imports System
Imports System.Threading.Tasks
Module Program
Async Sub MySub()
Await Task.Delay(3)
End Sub
End Module",
)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddAwait)>
Public Async Function TestTaskNotAwaited_WithLeadingTrivia() As Task
Dim initial =
<File>
Imports System
Imports System.Threading.Tasks
Module Program
Async Sub M()
' Useful comment
[|Task.Delay(3)|]
End Sub
End Module
</File>
Dim expected =
<File>
Imports System
Imports System.Threading.Tasks
Module Program
Async Sub M()
' Useful comment
Await Task.Delay(3)
End Sub
End Module
</File>
Await TestAsync(initial, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddAwait)>
Public Async Function TestBadAsyncReturnOperand1() As Task
Dim initial =
<File>
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading.Tasks
Module Program
Async Function Test() As Task(Of Integer)
Return 3
End Function
Async Function Test2() As Task(Of Integer)
[|Return Test()|]
End Function
End Module
</File>
Dim expected =
<File>
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading.Tasks
Module Program
Async Function Test() As Task(Of Integer)
Return 3
End Function
Async Function Test2() As Task(Of Integer)
Return Await Test()
End Function
End Module
</File>
Await TestAsync(initial, expected)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddAwait)>
Public Async Function TestFunctionNotAwaited() As Task
Dim initial =
<File>
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading.Tasks
Module Program
Function AwaitableFunction() As Task
Return New Task()
End Function
Async Sub MySub()
[|AwaitableFunction()|]
End Sub
End Module
</File>
Dim expected =
<File>
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading.Tasks
Module Program
Function AwaitableFunction() As Task
Return New Task()
End Function
Async Sub MySub()
Await AwaitableFunction()
End Sub
End Module
</File>
Await TestAsync(initial, expected)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddAwait)>
Public Async Function TestFunctionNotAwaited_WithLeadingTrivia() As Task
Dim initial =
<File>
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading.Tasks
Module Program
Function AwaitableFunction() As Task
Return New Task()
End Function
Async Sub MySub()
' Useful comment
[|AwaitableFunction()|]
End Sub
End Module
</File>
Dim expected =
<File>
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading.Tasks
Module Program
Function AwaitableFunction() As Task
Return New Task()
End Function
Async Sub MySub()
' Useful comment
Await AwaitableFunction()
End Sub
End Module
</File>
Await TestAsync(initial, expected, ignoreTrivia:=False)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddAwait)>
Public Async Function TestSubLambdaNotAwaited() As Task
Dim initial =
<File>
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading.Tasks
Module Program
Sub MySub()
Dim a = Async Sub()
[|Task.Delay(1)|]
End Sub
End Sub
End Module
</File>
Dim expected =
<File>
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading.Tasks
Module Program
Sub MySub()
Dim a = Async Sub()
Await Task.Delay(1)
End Sub
End Sub
End Module
</File>
Await TestAsync(initial, expected)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddAwait)>
Public Async Function TestFunctionLambdaNotAwaited() As Task
Dim initial =
<File>
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading.Tasks
Module Program
Sub MySub()
Dim a = Async Function()
' Useful comment
[|Task.Delay(1)|]
End Function
End Sub
End Module
</File>
Dim expected =
<File>
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading.Tasks
Module Program
Sub MySub()
Dim a = Async Function()
' Useful comment
Await Task.Delay(1)
End Function
End Sub
End Module
</File>
Await TestAsync(initial, expected, ignoreTrivia:=False)
End Function
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsAddAwait)>
Public Async Function TestAddAwaitOnAssignment() As Task
Await TestInRegularAndScriptAsync(
"Imports System.Threading.Tasks
Module Program
Async Function MyTestMethod1Async() As Task
Dim myInt As Integer = [|MyIntMethodAsync()|]
End Function
Private Function MyIntMethodAsync() As Task(Of Integer)
Return Task.FromResult(1)
End Function
End Module",
"Imports System.Threading.Tasks
Module Program
Async Function MyTestMethod1Async() As Task
Dim myInt As Integer = Await MyIntMethodAsync()
End Function
Private Function MyIntMethodAsync() As Task(Of Integer)
Return Task.FromResult(1)
End Function
End Module")
End Function
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsAddAwait)>
Public Async Function TestAddAwaitOnAssignment2() As Task
Await TestInRegularAndScriptAsync(
"Imports System.Threading.Tasks
Module Program
Async Function MyTestMethod1Async() As Task
Dim myInt As Long = [|MyIntMethodAsync()|]
End Function
Private Function MyIntMethodAsync() As Task(Of Integer)
Return Task.FromResult(1)
End Function
End Module",
"Imports System.Threading.Tasks
Module Program
Async Function MyTestMethod1Async() As Task
Dim myInt As Long = Await MyIntMethodAsync()
End Function
Private Function MyIntMethodAsync() As Task(Of Integer)
Return Task.FromResult(1)
End Function
End Module")
End Function
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsAddAwait)>
Public Async Function TestAddAwaitOnAssignment3() As Task
Await TestMissingInRegularAndScriptAsync(
"Imports System.Threading.Tasks
Module Program
Sub MyTestMethod1Async()
Dim myInt As Long = MyInt[||]MethodAsync()
End Sub
Private Function MyIntMethodAsync() As Task(Of Object)
Return Task.FromResult(New Object())
End Function
End Module")
End Function
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsAddAwait)>
Public Async Function TestAddAwaitOnAssignment4() As Task
Await TestInRegularAndScriptAsync(
"Imports System.Threading.Tasks
Module Program
Async Function MyTestMethod1Async() As Task
Dim myInt As Long = [|MyIntMethodAsync()|]
End Function
Private Function MyIntMethodAsync() As Task(Of Object)
Return Task.FromResult(New Object())
End Function
End Module",
"Imports System.Threading.Tasks
Module Program
Async Function MyTestMethod1Async() As Task
Dim myInt As Long = Await MyIntMethodAsync()
End Function
Private Function MyIntMethodAsync() As Task(Of Object)
Return Task.FromResult(New Object())
End Function
End Module")
End Function
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsAddAwait)>
Public Async Function TestAddAwaitOnAssignment5() As Task
Await TestInRegularAndScriptAsync(
"Imports System.Threading.Tasks
Module Program
Sub MyTestMethod1Async()
Dim lambda = Async Sub()
Dim myInt As Long = [|MyIntMethodAsync()|]
End Sub
End Sub
Private Function MyIntMethodAsync() As Task(Of Object)
Return Task.FromResult(New Object())
End Function
End Module",
"Imports System.Threading.Tasks
Module Program
Sub MyTestMethod1Async()
Dim lambda = Async Sub()
Dim myInt As Long = Await MyIntMethodAsync()
End Sub
End Sub
Private Function MyIntMethodAsync() As Task(Of Object)
Return Task.FromResult(New Object())
End Function
End Module")
End Function
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsAddAwait)>
Public Async Function TestAddAwaitOnAssignment6() As Task
Await TestInRegularAndScriptAsync(
"Imports System.Threading.Tasks
Module Program
Sub MyTestMethod1Async()
Dim lambda = Async Function() As Task
Dim myInt As Long = [|MyIntMethodAsync()|]
End Function
End Sub
Private Function MyIntMethodAsync() As Task(Of Object)
Return Task.FromResult(New Object())
End Function
End Module",
"Imports System.Threading.Tasks
Module Program
Sub MyTestMethod1Async()
Dim lambda = Async Function() As Task
Dim myInt As Long = Await MyIntMethodAsync()
End Function
End Sub
Private Function MyIntMethodAsync() As Task(Of Object)
Return Task.FromResult(New Object())
End Function
End Module")
End Function
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsAddAwait)>
Public Async Function TestAddAwaitOnAssignment7() As Task
Await TestInRegularAndScriptAsync(
"Imports System.Threading.Tasks
Module Program
Sub MyTestMethod1Async()
Dim myInt As Long
Dim lambda = Async Sub() myInt = [|MyIntMethodAsync()|]
End Sub
Private Function MyIntMethodAsync() As Task(Of Object)
Return Task.FromResult(New Object())
End Function
End Module",
"Imports System.Threading.Tasks
Module Program
Sub MyTestMethod1Async()
Dim myInt As Long
Dim lambda = Async Sub() myInt = Await MyIntMethodAsync()
End Sub
Private Function MyIntMethodAsync() As Task(Of Object)
Return Task.FromResult(New Object())
End Function
End Module")
End Function
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsAddAwait)>
Public Async Function TestTernaryOperator() As Task
Await TestInRegularAndScriptAsync(
"Imports System.Threading.Tasks
Module M
Async Function A() As Task(Of Integer)
Return [|If(True, Task.FromResult(0), Task.FromResult(1))|]
End Function
End Module",
"Imports System.Threading.Tasks
Module M
Async Function A() As Task(Of Integer)
Return Await If(True, Task.FromResult(0), Task.FromResult(1))
End Function
End Module")
End Function
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsAddAwait)>
Public Async Function TestTernaryOperator2() As Task
Await TestInRegularAndScriptAsync(
"Imports System.Threading.Tasks
Module M
Async Function A() As Task(Of Integer)
Return [|If(Nothing, Task.FromResult(1))|]
End Function
End Module",
"Imports System.Threading.Tasks
Module M
Async Function A() As Task(Of Integer)
Return Await If(Nothing, Task.FromResult(1))
End Function
End Module")
End Function
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsAddAwait)>
Public Async Function TestCastExpression() As Task
Await TestInRegularAndScriptAsync(
"Imports System.Threading.Tasks
Module M
Async Function A() As Task(Of Integer)
Return [|TryCast(Nothing, Task(Of Integer))|]
End Function
End Module",
"Imports System.Threading.Tasks
Module M
Async Function A() As Task(Of Integer)
Return Await TryCast(Nothing, Task(Of Integer))
End Function
End Module")
End Function
Friend Overrides Function CreateDiagnosticProviderAndFixer(workspace As Workspace) As (DiagnosticAnalyzer, CodeFixProvider)
Return (Nothing, New VisualBasicAddAwaitCodeFixProvider())
End Function
End Class
End Namespace
|
kelltrick/roslyn
|
src/EditorFeatures/VisualBasicTest/Diagnostics/Async/AddAwaitTests.vb
|
Visual Basic
|
apache-2.0
| 13,493
|
Imports System.Globalization.CultureInfo
Imports System.Net
Imports System.Xml
Public Class Gelbooru
Inherits Booru
Private m_Req As WebRequest
Private m_Res As WebResponse
Private m_Stream As IO.Stream
Private m_IsWorking As Boolean
Private m_IsFinished As Boolean
Public Sub New(baseUri As String)
MyBase.New(baseUri)
End Sub
Public Sub New(baseUri As Uri)
MyBase.New(BaseUri)
End Sub
Public Overrides Function BeginPostsList(limit As Integer, page As Integer, tags As String, callback As AsyncCallback, state As Object) As IAsyncResult
Dim q As String = "&"
If limit >= 0 Then q &= String.Format(InvariantCulture, "limit={0}&", limit)
If page >= 0 Then q &= String.Format(InvariantCulture, "page={0}&", page)
If tags IsNot Nothing Then q &= String.Format(InvariantCulture, "tags={0}&", Uri.EscapeDataString(tags))
q = q.Remove(q.Length - 1)
Dim u As New Uri(BaseUri, "/index.php?page=dapi&s=post" & q)
If m_IsWorking Then Throw New InvalidOperationException
m_IsWorking = True
m_Req = WebRequest.Create(u)
Return m_Req.BeginGetResponse(callback, state)
End Function
Public Overrides Function EndPostsList(asyncResult As IAsyncResult) As Post()
If m_IsFinished Then Throw New InvalidOperationException
m_Res = m_Req.EndGetResponse(asyncResult)
m_Stream = m_Res.GetResponseStream
EndPostsList = ParsePostsList(m_Stream)
m_Stream.Dispose()
m_Res = Nothing
m_Req = Nothing
m_IsFinished = True
m_IsWorking = False
End Function
Private Shared Function ParsePostsList(stream As IO.Stream) As Post()
Dim posts As New List(Of Post)
Using reader = XmlReader.Create(stream)
With reader
Do While .Read
Select Case .NodeType
Case XmlNodeType.Element
Select Case .Name
Case "post"
posts.Add(New GelbooruPost(.ReadOuterXml))
End Select
End Select
Loop
End With
End Using
Return posts.ToArray
End Function
End Class
|
minacle/Apibooru
|
Apibooru/Gelbooru.vb
|
Visual Basic
|
bsd-2-clause
| 2,067
|
Public Class LoadingScreen
Private Sub LoadingScreen_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
With lblLoading
.AutoSize = False
.TextAlign = ContentAlignment.MiddleCenter
.Dock = DockStyle.Fill
End With
Catch ex As Exception
Throw
End Try
End Sub
Friend Sub SetCurrentChampion(ByVal championName As String, ByVal role As String)
Try
lblLoading.Text = String.Format("Downloading Champion.GG data. This may take a little while.{0}{1} {2}", vbNewLine & vbNewLine, championName, role)
Catch ex As Exception
Throw
End Try
End Sub
End Class
|
maxdeviant/lol-mastery-manager
|
LoLMasteryManager/LoadingScreen.vb
|
Visual Basic
|
mit
| 747
|
Public Class Login
Inherits Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
RegisterHyperLink.NavigateUrl = "Register"
OpenAuthLogin.ReturnUrl = Request.QueryString("ReturnUrl")
Dim returnUrl = HttpUtility.UrlEncode(Request.QueryString("ReturnUrl"))
If Not String.IsNullOrEmpty(returnUrl) Then
RegisterHyperLink.NavigateUrl &= "?ReturnUrl=" & returnUrl
End If
End Sub
End Class
|
keeyanajones/Samples
|
microsoftProject/ASPNETVBWebFormsApplication/ASPNETVBWebFormsApplication/Account/Login.aspx.vb
|
Visual Basic
|
mit
| 489
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.IO
Imports System.Reflection.Metadata
Imports System.Reflection.Metadata.Ecma335
Imports System.Reflection.PortableExecutable
Imports System.Text
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.DiaSymReader.Tools
Imports Roslyn.Test.PdbUtilities
Imports Roslyn.Test.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.PDB
Public Class PDBTests
Inherits BasicTestBase
#Region "General"
<Fact>
Public Sub EmitDebugInfoForSourceTextWithoutEncoding1()
Dim tree1 = SyntaxFactory.ParseSyntaxTree("Class A : End Class", path:="Goo.vb", encoding:=Nothing)
Dim tree2 = SyntaxFactory.ParseSyntaxTree("Class B : End Class", path:="", encoding:=Nothing)
Dim tree3 = SyntaxFactory.ParseSyntaxTree(SourceText.From("Class C : End Class", encoding:=Nothing), path:="Bar.vb")
Dim tree4 = SyntaxFactory.ParseSyntaxTree("Class D : End Class", path:="Baz.vb", encoding:=Encoding.UTF8)
Dim comp = VisualBasicCompilation.Create("Compilation", {tree1, tree2, tree3, tree4}, {MscorlibRef}, options:=TestOptions.ReleaseDll)
Dim result = comp.Emit(New MemoryStream(), pdbStream:=New MemoryStream())
result.Diagnostics.Verify(
Diagnostic(ERRID.ERR_EncodinglessSyntaxTree, "Class A : End Class").WithLocation(1, 1),
Diagnostic(ERRID.ERR_EncodinglessSyntaxTree, "Class C : End Class").WithLocation(1, 1))
Assert.False(result.Success)
End Sub
<Fact>
Public Sub EmitDebugInfoForSourceTextWithoutEncoding2()
Dim tree1 = SyntaxFactory.ParseSyntaxTree("Class A" & vbCrLf & "Sub F() : End Sub : End Class", path:="Goo.vb", encoding:=Encoding.Unicode)
Dim tree2 = SyntaxFactory.ParseSyntaxTree("Class B" & vbCrLf & "Sub F() : End Sub : End Class", path:="", encoding:=Nothing)
Dim tree3 = SyntaxFactory.ParseSyntaxTree("Class C" & vbCrLf & "Sub F() : End Sub : End Class", path:="Bar.vb", encoding:=New UTF8Encoding(True, False))
Dim tree4 = SyntaxFactory.ParseSyntaxTree(SourceText.From("Class D" & vbCrLf & "Sub F() : End Sub : End Class", New UTF8Encoding(False, False)), path:="Baz.vb")
Dim comp = VisualBasicCompilation.Create("Compilation", {tree1, tree2, tree3, tree4}, {MscorlibRef}, options:=TestOptions.ReleaseDll)
Dim result = comp.Emit(New MemoryStream(), pdbStream:=New MemoryStream())
result.Diagnostics.Verify()
Assert.True(result.Success)
Dim hash1 = CryptographicHashProvider.ComputeSha1(Encoding.Unicode.GetBytesWithPreamble(tree1.ToString()))
Dim hash3 = CryptographicHashProvider.ComputeSha1(New UTF8Encoding(True, False).GetBytesWithPreamble(tree3.ToString()))
Dim hash4 = CryptographicHashProvider.ComputeSha1(New UTF8Encoding(False, False).GetBytesWithPreamble(tree4.ToString()))
Dim checksum1 = String.Concat(hash1.Select(Function(b) String.Format("{0,2:X}", b) + ", "))
Dim checksum3 = String.Concat(hash3.Select(Function(b) String.Format("{0,2:X}", b) + ", "))
Dim checksum4 = String.Concat(hash4.Select(Function(b) String.Format("{0,2:X}", b) + ", "))
comp.VerifyPdb(
<symbols>
<files>
<file id="1" name="Goo.vb" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd" checkSumAlgorithmId="ff1816ec-aa5e-4d10-87f7-6f4963833460" checkSum=<%= checksum1 %>/>
<file id="2" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
<file id="3" name="Bar.vb" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd" checkSumAlgorithmId="ff1816ec-aa5e-4d10-87f7-6f4963833460" checkSum=<%= checksum3 %>/>
<file id="4" name="Baz.vb" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd" checkSumAlgorithmId="ff1816ec-aa5e-4d10-87f7-6f4963833460" checkSum=<%= checksum4 %>/>
</files>
</symbols>, options:=PdbValidationOptions.ExcludeMethods)
End Sub
<Fact>
Public Sub CustomDebugEntryPoint_DLL()
Dim source = "
Class C
Shared Sub F()
End Sub
End Class
"
Dim c = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll)
Dim f = c.GetMember(Of MethodSymbol)("C.F")
c.VerifyPdb(
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="C" methodName="F"/>
<methods/>
</symbols>, debugEntryPoint:=f, options:=PdbValidationOptions.ExcludeScopes Or PdbValidationOptions.ExcludeSequencePoints Or PdbValidationOptions.ExcludeCustomDebugInformation)
Dim peReader = New PEReader(c.EmitToArray(debugEntryPoint:=f))
Dim peEntryPointToken = peReader.PEHeaders.CorHeader.EntryPointTokenOrRelativeVirtualAddress
Assert.Equal(0, peEntryPointToken)
End Sub
<Fact>
Public Sub CustomDebugEntryPoint_EXE()
Dim source = "
Class M
Shared Sub Main()
End Sub
End Class
Class C
Shared Sub F(Of S)()
End Sub
End Class
"
Dim c = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugExe)
Dim f = c.GetMember(Of MethodSymbol)("C.F")
c.VerifyPdb(
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="C" methodName="F"/>
<methods/>
</symbols>, debugEntryPoint:=f, options:=PdbValidationOptions.ExcludeScopes Or PdbValidationOptions.ExcludeSequencePoints Or PdbValidationOptions.ExcludeCustomDebugInformation)
Dim peReader = New PEReader(c.EmitToArray(debugEntryPoint:=f))
Dim peEntryPointToken = peReader.PEHeaders.CorHeader.EntryPointTokenOrRelativeVirtualAddress
Dim mdReader = peReader.GetMetadataReader()
Dim methodDef = mdReader.GetMethodDefinition(CType(MetadataTokens.Handle(peEntryPointToken), MethodDefinitionHandle))
Assert.Equal("Main", mdReader.GetString(methodDef.Name))
End Sub
<Fact>
Public Sub CustomDebugEntryPoint_Errors()
Dim source1 = "
Class C
Shared Sub F
End Sub
End Class
Class D(Of T)
Shared Sub G(Of S)()
End Sub
End Class
"
Dim source2 = "
Class C
Shared Sub F()
End Sub
End Class
"
Dim c1 = CreateCompilationWithMscorlib({source1}, options:=TestOptions.DebugDll)
Dim c2 = CreateCompilationWithMscorlib({source2}, options:=TestOptions.DebugDll)
Dim f1 = c1.GetMember(Of MethodSymbol)("C.F")
Dim f2 = c2.GetMember(Of MethodSymbol)("C.F")
Dim g = c1.GetMember(Of MethodSymbol)("D.G")
Dim d = c1.GetMember(Of NamedTypeSymbol)("D")
Assert.NotNull(f1)
Assert.NotNull(f2)
Assert.NotNull(g)
Assert.NotNull(d)
Dim stInt = c1.GetSpecialType(SpecialType.System_Int32)
Dim d_t_g_int = g.Construct(stInt)
Dim d_int = d.Construct(stInt)
Dim d_int_g = d_int.GetMember(Of MethodSymbol)("G")
Dim d_int_g_int = d_int_g.Construct(stInt)
Dim result = c1.Emit(New MemoryStream(), New MemoryStream(), debugEntryPoint:=f2)
result.Diagnostics.Verify(Diagnostic(ERRID.ERR_DebugEntryPointNotSourceMethodDefinition))
result = c1.Emit(New MemoryStream(), New MemoryStream(), debugEntryPoint:=d_t_g_int)
result.Diagnostics.Verify(Diagnostic(ERRID.ERR_DebugEntryPointNotSourceMethodDefinition))
result = c1.Emit(New MemoryStream(), New MemoryStream(), debugEntryPoint:=d_int_g)
result.Diagnostics.Verify(Diagnostic(ERRID.ERR_DebugEntryPointNotSourceMethodDefinition))
result = c1.Emit(New MemoryStream(), New MemoryStream(), debugEntryPoint:=d_int_g_int)
result.Diagnostics.Verify(Diagnostic(ERRID.ERR_DebugEntryPointNotSourceMethodDefinition))
End Sub
#End Region
<Fact>
Public Sub TestBasic()
Dim source =
<compilation>
<file><![CDATA[
Class C1
Sub Method()
System.Console.WriteLine("Hello, world.")
End Sub
End Class
]]></file>
</compilation>
Dim defines = PredefinedPreprocessorSymbols.AddPredefinedPreprocessorSymbols(OutputKind.ConsoleApplication)
defines = defines.Add(KeyValuePair.Create("_MyType", CObj("Console")))
Dim parseOptions = New VisualBasicParseOptions(preprocessorSymbols:=defines)
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll.WithParseOptions(parseOptions))
compilation.VerifyPdb(
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="My.MyComputer" name=".ctor">
<sequencePoints>
<entry offset="0x0" startLine="107" startColumn="9" endLine="107" endColumn="25" document="1"/>
<entry offset="0x1" startLine="108" startColumn="13" endLine="108" endColumn="25" document="1"/>
<entry offset="0x8" startLine="109" startColumn="9" endLine="109" endColumn="16" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<currentnamespace name="My"/>
</scope>
</method>
<method containingType="My.MyProject" name=".cctor">
<sequencePoints>
<entry offset="0x0" startLine="126" startColumn="26" endLine="126" endColumn="97" document="1"/>
<entry offset="0xa" startLine="137" startColumn="26" endLine="137" endColumn="95" document="1"/>
<entry offset="0x14" startLine="148" startColumn="26" endLine="148" endColumn="136" document="1"/>
<entry offset="0x1e" startLine="284" startColumn="26" endLine="284" endColumn="105" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x29">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
</scope>
</method>
<method containingType="My.MyProject" name="get_Computer">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="121" startColumn="13" endLine="121" endColumn="16" document="1"/>
<entry offset="0x1" startLine="122" startColumn="17" endLine="122" endColumn="62" document="1"/>
<entry offset="0xe" startLine="123" startColumn="13" endLine="123" endColumn="20" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x10">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<local name="Computer" il_index="0" il_start="0x0" il_end="0x10" attributes="0"/>
</scope>
</method>
<method containingType="My.MyProject" name="get_Application">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="133" startColumn="13" endLine="133" endColumn="16" document="1"/>
<entry offset="0x1" startLine="134" startColumn="17" endLine="134" endColumn="57" document="1"/>
<entry offset="0xe" startLine="135" startColumn="13" endLine="135" endColumn="20" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x10">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<local name="Application" il_index="0" il_start="0x0" il_end="0x10" attributes="0"/>
</scope>
</method>
<method containingType="My.MyProject" name="get_User">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="144" startColumn="13" endLine="144" endColumn="16" document="1"/>
<entry offset="0x1" startLine="145" startColumn="17" endLine="145" endColumn="58" document="1"/>
<entry offset="0xe" startLine="146" startColumn="13" endLine="146" endColumn="20" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x10">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<local name="User" il_index="0" il_start="0x0" il_end="0x10" attributes="0"/>
</scope>
</method>
<method containingType="My.MyProject" name="get_WebServices">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="237" startColumn="14" endLine="237" endColumn="17" document="1"/>
<entry offset="0x1" startLine="238" startColumn="17" endLine="238" endColumn="67" document="1"/>
<entry offset="0xe" startLine="239" startColumn="13" endLine="239" endColumn="20" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x10">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<local name="WebServices" il_index="0" il_start="0x0" il_end="0x10" attributes="0"/>
</scope>
</method>
<method containingType="C1" name="Method">
<sequencePoints>
<entry offset="0x0" startLine="2" startColumn="5" endLine="2" endColumn="17" document="1"/>
<entry offset="0x1" startLine="3" startColumn="9" endLine="3" endColumn="50" document="1"/>
<entry offset="0xc" startLine="4" startColumn="5" endLine="4" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xd">
<currentnamespace name=""/>
</scope>
</method>
<method containingType="My.MyProject+MyWebServices" name="Equals" parameterNames="o">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="247" startColumn="13" endLine="247" endColumn="75" document="1"/>
<entry offset="0x1" startLine="248" startColumn="17" endLine="248" endColumn="40" document="1"/>
<entry offset="0x10" startLine="249" startColumn="13" endLine="249" endColumn="25" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x12">
<currentnamespace name="My"/>
<local name="Equals" il_index="0" il_start="0x0" il_end="0x12" attributes="0"/>
</scope>
</method>
<method containingType="My.MyProject+MyWebServices" name="GetHashCode">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="251" startColumn="13" endLine="251" endColumn="63" document="1"/>
<entry offset="0x1" startLine="252" startColumn="17" endLine="252" endColumn="42" document="1"/>
<entry offset="0xa" startLine="253" startColumn="13" endLine="253" endColumn="25" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xc">
<importsforward declaringType="My.MyProject+MyWebServices" methodName="Equals" parameterNames="o"/>
<local name="GetHashCode" il_index="0" il_start="0x0" il_end="0xc" attributes="0"/>
</scope>
</method>
<method containingType="My.MyProject+MyWebServices" name="GetType">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="255" startColumn="13" endLine="255" endColumn="72" document="1"/>
<entry offset="0x1" startLine="256" startColumn="17" endLine="256" endColumn="46" document="1"/>
<entry offset="0xe" startLine="257" startColumn="13" endLine="257" endColumn="25" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x10">
<importsforward declaringType="My.MyProject+MyWebServices" methodName="Equals" parameterNames="o"/>
<local name="GetType" il_index="0" il_start="0x0" il_end="0x10" attributes="0"/>
</scope>
</method>
<method containingType="My.MyProject+MyWebServices" name="ToString">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="259" startColumn="13" endLine="259" endColumn="59" document="1"/>
<entry offset="0x1" startLine="260" startColumn="17" endLine="260" endColumn="39" document="1"/>
<entry offset="0xa" startLine="261" startColumn="13" endLine="261" endColumn="25" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xc">
<importsforward declaringType="My.MyProject+MyWebServices" methodName="Equals" parameterNames="o"/>
<local name="ToString" il_index="0" il_start="0x0" il_end="0xc" attributes="0"/>
</scope>
</method>
<method containingType="My.MyProject+MyWebServices" name="Create__Instance__" parameterNames="instance">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
<slot kind="1" offset="0"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="264" startColumn="12" endLine="264" endColumn="95" document="1"/>
<entry offset="0x1" startLine="265" startColumn="17" endLine="265" endColumn="44" document="1"/>
<entry offset="0xb" hidden="true" document="1"/>
<entry offset="0xe" startLine="266" startColumn="21" endLine="266" endColumn="35" document="1"/>
<entry offset="0x16" startLine="267" startColumn="17" endLine="267" endColumn="21" document="1"/>
<entry offset="0x17" startLine="268" startColumn="21" endLine="268" endColumn="36" document="1"/>
<entry offset="0x1b" startLine="270" startColumn="13" endLine="270" endColumn="25" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x1d">
<importsforward declaringType="My.MyProject+MyWebServices" methodName="Equals" parameterNames="o"/>
<local name="Create__Instance__" il_index="0" il_start="0x0" il_end="0x1d" attributes="0"/>
</scope>
</method>
<method containingType="My.MyProject+MyWebServices" name="Dispose__Instance__" parameterNames="instance">
<sequencePoints>
<entry offset="0x0" startLine="273" startColumn="13" endLine="273" endColumn="71" document="1"/>
<entry offset="0x1" startLine="274" startColumn="17" endLine="274" endColumn="35" document="1"/>
<entry offset="0x8" startLine="275" startColumn="13" endLine="275" endColumn="20" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<importsforward declaringType="My.MyProject+MyWebServices" methodName="Equals" parameterNames="o"/>
</scope>
</method>
<method containingType="My.MyProject+MyWebServices" name=".ctor">
<sequencePoints>
<entry offset="0x0" startLine="279" startColumn="13" endLine="279" endColumn="29" document="1"/>
<entry offset="0x1" startLine="280" startColumn="16" endLine="280" endColumn="28" document="1"/>
<entry offset="0x8" startLine="281" startColumn="13" endLine="281" endColumn="20" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<importsforward declaringType="My.MyProject+MyWebServices" methodName="Equals" parameterNames="o"/>
</scope>
</method>
<method containingType="My.MyProject+ThreadSafeObjectProvider`1" name="get_GetInstance">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
<slot kind="1" offset="0"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="341" startColumn="17" endLine="341" endColumn="20" document="1"/>
<entry offset="0x1" startLine="342" startColumn="21" endLine="342" endColumn="59" document="1"/>
<entry offset="0xf" hidden="true" document="1"/>
<entry offset="0x12" startLine="342" startColumn="60" endLine="342" endColumn="87" document="1"/>
<entry offset="0x1c" startLine="343" startColumn="21" endLine="343" endColumn="47" document="1"/>
<entry offset="0x24" startLine="344" startColumn="17" endLine="344" endColumn="24" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x26">
<importsforward declaringType="My.MyProject+MyWebServices" methodName="Equals" parameterNames="o"/>
<local name="GetInstance" il_index="0" il_start="0x0" il_end="0x26" attributes="0"/>
</scope>
</method>
<method containingType="My.MyProject+ThreadSafeObjectProvider`1" name=".ctor">
<sequencePoints>
<entry offset="0x0" startLine="350" startColumn="13" endLine="350" endColumn="29" document="1"/>
<entry offset="0x1" startLine="351" startColumn="17" endLine="351" endColumn="29" document="1"/>
<entry offset="0x8" startLine="352" startColumn="13" endLine="352" endColumn="20" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<importsforward declaringType="My.MyProject+MyWebServices" methodName="Equals" parameterNames="o"/>
</scope>
</method>
</methods>
</symbols>, options:=PdbValidationOptions.SkipConversionValidation) ' TODO: https://github.com/dotnet/roslyn/issues/18004
End Sub
<Fact()>
Public Sub ConstructorsWithoutInitializers()
Dim source =
<compilation>
<file><![CDATA[
Class C
Sub New()
Dim o As Object
End Sub
Sub New(x As Object)
Dim y As Object = x
End Sub
End Class
]]></file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, TestOptions.DebugDll)
compilation.VerifyPdb("C..ctor",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="C" name=".ctor">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="2" startColumn="5" endLine="2" endColumn="14" document="1"/>
<entry offset="0x8" startLine="4" startColumn="5" endLine="4" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<currentnamespace name=""/>
<local name="o" il_index="0" il_start="0x0" il_end="0x9" attributes="0"/>
</scope>
</method>
<method containingType="C" name=".ctor" parameterNames="x">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="5" startColumn="5" endLine="5" endColumn="25" document="1"/>
<entry offset="0x8" startLine="6" startColumn="13" endLine="6" endColumn="28" document="1"/>
<entry offset="0xf" startLine="7" startColumn="5" endLine="7" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x10">
<importsforward declaringType="C" methodName=".ctor"/>
<local name="y" il_index="0" il_start="0x0" il_end="0x10" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact()>
Public Sub ConstructorsWithInitializers()
Dim source =
<compilation>
<file><![CDATA[
Class C
Shared G As Object = 1
Private F As Object = G
Sub New()
Dim o As Object
End Sub
Sub New(x As Object)
Dim y As Object = x
End Sub
End Class
]]></file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, TestOptions.DebugDll)
compilation.VerifyPdb("C..ctor",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="C" name=".ctor">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="4" startColumn="5" endLine="4" endColumn="14" document="1"/>
<entry offset="0x8" startLine="3" startColumn="13" endLine="3" endColumn="28" document="1"/>
<entry offset="0x18" startLine="6" startColumn="5" endLine="6" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x19">
<importsforward declaringType="C" methodName=".cctor"/>
<local name="o" il_index="0" il_start="0x0" il_end="0x19" attributes="0"/>
</scope>
</method>
<method containingType="C" name=".ctor" parameterNames="x">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="7" startColumn="5" endLine="7" endColumn="25" document="1"/>
<entry offset="0x8" startLine="3" startColumn="13" endLine="3" endColumn="28" document="1"/>
<entry offset="0x18" startLine="8" startColumn="13" endLine="8" endColumn="28" document="1"/>
<entry offset="0x1f" startLine="9" startColumn="5" endLine="9" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x20">
<importsforward declaringType="C" methodName=".cctor"/>
<local name="y" il_index="0" il_start="0x0" il_end="0x20" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact()>
Public Sub TryCatchFinally()
Dim source =
<compilation>
<file><![CDATA[
Option Strict On
Imports System
Module M1
Public Sub Main()
Dim x As Integer = 0
Try
Dim y As String = "y"
label1:
label2:
If x = 0 Then
Throw New Exception()
End If
Catch ex As Exception
Dim z As String = "z"
Console.WriteLine(x)
x = 1
GoTo label1
Finally
Dim q As String = "q"
Console.WriteLine(x)
End Try
Console.WriteLine(x)
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugExe)
compilation.VerifyPdb("M1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="M1" methodName="Main"/>
<methods>
<method containingType="M1" name="Main">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
<slot kind="0" offset="51"/>
<slot kind="1" offset="100"/>
<slot kind="0" offset="182"/>
<slot kind="0" offset="221"/>
<slot kind="0" offset="351"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="5" startColumn="5" endLine="5" endColumn="22" document="1"/>
<entry offset="0x1" startLine="6" startColumn="13" endLine="6" endColumn="29" document="1"/>
<entry offset="0x3" startLine="7" startColumn="9" endLine="7" endColumn="12" document="1"/>
<entry offset="0x4" startLine="8" startColumn="17" endLine="8" endColumn="34" document="1"/>
<entry offset="0xa" startLine="9" startColumn="1" endLine="9" endColumn="8" document="1"/>
<entry offset="0xb" startLine="10" startColumn="1" endLine="10" endColumn="8" document="1"/>
<entry offset="0xc" startLine="11" startColumn="13" endLine="11" endColumn="26" document="1"/>
<entry offset="0x11" hidden="true" document="1"/>
<entry offset="0x14" startLine="12" startColumn="17" endLine="12" endColumn="38" document="1"/>
<entry offset="0x1a" startLine="13" startColumn="13" endLine="13" endColumn="19" document="1"/>
<entry offset="0x1d" hidden="true" document="1"/>
<entry offset="0x24" startLine="14" startColumn="9" endLine="14" endColumn="30" document="1"/>
<entry offset="0x25" startLine="15" startColumn="17" endLine="15" endColumn="34" document="1"/>
<entry offset="0x2c" startLine="16" startColumn="13" endLine="16" endColumn="33" document="1"/>
<entry offset="0x33" startLine="17" startColumn="13" endLine="17" endColumn="18" document="1"/>
<entry offset="0x35" startLine="18" startColumn="13" endLine="18" endColumn="24" document="1"/>
<entry offset="0x3c" hidden="true" document="1"/>
<entry offset="0x3e" startLine="19" startColumn="9" endLine="19" endColumn="16" document="1"/>
<entry offset="0x3f" startLine="20" startColumn="17" endLine="20" endColumn="34" document="1"/>
<entry offset="0x46" startLine="21" startColumn="13" endLine="21" endColumn="33" document="1"/>
<entry offset="0x4e" startLine="22" startColumn="9" endLine="22" endColumn="16" document="1"/>
<entry offset="0x4f" startLine="24" startColumn="9" endLine="24" endColumn="29" document="1"/>
<entry offset="0x56" startLine="26" startColumn="5" endLine="26" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x57">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="x" il_index="0" il_start="0x0" il_end="0x57" attributes="0"/>
<scope startOffset="0x4" endOffset="0x1a">
<local name="y" il_index="1" il_start="0x4" il_end="0x1a" attributes="0"/>
</scope>
<scope startOffset="0x1d" endOffset="0x3b">
<local name="ex" il_index="3" il_start="0x1d" il_end="0x3b" attributes="0"/>
<scope startOffset="0x25" endOffset="0x3b">
<local name="z" il_index="4" il_start="0x25" il_end="0x3b" attributes="0"/>
</scope>
</scope>
<scope startOffset="0x3f" endOffset="0x4c">
<local name="q" il_index="5" il_start="0x3f" il_end="0x4c" attributes="0"/>
</scope>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact()>
Public Sub TryCatchWhen_Debug()
Dim source =
<compilation>
<file>
Option Strict On
Imports System
Module M1
Public Sub Main()
Dim x As Integer = 0
Try
Dim y As String = "y"
label1:
label2:
x = x \ x
Catch ex As Exception When ex.Message IsNot Nothing
Dim z As String = "z"
Console.WriteLine(x)
x = 1
GoTo label1
Finally
Dim q As String = "q"
Console.WriteLine(x)
End Try
Console.WriteLine(x)
End Sub
End Module
</file>
</compilation>
Dim v = CompileAndVerify(CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugExe))
v.VerifyIL("M1.Main", "
{
// Code size 104 (0x68)
.maxstack 2
.locals init (Integer V_0, //x
String V_1, //y
System.Exception V_2, //ex
Boolean V_3,
String V_4, //z
String V_5) //q
-IL_0000: nop
-IL_0001: ldc.i4.0
IL_0002: stloc.0
.try
{
.try
{
-IL_0003: nop
-IL_0004: ldstr ""y""
IL_0009: stloc.1
-IL_000a: nop
-IL_000b: nop
-IL_000c: ldloc.0
IL_000d: ldloc.0
IL_000e: div
IL_000f: stloc.0
IL_0010: leave.s IL_004d
}
filter
{
~IL_0012: isinst ""System.Exception""
IL_0017: dup
IL_0018: brtrue.s IL_001e
IL_001a: pop
IL_001b: ldc.i4.0
IL_001c: br.s IL_0033
IL_001e: dup
IL_001f: call ""Sub Microsoft.VisualBasic.CompilerServices.ProjectData.SetProjectError(System.Exception)""
IL_0024: stloc.2
-IL_0025: ldloc.2
IL_0026: callvirt ""Function System.Exception.get_Message() As String""
IL_002b: ldnull
IL_002c: cgt.un
IL_002e: stloc.3
~IL_002f: ldloc.3
IL_0030: ldc.i4.0
IL_0031: cgt.un
IL_0033: endfilter
} // end filter
{ // handler
~IL_0035: pop
-IL_0036: ldstr ""z""
IL_003b: stloc.s V_4
-IL_003d: ldloc.0
IL_003e: call ""Sub System.Console.WriteLine(Integer)""
IL_0043: nop
-IL_0044: ldc.i4.1
IL_0045: stloc.0
-IL_0046: call ""Sub Microsoft.VisualBasic.CompilerServices.ProjectData.ClearProjectError()""
IL_004b: leave.s IL_000a
}
~IL_004d: leave.s IL_005f
}
finally
{
-IL_004f: nop
-IL_0050: ldstr ""q""
IL_0055: stloc.s V_5
-IL_0057: ldloc.0
IL_0058: call ""Sub System.Console.WriteLine(Integer)""
IL_005d: nop
IL_005e: endfinally
}
-IL_005f: nop
-IL_0060: ldloc.0
IL_0061: call ""Sub System.Console.WriteLine(Integer)""
IL_0066: nop
-IL_0067: ret
}
", sequencePoints:="M1.Main")
v.VerifyPdb("M1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="M1" methodName="Main"/>
<methods>
<method containingType="M1" name="Main">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
<slot kind="0" offset="51"/>
<slot kind="0" offset="119"/>
<slot kind="1" offset="141"/>
<slot kind="0" offset="188"/>
<slot kind="0" offset="318"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="5" startColumn="5" endLine="5" endColumn="22" document="1"/>
<entry offset="0x1" startLine="6" startColumn="13" endLine="6" endColumn="29" document="1"/>
<entry offset="0x3" startLine="7" startColumn="9" endLine="7" endColumn="12" document="1"/>
<entry offset="0x4" startLine="8" startColumn="17" endLine="8" endColumn="34" document="1"/>
<entry offset="0xa" startLine="9" startColumn="1" endLine="9" endColumn="8" document="1"/>
<entry offset="0xb" startLine="10" startColumn="1" endLine="10" endColumn="8" document="1"/>
<entry offset="0xc" startLine="11" startColumn="13" endLine="11" endColumn="22" document="1"/>
<entry offset="0x12" hidden="true" document="1"/>
<entry offset="0x25" startLine="12" startColumn="9" endLine="12" endColumn="60" document="1"/>
<entry offset="0x2f" hidden="true" document="1"/>
<entry offset="0x35" hidden="true" document="1"/>
<entry offset="0x36" startLine="13" startColumn="17" endLine="13" endColumn="34" document="1"/>
<entry offset="0x3d" startLine="14" startColumn="13" endLine="14" endColumn="33" document="1"/>
<entry offset="0x44" startLine="15" startColumn="13" endLine="15" endColumn="18" document="1"/>
<entry offset="0x46" startLine="16" startColumn="13" endLine="16" endColumn="24" document="1"/>
<entry offset="0x4d" hidden="true" document="1"/>
<entry offset="0x4f" startLine="17" startColumn="9" endLine="17" endColumn="16" document="1"/>
<entry offset="0x50" startLine="18" startColumn="17" endLine="18" endColumn="34" document="1"/>
<entry offset="0x57" startLine="19" startColumn="13" endLine="19" endColumn="33" document="1"/>
<entry offset="0x5f" startLine="20" startColumn="9" endLine="20" endColumn="16" document="1"/>
<entry offset="0x60" startLine="22" startColumn="9" endLine="22" endColumn="29" document="1"/>
<entry offset="0x67" startLine="24" startColumn="5" endLine="24" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x68">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="x" il_index="0" il_start="0x0" il_end="0x68" attributes="0"/>
<scope startOffset="0x4" endOffset="0xf">
<local name="y" il_index="1" il_start="0x4" il_end="0xf" attributes="0"/>
</scope>
<scope startOffset="0x12" endOffset="0x4c">
<local name="ex" il_index="2" il_start="0x12" il_end="0x4c" attributes="0"/>
<scope startOffset="0x36" endOffset="0x4c">
<local name="z" il_index="4" il_start="0x36" il_end="0x4c" attributes="0"/>
</scope>
</scope>
<scope startOffset="0x50" endOffset="0x5d">
<local name="q" il_index="5" il_start="0x50" il_end="0x5d" attributes="0"/>
</scope>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact>
Public Sub TryCatchWhen_Release()
Dim source =
<compilation>
<file>
Imports System
Imports System.IO
Module M1
Function filter(e As Exception)
Return True
End Function
Public Sub Main()
Try
Throw New InvalidOperationException()
Catch e As IOException When filter(e)
Console.WriteLine()
Catch e As Exception When filter(e)
Console.WriteLine()
End Try
End Sub
End Module
</file>
</compilation>
Dim v = CompileAndVerify(CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.ReleaseExe))
v.VerifyIL("M1.Main", "
{
// Code size 103 (0x67)
.maxstack 2
.locals init (System.IO.IOException V_0, //e
System.Exception V_1) //e
.try
{
-IL_0000: newobj ""Sub System.InvalidOperationException..ctor()""
IL_0005: throw
}
filter
{
~IL_0006: isinst ""System.IO.IOException""
IL_000b: dup
IL_000c: brtrue.s IL_0012
IL_000e: pop
IL_000f: ldc.i4.0
IL_0010: br.s IL_0027
IL_0012: dup
IL_0013: call ""Sub Microsoft.VisualBasic.CompilerServices.ProjectData.SetProjectError(System.Exception)""
IL_0018: stloc.0
-IL_0019: ldloc.0
IL_001a: call ""Function M1.filter(System.Exception) As Object""
IL_001f: call ""Function Microsoft.VisualBasic.CompilerServices.Conversions.ToBoolean(Object) As Boolean""
IL_0024: ldc.i4.0
IL_0025: cgt.un
IL_0027: endfilter
} // end filter
{ // handler
~IL_0029: pop
-IL_002a: call ""Sub System.Console.WriteLine()""
IL_002f: call ""Sub Microsoft.VisualBasic.CompilerServices.ProjectData.ClearProjectError()""
IL_0034: leave.s IL_0066
}
filter
{
~IL_0036: isinst ""System.Exception""
IL_003b: dup
IL_003c: brtrue.s IL_0042
IL_003e: pop
IL_003f: ldc.i4.0
IL_0040: br.s IL_0057
IL_0042: dup
IL_0043: call ""Sub Microsoft.VisualBasic.CompilerServices.ProjectData.SetProjectError(System.Exception)""
IL_0048: stloc.1
-IL_0049: ldloc.1
IL_004a: call ""Function M1.filter(System.Exception) As Object""
IL_004f: call ""Function Microsoft.VisualBasic.CompilerServices.Conversions.ToBoolean(Object) As Boolean""
IL_0054: ldc.i4.0
IL_0055: cgt.un
IL_0057: endfilter
} // end filter
{ // handler
~IL_0059: pop
-IL_005a: call ""Sub System.Console.WriteLine()""
IL_005f: call ""Sub Microsoft.VisualBasic.CompilerServices.ProjectData.ClearProjectError()""
IL_0064: leave.s IL_0066
}
-IL_0066: ret
}
", sequencePoints:="M1.Main")
End Sub
<Fact()>
Public Sub TestBasic1()
Dim source =
<compilation>
<file><![CDATA[
Option Strict On
Module Module1
Sub Main()
Dim x As Integer = 3
Do While (x <= 3)
Dim y As Integer = x + 1
x = y
Loop
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(
source,
TestOptions.DebugExe)
compilation.VerifyPdb("Module1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Module1" methodName="Main"/>
<methods>
<method containingType="Module1" name="Main">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
<slot kind="0" offset="65"/>
<slot kind="1" offset="30"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="4" startColumn="5" endLine="4" endColumn="15" document="1"/>
<entry offset="0x1" startLine="5" startColumn="13" endLine="5" endColumn="29" document="1"/>
<entry offset="0x3" hidden="true" document="1"/>
<entry offset="0x5" startLine="7" startColumn="17" endLine="7" endColumn="37" document="1"/>
<entry offset="0x9" startLine="8" startColumn="13" endLine="8" endColumn="18" document="1"/>
<entry offset="0xb" startLine="9" startColumn="9" endLine="9" endColumn="13" document="1"/>
<entry offset="0xc" startLine="6" startColumn="9" endLine="6" endColumn="26" document="1"/>
<entry offset="0x14" hidden="true" document="1"/>
<entry offset="0x17" startLine="10" startColumn="5" endLine="10" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x18">
<currentnamespace name=""/>
<local name="x" il_index="0" il_start="0x0" il_end="0x18" attributes="0"/>
<scope startOffset="0x5" endOffset="0xb">
<local name="y" il_index="1" il_start="0x5" il_end="0xb" attributes="0"/>
</scope>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact()>
Public Sub TestBasicCtor()
Dim source =
<compilation>
<file><![CDATA[
Class C1
Sub New()
System.Console.WriteLine("Hello, world.")
End Sub
End Class
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll)
compilation.VerifyPdb("C1..ctor",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="C1" name=".ctor">
<sequencePoints>
<entry offset="0x0" startLine="2" startColumn="5" endLine="2" endColumn="14" document="1"/>
<entry offset="0x8" startLine="3" startColumn="9" endLine="3" endColumn="50" document="1"/>
<entry offset="0x13" startLine="4" startColumn="5" endLine="4" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x14">
<currentnamespace name=""/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact()>
Public Sub TestLabels()
Dim source =
<compilation>
<file><![CDATA[
Class C1
Sub New()
label1:
label2:
label3:
goto label2:
End Sub
End Class
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll)
compilation.VerifyPdb("C1..ctor",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="C1" name=".ctor">
<sequencePoints>
<entry offset="0x0" startLine="2" startColumn="5" endLine="2" endColumn="14" document="1"/>
<entry offset="0x8" startLine="3" startColumn="9" endLine="3" endColumn="16" document="1"/>
<entry offset="0x9" startLine="4" startColumn="9" endLine="4" endColumn="16" document="1"/>
<entry offset="0xa" startLine="5" startColumn="9" endLine="5" endColumn="16" document="1"/>
<entry offset="0xb" startLine="7" startColumn="9" endLine="7" endColumn="20" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xd">
<currentnamespace name=""/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact()>
Public Sub IfStatement()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Class C
Sub F()
If G() Then
Console.WriteLine(1)
Else
Console.WriteLine(2)
End If
Console.WriteLine(3)
End Sub
Function G() As Boolean
Return False
End Function
End Class
]]></file>
</compilation>
Dim compilation = CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll)
Dim v = CompileAndVerify(compilation)
v.VerifyIL("C.F", "
{
// Code size 38 (0x26)
.maxstack 1
.locals init (Boolean V_0)
-IL_0000: nop
-IL_0001: ldarg.0
IL_0002: call ""Function C.G() As Boolean""
IL_0007: stloc.0
~IL_0008: ldloc.0
IL_0009: brfalse.s IL_0015
-IL_000b: ldc.i4.1
IL_000c: call ""Sub System.Console.WriteLine(Integer)""
IL_0011: nop
-IL_0012: nop
IL_0013: br.s IL_001e
-IL_0015: nop
-IL_0016: ldc.i4.2
IL_0017: call ""Sub System.Console.WriteLine(Integer)""
IL_001c: nop
-IL_001d: nop
-IL_001e: ldc.i4.3
IL_001f: call ""Sub System.Console.WriteLine(Integer)""
IL_0024: nop
-IL_0025: ret
}
", sequencePoints:="C.F")
v.VerifyPdb("C.F",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="C" name="F">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="1" offset="0"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="4" startColumn="5" endLine="4" endColumn="12" document="1"/>
<entry offset="0x1" startLine="5" startColumn="9" endLine="5" endColumn="20" document="1"/>
<entry offset="0x8" hidden="true" document="1"/>
<entry offset="0xb" startLine="6" startColumn="13" endLine="6" endColumn="33" document="1"/>
<entry offset="0x12" startLine="9" startColumn="9" endLine="9" endColumn="15" document="1"/>
<entry offset="0x15" startLine="7" startColumn="9" endLine="7" endColumn="13" document="1"/>
<entry offset="0x16" startLine="8" startColumn="13" endLine="8" endColumn="33" document="1"/>
<entry offset="0x1d" startLine="9" startColumn="9" endLine="9" endColumn="15" document="1"/>
<entry offset="0x1e" startLine="11" startColumn="9" endLine="11" endColumn="29" document="1"/>
<entry offset="0x25" startLine="12" startColumn="5" endLine="12" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x26">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact>
Public Sub DoWhileStatement()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Class C
Sub F()
Do While G()
Console.WriteLine(1)
Loop
End Sub
Function G() As Boolean
Return False
End Function
End Class
]]></file>
</compilation>
Dim compilation = CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll)
Dim v = CompileAndVerify(compilation)
v.VerifyIL("C.F", "
{
// Code size 22 (0x16)
.maxstack 1
.locals init (Boolean V_0)
-IL_0000: nop
~IL_0001: br.s IL_000b
-IL_0003: ldc.i4.1
IL_0004: call ""Sub System.Console.WriteLine(Integer)""
IL_0009: nop
-IL_000a: nop
-IL_000b: ldarg.0
IL_000c: call ""Function C.G() As Boolean""
IL_0011: stloc.0
~IL_0012: ldloc.0
IL_0013: brtrue.s IL_0003
-IL_0015: ret
}
", sequencePoints:="C.F")
v.VerifyPdb("C.F",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="C" name="F">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="1" offset="0"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="4" startColumn="5" endLine="4" endColumn="12" document="1"/>
<entry offset="0x1" hidden="true" document="1"/>
<entry offset="0x3" startLine="6" startColumn="13" endLine="6" endColumn="33" document="1"/>
<entry offset="0xa" startLine="7" startColumn="9" endLine="7" endColumn="13" document="1"/>
<entry offset="0xb" startLine="5" startColumn="9" endLine="5" endColumn="21" document="1"/>
<entry offset="0x12" hidden="true" document="1"/>
<entry offset="0x15" startLine="8" startColumn="5" endLine="8" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x16">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact>
Public Sub DoLoopWhileStatement()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Class C
Sub F()
Do
Console.WriteLine(1)
Loop While G()
End Sub
Function G() As Boolean
Return False
End Function
End Class
]]></file>
</compilation>
Dim compilation = CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll)
Dim v = CompileAndVerify(compilation)
v.VerifyIL("C.F", "
{
// Code size 21 (0x15)
.maxstack 1
.locals init (Boolean V_0)
-IL_0000: nop
-IL_0001: nop
-IL_0002: ldc.i4.1
IL_0003: call ""Sub System.Console.WriteLine(Integer)""
IL_0008: nop
-IL_0009: nop
IL_000a: ldarg.0
IL_000b: call ""Function C.G() As Boolean""
IL_0010: stloc.0
~IL_0011: ldloc.0
IL_0012: brtrue.s IL_0001
-IL_0014: ret
}
", sequencePoints:="C.F")
v.VerifyPdb("C.F",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="C" name="F">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="1" offset="0"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="4" startColumn="5" endLine="4" endColumn="12" document="1"/>
<entry offset="0x1" startLine="5" startColumn="9" endLine="5" endColumn="11" document="1"/>
<entry offset="0x2" startLine="6" startColumn="13" endLine="6" endColumn="33" document="1"/>
<entry offset="0x9" startLine="7" startColumn="9" endLine="7" endColumn="23" document="1"/>
<entry offset="0x11" hidden="true" document="1"/>
<entry offset="0x14" startLine="8" startColumn="5" endLine="8" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x15">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact>
Public Sub ForStatement()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Class C
Sub F()
For a = G(0) To G(1) Step G(2)
Console.WriteLine(1)
Next
End Sub
Function G(a As Integer) As Integer
Return 10
End Function
End Class
]]></file>
</compilation>
Dim compilation = CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll)
Dim v = CompileAndVerify(compilation)
v.VerifyIL("C.F", "
{
// Code size 55 (0x37)
.maxstack 3
.locals init (Integer V_0,
Integer V_1,
Integer V_2,
Integer V_3) //a
-IL_0000: nop
-IL_0001: ldarg.0
IL_0002: ldc.i4.0
IL_0003: call ""Function C.G(Integer) As Integer""
IL_0008: stloc.0
IL_0009: ldarg.0
IL_000a: ldc.i4.1
IL_000b: call ""Function C.G(Integer) As Integer""
IL_0010: stloc.1
IL_0011: ldarg.0
IL_0012: ldc.i4.2
IL_0013: call ""Function C.G(Integer) As Integer""
IL_0018: stloc.2
IL_0019: ldloc.0
IL_001a: stloc.3
~IL_001b: br.s IL_0028
-IL_001d: ldc.i4.1
IL_001e: call ""Sub System.Console.WriteLine(Integer)""
IL_0023: nop
-IL_0024: ldloc.3
IL_0025: ldloc.2
IL_0026: add.ovf
IL_0027: stloc.3
~IL_0028: ldloc.2
IL_0029: ldc.i4.s 31
IL_002b: shr
IL_002c: ldloc.3
IL_002d: xor
IL_002e: ldloc.2
IL_002f: ldc.i4.s 31
IL_0031: shr
IL_0032: ldloc.1
IL_0033: xor
IL_0034: ble.s IL_001d
-IL_0036: ret
}", sequencePoints:="C.F")
v.VerifyPdb("C.F",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="C" name="F">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="13" offset="0"/>
<slot kind="11" offset="0"/>
<slot kind="12" offset="0"/>
<slot kind="0" offset="0"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="4" startColumn="5" endLine="4" endColumn="12" document="1"/>
<entry offset="0x1" startLine="5" startColumn="9" endLine="5" endColumn="39" document="1"/>
<entry offset="0x1b" hidden="true" document="1"/>
<entry offset="0x1d" startLine="6" startColumn="13" endLine="6" endColumn="33" document="1"/>
<entry offset="0x24" startLine="7" startColumn="9" endLine="7" endColumn="13" document="1"/>
<entry offset="0x28" hidden="true" document="1"/>
<entry offset="0x36" startLine="8" startColumn="5" endLine="8" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x37">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<scope startOffset="0x1" endOffset="0x35">
<local name="a" il_index="3" il_start="0x1" il_end="0x35" attributes="0"/>
</scope>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact>
Public Sub ForStatement_LateBound()
Dim v = CompileAndVerify(
<compilation>
<file name="a.vb">
Option Strict On
Public Class MyClass1
Public Shared Sub Main()
Dim ctrlVar As Object
Dim initValue As Object = 0
Dim limit As Object = 2
Dim stp As Object = 1
For ctrlVar = initValue To limit Step stp
System.Console.WriteLine(ctrlVar)
Next
End Sub
End Class
</file>
</compilation>, options:=TestOptions.DebugDll)
v.VerifyIL("MyClass1.Main", "
{
// Code size 70 (0x46)
.maxstack 6
.locals init (Object V_0, //ctrlVar
Object V_1, //initValue
Object V_2, //limit
Object V_3, //stp
Object V_4,
Boolean V_5,
Boolean V_6)
-IL_0000: nop
-IL_0001: ldc.i4.0
IL_0002: box ""Integer""
IL_0007: stloc.1
-IL_0008: ldc.i4.2
IL_0009: box ""Integer""
IL_000e: stloc.2
-IL_000f: ldc.i4.1
IL_0010: box ""Integer""
IL_0015: stloc.3
-IL_0016: ldloc.0
IL_0017: ldloc.1
IL_0018: ldloc.2
IL_0019: ldloc.3
IL_001a: ldloca.s V_4
IL_001c: ldloca.s V_0
IL_001e: call ""Function Microsoft.VisualBasic.CompilerServices.ObjectFlowControl.ForLoopControl.ForLoopInitObj(Object, Object, Object, Object, ByRef Object, ByRef Object) As Boolean""
IL_0023: stloc.s V_5
~IL_0025: ldloc.s V_5
IL_0027: brfalse.s IL_0045
-IL_0029: ldloc.0
IL_002a: call ""Function System.Runtime.CompilerServices.RuntimeHelpers.GetObjectValue(Object) As Object""
IL_002f: call ""Sub System.Console.WriteLine(Object)""
IL_0034: nop
-IL_0035: ldloc.0
IL_0036: ldloc.s V_4
IL_0038: ldloca.s V_0
IL_003a: call ""Function Microsoft.VisualBasic.CompilerServices.ObjectFlowControl.ForLoopControl.ForNextCheckObj(Object, Object, ByRef Object) As Boolean""
IL_003f: stloc.s V_6
~IL_0041: ldloc.s V_6
IL_0043: brtrue.s IL_0029
-IL_0045: ret
}
", sequencePoints:="MyClass1.Main")
v.VerifyPdb("MyClass1.Main",
<symbols>
<files>
<file id="1" name="a.vb" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd" checkSumAlgorithmId="ff1816ec-aa5e-4d10-87f7-6f4963833460" checkSum="87, 56, 72, A9, 63, E5, 5D, C, F3, 97, 85, 44, CF, 51, 55, 8E, 76, E7, 1D, F1, "/>
</files>
<methods>
<method containingType="MyClass1" name="Main">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
<slot kind="0" offset="35"/>
<slot kind="0" offset="72"/>
<slot kind="0" offset="105"/>
<slot kind="13" offset="134"/>
<slot kind="1" offset="134"/>
<slot kind="1" offset="134" ordinal="1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="3" startColumn="5" endLine="3" endColumn="29" document="1"/>
<entry offset="0x1" startLine="6" startColumn="13" endLine="6" endColumn="36" document="1"/>
<entry offset="0x8" startLine="7" startColumn="13" endLine="7" endColumn="32" document="1"/>
<entry offset="0xf" startLine="8" startColumn="13" endLine="8" endColumn="30" document="1"/>
<entry offset="0x16" startLine="10" startColumn="9" endLine="10" endColumn="50" document="1"/>
<entry offset="0x25" hidden="true" document="1"/>
<entry offset="0x29" startLine="11" startColumn="13" endLine="11" endColumn="46" document="1"/>
<entry offset="0x35" startLine="12" startColumn="9" endLine="12" endColumn="13" document="1"/>
<entry offset="0x41" hidden="true" document="1"/>
<entry offset="0x45" startLine="14" startColumn="5" endLine="14" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x46">
<currentnamespace name=""/>
<local name="ctrlVar" il_index="0" il_start="0x0" il_end="0x46" attributes="0"/>
<local name="initValue" il_index="1" il_start="0x0" il_end="0x46" attributes="0"/>
<local name="limit" il_index="2" il_start="0x0" il_end="0x46" attributes="0"/>
<local name="stp" il_index="3" il_start="0x0" il_end="0x46" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact>
Public Sub SelectCaseStatement()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Class C
Sub F()
Select Case G(1)
Case G(2)
Console.WriteLine(4)
Case G(3)
Console.WriteLine(5)
End Select
End Sub
Function G(a As Integer) As Integer
Return a
End Function
End Class
]]></file>
</compilation>
Dim compilation = CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll)
Dim v = CompileAndVerify(compilation)
v.VerifyIL("C.F", "
{
// Code size 56 (0x38)
.maxstack 3
.locals init (Integer V_0,
Boolean V_1)
-IL_0000: nop
-IL_0001: nop
IL_0002: ldarg.0
IL_0003: ldc.i4.1
IL_0004: call ""Function C.G(Integer) As Integer""
IL_0009: stloc.0
-IL_000a: ldloc.0
IL_000b: ldarg.0
IL_000c: ldc.i4.2
IL_000d: call ""Function C.G(Integer) As Integer""
IL_0012: ceq
IL_0014: stloc.1
~IL_0015: ldloc.1
IL_0016: brfalse.s IL_0021
-IL_0018: ldc.i4.4
IL_0019: call ""Sub System.Console.WriteLine(Integer)""
IL_001e: nop
IL_001f: br.s IL_0036
-IL_0021: ldloc.0
IL_0022: ldarg.0
IL_0023: ldc.i4.3
IL_0024: call ""Function C.G(Integer) As Integer""
IL_0029: ceq
IL_002b: stloc.1
~IL_002c: ldloc.1
IL_002d: brfalse.s IL_0036
-IL_002f: ldc.i4.5
IL_0030: call ""Sub System.Console.WriteLine(Integer)""
IL_0035: nop
-IL_0036: nop
-IL_0037: ret
}
", sequencePoints:="C.F")
v.VerifyPdb("C.F",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="C" name="F">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="15" offset="0"/>
<slot kind="1" offset="0"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="4" startColumn="5" endLine="4" endColumn="12" document="1"/>
<entry offset="0x1" startLine="5" startColumn="9" endLine="5" endColumn="25" document="1"/>
<entry offset="0xa" startLine="6" startColumn="13" endLine="6" endColumn="22" document="1"/>
<entry offset="0x15" hidden="true" document="1"/>
<entry offset="0x18" startLine="7" startColumn="17" endLine="7" endColumn="37" document="1"/>
<entry offset="0x21" startLine="8" startColumn="13" endLine="8" endColumn="22" document="1"/>
<entry offset="0x2c" hidden="true" document="1"/>
<entry offset="0x2f" startLine="9" startColumn="17" endLine="9" endColumn="37" document="1"/>
<entry offset="0x36" startLine="10" startColumn="9" endLine="10" endColumn="19" document="1"/>
<entry offset="0x37" startLine="11" startColumn="5" endLine="11" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x38">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact()>
Public Sub TestIfThenAndBlocks()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module Module1
Sub Main(args As String())
Dim x As Integer = 0, xx = New Integer()
If x < 10 Then Dim s As String = "hi" : Console.WriteLine(s) Else Console.WriteLine("bye") : Console.WriteLine("bye1")
If x > 10 Then Console.WriteLine("hi") : Console.WriteLine("hi1") Else Dim s As String = "bye" : Console.WriteLine(s)
Do While x < 5
If x < 1 Then
Console.WriteLine("<1")
ElseIf x < 2 Then
Dim s2 As String = "<2"
Console.WriteLine(s2)
ElseIf x < 3 Then
Dim s3 As String = "<3"
Console.WriteLine(s3)
Else
Dim e1 As String = "Else"
Console.WriteLine(e1)
End If
Dim newX As Integer = x + 1
x = newX
Loop
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugExe)
compilation.VerifyPdb("Module1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Module1" methodName="Main" parameterNames="args"/>
<methods>
<method containingType="Module1" name="Main" parameterNames="args">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
<slot kind="0" offset="22"/>
<slot kind="1" offset="52"/>
<slot kind="0" offset="71"/>
<slot kind="1" offset="180"/>
<slot kind="0" offset="255"/>
<slot kind="0" offset="753"/>
<slot kind="1" offset="337"/>
<slot kind="1" offset="405"/>
<slot kind="0" offset="444"/>
<slot kind="1" offset="516"/>
<slot kind="0" offset="555"/>
<slot kind="0" offset="653"/>
<slot kind="1" offset="309"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="4" startColumn="5" endLine="4" endColumn="31" document="1"/>
<entry offset="0x1" startLine="6" startColumn="13" endLine="6" endColumn="29" document="1"/>
<entry offset="0x3" startLine="6" startColumn="31" endLine="6" endColumn="49" document="1"/>
<entry offset="0xb" startLine="8" startColumn="9" endLine="8" endColumn="23" document="1"/>
<entry offset="0x11" hidden="true" document="1"/>
<entry offset="0x14" startLine="8" startColumn="28" endLine="8" endColumn="46" document="1"/>
<entry offset="0x1a" startLine="8" startColumn="49" endLine="8" endColumn="69" document="1"/>
<entry offset="0x23" startLine="8" startColumn="70" endLine="8" endColumn="74" document="1"/>
<entry offset="0x24" startLine="8" startColumn="75" endLine="8" endColumn="99" document="1"/>
<entry offset="0x2f" startLine="8" startColumn="102" endLine="8" endColumn="127" document="1"/>
<entry offset="0x3a" startLine="9" startColumn="9" endLine="9" endColumn="23" document="1"/>
<entry offset="0x41" hidden="true" document="1"/>
<entry offset="0x45" startLine="9" startColumn="24" endLine="9" endColumn="47" document="1"/>
<entry offset="0x50" startLine="9" startColumn="50" endLine="9" endColumn="74" document="1"/>
<entry offset="0x5d" startLine="9" startColumn="75" endLine="9" endColumn="79" document="1"/>
<entry offset="0x5e" startLine="9" startColumn="84" endLine="9" endColumn="103" document="1"/>
<entry offset="0x65" startLine="9" startColumn="106" endLine="9" endColumn="126" document="1"/>
<entry offset="0x6d" hidden="true" document="1"/>
<entry offset="0x6f" startLine="12" startColumn="13" endLine="12" endColumn="26" document="1"/>
<entry offset="0x75" hidden="true" document="1"/>
<entry offset="0x79" startLine="13" startColumn="17" endLine="13" endColumn="40" document="1"/>
<entry offset="0x84" startLine="23" startColumn="13" endLine="23" endColumn="19" document="1"/>
<entry offset="0x87" startLine="14" startColumn="13" endLine="14" endColumn="30" document="1"/>
<entry offset="0x8d" hidden="true" document="1"/>
<entry offset="0x91" startLine="15" startColumn="21" endLine="15" endColumn="40" document="1"/>
<entry offset="0x98" startLine="16" startColumn="17" endLine="16" endColumn="38" document="1"/>
<entry offset="0xa0" startLine="23" startColumn="13" endLine="23" endColumn="19" document="1"/>
<entry offset="0xa3" startLine="17" startColumn="13" endLine="17" endColumn="30" document="1"/>
<entry offset="0xa9" hidden="true" document="1"/>
<entry offset="0xad" startLine="18" startColumn="21" endLine="18" endColumn="40" document="1"/>
<entry offset="0xb4" startLine="19" startColumn="17" endLine="19" endColumn="38" document="1"/>
<entry offset="0xbc" startLine="23" startColumn="13" endLine="23" endColumn="19" document="1"/>
<entry offset="0xbf" startLine="20" startColumn="13" endLine="20" endColumn="17" document="1"/>
<entry offset="0xc0" startLine="21" startColumn="21" endLine="21" endColumn="42" document="1"/>
<entry offset="0xc7" startLine="22" startColumn="17" endLine="22" endColumn="38" document="1"/>
<entry offset="0xcf" startLine="23" startColumn="13" endLine="23" endColumn="19" document="1"/>
<entry offset="0xd0" startLine="25" startColumn="17" endLine="25" endColumn="40" document="1"/>
<entry offset="0xd5" startLine="26" startColumn="13" endLine="26" endColumn="21" document="1"/>
<entry offset="0xd8" startLine="27" startColumn="9" endLine="27" endColumn="13" document="1"/>
<entry offset="0xd9" startLine="11" startColumn="9" endLine="11" endColumn="23" document="1"/>
<entry offset="0xdf" hidden="true" document="1"/>
<entry offset="0xe3" startLine="29" startColumn="5" endLine="29" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xe4">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="x" il_index="0" il_start="0x0" il_end="0xe4" attributes="0"/>
<local name="xx" il_index="1" il_start="0x0" il_end="0xe4" attributes="0"/>
<scope startOffset="0x14" endOffset="0x20">
<local name="s" il_index="3" il_start="0x14" il_end="0x20" attributes="0"/>
</scope>
<scope startOffset="0x5e" endOffset="0x6c">
<local name="s" il_index="5" il_start="0x5e" il_end="0x6c" attributes="0"/>
</scope>
<scope startOffset="0x6f" endOffset="0xd8">
<local name="newX" il_index="6" il_start="0x6f" il_end="0xd8" attributes="0"/>
<scope startOffset="0x91" endOffset="0xa0">
<local name="s2" il_index="9" il_start="0x91" il_end="0xa0" attributes="0"/>
</scope>
<scope startOffset="0xad" endOffset="0xbc">
<local name="s3" il_index="11" il_start="0xad" il_end="0xbc" attributes="0"/>
</scope>
<scope startOffset="0xc0" endOffset="0xcf">
<local name="e1" il_index="12" il_start="0xc0" il_end="0xcf" attributes="0"/>
</scope>
</scope>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact>
Public Sub TestTopConditionDoLoop()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module Module1
Sub Main(args As String())
Dim x As Integer = 0
Do While x < 5
If x < 1 Then
Console.WriteLine("<1")
ElseIf x < 2 Then
Dim s2 As String = "<2"
Console.WriteLine(s2)
ElseIf x < 3 Then
Dim s3 As String = "<3"
Console.WriteLine(s3)
Else
Dim e1 As String = "Else"
Console.WriteLine(e1)
End If
Dim newX As Integer = x + 1
x = newX
Loop
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugExe)
compilation.VerifyPdb("Module1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Module1" methodName="Main" parameterNames="args"/>
<methods>
<method containingType="Module1" name="Main" parameterNames="args">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
<slot kind="0" offset="474"/>
<slot kind="1" offset="58"/>
<slot kind="1" offset="126"/>
<slot kind="0" offset="165"/>
<slot kind="1" offset="237"/>
<slot kind="0" offset="276"/>
<slot kind="0" offset="374"/>
<slot kind="1" offset="30"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="4" startColumn="5" endLine="4" endColumn="31" document="1"/>
<entry offset="0x1" startLine="6" startColumn="13" endLine="6" endColumn="29" document="1"/>
<entry offset="0x3" hidden="true" document="1"/>
<entry offset="0x5" startLine="8" startColumn="13" endLine="8" endColumn="26" document="1"/>
<entry offset="0xa" hidden="true" document="1"/>
<entry offset="0xd" startLine="9" startColumn="17" endLine="9" endColumn="40" document="1"/>
<entry offset="0x18" startLine="19" startColumn="13" endLine="19" endColumn="19" document="1"/>
<entry offset="0x1b" startLine="10" startColumn="13" endLine="10" endColumn="30" document="1"/>
<entry offset="0x20" hidden="true" document="1"/>
<entry offset="0x23" startLine="11" startColumn="21" endLine="11" endColumn="40" document="1"/>
<entry offset="0x2a" startLine="12" startColumn="17" endLine="12" endColumn="38" document="1"/>
<entry offset="0x32" startLine="19" startColumn="13" endLine="19" endColumn="19" document="1"/>
<entry offset="0x35" startLine="13" startColumn="13" endLine="13" endColumn="30" document="1"/>
<entry offset="0x3b" hidden="true" document="1"/>
<entry offset="0x3f" startLine="14" startColumn="21" endLine="14" endColumn="40" document="1"/>
<entry offset="0x46" startLine="15" startColumn="17" endLine="15" endColumn="38" document="1"/>
<entry offset="0x4e" startLine="19" startColumn="13" endLine="19" endColumn="19" document="1"/>
<entry offset="0x51" startLine="16" startColumn="13" endLine="16" endColumn="17" document="1"/>
<entry offset="0x52" startLine="17" startColumn="21" endLine="17" endColumn="42" document="1"/>
<entry offset="0x59" startLine="18" startColumn="17" endLine="18" endColumn="38" document="1"/>
<entry offset="0x61" startLine="19" startColumn="13" endLine="19" endColumn="19" document="1"/>
<entry offset="0x62" startLine="21" startColumn="17" endLine="21" endColumn="40" document="1"/>
<entry offset="0x66" startLine="22" startColumn="13" endLine="22" endColumn="21" document="1"/>
<entry offset="0x68" startLine="23" startColumn="9" endLine="23" endColumn="13" document="1"/>
<entry offset="0x69" startLine="7" startColumn="9" endLine="7" endColumn="23" document="1"/>
<entry offset="0x6f" hidden="true" document="1"/>
<entry offset="0x73" startLine="25" startColumn="5" endLine="25" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x74">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="x" il_index="0" il_start="0x0" il_end="0x74" attributes="0"/>
<scope startOffset="0x5" endOffset="0x68">
<local name="newX" il_index="1" il_start="0x5" il_end="0x68" attributes="0"/>
<scope startOffset="0x23" endOffset="0x32">
<local name="s2" il_index="4" il_start="0x23" il_end="0x32" attributes="0"/>
</scope>
<scope startOffset="0x3f" endOffset="0x4e">
<local name="s3" il_index="6" il_start="0x3f" il_end="0x4e" attributes="0"/>
</scope>
<scope startOffset="0x52" endOffset="0x61">
<local name="e1" il_index="7" il_start="0x52" il_end="0x61" attributes="0"/>
</scope>
</scope>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact>
Public Sub TestBottomConditionDoLoop()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module Module1
Sub Main(args As String())
Dim x As Integer = 0
Do
If x < 1 Then
Console.WriteLine("<1")
ElseIf x < 2 Then
Dim s2 As String = "<2"
Console.WriteLine(s2)
ElseIf x < 3 Then
Dim s3 As String = "<3"
Console.WriteLine(s3)
Else
Dim e1 As String = "Else"
Console.WriteLine(e1)
End If
Dim newX As Integer = x + 1
x = newX
Loop While x < 5
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(
source,
TestOptions.DebugExe)
compilation.VerifyPdb("Module1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Module1" methodName="Main" parameterNames="args"/>
<methods>
<method containingType="Module1" name="Main" parameterNames="args">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
<slot kind="0" offset="464"/>
<slot kind="1" offset="48"/>
<slot kind="1" offset="116"/>
<slot kind="0" offset="155"/>
<slot kind="1" offset="227"/>
<slot kind="0" offset="266"/>
<slot kind="0" offset="364"/>
<slot kind="1" offset="32"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="4" startColumn="5" endLine="4" endColumn="31" document="1"/>
<entry offset="0x1" startLine="6" startColumn="13" endLine="6" endColumn="29" document="1"/>
<entry offset="0x3" startLine="8" startColumn="9" endLine="8" endColumn="11" document="1"/>
<entry offset="0x4" startLine="9" startColumn="13" endLine="9" endColumn="26" document="1"/>
<entry offset="0x9" hidden="true" document="1"/>
<entry offset="0xc" startLine="10" startColumn="17" endLine="10" endColumn="40" document="1"/>
<entry offset="0x17" startLine="20" startColumn="13" endLine="20" endColumn="19" document="1"/>
<entry offset="0x1a" startLine="11" startColumn="13" endLine="11" endColumn="30" document="1"/>
<entry offset="0x1f" hidden="true" document="1"/>
<entry offset="0x22" startLine="12" startColumn="21" endLine="12" endColumn="40" document="1"/>
<entry offset="0x29" startLine="13" startColumn="17" endLine="13" endColumn="38" document="1"/>
<entry offset="0x31" startLine="20" startColumn="13" endLine="20" endColumn="19" document="1"/>
<entry offset="0x34" startLine="14" startColumn="13" endLine="14" endColumn="30" document="1"/>
<entry offset="0x3a" hidden="true" document="1"/>
<entry offset="0x3e" startLine="15" startColumn="21" endLine="15" endColumn="40" document="1"/>
<entry offset="0x45" startLine="16" startColumn="17" endLine="16" endColumn="38" document="1"/>
<entry offset="0x4d" startLine="20" startColumn="13" endLine="20" endColumn="19" document="1"/>
<entry offset="0x50" startLine="17" startColumn="13" endLine="17" endColumn="17" document="1"/>
<entry offset="0x51" startLine="18" startColumn="21" endLine="18" endColumn="42" document="1"/>
<entry offset="0x58" startLine="19" startColumn="17" endLine="19" endColumn="38" document="1"/>
<entry offset="0x60" startLine="20" startColumn="13" endLine="20" endColumn="19" document="1"/>
<entry offset="0x61" startLine="22" startColumn="17" endLine="22" endColumn="40" document="1"/>
<entry offset="0x65" startLine="23" startColumn="13" endLine="23" endColumn="21" document="1"/>
<entry offset="0x67" startLine="24" startColumn="9" endLine="24" endColumn="25" document="1"/>
<entry offset="0x6e" hidden="true" document="1"/>
<entry offset="0x72" startLine="26" startColumn="5" endLine="26" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x73">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="x" il_index="0" il_start="0x0" il_end="0x73" attributes="0"/>
<scope startOffset="0x4" endOffset="0x67">
<local name="newX" il_index="1" il_start="0x4" il_end="0x67" attributes="0"/>
<scope startOffset="0x22" endOffset="0x31">
<local name="s2" il_index="4" il_start="0x22" il_end="0x31" attributes="0"/>
</scope>
<scope startOffset="0x3e" endOffset="0x4d">
<local name="s3" il_index="6" il_start="0x3e" il_end="0x4d" attributes="0"/>
</scope>
<scope startOffset="0x51" endOffset="0x60">
<local name="e1" il_index="7" il_start="0x51" il_end="0x60" attributes="0"/>
</scope>
</scope>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact>
Public Sub TestInfiniteLoop()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module Module1
Sub Main(args As String())
Dim x As Integer = 0
Do
Dim newX As Integer = x + 1
x = newX
Loop
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugExe)
compilation.VerifyPdb("Module1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Module1" methodName="Main" parameterNames="args"/>
<methods>
<method containingType="Module1" name="Main" parameterNames="args">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
<slot kind="0" offset="52"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="4" startColumn="5" endLine="4" endColumn="31" document="1"/>
<entry offset="0x1" startLine="6" startColumn="13" endLine="6" endColumn="29" document="1"/>
<entry offset="0x3" startLine="8" startColumn="9" endLine="8" endColumn="11" document="1"/>
<entry offset="0x4" startLine="9" startColumn="17" endLine="9" endColumn="40" document="1"/>
<entry offset="0x8" startLine="10" startColumn="13" endLine="10" endColumn="21" document="1"/>
<entry offset="0xa" startLine="11" startColumn="9" endLine="11" endColumn="13" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xd">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="x" il_index="0" il_start="0x0" il_end="0xd" attributes="0"/>
<scope startOffset="0x4" endOffset="0xa">
<local name="newX" il_index="1" il_start="0x4" il_end="0xa" attributes="0"/>
</scope>
</scope>
</method>
</methods>
</symbols>)
End Sub
<WorkItem(527647, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/527647")>
<Fact>
Public Sub ExtraSequencePointForEndIf()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Public Module MyMod
Public Sub Main(args As String())
If (args IsNot Nothing) Then
Console.WriteLine("Then")
Else
Console.WriteLine("Else")
End If
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(
source,
TestOptions.DebugExe)
' By Design (better than Dev10): <entry offset="0x19" startLine="10" startColumn="9" endLine="10" endColumn="15" document="1"/>
compilation.VerifyPdb("MyMod.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="MyMod" methodName="Main" parameterNames="args"/>
<methods>
<method containingType="MyMod" name="Main" parameterNames="args">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="1" offset="0"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="5" startColumn="5" endLine="5" endColumn="38" document="1"/>
<entry offset="0x1" startLine="6" startColumn="9" endLine="6" endColumn="37" document="1"/>
<entry offset="0x6" hidden="true" document="1"/>
<entry offset="0x9" startLine="7" startColumn="13" endLine="7" endColumn="38" document="1"/>
<entry offset="0x14" startLine="10" startColumn="9" endLine="10" endColumn="15" document="1"/>
<entry offset="0x17" startLine="8" startColumn="9" endLine="8" endColumn="13" document="1"/>
<entry offset="0x18" startLine="9" startColumn="13" endLine="9" endColumn="38" document="1"/>
<entry offset="0x23" startLine="10" startColumn="9" endLine="10" endColumn="15" document="1"/>
<entry offset="0x24" startLine="11" startColumn="5" endLine="11" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x25">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<WorkItem(538821, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538821")>
<Fact()>
Public Sub MissingSequencePointForOptimizedIfThen()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Public Module MyMod
Public Sub Main()
Console.WriteLine("B")
If "x"c = "X"c Then
Console.WriteLine("=")
End If
If "z"c <> "z"c Then
Console.WriteLine("<>")
End If
Console.WriteLine("E")
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugExe)
CompileAndVerify(compilation).VerifyIL("MyMod.Main", "
{
// Code size 34 (0x22)
.maxstack 1
.locals init (Boolean V_0,
Boolean V_1)
-IL_0000: nop
-IL_0001: ldstr ""B""
IL_0006: call ""Sub System.Console.WriteLine(String)""
IL_000b: nop
-IL_000c: ldc.i4.0
IL_000d: stloc.0
IL_000e: br.s IL_0010
-IL_0010: nop
-IL_0011: ldc.i4.0
IL_0012: stloc.1
IL_0013: br.s IL_0015
-IL_0015: nop
-IL_0016: ldstr ""E""
IL_001b: call ""Sub System.Console.WriteLine(String)""
IL_0020: nop
-IL_0021: ret
}
", sequencePoints:="MyMod.Main")
compilation.VerifyPdb("MyMod.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="MyMod" methodName="Main"/>
<methods>
<method containingType="MyMod" name="Main">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="1" offset="34"/>
<slot kind="1" offset="117"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="5" startColumn="5" endLine="5" endColumn="22" document="1"/>
<entry offset="0x1" startLine="6" startColumn="9" endLine="6" endColumn="31" document="1"/>
<entry offset="0xc" startLine="8" startColumn="9" endLine="8" endColumn="28" document="1"/>
<entry offset="0x10" startLine="10" startColumn="9" endLine="10" endColumn="15" document="1"/>
<entry offset="0x11" startLine="12" startColumn="9" endLine="12" endColumn="29" document="1"/>
<entry offset="0x15" startLine="14" startColumn="9" endLine="14" endColumn="15" document="1"/>
<entry offset="0x16" startLine="16" startColumn="9" endLine="16" endColumn="31" document="1"/>
<entry offset="0x21" startLine="17" startColumn="5" endLine="17" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x22">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact()>
Public Sub MissingSequencePointForTrivialIfThen()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module Module1
Sub Main()
' one
If (False) Then
Dim x As String = "hello"
Show(x)
End If
' two
If (False) Then Show("hello")
Try
Catch ex As Exception
Finally
' three
If (False) Then Show("hello")
End Try
End Sub
Function Show(s As String) As Integer
Console.WriteLine(s)
Return 1
End Function
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(
source,
TestOptions.DebugExe)
compilation.VerifyPdb("Module1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Module1" methodName="Main"/>
<methods>
<method containingType="Module1" name="Main">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="1" offset="0"/>
<slot kind="0" offset="33"/>
<slot kind="1" offset="118"/>
<slot kind="0" offset="172"/>
<slot kind="1" offset="245"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="5" startColumn="5" endLine="5" endColumn="15" document="1"/>
<entry offset="0x1" startLine="8" startColumn="9" endLine="8" endColumn="24" document="1"/>
<entry offset="0x5" startLine="11" startColumn="9" endLine="11" endColumn="15" document="1"/>
<entry offset="0x6" startLine="14" startColumn="9" endLine="14" endColumn="24" document="1"/>
<entry offset="0xa" hidden="true" document="1"/>
<entry offset="0xb" startLine="16" startColumn="9" endLine="16" endColumn="12" document="1"/>
<entry offset="0xe" hidden="true" document="1"/>
<entry offset="0x15" startLine="17" startColumn="9" endLine="17" endColumn="30" document="1"/>
<entry offset="0x1d" hidden="true" document="1"/>
<entry offset="0x1f" startLine="18" startColumn="9" endLine="18" endColumn="16" document="1"/>
<entry offset="0x20" startLine="20" startColumn="13" endLine="20" endColumn="28" document="1"/>
<entry offset="0x25" hidden="true" document="1"/>
<entry offset="0x26" startLine="21" startColumn="9" endLine="21" endColumn="16" document="1"/>
<entry offset="0x27" startLine="23" startColumn="5" endLine="23" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x28">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<scope startOffset="0xe" endOffset="0x1c">
<local name="ex" il_index="3" il_start="0xe" il_end="0x1c" attributes="0"/>
</scope>
</scope>
</method>
</methods>
</symbols>)
End Sub
<WorkItem(538944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538944")>
<Fact()>
Public Sub MissingEndWhileSequencePoint()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module MyMod
Sub Main(args As String())
Dim x, y, z As ULong, a, b, c As SByte
x = 10
y = 20
z = 30
a = 1
b = 2
c = 3
Dim ct As Integer = 100
Do
Console.WriteLine("Out={0}", y)
y = y + 2
While (x > a)
Do While ct - 50 > a + b * 10
b = b + 1
Console.Write("b={0} | ", b)
Do Until z <= ct / 4
Console.Write("z={0} | ", z)
Do
Console.Write("c={0} | ", c)
c = c * 2
Loop Until c > ct / 10
z = z - 4
Loop
Loop
x = x - 5
Console.WriteLine("x={0}", x)
End While
Loop While (y < 25)
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(
source,
TestOptions.DebugExe)
' startLine="33"
compilation.VerifyPdb("MyMod.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="MyMod" methodName="Main" parameterNames="args"/>
<methods>
<method containingType="MyMod" name="Main" parameterNames="args">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
<slot kind="0" offset="7"/>
<slot kind="0" offset="10"/>
<slot kind="0" offset="22"/>
<slot kind="0" offset="25"/>
<slot kind="0" offset="28"/>
<slot kind="0" offset="145"/>
<slot kind="1" offset="521"/>
<slot kind="1" offset="421"/>
<slot kind="1" offset="289"/>
<slot kind="1" offset="258"/>
<slot kind="1" offset="174"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="6" startColumn="5" endLine="6" endColumn="31" document="1"/>
<entry offset="0x1" startLine="8" startColumn="9" endLine="8" endColumn="15" document="1"/>
<entry offset="0x5" startLine="9" startColumn="9" endLine="9" endColumn="15" document="1"/>
<entry offset="0x9" startLine="10" startColumn="9" endLine="10" endColumn="15" document="1"/>
<entry offset="0xd" startLine="11" startColumn="9" endLine="11" endColumn="14" document="1"/>
<entry offset="0xf" startLine="12" startColumn="9" endLine="12" endColumn="14" document="1"/>
<entry offset="0x12" startLine="13" startColumn="9" endLine="13" endColumn="14" document="1"/>
<entry offset="0x15" startLine="14" startColumn="13" endLine="14" endColumn="32" document="1"/>
<entry offset="0x19" startLine="15" startColumn="9" endLine="15" endColumn="11" document="1"/>
<entry offset="0x1a" startLine="16" startColumn="13" endLine="16" endColumn="44" document="1"/>
<entry offset="0x2b" startLine="17" startColumn="13" endLine="17" endColumn="22" document="1"/>
<entry offset="0x43" hidden="true" document="1"/>
<entry offset="0x48" hidden="true" document="1"/>
<entry offset="0x4d" startLine="20" startColumn="21" endLine="20" endColumn="30" document="1"/>
<entry offset="0x54" startLine="21" startColumn="21" endLine="21" endColumn="49" document="1"/>
<entry offset="0x66" hidden="true" document="1"/>
<entry offset="0x68" startLine="23" startColumn="25" endLine="23" endColumn="53" document="1"/>
<entry offset="0x79" startLine="24" startColumn="25" endLine="24" endColumn="27" document="1"/>
<entry offset="0x7a" startLine="25" startColumn="29" endLine="25" endColumn="57" document="1"/>
<entry offset="0x8c" startLine="26" startColumn="29" endLine="26" endColumn="38" document="1"/>
<entry offset="0x93" startLine="27" startColumn="25" endLine="27" endColumn="47" document="1"/>
<entry offset="0xa8" hidden="true" document="1"/>
<entry offset="0xac" startLine="28" startColumn="25" endLine="28" endColumn="34" document="1"/>
<entry offset="0xc4" startLine="29" startColumn="21" endLine="29" endColumn="25" document="1"/>
<entry offset="0xc5" startLine="22" startColumn="21" endLine="22" endColumn="41" document="1"/>
<entry offset="0xdc" hidden="true" document="1"/>
<entry offset="0xe0" startLine="30" startColumn="17" endLine="30" endColumn="21" document="1"/>
<entry offset="0xe1" startLine="19" startColumn="17" endLine="19" endColumn="46" document="1"/>
<entry offset="0xf1" hidden="true" document="1"/>
<entry offset="0xf8" startLine="31" startColumn="17" endLine="31" endColumn="26" document="1"/>
<entry offset="0x110" startLine="32" startColumn="17" endLine="32" endColumn="46" document="1"/>
<entry offset="0x121" startLine="33" startColumn="13" endLine="33" endColumn="22" document="1"/>
<entry offset="0x122" startLine="18" startColumn="13" endLine="18" endColumn="26" document="1"/>
<entry offset="0x138" hidden="true" document="1"/>
<entry offset="0x13f" startLine="34" startColumn="9" endLine="34" endColumn="28" document="1"/>
<entry offset="0x158" hidden="true" document="1"/>
<entry offset="0x15f" startLine="35" startColumn="5" endLine="35" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x160">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="x" il_index="0" il_start="0x0" il_end="0x160" attributes="0"/>
<local name="y" il_index="1" il_start="0x0" il_end="0x160" attributes="0"/>
<local name="z" il_index="2" il_start="0x0" il_end="0x160" attributes="0"/>
<local name="a" il_index="3" il_start="0x0" il_end="0x160" attributes="0"/>
<local name="b" il_index="4" il_start="0x0" il_end="0x160" attributes="0"/>
<local name="c" il_index="5" il_start="0x0" il_end="0x160" attributes="0"/>
<local name="ct" il_index="6" il_start="0x0" il_end="0x160" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact()>
Public Sub TestImplicitLocals()
Dim source =
<compilation>
<file>
Option Explicit Off
Option Strict On
Imports System
Module Module1
Sub Main()
x = "Hello"
dim y as string = "world"
i% = 3
While i > 0
Console.WriteLine("{0}, {1}", x, y)
Console.WriteLine(i)
q$ = "string"
i = i% - 1
End While
End Sub
End Module
</file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(
source,
TestOptions.DebugExe)
compilation.VerifyPdb("Module1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Module1" methodName="Main"/>
<methods>
<method containingType="Module1" name="Main">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="0"/>
<slot kind="0" offset="56"/>
<slot kind="0" offset="180"/>
<slot kind="0" offset="25"/>
<slot kind="1" offset="72"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="6" startColumn="5" endLine="6" endColumn="15" document="1"/>
<entry offset="0x1" startLine="7" startColumn="9" endLine="7" endColumn="20" document="1"/>
<entry offset="0x7" startLine="8" startColumn="13" endLine="8" endColumn="34" document="1"/>
<entry offset="0xd" startLine="9" startColumn="9" endLine="9" endColumn="15" document="1"/>
<entry offset="0xf" hidden="true" document="1"/>
<entry offset="0x11" startLine="11" startColumn="13" endLine="11" endColumn="48" document="1"/>
<entry offset="0x23" startLine="12" startColumn="13" endLine="12" endColumn="33" document="1"/>
<entry offset="0x2a" startLine="13" startColumn="13" endLine="13" endColumn="26" document="1"/>
<entry offset="0x30" startLine="14" startColumn="13" endLine="14" endColumn="23" document="1"/>
<entry offset="0x34" startLine="15" startColumn="9" endLine="15" endColumn="18" document="1"/>
<entry offset="0x35" startLine="10" startColumn="9" endLine="10" endColumn="20" document="1"/>
<entry offset="0x3b" hidden="true" document="1"/>
<entry offset="0x3f" startLine="16" startColumn="5" endLine="16" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x40">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="x" il_index="0" il_start="0x0" il_end="0x40" attributes="0"/>
<local name="i" il_index="1" il_start="0x0" il_end="0x40" attributes="0"/>
<local name="q" il_index="2" il_start="0x0" il_end="0x40" attributes="0"/>
<local name="y" il_index="3" il_start="0x0" il_end="0x40" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact()>
Public Sub AddRemoveHandler()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module Module1
Sub Main(args As String())
Dim del As System.EventHandler =
Sub(sender As Object, a As EventArgs) Console.Write("unload")
Dim v = AppDomain.CreateDomain("qq")
AddHandler (v.DomainUnload), del
RemoveHandler (v.DomainUnload), del
AppDomain.Unload(v)
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(
source,
TestOptions.DebugExe)
compilation.VerifyPdb("Module1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Module1" methodName="Main" parameterNames="args"/>
<methods>
<method containingType="Module1" name="Main" parameterNames="args">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
<slot kind="0" offset="123"/>
</encLocalSlotMap>
<encLambdaMap>
<methodOrdinal>0</methodOrdinal>
<lambda offset="46"/>
</encLambdaMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="4" startColumn="5" endLine="4" endColumn="31" document="1"/>
<entry offset="0x1" startLine="5" startColumn="13" endLine="6" endColumn="74" document="1"/>
<entry offset="0x26" startLine="8" startColumn="13" endLine="8" endColumn="45" document="1"/>
<entry offset="0x31" startLine="10" startColumn="9" endLine="10" endColumn="41" document="1"/>
<entry offset="0x39" startLine="11" startColumn="9" endLine="11" endColumn="44" document="1"/>
<entry offset="0x41" startLine="13" startColumn="9" endLine="13" endColumn="28" document="1"/>
<entry offset="0x48" startLine="14" startColumn="5" endLine="14" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x49">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="del" il_index="0" il_start="0x0" il_end="0x49" attributes="0"/>
<local name="v" il_index="1" il_start="0x0" il_end="0x49" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact()>
Public Sub SelectCase_NoCaseBlocks()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module Module1
Sub Main()
Dim num As Integer = 0
Select Case num
End Select
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugExe)
compilation.VerifyPdb("Module1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Module1" methodName="Main"/>
<methods>
<method containingType="Module1" name="Main">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="3" startColumn="5" endLine="3" endColumn="15" document="1"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="31" document="1"/>
<entry offset="0x3" startLine="5" startColumn="9" endLine="5" endColumn="24" document="1"/>
<entry offset="0x4" startLine="6" startColumn="9" endLine="6" endColumn="19" document="1"/>
<entry offset="0x5" startLine="7" startColumn="5" endLine="7" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x6">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="num" il_index="0" il_start="0x0" il_end="0x6" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
CompileAndVerify(compilation, expectedOutput:="")
End Sub
<Fact()>
Public Sub SelectCase_SingleCaseStatement()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module Module1
Sub Main()
Dim num As Integer = 0
Select Case num
Case 1
End Select
Select Case num
Case Else
End Select
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugExe)
compilation.VerifyPdb("Module1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Module1" methodName="Main"/>
<methods>
<method containingType="Module1" name="Main">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="3" startColumn="5" endLine="3" endColumn="15" document="1"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="31" document="1"/>
<entry offset="0x3" startLine="5" startColumn="9" endLine="5" endColumn="24" document="1"/>
<entry offset="0xa" startLine="6" startColumn="13" endLine="6" endColumn="19" document="1"/>
<entry offset="0xd" startLine="7" startColumn="9" endLine="7" endColumn="19" document="1"/>
<entry offset="0xe" startLine="9" startColumn="9" endLine="9" endColumn="24" document="1"/>
<entry offset="0x11" startLine="10" startColumn="13" endLine="10" endColumn="22" document="1"/>
<entry offset="0x14" startLine="11" startColumn="9" endLine="11" endColumn="19" document="1"/>
<entry offset="0x15" startLine="12" startColumn="5" endLine="12" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x16">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="num" il_index="0" il_start="0x0" il_end="0x16" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
CompileAndVerify(compilation, expectedOutput:="")
End Sub
<Fact()>
Public Sub SelectCase_OnlyCaseStatements()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module Module1
Sub Main()
Dim num As Integer = 0
Select Case num
Case 1
Case 2
Case 0, 3 To 8
Case Else
End Select
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugExe)
CompileAndVerify(compilation).VerifyIL("Module1.Main", "
{
// Code size 55 (0x37)
.maxstack 2
.locals init (Integer V_0, //num
Integer V_1,
Boolean V_2)
-IL_0000: nop
-IL_0001: ldc.i4.0
IL_0002: stloc.0
-IL_0003: nop
IL_0004: ldloc.0
IL_0005: stloc.1
-IL_0006: ldloc.1
IL_0007: ldc.i4.1
IL_0008: ceq
IL_000a: stloc.2
~IL_000b: ldloc.2
IL_000c: brfalse.s IL_0010
IL_000e: br.s IL_0035
-IL_0010: ldloc.1
IL_0011: ldc.i4.2
IL_0012: ceq
IL_0014: stloc.2
~IL_0015: ldloc.2
IL_0016: brfalse.s IL_001a
IL_0018: br.s IL_0035
-IL_001a: ldloc.1
IL_001b: brfalse.s IL_002d
IL_001d: ldloc.1
IL_001e: ldc.i4.3
IL_001f: blt.s IL_002a
IL_0021: ldloc.1
IL_0022: ldc.i4.8
IL_0023: cgt
IL_0025: ldc.i4.0
IL_0026: ceq
IL_0028: br.s IL_002b
IL_002a: ldc.i4.0
IL_002b: br.s IL_002e
IL_002d: ldc.i4.1
IL_002e: stloc.2
~IL_002f: ldloc.2
IL_0030: brfalse.s IL_0034
IL_0032: br.s IL_0035
-IL_0034: nop
-IL_0035: nop
-IL_0036: ret
}
", sequencePoints:="Module1.Main")
compilation.VerifyPdb("Module1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Module1" methodName="Main"/>
<methods>
<method containingType="Module1" name="Main">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
<slot kind="15" offset="32"/>
<slot kind="1" offset="32"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="3" startColumn="5" endLine="3" endColumn="15" document="1"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="31" document="1"/>
<entry offset="0x3" startLine="5" startColumn="9" endLine="5" endColumn="24" document="1"/>
<entry offset="0x6" startLine="6" startColumn="13" endLine="6" endColumn="19" document="1"/>
<entry offset="0xb" hidden="true" document="1"/>
<entry offset="0x10" startLine="7" startColumn="13" endLine="7" endColumn="19" document="1"/>
<entry offset="0x15" hidden="true" document="1"/>
<entry offset="0x1a" startLine="8" startColumn="13" endLine="8" endColumn="27" document="1"/>
<entry offset="0x2f" hidden="true" document="1"/>
<entry offset="0x34" startLine="9" startColumn="13" endLine="9" endColumn="22" document="1"/>
<entry offset="0x35" startLine="10" startColumn="9" endLine="10" endColumn="19" document="1"/>
<entry offset="0x36" startLine="11" startColumn="5" endLine="11" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x37">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="num" il_index="0" il_start="0x0" il_end="0x37" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
CompileAndVerify(compilation, expectedOutput:="")
End Sub
<Fact()>
Public Sub SelectCase_SwitchTable()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module Module1
Sub Main()
Dim num As Integer = 0
Select Case num
Case 1
Console.WriteLine("1")
Case 2
Console.WriteLine("2")
Case 0, 3, 4, 5, 6, Is = 7, 8
Case Else
Console.WriteLine("Else")
End Select
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugExe)
compilation.VerifyPdb("Module1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Module1" methodName="Main"/>
<methods>
<method containingType="Module1" name="Main">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="3" startColumn="5" endLine="3" endColumn="15" document="1"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="31" document="1"/>
<entry offset="0x3" startLine="5" startColumn="9" endLine="5" endColumn="24" document="1"/>
<entry offset="0x30" startLine="6" startColumn="13" endLine="6" endColumn="19" document="1"/>
<entry offset="0x31" startLine="7" startColumn="17" endLine="7" endColumn="39" document="1"/>
<entry offset="0x3e" startLine="8" startColumn="13" endLine="8" endColumn="19" document="1"/>
<entry offset="0x3f" startLine="9" startColumn="17" endLine="9" endColumn="39" document="1"/>
<entry offset="0x4c" startLine="10" startColumn="13" endLine="10" endColumn="42" document="1"/>
<entry offset="0x4f" startLine="11" startColumn="13" endLine="11" endColumn="22" document="1"/>
<entry offset="0x50" startLine="12" startColumn="17" endLine="12" endColumn="42" document="1"/>
<entry offset="0x5d" startLine="13" startColumn="9" endLine="13" endColumn="19" document="1"/>
<entry offset="0x5e" startLine="14" startColumn="5" endLine="14" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x5f">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="num" il_index="0" il_start="0x0" il_end="0x5f" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
CompileAndVerify(compilation, expectedOutput:="")
End Sub
<Fact()>
Public Sub SelectCase_SwitchTable_TempUsed()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module Module1
Sub Main()
Dim num As Integer = 0
Select Case num + 1
Case 1
Console.WriteLine("")
Case 2
Console.WriteLine("2")
Case 0, 3, 4, 5, 6, Is = 7, 8
Console.WriteLine("0")
Case Else
Console.WriteLine("Else")
End Select
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugExe)
compilation.VerifyPdb("Module1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Module1" methodName="Main"/>
<methods>
<method containingType="Module1" name="Main">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
<slot kind="15" offset="32"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="3" startColumn="5" endLine="3" endColumn="15" document="1"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="31" document="1"/>
<entry offset="0x3" startLine="5" startColumn="9" endLine="5" endColumn="28" document="1"/>
<entry offset="0x34" startLine="6" startColumn="13" endLine="6" endColumn="19" document="1"/>
<entry offset="0x35" startLine="7" startColumn="17" endLine="7" endColumn="38" document="1"/>
<entry offset="0x42" startLine="8" startColumn="13" endLine="8" endColumn="19" document="1"/>
<entry offset="0x43" startLine="9" startColumn="17" endLine="9" endColumn="39" document="1"/>
<entry offset="0x50" startLine="10" startColumn="13" endLine="10" endColumn="42" document="1"/>
<entry offset="0x51" startLine="11" startColumn="17" endLine="11" endColumn="39" document="1"/>
<entry offset="0x5e" startLine="12" startColumn="13" endLine="12" endColumn="22" document="1"/>
<entry offset="0x5f" startLine="13" startColumn="17" endLine="13" endColumn="42" document="1"/>
<entry offset="0x6c" startLine="14" startColumn="9" endLine="14" endColumn="19" document="1"/>
<entry offset="0x6d" startLine="15" startColumn="5" endLine="15" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x6e">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="num" il_index="0" il_start="0x0" il_end="0x6e" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
CompileAndVerify(compilation, expectedOutput:="")
End Sub
<Fact()>
Public Sub SelectCase_IfList()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module Module1
Sub Main()
Dim num As Integer = 0
Select Case num
Case 1
Console.WriteLine("1")
Case 2
Console.WriteLine("2")
Case 0, >= 3, <= 8
Case Else
Console.WriteLine("Else")
End Select
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugExe)
compilation.VerifyPdb("Module1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Module1" methodName="Main"/>
<methods>
<method containingType="Module1" name="Main">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
<slot kind="15" offset="32"/>
<slot kind="1" offset="32"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="3" startColumn="5" endLine="3" endColumn="15" document="1"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="31" document="1"/>
<entry offset="0x3" startLine="5" startColumn="9" endLine="5" endColumn="24" document="1"/>
<entry offset="0x6" startLine="6" startColumn="13" endLine="6" endColumn="19" document="1"/>
<entry offset="0xb" hidden="true" document="1"/>
<entry offset="0xe" startLine="7" startColumn="17" endLine="7" endColumn="39" document="1"/>
<entry offset="0x1b" startLine="8" startColumn="13" endLine="8" endColumn="19" document="1"/>
<entry offset="0x20" hidden="true" document="1"/>
<entry offset="0x23" startLine="9" startColumn="17" endLine="9" endColumn="39" document="1"/>
<entry offset="0x30" startLine="10" startColumn="13" endLine="10" endColumn="31" document="1"/>
<entry offset="0x42" hidden="true" document="1"/>
<entry offset="0x47" startLine="12" startColumn="17" endLine="12" endColumn="42" document="1"/>
<entry offset="0x52" startLine="13" startColumn="9" endLine="13" endColumn="19" document="1"/>
<entry offset="0x53" startLine="14" startColumn="5" endLine="14" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x54">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="num" il_index="0" il_start="0x0" il_end="0x54" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
CompileAndVerify(compilation, expectedOutput:="")
End Sub
<Fact()>
Public Sub SelectCase_IfList_TempUsed()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module Module1
Sub Main()
Dim num As Integer = 0
Select Case num + 1
Case 1
Console.WriteLine("")
Case 2
Console.WriteLine("2")
Case 0, >= 3, <= 8
Console.WriteLine("0")
Case Else
Console.WriteLine("Else")
End Select
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugExe)
compilation.VerifyPdb("Module1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Module1" methodName="Main"/>
<methods>
<method containingType="Module1" name="Main">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
<slot kind="15" offset="32"/>
<slot kind="1" offset="32"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="3" startColumn="5" endLine="3" endColumn="15" document="1"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="31" document="1"/>
<entry offset="0x3" startLine="5" startColumn="9" endLine="5" endColumn="28" document="1"/>
<entry offset="0x8" startLine="6" startColumn="13" endLine="6" endColumn="19" document="1"/>
<entry offset="0xd" hidden="true" document="1"/>
<entry offset="0x10" startLine="7" startColumn="17" endLine="7" endColumn="38" document="1"/>
<entry offset="0x1d" startLine="8" startColumn="13" endLine="8" endColumn="19" document="1"/>
<entry offset="0x22" hidden="true" document="1"/>
<entry offset="0x25" startLine="9" startColumn="17" endLine="9" endColumn="39" document="1"/>
<entry offset="0x32" startLine="10" startColumn="13" endLine="10" endColumn="31" document="1"/>
<entry offset="0x44" hidden="true" document="1"/>
<entry offset="0x47" startLine="11" startColumn="17" endLine="11" endColumn="39" document="1"/>
<entry offset="0x54" startLine="13" startColumn="17" endLine="13" endColumn="42" document="1"/>
<entry offset="0x5f" startLine="14" startColumn="9" endLine="14" endColumn="19" document="1"/>
<entry offset="0x60" startLine="15" startColumn="5" endLine="15" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x61">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="num" il_index="0" il_start="0x0" il_end="0x61" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
CompileAndVerify(compilation, expectedOutput:="")
End Sub
<Fact()>
Public Sub SelectCase_String_SwitchTable_Hash()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module Module1
Sub Main()
Dim str As String = "00"
Select Case str
Case "01"
Console.WriteLine("01")
Case "02"
Console.WriteLine("02")
Case "00", "03", "04", "05", "06", "07", "08"
Case Else
Console.WriteLine("Else")
End Select
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugExe)
compilation.VerifyPdb("Module1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Module1" methodName="Main"/>
<methods>
<method containingType="Module1" name="Main">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
<slot kind="temp"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="3" startColumn="5" endLine="3" endColumn="15" document="1"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="33" document="1"/>
<entry offset="0x7" startLine="5" startColumn="9" endLine="5" endColumn="24" document="1"/>
<entry offset="0x135" startLine="6" startColumn="13" endLine="6" endColumn="22" document="1"/>
<entry offset="0x136" startLine="7" startColumn="17" endLine="7" endColumn="40" document="1"/>
<entry offset="0x143" startLine="8" startColumn="13" endLine="8" endColumn="22" document="1"/>
<entry offset="0x144" startLine="9" startColumn="17" endLine="9" endColumn="40" document="1"/>
<entry offset="0x151" startLine="10" startColumn="13" endLine="10" endColumn="58" document="1"/>
<entry offset="0x154" startLine="11" startColumn="13" endLine="11" endColumn="22" document="1"/>
<entry offset="0x155" startLine="12" startColumn="17" endLine="12" endColumn="42" document="1"/>
<entry offset="0x162" startLine="13" startColumn="9" endLine="13" endColumn="19" document="1"/>
<entry offset="0x163" startLine="14" startColumn="5" endLine="14" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x164">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="str" il_index="0" il_start="0x0" il_end="0x164" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
CompileAndVerify(compilation, expectedOutput:="")
End Sub
<Fact()>
Public Sub SelectCase_String_SwitchTable_NonHash()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module Module1
Sub Main()
Dim str As String = "00"
Select Case str
Case "01"
Console.WriteLine("01")
Case "02"
Case "00"
Console.WriteLine("00")
Case Else
End Select
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugExe)
compilation.VerifyPdb("Module1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Module1" methodName="Main"/>
<methods>
<method containingType="Module1" name="Main">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="3" startColumn="5" endLine="3" endColumn="15" document="1"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="33" document="1"/>
<entry offset="0x7" startLine="5" startColumn="9" endLine="5" endColumn="24" document="1"/>
<entry offset="0x34" startLine="6" startColumn="13" endLine="6" endColumn="22" document="1"/>
<entry offset="0x35" startLine="7" startColumn="17" endLine="7" endColumn="40" document="1"/>
<entry offset="0x42" startLine="8" startColumn="13" endLine="8" endColumn="22" document="1"/>
<entry offset="0x45" startLine="9" startColumn="13" endLine="9" endColumn="22" document="1"/>
<entry offset="0x46" startLine="10" startColumn="17" endLine="10" endColumn="40" document="1"/>
<entry offset="0x53" startLine="11" startColumn="13" endLine="11" endColumn="22" document="1"/>
<entry offset="0x56" startLine="12" startColumn="9" endLine="12" endColumn="19" document="1"/>
<entry offset="0x57" startLine="13" startColumn="5" endLine="13" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x58">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="str" il_index="0" il_start="0x0" il_end="0x58" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
CompileAndVerify(compilation, expectedOutput:="00")
End Sub
<Fact()>
Public Sub SelectCase_String_IfList()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module Module1
Sub Main()
Dim str As String = "00"
Select Case str
Case "01"
Console.WriteLine("01")
Case "02", 3.ToString()
Case "00"
Console.WriteLine("00")
End Select
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugExe)
compilation.VerifyPdb("Module1.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Module1" methodName="Main"/>
<methods>
<method containingType="Module1" name="Main">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
<slot kind="15" offset="34"/>
<slot kind="1" offset="34"/>
<slot kind="temp"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="3" startColumn="5" endLine="3" endColumn="15" document="1"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="33" document="1"/>
<entry offset="0x7" startLine="5" startColumn="9" endLine="5" endColumn="24" document="1"/>
<entry offset="0xa" startLine="6" startColumn="13" endLine="6" endColumn="22" document="1"/>
<entry offset="0x1a" hidden="true" document="1"/>
<entry offset="0x1d" startLine="7" startColumn="17" endLine="7" endColumn="40" document="1"/>
<entry offset="0x2a" startLine="8" startColumn="13" endLine="8" endColumn="36" document="1"/>
<entry offset="0x4f" hidden="true" document="1"/>
<entry offset="0x54" startLine="9" startColumn="13" endLine="9" endColumn="22" document="1"/>
<entry offset="0x64" hidden="true" document="1"/>
<entry offset="0x67" startLine="10" startColumn="17" endLine="10" endColumn="40" document="1"/>
<entry offset="0x72" startLine="11" startColumn="9" endLine="11" endColumn="19" document="1"/>
<entry offset="0x73" startLine="12" startColumn="5" endLine="12" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x74">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="str" il_index="0" il_start="0x0" il_end="0x74" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
CompileAndVerify(compilation, expectedOutput:="00")
End Sub
<Fact()>
Public Sub DontEmit_AnonymousType_NoKeys()
Dim source =
<compilation>
<file><![CDATA[
Class C1
Sub Method()
Dim o = New With { .a = 1 }
End Sub
End Class
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll)
compilation.VerifyPdb(
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="C1" name="Method">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="2" startColumn="5" endLine="2" endColumn="17" document="1"/>
<entry offset="0x1" startLine="3" startColumn="13" endLine="3" endColumn="36" document="1"/>
<entry offset="0x8" startLine="4" startColumn="5" endLine="4" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<currentnamespace name=""/>
<local name="o" il_index="0" il_start="0x0" il_end="0x9" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact()>
Public Sub DontEmit_AnonymousType_WithKeys()
Dim source =
<compilation>
<file><![CDATA[
Class C1
Sub Method()
Dim o = New With { Key .a = 1 }
End Sub
End Class
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll)
compilation.VerifyPdb(
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="C1" name="Method">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="2" startColumn="5" endLine="2" endColumn="17" document="1"/>
<entry offset="0x1" startLine="3" startColumn="13" endLine="3" endColumn="40" document="1"/>
<entry offset="0x8" startLine="4" startColumn="5" endLine="4" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<currentnamespace name=""/>
<local name="o" il_index="0" il_start="0x0" il_end="0x9" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<WorkItem(727419, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/727419")>
<Fact()>
Public Sub Bug727419()
Dim source =
<compilation>
<file><![CDATA[
Option Strict Off
Option Explicit Off
Imports System
Class GooDerived
Public Sub ComputeMatrix(ByVal rank As Integer)
Dim I As Integer
Dim J As Long
Dim q() As Long
Dim count As Long
Dim dims() As Long
' allocate space for arrays
ReDim q(rank)
ReDim dims(rank)
' create the dimensions
count = 1
For I = 0 To rank - 1
q(I) = 0
dims(I) = CLng(2 ^ I)
count *= dims(I)
Next I
End Sub
End Class
Module Variety
Sub Main()
Dim a As New GooDerived()
a.ComputeMatrix(2)
End Sub
End Module
' End of File
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(
source,
TestOptions.DebugExe)
compilation.VerifyPdb("GooDerived.ComputeMatrix",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="Variety" methodName="Main"/>
<methods>
<method containingType="GooDerived" name="ComputeMatrix" parameterNames="rank">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
<slot kind="0" offset="30"/>
<slot kind="0" offset="53"/>
<slot kind="0" offset="78"/>
<slot kind="0" offset="105"/>
<slot kind="11" offset="271"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="6" startColumn="5" endLine="6" endColumn="52" document="1"/>
<entry offset="0x1" startLine="14" startColumn="15" endLine="14" endColumn="22" document="1"/>
<entry offset="0xa" startLine="15" startColumn="15" endLine="15" endColumn="25" document="1"/>
<entry offset="0x14" startLine="18" startColumn="9" endLine="18" endColumn="18" document="1"/>
<entry offset="0x17" startLine="19" startColumn="9" endLine="19" endColumn="30" document="1"/>
<entry offset="0x1e" hidden="true" document="1"/>
<entry offset="0x20" startLine="20" startColumn="13" endLine="20" endColumn="21" document="1"/>
<entry offset="0x25" startLine="21" startColumn="13" endLine="21" endColumn="34" document="1"/>
<entry offset="0x3f" startLine="22" startColumn="13" endLine="22" endColumn="29" document="1"/>
<entry offset="0x46" startLine="23" startColumn="9" endLine="23" endColumn="15" document="1"/>
<entry offset="0x4a" hidden="true" document="1"/>
<entry offset="0x4f" startLine="24" startColumn="5" endLine="24" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x50">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="I" il_index="0" il_start="0x0" il_end="0x50" attributes="0"/>
<local name="J" il_index="1" il_start="0x0" il_end="0x50" attributes="0"/>
<local name="q" il_index="2" il_start="0x0" il_end="0x50" attributes="0"/>
<local name="count" il_index="3" il_start="0x0" il_end="0x50" attributes="0"/>
<local name="dims" il_index="4" il_start="0x0" il_end="0x50" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<WorkItem(722627, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/722627")>
<Fact()>
Public Sub Bug722627()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Friend Module SubMod
Sub Main()
L0:
GoTo L2
L1:
Exit Sub
L2:
GoTo L1
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(
source,
TestOptions.DebugExe)
compilation.VerifyPdb("SubMod.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="SubMod" methodName="Main"/>
<methods>
<method containingType="SubMod" name="Main">
<sequencePoints>
<entry offset="0x0" startLine="3" startColumn="5" endLine="3" endColumn="15" document="1"/>
<entry offset="0x1" startLine="4" startColumn="1" endLine="4" endColumn="4" document="1"/>
<entry offset="0x2" startLine="5" startColumn="9" endLine="5" endColumn="16" document="1"/>
<entry offset="0x4" startLine="6" startColumn="1" endLine="6" endColumn="4" document="1"/>
<entry offset="0x5" startLine="7" startColumn="9" endLine="7" endColumn="17" document="1"/>
<entry offset="0x7" startLine="8" startColumn="1" endLine="8" endColumn="4" document="1"/>
<entry offset="0x8" startLine="9" startColumn="9" endLine="9" endColumn="16" document="1"/>
<entry offset="0xa" startLine="10" startColumn="5" endLine="10" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xb">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<WorkItem(543703, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543703")>
<Fact()>
Public Sub DontIncludeMethodAttributesInSeqPoint()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module M1
Sub Main()
S()
End Sub
<System.Runtime.InteropServices.PreserveSigAttribute()>
<CLSCompliantAttribute(False)>
Public Sub S()
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll)
compilation.VerifyPdb(
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="M1" name="Main">
<sequencePoints>
<entry offset="0x0" startLine="3" startColumn="5" endLine="3" endColumn="15" document="1"/>
<entry offset="0x1" startLine="4" startColumn="9" endLine="4" endColumn="12" document="1"/>
<entry offset="0x7" startLine="5" startColumn="5" endLine="5" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x8">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
</scope>
</method>
<method containingType="M1" name="S">
<sequencePoints>
<entry offset="0x0" startLine="9" startColumn="5" endLine="9" endColumn="19" document="1"/>
<entry offset="0x1" startLine="11" startColumn="5" endLine="11" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x2">
<importsforward declaringType="M1" methodName="Main"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact(), WorkItem(529300, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529300")>
Public Sub DontShowOperatorNameCTypeInLocals()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module Module1
Class B2
Public f As Integer
Public Sub New(x As Integer)
f = x
End Sub
Shared Widening Operator CType(x As Integer) As B2
Return New B2(x)
End Operator
End Class
Sub Main()
Dim x As Integer = 11
Dim b2 As B2 = x
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll)
compilation.VerifyPdb(
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="Module1" name="Main">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="4"/>
<slot kind="0" offset="35"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="17" startColumn="5" endLine="17" endColumn="15" document="1"/>
<entry offset="0x1" startLine="18" startColumn="13" endLine="18" endColumn="30" document="1"/>
<entry offset="0x4" startLine="19" startColumn="13" endLine="19" endColumn="25" document="1"/>
<entry offset="0xb" startLine="20" startColumn="5" endLine="20" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xc">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
<local name="x" il_index="0" il_start="0x0" il_end="0xc" attributes="0"/>
<local name="b2" il_index="1" il_start="0x0" il_end="0xc" attributes="0"/>
</scope>
</method>
<method containingType="Module1+B2" name=".ctor" parameterNames="x">
<sequencePoints>
<entry offset="0x0" startLine="8" startColumn="9" endLine="8" endColumn="37" document="1"/>
<entry offset="0x8" startLine="9" startColumn="13" endLine="9" endColumn="18" document="1"/>
<entry offset="0xf" startLine="10" startColumn="9" endLine="10" endColumn="16" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x10">
<importsforward declaringType="Module1" methodName="Main"/>
</scope>
</method>
<method containingType="Module1+B2" name="op_Implicit" parameterNames="x">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="21" offset="-1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="12" startColumn="9" endLine="12" endColumn="59" document="1"/>
<entry offset="0x1" startLine="13" startColumn="13" endLine="13" endColumn="29" document="1"/>
<entry offset="0xa" startLine="14" startColumn="9" endLine="14" endColumn="21" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xc">
<importsforward declaringType="Module1" methodName="Main"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<WorkItem(760994, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/760994")>
<Fact()>
Public Sub Bug760994()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Class CLAZZ
Public FLD1 As Integer = 1
Public Event Load As Action
Public FLD2 As Integer = 1
Public Sub New()
End Sub
Private Sub frmMain_Load() Handles Me.Load
End Sub
End Class
Module Program
Sub Main(args As String())
Dim c As New CLAZZ
End Sub
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll)
compilation.VerifyPdb("CLAZZ..ctor",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="CLAZZ" name=".ctor">
<sequencePoints>
<entry offset="0x0" startLine="8" startColumn="5" endLine="8" endColumn="21" document="1"/>
<entry offset="0x1b" startLine="4" startColumn="12" endLine="4" endColumn="31" document="1"/>
<entry offset="0x22" startLine="6" startColumn="12" endLine="6" endColumn="31" document="1"/>
<entry offset="0x29" startLine="10" startColumn="5" endLine="10" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x2a">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact>
Public Sub WRN_PDBConstantStringValueTooLong()
Dim longStringValue = New String("a"c, 2050)
Dim source =
<compilation>
<file>
Imports System
Module Module1
Sub Main()
Const goo as String = "<%= longStringValue %>"
Console.WriteLine("Hello Word.")
Console.WriteLine(goo)
End Sub
End Module
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugExe)
Dim exebits = New IO.MemoryStream()
Dim pdbbits = New IO.MemoryStream()
Dim result = compilation.Emit(exebits, pdbbits)
result.Diagnostics.Verify()
'this new warning was abandoned
'result.Diagnostics.Verify(Diagnostic(ERRID.WRN_PDBConstantStringValueTooLong).WithArguments("goo", longStringValue.Substring(0, 20) & "..."))
''ensure that the warning is suppressable
'compilation = CreateCompilationWithMscorlibAndVBRuntime(source, OptionsExe.WithDebugInformationKind(Common.DebugInformationKind.Full).WithOptimizations(False).
' WithSpecificDiagnosticOptions(New Dictionary(Of Integer, ReportWarning) From {{CInt(ERRID.WRN_PDBConstantStringValueTooLong), ReportWarning.Suppress}}))
'result = compilation.Emit(exebits, Nothing, "DontCare", pdbbits, Nothing)
'result.Diagnostics.Verify()
''ensure that the warning can be turned into an error
'compilation = CreateCompilationWithMscorlibAndVBRuntime(source, OptionsExe.WithDebugInformationKind(Common.DebugInformationKind.Full).WithOptimizations(False).
' WithSpecificDiagnosticOptions(New Dictionary(Of Integer, ReportWarning) From {{CInt(ERRID.WRN_PDBConstantStringValueTooLong), ReportWarning.Error}}))
'result = compilation.Emit(exebits, Nothing, "DontCare", pdbbits, Nothing)
'Assert.False(result.Success)
'result.Diagnostics.Verify(Diagnostic(ERRID.WRN_PDBConstantStringValueTooLong).WithArguments("goo", longStringValue.Substring(0, 20) & "...").WithWarningAsError(True),
' Diagnostic(ERRID.ERR_WarningTreatedAsError).WithArguments("The value assigned to the constant string 'goo' is too long to be used in a PDB file. Consider shortening the value, otherwise the string's value will not be visible in the debugger. Only the debug experience is affected."))
End Sub
<Fact>
Public Sub NoDebugInfoForEmbeddedSymbols()
Dim source =
<compilation>
<file>
Imports Microsoft.VisualBasic.Strings
Public Class C
Public Shared Function F(z As Integer) As Char
Return ChrW(z)
End Function
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll.WithEmbedVbCoreRuntime(True))
' Dev11 generates debug info for embedded symbols. There is no reason to do so since the source code is not available to the user.
compilation.VerifyPdb(
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="C" name="F" parameterNames="z">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="4" startColumn="5" endLine="4" endColumn="51" document="1"/>
<entry offset="0x1" startLine="5" startColumn="9" endLine="5" endColumn="23" document="1"/>
<entry offset="0xa" startLine="6" startColumn="5" endLine="6" endColumn="17" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xc">
<type name="Microsoft.VisualBasic.Strings" importlevel="file"/>
<currentnamespace name=""/>
<local name="F" il_index="0" il_start="0x0" il_end="0xc" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact(), WorkItem(797482, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/797482")>
Public Sub Bug797482()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module Module1
Sub Main()
Console.WriteLine(MakeIncrementer(5)(2))
End Sub
Function MakeIncrementer(n As Integer) As Func(Of Integer, Integer)
Return Function(i)
Return i + n
End Function
End Function
End Module
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll)
compilation.VerifyPdb("Module1.MakeIncrementer",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="Module1" name="MakeIncrementer" parameterNames="n">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="30" offset="-1"/>
<slot kind="0" offset="-1"/>
</encLocalSlotMap>
<encLambdaMap>
<methodOrdinal>1</methodOrdinal>
<closure offset="-1"/>
<lambda offset="7" closure="0"/>
</encLambdaMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="7" startColumn="5" endLine="7" endColumn="72" document="1"/>
<entry offset="0x1" hidden="true" document="1"/>
<entry offset="0xe" startLine="8" startColumn="9" endLine="10" endColumn="21" document="1"/>
<entry offset="0x1d" startLine="11" startColumn="5" endLine="11" endColumn="17" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x1f">
<importsforward declaringType="Module1" methodName="Main"/>
<local name="$VB$Closure_0" il_index="0" il_start="0x0" il_end="0x1f" attributes="0"/>
<local name="MakeIncrementer" il_index="1" il_start="0x0" il_end="0x1f" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
''' <summary>
''' If a synthesized .ctor contains user code (field initializers),
''' the method must have a sequence point at
''' offset 0 for correct stepping behavior.
''' </summary>
<WorkItem(804681, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/804681")>
<Fact()>
Public Sub DefaultConstructorWithInitializer()
Dim source =
<compilation>
<file><![CDATA[
Class C
Private o As Object = New Object()
End Class
]]></file>
</compilation>
Dim compilation = CreateCompilationWithMscorlib(source, TestOptions.DebugDll)
compilation.VerifyPdb("C..ctor",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="C" name=".ctor">
<sequencePoints>
<entry offset="0x0" hidden="true" document="1"/>
<entry offset="0x7" startLine="2" startColumn="13" endLine="2" endColumn="39" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x18">
<currentnamespace name=""/>
</scope>
</method>
</methods>
</symbols>)
End Sub
''' <summary>
''' If a synthesized method contains any user code,
''' the method must have a sequence point at
''' offset 0 for correct stepping behavior.
''' </summary>
<Fact()>
Public Sub SequencePointAtOffset0()
Dim source =
<compilation>
<file><![CDATA[
Imports System
Module M
Private Fn As Func(Of Object, Integer) = Function(x)
Dim f As Func(Of Object, Integer) = Function(o) 1
Dim g As Func(Of Func(Of Object, Integer), Func(Of Object, Integer)) = Function(h) Function(y) h(y)
Return g(f)(Nothing)
End Function
End Module
]]></file>
</compilation>
Dim compilation = CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll)
compilation.VerifyPdb(
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="M" name=".cctor">
<customDebugInfo>
<encLambdaMap>
<methodOrdinal>0</methodOrdinal>
<closure offset="-84"/>
<lambda offset="-243"/>
<lambda offset="-182"/>
<lambda offset="-84"/>
<lambda offset="-72" closure="0"/>
</encLambdaMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="3" startColumn="13" endLine="7" endColumn="21" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x16">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
</scope>
</method>
<method containingType="M+_Closure$__0-0" name="_Lambda$__3" parameterNames="y">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="21" offset="-72"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="5" startColumn="96" endLine="5" endColumn="107" document="1"/>
<entry offset="0x1" startLine="5" startColumn="108" endLine="5" endColumn="112" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x17">
<importsforward declaringType="M" methodName=".cctor"/>
</scope>
</method>
<method containingType="M+_Closure$__" name="_Lambda$__0-0" parameterNames="x">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="21" offset="-243"/>
<slot kind="0" offset="-214"/>
<slot kind="0" offset="-151"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="3" startColumn="46" endLine="3" endColumn="57" document="1"/>
<entry offset="0x1" startLine="4" startColumn="17" endLine="4" endColumn="62" document="1"/>
<entry offset="0x26" startLine="5" startColumn="17" endLine="5" endColumn="112" document="1"/>
<entry offset="0x4b" startLine="6" startColumn="13" endLine="6" endColumn="33" document="1"/>
<entry offset="0x5b" startLine="7" startColumn="9" endLine="7" endColumn="21" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x5d">
<importsforward declaringType="M" methodName=".cctor"/>
<local name="f" il_index="1" il_start="0x0" il_end="0x5d" attributes="0"/>
<local name="g" il_index="2" il_start="0x0" il_end="0x5d" attributes="0"/>
</scope>
</method>
<method containingType="M+_Closure$__" name="_Lambda$__0-1" parameterNames="o">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="21" offset="-182"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="4" startColumn="49" endLine="4" endColumn="60" document="1"/>
<entry offset="0x1" startLine="4" startColumn="61" endLine="4" endColumn="62" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x7">
<importsforward declaringType="M" methodName=".cctor"/>
</scope>
</method>
<method containingType="M+_Closure$__" name="_Lambda$__0-2" parameterNames="h">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="30" offset="-84"/>
<slot kind="21" offset="-84"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="5" startColumn="84" endLine="5" endColumn="95" document="1"/>
<entry offset="0x1" hidden="true" document="1"/>
<entry offset="0xe" startLine="5" startColumn="96" endLine="5" endColumn="112" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x1f">
<importsforward declaringType="M" methodName=".cctor"/>
<local name="$VB$Closure_0" il_index="0" il_start="0x0" il_end="0x1f" attributes="0"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<WorkItem(846228, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/846228")>
<WorkItem(845078, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/845078")>
<Fact()>
Public Sub RaiseEvent001()
Dim source =
<compilation>
<file><![CDATA[
Public Class IntervalUpdate
Public Shared Sub Update()
RaiseEvent IntervalElapsed()
End Sub
Shared Sub Main()
Update()
End Sub
Public Shared Event IntervalElapsed()
End Class
]]></file>
</compilation>
Dim defines = PredefinedPreprocessorSymbols.AddPredefinedPreprocessorSymbols(OutputKind.ConsoleApplication)
defines = defines.Add(KeyValuePair.Create("_MyType", CObj("Console")))
Dim parseOptions = New VisualBasicParseOptions(preprocessorSymbols:=defines)
Dim compilation = CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll.WithParseOptions(parseOptions))
CompileAndVerify(compilation).VerifyIL("IntervalUpdate.Update", "
{
// Code size 18 (0x12)
.maxstack 1
.locals init (IntervalUpdate.IntervalElapsedEventHandler V_0)
-IL_0000: nop
-IL_0001: ldsfld ""IntervalUpdate.IntervalElapsedEvent As IntervalUpdate.IntervalElapsedEventHandler""
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: brfalse.s IL_0011
IL_000a: ldloc.0
IL_000b: callvirt ""Sub IntervalUpdate.IntervalElapsedEventHandler.Invoke()""
IL_0010: nop
-IL_0011: ret
}
", sequencePoints:="IntervalUpdate.Update")
compilation.VerifyPdb(
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="My.MyComputer" name=".ctor">
<sequencePoints>
<entry offset="0x0" startLine="107" startColumn="9" endLine="107" endColumn="25" document="1"/>
<entry offset="0x1" startLine="108" startColumn="13" endLine="108" endColumn="25" document="1"/>
<entry offset="0x8" startLine="109" startColumn="9" endLine="109" endColumn="16" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<currentnamespace name="My"/>
</scope>
</method>
<method containingType="My.MyProject" name=".cctor">
<sequencePoints>
<entry offset="0x0" startLine="126" startColumn="26" endLine="126" endColumn="97" document="1"/>
<entry offset="0xa" startLine="137" startColumn="26" endLine="137" endColumn="95" document="1"/>
<entry offset="0x14" startLine="148" startColumn="26" endLine="148" endColumn="136" document="1"/>
<entry offset="0x1e" startLine="284" startColumn="26" endLine="284" endColumn="105" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x29">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
</scope>
</method>
<method containingType="My.MyProject" name="get_Computer">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="121" startColumn="13" endLine="121" endColumn="16" document="1"/>
<entry offset="0x1" startLine="122" startColumn="17" endLine="122" endColumn="62" document="1"/>
<entry offset="0xe" startLine="123" startColumn="13" endLine="123" endColumn="20" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x10">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<local name="Computer" il_index="0" il_start="0x0" il_end="0x10" attributes="0"/>
</scope>
</method>
<method containingType="My.MyProject" name="get_Application">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="133" startColumn="13" endLine="133" endColumn="16" document="1"/>
<entry offset="0x1" startLine="134" startColumn="17" endLine="134" endColumn="57" document="1"/>
<entry offset="0xe" startLine="135" startColumn="13" endLine="135" endColumn="20" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x10">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<local name="Application" il_index="0" il_start="0x0" il_end="0x10" attributes="0"/>
</scope>
</method>
<method containingType="My.MyProject" name="get_User">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="144" startColumn="13" endLine="144" endColumn="16" document="1"/>
<entry offset="0x1" startLine="145" startColumn="17" endLine="145" endColumn="58" document="1"/>
<entry offset="0xe" startLine="146" startColumn="13" endLine="146" endColumn="20" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x10">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<local name="User" il_index="0" il_start="0x0" il_end="0x10" attributes="0"/>
</scope>
</method>
<method containingType="My.MyProject" name="get_WebServices">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="237" startColumn="14" endLine="237" endColumn="17" document="1"/>
<entry offset="0x1" startLine="238" startColumn="17" endLine="238" endColumn="67" document="1"/>
<entry offset="0xe" startLine="239" startColumn="13" endLine="239" endColumn="20" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x10">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<local name="WebServices" il_index="0" il_start="0x0" il_end="0x10" attributes="0"/>
</scope>
</method>
<method containingType="IntervalUpdate" name="Update">
<sequencePoints>
<entry offset="0x0" startLine="2" startColumn="5" endLine="2" endColumn="31" document="1"/>
<entry offset="0x1" startLine="3" startColumn="9" endLine="3" endColumn="37" document="1"/>
<entry offset="0x11" startLine="4" startColumn="5" endLine="4" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x12">
<currentnamespace name=""/>
</scope>
</method>
<method containingType="IntervalUpdate" name="Main">
<sequencePoints>
<entry offset="0x0" startLine="6" startColumn="5" endLine="6" endColumn="22" document="1"/>
<entry offset="0x1" startLine="7" startColumn="9" endLine="7" endColumn="17" document="1"/>
<entry offset="0x7" startLine="8" startColumn="5" endLine="8" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x8">
<importsforward declaringType="IntervalUpdate" methodName="Update"/>
</scope>
</method>
<method containingType="My.MyProject+MyWebServices" name="Equals" parameterNames="o">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="247" startColumn="13" endLine="247" endColumn="75" document="1"/>
<entry offset="0x1" startLine="248" startColumn="17" endLine="248" endColumn="40" document="1"/>
<entry offset="0x10" startLine="249" startColumn="13" endLine="249" endColumn="25" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x12">
<currentnamespace name="My"/>
<local name="Equals" il_index="0" il_start="0x0" il_end="0x12" attributes="0"/>
</scope>
</method>
<method containingType="My.MyProject+MyWebServices" name="GetHashCode">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="251" startColumn="13" endLine="251" endColumn="63" document="1"/>
<entry offset="0x1" startLine="252" startColumn="17" endLine="252" endColumn="42" document="1"/>
<entry offset="0xa" startLine="253" startColumn="13" endLine="253" endColumn="25" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xc">
<importsforward declaringType="My.MyProject+MyWebServices" methodName="Equals" parameterNames="o"/>
<local name="GetHashCode" il_index="0" il_start="0x0" il_end="0xc" attributes="0"/>
</scope>
</method>
<method containingType="My.MyProject+MyWebServices" name="GetType">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="255" startColumn="13" endLine="255" endColumn="72" document="1"/>
<entry offset="0x1" startLine="256" startColumn="17" endLine="256" endColumn="46" document="1"/>
<entry offset="0xe" startLine="257" startColumn="13" endLine="257" endColumn="25" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x10">
<importsforward declaringType="My.MyProject+MyWebServices" methodName="Equals" parameterNames="o"/>
<local name="GetType" il_index="0" il_start="0x0" il_end="0x10" attributes="0"/>
</scope>
</method>
<method containingType="My.MyProject+MyWebServices" name="ToString">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="259" startColumn="13" endLine="259" endColumn="59" document="1"/>
<entry offset="0x1" startLine="260" startColumn="17" endLine="260" endColumn="39" document="1"/>
<entry offset="0xa" startLine="261" startColumn="13" endLine="261" endColumn="25" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xc">
<importsforward declaringType="My.MyProject+MyWebServices" methodName="Equals" parameterNames="o"/>
<local name="ToString" il_index="0" il_start="0x0" il_end="0xc" attributes="0"/>
</scope>
</method>
<method containingType="My.MyProject+MyWebServices" name="Create__Instance__" parameterNames="instance">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
<slot kind="1" offset="0"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="264" startColumn="12" endLine="264" endColumn="95" document="1"/>
<entry offset="0x1" startLine="265" startColumn="17" endLine="265" endColumn="44" document="1"/>
<entry offset="0xb" hidden="true" document="1"/>
<entry offset="0xe" startLine="266" startColumn="21" endLine="266" endColumn="35" document="1"/>
<entry offset="0x16" startLine="267" startColumn="17" endLine="267" endColumn="21" document="1"/>
<entry offset="0x17" startLine="268" startColumn="21" endLine="268" endColumn="36" document="1"/>
<entry offset="0x1b" startLine="270" startColumn="13" endLine="270" endColumn="25" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x1d">
<importsforward declaringType="My.MyProject+MyWebServices" methodName="Equals" parameterNames="o"/>
<local name="Create__Instance__" il_index="0" il_start="0x0" il_end="0x1d" attributes="0"/>
</scope>
</method>
<method containingType="My.MyProject+MyWebServices" name="Dispose__Instance__" parameterNames="instance">
<sequencePoints>
<entry offset="0x0" startLine="273" startColumn="13" endLine="273" endColumn="71" document="1"/>
<entry offset="0x1" startLine="274" startColumn="17" endLine="274" endColumn="35" document="1"/>
<entry offset="0x8" startLine="275" startColumn="13" endLine="275" endColumn="20" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<importsforward declaringType="My.MyProject+MyWebServices" methodName="Equals" parameterNames="o"/>
</scope>
</method>
<method containingType="My.MyProject+MyWebServices" name=".ctor">
<sequencePoints>
<entry offset="0x0" startLine="279" startColumn="13" endLine="279" endColumn="29" document="1"/>
<entry offset="0x1" startLine="280" startColumn="16" endLine="280" endColumn="28" document="1"/>
<entry offset="0x8" startLine="281" startColumn="13" endLine="281" endColumn="20" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<importsforward declaringType="My.MyProject+MyWebServices" methodName="Equals" parameterNames="o"/>
</scope>
</method>
<method containingType="My.MyProject+ThreadSafeObjectProvider`1" name="get_GetInstance">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="0" offset="-1"/>
<slot kind="1" offset="0"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="341" startColumn="17" endLine="341" endColumn="20" document="1"/>
<entry offset="0x1" startLine="342" startColumn="21" endLine="342" endColumn="59" document="1"/>
<entry offset="0xf" hidden="true" document="1"/>
<entry offset="0x12" startLine="342" startColumn="60" endLine="342" endColumn="87" document="1"/>
<entry offset="0x1c" startLine="343" startColumn="21" endLine="343" endColumn="47" document="1"/>
<entry offset="0x24" startLine="344" startColumn="17" endLine="344" endColumn="24" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x26">
<importsforward declaringType="My.MyProject+MyWebServices" methodName="Equals" parameterNames="o"/>
<local name="GetInstance" il_index="0" il_start="0x0" il_end="0x26" attributes="0"/>
</scope>
</method>
<method containingType="My.MyProject+ThreadSafeObjectProvider`1" name=".ctor">
<sequencePoints>
<entry offset="0x0" startLine="350" startColumn="13" endLine="350" endColumn="29" document="1"/>
<entry offset="0x1" startLine="351" startColumn="17" endLine="351" endColumn="29" document="1"/>
<entry offset="0x8" startLine="352" startColumn="13" endLine="352" endColumn="20" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<importsforward declaringType="My.MyProject+MyWebServices" methodName="Equals" parameterNames="o"/>
</scope>
</method>
</methods>
</symbols>, options:=PdbValidationOptions.SkipConversionValidation) ' TODO: https://github.com/dotnet/roslyn/issues/18004
End Sub
<WorkItem(876518, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/876518")>
<Fact>
Public Sub WinFormMain()
Dim source =
<compilation>
<file>
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.Text = "Form1"
End Sub
End Class
</file>
</compilation>
Dim defines = PredefinedPreprocessorSymbols.AddPredefinedPreprocessorSymbols(
OutputKind.WindowsApplication,
KeyValuePair.Create(Of String, Object)("_MyType", "WindowsForms"),
KeyValuePair.Create(Of String, Object)("Config", "Debug"),
KeyValuePair.Create(Of String, Object)("DEBUG", -1),
KeyValuePair.Create(Of String, Object)("TRACE", -1),
KeyValuePair.Create(Of String, Object)("PLATFORM", "AnyCPU"))
Dim parseOptions As VisualBasicParseOptions = New VisualBasicParseOptions(preprocessorSymbols:=defines)
Dim compOptions As VisualBasicCompilationOptions = New VisualBasicCompilationOptions(
OutputKind.WindowsApplication,
optimizationLevel:=OptimizationLevel.Debug,
parseOptions:=parseOptions,
mainTypeName:="My.MyApplication")
Dim comp = CreateCompilationWithMscorlibAndVBRuntimeAndReferences(source, {SystemWindowsFormsRef}, compOptions)
comp.VerifyDiagnostics()
' Just care that there's at least one non-hidden sequence point.
comp.VerifyPdb("My.MyApplication.Main",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<entryPoint declaringType="My.MyApplication" methodName="Main" parameterNames="Args"/>
<methods>
<method containingType="My.MyApplication" name="Main" parameterNames="Args">
<sequencePoints>
<entry offset="0x0" startLine="76" startColumn="9" endLine="76" endColumn="55" document="1"/>
<entry offset="0x1" startLine="77" startColumn="13" endLine="77" endColumn="16" document="1"/>
<entry offset="0x2" startLine="78" startColumn="16" endLine="78" endColumn="133" document="1"/>
<entry offset="0xf" startLine="79" startColumn="13" endLine="79" endColumn="20" document="1"/>
<entry offset="0x11" startLine="80" startColumn="13" endLine="80" endColumn="20" document="1"/>
<entry offset="0x12" startLine="81" startColumn="13" endLine="81" endColumn="37" document="1"/>
<entry offset="0x1e" startLine="82" startColumn="9" endLine="82" endColumn="16" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x1f">
<currentnamespace name="My"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact>
Public Sub SynthesizedVariableForSelectCastValue()
Dim source =
<compilation>
<file>
Imports System
Class C
Sub F(args As String())
Select Case args(0)
Case "a"
Console.WriteLine(1)
Case "b"
Console.WriteLine(2)
Case "c"
Console.WriteLine(3)
End Select
End Sub
End Class
</file>
</compilation>
Dim c = CreateCompilationWithMscorlibAndVBRuntime(source, options:=TestOptions.DebugDll)
c.VerifyDiagnostics()
c.VerifyPdb("C.F",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="C" name="F" parameterNames="args">
<customDebugInfo>
<encLocalSlotMap>
<slot kind="15" offset="0"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" startLine="3" startColumn="5" endLine="3" endColumn="28" document="1"/>
<entry offset="0x1" startLine="4" startColumn="9" endLine="4" endColumn="28" document="1"/>
<entry offset="0x32" startLine="5" startColumn="13" endLine="5" endColumn="21" document="1"/>
<entry offset="0x33" startLine="6" startColumn="17" endLine="6" endColumn="37" document="1"/>
<entry offset="0x3c" startLine="7" startColumn="13" endLine="7" endColumn="21" document="1"/>
<entry offset="0x3d" startLine="8" startColumn="17" endLine="8" endColumn="37" document="1"/>
<entry offset="0x46" startLine="9" startColumn="13" endLine="9" endColumn="21" document="1"/>
<entry offset="0x47" startLine="10" startColumn="17" endLine="10" endColumn="37" document="1"/>
<entry offset="0x50" startLine="11" startColumn="9" endLine="11" endColumn="19" document="1"/>
<entry offset="0x51" startLine="12" startColumn="5" endLine="12" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x52">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact>
Public Sub Constant_AllTypes()
Dim source =
<compilation>
<file>
Imports System
Imports System.Collections.Generic
'Imports Microsoft.VisualBasic.Strings
Class X
End Class
Public Class C(Of S)
Enum EnumI1 As SByte : A : End Enum
Enum EnumU1 As Byte : A : End Enum
Enum EnumI2 As Short : A : End Enum
Enum EnumU2 As UShort : A : End Enum
Enum EnumI4 As Integer : A : End Enum
Enum EnumU4 As UInteger : A : End Enum
Enum EnumI8 As Long : A : End Enum
Enum EnumU8 As ULong : A : End Enum
Public Sub F(Of T)()
Const B As Boolean = Nothing
Const C As Char = Nothing
Const I1 As SByte = 0
Const U1 As Byte = 0
Const I2 As Short = 0
Const U2 As UShort = 0
Const I4 As Integer = 0
Const U4 As UInteger = 0
Const I8 As Long = 0
Const U8 As ULong = 0
Const R4 As Single = 0
Const R8 As Double = 0
Const EI1 As C(Of Integer).EnumI1 = 0
Const EU1 As C(Of Integer).EnumU1 = 0
Const EI2 As C(Of Integer).EnumI2 = 0
Const EU2 As C(Of Integer).EnumU2 = 0
Const EI4 As C(Of Integer).EnumI4 = 0
Const EU4 As C(Of Integer).EnumU4 = 0
Const EI8 As C(Of Integer).EnumI8 = 0
Const EU8 As C(Of Integer).EnumU8 = 0
'Const StrWithNul As String = ChrW(0)
Const EmptyStr As String = ""
Const NullStr As String = Nothing
Const NullObject As Object = Nothing
Const D As Decimal = Nothing
Const DT As DateTime = #1-1-2015#
End Sub
End Class
</file>
</compilation>
Dim c = CreateCompilationWithMscorlibAndVBRuntimeAndReferences(source, {SystemCoreRef}, options:=TestOptions.DebugDll.WithEmbedVbCoreRuntime(True))
c.VerifyPdb("C`1.F",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="C`1" name="F">
<sequencePoints>
<entry offset="0x0" startLine="18" startColumn="5" endLine="18" endColumn="25" document="1"/>
<entry offset="0x1" startLine="48" startColumn="5" endLine="48" endColumn="12" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x2">
<namespace name="System" importlevel="file"/>
<namespace name="System.Collections.Generic" importlevel="file"/>
<currentnamespace name=""/>
<constant name="B" value="0" type="Boolean"/>
<constant name="C" value="0" type="Char"/>
<constant name="I1" value="0" type="SByte"/>
<constant name="U1" value="0" type="Byte"/>
<constant name="I2" value="0" type="Int16"/>
<constant name="U2" value="0" type="UInt16"/>
<constant name="I4" value="0" type="Int32"/>
<constant name="U4" value="0" type="UInt32"/>
<constant name="I8" value="0" type="Int64"/>
<constant name="U8" value="0" type="UInt64"/>
<constant name="R4" value="0" type="Single"/>
<constant name="R8" value="0" type="Double"/>
<constant name="EI1" value="0" signature="EnumI1{Int32}"/>
<constant name="EU1" value="0" signature="EnumU1{Int32}"/>
<constant name="EI2" value="0" signature="EnumI2{Int32}"/>
<constant name="EU2" value="0" signature="EnumU2{Int32}"/>
<constant name="EI4" value="0" signature="EnumI4{Int32}"/>
<constant name="EU4" value="0" signature="EnumU4{Int32}"/>
<constant name="EI8" value="0" signature="EnumI8{Int32}"/>
<constant name="EU8" value="0" signature="EnumU8{Int32}"/>
<constant name="EmptyStr" value="" type="String"/>
<constant name="NullStr" value="null" type="String"/>
<constant name="NullObject" value="null" type="Object"/>
<constant name="D" value="0" type="Decimal"/>
<constant name="DT" value="01/01/2015 00:00:00" type="DateTime"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact>
Public Sub ImportsInAsync()
Dim source =
"Imports System.Linq
Imports System.Threading.Tasks
Class C
Shared Async Function F() As Task
Dim c = {1, 2, 3}
c.Select(Function(i) i)
End Function
End Class"
Dim c = CreateCompilationWithMscorlib45AndVBRuntime({Parse(source)}, options:=TestOptions.DebugDll, references:={SystemCoreRef})
c.VerifyPdb("C+VB$StateMachine_1_F.MoveNext",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="C+VB$StateMachine_1_F" name="MoveNext">
<customDebugInfo>
<hoistedLocalScopes format="portable">
<slot startOffset="0x0" endOffset="0x8b"/>
</hoistedLocalScopes>
<encLocalSlotMap>
<slot kind="27" offset="-1"/>
<slot kind="temp"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" hidden="true" document="1"/>
<entry offset="0x7" startLine="4" startColumn="5" endLine="4" endColumn="38" document="1"/>
<entry offset="0x8" startLine="5" startColumn="13" endLine="5" endColumn="26" document="1"/>
<entry offset="0x1f" startLine="6" startColumn="9" endLine="6" endColumn="32" document="1"/>
<entry offset="0x4f" startLine="7" startColumn="5" endLine="7" endColumn="17" document="1"/>
<entry offset="0x51" hidden="true" document="1"/>
<entry offset="0x58" hidden="true" document="1"/>
<entry offset="0x74" startLine="7" startColumn="5" endLine="7" endColumn="17" document="1"/>
<entry offset="0x7e" hidden="true" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x8b">
<importsforward declaringType="C+_Closure$__" methodName="_Lambda$__1-0" parameterNames="i"/>
<local name="$VB$ResumableLocal_c$0" il_index="0" il_start="0x0" il_end="0x8b" attributes="0"/>
</scope>
<asyncInfo>
<kickoffMethod declaringType="C" methodName="F"/>
</asyncInfo>
</method>
</methods>
</symbols>, options:=PdbValidationOptions.SkipConversionValidation) ' TODO: ResumableLocals conversion (https://github.com/dotnet/symreader-converter/issues/80)
End Sub
<Fact>
Public Sub ImportsInAsyncLambda()
Dim source =
"Imports System.Linq
Class C
Shared Sub M()
Dim f As System.Action =
Async Sub()
Dim c = {1, 2, 3}
c.Select(Function(i) i)
End Sub
End Sub
End Class"
Dim c = CreateCompilationWithMscorlib45AndVBRuntime({Parse(source)}, options:=TestOptions.DebugDll, references:={SystemCoreRef})
c.VerifyPdb("C+_Closure$__+VB$StateMachine___Lambda$__1-0.MoveNext",
<symbols>
<files>
<file id="1" name="" language="3a12d0b8-c26c-11d0-b442-00a0244a1dd2" languageVendor="994b45c4-e6e9-11d2-903f-00c04fa302a1" documentType="5a869d0b-6611-11d3-bd2a-0000f80849bd"/>
</files>
<methods>
<method containingType="C+_Closure$__+VB$StateMachine___Lambda$__1-0" name="MoveNext">
<customDebugInfo>
<hoistedLocalScopes format="portable">
<slot startOffset="0x0" endOffset="0x8b"/>
</hoistedLocalScopes>
<encLocalSlotMap>
<slot kind="27" offset="38"/>
<slot kind="temp"/>
</encLocalSlotMap>
</customDebugInfo>
<sequencePoints>
<entry offset="0x0" hidden="true" document="1"/>
<entry offset="0x7" startLine="5" startColumn="13" endLine="5" endColumn="24" document="1"/>
<entry offset="0x8" startLine="6" startColumn="21" endLine="6" endColumn="34" document="1"/>
<entry offset="0x1f" startLine="7" startColumn="17" endLine="7" endColumn="40" document="1"/>
<entry offset="0x4f" startLine="8" startColumn="13" endLine="8" endColumn="20" document="1"/>
<entry offset="0x51" hidden="true" document="1"/>
<entry offset="0x58" hidden="true" document="1"/>
<entry offset="0x74" hidden="true" document="1"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x8b">
<importsforward declaringType="C" methodName="M"/>
<local name="$VB$ResumableLocal_c$0" il_index="0" il_start="0x0" il_end="0x8b" attributes="0"/>
</scope>
<asyncInfo>
<catchHandler offset="0x51"/>
<kickoffMethod declaringType="C+_Closure$__" methodName="_Lambda$__1-0"/>
</asyncInfo>
</method>
</methods>
</symbols>, options:=PdbValidationOptions.SkipConversionValidation) ' TODO: ResumableLocals conversion (https://github.com/dotnet/symreader-converter/issues/80)
End Sub
End Class
End Namespace
|
pdelvo/roslyn
|
src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb
|
Visual Basic
|
apache-2.0
| 206,990
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateEvent
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Extensions
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics.GenerateEvent
Public Class GenerateEventTests
Inherits AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest
Friend Overrides Function CreateDiagnosticProviderAndFixer(workspace As Workspace) As Tuple(Of DiagnosticAnalyzer, CodeFixProvider)
Return New Tuple(Of DiagnosticAnalyzer, CodeFixProvider)(Nothing, New GenerateEventCodeFixProvider())
End Function
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub TestGenerateEventIntoInterface1()
Test(
NewLines("Interface MyInterface \n End Interface \n Class C \n Implements MyInterface \n Event foo() Implements [|MyInterface.E|] \n End Class"),
NewLines("Interface MyInterface \n Event E() \n End Interface \n Class C \n Implements MyInterface \n Event foo() Implements MyInterface.E \n End Class"))
End Sub
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub TestNotIfIdentifierMissing()
TestMissing(
NewLines("Interface MyInterface \n End Interface \n Class C \n Implements MyInterface \n Event foo() Implements [|MyInterface.|] \n End Class"))
End Sub
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub TestNotIfAlreadyPresent()
TestMissing(
NewLines("Interface MyInterface \n Event E() \n End Interface \n Class C \n Implements MyInterface \n Event foo() Implements [|MyInterface.E|] \n End Class"))
End Sub
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub TestGenerateEventWithParameter()
Test(
NewLines("Interface MyInterface \n End Interface \n Class C \n Implements MyInterface \n Event foo(x As Integer) Implements [|MyInterface.E|] \n End Class"),
NewLines("Interface MyInterface \n Event E(x As Integer) \n End Interface \n Class C \n Implements MyInterface \n Event foo(x As Integer) Implements MyInterface.E \n End Class"))
End Sub
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub TestHandlesClause()
Test(
NewLines("Class D \n End Class \n Class C \n WithEvents a As D \n Sub bar(x As Integer, e As Object) Handles [|a.E|] \n End Sub \n End Class"),
NewLines("Class D \n Public Event E(x As Integer, e As Object) \n End Class \n Class C \n WithEvents a As D \n Sub bar(x As Integer, e As Object) Handles a.E \n End Sub \n End Class"))
End Sub
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub TestHandlesClauseWithExistingEvent()
TestMissing(
NewLines("Class D \n Public Event E(x As Integer, e As Object) \n End Class \n Class C \n WithEvents a As D \n Sub bar(x As Integer, e As Object) Handles [|a.E|] \n End Sub \n End Class"))
End Sub
<WorkItem(531210)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub TestMyBase()
Test(
NewLines("Public Class BaseClass \n ' Place methods and properties here. \n End Class \n \n Public Class DerivedClass \n Inherits BaseClass \n Sub EventHandler(ByVal x As Integer) Handles [|MyBase.BaseEvent|] \n ' Place code to handle events from BaseClass here. \n End Sub \n End Class"),
NewLines("Public Class BaseClass \n Public Event BaseEvent(x As Integer) \n ' Place methods and properties here. \n End Class \n \n Public Class DerivedClass \n Inherits BaseClass \n Sub EventHandler(ByVal x As Integer) Handles MyBase.BaseEvent \n ' Place code to handle events from BaseClass here. \n End Sub \n End Class"))
End Sub
<WorkItem(531210)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub TestMe()
Test(
NewLines("Public Class C \n Sub EventHandler(ByVal x As Integer) Handles [|Me.MyEvent|] \n ' Place code to handle events from BaseClass here. \n End Sub \n End Class"),
NewLines("Public Class C \n Public Event MyEvent(x As Integer) \n Sub EventHandler(ByVal x As Integer) Handles Me.MyEvent \n ' Place code to handle events from BaseClass here. \n End Sub \n End Class"))
End Sub
<WorkItem(531210)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub TestMyClass()
Test(
NewLines("Public Class C \n Sub EventHandler(ByVal x As Integer) Handles [|MyClass.MyEvent|] \n ' Place code to handle events from BaseClass here. \n End Sub \n End Class"),
NewLines("Public Class C \n Public Event MyEvent(x As Integer) \n Sub EventHandler(ByVal x As Integer) Handles MyClass.MyEvent \n ' Place code to handle events from BaseClass here. \n End Sub \n End Class"))
End Sub
<WorkItem(531251)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub NotIfEventMemberMissing()
TestMissing(
NewLines("Public Class A \n End Class \n Public Class C \n Dim WithEvents x As A \n Sub Hello(i As Integer) Handles [|x.|]'mark \n End Sub \n End Class"))
End Sub
<WorkItem(531267)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub MakeParamsNotOptional()
Test(
NewLines("Public Class B \n Dim WithEvents x As B \n Private Sub Test(Optional x As String = Nothing) Handles [|x.E1|] 'mark 1 \n End Sub \n Private Sub Test2(ParamArray x As String()) Handles x.E2 'mark 2 \n End Sub \n End Class"),
NewLines("Public Class B \n Dim WithEvents x As B \n Public Event E1(x As String) \n Private Sub Test(Optional x As String = Nothing) Handles x.E1 'mark 1 \n End Sub \n Private Sub Test2(ParamArray x As String()) Handles x.E2 'mark 2 \n End Sub \n End Class"))
End Sub
<WorkItem(531267)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub MakeParamsNotParamArray()
Test(
NewLines("Public Class B \n Dim WithEvents x As B \n Private Sub Test(Optional x As String = Nothing) Handles x.E1 'mark 1 \n End Sub \n Private Sub Test2(ParamArray x As String()) Handles [|x.E2|] 'mark 2 \n End Sub \n End Class"),
NewLines("Public Class B \n Dim WithEvents x As B \n Public Event E2(x() As String) \n Private Sub Test(Optional x As String = Nothing) Handles x.E1 'mark 1 \n End Sub \n Private Sub Test2(ParamArray x As String()) Handles x.E2 'mark 2 \n End Sub \n End Class"))
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForAddEventStaticClass()
Test(
NewLines("Class EventClass \n Public Event ZEvent() \n End Class \n Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n AddHandler [|EventClass.XEvent|], AddressOf EClass_EventHandler \n End Sub \n Sub EClass_EventHandler() \n End Sub \n End Class"),
NewLines("Class EventClass \n Public Event XEvent() \n Public Event ZEvent() \n End Class \n Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n AddHandler EventClass.XEvent, AddressOf EClass_EventHandler \n End Sub \n Sub EClass_EventHandler() \n End Sub \n End Class"))
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForRemoveEventStaticClass()
Test(
NewLines("Class EventClass \n Public Event ZEvent() \n End Class \n Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n RemoveHandler [|EventClass.XEvent|], AddressOf EClass_EventHandler \n End Sub \n Sub EClass_EventHandler() \n End Sub \n End Class"),
NewLines("Class EventClass \n Public Event XEvent() \n Public Event ZEvent() \n End Class \n Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n RemoveHandler EventClass.XEvent, AddressOf EClass_EventHandler \n End Sub \n Sub EClass_EventHandler() \n End Sub \n End Class"))
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForAddEventVariable()
Test(
NewLines("Class EventClass \n Public Event ZEvent() \n End Class \n Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n AddHandler [|EClass.XEvent|], AddressOf EClass_EventHandler \n End Sub \n Sub EClass_EventHandler() \n End Sub \n End Class"),
NewLines("Class EventClass \n Public Event XEvent() \n Public Event ZEvent() \n End Class \n Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n AddHandler EClass.XEvent, AddressOf EClass_EventHandler \n End Sub \n Sub EClass_EventHandler() \n End Sub \n End Class"))
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForRemoveEventVariable()
Test(
NewLines("Class EventClass \n Public Event ZEvent() \n End Class \n Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n RemoveHandler [|EClass.XEvent|], AddressOf EClass_EventHandler \n End Sub \n Sub EClass_EventHandler() \n End Sub \n End Class"),
NewLines("Class EventClass \n Public Event XEvent() \n Public Event ZEvent() \n End Class \n Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n RemoveHandler EClass.XEvent, AddressOf EClass_EventHandler \n End Sub \n Sub EClass_EventHandler() \n End Sub \n End Class"))
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForAddEvent()
Test(
NewLines("Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n AddHandler [|XEvent|], AddressOf EClass_EventHandler \n End Sub \n Sub EClass_EventHandler() \n End Sub \n End Class"),
NewLines("Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n AddHandler XEvent, AddressOf EClass_EventHandler \n End Sub \n Public Event XEvent() \n Sub EClass_EventHandler() \n End Sub \n End Class"))
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForRemoveEvent()
Test(
NewLines("Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n RemoveHandler [|XEvent|], AddressOf EClass_EventHandler \n End Sub \n Sub EClass_EventHandler() \n End Sub \n End Class"),
NewLines("Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n RemoveHandler XEvent, AddressOf EClass_EventHandler \n End Sub \n Public Event XEvent() \n Sub EClass_EventHandler() \n End Sub \n End Class"))
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForAddEventMe()
Test(
NewLines("Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n AddHandler [|Me.XEvent|], AddressOf EClass_EventHandler \n End Sub \n Sub EClass_EventHandler() \n End Sub \n End Class"),
NewLines("Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n AddHandler Me.XEvent, AddressOf EClass_EventHandler \n End Sub \n Public Event XEvent() \n Sub EClass_EventHandler() \n End Sub \n End Class"))
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForRemoveEventMe()
Test(
NewLines("Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n RemoveHandler [|Me.XEvent|], AddressOf EClass_EventHandler \n End Sub \n Sub EClass_EventHandler() \n End Sub \n End Class"),
NewLines("Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n RemoveHandler Me.XEvent, AddressOf EClass_EventHandler \n End Sub \n Public Event XEvent() \n Sub EClass_EventHandler() \n End Sub \n End Class"))
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForAddEventMyClass()
Test(
NewLines("Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n AddHandler [|MyClass.XEvent|], AddressOf EClass_EventHandler \n End Sub \n Sub EClass_EventHandler() \n End Sub \n End Class"),
NewLines("Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n AddHandler MyClass.XEvent, AddressOf EClass_EventHandler \n End Sub \n Public Event XEvent() \n Sub EClass_EventHandler() \n End Sub \n End Class"))
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForRemoveEventMyClass()
Test(
NewLines("Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n RemoveHandler [|MyClass.XEvent|], AddressOf EClass_EventHandler \n End Sub \n Sub EClass_EventHandler() \n End Sub \n End Class"),
NewLines("Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n RemoveHandler MyClass.XEvent, AddressOf EClass_EventHandler \n End Sub \n Public Event XEvent() \n Sub EClass_EventHandler() \n End Sub \n End Class"))
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForAddEventMyBase()
Test(
NewLines("Public Class EventClass \n End Class \n Public Class Test \n Inherits EventClass \n Public Sub New() \n AddHandler [|MyBase.XEvent|], AddressOf EClass_EventHandler \n End Sub \n Sub EClass_EventHandler() \n End Sub \n End Class"),
NewLines("Public Class EventClass \n Public Event XEvent() \n End Class \n Public Class Test \n Inherits EventClass \n Public Sub New() \n AddHandler MyBase.XEvent, AddressOf EClass_EventHandler \n End Sub \n Sub EClass_EventHandler() \n End Sub \n End Class"))
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForRemoveEventMyBase()
Test(
NewLines("Public Class EventClass \n End Class \n Public Class Test \n Inherits EventClass \n Public Sub New() \n RemoveHandler [|MyBase.XEvent|], AddressOf EClass_EventHandler \n End Sub \n Sub EClass_EventHandler() \n End Sub \n End Class"),
NewLines("Public Class EventClass \n Public Event XEvent() \n End Class \n Public Class Test \n Inherits EventClass \n Public Sub New() \n RemoveHandler MyBase.XEvent, AddressOf EClass_EventHandler \n End Sub \n Sub EClass_EventHandler() \n End Sub \n End Class"))
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForAddEventDelegate()
Test(
NewLines("Imports System \n Public Class EventClass \n End Class \n Public Class Test\n WithEvents EClass As New EventClass \n Public Sub New() \n AddHandler [|EClass.XEvent|], EClass_EventHandler \n End Sub \n Dim EClass_EventHandler As Action = Sub() \n End Sub \n End Class"),
NewLines("Imports System \n Public Class EventClass \n Public Event XEvent() \n End Class \n Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n AddHandler EClass.XEvent, EClass_EventHandler \n End Sub \n Dim EClass_EventHandler As Action = Sub() \n End Sub \n End Class"))
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForRemoveEventDelegate()
Test(
NewLines("Imports System \n Public Class EventClass \n End Class \n Public Class Test\n WithEvents EClass As New EventClass \n Public Sub New() \n RemoveHandler [|EClass.XEvent|], EClass_EventHandler \n End Sub \n Dim EClass_EventHandler As Action = Sub() \n End Sub \n End Class"),
NewLines("Imports System \n Public Class EventClass \n Public Event XEvent() \n End Class \n Public Class Test \n WithEvents EClass As New EventClass \n Public Sub New() \n RemoveHandler EClass.XEvent, EClass_EventHandler \n End Sub \n Dim EClass_EventHandler As Action = Sub() \n End Sub \n End Class"))
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForAddEventMyBaseIntoCSharp()
Dim initialMarkup =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<ProjectReference>CSAssembly1</ProjectReference>
<Document>
Public Class Test
Inherits EventClass
Public Sub New()
AddHandler [|MyBase.XEvent|], AddressOf EClass_EventHandler
End Sub
Sub EClass_EventHandler(argument As String)
End Sub
End Class
</Document>
</Project>
<Project Language="C#" AssemblyName="CSAssembly1" CommonReferences="true">
<Document>
public class EventClass
{
}
</Document>
</Project>
</Workspace>.ToString()
Dim expected =
<Text>
public class EventClass
{
public event XEventHandler XEvent;
}
public delegate void XEventHandler(string argument);
</Text>.NormalizedValue
Test(initialMarkup, expected, compareTokens:=False)
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForRemoveEventMyBaseIntoCSharp()
Dim initialMarkup =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<ProjectReference>CSAssembly1</ProjectReference>
<Document>
Public Class Test
Inherits EventClass
Public Sub New()
RemoveHandler [|MyBase.XEvent|], AddressOf EClass_EventHandler
End Sub
Sub EClass_EventHandler(argument As String)
End Sub
End Class
</Document>
</Project>
<Project Language="C#" AssemblyName="CSAssembly1" CommonReferences="true">
<Document>
public class EventClass
{
}
</Document>
</Project>
</Workspace>.ToString()
Dim expected =
<Text>
public class EventClass
{
public event XEventHandler XEvent;
}
public delegate void XEventHandler(string argument);
</Text>.NormalizedValue
Test(initialMarkup, expected, compareTokens:=False)
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForAddEventMyBaseIntoCSharpGeneric()
Dim initialMarkup =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<ProjectReference>CSAssembly1</ProjectReference>
<Document>
Imports System
Public Class Test
Inherits EventClass
Public Sub New()
AddHandler [|MyBase.XEvent|], AddressOf EClass_EventHandler(Of EventArgs)
End Sub
Sub EClass_EventHandler(Of T)(sender As Object, e As T)
End Sub
End Class
</Document>
</Project>
<Project Language="C#" AssemblyName="CSAssembly1" CommonReferences="true">
<Document>
public class EventClass
{
}
</Document>
</Project>
</Workspace>.ToString()
Dim expected =
<Text>
using System;
public class EventClass
{
public event XEventHandler XEvent;
}
public delegate void XEventHandler(object sender, EventArgs e);
</Text>.NormalizedValue
Test(initialMarkup, expected, compareTokens:=False)
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForRemoveEventMyBaseIntoCSharpGeneric()
Dim initialMarkup =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<ProjectReference>CSAssembly1</ProjectReference>
<Document>
Imports System
Public Class Test
Inherits EventClass
Public Sub New()
RemoveHandler [|MyBase.XEvent|], AddressOf EClass_EventHandler(Of EventArgs)
End Sub
Sub EClass_EventHandler(Of T)(sender As Object, e As T)
End Sub
End Class
</Document>
</Project>
<Project Language="C#" AssemblyName="CSAssembly1" CommonReferences="true">
<Document>
public class EventClass
{
}
</Document>
</Project>
</Workspace>.ToString()
Dim expected =
<Text>
using System;
public class EventClass
{
public event XEventHandler XEvent;
}
public delegate void XEventHandler(object sender, EventArgs e);
</Text>.NormalizedValue
Test(initialMarkup, expected, compareTokens:=False)
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForAddEventMultiLineLambdaIntoCSharp()
Dim initialMarkup =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<ProjectReference>CSAssembly1</ProjectReference>
<Document>
Imports System
Public Class Test
WithEvents EClass As New EventClass
Public Sub New()
AddHandler [|EClass.XEvent|], Sub(a As Object, b As EventArgs)
End Sub
End Sub
End Class
</Document>
</Project>
<Project Language="C#" AssemblyName="CSAssembly1" CommonReferences="true">
<Document>
public class EventClass
{
}
</Document>
</Project>
</Workspace>.ToString()
Dim expected =
<Text>
using System;
public class EventClass
{
public event XEventHandler XEvent;
}
public delegate void XEventHandler(object a, EventArgs b);
</Text>.NormalizedValue
Test(initialMarkup, expected, compareTokens:=False)
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForRemoveEventMultiLineLambdaIntoCSharp()
Dim initialMarkup =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<ProjectReference>CSAssembly1</ProjectReference>
<Document>
Imports System
Public Class Test
WithEvents EClass As New EventClass
Public Sub New()
RemoveHandler [|EClass.XEvent|], Sub(a As Object, b As EventArgs)
End Sub
End Sub
End Class
</Document>
</Project>
<Project Language="C#" AssemblyName="CSAssembly1" CommonReferences="true">
<Document>
public class EventClass
{
}
</Document>
</Project>
</Workspace>.ToString()
Dim expected =
<Text>
using System;
public class EventClass
{
public event XEventHandler XEvent;
}
public delegate void XEventHandler(object a, EventArgs b);
</Text>.NormalizedValue
Test(initialMarkup, expected, compareTokens:=False)
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForAddEventMyBaseIntoCSharpGenericExistingDelegate()
Dim initialMarkup =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<ProjectReference>CSAssembly1</ProjectReference>
<Document>
Imports System
Public Class Test
Inherits EventClass
Public Sub New()
AddHandler [|MyBase.XEvent|], AddressOf EClass_EventHandler(Of EventArgs)
End Sub
Sub EClass_EventHandler(Of T)(sender As Object, e As T)
End Sub
End Class
</Document>
</Project>
<Project Language="C#" AssemblyName="CSAssembly1" CommonReferences="true">
<Document>
using System;
public class EventClass
{
public event XEventHandler ZEvent;
}
public delegate void XEventHandler(object sender, EventArgs e);
</Document>
</Project>
</Workspace>
TestMissingWithWorkspaceXml(initialMarkup)
End Sub
<WorkItem(774321)>
<WpfFact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEvent)>
Public Sub GenerateEventForRemoveEventMyBaseIntoCSharpGenericExistingDelegate()
Dim initialMarkup =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<ProjectReference>CSAssembly1</ProjectReference>
<Document>
Imports System
Public Class Test
Inherits EventClass
Public Sub New()
RemoveHandler [|MyBase.XEvent|], AddressOf EClass_EventHandler(Of EventArgs)
End Sub
Sub EClass_EventHandler(Of T)(sender As Object, e As T)
End Sub
End Class
</Document>
</Project>
<Project Language="C#" AssemblyName="CSAssembly1" CommonReferences="true">
<Document>
using System;
public class EventClass
{
public event XEventHandler ZEvent;
}
public delegate void XEventHandler(object sender, EventArgs e);
</Document>
</Project>
</Workspace>
TestMissingWithWorkspaceXml(initialMarkup)
End Sub
End Class
End Namespace
|
Inverness/roslyn
|
src/EditorFeatures/VisualBasicTest/Diagnostics/GenerateEvent/GenerateEventTests.vb
|
Visual Basic
|
apache-2.0
| 26,812
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Threading
Imports System.Threading.Tasks
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.CodeCleanup
Friend Module AsyncOrIteratorFunctionReturnTypeFixer
Public Function RewriteMethodStatement(func As MethodStatementSyntax, semanticModel As SemanticModel, cancellationToken As CancellationToken) As MethodStatementSyntax
Return RewriteMethodStatement(func, semanticModel, oldFunc:=func, cancellationToken:=cancellationToken)
End Function
Public Function RewriteMethodStatement(func As MethodStatementSyntax, semanticModel As SemanticModel, oldFunc As MethodStatementSyntax, cancellationToken As CancellationToken) As MethodStatementSyntax
If func.DeclarationKeyword.Kind = SyntaxKind.FunctionKeyword Then
Dim modifiers = func.Modifiers
Dim parameterListOpt = func.ParameterList
Dim asClauseOpt = func.AsClause
Dim oldAsClauseOpt = oldFunc.AsClause
Dim position = If(oldFunc.ParameterList IsNot Nothing, oldFunc.ParameterList.SpanStart, oldFunc.Identifier.SpanStart)
If RewriteFunctionStatement(modifiers, oldAsClauseOpt, parameterListOpt, asClauseOpt, semanticModel, position, cancellationToken) Then
Return func.Update(func.Kind, func.AttributeLists, func.Modifiers, func.DeclarationKeyword, func.Identifier,
func.TypeParameterList, parameterListOpt, asClauseOpt, func.HandlesClause, func.ImplementsClause)
End If
End If
Return func
End Function
Public Function RewriteLambdaHeader(lambdaHeader As LambdaHeaderSyntax, semanticModel As SemanticModel, cancellationToken As CancellationToken) As LambdaHeaderSyntax
Return RewriteLambdaHeader(lambdaHeader, semanticModel, oldLambdaHeader:=lambdaHeader, cancellationToken:=cancellationToken)
End Function
Public Function RewriteLambdaHeader(lambdaHeader As LambdaHeaderSyntax, semanticModel As SemanticModel, oldLambdaHeader As LambdaHeaderSyntax, cancellationToken As CancellationToken) As LambdaHeaderSyntax
If lambdaHeader.DeclarationKeyword.Kind = SyntaxKind.FunctionKeyword AndAlso
lambdaHeader.AsClause IsNot Nothing AndAlso
lambdaHeader.ParameterList IsNot Nothing Then
Dim parameterList = lambdaHeader.ParameterList
Dim asClause = lambdaHeader.AsClause
If RewriteFunctionStatement(lambdaHeader.Modifiers, oldLambdaHeader.AsClause, parameterList, asClause, semanticModel, oldLambdaHeader.AsClause.SpanStart, cancellationToken) Then
Return lambdaHeader.Update(lambdaHeader.Kind, lambdaHeader.AttributeLists, lambdaHeader.Modifiers, lambdaHeader.DeclarationKeyword, parameterList, asClause)
End If
End If
Return lambdaHeader
End Function
Private Function RewriteFunctionStatement(modifiers As SyntaxTokenList,
oldAsClauseOpt As AsClauseSyntax,
ByRef parameterListOpt As ParameterListSyntax,
ByRef asClauseOpt As SimpleAsClauseSyntax,
semanticModel As SemanticModel,
position As Integer,
cancellationToken As CancellationToken) As Boolean
' Pretty list Async and Iterator functions without an AsClause or an incorrect return type as follows:
' 1) Without an AsClause: Async functions are pretty listed to return Task and Iterator functions to return IEnumerable.
' 2) With an AsClause: If the return type R is a valid non-error type, pretty list as follows:
' (a) Async functions: If R is not Task or Task(Of T) or an instantiation of Task(Of T), pretty list return type to Task(Of R).
' (b) Iterator functions: If R is not IEnumerable/IEnumerator or IEnumerable(Of T)/IEnumerator(Of T) or an instantiation
' of these generic types, pretty list return type to IEnumerable(Of R).
If modifiers.Any(SyntaxKind.AsyncKeyword) Then
Return RewriteAsyncFunction(oldAsClauseOpt, parameterListOpt, asClauseOpt, semanticModel, position, cancellationToken)
ElseIf modifiers.Any(SyntaxKind.IteratorKeyword) Then
Return RewriteIteratorFunction(oldAsClauseOpt, parameterListOpt, asClauseOpt, semanticModel, position, cancellationToken)
Else
Return False
End If
End Function
Private Function RewriteAsyncFunction(oldAsClauseOpt As AsClauseSyntax,
ByRef parameterListOpt As ParameterListSyntax,
ByRef asClauseOpt As SimpleAsClauseSyntax,
semanticModel As SemanticModel,
position As Integer,
cancellationToken As CancellationToken) As Boolean
If semanticModel Is Nothing Then
Return False
End If
Dim taskType = semanticModel.Compilation.GetTypeByMetadataName(GetType(Task).FullName)
If asClauseOpt Is Nothing Then
' Without an AsClause: Async functions are pretty listed to return Task.
If taskType IsNot Nothing AndAlso parameterListOpt IsNot Nothing Then
GenerateFunctionAsClause(taskType, parameterListOpt, asClauseOpt, semanticModel, position)
Return True
End If
Else
' 2) With an AsClause: If the return type R is a valid non-error type, pretty list as follows:
' (a) Async functions: If R is not Task or Task(Of T) or an instantiation of Task(Of T), pretty list return type to Task(Of R).
Dim taskOfT = semanticModel.Compilation.GetTypeByMetadataName(GetType(Task(Of)).FullName)
Dim returnType = semanticModel.GetTypeInfo(oldAsClauseOpt.Type, cancellationToken).Type
If returnType IsNot Nothing AndAlso Not returnType.IsErrorType() AndAlso
taskType IsNot Nothing AndAlso taskOfT IsNot Nothing AndAlso
Not returnType.Equals(taskType) AndAlso Not returnType.OriginalDefinition.Equals(taskOfT) Then
RewriteFunctionAsClause(taskOfT.Construct(returnType), asClauseOpt, semanticModel, position)
Return True
End If
End If
Return False
End Function
Private Function RewriteIteratorFunction(oldAsClauseOpt As AsClauseSyntax,
ByRef parameterListOpt As ParameterListSyntax,
ByRef asClauseOpt As SimpleAsClauseSyntax,
semanticModel As SemanticModel,
position As Integer,
cancellationToken As CancellationToken) As Boolean
If semanticModel Is Nothing Then
Return False
End If
If asClauseOpt Is Nothing Then
' Without an AsClause: Iterator functions are pretty listed to return IEnumerable.
Dim iEnumerableType = semanticModel.Compilation.GetTypeByMetadataName(GetType(IEnumerable).FullName)
If iEnumerableType IsNot Nothing Then
GenerateFunctionAsClause(iEnumerableType, parameterListOpt, asClauseOpt, semanticModel, position)
Return True
End If
Else
' 2) With an AsClause: If the return type R is a valid non-error type, pretty list as follows:
' (b) Iterator functions: If R is not IEnumerable/IEnumerator or IEnumerable(Of T)/IEnumerator(Of T) or an instantiation
' of these generic types, pretty list return type to IEnumerable(Of R).
Dim returnType = semanticModel.GetTypeInfo(oldAsClauseOpt.Type, cancellationToken).Type
If returnType IsNot Nothing AndAlso Not returnType.IsErrorType() Then
Select Case returnType.OriginalDefinition.SpecialType
Case SpecialType.System_Collections_IEnumerable, SpecialType.System_Collections_IEnumerator,
SpecialType.System_Collections_Generic_IEnumerable_T, SpecialType.System_Collections_Generic_IEnumerator_T
Return False
Case Else
Dim iEnumerableOfT = semanticModel.Compilation.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerable_T)
If iEnumerableOfT IsNot Nothing Then
RewriteFunctionAsClause(iEnumerableOfT.Construct(returnType), asClauseOpt, semanticModel, position)
Return True
End If
End Select
End If
End If
Return False
End Function
' Pretty list the function without an AsClause to return type "T"
Private Sub GenerateFunctionAsClause(type As ITypeSymbol,
ByRef parameterListOpt As ParameterListSyntax,
ByRef asClauseOpt As SimpleAsClauseSyntax,
semanticModel As SemanticModel,
position As Integer)
Debug.Assert(type IsNot Nothing)
Debug.Assert(parameterListOpt IsNot Nothing)
Debug.Assert(asClauseOpt Is Nothing)
Debug.Assert(semanticModel IsNot Nothing)
Dim typeSyntax = SyntaxFactory.ParseTypeName(type.ToMinimalDisplayString(semanticModel, position))
asClauseOpt = SyntaxFactory.SimpleAsClause(typeSyntax).NormalizeWhitespace()
Dim closeParenToken = parameterListOpt.CloseParenToken
If Not closeParenToken.HasTrailingTrivia Then
' Add trailing whitespace trivia to close paren token.
closeParenToken = closeParenToken.WithTrailingTrivia(SyntaxFactory.WhitespaceTrivia(" "))
Else
' Add trailing whitespace trivia to close paren token and move it's current trailing trivia to asClause.
Dim closeParenTrailingTrivia = closeParenToken.TrailingTrivia
asClauseOpt = asClauseOpt.WithTrailingTrivia(closeParenTrailingTrivia)
closeParenToken = closeParenToken.WithTrailingTrivia(SyntaxFactory.WhitespaceTrivia(" "))
End If
parameterListOpt = parameterListOpt.WithCloseParenToken(closeParenToken)
End Sub
' Pretty list the function with return type "T" to return "genericTypeName(Of T)"
Private Sub RewriteFunctionAsClause(genericType As INamedTypeSymbol, ByRef asClauseOpt As SimpleAsClauseSyntax, semanticModel As SemanticModel, position As Integer)
Debug.Assert(genericType.IsGenericType)
Debug.Assert(asClauseOpt IsNot Nothing AndAlso Not asClauseOpt.IsMissing)
Debug.Assert(semanticModel IsNot Nothing)
' Move the leading and trailing trivia from the existing typeSyntax node to the new AsClause.
Dim typeSyntax = asClauseOpt.Type
Dim leadingTrivia = typeSyntax.GetLeadingTrivia()
Dim trailingTrivia = typeSyntax.GetTrailingTrivia()
Dim newTypeSyntax = SyntaxFactory.ParseTypeName(genericType.ToMinimalDisplayString(semanticModel, position))
' Replace the generic type argument with the original type name syntax. We need this for couple of scenarios:
' (a) Original type symbol binds to an alias symbol. Generic type argument would be the alias symbol's target type, but we want to retain the alias name.
' (b) Original type syntax is a non-simplified name, we don't want to replace it with a simplified name.
Dim genericName As GenericNameSyntax
If newTypeSyntax.Kind = SyntaxKind.QualifiedName Then
genericName = DirectCast(DirectCast(newTypeSyntax, QualifiedNameSyntax).Right, GenericNameSyntax)
Else
genericName = DirectCast(newTypeSyntax, GenericNameSyntax)
End If
Dim currentTypeArgument = genericName.TypeArgumentList.Arguments.First
Dim newTypeArgument = typeSyntax _
.WithoutLeadingTrivia() _
.WithoutTrailingTrivia()
newTypeSyntax = newTypeSyntax.ReplaceNode(currentTypeArgument, newTypeArgument) _
.WithLeadingTrivia(leadingTrivia) _
.WithTrailingTrivia(trailingTrivia)
asClauseOpt = asClauseOpt.WithType(newTypeSyntax)
End Sub
End Module
End Namespace
|
MichalStrehovsky/roslyn
|
src/Workspaces/VisualBasic/Portable/CodeCleanup/AsyncOrIteratorFunctionReturnTypeFixer.vb
|
Visual Basic
|
apache-2.0
| 13,572
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Threading.Tasks
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Roslyn.Test.Utilities
Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.VisualBasic
Public Class CodeAttributeTests
Inherits AbstractCodeAttributeTests
#Region "GetStartPoint() tests"
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetStartPoint1()
Dim code =
<Code>Imports System
<$$Serializable()>
Class C
End Class
</Code>
TestGetStartPoint(code,
Part(EnvDTE.vsCMPart.vsCMPartAttributes,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartBody,
TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=16)),
Part(EnvDTE.vsCMPart.vsCMPartBodyWithDelimiter,
TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=16)),
Part(EnvDTE.vsCMPart.vsCMPartHeader,
TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=16)),
Part(EnvDTE.vsCMPart.vsCMPartHeaderWithAttributes,
TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=16)),
Part(EnvDTE.vsCMPart.vsCMPartName,
TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=16)),
Part(EnvDTE.vsCMPart.vsCMPartNavigate,
TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=16)),
Part(EnvDTE.vsCMPart.vsCMPartWhole,
TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=16)),
Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes,
TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=16)))
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetStartPoint2()
Dim code =
<Code>Imports System
<$$CLSCompliant(True)>
Class C
End Class
</Code>
TestGetStartPoint(code,
Part(EnvDTE.vsCMPart.vsCMPartAttributes,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartBody,
TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=20)),
Part(EnvDTE.vsCMPart.vsCMPartBodyWithDelimiter,
TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=20)),
Part(EnvDTE.vsCMPart.vsCMPartHeader,
TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=20)),
Part(EnvDTE.vsCMPart.vsCMPartHeaderWithAttributes,
TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=20)),
Part(EnvDTE.vsCMPart.vsCMPartName,
TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=20)),
Part(EnvDTE.vsCMPart.vsCMPartNavigate,
TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=20)),
Part(EnvDTE.vsCMPart.vsCMPartWhole,
TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=20)),
Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes,
TextPoint(line:=3, lineOffset:=2, absoluteOffset:=18, lineLength:=20)))
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetStartPoint3()
Dim code =
<Code>
<$$Assembly: CLSCompliant(True)>
</Code>
TestGetStartPoint(code,
Part(EnvDTE.vsCMPart.vsCMPartAttributes,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartBody,
TextPoint(line:=1, lineOffset:=2, absoluteOffset:=2, lineLength:=30)),
Part(EnvDTE.vsCMPart.vsCMPartBodyWithDelimiter,
TextPoint(line:=1, lineOffset:=2, absoluteOffset:=2, lineLength:=30)),
Part(EnvDTE.vsCMPart.vsCMPartHeader,
TextPoint(line:=1, lineOffset:=2, absoluteOffset:=2, lineLength:=30)),
Part(EnvDTE.vsCMPart.vsCMPartHeaderWithAttributes,
TextPoint(line:=1, lineOffset:=2, absoluteOffset:=2, lineLength:=30)),
Part(EnvDTE.vsCMPart.vsCMPartName,
TextPoint(line:=1, lineOffset:=12, absoluteOffset:=12, lineLength:=30)),
Part(EnvDTE.vsCMPart.vsCMPartNavigate,
TextPoint(line:=1, lineOffset:=2, absoluteOffset:=2, lineLength:=30)),
Part(EnvDTE.vsCMPart.vsCMPartWhole,
TextPoint(line:=1, lineOffset:=2, absoluteOffset:=2, lineLength:=30)),
Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes,
TextPoint(line:=1, lineOffset:=2, absoluteOffset:=2, lineLength:=30)))
End Sub
#End Region
#Region "GetEndPoint() tests"
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetEndPoint1()
Dim code =
<Code>Imports System
<$$Serializable()>
Class C
End Class
</Code>
TestGetEndPoint(code,
Part(EnvDTE.vsCMPart.vsCMPartAttributes,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartBody,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=16)),
Part(EnvDTE.vsCMPart.vsCMPartBodyWithDelimiter,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=16)),
Part(EnvDTE.vsCMPart.vsCMPartHeader,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=16)),
Part(EnvDTE.vsCMPart.vsCMPartHeaderWithAttributes,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=16)),
Part(EnvDTE.vsCMPart.vsCMPartName,
TextPoint(line:=3, lineOffset:=14, absoluteOffset:=30, lineLength:=16)),
Part(EnvDTE.vsCMPart.vsCMPartNavigate,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=16)),
Part(EnvDTE.vsCMPart.vsCMPartWhole,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=16)),
Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=16)))
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetEndPoint2()
Dim code =
<Code>Imports System
<$$CLSCompliant(True)>
Class C
End Class
</Code>
TestGetEndPoint(code,
Part(EnvDTE.vsCMPart.vsCMPartAttributes,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartBody,
TextPoint(line:=3, lineOffset:=20, absoluteOffset:=36, lineLength:=20)),
Part(EnvDTE.vsCMPart.vsCMPartBodyWithDelimiter,
TextPoint(line:=3, lineOffset:=20, absoluteOffset:=36, lineLength:=20)),
Part(EnvDTE.vsCMPart.vsCMPartHeader,
TextPoint(line:=3, lineOffset:=20, absoluteOffset:=36, lineLength:=20)),
Part(EnvDTE.vsCMPart.vsCMPartHeaderWithAttributes,
TextPoint(line:=3, lineOffset:=20, absoluteOffset:=36, lineLength:=20)),
Part(EnvDTE.vsCMPart.vsCMPartName,
TextPoint(line:=3, lineOffset:=14, absoluteOffset:=30, lineLength:=20)),
Part(EnvDTE.vsCMPart.vsCMPartNavigate,
TextPoint(line:=3, lineOffset:=20, absoluteOffset:=36, lineLength:=20)),
Part(EnvDTE.vsCMPart.vsCMPartWhole,
TextPoint(line:=3, lineOffset:=20, absoluteOffset:=36, lineLength:=20)),
Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes,
TextPoint(line:=3, lineOffset:=20, absoluteOffset:=36, lineLength:=20)))
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetEndPoint3()
Dim code =
<Code>
<$$Assembly: CLSCompliant(True)>
</Code>
TestGetEndPoint(code,
Part(EnvDTE.vsCMPart.vsCMPartAttributes,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartBody,
TextPoint(line:=1, lineOffset:=30, absoluteOffset:=30, lineLength:=30)),
Part(EnvDTE.vsCMPart.vsCMPartBodyWithDelimiter,
TextPoint(line:=1, lineOffset:=30, absoluteOffset:=30, lineLength:=30)),
Part(EnvDTE.vsCMPart.vsCMPartHeader,
TextPoint(line:=1, lineOffset:=30, absoluteOffset:=30, lineLength:=30)),
Part(EnvDTE.vsCMPart.vsCMPartHeaderWithAttributes,
TextPoint(line:=1, lineOffset:=30, absoluteOffset:=30, lineLength:=30)),
Part(EnvDTE.vsCMPart.vsCMPartName,
TextPoint(line:=1, lineOffset:=24, absoluteOffset:=24, lineLength:=30)),
Part(EnvDTE.vsCMPart.vsCMPartNavigate,
TextPoint(line:=1, lineOffset:=30, absoluteOffset:=30, lineLength:=30)),
Part(EnvDTE.vsCMPart.vsCMPartWhole,
TextPoint(line:=1, lineOffset:=30, absoluteOffset:=30, lineLength:=30)),
Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes,
TextPoint(line:=1, lineOffset:=30, absoluteOffset:=30, lineLength:=30)))
End Sub
#End Region
#Region "AttributeArgument GetStartPoint() tests"
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetAttributeArgumentStartPoint1()
Dim code =
<Code>
Imports System
<$$Assembly: Goo(0,,Z:=42)>
Class GooAttribute
Inherits Attribute
Sub New(x As Integer, Optional y As Integer = 0)
End Sub
Property Z As integer
End Class
</Code>
TestAttributeArgumentStartPoint(code, 1,
Part(EnvDTE.vsCMPart.vsCMPartAttributes,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartBody,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartBodyWithDelimiter,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartHeader,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartHeaderWithAttributes,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartName,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartNavigate,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartWhole,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=25)))
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetAttributeArgumentStartPoint2()
Dim code =
<Code>
Imports System
<$$Assembly: Goo(0,,Z:=42)>
Class GooAttribute
Inherits Attribute
Sub New(x As Integer, Optional y As Integer = 0)
End Sub
Property Z As integer
End Class
</Code>
TestAttributeArgumentStartPoint(code, 2,
Part(EnvDTE.vsCMPart.vsCMPartAttributes,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartBody,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartBodyWithDelimiter,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartHeader,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartHeaderWithAttributes,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartName,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartNavigate,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartWhole,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=25)))
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetAttributeArgumentStartPoint3()
Dim code =
<Code>
Imports System
<$$Assembly: Goo(,Z:=42)>
Class GooAttribute
Inherits Attribute
Sub New(Optional y As Integer = 0)
End Sub
Property Z As integer
End Class
</Code>
TestAttributeArgumentStartPoint(code, 1,
Part(EnvDTE.vsCMPart.vsCMPartAttributes,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartBody,
TextPoint(line:=3, lineOffset:=15, absoluteOffset:=31, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartBodyWithDelimiter,
TextPoint(line:=3, lineOffset:=15, absoluteOffset:=31, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartHeader,
TextPoint(line:=3, lineOffset:=15, absoluteOffset:=31, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartHeaderWithAttributes,
TextPoint(line:=3, lineOffset:=15, absoluteOffset:=31, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartName,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartNavigate,
TextPoint(line:=3, lineOffset:=15, absoluteOffset:=31, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartWhole,
TextPoint(line:=3, lineOffset:=15, absoluteOffset:=31, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes,
TextPoint(line:=3, lineOffset:=15, absoluteOffset:=31, lineLength:=23)))
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetAttributeArgumentStartPoint4()
Dim code =
<Code>
Imports System
<$$Assembly: Goo(,Z:=42)>
Class GooAttribute
Inherits Attribute
Sub New(Optional y As Integer = 0)
End Sub
Property Z As integer
End Class
</Code>
TestAttributeArgumentStartPoint(code, 2,
Part(EnvDTE.vsCMPart.vsCMPartAttributes,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartBody,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartBodyWithDelimiter,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartHeader,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartHeaderWithAttributes,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartName,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartNavigate,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartWhole,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=23)))
End Sub
#End Region
#Region "AttributeArgument GetEndPoint() tests"
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetAttributeArgumentEndPoint1()
Dim code =
<Code>
Imports System
<$$Assembly: Goo(0,,Z:=42)>
Class GooAttribute
Inherits Attribute
Sub New(x As Integer, Optional y As Integer = 0)
End Sub
Property Z As integer
End Class
</Code>
TestAttributeArgumentEndPoint(code, 1,
Part(EnvDTE.vsCMPart.vsCMPartAttributes,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartBody,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartBodyWithDelimiter,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartHeader,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartHeaderWithAttributes,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartName,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartNavigate,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartWhole,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes,
TextPoint(line:=3, lineOffset:=17, absoluteOffset:=33, lineLength:=25)))
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetAttributeArgumentEndPoint2()
Dim code =
<Code>
Imports System
<$$Assembly: Goo(0,,Z:=42)>
Class GooAttribute
Inherits Attribute
Sub New(x As Integer, Optional y As Integer = 0)
End Sub
Property Z As integer
End Class
</Code>
TestAttributeArgumentEndPoint(code, 2,
Part(EnvDTE.vsCMPart.vsCMPartAttributes,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartBody,
TextPoint(line:=3, lineOffset:=18, absoluteOffset:=34, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartBodyWithDelimiter,
TextPoint(line:=3, lineOffset:=18, absoluteOffset:=34, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartHeader,
TextPoint(line:=3, lineOffset:=18, absoluteOffset:=34, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartHeaderWithAttributes,
TextPoint(line:=3, lineOffset:=18, absoluteOffset:=34, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartName,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartNavigate,
TextPoint(line:=3, lineOffset:=18, absoluteOffset:=34, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartWhole,
TextPoint(line:=3, lineOffset:=18, absoluteOffset:=34, lineLength:=25)),
Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes,
TextPoint(line:=3, lineOffset:=18, absoluteOffset:=34, lineLength:=25)))
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetAttributeArgumentEndPoint3()
Dim code =
<Code>
Imports System
<$$Assembly: Goo(,Z:=42)>
Class GooAttribute
Inherits Attribute
Sub New(Optional y As Integer = 0)
End Sub
Property Z As integer
End Class
</Code>
TestAttributeArgumentEndPoint(code, 1,
Part(EnvDTE.vsCMPart.vsCMPartAttributes,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartBody,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartBodyWithDelimiter,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartHeader,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartHeaderWithAttributes,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartName,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartNavigate,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartWhole,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes,
TextPoint(line:=3, lineOffset:=16, absoluteOffset:=32, lineLength:=23)))
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetAttributeArgumentEndPoint4()
Dim code =
<Code>
Imports System
<$$Assembly: Goo(,Z:=42)>
Class GooAttribute
Inherits Attribute
Sub New(Optional y As Integer = 0)
End Sub
Property Z As integer
End Class
</Code>
TestAttributeArgumentEndPoint(code, 2,
Part(EnvDTE.vsCMPart.vsCMPartAttributes,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartAttributesWithDelimiter,
NullTextPoint),
Part(EnvDTE.vsCMPart.vsCMPartBody,
TextPoint(line:=3, lineOffset:=22, absoluteOffset:=38, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartBodyWithDelimiter,
TextPoint(line:=3, lineOffset:=22, absoluteOffset:=38, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartHeader,
TextPoint(line:=3, lineOffset:=22, absoluteOffset:=38, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartHeaderWithAttributes,
TextPoint(line:=3, lineOffset:=22, absoluteOffset:=38, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartName,
TextPoint(line:=3, lineOffset:=18, absoluteOffset:=34, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartNavigate,
TextPoint(line:=3, lineOffset:=22, absoluteOffset:=38, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartWhole,
TextPoint(line:=3, lineOffset:=22, absoluteOffset:=38, lineLength:=23)),
Part(EnvDTE.vsCMPart.vsCMPartWholeWithAttributes,
TextPoint(line:=3, lineOffset:=22, absoluteOffset:=38, lineLength:=23)))
End Sub
#End Region
#Region "FullName tests"
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetFullName1()
Dim code =
<Code>
Imports System
<$$Serializable>
Class C
End Class
</Code>
TestFullName(code, "System.SerializableAttribute")
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetFullName2()
Dim code =
<Code>
<$$System.Serializable>
Class C
End Class
</Code>
TestFullName(code, "System.SerializableAttribute")
End Sub
#End Region
#Region "Parent tests"
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetParent1()
Dim code =
<Code>
Imports System
<$$Serializable>
Class C
End Class
</Code>
TestParent(code, IsElement("C", kind:=EnvDTE.vsCMElement.vsCMElementClass))
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetParent2()
Dim code =
<Code>
Imports System
<Serializable, $$CLSCompliant(False)>
Class C
End Class
</Code>
TestParent(code, IsElement("C", kind:=EnvDTE.vsCMElement.vsCMElementClass))
End Sub
#End Region
#Region "Attribute argument tests"
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetArguments1()
Dim code =
<Code>
Imports System
<$$Serializable>
Class C
End Class
</Code>
TestAttributeArguments(code, NoElements)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetArguments2()
Dim code =
<Code>
Imports System
<$$Serializable()>
Class C
End Class
</Code>
TestAttributeArguments(code, NoElements)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetArguments3()
Dim code =
<Code>
Imports System
<$$CLSCompliant(True)>
Class C
End Class
</Code>
TestAttributeArguments(code, IsAttributeArgument(value:="True"))
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetArguments4()
Dim code =
<Code>
Imports System
<$$AttributeUsage(AttributeTargets.All, AllowMultiple := False)>
Class CAttribute
Inherits Attribute
End Class
</Code>
TestAttributeArguments(code, IsAttributeArgument(value:="AttributeTargets.All"), IsAttributeArgument(name:="AllowMultiple", value:="False"))
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetArguments5_Omitted()
Dim code =
<Code>
<$$Goo(, Baz:=True)>
Class GooAttribute
Inherits Attribute
Sub New(Optional bar As String = Nothing)
End Sub
Public Property Baz As Boolean
Get
End Get
Set(value As Boolean)
End Set
End Property
End Class
</Code>
TestAttributeArguments(code, IsAttributeArgument(name:=""), IsAttributeArgument(name:="Baz", value:="True"))
End Sub
#End Region
#Region "Target tests"
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetTarget1()
Dim code =
<Code>
Imports System
<Assembly: CLSCompliant$$(False)>
</Code>
TestTarget(code, "Assembly")
End Sub
#End Region
#Region "Value tests"
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetValue1()
Dim code =
<Code>
Imports System
<$$Serializable>
Class C
End Class
</Code>
TestValue(code, "")
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetValue2()
Dim code =
<Code>
Imports System
<$$Serializable()>
Class C
End Class
</Code>
TestValue(code, "")
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetValue3()
Dim code =
<Code>
Imports System
<$$CLSCompliant(False)>
Class C
End Class
</Code>
TestValue(code, "False")
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Sub TestGetValue4()
Dim code =
<Code>
Imports System
<$$AttributeUsage(AttributeTargets.All, AllowMultiple = False)>
Class CAttribute
Inherits Attribute
End Class
</Code>
TestValue(code, "AttributeTargets.All, AllowMultiple = False")
End Sub
#End Region
#Region "AddAttributeArgument tests"
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestAddAttributeArgument1() As Task
Dim code =
<Code>
Imports System
<$$CLSCompliant>
Class C
End Class
</Code>
Dim expectedCode =
<Code>
Imports System
<CLSCompliant(True)>
Class C
End Class
</Code>
Await TestAddAttributeArgument(code, expectedCode, New AttributeArgumentData With {.Value = "True"})
End Function
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestAddAttributeArgument2() As Task
Dim code =
<Code>
Imports System
<$$CLSCompliant()>
Class C
End Class
</Code>
Dim expectedCode =
<Code>
Imports System
<CLSCompliant(True)>
Class C
End Class
</Code>
Await TestAddAttributeArgument(code, expectedCode, New AttributeArgumentData With {.Value = "True"})
End Function
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestAddArgument3() As Task
Dim code =
<Code>
Imports System
<$$AttributeUsage(AttributeTargets.All)>
Class CAttribute
Inherits Attribute
End Class
</Code>
Dim expectedCode =
<Code>
Imports System
<AttributeUsage(AttributeTargets.All, AllowMultiple:=False)>
Class CAttribute
Inherits Attribute
End Class
</Code>
Await TestAddAttributeArgument(code, expectedCode, New AttributeArgumentData With {.Name = "AllowMultiple", .Value = "False", .Position = 1})
End Function
#End Region
#Region "Delete tests"
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestDelete1() As Task
Dim code =
<Code><![CDATA[
<$$Goo>
Class C
End Class
]]></Code>
Dim expected =
<Code><![CDATA[
Class C
End Class
]]></Code>
Await TestDelete(code, expected)
End Function
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestDelete2() As Task
Dim code =
<Code><![CDATA[
<$$Goo, Bar>
Class C
End Class
]]></Code>
Dim expected =
<Code><![CDATA[
<Bar>
Class C
End Class
]]></Code>
Await TestDelete(code, expected)
End Function
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestDelete3() As Task
Dim code =
<Code><![CDATA[
<Goo>
<$$Bar>
Class C
End Class
]]></Code>
Dim expected =
<Code><![CDATA[
<Goo>
Class C
End Class
]]></Code>
Await TestDelete(code, expected)
End Function
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestDelete4() As Task
Dim code =
<Code><![CDATA[
<Assembly: $$Goo>
]]></Code>
Dim expected =
<Code><![CDATA[
]]></Code>
Await TestDelete(code, expected)
End Function
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestDelete5() As Task
Dim code =
<Code><![CDATA[
<Assembly: $$Goo, Assembly: Bar>
]]></Code>
Dim expected =
<Code><![CDATA[
<Assembly: Bar>
]]></Code>
Await TestDelete(code, expected)
End Function
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestDelete6() As Task
Dim code =
<Code><![CDATA[
<Assembly: Goo>
<Assembly: $$Bar>
]]></Code>
Dim expected =
<Code><![CDATA[
<Assembly: Goo>
]]></Code>
Await TestDelete(code, expected)
End Function
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestDelete7() As Task
Dim code =
<Code><![CDATA[
''' <summary>
''' Doc comment
''' </summary>
<$$Goo>
Class C
End Class
]]></Code>
Dim expected =
<Code><![CDATA[
''' <summary>
''' Doc comment
''' </summary>
Class C
End Class
]]></Code>
Await TestDelete(code, expected)
End Function
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestDelete8() As Task
Dim code =
<Code><![CDATA[
<$$Goo> ' Comment comment comment
Class C
End Class
]]></Code>
Dim expected =
<Code><![CDATA[
Class C
End Class
]]></Code>
Await TestDelete(code, expected)
End Function
#End Region
#Region "Delete attribute argument tests"
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestDeleteAttributeArgument1() As Task
Dim code =
<Code><![CDATA[
<$$System.CLSCompliant(True)>
Class C
End Class
]]></Code>
Dim expected =
<Code><![CDATA[
<System.CLSCompliant()>
Class C
End Class
]]></Code>
Await TestDeleteAttributeArgument(code, expected, 1)
End Function
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestDeleteAttributeArgument2() As Task
Dim code =
<Code><![CDATA[
<$$AttributeUsage(AttributeTargets.All, AllowMultiple:=False)>
Class CAttribute
Inherits Attribute
End Class
]]></Code>
Dim expected =
<Code><![CDATA[
<AttributeUsage(AllowMultiple:=False)>
Class CAttribute
Inherits Attribute
End Class
]]></Code>
Await TestDeleteAttributeArgument(code, expected, 1)
End Function
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestDeleteAttributeArgument3() As Task
Dim code =
<Code><![CDATA[
<$$AttributeUsage(AttributeTargets.All, AllowMultiple:=False)>
Class CAttribute
Inherits Attribute
End Class
]]></Code>
Dim expected =
<Code><![CDATA[
<AttributeUsage(AttributeTargets.All)>
Class CAttribute
Inherits Attribute
End Class
]]></Code>
Await TestDeleteAttributeArgument(code, expected, 2)
End Function
#End Region
#Region "Set Name tests"
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestSetName_NewName() As Task
Dim code =
<Code><![CDATA[
<$$Goo()>
Class C
End Class
]]></Code>
Dim expected =
<Code><![CDATA[
<Bar()>
Class C
End Class
]]></Code>
Await TestSetName(code, expected, "Bar", NoThrow(Of String)())
End Function
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestSetName_SimpleNameToDottedName() As Task
Dim code =
<Code><![CDATA[
<$$Goo()>
Class C
End Class
]]></Code>
Dim expected =
<Code><![CDATA[
<Bar.Baz()>
Class C
End Class
]]></Code>
Await TestSetName(code, expected, "Bar.Baz", NoThrow(Of String)())
End Function
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestSetName_DottedNameToSimpleName() As Task
Dim code =
<Code><![CDATA[
<$$Goo()>
Class C
End Class
]]></Code>
Dim expected =
<Code><![CDATA[
<Bar.Baz()>
Class C
End Class
]]></Code>
Await TestSetName(code, expected, "Bar.Baz", NoThrow(Of String)())
End Function
#End Region
#Region "Set Target tests"
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestSetTarget1() As Task
Dim code =
<Code>
Imports System
<Assembly: CLSCompliant$$(False)>
</Code>
Dim expected =
<Code>
Imports System
<Module: CLSCompliant(False)>
</Code>
Await TestSetTarget(code, expected, "Module")
End Function
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestSetTarget2() As Task
Dim code =
<Code>
Imports System
<CLSCompliant$$(False)>
Class C
End Class
</Code>
Dim expected =
<Code>
Imports System
<Assembly: CLSCompliant(False)>
Class C
End Class
</Code>
Await TestSetTarget(code, expected, "Assembly")
End Function
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestSetTarget3() As Task
Dim code =
<Code>
Imports System
<Assembly: CLSCompliant$$(False)>
</Code>
Dim expected =
<Code>
Imports System
<CLSCompliant(False)>
</Code>
Await TestSetTarget(code, expected, "")
End Function
#End Region
#Region "Set Value tests"
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestSetValue1() As Task
Dim code =
<Code>
Imports System
<Assembly: CLSCompliant$$(False)>
</Code>
Dim expected =
<Code>
Imports System
<Assembly: CLSCompliant(True)>
</Code>
Await TestSetValue(code, expected, "True")
End Function
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestSetValue2() As Task
Dim code =
<Code>
Imports System
<Assembly: CLSCompliant$$()>
</Code>
Dim expected =
<Code>
Imports System
<Assembly: CLSCompliant(True)>
</Code>
Await TestSetValue(code, expected, "True")
End Function
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestSetValue3() As Task
Dim code =
<Code>
Imports System
<Assembly: CLSCompliant$$>
</Code>
Dim expected =
<Code>
Imports System
<Assembly: CLSCompliant(True)>
</Code>
Await TestSetValue(code, expected, "True")
End Function
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModel)>
Public Async Function TestSetValue4() As Task
Dim code =
<Code>
Imports System
<Assembly: CLSCompliant$$(False)>
</Code>
Dim expected =
<Code>
Imports System
<Assembly: CLSCompliant()>
</Code>
Await TestSetValue(code, expected, "")
End Function
#End Region
Protected Overrides ReadOnly Property LanguageName As String
Get
Return LanguageNames.VisualBasic
End Get
End Property
End Class
End Namespace
|
VSadov/roslyn
|
src/VisualStudio/Core/Test/CodeModel/VisualBasic/CodeAttributeTests.vb
|
Visual Basic
|
apache-2.0
| 41,166
|
#Region "Copyright"
'
' Copyright (c) _YEAR_
' by _OWNER_
'
#End Region
#Region "Using Statements"
Imports System
Imports DotNetNuke.Entities.Modules
#End Region
Namespace _OWNER_._MODULE_
Partial Public Class _CONTROL_
Inherits PortalModuleBase
#Region "Event Handlers"
Protected Overrides Sub OnInit(e As EventArgs)
MyBase.OnInit(e)
End Sub
Protected Overrides Sub OnLoad(e As EventArgs)
MyBase.OnLoad(e)
If Not Page.IsPostBack Then
txtField.Text = DirectCast(Settings("field"), String)
End If
End Sub
Protected Sub cmdSave_Click(sender As Object, e As EventArgs) Handles cmdSave.Click
ModuleController.Instance.UpdateModuleSetting(ModuleId, "field", txtField.Text)
Skins.Skin.AddModuleMessage(Me, "Update Successful", Skins.Controls.ModuleMessage.ModuleMessageType.GreenSuccess)
End Sub
Protected Sub cmdCancel_Click(sender As Object, e As EventArgs) Handles cmdCancel.Click
End Sub
#End Region
End Class
End Namespace
|
raphael-m/Dnn.Platform
|
Website/DesktopModules/Admin/ModuleCreator/Templates/VB/Module - User Control/_CONTROL_.ascx.vb
|
Visual Basic
|
mit
| 1,109
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics
Imports Microsoft.CodeAnalysis.VisualBasic.Diagnostics
Imports Microsoft.CodeAnalysis.VisualBasic.GenerateConstructor
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.GenerateConstructor
Public Class GenerateConstructorTests
Inherits AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest
Friend Overrides Function CreateDiagnosticProviderAndFixer(workspace As Workspace) As (DiagnosticAnalyzer, CodeFixProvider)
Return (Nothing, New GenerateConstructorCodeFixProvider())
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateIntoContainingType() As Task
Await TestInRegularAndScriptAsync(
"Class C
Sub Main()
Dim f = New C([|4|], 5, 6)
End Sub
End Class",
"Class C
Private v1 As Integer
Private v2 As Integer
Private v3 As Integer
Public Sub New(v1 As Integer, v2 As Integer, v3 As Integer)
Me.v1 = v1
Me.v2 = v2
Me.v3 = v3
End Sub
Sub Main()
Dim f = New C(4, 5, 6)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestInvokingFromInsideAnotherConstructor() As Task
Await TestInRegularAndScriptAsync(
"Class A
Private v As B
Public Sub New()
Me.v = New B([|5|])
End Sub
End Class
Friend Class B
End Class",
"Class A
Private v As B
Public Sub New()
Me.v = New B(5)
End Sub
End Class
Friend Class B
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestMissingGenerateDefaultConstructor() As Task
Await TestMissingInRegularAndScriptAsync(
"Class Test
Sub Main()
Dim a = New [|A|]()
End Sub
End Class
Class A
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestMissingGenerateDefaultConstructorInStructure() As Task
Await TestMissingInRegularAndScriptAsync(
"Class Test
Sub Main()
Dim a = New [|A|]()
End Sub
End Class
Structure A
End Structure")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestOfferDefaultConstructorWhenOverloadExists() As Task
Await TestInRegularAndScriptAsync(
"Class Test
Sub Main()
Dim a = [|New A()|]
End Sub
End Class
Class A
Sub New(x As Integer)
End Sub
End Class",
"Class Test
Sub Main()
Dim a = New A()
End Sub
End Class
Class A
Public Sub New()
End Sub
Sub New(x As Integer)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestParameterizedConstructorOffered1() As Task
Await TestInRegularAndScriptAsync(
"Class Test
Sub Main()
Dim a = New A([|1|])
End Sub
End Class
Class A
End Class",
"Class Test
Sub Main()
Dim a = New A(1)
End Sub
End Class
Class A
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestParameterizedConstructorOffered2() As Task
Await TestInRegularAndScriptAsync(
"Class Test
Sub Main()
Dim a = New A([|1|])
End Sub
End Class
Class A
Public Sub New()
End Sub
End Class",
"Class Test
Sub Main()
Dim a = New A(1)
End Sub
End Class
Class A
Private v As Integer
Public Sub New()
End Sub
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class")
End Function
<WorkItem(527627, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/527627"), WorkItem(539735, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539735"), WorkItem(539735, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539735")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestInAsNewExpression() As Task
Await TestInRegularAndScriptAsync(
"Class Test
Sub Main()
Dim a As New A([|1|])
End Sub
End Class
Class A
Public Sub New()
End Sub
End Class",
"Class Test
Sub Main()
Dim a As New A(1)
End Sub
End Class
Class A
Private v As Integer
Public Sub New()
End Sub
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateInPartialClass1() As Task
Await TestInRegularAndScriptAsync(
"Public Partial Class Test
Public Sub S1()
End Sub
End Class
Public Class Test
Public Sub S2()
End Sub
End Class
Public Class A
Sub Main()
Dim s = New Test([|5|])
End Sub
End Class",
"Public Partial Class Test
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
Public Sub S1()
End Sub
End Class
Public Class Test
Public Sub S2()
End Sub
End Class
Public Class A
Sub Main()
Dim s = New Test(5)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateInPartialClassWhenArityDoesntMatch() As Task
Await TestInRegularAndScriptAsync(
"Public Partial Class Test
Public Sub S1()
End Sub
End Class
Public Class Test(Of T)
Public Sub S2()
End Sub
End Class
Public Class A
Sub Main()
Dim s = New Test([|5|])
End Sub
End Class",
"Public Partial Class Test
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
Public Sub S1()
End Sub
End Class
Public Class Test(Of T)
Public Sub S2()
End Sub
End Class
Public Class A
Sub Main()
Dim s = New Test(5)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateInPartialClassWithConflicts() As Task
Await TestInRegularAndScriptAsync(
"Public Partial Class Test2
End Class
Private Partial Class Test2
End Class
Public Class A
Sub Main()
Dim s = New Test2([|5|])
End Sub
End Class",
"Public Partial Class Test2
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class
Private Partial Class Test2
End Class
Public Class A
Sub Main()
Dim s = New Test2(5)
End Sub
End Class")
End Function
<WorkItem(528257, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528257")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateIntoInaccessibleType() As Task
Await TestMissingInRegularAndScriptAsync(
"Class Goo
Private Class Bar
End Class
End Class
Class A
Sub Main()
Dim s = New Goo.Bar([|5|])
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestOnNestedTypes() As Task
Await TestInRegularAndScriptAsync(
"Class Goo
Class Bar
End Class
End Class
Class A
Sub Main()
Dim s = New Goo.Bar([|5|])
End Sub
End Class",
"Class Goo
Class Bar
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class
End Class
Class A
Sub Main()
Dim s = New Goo.Bar(5)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestOnNestedPartialTypes() As Task
Await TestInRegularAndScriptAsync(
"Public Partial Class Test
Public Partial Class NestedTest
Public Sub S1()
End Sub
End Class
End Class
Public Partial Class Test
Public Partial Class NestedTest
Public Sub S2()
End Sub
End Class
End Class
Class A
Sub Main()
Dim s = New Test.NestedTest([|5|])
End Sub
End Class",
"Public Partial Class Test
Public Partial Class NestedTest
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
Public Sub S1()
End Sub
End Class
End Class
Public Partial Class Test
Public Partial Class NestedTest
Public Sub S2()
End Sub
End Class
End Class
Class A
Sub Main()
Dim s = New Test.NestedTest(5)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestOnNestedGenericType() As Task
Await TestInRegularAndScriptAsync(
"Class Outer(Of T)
Public Class Inner
End Class
Public i = New Inner([|5|])
End Class",
"Class Outer(Of T)
Public Class Inner
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class
Public i = New Inner(5)
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestOnGenericTypes1() As Task
Await TestInRegularAndScriptAsync(
"Class Base(Of T, V)
End Class
Class Test
Sub Goo()
Dim a = New Base(Of Integer, Integer)([|5|], 5)
End Sub
End Class",
"Class Base(Of T, V)
Private v1 As Integer
Private v2 As Integer
Public Sub New(v1 As Integer, v2 As Integer)
Me.v1 = v1
Me.v2 = v2
End Sub
End Class
Class Test
Sub Goo()
Dim a = New Base(Of Integer, Integer)(5, 5)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestOnGenericTypes2() As Task
Await TestInRegularAndScriptAsync(
"Class Base(Of T, V)
End Class
Class Derived(Of V)
Inherits Base(Of Integer, V)
End Class
Class Test
Sub Goo()
Dim a = New Base(Of Integer, Integer)(5, 5)
Dim b = New Derived(Of Integer)([|5|])
End Sub
End Class",
"Class Base(Of T, V)
End Class
Class Derived(Of V)
Inherits Base(Of Integer, V)
Private v1 As Integer
Public Sub New(v1 As Integer)
Me.v1 = v1
End Sub
End Class
Class Test
Sub Goo()
Dim a = New Base(Of Integer, Integer)(5, 5)
Dim b = New Derived(Of Integer)(5)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestOnGenericTypes3() As Task
Await TestInRegularAndScriptAsync(
"Class Base(Of T, V)
End Class
Class Derived(Of V)
Inherits Base(Of Integer, V)
End Class
Class MoreDerived
Inherits Derived(Of Double)
End Class
Class Test
Sub Goo()
Dim a = New Base(Of Integer, Integer)(5, 5)
Dim b = New Derived(Of Integer)(5)
Dim c = New MoreDerived([|5.5|])
End Sub
End Class",
"Class Base(Of T, V)
End Class
Class Derived(Of V)
Inherits Base(Of Integer, V)
End Class
Class MoreDerived
Inherits Derived(Of Double)
Private v As Double
Public Sub New(v As Double)
Me.v = v
End Sub
End Class
Class Test
Sub Goo()
Dim a = New Base(Of Integer, Integer)(5, 5)
Dim b = New Derived(Of Integer)(5)
Dim c = New MoreDerived(5.5)
End Sub
End Class")
End Function
<WorkItem(528244, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528244")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestDateTypeForInference() As Task
Await TestInRegularAndScriptAsync(
"Class Goo
End Class
Class A
Sub Main()
Dim s = New Goo([|Date.Now|])
End Sub
End Class",
"Class Goo
Private now As Date
Public Sub New(now As Date)
Me.now = now
End Sub
End Class
Class A
Sub Main()
Dim s = New Goo(Date.Now)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestBaseConstructor() As Task
Await TestInRegularAndScriptAsync(
"Class Base
End Class
Class Derived
Inherits Base
Private x As Integer
Public Sub New(x As Integer)
MyBase.New([|x|])
Me.x = x
End Sub
End Class",
"Class Base
Private x As Integer
Public Sub New(x As Integer)
Me.x = x
End Sub
End Class
Class Derived
Inherits Base
Private x As Integer
Public Sub New(x As Integer)
MyBase.New(x)
Me.x = x
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestMustInheritBase() As Task
Await TestInRegularAndScriptAsync(
"MustInherit Class Base
End Class
Class Derived
Inherits Base
Shared x As Integer
Public Sub New(x As Integer)
MyBase.New([|x|]) 'This should generate a protected ctor in Base
Derived.x = x
End Sub
Sub Test1()
Dim a As New Derived(1)
End Sub
End Class",
"MustInherit Class Base
Private x As Integer
Protected Sub New(x As Integer)
Me.x = x
End Sub
End Class
Class Derived
Inherits Base
Shared x As Integer
Public Sub New(x As Integer)
MyBase.New(x) 'This should generate a protected ctor in Base
Derived.x = x
End Sub
Sub Test1()
Dim a As New Derived(1)
End Sub
End Class")
End Function
<WorkItem(540586, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540586")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestMissingOnNoCloseParen() As Task
Await TestMissingInRegularAndScriptAsync(
"Imports System
Imports System.Collections.Generic
Imports System.Linq
Module Program
Sub Main(args As String())
Dim c = New [|goo|](
End Sub
End Module
Class goo
End Class")
End Function
<WorkItem(540545, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540545")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestConversionError() As Task
Await TestInRegularAndScriptAsync(
"Imports System
Module Program
Sub Main(args As String())
Dim i As Char
Dim cObject As C = New C([|i|])
Console.WriteLine(cObject.v1)
End Sub
End Module
Class C
Public v1 As Integer
Public Sub New(v1 As Integer)
Me.v1 = v1
End Sub
End Class",
"Imports System
Module Program
Sub Main(args As String())
Dim i As Char
Dim cObject As C = New C(i)
Console.WriteLine(cObject.v1)
End Sub
End Module
Class C
Public v1 As Integer
Private i As Char
Public Sub New(v1 As Integer)
Me.v1 = v1
End Sub
Public Sub New(i As Char)
Me.i = i
End Sub
End Class")
End Function
<WorkItem(540642, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540642")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestNotOnNestedConstructor() As Task
Await TestInRegularAndScriptAsync(
"Module Program
Sub Main(args As String())
Dim x As C = New C([|New C()|])
End Sub
End Module
Friend Class C
End Class",
"Module Program
Sub Main(args As String())
Dim x As C = New C(New C())
End Sub
End Module
Friend Class C
Private c As C
Public Sub New(c As C)
Me.c = c
End Sub
End Class")
End Function
<WorkItem(540607, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540607")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestUnavailableTypeParameters() As Task
Await TestInRegularAndScriptAsync(
"Class C(Of T1, T2)
Sub M(x As T1, y As T2)
Dim a As Test = New Test([|x|], y)
End Sub
End Class
Friend Class Test
End Class",
"Class C(Of T1, T2)
Sub M(x As T1, y As T2)
Dim a As Test = New Test(x, y)
End Sub
End Class
Friend Class Test
Private x As Object
Private y As Object
Public Sub New(x As Object, y As Object)
Me.x = x
Me.y = y
End Sub
End Class")
End Function
<WorkItem(540748, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540748")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestKeywordArgument1() As Task
Await TestInRegularAndScriptAsync(
"Class Test
Private [Class] As Integer = 5
Sub Main()
Dim a = New A([|[Class]|])
End Sub
End Class
Class A
End Class",
"Class Test
Private [Class] As Integer = 5
Sub Main()
Dim a = New A([Class])
End Sub
End Class
Class A
Private [class] As Integer
Public Sub New([class] As Integer)
Me.class = [class]
End Sub
End Class")
End Function
<WorkItem(540747, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540747")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestKeywordArgument2() As Task
Await TestInRegularAndScriptAsync(
"Class Test
Sub Main()
Dim a = New A([|Class|])
End Sub
End Class
Class A
End Class",
"Class Test
Sub Main()
Dim a = New A(Class)
End Sub
End Class
Class A
Private p As Object
Public Sub New(p As Object)
Me.p = p
End Sub
End Class")
End Function
<WorkItem(540746, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540746")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestConflictWithTypeParameterName() As Task
Await TestInRegularAndScriptAsync(
"Class Test
Sub Goo()
Dim a = New Bar(Of Integer)([|5|])
End Sub
End Class
Class Bar(Of V)
End Class",
"Class Test
Sub Goo()
Dim a = New Bar(Of Integer)(5)
End Sub
End Class
Class Bar(Of V)
Private v1 As Integer
Public Sub New(v1 As Integer)
Me.v1 = v1
End Sub
End Class")
End Function
<WorkItem(541174, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541174")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestExistingReadonlyField() As Task
Await TestInRegularAndScriptAsync(
"Class C
ReadOnly x As Integer
Sub Test()
Dim x As Integer = 1
Dim obj As New C([|x|])
End Sub
End Class",
"Class C
ReadOnly x As Integer
Public Sub New(x As Integer)
Me.x = x
End Sub
Sub Test()
Dim x As Integer = 1
Dim obj As New C(x)
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestExistingProperty() As Task
Await TestInRegularAndScriptAsync(
"Class Program
Sub Test()
Dim x = New A([|P|]:=5)
End Sub
End Class
Class A
Public Property P As Integer
End Class",
"Class Program
Sub Test()
Dim x = New A(P:=5)
End Sub
End Class
Class A
Public Sub New(P As Integer)
Me.P = P
End Sub
Public Property P As Integer
End Class")
End Function
<WorkItem(542055, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542055")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestExistingMethod() As Task
Await TestInRegularAndScriptAsync(
"Class A
Sub Test()
Dim t As New C([|u|]:=5)
End Sub
End Class
Class C
Public Sub u()
End Sub
End Class",
"Class A
Sub Test()
Dim t As New C(u:=5)
End Sub
End Class
Class C
Private u1 As Integer
Public Sub New(u As Integer)
u1 = u
End Sub
Public Sub u()
End Sub
End Class")
End Function
<WorkItem(542055, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542055")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestDetectAssignmentToSharedFieldFromInstanceConstructor() As Task
Await TestInRegularAndScriptAsync(
"Class Program
Sub Test()
Dim x = New A([|P|]:=5)
End Sub
End Class
Class A
Shared Property P As Integer
End Class",
"Class Program
Sub Test()
Dim x = New A(P:=5)
End Sub
End Class
Class A
Private P1 As Integer
Public Sub New(P As Integer)
P1 = P
End Sub
Shared Property P As Integer
End Class")
End Function
<WorkItem(542055, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542055")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestExistingFieldWithSameNameButIncompatibleType() As Task
Await TestInRegularAndScriptAsync(
"Class A
Sub Test()
Dim t As New B([|x|]:=5)
End Sub
End Class
Class B
Private x As String
End Class",
"Class A
Sub Test()
Dim t As New B(x:=5)
End Sub
End Class
Class B
Private x As String
Private x1 As Integer
Public Sub New(x As Integer)
x1 = x
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestExistingFieldFromBaseClass() As Task
Await TestInRegularAndScriptAsync(
"Class A
Sub Test()
Dim t As New C([|u|]:=5)
End Sub
End Class
Class C
Inherits B
Private x As String
End Class
Class B
Protected u As Integer
End Class",
"Class A
Sub Test()
Dim t As New C(u:=5)
End Sub
End Class
Class C
Inherits B
Private x As String
Public Sub New(u As Integer)
Me.u = u
End Sub
End Class
Class B
Protected u As Integer
End Class")
End Function
<WorkItem(542098, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542098")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestMeConstructorInitializer() As Task
Await TestInRegularAndScriptAsync(
"Class C
Sub New
Me.New([|1|])
End Sub
End Class",
"Class C
Private v As Integer
Sub New
Me.New(1)
End Sub
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class")
End Function
<WorkItem(542098, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542098")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestExistingMeConstructorInitializer() As Task
Await TestMissingInRegularAndScriptAsync(
"Class C
Private v As Integer
Sub New
Me.[|New|](1)
End Sub
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class")
End Function
<WorkItem(542098, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542098")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestMyBaseConstructorInitializer() As Task
Await TestInRegularAndScriptAsync(
"Class C
Sub New
MyClass.New([|1|])
End Sub
End Class",
"Class C
Private v As Integer
Sub New
MyClass.New(1)
End Sub
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class")
End Function
<WorkItem(542098, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542098")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestExistingMyBaseConstructorInitializer() As Task
Await TestMissingInRegularAndScriptAsync(
"Class C
Private v As Integer
Sub New
MyClass.[|New|](1)
End Sub
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class")
End Function
<WorkItem(542098, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542098")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestMyClassConstructorInitializer() As Task
Await TestInRegularAndScriptAsync(
"Class C
Inherits B
Sub New
MyBase.New([|1|])
End Sub
End Class
Class B
End Class",
"Class C
Inherits B
Sub New
MyBase.New(1)
End Sub
End Class
Class B
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class")
End Function
<WorkItem(542098, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542098")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestExistingMyClassConstructorInitializer() As Task
Await TestMissingInRegularAndScriptAsync(
"Class C
Inherits B
Sub New
MyBase.New([|1|])
End Sub
End Class
Class B
Protected Sub New(v As Integer)
End Sub
End Class")
End Function
<WorkItem(542056, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542056")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestConflictingFieldNameInSubclass() As Task
Await TestInRegularAndScriptAsync(
"Class A
Sub Test()
Dim t As New C([|u|]:=5)
End Sub
End Class
Class C
Inherits B
Private x As String
End Class
Class B
Protected u As String
End Class",
"Class A
Sub Test()
Dim t As New C(u:=5)
End Sub
End Class
Class C
Inherits B
Private x As String
Private u1 As Integer
Public Sub New(u As Integer)
u1 = u
End Sub
End Class
Class B
Protected u As String
End Class")
End Function
<WorkItem(542442, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542442")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestNothingArgument() As Task
Await TestMissingInRegularAndScriptAsync(
"Class C1
Public Sub New(ByVal accountKey As Integer)
Me.new()
Me.[|new|](accountKey, Nothing)
End Sub
Public Sub New(ByVal accountKey As Integer, ByVal accountName As String)
Me.New(accountKey, accountName, Nothing)
End Sub
Public Sub New(ByVal accountKey As Integer, ByVal accountName As String, ByVal accountNumber As String)
End Sub
End Class")
End Function
<WorkItem(540641, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540641")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestMissingOnExistingConstructor() As Task
Await TestMissingInRegularAndScriptAsync(
"Module Program
Sub M()
Dim x As C = New [|C|](P)
End Sub
End Module
Class C
Private v As Object
Public Sub New(v As Object)
Me.v = v
End Sub
End Class")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerationIntoVisibleType() As Task
Await TestInRegularAndScriptAsync(
"#ExternalSource (""Default.aspx"", 1)
Class C
Sub Goo()
Dim x As New D([|5|])
End Sub
End Class
Class D
End Class
#End ExternalSource",
"#ExternalSource (""Default.aspx"", 1)
Class C
Sub Goo()
Dim x As New D(5)
End Sub
End Class
Class D
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class
#End ExternalSource")
End Function
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestNoGenerationIntoEntirelyHiddenType() As Task
Await TestMissingInRegularAndScriptAsync(
<Text>#ExternalSource (""Default.aspx"", 1)
Class C
Sub Goo()
Dim x As New D([|5|])
End Sub
End Class
#End ExternalSource
Class D
End Class
</Text>.Value)
End Function
<WorkItem(546030, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546030")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestConflictingDelegatedParameterNameAndNamedArgumentName1() As Task
Await TestInRegularAndScriptAsync(
"Module Program
Sub Main(args As String())
Dim objc As New C(1, [|prop|]:=""Property"")
End Sub
End Module
Class C
Private prop As String
Public Sub New(prop As String)
Me.prop = prop
End Sub
End Class",
"Module Program
Sub Main(args As String())
Dim objc As New C(1, prop:=""Property"")
End Sub
End Module
Class C
Private prop As String
Private v As Integer
Public Sub New(prop As String)
Me.prop = prop
End Sub
Public Sub New(v As Integer, prop As String)
Me.v = v
Me.prop = prop
End Sub
End Class")
End Function
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestFormattingInGenerateConstructor() As Task
Await TestInRegularAndScriptAsync(
<Text>Class C
Sub New()
MyClass.New([|1|])
End Sub
End Class</Text>.Value.Replace(vbLf, vbCrLf),
<Text>Class C
Private v As Integer
Sub New()
MyClass.New(1)
End Sub
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class</Text>.Value.Replace(vbLf, vbCrLf))
End Function
<WorkItem(530003, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530003")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestAttributesWithArgument() As Task
Await TestInRegularAndScriptAsync(
"<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
End Class
[|<MyAttribute(123)>|]
Public Class D
End Class",
"<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class
<MyAttribute(123)>
Public Class D
End Class")
End Function
<WorkItem(530003, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530003")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestAttributesWithMultipleArguments() As Task
Await TestInRegularAndScriptAsync(
"<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
End Class
[|<MyAttribute(true, 1, ""hello"")>|]
Public Class D
End Class",
"<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
Private v1 As Boolean
Private v2 As Integer
Private v3 As String
Public Sub New(v1 As Boolean, v2 As Integer, v3 As String)
Me.v1 = v1
Me.v2 = v2
Me.v3 = v3
End Sub
End Class
<MyAttribute(true, 1, ""hello"")>
Public Class D
End Class")
End Function
<WorkItem(530003, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530003")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestAttributesWithNamedArguments() As Task
Await TestInRegularAndScriptAsync(
"<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
End Class
[|<MyAttribute(true, 1, Topic:=""hello"")>|]
Public Class D
End Class",
"<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
Private v1 As Boolean
Private v2 As Integer
Private Topic As String
Public Sub New(v1 As Boolean, v2 As Integer, Topic As String)
Me.v1 = v1
Me.v2 = v2
Me.Topic = Topic
End Sub
End Class
<MyAttribute(true, 1, Topic:=""hello"")>
Public Class D
End Class")
End Function
<WorkItem(530003, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530003")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestAttributesWithAdditionalConstructors() As Task
Await TestInRegularAndScriptAsync(
"<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class
[|<MyAttribute(True, 2)>|]
Public Class D
End Class",
"<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
Private v As Integer
Private v1 As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
Public Sub New(v As Integer, v1 As Integer)
Me.New(v)
Me.v1 = v1
End Sub
End Class
<MyAttribute(True, 2)>
Public Class D
End Class")
End Function
<WorkItem(530003, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530003")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestAttributesWithAllValidArguments() As Task
Await TestInRegularAndScriptAsync(
"Enum A
A1
End Enum
<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
End Class
[|<MyAttribute(New Short(1) {1, 2, 3}, A.A1, True, 1, ""Z""c, 5S, 1I, 5L, 6.0R, 2.1F, ""abc"")>|]
Public Class D End Class",
"Enum A
A1
End Enum
<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute
Private v1 As Short()
Private a1 As A
Private v2 As Boolean
Private v3 As Integer
Private v4 As Char
Private v5 As Short
Private v6 As Integer
Private v7 As Long
Private v8 As Double
Private v9 As Single
Private v10 As String
Public Sub New(v1() As Short, a1 As A, v2 As Boolean, v3 As Integer, v4 As Char, v5 As Short, v6 As Integer, v7 As Long, v8 As Double, v9 As Single, v10 As String)
Me.v1 = v1
Me.a1 = a1
Me.v2 = v2
Me.v3 = v3
Me.v4 = v4
Me.v5 = v5
Me.v6 = v6
Me.v7 = v7
Me.v8 = v8
Me.v9 = v9
Me.v10 = v10
End Sub
End Class
<MyAttribute(New Short(1) {1, 2, 3}, A.A1, True, 1, ""Z""c, 5S, 1I, 5L, 6.0R, 2.1F, ""abc"")>
Public Class D End Class")
End Function
<WorkItem(530003, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530003")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestAttributesWithLambda() As Task
Await TestMissingInRegularAndScriptAsync(
"<AttributeUsage(AttributeTargets.Class)>
Public Class MyAttribute
Inherits System.Attribute End Class
[|<MyAttribute(Function(x) x + 1)>|]
Public Class D
End Class")
End Function
<WorkItem(889349, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/889349")>
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestConstructorGenerationForDifferentNamedParameter() As Task
Await TestInRegularAndScriptAsync(
<Text>Class Program
Sub Main(args As String())
Dim a = New Program([|y:=4|])
End Sub
Sub New(x As Integer)
End Sub
End Class</Text>.Value.Replace(vbLf, vbCrLf),
<Text>Class Program
Private y As Integer
Sub Main(args As String())
Dim a = New Program(y:=4)
End Sub
Sub New(x As Integer)
End Sub
Public Sub New(y As Integer)
Me.y = y
End Sub
End Class</Text>.Value.Replace(vbLf, vbCrLf))
End Function
<WorkItem(897355, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/897355")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestOptionStrictOn() As Task
Await TestInRegularAndScriptAsync(
"Option Strict On
Module Module1
Sub Main()
Dim int As Integer = 3
Dim obj As Object = New Object()
Dim c1 As Classic = New Classic(int)
Dim c2 As Classic = [|New Classic(obj)|]
End Sub
Class Classic
Private int As Integer
Public Sub New(int As Integer)
Me.int = int
End Sub
End Class
End Module",
"Option Strict On
Module Module1
Sub Main()
Dim int As Integer = 3
Dim obj As Object = New Object()
Dim c1 As Classic = New Classic(int)
Dim c2 As Classic = New Classic(obj)
End Sub
Class Classic
Private int As Integer
Private obj As Object
Public Sub New(int As Integer)
Me.int = int
End Sub
Public Sub New(obj As Object)
Me.obj = obj
End Sub
End Class
End Module")
End Function
<WorkItem(528257, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528257")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateInInaccessibleType() As Task
Await TestInRegularAndScriptAsync(
"Class Goo
Private Class Bar
End Class
End Class
Class A
Sub Main()
Dim s = New [|Goo.Bar(5)|]
End Sub
End Class",
"Class Goo
Private Class Bar
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
End Class
End Class
Class A
Sub Main()
Dim s = New Goo.Bar(5)
End Sub
End Class")
End Function
Public Class GenerateConstructorTestsWithFindMissingIdentifiersAnalyzer
Inherits AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest
Friend Overrides Function CreateDiagnosticProviderAndFixer(workspace As Workspace) As (DiagnosticAnalyzer, CodeFixProvider)
Return (New VisualBasicUnboundIdentifiersDiagnosticAnalyzer(),
New GenerateConstructorCodeFixProvider())
End Function
<WorkItem(1241, "https://github.com/dotnet/roslyn/issues/1241")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateConstructorInIncompleteLambda() As Task
Await TestInRegularAndScriptAsync(
"Imports System.Linq
Class C
Sub New()
Dim s As Action = Sub()
Dim a = New [|C|](0)",
"Imports System.Linq
Class C
Private v As Integer
Sub New()
Dim s As Action = Sub()
Dim a = New C(0)Public Sub New(v As Integer)
Me.v = v
End Sub
End Class
")
End Function
<WorkItem(5920, "https://github.com/dotnet/roslyn/issues/5920")>
<Fact(), Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateConstructorInIncompleteLambda2() As Task
Await TestInRegularAndScriptAsync(
"Imports System.Linq
Class C
Private v As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
Sub New()
Dim s As Action = Sub()
Dim a = New [|C|](0, 0)",
"Imports System.Linq
Class C
Private v As Integer
Private v1 As Integer
Public Sub New(v As Integer)
Me.v = v
End Sub
Sub New()
Dim s As Action = Sub()
Dim a = New C(0, 0)Public Sub New(v As Integer, v1 As Integer)
Me.New(v)
Me.v1 = v1
End Sub
End Class
")
End Function
End Class
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestGenerateConstructorNotOfferedForDuplicate() As Task
Await TestMissingInRegularAndScriptAsync(
"Imports System
Class X
Private v As String
Public Sub New(v As String)
Me.v = v
End Sub
Sub Test()
Dim x As X = New X(New [|String|]())
End Sub
End Class")
End Function
<WorkItem(9575, "https://github.com/dotnet/roslyn/issues/9575")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestMissingOnMethodCall() As Task
Await TestMissingInRegularAndScriptAsync(
"class C
public sub new(int arg)
end sub
public function M(s as string, i as integer, b as boolean) as boolean
return [|M|](i, b)
end function
end class")
End Function
<WorkItem(13749, "https://github.com/dotnet/roslyn/issues/13749")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function Support_Readonly_Properties() As Task
Await TestInRegularAndScriptAsync(
"Class C
ReadOnly Property Prop As Integer
End Class
Module P
Sub M()
Dim prop = 42
Dim c = New C([|prop|])
End Sub
End Module",
"Class C
Public Sub New(prop As Integer)
Me.Prop = prop
End Sub
ReadOnly Property Prop As Integer
End Class
Module P
Sub M()
Dim prop = 42
Dim c = New C(prop)
End Sub
End Module")
End Function
<WorkItem(21692, "https://github.com/dotnet/roslyn/issues/21692")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestDelegateConstructor1() As Task
Await TestInRegularAndScriptAsync(
"Public Class B
Public Sub New(a As Integer)
[|Me.New(a, 1)|]
End Sub
End Class",
"Public Class B
Private a As Integer
Private v As Integer
Public Sub New(a As Integer)
Me.New(a, 1)
End Sub
Public Sub New(a As Integer, v As Integer)
Me.a = a
Me.v = v
End Sub
End Class")
End Function
<WorkItem(21692, "https://github.com/dotnet/roslyn/issues/21692")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestDelegateConstructor2() As Task
Await TestInRegularAndScriptAsync(
"Public Class B
Public Sub New(x As Integer)
Me.New(x, 0, 0)
End Sub
Public Sub New(x As Integer, y As Integer, z As Integer)
[|Me.New(x, y)|]
End Sub
End Class",
"Public Class B
Private x As Integer
Private y As Integer
Public Sub New(x As Integer)
Me.New(x, 0, 0)
End Sub
Public Sub New(x As Integer, y As Integer)
Me.x = x
Me.y = y
End Sub
Public Sub New(x As Integer, y As Integer, z As Integer)
Me.New(x, y)
End Sub
End Class")
End Function
<WorkItem(21692, "https://github.com/dotnet/roslyn/issues/21692")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestDelegateConstructor3() As Task
Await TestInRegularAndScriptAsync(
"Public Class B
Public Sub New(x As Integer)
End Sub
Public Sub New(x As Integer, y As Integer, z As Integer)
[|Me.New(x, y)|]
End Sub
End Class",
"Public Class B
Private y As Integer
Public Sub New(x As Integer)
End Sub
Public Sub New(x As Integer, y As Integer)
Me.New(x)
Me.y = y
End Sub
Public Sub New(x As Integer, y As Integer, z As Integer)
Me.New(x, y)
End Sub
End Class")
End Function
<WorkItem(21692, "https://github.com/dotnet/roslyn/issues/21692")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestDelegateConstructor4() As Task
Await TestInRegularAndScriptAsync(
"Public Class B
Public Sub New(x As Integer)
Me.New(x, 0)
End Sub
Public Sub New(x As Integer, y As Integer)
[|Me.New(x, y, 0)|]
End Sub
End Class",
"Public Class B
Private x As Integer
Private y As Integer
Private v As Integer
Public Sub New(x As Integer)
Me.New(x, 0)
End Sub
Public Sub New(x As Integer, y As Integer)
Me.New(x, y, 0)
End Sub
Public Sub New(x As Integer, y As Integer, v As Integer)
Me.x = x
Me.y = y
Me.v = v
End Sub
End Class")
End Function
<WorkItem(21692, "https://github.com/dotnet/roslyn/issues/21692")>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateConstructor)>
Public Async Function TestDelegateConstructor5() As Task
Await TestInRegularAndScriptAsync(
"Class C
Public Sub New(a As Integer)
End Sub
Public Sub New(a As Integer, b As Integer)
Me.New(True, True)
End Sub
Public Sub New(a As Boolean, b As Boolean)
Me.New(1, 1)
End Sub
Public Sub New(a As Integer, b As Integer, c As Integer, e As Integer)
[|Me.New(a, b, c)|]
End Sub
End Class",
"Class C
Private b As Integer
Private c As Integer
Public Sub New(a As Integer)
End Sub
Public Sub New(a As Integer, b As Integer)
Me.New(True, True)
End Sub
Public Sub New(a As Boolean, b As Boolean)
Me.New(1, 1)
End Sub
Public Sub New(a As Integer, b As Integer, c As Integer)
Me.New(a)
Me.b = b
Me.c = c
End Sub
Public Sub New(a As Integer, b As Integer, c As Integer, e As Integer)
Me.New(a, b, c)
End Sub
End Class")
End Function
End Class
End Namespace
|
mmitche/roslyn
|
src/EditorFeatures/VisualBasicTest/GenerateConstructor/GenerateConstructorTests.vb
|
Visual Basic
|
apache-2.0
| 46,836
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Runtime.CompilerServices
Imports System.Threading
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.ExtractMethod
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.ExtractMethod
Friend Module Extensions
<Extension()>
Public Function GetUnparenthesizedExpression(node As SyntaxNode) As ExpressionSyntax
Dim parenthesizedExpression = TryCast(node, ParenthesizedExpressionSyntax)
If parenthesizedExpression Is Nothing Then
Return DirectCast(node, ExpressionSyntax)
End If
Return GetUnparenthesizedExpression(parenthesizedExpression.Expression)
End Function
<Extension()>
Public Function GetStatementContainer(node As SyntaxNode) As SyntaxNode
Contract.ThrowIfNull(node)
Dim statement = node.GetStatementUnderContainer()
If statement Is Nothing Then
Return Nothing
End If
Return statement.Parent
End Function
<Extension()>
Public Function GetStatementUnderContainer(node As SyntaxNode) As ExecutableStatementSyntax
Contract.ThrowIfNull(node)
Do While node IsNot Nothing
If node.Parent.IsStatementContainerNode() AndAlso
TypeOf node Is ExecutableStatementSyntax AndAlso
node.Parent.ContainStatement(DirectCast(node, ExecutableStatementSyntax)) Then
Return TryCast(node, ExecutableStatementSyntax)
End If
node = node.Parent
Loop
Return Nothing
End Function
<Extension()>
Public Function ContainStatement(node As SyntaxNode, statement As StatementSyntax) As Boolean
Contract.ThrowIfNull(node)
Contract.ThrowIfNull(statement)
If Not node.IsStatementContainerNode() Then
Return False
End If
Return node.GetStatements().IndexOf(statement) >= 0
End Function
<Extension()>
Public Function GetOutermostNodeWithSameSpan(initialNode As SyntaxNode, predicate As Func(Of SyntaxNode, Boolean)) As SyntaxNode
If initialNode Is Nothing Then
Return Nothing
End If
' now try to find outmost node that has same span
Dim firstContainingSpan = initialNode.Span
Dim node = initialNode
Dim lastNode = Nothing
Do
If predicate(node) Then
lastNode = node
End If
node = node.Parent
Loop While node IsNot Nothing AndAlso node.Span.Equals(firstContainingSpan)
Return CType(If(lastNode, initialNode), SyntaxNode)
End Function
<Extension()>
Public Function PartOfConstantInitializerExpression(node As SyntaxNode) As Boolean
Return node.PartOfConstantInitializerExpression(Of FieldDeclarationSyntax)(Function(n) n.Modifiers) OrElse
node.PartOfConstantInitializerExpression(Of LocalDeclarationStatementSyntax)(Function(n) n.Modifiers)
End Function
<Extension()>
Private Function PartOfConstantInitializerExpression(Of T As SyntaxNode)(node As SyntaxNode, modifiersGetter As Func(Of T, SyntaxTokenList)) As Boolean
Dim decl = node.GetAncestor(Of T)()
If decl Is Nothing Then
Return False
End If
If Not modifiersGetter(decl).Any(Function(m) m.Kind = SyntaxKind.ConstKeyword) Then
Return False
End If
' we are under decl with const modifier, check we are part of initializer expression
Dim equal = node.GetAncestor(Of EqualsValueSyntax)()
If equal Is Nothing Then
Return False
End If
Return equal.Value IsNot Nothing AndAlso equal.Value.Span.Contains(node.Span)
End Function
<Extension()>
Public Function IsArgumentForByRefParameter(node As SyntaxNode, model As SemanticModel, cancellationToken As CancellationToken) As Boolean
Dim argument = node.FirstAncestorOrSelf(Of ArgumentSyntax)()
' make sure we are the argument
If argument Is Nothing OrElse node.Span <> argument.Span Then
Return False
End If
' now find invocation node
Dim invocation = argument.FirstAncestorOrSelf(Of InvocationExpressionSyntax)()
' argument for something we are not interested in
If invocation Is Nothing Then
Return False
End If
' find argument index
Dim argumentIndex = invocation.ArgumentList.Arguments.IndexOf(argument)
If argumentIndex < 0 Then
Return False
End If
' get all method symbols
Dim methodSymbols = model.GetSymbolInfo(invocation, cancellationToken).GetAllSymbols().Where(Function(s) s.Kind = SymbolKind.Method).Cast(Of IMethodSymbol)()
For Each method In methodSymbols
' not a right method
If method.Parameters.Length <= argumentIndex Then
Continue For
End If
' make sure there is no ref type
Dim parameter = method.Parameters(argumentIndex)
If parameter.RefKind <> RefKind.None Then
Return True
End If
Next
Return False
End Function
<Extension()>
Public Function ContainArgumentlessThrowWithoutEnclosingCatch(ByVal tokens As IEnumerable(Of SyntaxToken), ByVal textSpan As TextSpan) As Boolean
For Each token In tokens
If token.Kind <> SyntaxKind.ThrowKeyword Then
Continue For
End If
Dim throwStatement = TryCast(token.Parent, ThrowStatementSyntax)
If throwStatement Is Nothing OrElse throwStatement.Expression IsNot Nothing Then
Continue For
End If
Dim catchBlock = token.GetAncestor(Of CatchBlockSyntax)()
If catchBlock Is Nothing OrElse Not textSpan.Contains(catchBlock.Span) Then
Return True
End If
Next token
Return False
End Function
<Extension()>
Public Function ContainPreprocessorCrossOver(ByVal tokens As IEnumerable(Of SyntaxToken), ByVal textSpan As TextSpan) As Boolean
Dim activeRegions As Integer = 0
Dim activeIfs As Integer = 0
For Each trivia In tokens.GetAllTrivia()
If Not trivia.IsDirective Then
Continue For
End If
Dim directive = DirectCast(trivia.GetStructure(), DirectiveTriviaSyntax)
If Not textSpan.Contains(directive.Span) Then
Continue For
End If
Select Case directive.Kind
Case SyntaxKind.RegionDirectiveTrivia
activeRegions += 1
Case SyntaxKind.EndRegionDirectiveTrivia
If activeRegions <= 0 Then Return True
activeRegions -= 1
Case SyntaxKind.IfDirectiveTrivia
activeIfs += 1
Case SyntaxKind.EndIfDirectiveTrivia
If activeIfs <= 0 Then Return True
activeIfs -= 1
Case SyntaxKind.ElseDirectiveTrivia, SyntaxKind.ElseIfDirectiveTrivia
If activeIfs <= 0 Then Return True
End Select
Next trivia
Return activeIfs <> 0 OrElse activeRegions <> 0
End Function
<Extension()>
Public Function GetAllTrivia(ByVal tokens As IEnumerable(Of SyntaxToken)) As IEnumerable(Of SyntaxTrivia)
Dim list = New List(Of SyntaxTrivia)()
For Each token In tokens
list.AddRange(token.LeadingTrivia)
list.AddRange(token.TrailingTrivia)
Next token
Return list
End Function
<Extension()>
Public Function ContainsFieldInitializer(node As SyntaxNode) As Boolean
node = node.GetOutermostNodeWithSameSpan(Function(n) True)
Return node.DescendantNodesAndSelf().Any(Function(n) TypeOf n Is FieldInitializerSyntax)
End Function
<Extension()>
Public Function ContainsDotMemberAccess(node As SyntaxNode) As Boolean
Dim predicate = Function(n As SyntaxNode)
Dim member = TryCast(n, MemberAccessExpressionSyntax)
If member Is Nothing Then
Return False
End If
Return member.Expression Is Nothing AndAlso member.OperatorToken.Kind = SyntaxKind.DotToken
End Function
Return node.DescendantNodesAndSelf().Any(predicate)
End Function
<Extension()>
Public Function UnderWithBlockContext(token As SyntaxToken) As Boolean
Dim withBlock = token.GetAncestor(Of WithBlockSyntax)()
If withBlock Is Nothing Then
Return False
End If
Dim withBlockSpan = TextSpan.FromBounds(withBlock.WithStatement.Span.End, withBlock.EndWithStatement.SpanStart)
Return withBlockSpan.Contains(token.Span)
End Function
<Extension()>
Public Function UnderObjectMemberInitializerContext(token As SyntaxToken) As Boolean
Dim initializer = token.GetAncestor(Of ObjectMemberInitializerSyntax)()
If initializer Is Nothing Then
Return False
End If
Dim initializerSpan = TextSpan.FromBounds(initializer.WithKeyword.Span.End, initializer.Span.End)
Return initializerSpan.Contains(token.Span)
End Function
<Extension()>
Public Function UnderValidContext(token As SyntaxToken) As Boolean
Dim predicate As Func(Of SyntaxNode, Boolean) =
Function(n)
Dim range = TryCast(n, RangeArgumentSyntax)
If range IsNot Nothing Then
If range.UpperBound.Span.Contains(token.Span) AndAlso
range.GetAncestor(Of FieldDeclarationSyntax)() IsNot Nothing Then
Return True
End If
End If
Dim [property] = TryCast(n, PropertyStatementSyntax)
If [property] IsNot Nothing Then
Dim asNewClause = TryCast([property].AsClause, AsNewClauseSyntax)
If asNewClause IsNot Nothing AndAlso asNewClause.NewExpression IsNot Nothing Then
Dim span = TextSpan.FromBounds(asNewClause.NewExpression.NewKeyword.Span.End, asNewClause.NewExpression.Span.End)
Return span.Contains(token.Span)
End If
End If
If n.CheckTopLevel(token.Span) Then
Return True
End If
Return False
End Function
Return token.GetAncestors(Of SyntaxNode)().Any(predicate)
End Function
<Extension()>
Public Function ContainsInMethodBlockBody(block As MethodBlockBaseSyntax, textSpan As TextSpan) As Boolean
If block Is Nothing Then
Return False
End If
Dim blockSpan = TextSpan.FromBounds(block.BlockStatement.Span.End, block.EndBlockStatement.SpanStart)
Return blockSpan.Contains(textSpan)
End Function
<Extension()> _
Public Function UnderValidContext(ByVal node As SyntaxNode) As Boolean
Contract.ThrowIfNull(node)
Dim predicate As Func(Of SyntaxNode, Boolean) =
Function(n)
If TypeOf n Is MethodBlockBaseSyntax OrElse
TypeOf n Is MultiLineLambdaExpressionSyntax OrElse
TypeOf n Is SingleLineLambdaExpressionSyntax Then
Return True
End If
Return False
End Function
If Not node.GetAncestorsOrThis(Of SyntaxNode)().Any(predicate) Then
Return False
End If
If node.FromScript() OrElse node.GetAncestor(Of TypeBlockSyntax)() IsNot Nothing Then
Return True
End If
Return False
End Function
<Extension()>
Public Function IsReturnableConstruct(node As SyntaxNode) As Boolean
Return TypeOf node Is MethodBlockBaseSyntax OrElse
TypeOf node Is SingleLineLambdaExpressionSyntax OrElse
TypeOf node Is MultiLineLambdaExpressionSyntax
End Function
<Extension()>
Public Function HasSyntaxAnnotation([set] As HashSet(Of SyntaxAnnotation), node As SyntaxNode) As Boolean
Return [set].Any(Function(a) node.GetAnnotatedNodesAndTokens(a).Any())
End Function
<Extension()>
Public Function IsFunctionValue(symbol As ISymbol) As Boolean
Dim local = TryCast(symbol, ILocalSymbol)
Return local IsNot Nothing AndAlso local.IsFunctionValue
End Function
<Extension()>
Public Function ToSeparatedList(Of T As SyntaxNode)(nodes As IEnumerable(Of Tuple(Of T, SyntaxToken))) As SeparatedSyntaxList(Of T)
Dim list = New List(Of SyntaxNodeOrToken)
For Each tuple In nodes
Contract.ThrowIfNull(tuple.Item1)
list.Add(tuple.Item1)
If tuple.Item2.Kind = SyntaxKind.None Then
Exit For
End If
list.Add(tuple.Item2)
Next
Return SyntaxFactory.SeparatedList(Of T)(list)
End Function
<Extension()>
Public Function CreateAssignmentExpressionStatementWithValue(identifier As SyntaxToken, rvalue As ExpressionSyntax) As StatementSyntax
Return SyntaxFactory.SimpleAssignmentStatement(SyntaxFactory.IdentifierName(identifier), SyntaxFactory.Token(SyntaxKind.EqualsToken), rvalue).WithAppendedTrailingTrivia(SyntaxFactory.ElasticMarker)
End Function
<Extension()>
Public Function ProcessLocalDeclarationStatement(variableToRemoveMap As HashSet(Of SyntaxAnnotation),
declarationStatement As LocalDeclarationStatementSyntax,
expressionStatements As List(Of StatementSyntax),
variableDeclarators As List(Of VariableDeclaratorSyntax),
triviaList As List(Of SyntaxTrivia)) As Boolean
' go through each var decls in decl statement, and create new assignment if
' variable is initialized at decl.
Dim hasChange As Boolean = False
Dim leadingTriviaApplied As Boolean = False
For Each variableDeclarator In declarationStatement.Declarators
Dim identifierList = New List(Of ModifiedIdentifierSyntax)()
Dim nameCount = variableDeclarator.Names.Count
For i = 0 To nameCount - 1 Step 1
Dim variable = variableDeclarator.Names(i)
If variableToRemoveMap.HasSyntaxAnnotation(variable) Then
If variableDeclarator.Initializer IsNot Nothing AndAlso i = nameCount - 1 Then
' move comments with the variable here
Dim identifier As SyntaxToken = variable.Identifier
' The leading trivia from the declaration is applied to the first variable
' There is not much value in appending the trailing trivia of the modifier
If i = 0 AndAlso Not leadingTriviaApplied AndAlso declarationStatement.HasLeadingTrivia Then
identifier = identifier.WithLeadingTrivia(declarationStatement.GetLeadingTrivia.AddRange(identifier.LeadingTrivia))
leadingTriviaApplied = True
End If
expressionStatements.Add(identifier.CreateAssignmentExpressionStatementWithValue(variableDeclarator.Initializer.Value))
Continue For
End If
' we don't remove trivia around tokens we remove
triviaList.AddRange(variable.GetLeadingTrivia())
triviaList.AddRange(variable.GetTrailingTrivia())
Continue For
End If
If triviaList.Count > 0 Then
identifierList.Add(variable.WithPrependedLeadingTrivia(triviaList))
triviaList.Clear()
Continue For
End If
identifierList.Add(variable)
Next
If identifierList.Count = 0 Then
' attach left over trivia to last expression statement
If triviaList.Count > 0 AndAlso expressionStatements.Count > 0 Then
Dim lastStatement = expressionStatements(expressionStatements.Count - 1)
lastStatement = lastStatement.WithPrependedLeadingTrivia(triviaList)
expressionStatements(expressionStatements.Count - 1) = lastStatement
triviaList.Clear()
End If
Continue For
ElseIf identifierList.Count = variableDeclarator.Names.Count Then
variableDeclarators.Add(variableDeclarator)
ElseIf identifierList.Count > 0 Then
variableDeclarators.Add(
variableDeclarator.WithNames(SyntaxFactory.SeparatedList(identifierList)).
WithPrependedLeadingTrivia(triviaList))
hasChange = True
End If
Next variableDeclarator
Return hasChange OrElse declarationStatement.Declarators.Count <> variableDeclarators.Count
End Function
<Extension()>
Public Function IsExpressionInCast(node As SyntaxNode) As Boolean
Return TypeOf node Is ExpressionSyntax AndAlso TypeOf node.Parent Is CastExpressionSyntax
End Function
<Extension()>
Public Function IsErrorType(type As ITypeSymbol) As Boolean
Return type Is Nothing OrElse type.Kind = SymbolKind.ErrorType
End Function
<Extension()>
Public Function IsObjectType(type As ITypeSymbol) As Boolean
Return type Is Nothing OrElse type.SpecialType = SpecialType.System_Object
End Function
End Module
End Namespace
|
mmitche/roslyn
|
src/Features/VisualBasic/Portable/ExtractMethod/Extensions.vb
|
Visual Basic
|
apache-2.0
| 19,743
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Threading
Imports Microsoft.CodeAnalysis.Completion.Providers
Imports Microsoft.CodeAnalysis.VisualBasic.Extensions.ContextQuery
Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.KeywordRecommenders.Expressions
Friend Class AwaitKeywordRecommender
Inherits AbstractKeywordRecommender
Protected Overrides Function RecommendKeywords(context As VisualBasicSyntaxContext, cancellationToken As CancellationToken) As IEnumerable(Of RecommendedKeyword)
If context.IsAnyExpressionContext OrElse context.IsSingleLineStatementContext Then
For Each node In context.TargetToken.GetAncestors(Of SyntaxNode)()
If node.IsKind(SyntaxKind.SingleLineSubLambdaExpression, SyntaxKind.SingleLineFunctionLambdaExpression,
SyntaxKind.MultiLineSubLambdaExpression, SyntaxKind.MultiLineFunctionLambdaExpression) Then
Return SpecializedCollections.SingletonEnumerable(New RecommendedKeyword("Await", VBFeaturesResources.AwaitKeywordToolTip))
End If
If node.IsKind(SyntaxKind.FinallyBlock, SyntaxKind.SyncLockBlock, SyntaxKind.CatchBlock) Then
Return SpecializedCollections.EmptyEnumerable(Of RecommendedKeyword)()
End If
Next
Return SpecializedCollections.SingletonEnumerable(New RecommendedKeyword("Await", VBFeaturesResources.AwaitKeywordToolTip))
End If
Return SpecializedCollections.EmptyEnumerable(Of RecommendedKeyword)()
End Function
End Class
End Namespace
|
KevinRansom/roslyn
|
src/Features/VisualBasic/Portable/Completion/KeywordRecommenders/Expressions/AwaitKeywordRecommender.vb
|
Visual Basic
|
apache-2.0
| 1,811
|
Imports System.Data
Partial Class rLista_dFiadores
Inherits vis2formularios.frmReporte
Dim loObjetoReporte As CrystalDecisions.CrystalReports.Engine.ReportDocument
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim lcParametro0Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(0))
Dim lcParametro0Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(0))
Dim lcParametro1Desde As String = goServicios.mObtenerListaFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(1))
Dim lcParametro2Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(2))
Dim lcParametro2Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(2))
Dim lcParametro3Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(3))
Dim lcParametro3Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(3))
Dim lcParametro4Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(4))
Dim lcParametro4Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(4))
Dim lcParametro5Desde As String = goServicios.mObtenerListaFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(5))
Dim lcOrdenamiento As String = cusAplicacion.goReportes.pcOrden
Dim loComandoSeleccionar As New StringBuilder()
loComandoSeleccionar.AppendLine("SELECT fiadores.origen, ")
loComandoSeleccionar.AppendLine(" fiadores.cod_reg, ")
loComandoSeleccionar.AppendLine(" fiadores.ced_fia, ")
loComandoSeleccionar.AppendLine(" fiadores.nom_fia, ")
loComandoSeleccionar.AppendLine(" fiadores.clase, ")
loComandoSeleccionar.AppendLine(" fiadores.tipo, ")
loComandoSeleccionar.AppendLine(" fiadores.status, ")
loComandoSeleccionar.AppendLine(" clientes.nom_cli ")
loComandoSeleccionar.AppendLine(" FROM fiadores, ")
loComandoSeleccionar.AppendLine(" clientes ")
loComandoSeleccionar.AppendLine(" WHERE fiadores.cod_reg = clientes.cod_cli ")
loComandoSeleccionar.AppendLine(" AND fiadores.origen IN (" & lcParametro1Desde & ")")
loComandoSeleccionar.AppendLine(" AND fiadores.cod_reg between " & lcParametro0Desde)
loComandoSeleccionar.AppendLine(" AND " & lcParametro0Hasta)
loComandoSeleccionar.AppendLine(" AND fiadores.nom_fia between " & lcParametro2Desde)
loComandoSeleccionar.AppendLine(" AND " & lcParametro2Hasta)
loComandoSeleccionar.AppendLine(" AND fiadores.clase between " & lcParametro3Desde)
loComandoSeleccionar.AppendLine(" AND " & lcParametro3Hasta)
loComandoSeleccionar.AppendLine(" AND fiadores.tipo between " & lcParametro4Desde)
loComandoSeleccionar.AppendLine(" AND " & lcParametro4Hasta)
loComandoSeleccionar.AppendLine(" AND fiadores.status IN (" & lcParametro5Desde & ")")
loComandoSeleccionar.AppendLine(" ORDER BY fiadores." & lcOrdenamiento)
Dim loServicios As New cusDatos.goDatos
Dim laDatosReporte As DataSet = loServicios.mObtenerTodosSinEsquema(loComandoSeleccionar.ToString, "curReportes")
'-------------------------------------------------------------------------------------------------------
' Verificando si el select (tabla nº0) trae registros
'-------------------------------------------------------------------------------------------------------
If (laDatosReporte.Tables(0).Rows.Count <= 0) Then
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Información", _
"No se Encontraron Registros para los Parámetros Especificados. ", _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Informacion, _
"350px", _
"200px")
End If
loObjetoReporte = cusAplicacion.goReportes.mCargarReporte("rLista_dFiadores", laDatosReporte)
Me.mTraducirReporte(loObjetoReporte)
Me.mFormatearCamposReporte(loObjetoReporte)
Me.crvrLista_dFiadores.ReportSource = loObjetoReporte
Catch loExcepcion As Exception
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Error", _
"No se pudo Completar el Proceso: " & loExcepcion.Message, _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Error, _
"auto", _
"auto")
End Try
End Sub
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
Try
loObjetoReporte.Close()
Catch loExcepcion As Exception
End Try
End Sub
End Class
'-------------------------------------------------------------------------------------------'
' Fin del codigo
'-------------------------------------------------------------------------------------------'
' YJP: 23/04/09: Codigo inicial
'-------------------------------------------------------------------------------------------'
' JJD: 15/08/09: Se incluyo el orden de los registros
'-------------------------------------------------------------------------------------------'
' CMS: 28/05/10: Validacion de registro cero
'-------------------------------------------------------------------------------------------'
|
kodeitsolutions/ef-reports
|
rLista_dFiadores.aspx.vb
|
Visual Basic
|
mit
| 6,019
|
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("WindowsKiller")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("WindowsKiller")>
<Assembly: AssemblyCopyright("Copyright © 2015")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("9a0d9e10-a5ac-4935-8531-5069d7bb8b9f")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
pepm99/WIndowsKillerProject
|
WindowsKiller/WindowsKiller/My Project/AssemblyInfo.vb
|
Visual Basic
|
mit
| 1,144
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.34209
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Imports System
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("ServerManager.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set
resourceCulture = value
End Set
End Property
End Module
End Namespace
|
evandixon/Server-Manager
|
ServerManager/My Project/Resources.Designer.vb
|
Visual Basic
|
mit
| 2,719
|
'
' Created by SharpDevelop.
' User: John
' Date: 03/02/2013
' Time: 16:03
'
' To change this template use Tools | Options | Coding | Edit Standard Headers.
'
Partial Class Form1
Inherits System.Windows.Forms.Form
''' <summary>
''' Designer variable used to keep track of non-visual components.
''' </summary>
Private components As System.ComponentModel.IContainer
''' <summary>
''' Disposes resources used by the form.
''' </summary>
''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If components IsNot Nothing Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
''' <summary>
''' This method is required for Windows Forms designer support.
''' Do not change the method contents inside the source code editor. The Forms designer might
''' not be able to load this method if it was changed manually.
''' </summary>
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1))
Me.button1 = New System.Windows.Forms.Button()
Me.textBox1 = New System.Windows.Forms.TextBox()
Me.label1 = New System.Windows.Forms.Label()
Me.progressBar1 = New System.Windows.Forms.ProgressBar()
Me.openFileDialog1 = New System.Windows.Forms.OpenFileDialog()
Me.button2 = New System.Windows.Forms.Button()
Me.button3 = New System.Windows.Forms.Button()
Me.button4 = New System.Windows.Forms.Button()
Me.tabControl1 = New System.Windows.Forms.TabControl()
Me.tabPage1 = New System.Windows.Forms.TabPage()
Me.Button14 = New System.Windows.Forms.Button()
Me.Panel1 = New System.Windows.Forms.Panel()
Me.TextBox5 = New System.Windows.Forms.TextBox()
Me.progressBar2 = New System.Windows.Forms.ProgressBar()
Me.label4 = New System.Windows.Forms.Label()
Me.button8 = New System.Windows.Forms.Button()
Me.button7 = New System.Windows.Forms.Button()
Me.button6 = New System.Windows.Forms.Button()
Me.button5 = New System.Windows.Forms.Button()
Me.label3 = New System.Windows.Forms.Label()
Me.label2 = New System.Windows.Forms.Label()
Me.pictureBox1 = New System.Windows.Forms.PictureBox()
Me.tabPage2 = New System.Windows.Forms.TabPage()
Me.Button15 = New System.Windows.Forms.Button()
Me.Panel2 = New System.Windows.Forms.Panel()
Me.TextBox8 = New System.Windows.Forms.TextBox()
Me.TextBox6 = New System.Windows.Forms.TextBox()
Me.TextBox7 = New System.Windows.Forms.TextBox()
Me.PictureBox5 = New System.Windows.Forms.PictureBox()
Me.PictureBox4 = New System.Windows.Forms.PictureBox()
Me.label6 = New System.Windows.Forms.Label()
Me.numericUpDown1 = New System.Windows.Forms.NumericUpDown()
Me.label5 = New System.Windows.Forms.Label()
Me.tabPage3 = New System.Windows.Forms.TabPage()
Me.Button16 = New System.Windows.Forms.Button()
Me.Panel3 = New System.Windows.Forms.Panel()
Me.TextBox11 = New System.Windows.Forms.TextBox()
Me.TextBox10 = New System.Windows.Forms.TextBox()
Me.PictureBox7 = New System.Windows.Forms.PictureBox()
Me.TextBox9 = New System.Windows.Forms.TextBox()
Me.pictureBox3 = New System.Windows.Forms.PictureBox()
Me.pictureBox2 = New System.Windows.Forms.PictureBox()
Me.radioButton2 = New System.Windows.Forms.RadioButton()
Me.radioButton1 = New System.Windows.Forms.RadioButton()
Me.numericUpDown2 = New System.Windows.Forms.NumericUpDown()
Me.label9 = New System.Windows.Forms.Label()
Me.textBox3 = New System.Windows.Forms.TextBox()
Me.textBox2 = New System.Windows.Forms.TextBox()
Me.label8 = New System.Windows.Forms.Label()
Me.label7 = New System.Windows.Forms.Label()
Me.tabPage4 = New System.Windows.Forms.TabPage()
Me.Button17 = New System.Windows.Forms.Button()
Me.Panel4 = New System.Windows.Forms.Panel()
Me.TextBox13 = New System.Windows.Forms.TextBox()
Me.PictureBox6 = New System.Windows.Forms.PictureBox()
Me.PictureBox8 = New System.Windows.Forms.PictureBox()
Me.TextBox12 = New System.Windows.Forms.TextBox()
Me.label10 = New System.Windows.Forms.Label()
Me.button9 = New System.Windows.Forms.Button()
Me.textBox4 = New System.Windows.Forms.TextBox()
Me.tabPage5 = New System.Windows.Forms.TabPage()
Me.Button18 = New System.Windows.Forms.Button()
Me.Panel5 = New System.Windows.Forms.Panel()
Me.TextBox14 = New System.Windows.Forms.TextBox()
Me.checkBox3 = New System.Windows.Forms.CheckBox()
Me.numericUpDown3 = New System.Windows.Forms.NumericUpDown()
Me.button13 = New System.Windows.Forms.Button()
Me.button12 = New System.Windows.Forms.Button()
Me.listBox2 = New System.Windows.Forms.ListBox()
Me.checkBox2 = New System.Windows.Forms.CheckBox()
Me.checkBox1 = New System.Windows.Forms.CheckBox()
Me.tabPage6 = New System.Windows.Forms.TabPage()
Me.Button19 = New System.Windows.Forms.Button()
Me.Panel6 = New System.Windows.Forms.Panel()
Me.TextBox17 = New System.Windows.Forms.TextBox()
Me.PictureBox9 = New System.Windows.Forms.PictureBox()
Me.TextBox16 = New System.Windows.Forms.TextBox()
Me.TextBox15 = New System.Windows.Forms.TextBox()
Me.label12 = New System.Windows.Forms.Label()
Me.button11 = New System.Windows.Forms.Button()
Me.button10 = New System.Windows.Forms.Button()
Me.listBox1 = New System.Windows.Forms.ListBox()
Me.colorDialog1 = New System.Windows.Forms.ColorDialog()
Me.tabControl1.SuspendLayout()
Me.tabPage1.SuspendLayout()
Me.Panel1.SuspendLayout()
CType(Me.pictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.tabPage2.SuspendLayout()
Me.Panel2.SuspendLayout()
CType(Me.PictureBox5, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PictureBox4, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.numericUpDown1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.tabPage3.SuspendLayout()
Me.Panel3.SuspendLayout()
CType(Me.PictureBox7, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.pictureBox3, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.pictureBox2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.numericUpDown2, System.ComponentModel.ISupportInitialize).BeginInit()
Me.tabPage4.SuspendLayout()
Me.Panel4.SuspendLayout()
CType(Me.PictureBox6, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PictureBox8, System.ComponentModel.ISupportInitialize).BeginInit()
Me.tabPage5.SuspendLayout()
Me.Panel5.SuspendLayout()
CType(Me.numericUpDown3, System.ComponentModel.ISupportInitialize).BeginInit()
Me.tabPage6.SuspendLayout()
Me.Panel6.SuspendLayout()
CType(Me.PictureBox9, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'button1
'
Me.button1.Location = New System.Drawing.Point(341, 63)
Me.button1.Name = "button1"
Me.button1.Size = New System.Drawing.Size(75, 30)
Me.button1.TabIndex = 0
Me.button1.Text = "Run"
Me.button1.UseVisualStyleBackColor = True
'
'textBox1
'
Me.textBox1.Location = New System.Drawing.Point(12, 37)
Me.textBox1.Name = "textBox1"
Me.textBox1.Size = New System.Drawing.Size(404, 20)
Me.textBox1.TabIndex = 1
'
'label1
'
Me.label1.Location = New System.Drawing.Point(12, 13)
Me.label1.Name = "label1"
Me.label1.Size = New System.Drawing.Size(100, 21)
Me.label1.TabIndex = 2
Me.label1.Text = "Select Input ASCII File"
'
'progressBar1
'
Me.progressBar1.Location = New System.Drawing.Point(12, 63)
Me.progressBar1.Name = "progressBar1"
Me.progressBar1.Size = New System.Drawing.Size(323, 30)
Me.progressBar1.TabIndex = 3
'
'openFileDialog1
'
Me.openFileDialog1.FileName = "openFileDialog1"
'
'button2
'
Me.button2.Location = New System.Drawing.Point(422, 37)
Me.button2.Name = "button2"
Me.button2.Size = New System.Drawing.Size(30, 23)
Me.button2.TabIndex = 4
Me.button2.Text = "..."
Me.button2.UseVisualStyleBackColor = True
'
'button3
'
Me.button3.Location = New System.Drawing.Point(118, 8)
Me.button3.Name = "button3"
Me.button3.Size = New System.Drawing.Size(49, 23)
Me.button3.TabIndex = 5
Me.button3.Text = "Help"
Me.button3.UseVisualStyleBackColor = True
'
'button4
'
Me.button4.BackgroundImage = CType(resources.GetObject("button4.BackgroundImage"), System.Drawing.Image)
Me.button4.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
Me.button4.Location = New System.Drawing.Point(422, 63)
Me.button4.Name = "button4"
Me.button4.Size = New System.Drawing.Size(30, 30)
Me.button4.TabIndex = 6
Me.button4.UseVisualStyleBackColor = True
'
'tabControl1
'
Me.tabControl1.Controls.Add(Me.tabPage1)
Me.tabControl1.Controls.Add(Me.tabPage2)
Me.tabControl1.Controls.Add(Me.tabPage3)
Me.tabControl1.Controls.Add(Me.tabPage4)
Me.tabControl1.Controls.Add(Me.tabPage5)
Me.tabControl1.Controls.Add(Me.tabPage6)
Me.tabControl1.Location = New System.Drawing.Point(12, 113)
Me.tabControl1.Name = "tabControl1"
Me.tabControl1.SelectedIndex = 0
Me.tabControl1.Size = New System.Drawing.Size(440, 145)
Me.tabControl1.TabIndex = 0
'
'tabPage1
'
Me.tabPage1.Controls.Add(Me.Button14)
Me.tabPage1.Controls.Add(Me.Panel1)
Me.tabPage1.Controls.Add(Me.progressBar2)
Me.tabPage1.Controls.Add(Me.label4)
Me.tabPage1.Controls.Add(Me.button8)
Me.tabPage1.Controls.Add(Me.button7)
Me.tabPage1.Controls.Add(Me.button6)
Me.tabPage1.Controls.Add(Me.button5)
Me.tabPage1.Controls.Add(Me.label3)
Me.tabPage1.Controls.Add(Me.label2)
Me.tabPage1.Controls.Add(Me.pictureBox1)
Me.tabPage1.Location = New System.Drawing.Point(4, 22)
Me.tabPage1.Name = "tabPage1"
Me.tabPage1.Padding = New System.Windows.Forms.Padding(3)
Me.tabPage1.Size = New System.Drawing.Size(432, 119)
Me.tabPage1.TabIndex = 0
Me.tabPage1.Text = "Colours"
Me.tabPage1.UseVisualStyleBackColor = True
'
'Button14
'
Me.Button14.Location = New System.Drawing.Point(180, 86)
Me.Button14.Name = "Button14"
Me.Button14.Size = New System.Drawing.Size(65, 23)
Me.Button14.TabIndex = 10
Me.Button14.Text = "Show info"
Me.Button14.UseVisualStyleBackColor = True
'
'Panel1
'
Me.Panel1.Controls.Add(Me.TextBox5)
Me.Panel1.Location = New System.Drawing.Point(7, 119)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(417, 386)
Me.Panel1.TabIndex = 9
'
'TextBox5
'
Me.TextBox5.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.TextBox5.Location = New System.Drawing.Point(3, 3)
Me.TextBox5.Multiline = True
Me.TextBox5.Name = "TextBox5"
Me.TextBox5.Size = New System.Drawing.Size(411, 154)
Me.TextBox5.TabIndex = 0
Me.TextBox5.Text = resources.GetString("TextBox5.Text")
'
'progressBar2
'
Me.progressBar2.Location = New System.Drawing.Point(7, 86)
Me.progressBar2.Name = "progressBar2"
Me.progressBar2.Size = New System.Drawing.Size(169, 23)
Me.progressBar2.TabIndex = 8
'
'label4
'
Me.label4.Location = New System.Drawing.Point(3, 30)
Me.label4.Name = "label4"
Me.label4.Size = New System.Drawing.Size(51, 23)
Me.label4.TabIndex = 7
Me.label4.Text = "Colour 2"
'
'button8
'
Me.button8.BackColor = System.Drawing.Color.Green
Me.button8.Location = New System.Drawing.Point(76, 27)
Me.button8.Name = "button8"
Me.button8.Size = New System.Drawing.Size(28, 23)
Me.button8.TabIndex = 6
Me.button8.UseVisualStyleBackColor = False
'
'button7
'
Me.button7.Location = New System.Drawing.Point(251, 86)
Me.button7.Name = "button7"
Me.button7.Size = New System.Drawing.Size(63, 23)
Me.button7.TabIndex = 5
Me.button7.Text = "Preview"
Me.button7.UseVisualStyleBackColor = True
'
'button6
'
Me.button6.BackColor = System.Drawing.Color.Blue
Me.button6.Location = New System.Drawing.Point(76, 51)
Me.button6.Name = "button6"
Me.button6.Size = New System.Drawing.Size(28, 23)
Me.button6.TabIndex = 4
Me.button6.UseVisualStyleBackColor = False
'
'button5
'
Me.button5.BackColor = System.Drawing.Color.Red
Me.button5.Location = New System.Drawing.Point(76, 3)
Me.button5.Name = "button5"
Me.button5.Size = New System.Drawing.Size(28, 23)
Me.button5.TabIndex = 3
Me.button5.UseVisualStyleBackColor = False
'
'label3
'
Me.label3.Location = New System.Drawing.Point(4, 56)
Me.label3.Name = "label3"
Me.label3.Size = New System.Drawing.Size(100, 23)
Me.label3.TabIndex = 2
Me.label3.Text = "Colour 3"
'
'label2
'
Me.label2.Location = New System.Drawing.Point(3, 6)
Me.label2.Name = "label2"
Me.label2.Size = New System.Drawing.Size(100, 23)
Me.label2.TabIndex = 1
Me.label2.Text = "Colour 1"
'
'pictureBox1
'
Me.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.pictureBox1.Location = New System.Drawing.Point(320, 10)
Me.pictureBox1.Name = "pictureBox1"
Me.pictureBox1.Size = New System.Drawing.Size(104, 103)
Me.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
Me.pictureBox1.TabIndex = 0
Me.pictureBox1.TabStop = False
'
'tabPage2
'
Me.tabPage2.Controls.Add(Me.Button15)
Me.tabPage2.Controls.Add(Me.Panel2)
Me.tabPage2.Controls.Add(Me.label6)
Me.tabPage2.Controls.Add(Me.numericUpDown1)
Me.tabPage2.Controls.Add(Me.label5)
Me.tabPage2.Location = New System.Drawing.Point(4, 22)
Me.tabPage2.Name = "tabPage2"
Me.tabPage2.Padding = New System.Windows.Forms.Padding(3)
Me.tabPage2.Size = New System.Drawing.Size(432, 119)
Me.tabPage2.TabIndex = 1
Me.tabPage2.Text = "Grid"
Me.tabPage2.UseVisualStyleBackColor = True
'
'Button15
'
Me.Button15.Location = New System.Drawing.Point(358, 93)
Me.Button15.Name = "Button15"
Me.Button15.Size = New System.Drawing.Size(65, 23)
Me.Button15.TabIndex = 11
Me.Button15.Text = "Show info"
Me.Button15.UseVisualStyleBackColor = True
'
'Panel2
'
Me.Panel2.Controls.Add(Me.TextBox8)
Me.Panel2.Controls.Add(Me.TextBox6)
Me.Panel2.Controls.Add(Me.TextBox7)
Me.Panel2.Controls.Add(Me.PictureBox5)
Me.Panel2.Controls.Add(Me.PictureBox4)
Me.Panel2.Location = New System.Drawing.Point(6, 122)
Me.Panel2.Name = "Panel2"
Me.Panel2.Size = New System.Drawing.Size(417, 383)
Me.Panel2.TabIndex = 10
'
'TextBox8
'
Me.TextBox8.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.TextBox8.Location = New System.Drawing.Point(3, 303)
Me.TextBox8.Multiline = True
Me.TextBox8.Name = "TextBox8"
Me.TextBox8.Size = New System.Drawing.Size(411, 77)
Me.TextBox8.TabIndex = 5
Me.TextBox8.Text = resources.GetString("TextBox8.Text")
'
'TextBox6
'
Me.TextBox6.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.TextBox6.Location = New System.Drawing.Point(220, 172)
Me.TextBox6.Multiline = True
Me.TextBox6.Name = "TextBox6"
Me.TextBox6.Size = New System.Drawing.Size(173, 125)
Me.TextBox6.TabIndex = 4
Me.TextBox6.Text = resources.GetString("TextBox6.Text")
'
'TextBox7
'
Me.TextBox7.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.TextBox7.Location = New System.Drawing.Point(16, 172)
Me.TextBox7.Multiline = True
Me.TextBox7.Name = "TextBox7"
Me.TextBox7.Size = New System.Drawing.Size(173, 125)
Me.TextBox7.TabIndex = 3
Me.TextBox7.Text = resources.GetString("TextBox7.Text")
'
'PictureBox5
'
Me.PictureBox5.Image = CType(resources.GetObject("PictureBox5.Image"), System.Drawing.Image)
Me.PictureBox5.Location = New System.Drawing.Point(221, 3)
Me.PictureBox5.Name = "PictureBox5"
Me.PictureBox5.Size = New System.Drawing.Size(170, 163)
Me.PictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
Me.PictureBox5.TabIndex = 2
Me.PictureBox5.TabStop = False
'
'PictureBox4
'
Me.PictureBox4.Image = CType(resources.GetObject("PictureBox4.Image"), System.Drawing.Image)
Me.PictureBox4.Location = New System.Drawing.Point(16, 3)
Me.PictureBox4.Name = "PictureBox4"
Me.PictureBox4.Size = New System.Drawing.Size(170, 163)
Me.PictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
Me.PictureBox4.TabIndex = 1
Me.PictureBox4.TabStop = False
'
'label6
'
Me.label6.Location = New System.Drawing.Point(6, 38)
Me.label6.Name = "label6"
Me.label6.Size = New System.Drawing.Size(358, 69)
Me.label6.TabIndex = 3
Me.label6.Text = resources.GetString("label6.Text")
'
'numericUpDown1
'
Me.numericUpDown1.Increment = New Decimal(New Integer() {10, 0, 0, 0})
Me.numericUpDown1.Location = New System.Drawing.Point(70, 11)
Me.numericUpDown1.Maximum = New Decimal(New Integer() {200, 0, 0, 0})
Me.numericUpDown1.Minimum = New Decimal(New Integer() {10, 0, 0, 0})
Me.numericUpDown1.Name = "numericUpDown1"
Me.numericUpDown1.Size = New System.Drawing.Size(68, 20)
Me.numericUpDown1.TabIndex = 2
Me.numericUpDown1.Value = New Decimal(New Integer() {50, 0, 0, 0})
'
'label5
'
Me.label5.Location = New System.Drawing.Point(15, 11)
Me.label5.Name = "label5"
Me.label5.Size = New System.Drawing.Size(49, 23)
Me.label5.TabIndex = 1
Me.label5.Text = "Grid size"
'
'tabPage3
'
Me.tabPage3.Controls.Add(Me.Button16)
Me.tabPage3.Controls.Add(Me.Panel3)
Me.tabPage3.Controls.Add(Me.pictureBox3)
Me.tabPage3.Controls.Add(Me.pictureBox2)
Me.tabPage3.Controls.Add(Me.radioButton2)
Me.tabPage3.Controls.Add(Me.radioButton1)
Me.tabPage3.Controls.Add(Me.numericUpDown2)
Me.tabPage3.Controls.Add(Me.label9)
Me.tabPage3.Controls.Add(Me.textBox3)
Me.tabPage3.Controls.Add(Me.textBox2)
Me.tabPage3.Controls.Add(Me.label8)
Me.tabPage3.Controls.Add(Me.label7)
Me.tabPage3.Location = New System.Drawing.Point(4, 22)
Me.tabPage3.Name = "tabPage3"
Me.tabPage3.Padding = New System.Windows.Forms.Padding(3)
Me.tabPage3.Size = New System.Drawing.Size(432, 119)
Me.tabPage3.TabIndex = 2
Me.tabPage3.Text = "Cross Section"
Me.tabPage3.UseVisualStyleBackColor = True
'
'Button16
'
Me.Button16.Location = New System.Drawing.Point(358, 95)
Me.Button16.Name = "Button16"
Me.Button16.Size = New System.Drawing.Size(65, 23)
Me.Button16.TabIndex = 11
Me.Button16.Text = "Show info"
Me.Button16.UseVisualStyleBackColor = True
'
'Panel3
'
Me.Panel3.Controls.Add(Me.TextBox11)
Me.Panel3.Controls.Add(Me.TextBox10)
Me.Panel3.Controls.Add(Me.PictureBox7)
Me.Panel3.Controls.Add(Me.TextBox9)
Me.Panel3.Location = New System.Drawing.Point(6, 121)
Me.Panel3.Name = "Panel3"
Me.Panel3.Size = New System.Drawing.Size(417, 386)
Me.Panel3.TabIndex = 10
'
'TextBox11
'
Me.TextBox11.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.TextBox11.Location = New System.Drawing.Point(204, 334)
Me.TextBox11.Multiline = True
Me.TextBox11.Name = "TextBox11"
Me.TextBox11.Size = New System.Drawing.Size(142, 30)
Me.TextBox11.TabIndex = 5
Me.TextBox11.Text = "Example of 10 sample points"
'
'TextBox10
'
Me.TextBox10.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.TextBox10.Location = New System.Drawing.Point(45, 334)
Me.TextBox10.Multiline = True
Me.TextBox10.Name = "TextBox10"
Me.TextBox10.Size = New System.Drawing.Size(142, 30)
Me.TextBox10.TabIndex = 4
Me.TextBox10.Text = "Example of 5 sample points"
'
'PictureBox7
'
Me.PictureBox7.Image = CType(resources.GetObject("PictureBox7.Image"), System.Drawing.Image)
Me.PictureBox7.Location = New System.Drawing.Point(21, 81)
Me.PictureBox7.Name = "PictureBox7"
Me.PictureBox7.Size = New System.Drawing.Size(354, 247)
Me.PictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
Me.PictureBox7.TabIndex = 3
Me.PictureBox7.TabStop = False
'
'TextBox9
'
Me.TextBox9.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.TextBox9.Location = New System.Drawing.Point(3, 3)
Me.TextBox9.Multiline = True
Me.TextBox9.Name = "TextBox9"
Me.TextBox9.Size = New System.Drawing.Size(411, 73)
Me.TextBox9.TabIndex = 0
Me.TextBox9.Text = resources.GetString("TextBox9.Text")
'
'pictureBox3
'
Me.pictureBox3.BackgroundImage = CType(resources.GetObject("pictureBox3.BackgroundImage"), System.Drawing.Image)
Me.pictureBox3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
Me.pictureBox3.InitialImage = Nothing
Me.pictureBox3.Location = New System.Drawing.Point(273, 82)
Me.pictureBox3.Name = "pictureBox3"
Me.pictureBox3.Size = New System.Drawing.Size(79, 33)
Me.pictureBox3.TabIndex = 9
Me.pictureBox3.TabStop = False
'
'pictureBox2
'
Me.pictureBox2.BackgroundImage = CType(resources.GetObject("pictureBox2.BackgroundImage"), System.Drawing.Image)
Me.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
Me.pictureBox2.InitialImage = Nothing
Me.pictureBox2.Location = New System.Drawing.Point(84, 82)
Me.pictureBox2.Name = "pictureBox2"
Me.pictureBox2.Size = New System.Drawing.Size(79, 33)
Me.pictureBox2.TabIndex = 8
Me.pictureBox2.TabStop = False
'
'radioButton2
'
Me.radioButton2.Location = New System.Drawing.Point(192, 83)
Me.radioButton2.Name = "radioButton2"
Me.radioButton2.Size = New System.Drawing.Size(75, 30)
Me.radioButton2.TabIndex = 7
Me.radioButton2.TabStop = True
Me.radioButton2.Text = "Simple Sections"
Me.radioButton2.UseVisualStyleBackColor = True
'
'radioButton1
'
Me.radioButton1.Checked = True
Me.radioButton1.Location = New System.Drawing.Point(6, 83)
Me.radioButton1.Name = "radioButton1"
Me.radioButton1.Size = New System.Drawing.Size(72, 32)
Me.radioButton1.TabIndex = 6
Me.radioButton1.TabStop = True
Me.radioButton1.Text = "Complex Sections"
Me.radioButton1.UseVisualStyleBackColor = True
'
'numericUpDown2
'
Me.numericUpDown2.Location = New System.Drawing.Point(102, 57)
Me.numericUpDown2.Minimum = New Decimal(New Integer() {10, 0, 0, 0})
Me.numericUpDown2.Name = "numericUpDown2"
Me.numericUpDown2.Size = New System.Drawing.Size(36, 20)
Me.numericUpDown2.TabIndex = 5
Me.numericUpDown2.Value = New Decimal(New Integer() {30, 0, 0, 0})
'
'label9
'
Me.label9.Location = New System.Drawing.Point(6, 59)
Me.label9.Name = "label9"
Me.label9.Size = New System.Drawing.Size(90, 20)
Me.label9.TabIndex = 4
Me.label9.Text = "Samples (Default)"
'
'textBox3
'
Me.textBox3.Location = New System.Drawing.Point(102, 31)
Me.textBox3.Name = "textBox3"
Me.textBox3.Size = New System.Drawing.Size(165, 20)
Me.textBox3.TabIndex = 3
Me.textBox3.Text = "Elevation"
'
'textBox2
'
Me.textBox2.Location = New System.Drawing.Point(102, 6)
Me.textBox2.Name = "textBox2"
Me.textBox2.Size = New System.Drawing.Size(165, 20)
Me.textBox2.TabIndex = 2
Me.textBox2.Text = "Distance"
'
'label8
'
Me.label8.Location = New System.Drawing.Point(6, 33)
Me.label8.Name = "label8"
Me.label8.Size = New System.Drawing.Size(72, 20)
Me.label8.TabIndex = 1
Me.label8.Text = "Y Axis Label"
'
'label7
'
Me.label7.Location = New System.Drawing.Point(6, 9)
Me.label7.Name = "label7"
Me.label7.Size = New System.Drawing.Size(72, 20)
Me.label7.TabIndex = 0
Me.label7.Text = "X Axis Label"
'
'tabPage4
'
Me.tabPage4.Controls.Add(Me.Button17)
Me.tabPage4.Controls.Add(Me.Panel4)
Me.tabPage4.Controls.Add(Me.label10)
Me.tabPage4.Controls.Add(Me.button9)
Me.tabPage4.Controls.Add(Me.textBox4)
Me.tabPage4.Location = New System.Drawing.Point(4, 22)
Me.tabPage4.Name = "tabPage4"
Me.tabPage4.Padding = New System.Windows.Forms.Padding(3)
Me.tabPage4.Size = New System.Drawing.Size(432, 119)
Me.tabPage4.TabIndex = 3
Me.tabPage4.Text = "Background Image"
Me.tabPage4.UseVisualStyleBackColor = True
'
'Button17
'
Me.Button17.Location = New System.Drawing.Point(358, 95)
Me.Button17.Name = "Button17"
Me.Button17.Size = New System.Drawing.Size(65, 23)
Me.Button17.TabIndex = 11
Me.Button17.Text = "Show info"
Me.Button17.UseVisualStyleBackColor = True
'
'Panel4
'
Me.Panel4.Controls.Add(Me.TextBox13)
Me.Panel4.Controls.Add(Me.PictureBox6)
Me.Panel4.Controls.Add(Me.PictureBox8)
Me.Panel4.Controls.Add(Me.TextBox12)
Me.Panel4.Location = New System.Drawing.Point(6, 119)
Me.Panel4.Name = "Panel4"
Me.Panel4.Size = New System.Drawing.Size(417, 386)
Me.Panel4.TabIndex = 10
'
'TextBox13
'
Me.TextBox13.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.TextBox13.Location = New System.Drawing.Point(3, 281)
Me.TextBox13.Multiline = True
Me.TextBox13.Name = "TextBox13"
Me.TextBox13.Size = New System.Drawing.Size(411, 90)
Me.TextBox13.TabIndex = 5
Me.TextBox13.Text = "The selected image will be streched over the extent of the grid, the result will " &
"look like the image on the right." & Global.Microsoft.VisualBasic.ChrW(9) & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "The image formats supported are: PNG, JPG " &
"and GIF" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10)
'
'PictureBox6
'
Me.PictureBox6.Image = CType(resources.GetObject("PictureBox6.Image"), System.Drawing.Image)
Me.PictureBox6.Location = New System.Drawing.Point(226, 112)
Me.PictureBox6.Name = "PictureBox6"
Me.PictureBox6.Size = New System.Drawing.Size(170, 163)
Me.PictureBox6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
Me.PictureBox6.TabIndex = 4
Me.PictureBox6.TabStop = False
'
'PictureBox8
'
Me.PictureBox8.Image = CType(resources.GetObject("PictureBox8.Image"), System.Drawing.Image)
Me.PictureBox8.Location = New System.Drawing.Point(21, 112)
Me.PictureBox8.Name = "PictureBox8"
Me.PictureBox8.Size = New System.Drawing.Size(170, 163)
Me.PictureBox8.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
Me.PictureBox8.TabIndex = 3
Me.PictureBox8.TabStop = False
'
'TextBox12
'
Me.TextBox12.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.TextBox12.Location = New System.Drawing.Point(3, 3)
Me.TextBox12.Multiline = True
Me.TextBox12.Name = "TextBox12"
Me.TextBox12.Size = New System.Drawing.Size(411, 90)
Me.TextBox12.TabIndex = 0
Me.TextBox12.Text = resources.GetString("TextBox12.Text")
'
'label10
'
Me.label10.Location = New System.Drawing.Point(15, 10)
Me.label10.Name = "label10"
Me.label10.Size = New System.Drawing.Size(375, 40)
Me.label10.TabIndex = 9
Me.label10.Text = "Select a image file to use as a background. This must be exactly the same size a" &
"s the ASCII grid as it will be streched to fit it."
'
'button9
'
Me.button9.Location = New System.Drawing.Point(396, 50)
Me.button9.Name = "button9"
Me.button9.Size = New System.Drawing.Size(30, 23)
Me.button9.TabIndex = 8
Me.button9.Text = "..."
Me.button9.UseVisualStyleBackColor = True
'
'textBox4
'
Me.textBox4.Location = New System.Drawing.Point(15, 53)
Me.textBox4.Name = "textBox4"
Me.textBox4.Size = New System.Drawing.Size(377, 20)
Me.textBox4.TabIndex = 0
'
'tabPage5
'
Me.tabPage5.Controls.Add(Me.Button18)
Me.tabPage5.Controls.Add(Me.Panel5)
Me.tabPage5.Controls.Add(Me.checkBox3)
Me.tabPage5.Controls.Add(Me.numericUpDown3)
Me.tabPage5.Controls.Add(Me.button13)
Me.tabPage5.Controls.Add(Me.button12)
Me.tabPage5.Controls.Add(Me.listBox2)
Me.tabPage5.Controls.Add(Me.checkBox2)
Me.tabPage5.Controls.Add(Me.checkBox1)
Me.tabPage5.Location = New System.Drawing.Point(4, 22)
Me.tabPage5.Name = "tabPage5"
Me.tabPage5.Padding = New System.Windows.Forms.Padding(3)
Me.tabPage5.Size = New System.Drawing.Size(432, 119)
Me.tabPage5.TabIndex = 4
Me.tabPage5.Text = "Options"
Me.tabPage5.UseVisualStyleBackColor = True
'
'Button18
'
Me.Button18.Location = New System.Drawing.Point(358, 95)
Me.Button18.Name = "Button18"
Me.Button18.Size = New System.Drawing.Size(65, 23)
Me.Button18.TabIndex = 11
Me.Button18.Text = "Show info"
Me.Button18.UseVisualStyleBackColor = True
'
'Panel5
'
Me.Panel5.Controls.Add(Me.TextBox14)
Me.Panel5.Location = New System.Drawing.Point(6, 119)
Me.Panel5.Name = "Panel5"
Me.Panel5.Size = New System.Drawing.Size(417, 386)
Me.Panel5.TabIndex = 10
'
'TextBox14
'
Me.TextBox14.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.TextBox14.Location = New System.Drawing.Point(3, 3)
Me.TextBox14.Multiline = True
Me.TextBox14.Name = "TextBox14"
Me.TextBox14.Size = New System.Drawing.Size(411, 254)
Me.TextBox14.TabIndex = 0
Me.TextBox14.Text = resources.GetString("TextBox14.Text")
'
'checkBox3
'
Me.checkBox3.Checked = True
Me.checkBox3.CheckState = System.Windows.Forms.CheckState.Checked
Me.checkBox3.Location = New System.Drawing.Point(6, 95)
Me.checkBox3.Name = "checkBox3"
Me.checkBox3.Size = New System.Drawing.Size(359, 24)
Me.checkBox3.TabIndex = 6
Me.checkBox3.Text = "Allow cross section sample points to be plotted on the map"
Me.checkBox3.UseVisualStyleBackColor = True
'
'numericUpDown3
'
Me.numericUpDown3.Location = New System.Drawing.Point(164, 48)
Me.numericUpDown3.Maximum = New Decimal(New Integer() {200, 0, 0, 0})
Me.numericUpDown3.Minimum = New Decimal(New Integer() {5, 0, 0, 0})
Me.numericUpDown3.Name = "numericUpDown3"
Me.numericUpDown3.Size = New System.Drawing.Size(44, 20)
Me.numericUpDown3.TabIndex = 5
Me.numericUpDown3.Value = New Decimal(New Integer() {5, 0, 0, 0})
'
'button13
'
Me.button13.Location = New System.Drawing.Point(103, 71)
Me.button13.Name = "button13"
Me.button13.Size = New System.Drawing.Size(55, 20)
Me.button13.TabIndex = 4
Me.button13.Text = "Clear"
Me.button13.UseVisualStyleBackColor = True
'
'button12
'
Me.button12.Location = New System.Drawing.Point(103, 48)
Me.button12.Name = "button12"
Me.button12.Size = New System.Drawing.Size(55, 20)
Me.button12.TabIndex = 3
Me.button12.Text = "Add"
Me.button12.UseVisualStyleBackColor = True
'
'listBox2
'
Me.listBox2.FormattingEnabled = True
Me.listBox2.Items.AddRange(New Object() {"10", "20", "30", "40"})
Me.listBox2.Location = New System.Drawing.Point(28, 48)
Me.listBox2.Name = "listBox2"
Me.listBox2.Size = New System.Drawing.Size(69, 43)
Me.listBox2.TabIndex = 2
'
'checkBox2
'
Me.checkBox2.Checked = True
Me.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked
Me.checkBox2.Location = New System.Drawing.Point(6, 24)
Me.checkBox2.Name = "checkBox2"
Me.checkBox2.Size = New System.Drawing.Size(295, 24)
Me.checkBox2.TabIndex = 1
Me.checkBox2.Text = "Allow changes to number of samples (add to list below)"
Me.checkBox2.UseVisualStyleBackColor = True
'
'checkBox1
'
Me.checkBox1.Checked = True
Me.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked
Me.checkBox1.Location = New System.Drawing.Point(6, 4)
Me.checkBox1.Name = "checkBox1"
Me.checkBox1.Size = New System.Drawing.Size(276, 24)
Me.checkBox1.TabIndex = 0
Me.checkBox1.Text = "Display Table (allows copy/paste to Excel or similar)"
Me.checkBox1.UseVisualStyleBackColor = True
'
'tabPage6
'
Me.tabPage6.Controls.Add(Me.Button19)
Me.tabPage6.Controls.Add(Me.Panel6)
Me.tabPage6.Controls.Add(Me.label12)
Me.tabPage6.Controls.Add(Me.button11)
Me.tabPage6.Controls.Add(Me.button10)
Me.tabPage6.Controls.Add(Me.listBox1)
Me.tabPage6.Location = New System.Drawing.Point(4, 22)
Me.tabPage6.Name = "tabPage6"
Me.tabPage6.Padding = New System.Windows.Forms.Padding(3)
Me.tabPage6.Size = New System.Drawing.Size(432, 119)
Me.tabPage6.TabIndex = 5
Me.tabPage6.Text = "Grids"
Me.tabPage6.UseVisualStyleBackColor = True
'
'Button19
'
Me.Button19.Location = New System.Drawing.Point(361, 7)
Me.Button19.Name = "Button19"
Me.Button19.Size = New System.Drawing.Size(65, 23)
Me.Button19.TabIndex = 11
Me.Button19.Text = "Show info"
Me.Button19.UseVisualStyleBackColor = True
'
'Panel6
'
Me.Panel6.Controls.Add(Me.TextBox17)
Me.Panel6.Controls.Add(Me.PictureBox9)
Me.Panel6.Controls.Add(Me.TextBox16)
Me.Panel6.Controls.Add(Me.TextBox15)
Me.Panel6.Location = New System.Drawing.Point(6, 119)
Me.Panel6.Name = "Panel6"
Me.Panel6.Size = New System.Drawing.Size(417, 386)
Me.Panel6.TabIndex = 10
'
'TextBox17
'
Me.TextBox17.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.TextBox17.Location = New System.Drawing.Point(290, 82)
Me.TextBox17.Multiline = True
Me.TextBox17.Name = "TextBox17"
Me.TextBox17.Size = New System.Drawing.Size(124, 180)
Me.TextBox17.TabIndex = 3
Me.TextBox17.Text = "Values are obtained for all overlapping grids" & Global.Microsoft.VisualBasic.ChrW(9) & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "Grids added in this manner will" &
" not show up on the interactive map, they will only be displayed in the cross se" &
"ction."
'
'PictureBox9
'
Me.PictureBox9.Image = CType(resources.GetObject("PictureBox9.Image"), System.Drawing.Image)
Me.PictureBox9.Location = New System.Drawing.Point(3, 82)
Me.PictureBox9.Name = "PictureBox9"
Me.PictureBox9.Size = New System.Drawing.Size(281, 180)
Me.PictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
Me.PictureBox9.TabIndex = 2
Me.PictureBox9.TabStop = False
'
'TextBox16
'
Me.TextBox16.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.TextBox16.Location = New System.Drawing.Point(3, 268)
Me.TextBox16.Multiline = True
Me.TextBox16.Name = "TextBox16"
Me.TextBox16.Size = New System.Drawing.Size(411, 115)
Me.TextBox16.TabIndex = 1
Me.TextBox16.Text = resources.GetString("TextBox16.Text")
'
'TextBox15
'
Me.TextBox15.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.TextBox15.Location = New System.Drawing.Point(3, 3)
Me.TextBox15.Multiline = True
Me.TextBox15.Name = "TextBox15"
Me.TextBox15.Size = New System.Drawing.Size(411, 73)
Me.TextBox15.TabIndex = 0
Me.TextBox15.Text = resources.GetString("TextBox15.Text")
'
'label12
'
Me.label12.Location = New System.Drawing.Point(133, 6)
Me.label12.Name = "label12"
Me.label12.Size = New System.Drawing.Size(174, 23)
Me.label12.TabIndex = 9
Me.label12.Text = "Add multiple grids for comparisons. "
Me.label12.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'button11
'
Me.button11.Location = New System.Drawing.Point(69, 7)
Me.button11.Name = "button11"
Me.button11.Size = New System.Drawing.Size(58, 23)
Me.button11.TabIndex = 8
Me.button11.Text = "Clear"
Me.button11.UseVisualStyleBackColor = True
'
'button10
'
Me.button10.Location = New System.Drawing.Point(4, 6)
Me.button10.Name = "button10"
Me.button10.Size = New System.Drawing.Size(59, 23)
Me.button10.TabIndex = 7
Me.button10.Text = "Add"
Me.button10.UseVisualStyleBackColor = True
'
'listBox1
'
Me.listBox1.FormattingEnabled = True
Me.listBox1.Location = New System.Drawing.Point(3, 33)
Me.listBox1.Name = "listBox1"
Me.listBox1.Size = New System.Drawing.Size(423, 82)
Me.listBox1.TabIndex = 0
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(464, 101)
Me.Controls.Add(Me.tabControl1)
Me.Controls.Add(Me.button4)
Me.Controls.Add(Me.button3)
Me.Controls.Add(Me.button2)
Me.Controls.Add(Me.progressBar1)
Me.Controls.Add(Me.label1)
Me.Controls.Add(Me.textBox1)
Me.Controls.Add(Me.button1)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.MaximumSize = New System.Drawing.Size(480, 700)
Me.MinimizeBox = False
Me.MinimumSize = New System.Drawing.Size(480, 140)
Me.Name = "Form1"
Me.Text = "Grid2OpenLayers"
Me.tabControl1.ResumeLayout(False)
Me.tabPage1.ResumeLayout(False)
Me.Panel1.ResumeLayout(False)
Me.Panel1.PerformLayout()
CType(Me.pictureBox1, System.ComponentModel.ISupportInitialize).EndInit()
Me.tabPage2.ResumeLayout(False)
Me.Panel2.ResumeLayout(False)
Me.Panel2.PerformLayout()
CType(Me.PictureBox5, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.PictureBox4, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.numericUpDown1, System.ComponentModel.ISupportInitialize).EndInit()
Me.tabPage3.ResumeLayout(False)
Me.tabPage3.PerformLayout()
Me.Panel3.ResumeLayout(False)
Me.Panel3.PerformLayout()
CType(Me.PictureBox7, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.pictureBox3, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.pictureBox2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.numericUpDown2, System.ComponentModel.ISupportInitialize).EndInit()
Me.tabPage4.ResumeLayout(False)
Me.tabPage4.PerformLayout()
Me.Panel4.ResumeLayout(False)
Me.Panel4.PerformLayout()
CType(Me.PictureBox6, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.PictureBox8, System.ComponentModel.ISupportInitialize).EndInit()
Me.tabPage5.ResumeLayout(False)
Me.Panel5.ResumeLayout(False)
Me.Panel5.PerformLayout()
CType(Me.numericUpDown3, System.ComponentModel.ISupportInitialize).EndInit()
Me.tabPage6.ResumeLayout(False)
Me.Panel6.ResumeLayout(False)
Me.Panel6.PerformLayout()
CType(Me.PictureBox9, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Private radioButton1 As System.Windows.Forms.RadioButton
Private radioButton2 As System.Windows.Forms.RadioButton
Private pictureBox2 As System.Windows.Forms.PictureBox
Private pictureBox3 As System.Windows.Forms.PictureBox
Private label12 As System.Windows.Forms.Label
Private checkBox3 As System.Windows.Forms.CheckBox
Private numericUpDown3 As System.Windows.Forms.NumericUpDown
Private checkBox2 As System.Windows.Forms.CheckBox
Private listBox2 As System.Windows.Forms.ListBox
Private WithEvents button12 As System.Windows.Forms.Button
Private WithEvents button13 As System.Windows.Forms.Button
Private WithEvents button11 As System.Windows.Forms.Button
Private listBox1 As System.Windows.Forms.ListBox
Private WithEvents button10 As System.Windows.Forms.Button
Private tabPage6 As System.Windows.Forms.TabPage
Private checkBox1 As System.Windows.Forms.CheckBox
Private label10 As System.Windows.Forms.Label
Private textBox4 As System.Windows.Forms.TextBox
Private WithEvents button9 As System.Windows.Forms.Button
Private tabPage5 As System.Windows.Forms.TabPage
Private tabPage4 As System.Windows.Forms.TabPage
Private label9 As System.Windows.Forms.Label
Private numericUpDown2 As System.Windows.Forms.NumericUpDown
Private label7 As System.Windows.Forms.Label
Private label8 As System.Windows.Forms.Label
Private textBox2 As System.Windows.Forms.TextBox
Private textBox3 As System.Windows.Forms.TextBox
Private tabPage3 As System.Windows.Forms.TabPage
Private label6 As System.Windows.Forms.Label
Private label5 As System.Windows.Forms.Label
Private numericUpDown1 As System.Windows.Forms.NumericUpDown
Private progressBar2 As System.Windows.Forms.ProgressBar
Private WithEvents button8 As System.Windows.Forms.Button
Private label4 As System.Windows.Forms.Label
Private colorDialog1 As System.Windows.Forms.ColorDialog
Private tabPage2 As System.Windows.Forms.TabPage
Private pictureBox1 As System.Windows.Forms.PictureBox
Private label2 As System.Windows.Forms.Label
Private label3 As System.Windows.Forms.Label
Private WithEvents button5 As System.Windows.Forms.Button
Private WithEvents button6 As System.Windows.Forms.Button
Private WithEvents button7 As System.Windows.Forms.Button
Private tabPage1 As System.Windows.Forms.TabPage
Private tabControl1 As System.Windows.Forms.TabControl
Private WithEvents button4 As System.Windows.Forms.Button
Private WithEvents button3 As System.Windows.Forms.Button
Private WithEvents button2 As System.Windows.Forms.Button
Private openFileDialog1 As System.Windows.Forms.OpenFileDialog
Private progressBar1 As System.Windows.Forms.ProgressBar
Private label1 As System.Windows.Forms.Label
Private textBox1 As System.Windows.Forms.TextBox
Private WithEvents button1 As System.Windows.Forms.Button
Friend WithEvents Panel1 As System.Windows.Forms.Panel
Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
Friend WithEvents Panel2 As System.Windows.Forms.Panel
Friend WithEvents PictureBox5 As System.Windows.Forms.PictureBox
Friend WithEvents PictureBox4 As System.Windows.Forms.PictureBox
Friend WithEvents TextBox8 As System.Windows.Forms.TextBox
Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
Friend WithEvents TextBox7 As System.Windows.Forms.TextBox
Friend WithEvents Panel3 As System.Windows.Forms.Panel
Friend WithEvents PictureBox7 As System.Windows.Forms.PictureBox
Friend WithEvents TextBox9 As System.Windows.Forms.TextBox
Friend WithEvents TextBox11 As System.Windows.Forms.TextBox
Friend WithEvents TextBox10 As System.Windows.Forms.TextBox
Friend WithEvents Panel4 As System.Windows.Forms.Panel
Friend WithEvents TextBox13 As System.Windows.Forms.TextBox
Friend WithEvents PictureBox6 As System.Windows.Forms.PictureBox
Friend WithEvents PictureBox8 As System.Windows.Forms.PictureBox
Friend WithEvents TextBox12 As System.Windows.Forms.TextBox
Friend WithEvents Panel5 As System.Windows.Forms.Panel
Friend WithEvents TextBox14 As System.Windows.Forms.TextBox
Friend WithEvents Panel6 As System.Windows.Forms.Panel
Friend WithEvents TextBox16 As System.Windows.Forms.TextBox
Friend WithEvents TextBox15 As System.Windows.Forms.TextBox
Friend WithEvents TextBox17 As System.Windows.Forms.TextBox
Friend WithEvents PictureBox9 As System.Windows.Forms.PictureBox
Friend WithEvents Button14 As System.Windows.Forms.Button
Friend WithEvents Button15 As System.Windows.Forms.Button
Friend WithEvents Button16 As System.Windows.Forms.Button
Friend WithEvents Button17 As System.Windows.Forms.Button
Friend WithEvents Button18 As System.Windows.Forms.Button
Friend WithEvents Button19 As System.Windows.Forms.Button
End Class
|
JohnWilcock/Grid2OpenLayers
|
Grid2Openlayers/Form1.Designer.vb
|
Visual Basic
|
mit
| 48,228
|
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
<Assembly: AssemblyTitle("")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("")>
<Assembly: AssemblyCopyright("")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
<Assembly: Guid("0e3e3a67-7d9c-486b-920e-a5711b346e09")>
<Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
ljw1004/blog
|
VSIX/dotnet-code-analyzer/Analyzer_CheckedExceptions/My Project/AssemblyInfo.vb
|
Visual Basic
|
mit
| 449
|
Namespace Snmp
''' <summary>Snmp Object Mapping Class</summary>
''' <autogenerated>Generated from a T4 template. Modifications will be lost, if applicable use a partial class instead.</autogenerated>
''' <generator-date>08/02/2014 18:26:35</generator-date>
''' <generator-functions>1</generator-functions>
''' <generator-source>Caerus\_Snmp\Generated\ObjectMapping.tt</generator-source>
''' <generator-template>Text-Templates\Classes\VB_Object.tt</generator-template>
''' <generator-version>1</generator-version>
<System.CodeDom.Compiler.GeneratedCode("Caerus\_Snmp\Generated\ObjectMapping.tt", "1")> _
<System.Serializable()> _
Partial Public Class ObjectMapping
Inherits System.Object
Implements System.Xml.Serialization.IXmlSerializable
#Region " Public Constructors "
''' <summary>Default Constructor</summary>
Public Sub New()
MyBase.New()
m_Version = SnmpVersion.SNMP_VERSION_2C
m_FieldMappings = New FieldMapping() {}
m_TableMappings = New TableMapping() {}
End Sub
''' <summary>Parametered Constructor (1 Parameters)</summary>
Public Sub New( _
ByVal _Version As SnmpVersion _
)
MyBase.New()
Version = _Version
m_FieldMappings = New FieldMapping() {}
m_TableMappings = New TableMapping() {}
End Sub
''' <summary>Parametered Constructor (2 Parameters)</summary>
Public Sub New( _
ByVal _Version As SnmpVersion, _
ByVal _FieldMappings As FieldMapping() _
)
MyBase.New()
Version = _Version
FieldMappings = _FieldMappings
m_TableMappings = New TableMapping() {}
End Sub
''' <summary>Parametered Constructor (3 Parameters)</summary>
Public Sub New( _
ByVal _Version As SnmpVersion, _
ByVal _FieldMappings As FieldMapping(), _
ByVal _TableMappings As TableMapping() _
)
MyBase.New()
Version = _Version
FieldMappings = _FieldMappings
TableMappings = _TableMappings
End Sub
''' <summary>Parametered Constructor (4 Parameters)</summary>
Public Sub New( _
ByVal _Version As SnmpVersion, _
ByVal _FieldMappings As FieldMapping(), _
ByVal _TableMappings As TableMapping(), _
ByVal _InheritsMappings As System.Boolean _
)
MyBase.New()
Version = _Version
FieldMappings = _FieldMappings
TableMappings = _TableMappings
InheritsMappings = _InheritsMappings
End Sub
#End Region
#Region " Class Plumbing/Interface Code "
#Region " IXmlSerialisable Implementation "
#Region " Public Methods "
''' <summary>Method to Return Schema Depicting Object/Class</summary>
''' <remarks></remarks>
Public Function IXmlSerialisable_GetSchema() As System.Xml.Schema.XmlSchema Implements System.Xml.Serialization.IXmlSerializable.GetSchema
Return Leviathan.Configuration.XmlSerialiser.GenerateSchema(Me.GetType)
End Function
''' <summary></summary>
''' <remarks></remarks>
Public Sub IXmlSerialisable_ReadXml( _
ByVal reader As System.Xml.XmlReader _
) Implements System.Xml.Serialization.IXmlSerializable.ReadXml
Leviathan.Configuration.XmlSerialiser.ReadXml(Me, reader)
End Sub
''' <summary></summary>
''' <remarks></remarks>
Public Sub IXmlSerialisable_WriteXml( _
ByVal writer As System.Xml.XmlWriter _
) Implements System.Xml.Serialization.IXmlSerializable.WriteXml
Leviathan.Configuration.XmlSerialiser.WriteXml(Me, writer)
End Sub
#End Region
#End Region
#End Region
#Region " Public Constants "
''' <summary>Public Shared Reference to the Name of the Property: Version</summary>
''' <remarks></remarks>
Public Const PROPERTY_VERSION As String = "Version"
''' <summary>Public Shared Reference to the Name of the Property: FieldMappings</summary>
''' <remarks></remarks>
Public Const PROPERTY_FIELDMAPPINGS As String = "FieldMappings"
''' <summary>Public Shared Reference to the Name of the Property: TableMappings</summary>
''' <remarks></remarks>
Public Const PROPERTY_TABLEMAPPINGS As String = "TableMappings"
''' <summary>Public Shared Reference to the Name of the Property: InheritsMappings</summary>
''' <remarks></remarks>
Public Const PROPERTY_INHERITSMAPPINGS As String = "InheritsMappings"
#End Region
#Region " Private Variables "
''' <summary>Private Data Storage Variable for Property: Version</summary>
''' <remarks></remarks>
Private m_Version As SnmpVersion
''' <summary>Private Data Storage Variable for Property: FieldMappings</summary>
''' <remarks></remarks>
Private m_FieldMappings As FieldMapping()
''' <summary>Private Data Storage Variable for Property: TableMappings</summary>
''' <remarks></remarks>
Private m_TableMappings As TableMapping()
''' <summary>Private Data Storage Variable for Property: InheritsMappings</summary>
''' <remarks></remarks>
Private m_InheritsMappings As System.Boolean
#End Region
#Region " Public Properties "
''' <summary>Provides Access to the Property: Version</summary>
''' <remarks></remarks>
<System.Xml.Serialization.XmlElement(ElementName:="Version")> _
Public Property Version() As SnmpVersion
Get
Return m_Version
End Get
Set(value As SnmpVersion)
m_Version = value
End Set
End Property
''' <summary>Provides Access to the Property: FieldMappings</summary>
''' <remarks></remarks>
<System.Xml.Serialization.XmlElement(ElementName:="FieldMappings")> _
Public Property FieldMappings() As FieldMapping()
Get
Return m_FieldMappings
End Get
Set(value As FieldMapping())
m_FieldMappings = value
End Set
End Property
''' <summary>Provides Access to the Property: TableMappings</summary>
''' <remarks></remarks>
<System.Xml.Serialization.XmlElement(ElementName:="TableMappings")> _
Public Property TableMappings() As TableMapping()
Get
Return m_TableMappings
End Get
Set(value As TableMapping())
m_TableMappings = value
End Set
End Property
''' <summary>Provides Access to the Property: InheritsMappings</summary>
''' <remarks></remarks>
<System.Xml.Serialization.XmlElement(ElementName:="InheritsMappings")> _
Public Property InheritsMappings() As System.Boolean
Get
Return m_InheritsMappings
End Get
Set(value As System.Boolean)
m_InheritsMappings = value
End Set
End Property
#End Region
End Class
End Namespace
|
thiscouldbejd/Caerus
|
_Snmp/Generated/ObjectMapping.vb
|
Visual Basic
|
mit
| 6,466
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.NetCore.Analyzers.Security
Imports Microsoft.CodeAnalysis.VisualBasic.TypedConstantExtensions
Namespace Microsoft.NetCore.VisualBasic.Analyzers.Runtime
<DiagnosticAnalyzer(LanguageNames.VisualBasic)>
Public Class BasicDataSetDataTableInSerializableObjectGraphAnalyzer
Inherits DataSetDataTableInSerializableObjectGraphAnalyzer
Protected Overrides Function ToString(typedConstant As TypedConstant) As String
Return typedConstant.ToVisualBasicString()
End Function
End Class
End Namespace
|
dotnet/roslyn-analyzers
|
src/NetAnalyzers/VisualBasic/Microsoft.NetCore.Analyzers/Security/BasicDataSetDataTableInSerializableObjectGraphAnalyzer.vb
|
Visual Basic
|
mit
| 777
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.