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
|
|---|---|---|---|---|---|
Public Class RelayCommand
Implements ICommand
Private ReadOnly _execute As Action(Of Object)
Private ReadOnly _canExecute As Predicate(Of Object)
Public Sub New(ByVal execute As Action(Of Object))
Me.New(execute, Nothing)
End Sub
Public Sub New(ByVal execute As Action(Of Object), ByVal canExecute As Predicate(Of Object))
If execute Is Nothing Then Throw New ArgumentNullException("execute")
_execute = execute
_canExecute = canExecute
End Sub
Public Function CanExecute(parameter As Object) As Boolean Implements ICommand.CanExecute
Return If(_canExecute Is Nothing, True, _canExecute(parameter))
End Function
Public Custom Event CanExecuteChanged As EventHandler Implements ICommand.CanExecuteChanged
AddHandler(value As EventHandler)
AddHandler CommandManager.RequerySuggested, value
End AddHandler
RemoveHandler(value As EventHandler)
RemoveHandler CommandManager.RequerySuggested, value
End RemoveHandler
RaiseEvent(sender As Object, e As EventArgs)
End RaiseEvent
End Event
Public Sub Execute(parameter As Object) Implements ICommand.Execute
_execute(parameter)
End Sub
End Class
Public Class RelayCommand(Of T)
Implements ICommand
Private ReadOnly _execute As Action(Of T)
Private ReadOnly _canExecute As Predicate(Of T)
Public Sub New(ByVal execute As Action(Of T))
Me.New(execute, Nothing)
End Sub
Public Sub New(ByVal execute As Action(Of T), ByVal canExecute As Predicate(Of T))
If execute Is Nothing Then
Throw New ArgumentNullException("execute")
End If
_execute = execute
_canExecute = canExecute
End Sub
<DebuggerStepThrough()>
Public Function CanExecute(ByVal parameter As Object) As Boolean Implements ICommand.CanExecute
Return If(_canExecute Is Nothing, True, _canExecute(CType(parameter, T)))
End Function
Public Custom Event CanExecuteChanged As EventHandler Implements ICommand.CanExecuteChanged
AddHandler(ByVal value As EventHandler)
AddHandler CommandManager.RequerySuggested, value
End AddHandler
RemoveHandler(ByVal value As EventHandler)
RemoveHandler CommandManager.RequerySuggested, value
End RemoveHandler
RaiseEvent(ByVal sender As Object, ByVal e As EventArgs)
End RaiseEvent
End Event
Public Sub Execute(ByVal parameter As Object) Implements ICommand.Execute
_execute(CType(parameter, T))
End Sub
End Class
|
MeshackMusundi/OpenWeather
|
OpenWeather/Commands/RelayCommand.vb
|
Visual Basic
|
mit
| 2,630
|
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 draftDocument As SolidEdgeDraft.DraftDocument = Nothing
Dim sheet As SolidEdgeDraft.Sheet = Nothing
Dim arcs2d As SolidEdgeFrameworkSupport.Arcs2d = Nothing
Dim arc2d As SolidEdgeFrameworkSupport.Arc2d = 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
draftDocument = CType(documents.Add("SolidEdge.DraftDocument"), SolidEdgeDraft.DraftDocument)
sheet = draftDocument.ActiveSheet
arcs2d = sheet.Arcs2d
arc2d = arcs2d.AddByCenterStartEnd(0, 0, 0.382, 0.105, 0.2207, 0.329)
Dim layer = arc2d.Layer
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.Arc2d.Layer.vb
|
Visual Basic
|
mit
| 1,555
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.34014
'
' 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.CompareFileSets.My.MySettings
Get
Return Global.CompareFileSets.My.MySettings.Default
End Get
End Property
End Module
End Namespace
|
JonKaye/simple-file-set-compare
|
CompareFileSets/My Project/Settings.Designer.vb
|
Visual Basic
|
apache-2.0
| 2,920
|
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
' アセンブリに関連付けられている情報を変更するには、
' これらの属性値を変更してください。
' アセンブリ属性の値を確認します。
<Assembly: AssemblyTitle("barcode")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("barcode")>
<Assembly: AssemblyCopyright("Copyright © 2011")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'このプロジェクトが COM に公開される場合、次の GUID がタイプ ライブラリの ID になります。
<Assembly: Guid("a3f1d45f-59b0-416f-91df-804907f9eb84")>
' アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
' 既定値にすることができます:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.4.0.0")>
<Assembly: AssemblyFileVersion("1.4.0.0")>
|
rapidreport/barcode-dotnet
|
barcode/My Project/AssemblyInfo.vb
|
Visual Basic
|
bsd-2-clause
| 1,287
|
' 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.Editor.Implementation.Outlining
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Outlining
Imports Microsoft.CodeAnalysis.Editor.VisualBasic.Outlining
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Outlining
Public Class CommentTests
Inherits AbstractSyntaxOutlinerTests
Protected Overrides ReadOnly Property LanguageName As String
Get
Return LanguageNames.VisualBasic
End Get
End Property
Friend Overrides Function GetRegionsAsync(document As Document, position As Integer) As Task(Of OutliningSpan())
Dim root = document.GetSyntaxRootAsync(CancellationToken.None).Result
Dim trivia = root.FindTrivia(position, findInsideTrivia:=True)
Dim token = trivia.Token
If token.LeadingTrivia.Contains(trivia) Then
Return Task.FromResult(VisualBasicOutliningHelpers.CreateCommentsRegions(token.LeadingTrivia).ToArray())
ElseIf token.TrailingTrivia.Contains(trivia) Then
Return Task.FromResult(VisualBasicOutliningHelpers.CreateCommentsRegions(token.TrailingTrivia).ToArray())
Else
Return Task.FromResult(Contract.FailWithReturn(Of OutliningSpan())())
End If
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.Outlining)>
Public Async Function TestSimpleComment1() As Task
Const code = "
{|span:' $$Hello
' VB!|}
Class C1
End Class
"
Await VerifyRegionsAsync(code,
Region("span", "' Hello ...", autoCollapse:=True))
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.Outlining)>
Public Async Function TestSimpleComment2() As Task
Const code = "
{|span:' $$Hello
'
' VB!|}
Class C1
End Class
"
Await VerifyRegionsAsync(code,
Region("span", "' Hello ...", autoCollapse:=True))
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.Outlining)>
Public Async Function TestSimpleComment3() As Task
Const code = "
{|span:' $$Hello
' VB!|}
Class C1
End Class
"
Await VerifyRegionsAsync(code,
Region("span", "' Hello ...", autoCollapse:=True))
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.Outlining)>
Public Async Function TestSingleLineCommentGroupFollowedByDocumentationComment() As Task
Const code = "
{|span:' $$Hello
' VB!|}
''' <summary></summary>
Class C1
End Class
"
Await VerifyRegionsAsync(code,
Region("span", "' Hello ...", autoCollapse:=True))
End Function
End Class
End Namespace
|
VPashkov/roslyn
|
src/EditorFeatures/VisualBasicTest/Outlining/CommentTests.vb
|
Visual Basic
|
apache-2.0
| 2,972
|
' 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.Xml.Linq
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Editor.VisualBasic.TodoComments
Imports Microsoft.CodeAnalysis.Editor.Implementation.TodoComments
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Extensions
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.Options
Imports Microsoft.CodeAnalysis.SolutionCrawler
Imports Microsoft.CodeAnalysis.Text
Imports Roslyn.Test.EditorUtilities
Imports Moq
Imports Microsoft.CodeAnalysis.Editor.Shared.Options
Imports System.Threading.Tasks
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.TodoComment
Public Class TodoCommentTests
<WpfFact>
Public Async Function TestSingleLineTodoComment_Colon() As Task
Dim code = <code>' [|TODO:test|]</code>
Await TestAsync(code)
End Function
<WpfFact>
Public Async Function TestSingleLineTodoComment_Space() As Task
Dim code = <code>' [|TODO test|]</code>
Await TestAsync(code)
End Function
<WpfFact>
Public Async Function TestSingleLineTodoComment_Underscore() As Task
Dim code = <code>' TODO_test</code>
Await TestAsync(code)
End Function
<WpfFact>
Public Async Function TestSingleLineTodoComment_Number() As Task
Dim code = <code>' TODO1 test</code>
Await TestAsync(code)
End Function
<WpfFact>
Public Async Function TestSingleLineTodoComment_Quote() As Task
Dim code = <code>' "TODO test"</code>
Await TestAsync(code)
End Function
<WpfFact>
Public Async Function TestSingleLineTodoComment_Middle() As Task
Dim code = <code>' Hello TODO test</code>
Await TestAsync(code)
End Function
<WpfFact>
Public Async Function TestSingleLineTodoComment_Document() As Task
Dim code = <code>''' [|TODO test|]</code>
Await TestAsync(code)
End Function
<WpfFact>
Public Async Function TestSingleLineTodoComment_Preprocessor1() As Task
Dim code = <code>#If DEBUG Then ' [|TODO test|]</code>
Await TestAsync(code)
End Function
<WpfFact>
Public Async Function TestSingleLineTodoComment_Preprocessor2() As Task
Dim code = <code>#If DEBUG Then ''' [|TODO test|]</code>
Await TestAsync(code)
End Function
<WpfFact>
Public Async Function TestSingleLineTodoComment_Region() As Task
Dim code = <code>#Region ' [|TODO test |]</code>
Await TestAsync(code)
End Function
<WpfFact>
Public Async Function TestSingleLineTodoComment_EndRegion() As Task
Dim code = <code>#End Region ' [|TODO test |]</code>
Await TestAsync(code)
End Function
<WpfFact>
Public Async Function TestSingleLineTodoComment_TrailingSpan() As Task
Dim code = <code>' [|TODO test |]</code>
Await TestAsync(code)
End Function
<WpfFact>
Public Async Function TestSingleLineTodoComment_REM() As Task
Dim code = <code>REM [|TODO test |]</code>
Await TestAsync(code)
End Function
<WpfFact>
Public Async Function TestSingleLineTodoComment_Preprocessor_REM() As Task
Dim code = <code>#If Debug Then REM [|TODO test |]</code>
Await TestAsync(code)
End Function
<WpfFact>
Public Async Function TestSinglelineDocumentComment_Multiline() As Task
Dim code = <code>
''' <summary>
''' [|TODO : test |]
''' </summary>
''' [|UNDONE: test2 |]</code>
Await TestAsync(code)
End Function
<WpfFact>
<WorkItem(606010)>
Public Async Function TestLeftRightSingleQuote() As Task
Dim code = <code>
‘[|todo fullwidth 1|]
’[|todo fullwidth 2|]
</code>
Await TestAsync(code)
End Function
<WpfFact>
<WorkItem(606019)>
Public Async Function TestHalfFullTodo() As Task
Dim code = <code>
'[|todo whatever|]
</code>
Await TestAsync(code)
End Function
<WpfFact>
<WorkItem(627723)>
Public Async Function TestSingleQuote_Invalid1() As Task
Dim code = <code>
'' todo whatever
</code>
Await TestAsync(code)
End Function
<WpfFact>
<WorkItem(627723)>
Public Async Function TestSingleQuote_Invalid2() As Task
Dim code = <code>
'''' todo whatever
</code>
Await TestAsync(code)
End Function
<WpfFact>
<WorkItem(627723)>
Public Async Function TestSingleQuote_Invalid3() As Task
Dim code = <code>
' '' todo whatever
</code>
Await TestAsync(code)
End Function
Private Shared Async Function TestAsync(codeWithMarker As XElement) As Tasks.Task
Dim code As String = Nothing
Dim list As IList(Of TextSpan) = Nothing
MarkupTestFile.GetSpans(codeWithMarker.NormalizedValue, code, list)
Using workspace = Await VisualBasicWorkspaceFactory.CreateWorkspaceFromLinesAsync(code)
Dim commentTokens = New TodoCommentTokens()
Dim provider = New TodoCommentIncrementalAnalyzerProvider(commentTokens)
Dim worker = DirectCast(provider.CreateIncrementalAnalyzer(workspace), TodoCommentIncrementalAnalyzer)
Dim document = workspace.Documents.First()
Dim documentId = document.Id
worker.AnalyzeSyntaxAsync(workspace.CurrentSolution.GetDocument(documentId), CancellationToken.None).Wait()
Dim todoLists = worker.GetItems_TestingOnly(documentId)
Assert.Equal(todoLists.Count, list.Count)
For i = 0 To todoLists.Count - 1 Step 1
Dim todo = todoLists(i)
Dim span = list(i)
Dim line = document.InitialTextSnapshot.GetLineFromPosition(span.Start)
Assert.Equal(todo.MappedLine, line.LineNumber)
Assert.Equal(todo.MappedColumn, span.Start - line.Start.Position)
Assert.Equal(todo.Message, code.Substring(span.Start, span.Length))
Next
End Using
End Function
End Class
End Namespace
|
mseamari/Stuff
|
src/EditorFeatures/VisualBasicTest/TodoComment/TodoCommentTests.vb
|
Visual Basic
|
apache-2.0
| 7,032
|
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Diagnostics
Imports System.Windows.Forms.DataVisualization.Charting
Imports System.Threading
Public Class frmMining
Public classUtilization As Utilization
Private RefreshCount As Long
Private RestartedMinerAt As DateTime
Private RestartedWalletAt As DateTime
Public bDisposing As Boolean
Public bSuccessfullyLoaded As Boolean
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
Refresh(True)
End Sub
Private Sub UpdateCharts()
Dim thCharts As New Thread(AddressOf UpdateChartsThread)
thCharts.IsBackground = True
thCharts.Start()
End Sub
Private Sub UpdateChartsThread()
ChartBoinc()
ChartBoincUtilization()
Me.Update()
End Sub
Public Sub Refresh(ByVal bStatsOnly As Boolean)
Try
If Not bStatsOnly Then
UpdateCharts()
Else
ChartBoincUtilization()
End If
Catch ex As Exception
End Try
Try
lblPower.Text = Trim(Math.Round(classUtilization.BoincUtilization, 1))
lblThreadCount.Text = Trim(classUtilization.BoincThreads)
lblVersion.Text = Trim(classUtilization.Version)
lblAvgCredits.Text = Trim(classUtilization.BoincTotalCreditsAvg)
Catch ex As Exception
End Try
Try
lblMD5.Text = Trim(classUtilization.BoincMD5)
RefreshCount = RefreshCount + 1
If RefreshCount = 1 Then
ReStartGuiMiner()
RestartedWalletAt = Now
End If
Catch ex As Exception
End Try
Try
Dim lMinSetting = Val(KeyValue("RestartMiner"))
Dim lRunning = Math.Abs(DateDiff(DateInterval.Minute, RestartedMinerAt, Now))
If lMinSetting = 0 Then
lblRestartMiner.Text = "Never"
Else
Dim dCountdown As Double
dCountdown = lMinSetting - lRunning
lblRestartMiner.Text = Trim(dCountdown)
If dCountdown <= 0 Then
ReStartGuiMiner()
Refresh(True)
End If
End If
Catch ex As Exception
End Try
Try
Dim lMinSetting = Val(KeyValue("RestartWallet"))
Dim lRunning = Math.Abs(DateDiff(DateInterval.Minute, RestartedWalletAt, Now))
If lMinSetting = 0 Then
lblRestartWallet.Text = "Never"
Else
Dim dCountdown As Double
dCountdown = lMinSetting - lRunning
lblRestartWallet.Text = Trim(dCountdown)
If dCountdown <= 0 Then
RestartedWalletAt = Now
RestartWallet()
End If
End If
Catch ex As Exception
End Try
bSuccessfullyLoaded = True
End Sub
Public Sub KillGuiMiner()
Try
KillProcess("cgminer*")
KillProcess("reaper*")
KillProcess("guiminer*")
For x = 1 To 4
KillProcess("conhost.exe") 'Kills up to 4 instances of surrogates
Next x
Catch ex As Exception
End Try
End Sub
Public Sub ReStartGuiMiner()
Try
KillGuiMiner()
Threading.Thread.Sleep(200)
Application.DoEvents()
PictureBox1.Refresh()
RestartedMinerAt = Now
Me.Visible = True
Catch ex As Exception
End Try
Dim p As Process
Dim hwnd As IntPtr
Dim sCap As String
sCap = "GUIMiner-scrypt alpha"
Dim iTimeOut As Long
Dim sProcName As String
Dim pi As ProcessStartInfo
Try
p = New Process()
pi = New ProcessStartInfo()
pi.WorkingDirectory = GetGRCAppDir() + "\guiminer\"
pi.UseShellExecute = False
pi.FileName = pi.WorkingDirectory + "guiminer.exe"
pi.WindowStyle = ProcessWindowStyle.Maximized
pi.CreateNoWindow = False
p.StartInfo = pi
If Not File.Exists(pi.FileName) Then
lblThanks.Text = "GUI Miner missing. "
Exit Sub
End If
p.Start()
Application.DoEvents()
Threading.Thread.Sleep(500)
Application.DoEvents()
sProcName = p.ProcessName
Catch ex As Exception
lblThanks.Text = "Error loading GUIMiner."
Exit Sub
End Try
Try
Do While hwnd = 0
For Each guiminer As Process In Process.GetProcesses
If guiminer.ProcessName Like sProcName + "*" Then
' Debug.Print(guiminer.ProcessName)
hwnd = guiminer.Handle
Exit For
End If
Next
System.Threading.Thread.Sleep(300)
iTimeOut = iTimeOut + 1
hwnd = FindWindowByCaption(IntPtr.Zero, sCap)
If CDbl(hwnd) > 1 Then Exit Do
If iTimeOut > 9 Then Exit Do
Application.DoEvents()
Loop
Catch ex As Exception
Try
hwnd = FindWindowByCaption(IntPtr.Zero, sCap)
Catch exx As Exception
End Try
End Try
If 1 = 0 Then
Do While hwnd = 0
'sCap = p.MainWindowTitle
hwnd = FindWindowByCaption(IntPtr.Zero, sCap)
System.Threading.Thread.Sleep(300)
iTimeOut = iTimeOut + 1
If iTimeOut > 500 Then Exit Do
Loop
End If
Dim c As Control
Try
c = PictureBox1
If Not hwnd.Equals(IntPtr.Zero) Then
Dim sThanks As String
sThanks = "Special Thanks go to Taco Time, Kiv MacLeod, m0mchil, and puddinpop for guiminer, cgminer and reaper."
lblThanks.Text = sThanks
pi.WindowStyle = ProcessWindowStyle.Maximized
SetParent(hwnd, c.Handle)
ShowWindow(hwnd, 5)
SetWindowText(hwnd, "Miner1")
RemoveTitleBar(hwnd)
MoveWindow(hwnd, 0, 0, c.Width, c.Height, True)
If c.Width < 910 Then
MoveWindow(hwnd, 0, 0, 917, 386, True)
End If
c.Refresh()
Application.DoEvents()
End If
Catch ex As Exception
lblThanks.Text = "Error initializing guiminer."
Exit Sub
End Try
End Sub
Public Function GetGRCAppDir() As String
Try
Dim fi As New System.IO.FileInfo(Application.ExecutablePath)
Return fi.DirectoryName
Catch ex As Exception
End Try
End Function
Public Sub RestartWallet()
Try
'First kill CGMiner, Reaper and GuiMiner
'Launch GRC Restarter
For x = 1 To 4
KillGuiMiner()
Threading.Thread.Sleep(500) 'Let CGMiner & Reaper close.
Application.DoEvents()
Next
Threading.Thread.Sleep(2000)
Dim p As Process = New Process()
Dim pi As ProcessStartInfo = New ProcessStartInfo()
pi.WorkingDirectory = GetGRCAppDir()
pi.UseShellExecute = True
pi.FileName = "GRCRestarter.exe"
p.StartInfo = pi
p.Start()
Catch ex As Exception
End Try
End Sub
Public Sub ChartBoinc()
Try
Chart1.Series.Clear()
Chart1.Titles.Clear()
Chart1.Titles.Add("Boinc Utilization")
Dim seriesAvgCredits As New Series
seriesAvgCredits.Name = "Avg Daily Credits"
'Dim format As String = "MM.dd.yyyy"
seriesAvgCredits.ChartType = SeriesChartType.Line
Chart1.ChartAreas(0).AxisX.LabelStyle.Format = "MM-dd-yyyy"
Chart1.ChartAreas(0).AxisX.IntervalType = DateTimeIntervalType.Weeks
Dim seriesTotalCredits As New Series
seriesTotalCredits.ChartType = SeriesChartType.FastLine
seriesTotalCredits.Name = "Total Daily Credits"
Dim dProj As Double
Dim seriesProjects As New Series
seriesProjects.Name = "Projects"
Chart1.ChartAreas(0).AxisX.Interval = 1
seriesProjects.ChartType = SeriesChartType.StepLine
Dim lookback As Double '
For x = 30 To 0.5 Step -1.5
lookback = x * 3600 * 24
ReturnBoincCreditsAtPointInTime(lookback)
Dim l1 As Double
Dim l2 As Double
Dim l3 As Double
Dim dAvg As Double
l1 = BoincCredits
ReturnBoincCreditsAtPointInTime(lookback - (3600 * 24))
l2 = BoincCredits
dAvg = BoincCreditsAvg
l3 = Math.Abs(l1 - l2)
Dim pCreditsAvg As New DataPoint
dProj = BoincProjects
Dim d1 As Date = DateAdd(DateInterval.Day, -x, Now)
pCreditsAvg.SetValueXY(d1, dAvg)
seriesAvgCredits.Points.Add(pCreditsAvg)
Dim dpProj As New DataPoint()
dpProj.SetValueXY(d1, dProj * (dAvg / 10))
seriesProjects.Points.Add(dpProj)
Dim pCreditsTotal As New DataPoint()
pCreditsTotal.SetValueXY(d1, l3)
seriesTotalCredits.Points.Add(pCreditsTotal)
Next
Chart1.Series.Add(seriesTotalCredits)
Chart1.Series.Add(seriesAvgCredits)
Chart1.Series.Add(seriesProjects)
Catch ex As Exception
End Try
End Sub
Public Sub ChartBoincUtilization()
Try
ChartUtilization.Series.Clear()
ChartUtilization.Titles.Clear()
ChartUtilization.Titles.Add("Utilization")
Dim sUtilization As New Series
sUtilization.Name = "Utilization"
sUtilization.ChartType = SeriesChartType.Pie
sUtilization.LegendText = "Boinc Utilization"
ChartUtilization.Series.Add(sUtilization)
Dim bu As Double
bu = Math.Round(classUtilization.BoincUtilization, 1)
ChartUtilization.Series("Utilization").Points.AddY(bu)
ChartUtilization.Series("Utilization").Points(0).Label = Trim(bu)
ChartUtilization.Series("Utilization").Points(0).LegendToolTip = Trim(bu) + " utilization."
ChartUtilization.Series("Utilization").Points.AddY(100 - bu)
ChartUtilization.Series("Utilization").Points(1).LegendText = ""
ChartUtilization.Series("Utilization").Points(1).IsVisibleInLegend = False
ChartUtilization.Series("Utilization")("PointWidth") = "0.5"
ChartUtilization.Series("Utilization").IsValueShownAsLabel = False
ChartUtilization.Series("Utilization")("BarLabelStyle") = "Center"
ChartUtilization.ChartAreas(0).Area3DStyle.Enable3D = True
ChartUtilization.Series("Utilization")("DrawingStyle") = "Cylinder"
Catch ex As Exception
End Try
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Call Refresh(False)
End Sub
Private Sub btnRestartMiner_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRestartMiner.Click
Try
ReStartGuiMiner()
Catch ex As Exception
End Try
End Sub
Private Sub RefreshRestartMinutes()
End Sub
Private Sub frmMining_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If bDisposing Then
Me.Close()
Me.Dispose()
KillGuiMiner()
Exit Sub
End If
Me.Hide()
e.Cancel = True
End Sub
Private Sub frmMining_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub btnRestart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRestart.Click
RestartWallet()
End Sub
Private Sub btnCloseWallet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Try
KillGuiMiner()
KillProcess("gridcoin-qt*")
Catch ex As Exception
End Try
End Sub
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
KillGuiMiner()
End Sub
Private Sub btnCloseWallet_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCloseWallet.Click
Try
KillGuiMiner()
KillProcess("gridcoin-qt*")
Catch ex As Exception
End Try
End Sub
Private Sub btnHide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHide.Click
Me.Hide()
End Sub
End Class
|
icede/Gridcoin-master
|
src/boinc/boinc/OldAlgos/frmMining.vb
|
Visual Basic
|
mit
| 13,176
|
' 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.Tasks
Imports Microsoft.CodeAnalysis.Remote.Testing
Namespace Microsoft.CodeAnalysis.Editor.UnitTests.FindReferences
Partial Public Class FindReferencesTests
<WorkItem(539174, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539174")>
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestVisualBasic_OperatorError1(kind As TestKind, host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Module Program
Sub Main(args As String())
Dim b = 5 $$-
End Sub
End Module
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input, kind, host)
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharpFindReferencesOnUnaryOperatorOverload(kind As TestKind, host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class A
{
void Goo()
{
A a;
var x = $$[|-|]a;
}
public static A operator {|Definition:-|}(A a) { return a; }}
}
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input, kind, host)
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharpFindReferencesOnUnaryOperatorOverloadFromDefinition(kind As TestKind, host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class A
{
void Goo()
{
A a;
var x = [|-|]a;
}
public static A operator {|Definition:$$-|}(A a) { return a; }
}
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input, kind, host)
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharpFindReferencesOnBinaryOperatorOverload(kind As TestKind, host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class A
{
void Goo()
{
var x = new A() [|$$+|] new A();
}
public static A operator {|Definition:+|}(A a, A b) { return a; }
}
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input, kind, host)
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharpFindReferencesOnBinaryOperatorOverloadFromDefinition(kind As TestKind, host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class A
{
void Goo()
{
var x = new A() [|+|] new A();
}
public static A operator {|Definition:$$+|}(A a, A b) { return a; }
}
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input, kind, host)
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestVisualBasicFindReferencesOnUnaryOperatorOverload(kind As TestKind, host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class A
Public Shared Operator {|Definition:-|}(x As A) As A
Return x
End Operator
Sub Goo()
Dim a As A
Dim b = $$[|-|]a
End Sub
End Class
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input, kind, host)
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestVisualBasicFindReferencesOnUnaryOperatorOverloadFromDefinition(kind As TestKind, host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class A
Public Shared Operator {|Definition:$$-|}(x As A) As A
Return x
End Operator
Sub Goo()
Dim a As A
Dim b = [|-|]a
End Sub
End Class
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input, kind, host)
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestVisualBasicFindReferencesOnBinaryOperatorOverload(kind As TestKind, host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class A
Public Shared Operator {|Definition:^|}(x As A, y As A) As A
Return y
End Operator
Sub Goo()
Dim a = New A [|^$$|] New A
End Sub
End Class
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input, kind, host)
End Function
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestVisualBasicFindReferencesOnBinaryOperatorOverloadFromDefinition(kind As TestKind, host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class A
Public Shared Operator {|Definition:$$^|}(x As A, y As A) As A
Return y
End Operator
Sub Goo()
Dim a = New A [|^|] New A
End Sub
End Class
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input, kind, host)
End Function
<WorkItem(30642, "https://github.com/dotnet/roslyn/issues/30642")>
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharpFindReferencesOnBuiltInOperatorWithUserDefinedEquivalent(kind As TestKind, host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class A
{
void Goo(string a, string b, int x, int y)
{
var m = a $$[|==|] b;
var n = a [|==|] b;
var o = x == y;
}
}
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input, kind, host)
End Function
<WorkItem(30642, "https://github.com/dotnet/roslyn/issues/30642")>
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestVisualBasicFindReferencesOnBuiltInOperatorWithUserDefinedEquivalent(kind As TestKind, host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
class A
sub Goo(a as string, b as string, x as integer, y as integer)
dim m = a $$[|=|] b
dim n = a [|=|] b
dim o = x = y
end sub
end class
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input, kind, host)
End Function
<WorkItem(30642, "https://github.com/dotnet/roslyn/issues/30642")>
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCrossLanguageFindReferencesOnBuiltInOperatorWithUserDefinedEquivalent_FromCSharp(kind As TestKind, host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class A
{
void Goo(string a, string b, int x, int y)
{
var m = a $$[|==|] b;
var n = a [|==|] b;
var o = x == y;
}
}
</Document>
</Project>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
class A
sub Goo(a as string, b as string, x as integer, y as integer)
dim m = a [|=|] b
dim n = a [|=|] b
dim o = x = y
end sub
end class
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input, kind, host)
End Function
<WorkItem(30642, "https://github.com/dotnet/roslyn/issues/30642")>
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCrossLanguageFindReferencesOnBuiltInOperatorWithUserDefinedEquivalent_FromVisualBasic(kind As TestKind, host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class A
{
void Goo(string a, string b, int x, int y)
{
var m = a [|==|] b;
var n = a [|==|] b;
var o = x == y;
}
}
</Document>
</Project>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
class A
sub Goo(a as string, b as string, x as integer, y as integer)
dim m = a $$[|=|] b
dim n = a [|=|] b
dim o = x = y
end sub
end class
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input, kind, host)
End Function
<WorkItem(44288, "https://github.com/dotnet/roslyn/issues/44288")>
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestOperatorReferenceInGlobalSuppression(kind As TestKind, host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~M:A.[|op_Addition|](A,A)~A")]
class A
{
void Goo()
{
var x = new A() [|$$+|] new A();
}
public static A operator {|Definition:+|}(A a, A b) { return a; }
}
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input, kind, host)
End Function
End Class
End Namespace
|
panopticoncentral/roslyn
|
src/EditorFeatures/Test2/FindReferences/FindReferencesTests.OperatorSymbols.vb
|
Visual Basic
|
mit
| 10,288
|
' 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.Tasks
Imports Microsoft.CodeAnalysis.Scripting
Imports Roslyn.Test.Utilities
Imports Xunit
Namespace Microsoft.CodeAnalysis.VisualBasic.Scripting.UnitTests
Public Class ScriptTests
Inherits TestBase
' It shouldn't be necessary to include VB runtime assembly
' explicitly in VisualBasicScript.Create.
Private Shared ReadOnly s_defaultOptions As ScriptOptions = ScriptOptions.Default.AddReferences(MsvbRef)
<Fact>
Public Sub TestCreateScript()
Dim script = VisualBasicScript.Create("? 1 + 2")
Assert.Equal("? 1 + 2", script.Code)
End Sub
<Fact>
Public Sub TestEvalScript()
Dim value = VisualBasicScript.EvaluateAsync("? 1 + 2", s_defaultOptions)
Assert.Equal(3, value.Result)
End Sub
<Fact>
Public Async Function TestRunScript() As Task
Dim state = Await VisualBasicScript.RunAsync("? 1 + 2", s_defaultOptions)
Assert.Equal(3, state.ReturnValue)
End Function
<Fact>
Public Async Function TestCreateAndRunScript() As Task
Dim script = VisualBasicScript.Create("? 1 + 2", s_defaultOptions)
Dim state = Await script.RunAsync()
Assert.Same(script, state.Script)
Assert.Equal(3, state.ReturnValue)
End Function
<Fact>
Public Async Function TestRunScriptWithSpecifiedReturnType() As Task
Dim state = Await VisualBasicScript.RunAsync("? 1 + 2", s_defaultOptions)
Assert.Equal(3, state.ReturnValue)
End Function
<Fact>
Public Sub TestGetCompilation()
Dim script = VisualBasicScript.Create("? 1 + 2")
Dim compilation = script.GetCompilation()
Assert.Equal(script.Code, compilation.SyntaxTrees.First().GetText().ToString())
End Sub
<Fact>
Public Async Function TestRunVoidScript() As Task
Dim state = Await VisualBasicScript.RunAsync("System.Console.WriteLine(0)", s_defaultOptions)
Assert.Null(state.ReturnValue)
End Function
<Fact>
Public Sub TestDefaultNamespaces()
' If this ever changes, it is important to ensure that the
' IDE is also updated with the same default namespaces.
Assert.Empty(ScriptOptions.Default.Imports)
End Sub
' TODO: port C# tests
End Class
End Namespace
|
ErikSchierboom/roslyn
|
src/Scripting/VisualBasicTest/ScriptTests.vb
|
Visual Basic
|
apache-2.0
| 2,693
|
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Imports System.IO
Imports DTIImageManager.dsImageManager
Imports DTIImageManager.SharedImageVariables
'#If DEBUG Then
Partial Class ViewImage
Inherits BaseClasses.BaseSecurityPage
'#Else
' <ComponentModel.EditorBrowsable(ComponentModel.EditorBrowsableState.Never), ComponentModel.ToolboxItem(False)> _
' Partial Class ViewImage
' Inherits BaseClasses.BaseSecurityPage
'#End If
#Region "Query String properties"
Const _maxheight As Integer = 10000000
Const _maxwidth As Integer = 10000000
Public ReadOnly Property reqwidth() As Integer
Get
If Request.Params("width") Is Nothing Then Return 0
Return Request.Params("width")
End Get
End Property
Public ReadOnly Property reqheight() As Integer
Get
If Request.Params("height") Is Nothing Then Return 0
Return Request.Params("height")
End Get
End Property
Public ReadOnly Property forceSize() As Boolean
Get
If Request.Params("maxHeight") Is Nothing AndAlso Request.Params("maxWidth") Is Nothing Then
If Request.Params("forcesize") Is Nothing Then Return True
If Request.Params("forcesize").ToLower() = "n" Then Return False
If Request.Params("forcesize").ToLower() = "0" Then Return False
Return True
End If
If Request.Params("forcesize") Is Nothing Then Return False
If Request.Params("forcesize").ToLower() = "y" Then Return True
If Request.Params("forcesize").ToLower() = "1" Then Return True
Return False
End Get
End Property
Public ReadOnly Property maxHeight() As Integer
Get
If Request.Params("maxHeight") Is Nothing Then Return _maxheight
Return Request.Params("maxHeight")
End Get
End Property
Public ReadOnly Property maxWidth() As Integer
Get
If Request.Params("maxWidth") Is Nothing Then Return _maxwidth
Return Request.Params("maxWidth")
End Get
End Property
Private cropoffsetValue As Double = -2
Public ReadOnly Property cropOffset() As Double
Get
Dim ret As Double = 0
If Double.TryParse(Request.Params("cropoffset"), ret) Then
Return ret
End If
Return cropoffsetValue
End Get
End Property
Public ReadOnly Property sizeHeight() As String
Get
Return Request.Params("sizeHeight")
End Get
End Property
Private _img_id As Integer = -1
Public ReadOnly Property img_id() As Integer
Get
If _img_id = -1 Then
If Not Integer.TryParse(Request.Params("Id"), _img_id) Then
_img_id = -1
End If
End If
Return _img_id
End Get
End Property
Public ReadOnly Property ParamCount As Integer
Get
Return Request.Params.Count
End Get
End Property
#End Region
#Region "Overidable data acessors"
Protected Overridable Function getRow() As DataRow
Dim img_row As DataRow = myImages.FindById(img_id)
If img_row Is Nothing Then
sqlHelper.SafeFillTable("select * from DTIImageManager where id = @img_id", myImages, New Object() {img_id})
img_row = myImages.FindById(img_id)
End If
Return img_row
End Function
Protected Overridable Function getRowHeight(ByVal row As DataRow) As Integer
Try
Return row("Height")
Catch ex As Exception
End Try
Return 0
End Function
Protected Overridable Function getRowWidth(ByVal row As DataRow) As Integer
Try
Return row("Width")
Catch ex As Exception
End Try
Return 0
End Function
Protected Overridable Function getRowContentType(ByVal row As DataRow) As String
Try
Return row("Image_Content_Type")
Catch ex As Exception
End Try
Return "image/jpeg"
End Function
Protected Overridable Function getRowFilename(ByVal row As DataRow) As String
Try
Return row("Original_Filename")
Catch ex As Exception
End Try
Return ""
End Function
Protected Overridable Function getRowImageData(ByVal row As DataRow) As Byte()
Return row("Image")
End Function
#End Region
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Response.IsClientConnected Then Return
Dim img_row As DataRow = getRow()
If Not img_row Is Nothing Then
Response.ContentType = getRowContentType(img_row)
Try
Dim img As Byte()
Dim height As Integer = 0
Dim width As Integer = 0
If getRowHeight(img_row) = 0 OrElse getRowWidth(img_row) = 0 OrElse ParamCount = 1 Then
img = getRowImageData(img_row)
Else
If forceSize AndAlso reqheight > 0 AndAlso reqwidth > 0 Then
img = processImageArr(getRowImageData(img_row), getRowContentType(img_row), reqheight, reqwidth, True, cropOffset)
Else
getDimensions(height, width, getRowHeight(img_row), getRowWidth(img_row))
If height = getRowHeight(img_row) AndAlso width = getRowWidth(img_row) Then
img = getRowImageData(img_row)
Else
img = processImageArr(getRowImageData(img_row), getRowContentType(img_row), height, width)
End If
End If
End If
Response.AddHeader("Content-Disposition", "inline; filename=""" & getRowFilename(img_row) & """")
Response.OutputStream.Write(img, 0, img.Length)
HttpContext.Current.ApplicationInstance.CompleteRequest() 'Response.End()
Catch ex As Exception
Response.Write(ex.Message)
End Try
End If
End Sub
Public Shared Function GZipSupported() As Boolean
Dim AcceptEncoding As String = System.Web.HttpContext.Current.Request.Headers("Accept-Encoding")
If AcceptEncoding Is Nothing Then Return False
If Not String.IsNullOrEmpty(AcceptEncoding) And (AcceptEncoding.Contains("gzip") Or AcceptEncoding.Contains("deflate")) Then
Return True
End If
Return False
End Function
Public Shared LastModified As Date = Nothing
Public Function isModified() As Boolean
Dim modSince As DateTime
If Not String.IsNullOrEmpty(Request.Headers("If-None-Match")) Then
If Request.Headers("If-None-Match") = etag Then Return False Else Return True
End If
If Not String.IsNullOrEmpty(("If-Modified-Since")) Then
If Date.TryParse(Request.Headers("If-Modified-Since"), modSince) Then
If LastModified.AddSeconds(-1) > modSince Then
Return True
Else
Return False
End If
End If
End If
Return True
End Function
Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
If LastModified = Nothing Then LastModified = Date.Now
Response.Cache.SetCacheability(Web.HttpCacheability.ServerAndPrivate)
Response.Cache.SetLastModified(LastModified)
Response.AppendHeader("Vary", "Content-Encoding")
Response.Cache.SetETag(etag)
If Not isModified() Then
Response.StatusCode = 304
Response.StatusDescription = "Not Modified"
Response.AddHeader("Content-Length", "0")
Response.Cache.SetCacheability(Web.HttpCacheability.Public)
Response.Cache.SetLastModified(LastModified)
BaseClasses.DataBase.endResponse()
Return
End If
If GZipSupported() Then
Dim AcceptEncoding As String = System.Web.HttpContext.Current.Request.Headers("Accept-Encoding")
If AcceptEncoding.Contains("deflate") Then
Response.Filter = New System.IO.Compression.DeflateStream(Response.Filter, System.IO.Compression.CompressionMode.Compress)
Response.AppendHeader("Content-Encoding", "deflate")
Else
Response.Filter = New Compression.GZipStream(Response.Filter, Compression.CompressionMode.Compress)
Response.AddHeader("Content-Encoding", "gzip")
End If
End If
End Sub
''' <summary>
''' Generates a MD5 hash of a given password
''' </summary>
''' <param name="input">String to hash</param>
''' <returns>MD5 hash of String</returns>
''' <remarks></remarks>
<System.ComponentModel.Description("Generates a MD5 hash of a given password")> _
Public Shared Function GenerateHash(ByVal input As String) As String
Dim md5Hasher As New System.Security.Cryptography.MD5CryptoServiceProvider()
Dim hashedBytes As Byte()
Dim encoder As New System.Text.UTF8Encoding()
hashedBytes = md5Hasher.ComputeHash(encoder.GetBytes(input))
Dim strOutput As New System.Text.StringBuilder(hashedBytes.Length)
For i As Integer = 0 To hashedBytes.Length - 1
strOutput.Append(hashedBytes(i).ToString("X2"))
Next
Return strOutput.ToString()
End Function
Public ReadOnly Property etag() As String
Get
Return """" & GenerateHash(img_id & "_" & reqwidth & "_" & reqheight & "_" & maxHeight & "_" & maxWidth & "_" & sizeHeight).Replace("-", "") & """"
End Get
End Property
Public Sub getDimensions(ByRef height As Integer, ByRef width As Integer, ByVal actualHeight As Integer, ByVal actualwidth As Integer)
getDimention(height, width, actualHeight, actualwidth, reqheight, reqwidth, maxHeight, maxWidth, sizeHeight)
End Sub
#Region "Shared Methods"
''' <summary>
''' The height and width are output variables only. For request height use the
''' optioanl parameters reqHeight and reqwidth
''' For quick sizing use the sizeHeight string as the value as either a percentage
''' or S,M,L,XL,XXL for 100,150,225,500,100 pixle images
''' </summary>
''' <param name="height"></param>
''' <param name="width"></param>
''' <param name="actualHeight"></param>
''' <param name="actualwidth"></param>
''' <param name="reqheight"></param>
''' <param name="reqwidth"></param>
''' <param name="maxheight"></param>
''' <param name="maxwidth"></param>
''' <param name="sizeHeight"></param>
''' <remarks></remarks>
<System.ComponentModel.Description("The height and width are output variables only. For request height use the optioanl parameters reqHeight and reqwidth For quick sizing use the sizeHeight string as the value as either a percentage or S,M,L,XL,XXL for 100,150,225,500,100 pixle images")> _
Public Shared Sub getDimention(ByRef height As Integer, ByRef width As Integer, ByVal actualHeight As Integer, ByVal actualwidth As Integer, Optional ByVal reqheight As Integer = 0, Optional ByVal reqwidth As Integer = 0, Optional ByVal maxheight As Integer = 10000, Optional ByVal maxwidth As Integer = 10000, Optional ByVal sizeHeight As String = Nothing)
height = actualHeight
width = actualwidth
If Not sizeHeight Is Nothing Then
sizeHeight = sizeHeight.ToUpper()
If sizeHeight.IndexOf("%") > 0 Then
Dim percent As Double
Try
percent = Double.Parse(sizeHeight.Replace("%", "")) * 0.01
Catch ex As Exception
End Try
height = percent * CType(actualHeight, Double)
width = percent * CType(actualwidth, Double)
Else
Select Case sizeHeight
Case "S"
maxheight = 100
maxwidth = 100
Case "M"
maxheight = 150
maxwidth = 150
Case "L"
maxheight = 225
maxwidth = 225
Case "XL"
maxheight = 500
maxwidth = 500
Case "XXL"
maxheight = 1000
maxwidth = 1000
End Select
End If
End If
If Not reqheight = 0 AndAlso Not reqwidth = 0 Then
height = reqheight
width = reqwidth
ElseIf Not reqheight = 0 Then
height = reqheight
Dim x As Double = actualwidth * reqheight / actualHeight
width = x
ElseIf Not reqwidth = 0 Then
width = reqwidth
Dim y As Double = actualHeight * reqwidth / actualwidth
height = y
End If
If maxwidth < width Then
Dim y As Double = height * maxwidth / width
height = y
width = maxwidth
End If
If maxheight < height Then
Dim x As Double = width * maxheight / height
width = x
height = maxheight
End If
End Sub
Private Shared Sub processImageArrSelect(ByRef Img_Array As Byte(), ByRef pic As Bitmap, ByVal Img_Type As String)
Using toStream As New MemoryStream
Select Case Img_Type
Case "gif"
'Dim quantizer As New OctreeQuantizer(255, 8)
'Using quantized As Bitmap = quantizer.Quantize(pic)
' quantized.Save(toStream, ImageFormat.Gif)
'End Using
pic.MakeTransparent(pic.GetPixel(0, 0))
pic.Save(toStream, ImageFormat.Png)
Img_Array = toStream.ToArray()
'Case "pjpeg"
' pic.Save(toStream, ImageFormat.Jpeg)
' Img_Array = toStream.ToArray()
'Case "jpeg"
' pic.Save(toStream, ImageFormat.Jpeg)
' Img_Array = toStream.ToArray()
Case Else '"x-png"
pic.Save(toStream, ImageFormat.Png)
Img_Array = toStream.ToArray()
'Case Else
' Dim info As ImageCodecInfo() = ImageCodecInfo.GetImageEncoders()
' Dim encoderParameters As EncoderParameters
' encoderParameters = New EncoderParameters(1)
' encoderParameters.Param(0) = New EncoderParameter(Encoder.Quality, 100)
' pic.Save(toStream, info(1), encoderParameters)
' 'pic.Save(toStream, ImageFormat.Jpeg)
' Img_Array = toStream.ToArray()
End Select
End Using
End Sub
Public Shared Function processImageArr(ByVal _imgArr As Byte(), ByVal cntType As String, ByVal _height As Integer, ByVal _width As Integer, Optional ByVal forceSize As Boolean = False, Optional ByVal cropOffset As Double = -2, Optional ByVal orientation As RotateFlipType = RotateFlipType.RotateNoneFlipNone) As Byte()
'get the image from the bytestream
Using ms As New MemoryStream(_imgArr)
Using myImage As Image = Image.FromStream(ms)
'This code auto-orients images taken from cell phones
If orientation = 0 AndAlso Array.IndexOf(myImage.PropertyIdList, 274) > -1 Then
Select Case CInt(myImage.GetPropertyItem(274).Value(0))
Case 1
orientation = RotateFlipType.RotateNoneFlipNone
Exit Select
Case 2
orientation = RotateFlipType.RotateNoneFlipX
Exit Select
Case 3
orientation = RotateFlipType.Rotate180FlipNone
Exit Select
Case 4
orientation = RotateFlipType.Rotate180FlipX
Exit Select
Case 5
orientation = RotateFlipType.Rotate90FlipX
Exit Select
Case 6
orientation = RotateFlipType.Rotate90FlipNone
Exit Select
Case 7
orientation = RotateFlipType.Rotate270FlipX
Exit Select
Case 8
orientation = RotateFlipType.Rotate270FlipNone
Exit Select
End Select
myImage.RemovePropertyItem(274)
End If
If orientation = Nothing Then orientation = RotateFlipType.RotateNoneFlipNone
If orientation = 1 OrElse orientation = 3 OrElse orientation = 5 OrElse orientation = 7 Then
Dim tmp As Integer = _height
_height = _width
_width = tmp
End If
If _height = 0 OrElse _width = 0 Then _
getDimention(_height, _width, myImage.Height, myImage.Width, _height, _width)
'If Not orientation = RotateFlipType.RotateNoneFlipNone Then
'End If
' This EXIF data is now invalid and should be removed.
'height and width processing
Dim proHeight As Integer = _height
Dim proWidth As Integer = _width
If forceSize Then
Dim matchwidth As Boolean = Math.Abs(myImage.Height - _height) > Math.Abs(myImage.Width - _width)
If matchwidth Then
If _height > myImage.Height * (_width / myImage.Width) Then matchwidth = False
Else
If _width > myImage.Width * (_height / myImage.Height) Then matchwidth = True
End If
If matchwidth Then
proWidth = _width
proHeight = myImage.Height * (_width / myImage.Width)
Else
proWidth = myImage.Width * (_height / myImage.Height)
proHeight = _height
End If
If cropOffset < -1 OrElse cropOffset > 1 Then
If myImage.Width > myImage.Height Then
cropOffset = 0
Else
cropOffset = -0.9
End If
End If
End If
Dim Format As PixelFormat = myImage.PixelFormat
If Format.ToString().Contains("Indexed") Then
Format = PixelFormat.Format24bppRgb
End If
Dim processedBP As Bitmap = New Bitmap(proWidth, proHeight, Format)
Dim g As Graphics = Graphics.FromImage(processedBP)
Try
Dim ia As New ImageAttributes
ia.SetWrapMode(WrapMode.TileFlipXY)
g.SmoothingMode = SmoothingMode.HighQuality
g.InterpolationMode = InterpolationMode.HighQualityBicubic
g.PixelOffsetMode = PixelOffsetMode.HighQuality
Dim rect As Rectangle = New Rectangle(0, 0, proWidth,
proHeight)
g.DrawImage(myImage, rect, 0, 0, myImage.Width, myImage.Height, GraphicsUnit.Pixel, ia)
If forceSize Then
processedBP = cropImage(processedBP, _width, _height, cropOffset)
End If
processedBP.RotateFlip(orientation)
'processedBP.RotateFlip(RotateFlipType.Rotate180FlipNone)
'processedBP.RotateFlip(RotateFlipType.Rotate180FlipNone)
'processedBP.MakeTransparent()
Dim imgType As String = cntType.Substring(cntType.LastIndexOf("/") + 1)
processImageArrSelect(_imgArr, processedBP, imgType)
Finally
g.Dispose()
processedBP.Dispose()
End Try
End Using
End Using
Return _imgArr
End Function
Public Shared Function cropImage(ByVal img As Image, ByVal width As Integer, ByVal height As Integer, Optional ByVal Cropoffset As Double = 0) As Image
Dim rec As Rectangle
Cropoffset = Cropoffset + 1
Dim wid As Double = (img.Width - width) * (Cropoffset / 2)
Dim hei As Double = (img.Height - height) * (Cropoffset / 2)
rec = New Rectangle(wid, hei, width, height)
'If Cropoffset = -1 Then
' rec = New Rectangle(0, 0, width, height)
'ElseIf Cropoffset = 1 Then
' rec = New Rectangle((img.Width - width), (img.Height - height), width, height)
'Else
' rec = New Rectangle((img.Width - width) / 2, (img.Height - height) / 2, width, height)
'End If
Return cropImage(img, rec)
End Function
Public Shared Function cropImage(ByVal img As Image, ByVal croparea As Rectangle) As Image
Dim bm As New Bitmap(img)
Dim bmCrop As Bitmap = bm.Clone(croparea, bm.PixelFormat)
Return bmCrop
End Function
Public Shared Sub getHeightWidth(ByRef _imgArr As Byte(), ByRef height As Integer, ByRef width As Integer)
Dim ms As New MemoryStream
Dim myImage As Image = Nothing
Try
ms.Write(_imgArr, 0, _imgArr.Length)
myImage = Image.FromStream(ms)
height = myImage.Height
width = myImage.Width
Catch ex As Exception
height = 0
width = 0
End Try
End Sub
Shared Function getZoomableThmb(ByVal id As Integer, Optional ByVal tmbsize As Integer = 120, Optional ByVal caption As String = "") As String
Dim myHS As New ImageThumb
myHS.ImageId = id
If caption <> "" Then myHS.Caption = caption
myHS.ThumbSize = tmbsize
Return myHS.outputValue
End Function
#End Region
End Class
|
Micmaz/DTIControls
|
DTIContentManagement/DTIImageManager/ViewImage.aspx.vb
|
Visual Basic
|
mit
| 20,747
|
'------------------------------------------------------------------------------
' <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
Partial Public Class Customers
'''<summary>
'''form1 control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents form1 As Global.System.Web.UI.HtmlControls.HtmlForm
'''<summary>
'''customersList1 control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents customersList1 As Global.System.Web.UI.WebControls.GridView
'''<summary>
'''customersListResponse control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents customersListResponse As Global.System.Web.UI.WebControls.Label
'''<summary>
'''Label4 control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents Label4 As Global.System.Web.UI.WebControls.Label
'''<summary>
'''customersListDropDown control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents customersListDropDown As Global.System.Web.UI.WebControls.DropDownList
'''<summary>
'''Label5 control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents Label5 As Global.System.Web.UI.WebControls.Label
'''<summary>
'''cardsListDropdown control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents cardsListDropdown As Global.System.Web.UI.WebControls.DropDownList
'''<summary>
'''Label6 control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents Label6 As Global.System.Web.UI.WebControls.Label
'''<summary>
'''amount control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents amount As Global.System.Web.UI.WebControls.TextBox
'''<summary>
'''chargeCustomer control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents chargeCustomer As Global.System.Web.UI.WebControls.Button
'''<summary>
'''chargeResponselbl control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents chargeResponselbl As Global.System.Web.UI.WebControls.Label
'''<summary>
'''transactionResponselbl control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents transactionResponselbl As Global.System.Web.UI.WebControls.Label
'''<summary>
'''transactionsList control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents transactionsList As Global.System.Web.UI.WebControls.GridView
End Class
|
passportpayments/dotnet
|
Sample App/PassportPaymentsDemo/PassportPaymentsApi/Customers.aspx.designer.vb
|
Visual Basic
|
mit
| 4,379
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmMainMenu
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.components = New System.ComponentModel.Container()
Me.cmdPlayGame = New System.Windows.Forms.Button()
Me.cmdOptions = New System.Windows.Forms.Button()
Me.cmdExit = New System.Windows.Forms.Button()
Me.lblTitle = New System.Windows.Forms.Label()
Me.tmrTitleColors = New System.Windows.Forms.Timer(Me.components)
Me.SuspendLayout()
'
'cmdPlayGame
'
Me.cmdPlayGame.Location = New System.Drawing.Point(223, 192)
Me.cmdPlayGame.Name = "cmdPlayGame"
Me.cmdPlayGame.Size = New System.Drawing.Size(75, 23)
Me.cmdPlayGame.TabIndex = 0
Me.cmdPlayGame.Text = "Game Start"
Me.cmdPlayGame.UseVisualStyleBackColor = True
'
'cmdOptions
'
Me.cmdOptions.Location = New System.Drawing.Point(223, 221)
Me.cmdOptions.Name = "cmdOptions"
Me.cmdOptions.Size = New System.Drawing.Size(75, 23)
Me.cmdOptions.TabIndex = 2
Me.cmdOptions.Text = "Options"
Me.cmdOptions.UseVisualStyleBackColor = True
'
'cmdExit
'
Me.cmdExit.Location = New System.Drawing.Point(223, 250)
Me.cmdExit.Name = "cmdExit"
Me.cmdExit.Size = New System.Drawing.Size(75, 34)
Me.cmdExit.TabIndex = 3
Me.cmdExit.Text = "Return to Desktop"
Me.cmdExit.UseVisualStyleBackColor = True
'
'lblTitle
'
Me.lblTitle.Font = New System.Drawing.Font("Impact", 48.0!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblTitle.ForeColor = System.Drawing.Color.White
Me.lblTitle.Location = New System.Drawing.Point(25, 28)
Me.lblTitle.Name = "lblTitle"
Me.lblTitle.Size = New System.Drawing.Size(474, 116)
Me.lblTitle.TabIndex = 4
Me.lblTitle.Text = "BAND BLASTER"
Me.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'tmrTitleColors
'
Me.tmrTitleColors.Enabled = True
Me.tmrTitleColors.Interval = 50
'
'frmMainMenu
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.Color.Black
Me.ClientSize = New System.Drawing.Size(521, 436)
Me.Controls.Add(Me.lblTitle)
Me.Controls.Add(Me.cmdExit)
Me.Controls.Add(Me.cmdOptions)
Me.Controls.Add(Me.cmdPlayGame)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmMainMenu"
Me.Text = "BAND BLASTER"
Me.ResumeLayout(False)
End Sub
Friend WithEvents cmdPlayGame As System.Windows.Forms.Button
Friend WithEvents cmdOptions As System.Windows.Forms.Button
Friend WithEvents cmdExit As System.Windows.Forms.Button
Friend WithEvents lblTitle As System.Windows.Forms.Label
Friend WithEvents tmrTitleColors As System.Windows.Forms.Timer
End Class
|
cessnao3/orientation-client
|
BAND BLASTER UNPUBLISHED/McPhinal/MainMenu.Designer.vb
|
Visual Basic
|
mit
| 4,070
|
' 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.Reflection.Metadata
Imports Microsoft.CodeAnalysis.CodeGen
Imports Microsoft.CodeAnalysis.ExpressionEvaluator
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols.Metadata.PE
Imports Microsoft.VisualStudio.Debugger.Evaluation
Imports Roslyn.Test.PdbUtilities
Imports Roslyn.Test.Utilities
Imports Xunit
Imports Resources = Microsoft.CodeAnalysis.ExpressionEvaluator.UnitTests.Resources
Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests
Public Class WinMdTests
Inherits ExpressionCompilerTestBase
''' <summary>
''' Handle runtime assemblies rather than Windows.winmd
''' (compile-time assembly) since those are the assemblies
''' loaded in the debuggee.
''' </summary>
<WorkItem(981104)>
<ConditionalFact(GetType(OSVersionWin8))>
Public Sub Win8RuntimeAssemblies()
Const source =
"Class C
Shared Sub M(f As Windows.Storage.StorageFolder, p As Windows.Foundation.Collections.PropertySet)
End Sub
End Class"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll, references:=WinRtRefs)
Dim runtimeAssemblies = ExpressionCompilerTestHelpers.GetRuntimeWinMds("Windows.Storage", "Windows.Foundation.Collections")
Assert.True(runtimeAssemblies.Length >= 2)
Dim exeBytes As Byte() = Nothing
Dim pdbBytes As Byte() = Nothing
Dim references As ImmutableArray(Of MetadataReference) = Nothing
comp.EmitAndGetReferences(exeBytes, pdbBytes, references)
Dim runtime = CreateRuntimeInstance(
ExpressionCompilerUtilities.GenerateUniqueName(),
ImmutableArray.Create(MscorlibRef).Concat(runtimeAssemblies), ' no reference to Windows.winmd
exeBytes,
SymReaderFactory.CreateReader(pdbBytes))
Dim context = CreateMethodContext(runtime, "C.M")
Dim errorMessage As String = Nothing
Dim testData = New CompilationTestData()
context.CompileExpression("If(p Is Nothing, f, Nothing)", errorMessage, testData)
testData.GetMethodData("<>x.<>m0").VerifyIL(
"{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.1
IL_0001: brfalse.s IL_0005
IL_0003: ldnull
IL_0004: ret
IL_0005: ldarg.0
IL_0006: ret
}")
End Sub
<Fact>
Public Sub Win8OnWin8()
CompileTimeAndRuntimeAssemblies(
ImmutableArray.Create(
MscorlibRef,
AssemblyMetadata.CreateFromImage(ToVersion1_3(Resources.Windows)).GetReference(),
AssemblyMetadata.CreateFromImage(ToVersion1_3(Resources.LibraryA)).GetReference(),
AssemblyMetadata.CreateFromImage(Resources.LibraryB).GetReference()),
ImmutableArray.Create(
MscorlibRef,
AssemblyMetadata.CreateFromImage(ToVersion1_3(Resources.Windows_Data)).GetReference(),
AssemblyMetadata.CreateFromImage(ToVersion1_3(Resources.Windows_Storage)).GetReference(),
AssemblyMetadata.CreateFromImage(ToVersion1_3(Resources.LibraryA)).GetReference(),
AssemblyMetadata.CreateFromImage(Resources.LibraryB).GetReference()),
"Windows.Storage")
End Sub
<Fact>
Public Sub Win8OnWin10()
CompileTimeAndRuntimeAssemblies(
ImmutableArray.Create(
MscorlibRef,
AssemblyMetadata.CreateFromImage(ToVersion1_3(Resources.Windows)).GetReference(),
AssemblyMetadata.CreateFromImage(ToVersion1_3(Resources.LibraryA)).GetReference(),
AssemblyMetadata.CreateFromImage(Resources.LibraryB).GetReference()),
ImmutableArray.Create(
MscorlibRef,
AssemblyMetadata.CreateFromImage(ToVersion1_4(Resources.Windows_Data)).GetReference(),
AssemblyMetadata.CreateFromImage(ToVersion1_4(Resources.Windows_Storage)).GetReference(),
AssemblyMetadata.CreateFromImage(ToVersion1_3(Resources.LibraryA)).GetReference(),
AssemblyMetadata.CreateFromImage(Resources.LibraryB).GetReference()),
"Windows.Storage")
End Sub
<Fact>
Public Sub Win10OnWin10()
CompileTimeAndRuntimeAssemblies(
ImmutableArray.Create(
MscorlibRef,
AssemblyMetadata.CreateFromImage(ToVersion1_4(Resources.Windows_Data)).GetReference(),
AssemblyMetadata.CreateFromImage(ToVersion1_4(Resources.Windows_Storage)).GetReference(),
AssemblyMetadata.CreateFromImage(ToVersion1_4(Resources.LibraryA)).GetReference(),
AssemblyMetadata.CreateFromImage(Resources.LibraryB).GetReference()),
ImmutableArray.Create(
MscorlibRef,
AssemblyMetadata.CreateFromImage(ToVersion1_4(Resources.Windows)).GetReference(),
AssemblyMetadata.CreateFromImage(ToVersion1_4(Resources.LibraryA)).GetReference(),
AssemblyMetadata.CreateFromImage(Resources.LibraryB).GetReference()),
"Windows")
End Sub
Private Sub CompileTimeAndRuntimeAssemblies(
compileReferences As ImmutableArray(Of MetadataReference),
runtimeReferences As ImmutableArray(Of MetadataReference),
storageAssemblyName As String)
Const source =
"Class C
Shared Sub M(a As LibraryA.A, b As LibraryB.B, t As Windows.Data.Text.TextSegment, f As Windows.Storage.StorageFolder)
End Sub
End Class"
Dim runtime = CreateRuntime(source, compileReferences, runtimeReferences)
Dim context = CreateMethodContext(runtime, "C.M")
Dim errorMessage As String = Nothing
Dim testData = New CompilationTestData()
context.CompileExpression("If(a, If(b, If(t, f)))", errorMessage, testData)
Assert.Null(errorMessage)
testData.GetMethodData("<>x.<>m0").VerifyIL(
"{
// Code size 17 (0x11)
.maxstack 2
IL_0000: ldarg.0
IL_0001: dup
IL_0002: brtrue.s IL_0010
IL_0004: pop
IL_0005: ldarg.1
IL_0006: dup
IL_0007: brtrue.s IL_0010
IL_0009: pop
IL_000a: ldarg.2
IL_000b: dup
IL_000c: brtrue.s IL_0010
IL_000e: pop
IL_000f: ldarg.3
IL_0010: ret
}")
testData = New CompilationTestData()
Dim result = context.CompileExpression("f", errorMessage, testData)
Assert.Null(errorMessage)
Dim methodData = testData.GetMethodData("<>x.<>m0")
methodData.VerifyIL(
"{
// Code size 2 (0x2)
.maxstack 1
IL_0000: ldarg.3
IL_0001: ret
}")
' Check return type is from runtime assembly.
Dim assemblyReference = AssemblyMetadata.CreateFromImage(result.Assembly).GetReference()
Dim comp = VisualBasicCompilation.Create(
assemblyName:=ExpressionCompilerUtilities.GenerateUniqueName(),
references:=runtimeReferences.Concat(ImmutableArray.Create(Of MetadataReference)(assemblyReference)))
Dim assembly = ImmutableArray.CreateRange(result.Assembly)
Using metadata = ModuleMetadata.CreateFromImage(ImmutableArray.CreateRange(assembly))
Dim reader = metadata.MetadataReader
Dim typeDef = reader.GetTypeDef("<>x")
Dim methodHandle = reader.GetMethodDefHandle(typeDef, "<>m0")
Dim [module] = DirectCast(comp.GetMember("<>x").ContainingModule, PEModuleSymbol)
Dim metadataDecoder = New MetadataDecoder([module])
Dim signatureHeader As SignatureHeader = Nothing
Dim metadataException As BadImageFormatException = Nothing
Dim parameters = metadataDecoder.GetSignatureForMethod(methodHandle, signatureHeader, metadataException)
Assert.Equal(parameters.Length, 5)
Dim actualReturnType = parameters(0).Type
Assert.Equal(actualReturnType.TypeKind, TypeKind.Class) ' not error
Dim expectedReturnType = comp.GetMember("Windows.Storage.StorageFolder")
Assert.Equal(expectedReturnType, actualReturnType)
Assert.Equal(storageAssemblyName, actualReturnType.ContainingAssembly.Name)
End Using
End Sub
''' <summary>
''' Assembly-qualified name containing "ContentType=WindowsRuntime",
''' and referencing runtime assembly.
''' </summary>
<WorkItem(1116143)>
<ConditionalFact(GetType(OSVersionWin8))>
Public Sub AssemblyQualifiedName()
Const source =
"Class C
Shared Sub M(f As Windows.Storage.StorageFolder, p As Windows.Foundation.Collections.PropertySet)
End Sub
End Class"
Dim runtime = CreateRuntime(
source,
ImmutableArray.CreateRange(WinRtRefs),
ImmutableArray.Create(MscorlibRef).Concat(ExpressionCompilerTestHelpers.GetRuntimeWinMds("Windows.Storage", "Windows.Foundation.Collections")))
Dim context = CreateMethodContext(
runtime,
"C.M")
Dim aliases = ImmutableArray.Create(
VariableAlias("s", "Windows.Storage.StorageFolder, Windows.Storage, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime"),
VariableAlias("d", "Windows.Foundation.DateTime, Windows.Foundation, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime"))
Dim errorMessage As String = Nothing
Dim testData = New CompilationTestData()
context.CompileExpression(
"If(DirectCast(s.Attributes, Object), d.UniversalTime)",
DkmEvaluationFlags.TreatAsExpression,
aliases,
errorMessage,
testData)
testData.GetMethodData("<>x.<>m0").VerifyIL(
"{
// Code size 55 (0x37)
.maxstack 2
IL_0000: ldstr ""s""
IL_0005: call ""Function Microsoft.VisualStudio.Debugger.Clr.IntrinsicMethods.GetObjectByAlias(String) As Object""
IL_000a: castclass ""Windows.Storage.StorageFolder""
IL_000f: callvirt ""Function Windows.Storage.StorageFolder.get_Attributes() As Windows.Storage.FileAttributes""
IL_0014: box ""Windows.Storage.FileAttributes""
IL_0019: dup
IL_001a: brtrue.s IL_0036
IL_001c: pop
IL_001d: ldstr ""d""
IL_0022: call ""Function Microsoft.VisualStudio.Debugger.Clr.IntrinsicMethods.GetObjectByAlias(String) As Object""
IL_0027: unbox.any ""Windows.Foundation.DateTime""
IL_002c: ldfld ""Windows.Foundation.DateTime.UniversalTime As Long""
IL_0031: box ""Long""
IL_0036: ret
}")
End Sub
Private Function CreateRuntime(
source As String,
compileReferences As ImmutableArray(Of MetadataReference),
runtimeReferences As ImmutableArray(Of MetadataReference)) As RuntimeInstance
Dim comp = CreateCompilationWithMscorlib(
{source},
options:=TestOptions.DebugDll,
assemblyName:=ExpressionCompilerUtilities.GenerateUniqueName(),
references:=compileReferences)
Dim exeBytes As Byte() = Nothing
Dim pdbBytes As Byte() = Nothing
Dim references As ImmutableArray(Of MetadataReference) = Nothing
comp.EmitAndGetReferences(exeBytes, pdbBytes, references)
Return CreateRuntimeInstance(
ExpressionCompilerUtilities.GenerateUniqueName(),
runtimeReferences.AddIntrinsicAssembly(),
exeBytes,
SymReaderFactory.CreateReader(pdbBytes))
End Function
Private Shared Function ToVersion1_3(bytes As Byte()) As Byte()
Return ExpressionCompilerTestHelpers.ToVersion1_3(bytes)
End Function
Private Shared Function ToVersion1_4(bytes As Byte()) As Byte()
Return ExpressionCompilerTestHelpers.ToVersion1_4(bytes)
End Function
End Class
End Namespace
|
HellBrick/roslyn
|
src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/WinMdTests.vb
|
Visual Basic
|
apache-2.0
| 12,654
|
'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 Microsoft.VisualBasic
Imports System
Namespace MultipleGlobeViewers
Partial Public Class SecondaryViewerForm
''' <summary>
''' Required designer variable.
''' </summary>
Private components As System.ComponentModel.IContainer = Nothing
''' <summary>
''' Clean up any resources being used.
''' </summary>
''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso (components IsNot Nothing) Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
#Region "Windows Form Designer generated code"
''' <summary>
''' Required method for Designer support - do not modify
''' the contents of this method with the code editor.
''' </summary>
Private Sub InitializeComponent()
Me.label1 = New System.Windows.Forms.Label()
Me.viewerListBox = New System.Windows.Forms.ListBox()
Me.topDownButton = New System.Windows.Forms.Button()
Me.normalButton = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
' label1
'
Me.label1.AutoSize = True
Me.label1.Location = New System.Drawing.Point(2, 12)
Me.label1.Name = "label1"
Me.label1.Size = New System.Drawing.Size(90, 13)
Me.label1.TabIndex = 0
Me.label1.Text = "Select the Viewer"
'
' viewerListBox
'
Me.viewerListBox.FormattingEnabled = True
Me.viewerListBox.Location = New System.Drawing.Point(98, 12)
Me.viewerListBox.Name = "viewerListBox"
Me.viewerListBox.Size = New System.Drawing.Size(128, 56)
Me.viewerListBox.TabIndex = 1
'
' topDownButton
'
Me.topDownButton.Location = New System.Drawing.Point(29, 83)
Me.topDownButton.Name = "topDownButton"
Me.topDownButton.Size = New System.Drawing.Size(75, 23)
Me.topDownButton.TabIndex = 2
Me.topDownButton.Text = "Top Down"
Me.topDownButton.UseVisualStyleBackColor = True
'
' normalButton
'
Me.normalButton.Location = New System.Drawing.Point(129, 83)
Me.normalButton.Name = "normalButton"
Me.normalButton.Size = New System.Drawing.Size(75, 23)
Me.normalButton.TabIndex = 3
Me.normalButton.Text = "Syncd Up"
Me.normalButton.UseVisualStyleBackColor = True
'
' SecondaryViewerForm
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(235, 113)
Me.Controls.Add(Me.normalButton)
Me.Controls.Add(Me.topDownButton)
Me.Controls.Add(Me.viewerListBox)
Me.Controls.Add(Me.label1)
Me.Name = "SecondaryViewerForm"
Me.Text = "SecondaryViewer"
Me.TopMost = True
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
Private label1 As System.Windows.Forms.Label
Public viewerListBox As System.Windows.Forms.ListBox
Public topDownButton As System.Windows.Forms.Button
Public normalButton As System.Windows.Forms.Button
End Class
End Namespace
|
Esri/arcobjects-sdk-community-samples
|
Net/3D/MultipleGlobeViewers/VBNet/SecondaryViewerForm.designer.vb
|
Visual Basic
|
apache-2.0
| 3,563
|
Imports System.Data
Imports System.IO
Imports System.Windows.Forms
Imports M_OrderLibrary.LibUtility
Public Class LibDb
#If CONFIG = "Desktop" Then
Public Shared FolderBase As String = LibUtility.HomeDir()
#Else
Public Const FolderBase As String = "\My Documents\"
#End If
Public Shared FolderFoto As String = FolderBase & "Foto\"
Private Shared DB_Name As String = "PocketDataSql.sdf"
Private Shared DB_FileName As String = HomeDir() + DB_Name
Private Shared DB_DataSource As String = "Data Source = " & DB_FileName
Public Const cartImport As String = "IMPOR_"
Public Const cartExport As String = "EXPOR_"
Public Const cartFoto As String = "Foto"
Public Shared ssceconn As New SqlCeConnection(DB_DataSource)
Public Shared sqlRows As SqlCeCommand
Public Shared sqlSelectRows As SqlCeCommand
Public Shared da As New SqlCeDataAdapter
Public Shared dr As SqlCeDataReader
Public Shared ds As New DataSet
Public Shared pr1 As New SqlCeParameter : Public Shared pr2 As New SqlCeParameter
Public Shared pr3 As New SqlCeParameter : Public Shared pr4 As New SqlCeParameter
Public Shared pr5 As New SqlCeParameter
Public Shared Property propExportFolder(Optional ByVal Folder As String = Nothing) As String
Get
If String.IsNullOrEmpty(Folder) Then
Return FolderBase
Else
Return (FolderBase & Folder & "\Export")
End If
End Get
Set(ByVal value As String)
If Not Directory.Exists(FolderBase & value) Then
Directory.CreateDirectory(FolderBase & value)
End If
If Not String.IsNullOrEmpty(value) AndAlso Not Directory.Exists(FolderBase & value & "\Export") Then
Directory.CreateDirectory(FolderBase & value & "\Export")
End If
End Set
End Property
Public Shared Property propImportFolder(Optional ByVal Folder As String = Nothing) As String
Get
If String.IsNullOrEmpty(Folder) Then
Return FolderBase
Else
Return (FolderBase & Folder & "\Import")
End If
End Get
Set(ByVal value As String)
If Not Directory.Exists(FolderBase & value) Then
Directory.CreateDirectory(FolderBase & value)
End If
If Not String.IsNullOrEmpty(value) AndAlso Not Directory.Exists(FolderBase & value & "\Import") Then
Directory.CreateDirectory(FolderBase & value & "\Import")
End If
If Not String.IsNullOrEmpty(value) AndAlso Not Directory.Exists(FolderFoto) Then
Directory.CreateDirectory(FolderFoto.TrimEnd("\"c))
End If
End Set
End Property
Public Shared Property propDB_Name() As String
Get
Return DB_Name
End Get
Set(ByVal value As String)
DB_Name = value
End Set
End Property
Public Shared Property propDB_FileName() As String
Get
Return DB_FileName
End Get
Set(ByVal value As String)
DB_FileName = value
End Set
End Property
Public Shared Property propDataSource() As String
Get
Return DB_DataSource
End Get
Set(ByVal value As String)
DB_DataSource = value
End Set
End Property
Public Shared Function GetClienteAgente(ByVal CodiceCliente As String) As String
GetClienteAgente = Nothing
Try
ssceconn.Open()
sqlSelectRows = ssceconn.CreateCommand()
sqlSelectRows.CommandText = "SELECT (PECRI + '... ' + PEIND) AS PERA1 From Clienti WHERE PECOD='" & _
CodiceCliente & "'"
GetClienteAgente = sqlSelectRows.ExecuteScalar
Catch ex As Exception
LibError.DisplaySQLCEErrors(ex)
Finally
ssceconn.Close()
End Try
If String.IsNullOrEmpty(GetClienteAgente) Then GetClienteAgente = "#N/D"
Return GetClienteAgente
End Function
Private Shared Function Test_Db(ByVal datasource As String) As String
Dim result As String
Dim ssceconntest As New SqlCeConnection(datasource)
Try
ssceconntest.Open()
Catch ex As SqlCeException
Return "Error:" & ex.NativeError.ToString
End Try
sqlRows = ssceconntest.CreateCommand()
sqlRows.CommandText = "select dbver from contaid"
result = sqlRows.ExecuteScalar
ssceconntest.Close()
ssceconntest.Dispose()
Return result
End Function
Public Shared Function Test_Connection() As Boolean
Dim result As Boolean = False
Try
'Verifica se file è readonly ed esiste
Dim di As New FileInfo(DB_FileName)
If di.Exists Then
If (di.Attributes And FileAttributes.ReadOnly) = FileAttributes.ReadOnly Then
di.Attributes = FileAttributes.Normal Or FileAttributes.Archive
End If
Else
LibError.DisplaySQLCEErrors("Attenzione non è presente il database.")
Return result
End If
Dim result_version As String = Test_Db(DB_DataSource)
If Not result_version.StartsWith("Error") Then
Dim UpdateDb As New LibUpdateDB
result = UpdateDb.Allinea_Db(HomeDir()) 'Allineamento della versione DB.
ElseIf result_version = "Error:28609" Then
result = UpgradeDB()
ElseIf result_version Is Nothing Then
LibDb.CorrezioneDB() ' Se ci sono problemi compatta il db.
result = True
End If
Catch ex As SqlCeException
LibError.DisplaySQLCEErrors(ex)
Finally
ssceconn.Close()
End Try
Return result
End Function
Private Shared Function UpgradeDB() As Boolean
Dim result As Boolean = False
'update.exe /s "\dir1\source.sdf" /sp "password1" /d "\dir2\destination.sdf" /dp "password2" /e /q
Dim libfile As New LibFile
Dim destdir As String = HomeDir()
Dim destfile As String = destdir & "UpdatedDb.sdf"
Dim programma As String = destdir & "upgrade.exe"
Dim parametri As String = "/S """ & DB_FileName & """ /D """ & destfile & """ /Q"
If File.Exists(destfile) Then File.Delete(destfile)
MessageBox.Show("Sta per essere avviata la conversione, attendere...")
Process.Start(programma, parametri).WaitForExit()
If Test_Db("Data Source = " & destfile) Is Nothing Then
result = False
File.Delete(destfile)
MessageBox.Show("Conversione fallita!.")
Else
Dim UpdateDb As New LibUpdateDB
File.Delete(DB_FileName)
File.Move(destfile, DB_FileName)
result = UpdateDb.Allinea_Db(HomeDir()) 'Allineamento della versione DB.
MessageBox.Show("Conversione terminata con successo!.")
End If
Return result
End Function
#Region "Riparazione Database"
Public Shared Sub CorrezioneDB()
If Verifica() = False Then
Ripara()
End If
Compatta()
Shrink()
End Sub
Public Shared Sub Compatta()
'Dim engine As New SqlCeEngine("Data Source = AdventureWorks.sdf")
' Specify null destination connection string for in-place compaction
'engine.Compact(Nothing)
' Specify connection string for new database options; The following
' tokens are valid:
' - Password
' - LCID
' - Encrypt
' All other SqlCeConnection.ConnectionString tokens are ignored
'engine.Compact("Data Source=; Password =a@3!7f$dQ;")
Dim engine As New SqlCeEngine(DB_DataSource)
Try
engine.Compact(Nothing)
Catch ex As SqlCeException
LibError.dolog(ex)
Finally
engine.Dispose()
End Try
End Sub
Public Shared Function Verifica() As Boolean
Dim result As Boolean = False
Dim engine As New SqlCeEngine(DB_DataSource)
Try
result = engine.Verify()
Catch ex As Exception
LibError.dolog(ex)
Finally
engine.Dispose()
End Try
Return result
End Function
Public Shared Sub Ripara()
Dim result As Boolean = False
Dim engine As New SqlCeEngine(DB_DataSource)
Try
engine.Repair(Nothing, RepairOption.DeleteCorruptedRows)
Catch ex As Exception
LibError.dolog(ex)
Finally
engine.Dispose()
End Try
End Sub
Private Shared Sub Crea_Db(ByVal Path_Db As String)
Dim engine As New SqlCeEngine(Path_Db)
Try
If File.Exists(Path_Db) Then
File.Delete(Path_Db)
End If
engine.CreateDatabase()
Catch ex As Exception
Finally
engine.Dispose()
End Try
End Sub
Public Shared Sub Shrink()
Dim result As Boolean = False
Dim engine As New SqlCeEngine(DB_DataSource)
Try
engine.Shrink()
Catch ex As Exception
LibError.dolog(ex)
Finally
engine.Dispose()
End Try
End Sub
Public Sub RiGenera_Db()
Exit Sub
Try
Crea_Db(DB_FileName)
sqlRows = ssceconn.CreateCommand()
ssceconn.Open()
'...
LibUpdateDB.Set_DbVer("3.26")
Finally
ssceconn.Close()
End Try
End Sub
Public Sub Delete_Db(ByVal gruppo As String)
sqlRows = ssceconn.CreateCommand()
Try
ssceconn.Open()
If gruppo = "STATS" Or gruppo = "ALL" Then
sqlRows.CommandText = "delete from StatisticheFatturato"
sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "delete from StatisticheCliente"
sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "delete from StatisticheAgente"
sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "delete from StatisticheBudget"
sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "delete from StatisticheMerceologico"
sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "delete from StatisticheOrdini"
sqlRows.ExecuteNonQuery()
End If
If gruppo = "ANAGR" Or gruppo = "ALL" Then
sqlRows.CommandText = "delete from Articoli"
sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "delete from BarcodeArticoli"
sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "delete from Clienti"
sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "delete from FornitoriArticoli"
sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "delete from NoteDestinatari"
sqlRows.ExecuteNonQuery()
End If
If gruppo = "PREZZ" Or gruppo = "ALL" Then
sqlRows.CommandText = "delete from CondizioniVendita"
sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "delete from ListinoArticoli"
sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "delete from Offerte"
sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "delete from OfferteCategoriaClienti"
sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "delete from OfferteClienti"
sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "delete from OfferteZona"
sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "delete from OfferteDescrizione"
sqlRows.ExecuteNonQuery()
End If
If gruppo = "PAGAM" Or gruppo = "ALL" Then
sqlRows.CommandText = "delete from TotaliPagamenti"
sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "delete from PagamentiClienti"
sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "delete from EstrattoContoClienti"
sqlRows.ExecuteNonQuery()
End If
If gruppo = "CAUZI" Or gruppo = "ALL" Then
sqlRows.CommandText = "delete from Vuoti"
sqlRows.ExecuteNonQuery()
End If
If gruppo = "EXTRA" Or gruppo = "ALL" Then
sqlRows.CommandText = "delete from Note"
sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "delete from Ordini"
sqlRows.ExecuteNonQuery()
End If
If gruppo = "SETUP" Then
'sqlRows.CommandText = "delete from Impostazioni"
'sqlRows.ExecuteNonQuery()
sqlRows.CommandText = "update contaid set contaid = '1'"
sqlRows.ExecuteNonQuery()
End If
Finally
ssceconn.Close()
End Try
End Sub
#End Region
End Class
|
maslopop/morder4
|
M-OrderLibrary/LibDb.vb
|
Visual Basic
|
apache-2.0
| 13,427
|
'////////////////////////////////////////////////////////////////////////
' Copyright 2001-2015 Aspose Pty Ltd. All Rights Reserved.
'
' This file is part of Aspose.Imaging. The source code in this file
' is only intended as a supplement to the documentation, and is provided
' "as is", without warranty of any kind, either expressed or implied.
'////////////////////////////////////////////////////////////////////////
Imports Aspose.Cloud
Imports System
Namespace Aspose.Cells.Cloud.Examples.Cells
Friend Class ChangeCellStyleWorksheet
Shared Sub Main()
Dim dataDir As String = Common.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
Dim input As String = "sample1.xlsx"
Dim output As String = "ouput.xlsx"
Dim style As New WorkbookStyle()
Common.StorageService.File.UploadFile(dataDir & input, input, storage:= Common.STORAGE)
Common.CellsService.WorksheetColumns.UpdateCellRangeStyle(input, "Sheet1", "A1:A10", style, Common.FOLDER, storage:= Common.STORAGE)
Common.StorageService.File.DownloadFile(input, dataDir & output, storage:= Common.STORAGE)
End Sub
End Class
End Namespace
|
farooqsheikhpk/Aspose.Cells-for-Cloud
|
Examples/DotNet/VisualBasic/Cells/ChangeCellStyleWorksheet.vb
|
Visual Basic
|
mit
| 1,147
|
Imports System
Imports System.Collections.Generic
Imports Xunit
Imports Xunit.Extensions
Public Class MyTest
<Theory>
<PropertyData("{caret}", PropertyType := GetType(ProvidesPropertyData))>
Public Sub Test1(ByVal value As Int32)
Assert.Equal(42, value)
End Sub
End Class
Public Class ProvidesPropertyData
Public Shared ReadOnly Iterator Property DataEnumerator() As IEnumerable(Of Object())
Get
Yield New Object() { 42 }
End Get
End Property
Public Shared ReadOnly Iterator Property AnotherDataEnumerator() As IEnumerable(Of Object())
Get
Yield New Object() { 42 }
End Get
End Property
Public Shared ReadOnly Iterator Property MoreDataEnumerator() As IEnumerable(Of Object())
Get
Yield New Object() { 42 }
End Get
End Property
End Class
|
derigel23/resharper-xunit
|
resharper/test/data/References/CodeCompletion/ListsPropertyDataCandidatesInOtherClass.vb
|
Visual Basic
|
apache-2.0
| 874
|
Imports CodeCracker.VisualBasic.Design
Imports Xunit
Namespace Design
Public Class EmptyCatchBlockTests
Inherits CodeFixVerifier(Of EmptyCatchBlockAnalyzer, EmptyCatchBlockCodeFixProvider)
Private test As String = "
Imports System
Namespace ConsoleApplication1
Class TypeName
Public Sub Foo()
Try
Dim a = ""A""
Catch
End Try
End Sub
End Class
End Namespace"
<Fact>
Public Async Function EmptyCatchBlockAnalyzerCreateDiagnostic() As Task
Const testWithBlock = "
Imports System
Namespace ConsoleApplication1
Class TypeName
Public Sub Foo()
Try
Dim a = ""A""
Catch
Throw
End Try
End Sub
End Class
End Namespace"
Await VerifyBasicHasNoDiagnosticsAsync(testWithBlock)
End Function
<Fact>
Public Async Function WhenRemoveTryCatchStatement() As Task
Const fix = "
Imports System
Namespace ConsoleApplication1
Class TypeName
Public Sub Foo()
Dim a = ""A""
End Sub
End Class
End Namespace"
Await VerifyBasicFixAsync(test, fix)
End Function
<Fact>
Public Async Function WhenPutExceptionClassInCatchBlock() As Task
Const fix = "
Imports System
Namespace ConsoleApplication1
Class TypeName
Public Sub Foo()
Try
Dim a = ""A""
Catch ex As Exception
Throw
End Try
End Sub
End Class
End Namespace"
Await VerifyBasicFixAsync(test, fix, 1)
End Function
<Fact>
Public Async Function WhenMultipleCatchRemoveOnlySelectedEmpty() As Task
Const multipleTest As String = "
Imports System
Namespace ConsoleApplication1
Class TypeName
Public Async Function Foo() As Task
Try
Dim a = ""A""
Catch aex As ArgumentException
Catch ex As Exception
a = ""B""
End Try
End Function
End Class
End Namespace"
Const multipleFix = "
Imports System
Namespace ConsoleApplication1
Class TypeName
Public Async Function Foo() As Task
Try
Dim a = ""A""
Catch ex As Exception
a = ""B""
End Try
End Function
End Class
End Namespace"
Await VerifyBasicFixAsync(multipleTest, multipleFix, 0)
End Function
End Class
End Namespace
|
adraut/code-cracker
|
test/VisualBasic/CodeCracker.Test/Design/EmptyCatchBlockTests.vb
|
Visual Basic
|
apache-2.0
| 2,612
|
' 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.Generic
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic
''' <summary>
''' A region analysis walker that computes the set of variables whose values flow into (are used in)
''' the region.
''' A variable assigned outside is used inside if an analysis
''' that leaves the variable unassigned on entry to the region would cause the
''' generation of "unassigned" errors within the region.
''' </summary>
Friend Class DataFlowsInWalker
Inherits AbstractRegionDataFlowPass
' TODO: normalize the result by removing variables that are unassigned in an unmodified flow analysis.
Private Sub New(info As FlowAnalysisInfo, region As FlowAnalysisRegionInfo, unassignedVariables As HashSet(Of Symbol))
MyBase.New(info, region, unassignedVariables, trackStructsWithIntrinsicTypedFields:=True)
End Sub
Friend Overloads Shared Function Analyze(info As FlowAnalysisInfo, region As FlowAnalysisRegionInfo,
unassignedVariables As HashSet(Of Symbol),
ByRef succeeded As Boolean?,
ByRef invalidRegionDetected As Boolean) As HashSet(Of Symbol)
' remove static locals from unassigned, otherwise they will never reach ReportUnassigned(...)
Dim unassignedWithoutStatic As New HashSet(Of Symbol)
For Each var In unassignedVariables
If var.Kind <> SymbolKind.Local OrElse Not DirectCast(var, LocalSymbol).IsStatic Then
unassignedWithoutStatic.Add(var)
End If
Next
Dim walker = New DataFlowsInWalker(info, region, unassignedWithoutStatic)
Try
succeeded = walker.Analyze() AndAlso Not walker.InvalidRegionDetected
invalidRegionDetected = walker.InvalidRegionDetected
Return If(succeeded, walker._dataFlowsIn, New HashSet(Of Symbol)())
Finally
walker.Free()
End Try
End Function
Private ReadOnly _dataFlowsIn As HashSet(Of Symbol) = New HashSet(Of Symbol)()
Private Function ResetState(state As LocalState) As LocalState
Dim unreachable As Boolean = Not state.Reachable
state = ReachableState()
If unreachable Then
state.Assign(0)
End If
Return state
End Function
Protected Overrides Sub EnterRegion()
Me.SetState(ResetState(Me.State))
Me._dataFlowsIn.Clear()
MyBase.EnterRegion()
End Sub
Protected Overrides Sub NoteBranch(pending As PendingBranch, stmt As BoundStatement, labelStmt As BoundLabelStatement)
If stmt.Syntax IsNot Nothing AndAlso labelStmt.Syntax IsNot Nothing AndAlso Not IsInsideRegion(stmt.Syntax.Span) AndAlso IsInsideRegion(labelStmt.Syntax.Span) Then
pending.State = ResetState(pending.State)
End If
MyBase.NoteBranch(pending, stmt, labelStmt)
End Sub
Public Overrides Function VisitRangeVariable(node As BoundRangeVariable) As BoundNode
' Sometimes query expressions refer to query range variable just to
' copy its value to a new compound variable. There is no reference
' to the range variable in code and, from user point of view, there is
' no access to it.
' If and only if range variable is declared outside of the region and read inside, it flows in.
If Not node.WasCompilerGenerated AndAlso
IsInside AndAlso
Not IsInsideRegion(node.RangeVariable.Syntax.Span) Then
_dataFlowsIn.Add(node.RangeVariable)
End If
Return Nothing
End Function
Protected Overrides Sub VisitAmbiguousLocalSymbol(ambiguous As DataFlowPass.AmbiguousLocalsPseudoSymbol)
MyBase.VisitAmbiguousLocalSymbol(ambiguous)
' Locals from ambiguous implicit receiver can only be unassigned in *REGION* flow analysis
' if a new region starts after they are declared and before the implicit receiver is referenced;
' region data flow analysis for such regions is prohibited and should return Succeeded = False.
' Check if the first local in the collection was 'unassigned' by entering a region,
' in which case set a flag that the region is not valid
If IsInside Then
Dim firstLocal As LocalSymbol = ambiguous.Locals(0)
If Not Me.State.IsAssigned(VariableSlot(firstLocal)) Then
Me.SetInvalidRegion()
End If
End If
End Sub
Protected Overrides Sub ReportUnassigned(local As Symbol,
node As SyntaxNode,
rwContext As ReadWriteContext,
Optional slot As Integer = SlotKind.NotTracked,
Optional boundFieldAccess As BoundFieldAccess = Nothing)
Debug.Assert(local.Kind <> SymbolKind.Field OrElse boundFieldAccess IsNot Nothing)
If IsInsideRegion(node.Span) Then
Debug.Assert(local.Kind <> SymbolKind.RangeVariable)
If local.Kind = SymbolKind.Field Then
Dim sym As Symbol = GetNodeSymbol(boundFieldAccess)
' Unreachable for AmbiguousLocalsPseudoSymbol: ambiguous implicit
' receiver should not ever be considered unassigned
Debug.Assert(Not TypeOf sym Is AmbiguousLocalsPseudoSymbol)
If sym IsNot Nothing Then
_dataFlowsIn.Add(sym)
End If
Else
_dataFlowsIn.Add(local)
End If
End If
MyBase.ReportUnassigned(local, node, rwContext, slot, boundFieldAccess)
End Sub
Friend Overrides Sub AssignLocalOnDeclaration(local As LocalSymbol, node As BoundLocalDeclaration)
' NOTE: static locals should not be considered assigned even in presence of initializer
If Not local.IsStatic Then
MyBase.AssignLocalOnDeclaration(local, node)
End If
End Sub
End Class
End Namespace
|
shyamnamboodiripad/roslyn
|
src/Compilers/VisualBasic/Portable/Analysis/FlowAnalysis/DataFlowsInWalker.vb
|
Visual Basic
|
apache-2.0
| 6,874
|
'-------------------------------------------------------------------------------------------'
' Inicio del codigo
'-------------------------------------------------------------------------------------------'
' Importando librerias
'-------------------------------------------------------------------------------------------'
Imports System.Data
'-------------------------------------------------------------------------------------------'
' Inicio de clase "rConceptos_ConCC"
'-------------------------------------------------------------------------------------------'
Partial Class rConceptos_ConCC
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
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))
Try
Dim loComandoSeleccionar As New StringBuilder()
'loConsulta.AppendLine("SELECT Cod_Con,")
'loConsulta.AppendLine(" Nom_Con,")
'loConsulta.AppendLine(" Status,")
'loConsulta.AppendLine(" (CASE WHEN Status = 'A' THEN 'Activo' ELSE 'Inactivo' END) AS Status_Conceptos ")
'loConsulta.AppendLine("FROM Conceptos")
'loConsulta.AppendLine("WHERE Cod_Con BETWEEN " & lcParametro0Desde)
'loConsulta.AppendLine(" AND " & lcParametro0Hasta)
'loConsulta.AppendLine(" AND Status IN (" & lcParametro1Desde & ")")
'loConsulta.AppendLine("ORDER BY Cod_Con, Nom_Con")
loComandoSeleccionar.AppendLine("")
loComandoSeleccionar.AppendLine("--Tabla temporal con los registros a listar")
loComandoSeleccionar.AppendLine("CREATE TABLE #tmpRegistros( Codigo VARCHAR(30) COLLATE DATABASE_DEFAULT, ")
loComandoSeleccionar.AppendLine(" Nombre VARCHAR(100) COLLATE DATABASE_DEFAULT, ")
loComandoSeleccionar.AppendLine(" Estatus VARCHAR(15) COLLATE DATABASE_DEFAULT, ")
loComandoSeleccionar.AppendLine(" Contable XML")
loComandoSeleccionar.AppendLine(" );")
loComandoSeleccionar.AppendLine("")
loComandoSeleccionar.AppendLine("INSERT INTO #tmpRegistros(Codigo, Nombre, Estatus, Contable)")
loComandoSeleccionar.AppendLine("SELECT Cod_Con, ")
loComandoSeleccionar.AppendLine(" Nom_Con,")
loComandoSeleccionar.AppendLine(" (CASE Status ")
loComandoSeleccionar.AppendLine(" WHEN 'A' THEN 'Activo' ")
loComandoSeleccionar.AppendLine(" WHEN 'I' THEN 'Inactivo'")
loComandoSeleccionar.AppendLine(" ELSE 'Suspendido' ")
loComandoSeleccionar.AppendLine(" END) AS Status,")
loComandoSeleccionar.AppendLine(" Contable")
loComandoSeleccionar.AppendLine("FROM Conceptos_Nomina")
loComandoSeleccionar.AppendLine("WHERE Conceptos_Nomina.Cod_Con Between " & lcParametro0Desde)
loComandoSeleccionar.AppendLine(" And " & lcParametro0Hasta)
loComandoSeleccionar.AppendLine(" And Conceptos_Nomina.Status IN (" & lcParametro1Desde & ")")
loComandoSeleccionar.AppendLine("")
loComandoSeleccionar.AppendLine("")
loComandoSeleccionar.AppendLine("")
loComandoSeleccionar.AppendLine("")
loComandoSeleccionar.AppendLine("-- En el SELECT final se expande el XML Contable para obtener las ")
loComandoSeleccionar.AppendLine("-- Cuentas Contables, de Gastos y Centros de Costos de cada página del registro ")
loComandoSeleccionar.AppendLine("")
loComandoSeleccionar.AppendLine("SELECT CASE WHEN (LEN(Detalles.Cue_Con_Codigo) > '0' AND (LEN(Detalles.Cue_Con_Codigo) < '9' OR LEN(Detalles.Cue_Con_Codigo) > '9')) THEN '******' ELSE '' END AS Asteriscos,")
loComandoSeleccionar.AppendLine(" #tmpRegistros.Codigo AS Codigo,")
loComandoSeleccionar.AppendLine(" #tmpRegistros.Nombre AS Nombre,")
loComandoSeleccionar.AppendLine(" #tmpRegistros.Estatus AS Estatus,")
loComandoSeleccionar.AppendLine(" #tmpRegistros.Estatus AS Status_Conceptos, ")
loComandoSeleccionar.AppendLine(" COALESCE(Detalles.Numero, 1) AS Numero,")
loComandoSeleccionar.AppendLine(" COALESCE(Detalles.Pagina, '') AS Pagina,")
loComandoSeleccionar.AppendLine(" COALESCE(Detalles.Cue_Con_Codigo, '') AS Cue_Con_Codigo,")
loComandoSeleccionar.AppendLine(" COALESCE(Cuentas_Contables.Nom_Cue, '') AS Cue_Con_Nombre,")
loComandoSeleccionar.AppendLine(" COALESCE(Detalles.Cue_Gas_Codigo, '') AS Cue_Gas_Codigo,")
loComandoSeleccionar.AppendLine(" COALESCE(Cuentas_Gastos.Nom_Gas, '') AS Cue_Gas_Nombre,")
loComandoSeleccionar.AppendLine(" COALESCE(Detalles.Cen_Cos_Codigo, '') AS Cen_Cos_Codigo,")
loComandoSeleccionar.AppendLine(" COALESCE(Centros_Costos.Nom_Cen, '') AS Cen_Cos_Nombre,")
loComandoSeleccionar.AppendLine(" COALESCE(Detalles.Cen_Cos_Porcentaje, 0) AS Cen_Cos_Porcentaje ")
loComandoSeleccionar.AppendLine("FROM #tmpRegistros")
loComandoSeleccionar.AppendLine(" LEFT JOIN ( SELECT Codigo,")
loComandoSeleccionar.AppendLine(" (Ficha.C.value('@n[1]', 'VARCHAR(MAX)')+1) AS Numero,")
loComandoSeleccionar.AppendLine(" Ficha.C.value('@nombre[1]', 'VARCHAR(MAX)') AS Pagina,")
loComandoSeleccionar.AppendLine(" Ficha.C.value('./cue_con[1]', 'VARCHAR(MAX)') AS Cue_Con_Codigo,")
loComandoSeleccionar.AppendLine(" Ficha.C.value('./cue_gas[1]', 'VARCHAR(MAX)') AS Cue_Gas_Codigo,")
loComandoSeleccionar.AppendLine(" Costos.C.value('@codigo[1]', 'VARCHAR(MAX)') AS Cen_Cos_Codigo,")
loComandoSeleccionar.AppendLine(" CAST(Costos.C.value('@porcentaje[1]', 'VARCHAR(MAX)') AS DECIMAL(28,10)) AS Cen_Cos_Porcentaje")
loComandoSeleccionar.AppendLine(" FROM #tmpRegistros")
loComandoSeleccionar.AppendLine(" CROSS APPLY Contable.nodes('contable/ficha') AS Ficha(C)")
loComandoSeleccionar.AppendLine(" OUTER APPLY Contable.nodes('contable/ficha/centro_costo') AS Costos(C)")
loComandoSeleccionar.AppendLine(" ) Detalles")
loComandoSeleccionar.AppendLine(" ON Detalles.Codigo = #tmpRegistros.Codigo")
loComandoSeleccionar.AppendLine(" LEFT JOIN Cuentas_Contables")
loComandoSeleccionar.AppendLine(" ON Cuentas_Contables.Cod_Cue = Detalles.Cue_Con_Codigo")
loComandoSeleccionar.AppendLine(" LEFT JOIN Cuentas_Gastos")
loComandoSeleccionar.AppendLine(" ON Cuentas_Gastos.Cod_Gas = Detalles.Cue_Gas_Codigo")
loComandoSeleccionar.AppendLine(" LEFT JOIN Centros_Costos")
loComandoSeleccionar.AppendLine(" ON Centros_Costos.Cod_Cen = Detalles.Cen_Cos_Codigo")
'loComandoSeleccionar.AppendLine("WHERE Detalles.Cue_Con_Codigo <> '' ")
'loComandoSeleccionar.AppendLine(" AND LEN(Detalles.Cue_Con_Codigo) <> '9' ")
loComandoSeleccionar.AppendLine("ORDER BY #tmpRegistros.Codigo, COALESCE(Detalles.Numero, 1)")
loComandoSeleccionar.AppendLine("")
'Me.mEscribirConsulta(loComandoSeleccionar.ToString())
Dim loServicios As New cusDatos.goDatos
Dim laDatosReporte As DataSet = loServicios.mObtenerTodosSinEsquema(loComandoSeleccionar.ToString(), "curReportes")
loObjetoReporte = cusAplicacion.goReportes.mCargarReporte("rConceptos_ConCC", laDatosReporte)
Me.mTraducirReporte(loObjetoReporte)
Me.mFormatearCamposReporte(loObjetoReporte)
Me.crvrConceptos_ConCC.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 '
'-------------------------------------------------------------------------------------------'
' MJP: 09/07/08: Codigo inicial. '
'-------------------------------------------------------------------------------------------'
' MJP: 11/07/08: Creación objeto que cierra el archivo de reporte. '
'-------------------------------------------------------------------------------------------'
' MJP: 14/07/08: Agregacion filtro Status. '
'-------------------------------------------------------------------------------------------'
' MVP: 04/08/08: Cambios para multi idioma, mensaje de error y clase padre. '
'-------------------------------------------------------------------------------------------'
' RJG: 10/09/14: Ajuste de interfaz y estandarización de código. '
'-------------------------------------------------------------------------------------------'
' JJD: 04/12/14: Programacion de la busqueda de las Cuentas Contables. '
'-------------------------------------------------------------------------------------------'
' JJD: 09/12/14: Ajuste a la emision del reporte. '
'-------------------------------------------------------------------------------------------'
' JJD: 18/12/14: Inclusion del Len de la Cuenta Contable. '
'-------------------------------------------------------------------------------------------'
' EAG: 30/09/15: Comentar linea que escribe la consulta SQL. '
'-------------------------------------------------------------------------------------------'
|
kodeitsolutions/ef-reports
|
Reportes - Nomina/rConceptos_ConCC.aspx.vb
|
Visual Basic
|
mit
| 11,558
|
'------------------------------------------------------------------------------
' <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
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
' or if you encounter build errors in this file, go to the Project Designer
' (go to Project Properties or double-click the My Project node in
' Solution Explorer), and make changes on the Application tab.
'
Partial Friend Class MyApplication
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Sub New()
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
Me.IsSingleInstance = false
Me.EnableVisualStyles = true
Me.SaveMySettingsOnExit = true
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
End Sub
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.Redirect_Creator.Form1
End Sub
End Class
End Namespace
|
alorimer/redirect
|
Redirect Creator/My Project/Application.Designer.vb
|
Visual Basic
|
mit
| 1,482
|
Public Interface IWizardPart
Event IsValidChanged()
Property Order As Integer
ReadOnly Property IsValid As Boolean
ReadOnly Property Instance As Control
ReadOnly Property StepItem As DevComponents.DotNetBar.StepItem
ReadOnly Property Title As String
Sub LoadAndDisplay()
End Interface
|
nublet/DMS
|
DMS.Forms.Shared/Wizards/IWizardPart.vb
|
Visual Basic
|
mit
| 321
|
'-------------------------------------------------------------------------------------------'
' Inicio del codigo
'-------------------------------------------------------------------------------------------'
' Importando librerias
'-------------------------------------------------------------------------------------------'
Imports System.Data
'-------------------------------------------------------------------------------------------'
' Inicio de clase "CGS_rECuentas_Bancos"
'-------------------------------------------------------------------------------------------'
Partial Class CGS_rECuentas_Bancos
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.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(1), goServicios.enuOpcionesRedondeo.KN_FechaInicioDelDia)
Dim lcParametro1Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(1), goServicios.enuOpcionesRedondeo.KN_FechaFinDelDia)
'Dim lcParametro2Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(2), goServicios.enuOpcionesRedondeo.KN_FechaInicioDelDia)
'Dim lcParametro2Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(2), goServicios.enuOpcionesRedondeo.KN_FechaFinDelDia)
'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.mObtenerListaFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(4))
'Dim lcParametro5Desde As String = cusAplicacion.goReportes.paParametrosIniciales(5)
Dim lcOrdenamiento As String = cusAplicacion.goReportes.pcOrden
Dim loComandoSeleccionar As New StringBuilder()
loComandoSeleccionar.AppendLine("DECLARE @lcCodCue_Desde AS VARCHAR(10) = " & lcParametro0Desde)
loComandoSeleccionar.AppendLine("DECLARE @lcCodCue_Hasta AS VARCHAR(10) = " & lcParametro0Hasta)
loComandoSeleccionar.AppendLine("DECLARE @ldFecha_Desde AS DATE = " & lcParametro1Desde)
loComandoSeleccionar.AppendLine("DECLARE @ldFecha_Hasta AS DATE = " & lcParametro1Hasta)
loComandoSeleccionar.AppendLine("")
loComandoSeleccionar.AppendLine("SELECT Movimientos_Cuentas.Cod_Cue, ")
loComandoSeleccionar.AppendLine(" (SUM(Movimientos_Cuentas.Mon_Deb)- SUM(Movimientos_Cuentas.Mon_Hab)) AS Sal_Ini ")
loComandoSeleccionar.AppendLine("INTO #tempSALDOINICIAL ")
loComandoSeleccionar.AppendLine("FROM Movimientos_Cuentas ")
loComandoSeleccionar.AppendLine(" JOIN Cuentas_Bancarias ON Cuentas_Bancarias.Cod_Cue = Movimientos_Cuentas.Cod_Cue ")
loComandoSeleccionar.AppendLine(" JOIN Bancos ON Bancos.Cod_Ban = Cuentas_Bancarias.Cod_Ban ")
loComandoSeleccionar.AppendLine("WHERE Movimientos_Cuentas.Fec_Ini < @ldFecha_Desde ")
loComandoSeleccionar.AppendLine(" AND Movimientos_Cuentas.Cod_Cue BETWEEN @lcCodCue_Desde AND @lcCodCue_Hasta")
loComandoSeleccionar.AppendLine(" AND Movimientos_Cuentas.Status = 'Confirmado'")
loComandoSeleccionar.AppendLine("GROUP BY Movimientos_Cuentas.Cod_Cue ")
loComandoSeleccionar.AppendLine("")
loComandoSeleccionar.AppendLine("SELECT Movimientos_Cuentas.Cod_Cue, ")
loComandoSeleccionar.AppendLine(" Cuentas_Bancarias.Num_Cue, ")
loComandoSeleccionar.AppendLine(" Bancos.Nom_Ban, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cuentas.Fec_Ini, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cuentas.Documento, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cuentas.Cod_Tip, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cuentas.Tip_Doc, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cuentas.Comentario, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cuentas.Tip_Ori, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cuentas.Mon_Deb, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cuentas.Mon_Hab, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cuentas.Mon_Imp1, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cuentas.Referencia, ")
loComandoSeleccionar.AppendLine(" CASE Movimientos_Cuentas.Tip_Ori ")
loComandoSeleccionar.AppendLine(" WHEN 'Cobros' THEN Detalles_Cobros.Fec_Ini ")
loComandoSeleccionar.AppendLine(" WHEN 'Pagos' THEN Detalles_Pagos.Fec_Ini ")
loComandoSeleccionar.AppendLine(" WHEN 'Ordenes_Pagos' THEN Detalles_oPagos.Fec_Ini ")
loComandoSeleccionar.AppendLine(" WHEN 'Depositos' THEN Depositos.Fec_Ini ")
loComandoSeleccionar.AppendLine(" WHEN 'Cuentas_Cobrar' THEN Cuentas_Cobrar.Fec_Ini ")
loComandoSeleccionar.AppendLine(" ELSE NULL ")
loComandoSeleccionar.AppendLine(" END AS Fec_Ini_Detalles")
loComandoSeleccionar.AppendLine("INTO #tempMOVIMIENTO ")
loComandoSeleccionar.AppendLine("FROM Movimientos_Cuentas ")
loComandoSeleccionar.AppendLine(" JOIN Cuentas_Bancarias ON Cuentas_Bancarias.Cod_Cue = Movimientos_Cuentas.Cod_Cue")
loComandoSeleccionar.AppendLine(" AND Movimientos_Cuentas.Cod_Cue BETWEEN @lcCodCue_Desde AND @lcCodCue_Hasta")
loComandoSeleccionar.AppendLine(" JOIN Bancos ON Bancos.Cod_Ban = Cuentas_Bancarias.Cod_Ban")
loComandoSeleccionar.AppendLine(" LEFT JOIN Detalles_Cobros ON Movimientos_Cuentas.Doc_Ori = Detalles_Cobros.Documento")
loComandoSeleccionar.AppendLine(" AND Movimientos_Cuentas.Tip_Ori = 'Cobros'")
loComandoSeleccionar.AppendLine(" AND Detalles_Cobros.Tip_Des = 'Movimientos_Cuentas'")
loComandoSeleccionar.AppendLine(" AND Detalles_Cobros.Doc_Des = Movimientos_Cuentas.Documento")
loComandoSeleccionar.AppendLine(" LEFT JOIN Detalles_Pagos ON Movimientos_Cuentas.Doc_Ori = Detalles_Pagos.Documento")
loComandoSeleccionar.AppendLine(" AND Movimientos_Cuentas.Tip_Ori = 'Pagos'")
loComandoSeleccionar.AppendLine(" AND Detalles_Pagos.Tip_Des = 'Movimientos_Cuentas'")
loComandoSeleccionar.AppendLine(" AND Detalles_Pagos.Doc_Des = Movimientos_Cuentas.Documento")
loComandoSeleccionar.AppendLine(" LEFT JOIN Detalles_oPagos ON Movimientos_Cuentas.Doc_Ori = Detalles_oPagos.Documento")
loComandoSeleccionar.AppendLine(" AND Movimientos_Cuentas.Tip_Ori = 'Ordenes_Pagos'")
loComandoSeleccionar.AppendLine(" AND Detalles_oPagos.Tip_Des = 'Movimientos_Cuentas'")
loComandoSeleccionar.AppendLine(" AND Detalles_oPagos.Doc_Des = Movimientos_Cuentas.Documento")
loComandoSeleccionar.AppendLine(" LEFT JOIN Depositos ON Movimientos_Cuentas.Doc_Ori = Depositos.Documento")
loComandoSeleccionar.AppendLine(" AND Movimientos_Cuentas.Tip_Ori = 'Depositos'")
loComandoSeleccionar.AppendLine(" LEFT JOIN Cuentas_Cobrar ON Movimientos_Cuentas.Doc_Ori = Cuentas_Cobrar.Documento")
loComandoSeleccionar.AppendLine(" AND Cuentas_Cobrar.Cod_Tip = 'CHEQ'")
loComandoSeleccionar.AppendLine(" AND Movimientos_Cuentas.Tip_Ori = 'Cuentas_Cobrar' ")
loComandoSeleccionar.AppendLine("WHERE Movimientos_Cuentas.Fec_Ini BETWEEN @ldFecha_Desde AND @ldFecha_Hasta")
loComandoSeleccionar.AppendLine(" AND Movimientos_Cuentas.Status = 'Confirmado' ")
loComandoSeleccionar.AppendLine("")
loComandoSeleccionar.AppendLine("SELECT #tempMOVIMIENTO.Cod_Cue, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Num_Cue, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Nom_Ban, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Fec_Ini, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Documento, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Cod_Tip, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Tip_Doc, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Comentario, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Tip_Ori, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Mon_Deb, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Mon_Hab, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Mon_Imp1, ")
loComandoSeleccionar.AppendLine(" ISNULL(#tempSALDOINICIAL.Sal_Ini,0) AS Sal_Ini, ")
loComandoSeleccionar.AppendLine(" 0 AS Sal_Doc, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Referencia, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Fec_Ini_Detalles ")
loComandoSeleccionar.AppendLine("FROM #tempMOVIMIENTO ")
loComandoSeleccionar.AppendLine(" LEFT JOIN #tempSALDOINICIAL ON #tempSALDOINICIAL.Cod_Cue = #tempMOVIMIENTO.Cod_Cue")
loComandoSeleccionar.AppendLine("ORDER BY #tempMOVIMIENTO.Cod_Cue, #tempMOVIMIENTO.Fec_Ini ASC")
loComandoSeleccionar.AppendLine("")
loComandoSeleccionar.AppendLine("DROP TABLE #tempSALDOINICIAL")
loComandoSeleccionar.AppendLine("DROP TABLE #tempMOVIMIENTO")
'Me.mEscribirConsulta(loComandoSeleccionar.ToString)
Dim loServicios As New cusDatos.goDatos
Dim laDatosReporte As DataSet = loServicios.mObtenerTodosSinEsquema(loComandoSeleccionar.ToString(), "curReportes")
If laDatosReporte.Tables(0).Rows.Count <> 0 Then
'******************************************************************************************
' Se Procesa manualmetne los datos
'******************************************************************************************
Dim loTabla As New DataTable("curReportes")
Dim loColumna As DataColumn
loColumna = New DataColumn("Cod_Cue", GetType(String))
loColumna.MaxLength = 50
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Num_Cue", GetType(String))
loColumna.MaxLength = 50
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Nom_Ban", GetType(String))
loColumna.MaxLength = 50
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Fec_Ini", GetType(String))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Documento", GetType(String))
loColumna.MaxLength = 50
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Cod_Tip", GetType(String))
loColumna.MaxLength = 50
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Tip_Doc", GetType(String))
loColumna.MaxLength = 50
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Comentario", GetType(String))
loColumna.MaxLength = 500
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Tip_Ori", GetType(String))
loColumna.MaxLength = 50
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Mon_Deb", GetType(Decimal))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Mon_Hab", GetType(Decimal))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Mon_Imp1", GetType(Decimal))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Sal_Ini", GetType(Decimal))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Sal_Doc", GetType(Decimal))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Referencia", GetType(String))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Fec_Ini_Detalles", GetType(String))
loTabla.Columns.Add(loColumna)
Dim loNuevaFila As DataRow
Dim Cuenta_Actual As String
Dim SaldoAnterior As Decimal = 0
Dim lnTotalFilas As Integer = laDatosReporte.Tables(0).Rows.Count
Dim loFila As DataRow
'***************
loFila = laDatosReporte.Tables(0).Rows(0)
loNuevaFila = loTabla.NewRow()
loTabla.Rows.Add(loNuevaFila)
SaldoAnterior = loFila("Sal_Ini")
loNuevaFila.Item("Cod_Cue") = loFila("Cod_Cue")
loNuevaFila.Item("Num_Cue") = loFila("Num_Cue")
loNuevaFila.Item("Nom_Ban") = loFila("Nom_Ban")
loNuevaFila.Item("Fec_Ini") = Microsoft.VisualBasic.Format(CDate(loFila("Fec_Ini")), "dd/MM/yyyy")
loNuevaFila.Item("Documento") = loFila("Documento")
loNuevaFila.Item("Cod_Tip") = loFila("Cod_Tip")
loNuevaFila.Item("Tip_Doc") = loFila("Tip_Doc")
loNuevaFila.Item("Comentario") = loFila("Comentario")
loNuevaFila.Item("Tip_Ori") = loFila("Tip_Ori")
loNuevaFila.Item("Mon_Deb") = loFila("Mon_Deb")
loNuevaFila.Item("Mon_Hab") = loFila("Mon_Hab")
loNuevaFila.Item("Mon_Imp1") = loFila("Mon_Imp1")
loNuevaFila.Item("Sal_Ini") = loFila("Sal_Ini")
loNuevaFila.Item("Sal_Doc") = SaldoAnterior + loFila("Mon_Deb") - loFila("Mon_Hab")
loNuevaFila.Item("Referencia") = loFila("Referencia")
Dim ldFechaHoy As Date = Date.Today()
If (loFila("Fec_Ini_Detalles") Is System.DBNull.Value) Then
loNuevaFila.Item("Fec_Ini_Detalles") = loNuevaFila.Item("Fec_Ini")
Else
loNuevaFila.Item("Fec_Ini_Detalles") = Microsoft.VisualBasic.Format(CDate(loFila("Fec_Ini_Detalles")), "dd/MM/yyyy")
End If
SaldoAnterior = SaldoAnterior + loFila("Mon_Deb") - loFila("Mon_Hab")
Cuenta_Actual = loFila("Cod_Cue")
loTabla.AcceptChanges()
For lnNumeroFila As Integer = 1 To lnTotalFilas - 1
loFila = laDatosReporte.Tables(0).Rows(lnNumeroFila)
loNuevaFila = loTabla.NewRow()
loTabla.Rows.Add(loNuevaFila)
If loFila("Cod_Cue") <> Cuenta_Actual Then
SaldoAnterior = loFila("Sal_Ini")
End If
loNuevaFila.Item("Cod_Cue") = loFila("Cod_Cue")
loNuevaFila.Item("Num_Cue") = loFila("Num_Cue")
loNuevaFila.Item("Nom_Ban") = loFila("Nom_Ban")
loNuevaFila.Item("Fec_Ini") = Microsoft.VisualBasic.Format(CDate(loFila("Fec_Ini")), "dd/MM/yyyy")
loNuevaFila.Item("Documento") = loFila("Documento")
loNuevaFila.Item("Cod_Tip") = loFila("Cod_Tip")
loNuevaFila.Item("Tip_Doc") = loFila("Tip_Doc")
loNuevaFila.Item("Comentario") = loFila("Comentario")
loNuevaFila.Item("Tip_Ori") = loFila("Tip_Ori")
loNuevaFila.Item("Mon_Deb") = loFila("Mon_Deb")
loNuevaFila.Item("Mon_Hab") = loFila("Mon_Hab")
loNuevaFila.Item("Mon_Imp1") = loFila("Mon_Imp1")
loNuevaFila.Item("Sal_Ini") = loFila("Sal_Ini")
loNuevaFila.Item("Sal_Doc") = SaldoAnterior + loFila("Mon_Deb") - loFila("Mon_Hab")
loNuevaFila.Item("Referencia") = loFila("Referencia")
If (loFila("Fec_Ini_Detalles") Is System.DBNull.Value) Then
loNuevaFila.Item("Fec_Ini_Detalles") = loNuevaFila.Item("Fec_Ini")
Else
loNuevaFila.Item("Fec_Ini_Detalles") = Microsoft.VisualBasic.Format(CDate(loFila("Fec_Ini_Detalles")), "dd/MM/yyyy")
End If
SaldoAnterior = SaldoAnterior + loFila("Mon_Deb") - loFila("Mon_Hab")
Cuenta_Actual = loFila("Cod_Cue")
loTabla.AcceptChanges()
Next lnNumeroFila
Dim loDatosReporteFinal As New DataSet("curReportes")
loDatosReporteFinal.Tables.Add(loTabla)
'--------------------------------------------------------------------------------------'
' Se llena el reporte con la tabla nueva '
'--------------------------------------------------------------------------------------'
Me.mCargarLogoEmpresa(loDatosReporteFinal.Tables(0), "LogoEmpresa")
loObjetoReporte = cusAplicacion.goReportes.mCargarReporte("CGS_rECuentas_Bancos", loDatosReporteFinal)
Else
loObjetoReporte = cusAplicacion.goReportes.mCargarReporte("CGS_rECuentas_Bancos", laDatosReporte)
End If
loObjetoReporte.DataDefinition.FormulaFields("Comentario_Notas").Text = 1
'loObjetoReporte.ReportDefinition.ReportObjects("text8").Height = 0
'loObjetoReporte.ReportDefinition.ReportObjects("Comentario1").Height = 0
'loObjetoReporte.ReportDefinition.ReportObjects("text8").Top = 0
'loObjetoReporte.ReportDefinition.ReportObjects("Comentario1").Top = 0
Me.mTraducirReporte(loObjetoReporte)
Me.mFormatearCamposReporte(loObjetoReporte)
Me.crvCGS_rECuentas_Bancos.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 '
'-------------------------------------------------------------------------------------------'
' CMS: 11/06/09: Programacion inicial '
'-------------------------------------------------------------------------------------------'
' DLC: 20/05/10: Se agregó a la consulta los campos de la fecha inicial del detalle de pago,'
' asi como tambien la referencia a este documento '
'-------------------------------------------------------------------------------------------'
' RJG: 02/09/10: Modificado para diferenciar los 5 posibles origenes de un movimiento '
' bancario. '
'-------------------------------------------------------------------------------------------'
' RJG: 05/01/12: Corrección en la unión: Aparecían movimientos duplicados cuando el cobro/ '
' Pago/Orden de Pago tenía más de una forma de pago. '
'-------------------------------------------------------------------------------------------'
' RJG: 31/01/12: Corrección en la unión: faltó aplicar el filtro de Cuenta Bancaria en uno '
' los JOINs. '
'-------------------------------------------------------------------------------------------'
|
kodeitsolutions/ef-reports
|
CGS_rECuentas_Bancos.aspx.vb
|
Visual Basic
|
mit
| 20,848
|
'------------------------------------------------------------------------------
' <generado automáticamente>
' Este código fue generado por una herramienta.
'
' Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
' se vuelve a generar el código.
' </generado automáticamente>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Partial Public Class ReporteBalanceComprobacionAcumuladoDet
'''<summary>
'''Control Head1.
'''</summary>
'''<remarks>
'''Campo generado automáticamente.
'''Para modificarlo, mueva la declaración del campo del archivo del diseñador al archivo de código subyacente.
'''</remarks>
Protected WithEvents Head1 As Global.System.Web.UI.HtmlControls.HtmlHead
'''<summary>
'''Control form1.
'''</summary>
'''<remarks>
'''Campo generado automáticamente.
'''Para modificarlo, mueva la declaración del campo del archivo del diseñador al archivo de código subyacente.
'''</remarks>
Protected WithEvents form1 As Global.System.Web.UI.HtmlControls.HtmlForm
'''<summary>
'''Control ReportViewer1.
'''</summary>
'''<remarks>
'''Campo generado automáticamente.
'''Para modificarlo, mueva la declaración del campo del archivo del diseñador al archivo de código subyacente.
'''</remarks>
Protected WithEvents ReportViewer1 As Global.Telerik.ReportViewer.WebForms.ReportViewer
End Class
|
crackper/SistFoncreagro
|
SistFoncreagro.WebSite/Contabilidad/Formularios/ReporteBalanceComprobacionAcumuladoDet.aspx.designer.vb
|
Visual Basic
|
mit
| 1,531
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information.
Imports System.Composition
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.NetCore.Analyzers.Runtime
Namespace Microsoft.NetCore.VisualBasic.Analyzers.Runtime
<ExportCodeFixProvider(LanguageNames.VisualBasic, Name:="CA2229 CodeFix provider"), [Shared]>
Public Class BasicMarkAllNonSerializableFieldsFixer
Inherits MarkAllNonSerializableFieldsFixer
Protected Overrides Function GetFieldDeclarationNode(node As SyntaxNode) As SyntaxNode
Dim fieldNode = node
While fieldNode IsNot Nothing AndAlso Not fieldNode.IsKind(SyntaxKind.FieldDeclaration)
fieldNode = fieldNode.Parent
End While
Return If(fieldNode.IsKind(SyntaxKind.FieldDeclaration), fieldNode, Nothing)
End Function
End Class
End Namespace
|
dotnet/roslyn-analyzers
|
src/NetAnalyzers/VisualBasic/Microsoft.NetCore.Analyzers/Runtime/BasicMarkAllNonSerializableFields.Fixer.vb
|
Visual Basic
|
mit
| 1,033
|
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 assemblyDocument As SolidEdgeAssembly.AssemblyDocument = Nothing
Dim occurrences As SolidEdgeAssembly.Occurrences = Nothing
Dim occurrence As SolidEdgeAssembly.Occurrence = 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(1)
Dim displayInDrawings = occurrence.DisplayInDrawings
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.DisplayInDrawings.vb
|
Visual Basic
|
mit
| 1,523
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class ListeUtilisateur
Inherits System.Windows.Forms.Form
'Form remplace la méthode Dispose pour nettoyer la liste des composants.
<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
'Requise par le Concepteur Windows Form
Private components As System.ComponentModel.IContainer
'REMARQUE : la procédure suivante est requise par le Concepteur Windows Form
'Elle peut être modifiée à l'aide du Concepteur Windows Form.
'Ne la modifiez pas à l'aide de l'éditeur de code.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(ListeUtilisateur))
Me.btnAjout = New System.Windows.Forms.PictureBox()
Me.Label3 = New System.Windows.Forms.Label()
Me.ListeUser = New System.Windows.Forms.ListView()
Me.ColumnHeader1 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.ColumnHeader2 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.ColumnHeader3 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.ColumnHeader4 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.ColumnHeader5 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.ColumnHeader6 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.btnModifier = New System.Windows.Forms.Button()
Me.btnDelete = New System.Windows.Forms.Button()
Me.btnClose = New System.Windows.Forms.Button()
CType(Me.btnAjout, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'btnAjout
'
Me.btnAjout.Cursor = System.Windows.Forms.Cursors.Hand
Me.btnAjout.Image = Global.HG.My.Resources.Resources.add
Me.btnAjout.Location = New System.Drawing.Point(630, 26)
Me.btnAjout.Name = "btnAjout"
Me.btnAjout.Size = New System.Drawing.Size(35, 32)
Me.btnAjout.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.btnAjout.TabIndex = 39
Me.btnAjout.TabStop = False
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.BackColor = System.Drawing.Color.Transparent
Me.Label3.Font = New System.Drawing.Font("Corbel", 9.75!, System.Drawing.FontStyle.Bold)
Me.Label3.ForeColor = System.Drawing.Color.White
Me.Label3.Location = New System.Drawing.Point(669, 36)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(107, 15)
Me.Label3.TabIndex = 38
Me.Label3.Text = "Nouvel utilisateur"
'
'ListeUser
'
Me.ListeUser.Activation = System.Windows.Forms.ItemActivation.TwoClick
Me.ListeUser.AllowColumnReorder = True
Me.ListeUser.BackColor = System.Drawing.Color.White
Me.ListeUser.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1, Me.ColumnHeader2, Me.ColumnHeader3, Me.ColumnHeader4, Me.ColumnHeader5, Me.ColumnHeader6})
Me.ListeUser.Font = New System.Drawing.Font("Corbel", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.ListeUser.FullRowSelect = True
Me.ListeUser.GridLines = True
Me.ListeUser.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable
Me.ListeUser.Location = New System.Drawing.Point(7, 78)
Me.ListeUser.MultiSelect = False
Me.ListeUser.Name = "ListeUser"
Me.ListeUser.Size = New System.Drawing.Size(781, 422)
Me.ListeUser.TabIndex = 40
Me.ListeUser.UseCompatibleStateImageBehavior = False
Me.ListeUser.View = System.Windows.Forms.View.Details
'
'ColumnHeader1
'
Me.ColumnHeader1.Text = "id"
Me.ColumnHeader1.Width = 0
'
'ColumnHeader2
'
Me.ColumnHeader2.Text = "Nom d'utilisateur"
Me.ColumnHeader2.Width = 278
'
'ColumnHeader3
'
Me.ColumnHeader3.Text = "Rôle"
Me.ColumnHeader3.Width = 292
'
'ColumnHeader4
'
Me.ColumnHeader4.Text = "Mot de passe"
Me.ColumnHeader4.Width = 206
'
'ColumnHeader5
'
Me.ColumnHeader5.Text = "password"
Me.ColumnHeader5.Width = 0
'
'ColumnHeader6
'
Me.ColumnHeader6.Text = "role"
Me.ColumnHeader6.Width = 0
'
'btnModifier
'
Me.btnModifier.BackColor = System.Drawing.Color.DeepSkyBlue
Me.btnModifier.Font = New System.Drawing.Font("Comic Sans MS", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnModifier.Image = CType(resources.GetObject("btnModifier.Image"), System.Drawing.Image)
Me.btnModifier.Location = New System.Drawing.Point(238, 518)
Me.btnModifier.Name = "btnModifier"
Me.btnModifier.Size = New System.Drawing.Size(114, 42)
Me.btnModifier.TabIndex = 43
Me.btnModifier.Text = "Modifier"
Me.btnModifier.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText
Me.btnModifier.UseVisualStyleBackColor = False
'
'btnDelete
'
Me.btnDelete.BackColor = System.Drawing.Color.DeepSkyBlue
Me.btnDelete.Font = New System.Drawing.Font("Comic Sans MS", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnDelete.Image = CType(resources.GetObject("btnDelete.Image"), System.Drawing.Image)
Me.btnDelete.Location = New System.Drawing.Point(354, 518)
Me.btnDelete.Name = "btnDelete"
Me.btnDelete.Size = New System.Drawing.Size(114, 42)
Me.btnDelete.TabIndex = 44
Me.btnDelete.Text = "Supprimer"
Me.btnDelete.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText
Me.btnDelete.UseVisualStyleBackColor = False
'
'btnClose
'
Me.btnClose.BackColor = System.Drawing.Color.DeepSkyBlue
Me.btnClose.Font = New System.Drawing.Font("Corbel", 11.25!)
Me.btnClose.Image = CType(resources.GetObject("btnClose.Image"), System.Drawing.Image)
Me.btnClose.Location = New System.Drawing.Point(470, 518)
Me.btnClose.Name = "btnClose"
Me.btnClose.Size = New System.Drawing.Size(109, 42)
Me.btnClose.TabIndex = 45
Me.btnClose.Text = "Fermer"
Me.btnClose.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText
Me.btnClose.UseVisualStyleBackColor = False
'
'ListeUtilisateur
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.Color.Turquoise
Me.BackgroundImage = Global.HG.My.Resources.Resources.background
Me.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
Me.ClientSize = New System.Drawing.Size(800, 577)
Me.Controls.Add(Me.btnClose)
Me.Controls.Add(Me.btnDelete)
Me.Controls.Add(Me.btnModifier)
Me.Controls.Add(Me.ListeUser)
Me.Controls.Add(Me.btnAjout)
Me.Controls.Add(Me.Label3)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "ListeUtilisateur"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "ListeUtilisateur"
CType(Me.btnAjout, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents btnAjout As System.Windows.Forms.PictureBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents ListeUser As System.Windows.Forms.ListView
Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader
Friend WithEvents ColumnHeader2 As System.Windows.Forms.ColumnHeader
Friend WithEvents ColumnHeader3 As System.Windows.Forms.ColumnHeader
Friend WithEvents ColumnHeader4 As System.Windows.Forms.ColumnHeader
Friend WithEvents ColumnHeader5 As System.Windows.Forms.ColumnHeader
Friend WithEvents ColumnHeader6 As System.Windows.Forms.ColumnHeader
Friend WithEvents btnModifier As System.Windows.Forms.Button
Friend WithEvents btnDelete As System.Windows.Forms.Button
Friend WithEvents btnClose As System.Windows.Forms.Button
End Class
|
lepresk/HG
|
HG/ListeUtilisateur.designer.vb
|
Visual Basic
|
mit
| 9,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 System.Threading.Tasks
Namespace Microsoft.CodeAnalysis.Editor.UnitTests.FindReferences
Partial Public Class FindReferencesTests
<WorkItem(538886)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_Property1() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
using System;
namespace ConsoleApplication22
{
class Program
{
static public int {|Definition:F$$oo|}
{
get
{
return 1;
}
}
static void Main(string[] args)
{
int temp = Program.[|Foo|];
}
}
}
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(538886)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_Property2() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
using System;
namespace ConsoleApplication22
{
class Program
{
static public int {|Definition:Foo|}
{
get
{
return 1;
}
}
static void Main(string[] args)
{
int temp = Program.[|Fo$$o|];
}
}
}
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(539022)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_PropertyCascadeThroughInterface1() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
interface I
{
int {|Definition:$$P|} { get; }
}
class C : I
{
public int {|Definition:P|} { get; }
}
}
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(539022)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_PropertyCascadeThroughInterface2() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
interface I
{
int {|Definition:P|} { get; }
}
class C : I
{
public int {|Definition:$$P|} { get; }
}
}
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(539047)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_PropertyThroughBase1() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
interface I1
{
int {|Definition:$$Area|} { get; }
}
class C1 : I1
{
public int {|Definition:Area|} { get { return 1; } }
}
class C2 : C1
{
public int Area
{
get
{
return base.[|Area|];
}
}
}
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(539047)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_PropertyThroughBase2() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
interface I1
{
int {|Definition:Area|} { get; }
}
class C1 : I1
{
public int {|Definition:$$Area|} { get { return 1; } }
}
class C2 : C1
{
public int Area
{
get
{
return base.[|Area|];
}
}
}
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(539047)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_PropertyThroughBase3() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
interface I1
{
int Definition:Area { get; }
}
class C1 : I1
{
public int Definition:Area { get { return 1; } }
}
class C2 : C1
{
public int {|Definition:$$Area|}
{
get
{
return base.Area;
}
}
}
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(539047)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_PropertyThroughBase4() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
interface I1
{
int {|Definition:Area|} { get; }
}
class C1 : I1
{
public int {|Definition:Area|} { get { return 1; } }
}
class C2 : C1
{
public int Area
{
get
{
return base.[|$$Area|];
}
}
}
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(539523)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_ExplicitProperty1() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
public interface DD
{
int {|Definition:$$Prop|} { get; set; }
}
public class A : DD
{
int DD.{|Definition:Prop|}
{
get { return 1; }
set { }
}
}
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(539523)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_ExplicitProperty2() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
public interface DD
{
int {|Definition:Prop|} { get; set; }
}
public class A : DD
{
int DD.{|Definition:$$Prop|}
{
get { return 1; }
set { }
}
}
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(539885)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_PropertyFromGenericInterface1() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
<![CDATA[
using System;
interface I1<T>
{
T {|Definition:$$Name|} { get; set; }
}
interface I2
{
int Name { get; set; }
}
interface I3<T> : I2
{
new T {|Definition:Name|} { get; set; }
}
public class M<T> : I1<T>, I3<T>
{
public T {|Definition:Name|} { get; set; }
int I2.Name { get; set; }
}
]]>
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(539885)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_PropertyFromGenericInterface2() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
<![CDATA[
using System;
interface I1<T>
{
T Name { get; set; }
}
interface I2
{
int {|Definition:$$Name|} { get; set; }
}
interface I3<T> : I2
{
new T Name { get; set; }
}
public class M<T> : I1<T>, I3<T>
{
public T Name { get; set; }
int I2.{|Definition:Name|} { get; set; }
}
]]>
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(539885)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_PropertyFromGenericInterface3() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
<![CDATA[
using System;
interface I1<T>
{
T {|Definition:Name|} { get; set; }
}
interface I2
{
int Name { get; set; }
}
interface I3<T> : I2
{
new T {|Definition:$$Name|} { get; set; }
}
public class M<T> : I1<T>, I3<T>
{
public T {|Definition:Name|} { get; set; }
int I2.Name { get; set; }
}
]]>
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(539885)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_PropertyFromGenericInterface4() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
<![CDATA[
using System;
interface I1<T>
{
T Name { get; set; }
}
interface I2
{
int {|Definition:Name|} { get; set; }
}
interface I3<T> : I2
{
new T Name { get; set; }
}
public class M<T> : I1<T>, I3<T>
{
public T Name { get; set; }
int I2.{|Definition:$$Name|} { get; set; }
}
]]>
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(539885)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_PropertyFromGenericInterface5() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
<![CDATA[
using System;
interface I1<T>
{
T {|Definition:Name|} { get; set; }
}
interface I2
{
int Name { get; set; }
}
interface I3<T> : I2
{
new T {|Definition:Name|} { get; set; }
}
public class M<T> : I1<T>, I3<T>
{
public T {|Definition:$$Name|} { get; set; }
int I2.Name { get; set; }
}
]]>
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(540440)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestBasic_PropertyFunctionValue1() As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
<![CDATA[
Module Program
ReadOnly Property {|Definition:$$X|} As Integer ' Rename X to Y
Get
[|X|] = 1
End Get
End Property
End Module]]>
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(540440)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestBasic_PropertyFunctionValue2() As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
<![CDATA[
Module Program
ReadOnly Property {|Definition:X|} As Integer ' Rename X to Y
Get
[|$$X|] = 1
End Get
End Property
End Module]]>
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(543125)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_AnonymousTypeProperties1() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class C
{
void M()
{
var a = new { $$[|{|Definition:P|}|] = 4 };
var b = new { P = "asdf" };
var c = new { [|P|] = 4 };
var d = new { P = "asdf" };
}
}
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(543125)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_AnonymousTypeProperties2() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class C
{
void M()
{
var a = new { [|P|] = 4 };
var b = new { P = "asdf" };
var c = new { $$[|{|Definition:P|}|] = 4 };
var d = new { P = "asdf" };
}
}
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(543125)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_AnonymousTypeProperties3() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class C
{
void M()
{
var a = new { P = 4 };
var b = new { $$[|{|Definition:P|}|] = "asdf" };
var c = new { P = 4 };
var d = new { [|P|] = "asdf" };
}
}
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(543125)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharp_AnonymousTypeProperties4() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class C
{
void M()
{
var a = new { P = 4 };
var b = new { [|P|] = "asdf" };
var c = new { P = 4 };
var d = new { $$[|{|Definition:P|}|] = "asdf" };
}
}
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(542881)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestBasic_AnonymousTypeProperties1() As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Imports System
Imports System.Linq
Module Program
Sub Main(args As String())
Dim a1 = New With {Key.at = New With {.s = "hello"}}
Dim query = From at In (From s In "1" Select s)
Select New With {Key {|Definition:a1|}}
Dim hello = query.First()
Console.WriteLine(hello.$$[|a1|].at.s)
End Sub
End Module
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(542881)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestBasic_AnonymousTypeProperties2() As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Imports System
Imports System.Linq
Module Program
Sub Main(args As String())
Dim a1 = New With {Key.[|{|Definition:at|}|] = New With {.s = "hello"}}
Dim query = From at In (From s In "1" Select s)
Select New With {Key a1}
Dim hello = query.First()
Console.WriteLine(hello.a1.$$[|at|].s)
End Sub
End Module
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(542881)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestBasic_AnonymousTypeProperties3() As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Imports System
Imports System.Linq
Module Program
Sub Main(args As String())
Dim a1 = New With {Key.at = New With {.[|{|Definition:s|}|] = "hello"}}
Dim query = From at In (From s In "1" Select s)
Select New With {Key a1}
Dim hello = query.First()
Console.WriteLine(hello.a1.at.$$[|s|])
End Sub
End Module
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(545576)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestBasic_CascadeBetweenPropertyAndField1() As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class C
Property {|Definition:$$X|}()
Sub Foo()
Console.WriteLine([|_X|])
End Sub
End Class
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(545576)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestBasic_CascadeBetweenPropertyAndField2() As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class C
Property {|Definition:X|}()
Sub Foo()
Console.WriteLine([|$$_X|])
End Sub
End Class
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(529765)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestBasic_CascadeBetweenParameterizedVBPropertyAndCSharpMethod1() As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" AssemblyName="VBAssembly" CommonReferences="true">
<Document>
Public Class A
Public Overridable ReadOnly Property {|Definition:$$X|}(y As Integer) As Integer
{|Definition:Get|}
Return 0
End Get
End Property
End Class
</Document>
</Project>
<Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true">
<ProjectReference>VBAssembly</ProjectReference>
<Document>
class B : A
{
public override int {|Definition:get_X|}(int y)
{
return base.[|get_X|](y);
}
}
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(529765)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestBasic_CascadeBetweenParameterizedVBPropertyAndCSharpMethod2() As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" AssemblyName="VBAssembly" CommonReferences="true">
<Document>
Public Class A
Public Overridable ReadOnly Property {|Definition:X|}(y As Integer) As Integer
{|Definition:Get|}
Return 0
End Get
End Property
End Class
</Document>
</Project>
<Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true">
<ProjectReference>VBAssembly</ProjectReference>
<Document>
class B : A
{
public override int {|Definition:$$get_X|}(int y)
{
return base.[|get_X|](y);
}
}
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(529765)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestBasic_CascadeBetweenParameterizedVBPropertyAndCSharpMethod3() As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" AssemblyName="VBAssembly" CommonReferences="true">
<Document>
Public Class A
Public Overridable ReadOnly Property {|Definition:X|}(y As Integer) As Integer
{|Definition:Get|}
Return 0
End Get
End Property
End Class
</Document>
</Project>
<Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true">
<ProjectReference>VBAssembly</ProjectReference>
<Document>
class B : A
{
public override int {|Definition:get_X|}(int y)
{
return base.[|$$get_X|](y);
}
}
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(665876)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestBasic_DefaultProperties() As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Option Strict On
Public Interface IA
Default Property Foo(ByVal x As Integer) As Integer
End Interface
Public Interface IC
Inherits IA
Default Overloads Property {|Definition:$$Foo|}(ByVal x As Long) As String ' Rename Foo to Bar
End Interface
Class M
Sub F(x As IC)
Dim y = x[||](1L)
Dim y2 = x(1)
End Sub
End Class
</Document>
<Document>
Class M2
Sub F(x As IC)
Dim y = x[||](1L)
Dim y2 = x(1)
End Sub
End Class
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(665876)>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestBasic_DefaultProperties2() As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Option Strict On
Public Interface IA
Default Property {|Definition:$$Foo|}(ByVal x As Integer) As Integer
End Interface
Public Interface IC
Inherits IA
Default Overloads Property Foo(ByVal x As Long) As String ' Rename Foo to Bar
End Interface
Class M
Sub F(x As IC)
Dim y = x(1L)
Dim y2 = x[||](1)
End Sub
End Class
</Document>
<Document>
Class M2
Sub F(x As IC)
Dim y = x(1L)
Dim y2 = x[||](1)
End Sub
End Class
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
End Class
End Namespace
|
HellBrick/roslyn
|
src/EditorFeatures/Test2/FindReferences/FindReferencesTests.PropertySymbols.vb
|
Visual Basic
|
apache-2.0
| 21,404
|
' Copyright 2017 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.Geometry
Imports Esri.ArcGISRuntime.Mapping
Imports Esri.ArcGISRuntime.UI
Imports Esri.ArcGISRuntime.UI.Controls
Namespace ShowCallout
Partial Public Class ShowCalloutVB
Public Sub New()
InitializeComponent()
Initialize()
End Sub
Private Sub Initialize()
' Create a new basemap using the streets base layer
Dim myBasemap As Basemap = Basemap.CreateStreets()
' Create a new map based on the streets basemap
Dim myMap As New Map(myBasemap)
' Assign the map to the MapView
MyMapView.Map = myMap
End Sub
Private Sub MyMapView_GeoViewTapped(sender As Object, e As GeoViewInputEventArgs) Handles MyMapView.GeoViewTapped
' Get the user-tapped location
Dim mapLocation As MapPoint = e.Location
' Project the user-tapped map point location to a geometry
Dim myGeometry As Geometry = GeometryEngine.Project(mapLocation, SpatialReferences.Wgs84)
' Convert to geometry to a traditional Lat/Long map point
Dim projectedLocation As MapPoint = CType(myGeometry, MapPoint)
' Format the display callout string based upon the projected map point (example "Lat: 100.123, Long: 100.234")
Dim mapLocationDescription As String = String.Format("Lat: {0:F3} Long:{1:F3}", projectedLocation.Y, projectedLocation.X)
' Create a New callout definition using the formatted string
Dim myCalloutDefinition As CalloutDefinition = New CalloutDefinition("Location:", mapLocationDescription)
' Display the callout
MyMapView.ShowCalloutAt(mapLocation, myCalloutDefinition)
End Sub
End Class
End Namespace
|
Arc3D/arcgis-runtime-samples-dotnet
|
src/UWP/ArcGISRuntime.UWP.Samples/Samples/MapView/ShowCallout/ShowCalloutVB.xaml.vb
|
Visual Basic
|
apache-2.0
| 2,370
|
' 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.Generic
Imports System.Collections.Immutable
Imports System.Threading
Imports Microsoft.CodeAnalysis.Collections
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
''' <summary>
''' Represents either a namespace or a type.
''' </summary>
Friend MustInherit Class NamespaceOrTypeSymbol
Inherits Symbol
Implements INamespaceOrTypeSymbol
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
' Changes to the public interface of this class should remain synchronized with the C# version.
' Do not make any changes to the public interface without making the corresponding change
' to the C# version.
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
''' <summary>
''' Returns true if this symbol is a namespace. If its not a namespace, it must be a type.
''' </summary>
Public ReadOnly Property IsNamespace As Boolean Implements INamespaceOrTypeSymbol.IsNamespace
Get
Return Kind = SymbolKind.Namespace
End Get
End Property
''' <summary>
''' Returns true if this symbols is a type. Equivalent to Not IsNamespace.
''' </summary>
Public ReadOnly Property IsType As Boolean Implements INamespaceOrTypeSymbol.IsType
Get
Return Not IsNamespace
End Get
End Property
''' <summary>
''' Get all the members of this symbol.
''' </summary>
''' <returns>An ImmutableArray containing all the members of this symbol. If this symbol has no members,
''' returns an empty ImmutableArray. Never returns Nothing.</returns>
Public MustOverride Function GetMembers() As ImmutableArray(Of Symbol)
''' <summary>
''' Get all the members of this symbol. The members may not be in a particular order, and the order
''' may not be stable from call-to-call.
''' </summary>
''' <returns>An ImmutableArray containing all the members of this symbol. If this symbol has no members,
''' returns an empty ImmutableArray. Never returns null.</returns>
Friend Overridable Function GetMembersUnordered() As ImmutableArray(Of Symbol)
'' Default implementation Is to use ordered version. When performance indicates, we specialize to have
'' separate implementation.
#If DEBUG Then
'' In DEBUG, swap first And last elements so that use of Unordered in a place it isn't warranted is caught
'' more obviously.
Return GetMembers().DeOrder()
#Else
Return GetMembers()
#End If
End Function
''' <summary>
''' Get all the members of this symbol that have a particular name.
''' </summary>
''' <returns>An ImmutableArray containing all the members of this symbol with the given name. If there are
''' no members with this name, returns an empty ImmutableArray. The result is deteministic (i.e. the same
''' from call to call and from compilation to compilation). Members of the same kind appear in the result
''' in the same order in which they appeared at their origin (metadata or source).
''' Never returns Nothing.</returns>
Public MustOverride Function GetMembers(name As String) As ImmutableArray(Of Symbol)
''' <summary>
''' Get all the type members of this symbol. The types may not be in a particular order, and the order
''' may not be stable from call-to-call.
''' </summary>
''' <returns>An ImmutableArray containing all the type members of this symbol. If this symbol has no type members,
''' returns an empty ImmutableArray. Never returns null.</returns>
Friend Overridable Function GetTypeMembersUnordered() As ImmutableArray(Of NamedTypeSymbol)
'' Default implementation Is to use ordered version. When performance indicates, we specialize to have
'' separate implementation.
#If DEBUG Then
'' In DEBUG, swap first And last elements so that use of Unordered in a place it isn't warranted is caught
'' more obviously.
Return GetTypeMembers().DeOrder()
#Else
Return GetTypeMembers()
#End If
End Function
''' <summary>
''' Get all the members of this symbol that are types.
''' </summary>
''' <returns>An ImmutableArray containing all the types that are members of this symbol. If this symbol has no type members,
''' returns an empty ImmutableArray. Never returns Nothing.</returns>
Public MustOverride Function GetTypeMembers() As ImmutableArray(Of NamedTypeSymbol)
''' <summary>
''' Get all the members of this symbol that are types that have a particular name, and any arity.
''' </summary>
''' <returns>An ImmutableArray containing all the types that are members of this symbol with the given name.
''' If this symbol has no type members with this name,
''' returns an empty ImmutableArray. Never returns Nothing.</returns>
Public MustOverride Function GetTypeMembers(name As String) As ImmutableArray(Of NamedTypeSymbol)
''' <summary>
''' Get all the members of this symbol that are types that have a particular name and arity.
''' </summary>
''' <returns>An ImmutableArray containing all the types that are members of this symbol with the given name and arity.
''' If this symbol has no type members with this name and arity,
''' returns an empty ImmutableArray. Never returns Nothing.</returns>
Public Overridable Function GetTypeMembers(name As String, arity As Integer) As ImmutableArray(Of NamedTypeSymbol)
' default implementation does a post-filter. We can override this if its a performance burden, but
' experience is that it won't be.
Return GetTypeMembers(name).WhereAsArray(Function(t) t.Arity = arity)
End Function
' Only the compiler can create new instances.
Friend Sub New()
End Sub
''' <summary>
''' Returns true if this symbol was declared as requiring an override; i.e., declared
''' with the "MustOverride" modifier. Never returns true for types.
''' </summary>
''' <returns>
''' Always returns False.
''' </returns>
Public NotOverridable Overrides ReadOnly Property IsMustOverride As Boolean
Get
Return False
End Get
End Property
''' <summary>
''' Returns true if this symbol was declared to override a base class members and was
''' also restricted from further overriding; i.e., declared with the "NotOverridable"
''' modifier. Never returns true for types.
''' </summary>
''' <returns>
''' Always returns False.
''' </returns>
Public NotOverridable Overrides ReadOnly Property IsNotOverridable As Boolean
Get
Return False
End Get
End Property
''' <summary>
''' Returns true if this member is overridable, has an implementation,
''' and does not override a base class member; i.e., declared with the "Overridable"
''' modifier. Does not return true for members declared as MustOverride or Overrides.
''' </summary>
''' <returns>
''' Always returns False.
''' </returns>
Public NotOverridable Overrides ReadOnly Property IsOverridable As Boolean
Get
Return False
End Get
End Property
''' <summary>
''' Returns true if this symbol was declared to override a base class members; i.e., declared
''' with the "Overrides" modifier. Still returns true if the members was declared
''' to override something, but (erroneously) no member to override exists.
''' </summary>
''' <returns>
''' Always returns False.
''' </returns>
Public NotOverridable Overrides ReadOnly Property IsOverrides As Boolean
Get
Return False
End Get
End Property
''' <summary>
''' This is a helper method shared between NamedTypeSymbol and NamespaceSymbol.
'''
''' Its purpose is to add names of probable extension methods found in membersByName parameter
''' to nameSet parameter. Method's viability check is delegated to overridable method
''' AddExtensionMethodLookupSymbolsInfoViabilityCheck, which is overridden by RetargetingNamedtypeSymbol
''' and RetargetingNamespaceSymbol in order to perform the check on corresponding RetargetingMethodSymbol.
'''
''' Returns true if there were extension methods among the members,
''' regardless whether their names were added into the set.
''' </summary>
Friend Function AddExtensionMethodLookupSymbolsInfo(
nameSet As LookupSymbolsInfo,
options As LookupOptions,
originalBinder As Binder,
membersByName As IEnumerable(Of KeyValuePair(Of String, ImmutableArray(Of Symbol)))
) As Boolean
Dim haveSeenExtensionMethod As Boolean = False
For Each pair As KeyValuePair(Of String, ImmutableArray(Of Symbol)) In membersByName
' TODO: Should we check whether nameSet already contains pair.Key and
' go to the next pair? If we do that the, haveSeenExtensionMethod == false,
' won't actually mean that there are no extension methods in membersByName.
For Each member As Symbol In pair.Value
If member.Kind = SymbolKind.Method Then
Dim method = DirectCast(member, MethodSymbol)
If method.MayBeReducibleExtensionMethod Then
haveSeenExtensionMethod = True
If AddExtensionMethodLookupSymbolsInfoViabilityCheck(method, options, originalBinder) Then
nameSet.AddSymbol(member, member.Name, member.GetArity())
' Move to the next name.
Exit For
End If
End If
End If
Next
Next
Return haveSeenExtensionMethod
End Function
''' <summary>
''' Perform extension method viability check within AppendExtensionMethodNames method above.
''' This method is overridden by RetargetingNamedtypeSymbol and RetargetingNamespaceSymbol in order to
''' perform the check on corresponding RetargetingMethodSymbol.
'''
''' Returns true if the method is viable.
''' </summary>
Friend Overridable Function AddExtensionMethodLookupSymbolsInfoViabilityCheck(
method As MethodSymbol,
options As LookupOptions,
originalBinder As Binder
) As Boolean
Return originalBinder.CanAddLookupSymbolInfo(method, options, accessThroughType:=method.ContainingType)
End Function
''' <summary>
''' Finds types or namespaces described by a qualified name.
''' </summary>
''' <param name="qualifiedName">Sequence of simple plain names.</param>
''' <returns> A set of namespace or type symbols with given qualified name (might comprise of types with multiple generic arities),
''' or an empty set if the member can't be found (the qualified name is ambiguous or the symbol doesn't exist).
''' </returns>
''' <remarks>
''' "C.D" matches C.D, C(Of T).D, C(Of S,T).D(Of U), etc.
''' </remarks>
Friend Function GetNamespaceOrTypeByQualifiedName(qualifiedName As IEnumerable(Of String)) As IEnumerable(Of NamespaceOrTypeSymbol)
Dim namespaceOrType As NamespaceOrTypeSymbol = Me
Dim symbols As IEnumerable(Of NamespaceOrTypeSymbol) = Nothing
For Each namePart In qualifiedName
If symbols IsNot Nothing Then
namespaceOrType = symbols.OfMinimalArity()
If namespaceOrType Is Nothing Then
Return SpecializedCollections.EmptyEnumerable(Of NamespaceOrTypeSymbol)()
End If
End If
symbols = namespaceOrType.GetMembers(namePart).OfType(Of NamespaceOrTypeSymbol)()
Next
Return symbols
End Function
#Region "INamespaceOrTypeSymbol"
Private Function INamespaceOrTypeSymbol_GetMembers() As ImmutableArray(Of ISymbol) Implements INamespaceOrTypeSymbol.GetMembers
Return StaticCast(Of ISymbol).From(Me.GetMembers())
End Function
Private Function INamespaceOrTypeSymbol_GetMembers(name As String) As ImmutableArray(Of ISymbol) Implements INamespaceOrTypeSymbol.GetMembers
Return StaticCast(Of ISymbol).From(Me.GetMembers(name))
End Function
Private Function INamespaceOrTypeSymbol_GetTypeMembers() As ImmutableArray(Of INamedTypeSymbol) Implements INamespaceOrTypeSymbol.GetTypeMembers
Return StaticCast(Of INamedTypeSymbol).From(Me.GetTypeMembers())
End Function
Private Function INamespaceOrTypeSymbol_GetTypeMembers(name As String) As ImmutableArray(Of INamedTypeSymbol) Implements INamespaceOrTypeSymbol.GetTypeMembers
Return StaticCast(Of INamedTypeSymbol).From(Me.GetTypeMembers(name))
End Function
Public Function INamespaceOrTypeSymbol_GetTypeMembers(name As String, arity As Integer) As ImmutableArray(Of INamedTypeSymbol) Implements INamespaceOrTypeSymbol.GetTypeMembers
Return StaticCast(Of INamedTypeSymbol).From(Me.GetTypeMembers(name, arity))
End Function
#End Region
End Class
End Namespace
|
stjeong/roslyn
|
src/Compilers/VisualBasic/Portable/Symbols/NamespaceOrTypeSymbol.vb
|
Visual Basic
|
apache-2.0
| 14,378
|
Imports System.ComponentModel
Imports EIDSS.model.Enums
Imports DevExpress.XtraGrid
Public MustInherit Class GenericReferenceDetail
Protected Overridable ReadOnly Property ReferenceDbService() As BaseDbService
Get
Throw New Exception("property is not implemented")
End Get
End Property
Protected Overridable ReadOnly Property CanDeleteProc() As String
Get
Throw New Exception("property is not implemented")
End Get
End Property
Protected Overridable ReadOnly Property MainCaption() As String
Get
Throw New Exception("property is not implemented")
End Get
End Property
Protected Overridable ReadOnly Property CodeCaption() As String
Get
Throw New Exception("property is not implemented")
End Get
End Property
Protected Overridable ReadOnly Property CodeField() As String
Get
Throw New Exception("property is not implemented")
End Get
End Property
Protected Overridable ReadOnly Property HACodeMask() As Integer
Get
If (Not StartUpParameters Is Nothing AndAlso StartUpParameters.ContainsKey("HACodeMask")) Then
Return CInt(StartUpParameters("HACodeMask"))
End If
Return HACode.Avian Or HACode.Human Or HACode.Livestock
End Get
End Property
Protected Overridable ReadOnly Property MandatoryFields() As String
Get
Return "strDefault,name"
End Get
End Property
Friend WithEvents RefView As DataView
Private m_Helper As ReferenceEditorHelper
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
DbService = ReferenceDbService
AuditObject = New AuditObject(EIDSSAuditObject.daoReference, AuditTable.trtBaseReference)
Me.PermissionObject = EIDSS.model.Enums.EIDSSPermissionObject.Reference
'CheckEdits = New ArrayList
m_Helper = New ReferenceEditorHelper(gcReference, gcolTranslatedValue, MandatoryFields, "strDefault,name")
m_Helper.CanDeleteProc = CanDeleteProc
If Not EIDSS.model.Core.EidssUserContext.User.HasPermission(PermissionHelper.DeletePermission( _
EIDSS.model.Enums.EIDSSPermissionObject.Reference)) Then
btnDelete.Enabled = False
End If
gcolEnglishValue.ColumnEdit = ReferenceEditorHelper.EnglishValueEditor
AddHandler OnBeforePost, AddressOf ReferenceEditorHelper.BeforePost
Me.gcolCode.FieldName = CodeField
Me.gcolCode.Caption = CodeCaption
Me.Caption = MainCaption
gcolHACode.SortMode = ColumnSortMode.DisplayText
End Sub
Protected Overrides Sub DefineBinding()
m_DoDeleteAfterNo = False
RefView = m_Helper.BindView(baseDataSet, False)
Core.LookupBinder.BindReprositoryHACodeLookup(pceHACode, baseDataSet.Tables("HACodes").DefaultView, gvReference, HACodeMask)
End Sub
Public Overrides Function HasChanges() As Boolean
Return Not baseDataSet.Tables("BaseReference").GetChanges() Is Nothing
End Function
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
m_Helper.DeleteRow()
End Sub
Private Sub gvReference_ValidateRow(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs) Handles gvReference.ValidateRow
m_Helper.ValidateRow(e)
End Sub
<Browsable(False), Localizable(False), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
Public Overrides Property [ReadOnly]() As Boolean
Get
Return MyBase.ReadOnly
End Get
Set(ByVal value As Boolean)
MyBase.ReadOnly = value
If value Then
btnDelete.Visible = False
Else
If Not EIDSS.model.Core.EidssUserContext.User.HasPermission(PermissionHelper.DeletePermission( _
EIDSS.model.Enums.EIDSSPermissionObject.Reference)) Then
btnDelete.Visible = True
btnDelete.Enabled = False
End If
If Not EIDSS.model.Core.EidssUserContext.User.HasPermission(PermissionHelper.InsertPermission( _
EIDSS.model.Enums.EIDSSPermissionObject.Reference)) Then
If Not RefView Is Nothing Then RefView.AllowNew = False
End If
If Not EIDSS.model.Core.EidssUserContext.User.HasPermission(PermissionHelper.UpdatePermission( _
EIDSS.model.Enums.EIDSSPermissionObject.Reference)) Then
If Not RefView Is Nothing Then RefView.AllowEdit = False
End If
End If
End Set
End Property
End Class
|
EIDSS/EIDSS-Legacy
|
EIDSS v6.1/vb/EIDSS/EIDSS_Admin/LookupForms/GenericReferenceDetail.vb
|
Visual Basic
|
bsd-2-clause
| 5,229
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class AnimatUpdate
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 = "AnimaUpdate"
End Sub
End Class
|
NeuroRoboticTech/AnimatLabPublicSource
|
Libraries/AnimatGUI/Forms/AnimatUpdate.Designer.vb
|
Visual Basic
|
bsd-3-clause
| 1,104
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<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
'Wird vom Windows Form-Designer benötigt.
Private components As System.ComponentModel.IContainer
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.initBtn = New System.Windows.Forms.Button()
Me.closeBtn = New System.Windows.Forms.Button()
Me.writeBtn = New System.Windows.Forms.Button()
Me.RichTextBox1 = New System.Windows.Forms.RichTextBox()
Me.ComboBox1 = New System.Windows.Forms.ComboBox()
Me.ComboBox2 = New System.Windows.Forms.ComboBox()
Me.SerialPort1 = New System.IO.Ports.SerialPort(Me.components)
Me.Button1 = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
Me.Button3 = New System.Windows.Forms.Button()
Me.Button4 = New System.Windows.Forms.Button()
Me.Button5 = New System.Windows.Forms.Button()
Me.Button6 = New System.Windows.Forms.Button()
Me.Button7 = New System.Windows.Forms.Button()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.Label5 = New System.Windows.Forms.Label()
Me.Label6 = New System.Windows.Forms.Label()
Me.Label1 = New System.Windows.Forms.Label()
Me.Button8 = New System.Windows.Forms.Button()
Me.Label4 = New System.Windows.Forms.Label()
Me.Button9 = New System.Windows.Forms.Button()
Me.Button10 = New System.Windows.Forms.Button()
Me.Button11 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'initBtn
'
Me.initBtn.Location = New System.Drawing.Point(595, 161)
Me.initBtn.Name = "initBtn"
Me.initBtn.Size = New System.Drawing.Size(194, 21)
Me.initBtn.TabIndex = 0
Me.initBtn.Text = "Init"
Me.initBtn.UseVisualStyleBackColor = True
'
'closeBtn
'
Me.closeBtn.Location = New System.Drawing.Point(795, 161)
Me.closeBtn.Name = "closeBtn"
Me.closeBtn.Size = New System.Drawing.Size(194, 21)
Me.closeBtn.TabIndex = 0
Me.closeBtn.Text = "Close"
Me.closeBtn.UseVisualStyleBackColor = True
'
'writeBtn
'
Me.writeBtn.Location = New System.Drawing.Point(595, 478)
Me.writeBtn.Name = "writeBtn"
Me.writeBtn.Size = New System.Drawing.Size(194, 21)
Me.writeBtn.TabIndex = 0
Me.writeBtn.Text = "Write"
Me.writeBtn.UseVisualStyleBackColor = True
'
'RichTextBox1
'
Me.RichTextBox1.Location = New System.Drawing.Point(23, 478)
Me.RichTextBox1.Name = "RichTextBox1"
Me.RichTextBox1.Size = New System.Drawing.Size(394, 20)
Me.RichTextBox1.TabIndex = 2
Me.RichTextBox1.Text = ""
'
'ComboBox1
'
Me.ComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.ComboBox1.FormattingEnabled = True
Me.ComboBox1.Location = New System.Drawing.Point(23, 161)
Me.ComboBox1.Name = "ComboBox1"
Me.ComboBox1.Size = New System.Drawing.Size(194, 21)
Me.ComboBox1.TabIndex = 3
'
'ComboBox2
'
Me.ComboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.ComboBox2.FormattingEnabled = True
Me.ComboBox2.Items.AddRange(New Object() {"9600"})
Me.ComboBox2.Location = New System.Drawing.Point(223, 161)
Me.ComboBox2.Name = "ComboBox2"
Me.ComboBox2.Size = New System.Drawing.Size(194, 21)
Me.ComboBox2.TabIndex = 4
'
'Button1
'
Me.Button1.BackColor = System.Drawing.Color.Red
Me.Button1.Location = New System.Drawing.Point(23, 251)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(50, 50)
Me.Button1.TabIndex = 5
Me.Button1.Text = "Red"
Me.Button1.UseVisualStyleBackColor = False
'
'Button2
'
Me.Button2.BackColor = System.Drawing.Color.Fuchsia
Me.Button2.Location = New System.Drawing.Point(79, 251)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(50, 50)
Me.Button2.TabIndex = 5
Me.Button2.Text = "Pink"
Me.Button2.UseVisualStyleBackColor = False
'
'Button3
'
Me.Button3.BackColor = System.Drawing.Color.Yellow
Me.Button3.Location = New System.Drawing.Point(135, 251)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(50, 50)
Me.Button3.TabIndex = 5
Me.Button3.Text = "Yellow"
Me.Button3.UseVisualStyleBackColor = False
'
'Button4
'
Me.Button4.BackColor = System.Drawing.Color.White
Me.Button4.Location = New System.Drawing.Point(191, 251)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(50, 50)
Me.Button4.TabIndex = 5
Me.Button4.Text = "White"
Me.Button4.UseVisualStyleBackColor = False
'
'Button5
'
Me.Button5.BackColor = System.Drawing.Color.Lime
Me.Button5.Location = New System.Drawing.Point(247, 251)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(50, 50)
Me.Button5.TabIndex = 5
Me.Button5.Text = "Green"
Me.Button5.UseVisualStyleBackColor = False
'
'Button6
'
Me.Button6.Location = New System.Drawing.Point(303, 251)
Me.Button6.Name = "Button6"
Me.Button6.Size = New System.Drawing.Size(50, 50)
Me.Button6.TabIndex = 5
Me.Button6.Text = "Teal"
Me.Button6.UseVisualStyleBackColor = True
'
'Button7
'
Me.Button7.BackColor = System.Drawing.Color.Blue
Me.Button7.Location = New System.Drawing.Point(359, 251)
Me.Button7.Name = "Button7"
Me.Button7.Size = New System.Drawing.Size(50, 50)
Me.Button7.TabIndex = 5
Me.Button7.Text = "Blue"
Me.Button7.UseVisualStyleBackColor = False
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Font = New System.Drawing.Font("Orator Std", 10.0!)
Me.Label2.Location = New System.Drawing.Point(19, 139)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(97, 19)
Me.Label2.TabIndex = 7
Me.Label2.Text = "Serial Port"
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Font = New System.Drawing.Font("Orator Std", 10.0!)
Me.Label3.Location = New System.Drawing.Point(219, 139)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(73, 19)
Me.Label3.TabIndex = 7
Me.Label3.Text = "Baudrate"
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Font = New System.Drawing.Font("Orator Std", 35.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label5.Location = New System.Drawing.Point(19, 25)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(559, 63)
Me.Label5.TabIndex = 6
Me.Label5.Text = "Ikea Dioder Control"
'
'Label6
'
Me.Label6.AutoSize = True
Me.Label6.Font = New System.Drawing.Font("Orator Std", 15.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label6.Location = New System.Drawing.Point(18, 112)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(168, 27)
Me.Label6.TabIndex = 6
Me.Label6.Text = "Arduino Setup"
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Font = New System.Drawing.Font("Orator Std", 15.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.Location = New System.Drawing.Point(18, 221)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(144, 27)
Me.Label1.TabIndex = 6
Me.Label1.Text = "LED Control"
'
'Button8
'
Me.Button8.BackColor = System.Drawing.Color.Black
Me.Button8.Location = New System.Drawing.Point(415, 251)
Me.Button8.Name = "Button8"
Me.Button8.Size = New System.Drawing.Size(50, 50)
Me.Button8.TabIndex = 5
Me.Button8.Text = "Blue"
Me.Button8.UseVisualStyleBackColor = False
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Font = New System.Drawing.Font("Orator Std", 15.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label4.Location = New System.Drawing.Point(18, 439)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(204, 27)
Me.Label4.TabIndex = 6
Me.Label4.Text = "LED Command Line"
'
'Button9
'
Me.Button9.BackColor = System.Drawing.Color.Red
Me.Button9.ImageAlign = System.Drawing.ContentAlignment.TopCenter
Me.Button9.Location = New System.Drawing.Point(23, 307)
Me.Button9.Name = "Button9"
Me.Button9.Size = New System.Drawing.Size(50, 50)
Me.Button9.TabIndex = 5
Me.Button9.Text = "Fade In"
Me.Button9.UseVisualStyleBackColor = False
'
'Button10
'
Me.Button10.BackColor = System.Drawing.Color.Red
Me.Button10.Location = New System.Drawing.Point(23, 362)
Me.Button10.Name = "Button10"
Me.Button10.Size = New System.Drawing.Size(50, 50)
Me.Button10.TabIndex = 5
Me.Button10.Text = "Fade Out"
Me.Button10.UseVisualStyleBackColor = False
'
'Button11
'
Me.Button11.BackColor = System.Drawing.Color.Black
Me.Button11.Location = New System.Drawing.Point(795, 252)
Me.Button11.Name = "Button11"
Me.Button11.Size = New System.Drawing.Size(113, 50)
Me.Button11.TabIndex = 5
Me.Button11.Text = "Blue"
Me.Button11.UseVisualStyleBackColor = False
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(1055, 574)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.Button11)
Me.Controls.Add(Me.Button8)
Me.Controls.Add(Me.Button7)
Me.Controls.Add(Me.Button6)
Me.Controls.Add(Me.Button5)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button10)
Me.Controls.Add(Me.Button9)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.ComboBox2)
Me.Controls.Add(Me.ComboBox1)
Me.Controls.Add(Me.RichTextBox1)
Me.Controls.Add(Me.writeBtn)
Me.Controls.Add(Me.closeBtn)
Me.Controls.Add(Me.initBtn)
Me.Name = "Form1"
Me.Text = "Ikea Dioder Control"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents initBtn As System.Windows.Forms.Button
Friend WithEvents closeBtn As System.Windows.Forms.Button
Friend WithEvents writeBtn As System.Windows.Forms.Button
Friend WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox
Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
Friend WithEvents ComboBox2 As System.Windows.Forms.ComboBox
Friend WithEvents SerialPort1 As System.IO.Ports.SerialPort
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 Button4 As System.Windows.Forms.Button
Friend WithEvents Button5 As System.Windows.Forms.Button
Friend WithEvents Button6 As System.Windows.Forms.Button
Friend WithEvents Button7 As System.Windows.Forms.Button
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Button8 As System.Windows.Forms.Button
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Button9 As System.Windows.Forms.Button
Friend WithEvents Button10 As System.Windows.Forms.Button
Friend WithEvents Button11 As System.Windows.Forms.Button
End Class
|
sparship/leduino
|
net/Ikea-Dioder-Control.Designer.vb
|
Visual Basic
|
mit
| 13,775
|
' 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.Generic
Imports System.Text
Imports System.Xml.Linq
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Roslyn.Test.Utilities
Imports Xunit
Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests
Public Class EnumTests
Inherits BasicTestBase
' The value of first enumerator, and the value of each successive enumerator
<Fact>
Public Sub ValueOfFirst()
Dim text =
<compilation name="C">
<file name="a.vb">
Enum Suits
ValueA
ValueB
ValueC
ValueD
End Enum
</file>
</compilation>
VerifyEnumsValue(text, "Suits", 0, 1, 2, 3)
End Sub
' The value can be explicated initialized
<Fact>
Public Sub ExplicateInit()
Dim text =
<compilation name="C">
<file name="a.vb">
Public Enum Suits
ValueA = -1
ValueB = 2
ValueC = 3
ValueD = 4
End Enum
</file>
</compilation>
VerifyEnumsValue(text, "Suits", -1, 2, 3, 4)
End Sub
' The value can be explicated and implicit initialized
<Fact>
Public Sub MixedInit()
Dim text =
<compilation name="C">
<file name="a.vb">
Public Enum Suits
ValueA
ValueB = 10
ValueC
ValueD
End Enum
</file>
</compilation>
VerifyEnumsValue(text, "Suits", 0, 10, 11, 12)
End Sub
' Using shared field of an enum member does not cause evaluation cycle
<Fact>
Public Sub MixedInitShared()
Dim text =
<compilation name="C">
<file name="a.vb">
Public Enum Suits
ValueA
ValueB = 10
ValueC = Suits.ValueC.ValueB + 1
ValueD
End Enum
</file>
</compilation>
VerifyEnumsValue(text, "Suits", 0, 10, 11, 12)
End Sub
' Enumerator initializers must be of integral or enumeration type
<WorkItem(539945, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539945")>
<Fact>
Public Sub OutOfUnderlyingRange()
Dim text =
<compilation name="C">
<file name="a.vb">
Option Strict Off
Public Enum Suits As Byte
ValueA = "3" ' Can't implicitly convert
ValueB = 2.2 ' Can implicitly convert
ValueC = 257 ' Out of underlying range
End Enum
</file>
</compilation>
' There are diagnostics for these values (see EnumErrorsInValues test),
' but as long as the value is constant (including the needed conversion), the constant value is used
' (see conversion of 2.2 vs. conversion of "3").
VerifyEnumsValue(text, "Suits", SpecialType.System_Byte, Nothing, CByte(2), Nothing)
text =
<compilation name="C">
<file name="a.vb">
Option Strict On
Public Enum Suits As Byte
ValueA = "3" ' Can't implicitly convert
ValueB = 2.2 ' Can't implicitly convert: [Option Strict On] disallows implicit conversion
ValueC = 257 ' Out of underlying range
End Enum
</file>
</compilation>
' There are diagnostics for these values (see EnumErrorsInValues test),
' but as long as the value is constant (including the needed conversion), the constant value is used
' (see conversion of 2.2 vs. conversion of "3").
VerifyEnumsValue(text, "Suits", SpecialType.System_Byte, Nothing, CByte(2), Nothing)
text =
<compilation name="C">
<file name="a.vb">
Enum Suits As Short
a
b
c
d = -65536
e
f
End Enum
</file>
</compilation>
VerifyEnumsValue(text, "Suits", SpecialType.System_Int16, CShort(0), CShort(1), CShort(2), Nothing, Nothing, Nothing)
End Sub
<Fact>
Public Sub EnumErrorsInValues()
Dim text =
<compilation name="C">
<file name="a.vb">
Public Enum Suits As Byte
ValueA = "3" ' Can't implicitly convert
ValueB = 2.2 ' Can implicitly convert
ValueC = 257 ' Out of underlying range
End Enum
</file>
</compilation>
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(text)
CompilationUtils.AssertTheseDiagnostics(comp, <errors>
BC30060: Conversion from 'String' to 'Byte' cannot occur in a constant expression.
ValueA = "3" ' Can't implicitly convert
~~~
BC30439: Constant expression not representable in type 'Byte'.
ValueC = 257 ' Out of underlying range
~~~
</errors>)
comp = CompilationUtils.CreateCompilationWithMscorlib(text, TestOptions.ReleaseDll.WithOptionStrict(OptionStrict.On))
CompilationUtils.AssertTheseDiagnostics(comp, <errors>
BC30512: Option Strict On disallows implicit conversions from 'String' to 'Byte'.
ValueA = "3" ' Can't implicitly convert
~~~
BC30512: Option Strict On disallows implicit conversions from 'Double' to 'Byte'.
ValueB = 2.2 ' Can implicitly convert
~~~
BC30439: Constant expression not representable in type 'Byte'.
ValueC = 257 ' Out of underlying range
~~~
</errors>)
End Sub
<Fact()>
Public Sub ExplicitAssociated()
Dim text =
<compilation name="C">
<file name="a.vb">
Class C(Of T)
Const field As Integer = 100
Private Enum TestEnum
A
B = A ' another member
C = D ' another member
D = CByte(11) ' type can be implicitly converted to underlying type
F = 3 + 5 ' expression
G = field ' const field
TestEnum ' its own type name
var ' contextual keyword
T ' Type parameter
End Enum
Private Enum EnumB
B = TestEnum.T
End Enum
End Class
</file>
</compilation>
VerifyEnumsValue(text, "C.TestEnum", 0, 0, 11, 11, 8, 100, 101, 102, 103)
VerifyEnumsValue(text, "C.EnumB", 103)
text =
<compilation name="C">
<file name="a.vb">
Class c1
Public Shared StaticField As Integer = 10
Public Shared ReadOnly ReadonlyField As Integer = 100
Private Enum EnumTest
A = StaticField
B = ReadonlyField
End Enum
End Class
</file>
</compilation>
VerifyEnumsValue(text, "c1.EnumTest", SpecialType.System_Int32, Nothing, Nothing)
End Sub
' No enum-body
<Fact>
Public Sub NoEnumBody()
Dim text =
<compilation name="C">
<file name="a.vb">
Enum Figure
End Enum
</file>
</compilation>
VerifyEnumsValue(text, "Figure")
End Sub
' No identifier
<Fact>
Public Sub BC30203ERR_ExpectedIdentifier_NoIDForEnum()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(
<compilation name="BadEmptyEnum1">
<file name="a.vb">
Enum
One
Two
Three
End Enum
</file>
</compilation>)
CompilationUtils.AssertTheseParseDiagnostics(comp, <ERRORS>
BC30203: Identifier expected.
Enum
~
</ERRORS>)
End Sub
<Fact>
Public Sub EnumTypeCharMismatch()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(
<compilation name="EnumTypeCharMismatch">
<file name="a.vb">
Enum E As Integer
X
Y = E.X%
Z = E.X$
End Enum
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(comp, <ERRORS>
BC30277: Type character '$' does not match declared data type 'Integer'.
Z = E.X$
~~
</ERRORS>)
End Sub
<Fact>
Public Sub EnumTypeCharMismatch1()
Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(
<compilation name="EnumTypeCharMismatch">
<file name="a.vb">
Imports System
Module M1
Enum E As Integer
X = Int32%.MinValue
Y = E%.X
Z = E$.X
End Enum
End Module
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(comp, <ERRORS>
BC30277: Type character '$' does not match declared data type 'Integer'.
Z = E$.X
~~
</ERRORS>)
End Sub
' Same identifier for enum members
<Fact>
Public Sub SameIDForEnum()
Dim text =
<compilation name="C">
<file name="a.vb">
Enum TestEnum
One
One
End Enum
</file>
</compilation>
VerifyEnumsValue(text, "TestEnum", 0, 1)
End Sub
' Modifiers for enum
<WorkItem(539944, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539944")>
<Fact>
Public Sub BC30396ERR_BadEnumFlags1_ModifiersForEnum()
Dim compilation1 = CompilationUtils.CreateCompilationWithMscorlib(
<compilation name="C">
<file name="a.vb">
Class Program
Protected Enum Figure1
One = 1
End Enum ' OK
New Public Enum Figure2
Zero = 0
End Enum ' new + protection modifier is Not OK
Private MustInherit Enum Figure3
Zero
End Enum ' abstract not valid
Private Private Enum Figure4
One = 1
End Enum ' Duplicate modifier is not OK
Private Public Enum Figure5
End Enum ' More than one protection modifiers is not OK
Private NotInheritable Enum Figure0
Zero
End Enum ' sealed not valid
Private Shadows Enum Figure
Zero
End Enum ' OK
End Class
</file>
</compilation>)
Dim expectedErrors1 = <errors>
BC30035: Syntax error.
New Public Enum Figure2
~~~
BC30188: Declaration expected.
Zero = 0
~~~~
BC30184: 'End Enum' must be preceded by a matching 'Enum'.
End Enum ' new + protection modifier is Not OK
~~~~~~~~
BC30396: 'MustInherit' is not valid on an Enum declaration.
Private MustInherit Enum Figure3
~~~~~~~~~~~
BC30178: Specifier is duplicated.
Private Private Enum Figure4
~~~~~~~
BC30176: Only one of 'Public', 'Private', 'Protected', 'Friend', or 'Protected Friend' can be specified.
Private Public Enum Figure5
~~~~~~
BC30280: Enum 'Figure5' must contain at least one member.
Private Public Enum Figure5
~~~~~~~
BC30396: 'NotInheritable' is not valid on an Enum declaration.
Private NotInheritable Enum Figure0
~~~~~~~~~~~~~~
</errors>
CompilationUtils.AssertTheseDiagnostics(compilation1, expectedErrors1)
End Sub
' Modifiers for enum member
<Fact>
Public Sub ModifiersForEnumMember()
Dim text =
<compilation name="C">
<file name="a.vb">
Enum ColorA
Public Red
End Enum
</file>
</compilation>
VerifyEnumsValue(text, "ColorA")
text =
<compilation name="C">
<file name="a.vb">
Enum ColorA
Private Sub goo()
End Sub
End Enum
</file>
</compilation>
VerifyEnumsValue(text, "ColorA")
End Sub
' Flag Attribute and Enumerate a Enum
<Fact>
Public Sub FlagOnEnum()
Dim text =
<compilation name="C">
<file name="a.vb">
<System.Flags>
Public Enum Suits
ValueA = 1
ValueB = 2
ValueC = 4
ValueD = 8
Combi = ValueA Or ValueB
End Enum
</file>
</compilation>
VerifyEnumsValue(text, "Suits", 1, 2, 4, 8, 3)
End Sub
' Customer Attribute on Enum declaration
<Fact>
Public Sub AttributeOnEnum()
Dim text =
<compilation name="C">
<file name="a.vb">
Class Attr1
Inherits System.Attribute
End Class
<Attr1> _
Enum Figure
One
Two
Three
End Enum
</file>
</compilation>
VerifyEnumsValue(text, "Figure", 0, 1, 2)
End Sub
<Fact()>
Public Sub ConvertOnEnum()
Dim text =
<compilation name="C">
<file name="a.vb">
Imports System
Class c1
Public Enum Suits
ValueA = 1
ValueB = 2
ValueC = 4
ValueD = 2
ValueE = 2
End Enum
Shared Sub Main()
Dim S As Suits = CType(2, Suits)
Console.WriteLine(S.ToString()) ' ValueE
Dim S1 As Suits = CType(-1, Suits)
Console.WriteLine(S1.ToString()) ' 255
End Sub
End Class
</file>
</compilation>
VerifyEnumsValue(text, "c1.Suits", 1, 2, 4, 2, 2)
Dim expectedOutput = <![CDATA[
ValueE
-1
]]>
Dim comp = CreateCompilationWithMscorlibAndVBRuntime(text, TestOptions.ReleaseExe)
CompileAndVerify(comp, expectedOutput)
End Sub
' Enum used in switch
<Fact>
Public Sub SwitchInEnum()
Dim text =
<compilation name="C">
<file name="a.vb">
Class c1
Public Enum Suits
ValueA = 2
ValueB
ValueC = 2
End Enum
Public Sub Main()
Dim s As Suits
Select Case s
Case Suits.ValueA
Exit Select
Case Suits.ValueB
Exit Select
Case Suits.ValueC
Exit Select
Case Else
Exit Select
End Select
End Sub
End Class
</file>
</compilation>
VerifyEnumsValue(text, "c1.Suits", 2, 3, 2)
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(text)
CompilationUtils.AssertTheseDeclarationDiagnostics(comp, <errors></errors>)
End Sub
' The literal 0 implicitly converts to any enum type.
<Fact>
Public Sub ZeroInEnum()
Dim text =
<compilation name="C">
<file name="a.vb">
Imports System
Class c1
Private Enum Gender As Byte
Male = 2
End Enum
Public Shared Sub Main(args As String())
Dim s As Gender = 0
Console.WriteLine(s)
s = -0
Console.WriteLine(s)
s = 0.0
Console.WriteLine(s)
End Sub
End Class
</file>
</compilation>
CompileAndVerify(text, expectedOutput:="0" & vbCr & vbLf & "0" & vbCr & vbLf & "0" & vbCr & vbLf)
End Sub
' Derived.
<Fact>
Public Sub BC30628ERR_StructCantInherit_DerivedFromEnum()
Dim text =
<compilation name="C">
<file name="a.vb">
Public Enum Suits
ValueA = 2
ValueB
ValueC = 2
End Enum
Structure S1
Inherits Suits
End Structure
Interface I1
Inherits Suits
End Interface
</file>
</compilation>
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(text)
CompilationUtils.AssertTheseDeclarationDiagnostics(comp, <errors>
BC30628: Structures cannot have 'Inherits' statements.
Inherits Suits
~~~~~~~~~~~~~~
BC30354: Interface can inherit only from another interface.
Inherits Suits
~~~~~
</errors>)
End Sub
' Enums can Not be declared in nested enum declaration
<WorkItem(539943, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539943")>
<Fact>
Public Sub BC30619ERR_InvInsideEndsEnum_NestedFromEnum()
Dim text =
<compilation name="C">
<file name="a.vb">
Public Enum Num
Enum Figure
Zero
End Enum
End Enum
</file>
</compilation>
VerifyEnumsValue(text, "Num")
VerifyEnumsValue(text, "Figure", 0)
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(text)
CompilationUtils.AssertTheseDiagnostics(comp, <errors>
BC30185: 'Enum' must end with a matching 'End Enum'.
Public Enum Num
~~~~~~~~~~~~~~~
BC30280: Enum 'Num' must contain at least one member.
Public Enum Num
~~~
BC30619: Statement cannot appear within an Enum body. End of Enum assumed.
Enum Figure
~~~~~~~~~~~
BC30184: 'End Enum' must be preceded by a matching 'Enum'.
End Enum
~~~~~~~~
</errors>)
End Sub
' Enums can be declared anywhere
<Fact>
Public Sub DeclEnum()
Dim text =
<compilation name="C">
<file name="a.vb">
Namespace ns
Enum Gender
Male
End Enum
End Namespace
Structure B
Private Enum Gender
Male
End Enum
End Structure
</file>
</compilation>
VerifyEnumsValue(text, "ns.Gender", 0)
VerifyEnumsValue(text, "B.Gender", 0)
End Sub
' Enums obey local scope rules
<Fact>
Public Sub DeclEnum_01()
Dim text =
<compilation name="C">
<file name="a.vb">
Namespace ns
Enum E1
yes = 1
no = yes - 1
End Enum
Public Class mine
Public Enum E1
yes = 1
no = yes - 1
End Enum
End Class
End Namespace
</file>
</compilation>
VerifyEnumsValue(text, "ns.E1", 1, 0)
VerifyEnumsValue(text, "ns.mine.E1", 1, 0)
End Sub
<Fact()>
Public Sub NullableOfEnum()
Dim text =
<compilation name="C">
<file name="a.vb">
Enum EnumB As Long
Num = 1000
End Enum
Class c1
Public Shared Sub Main()
Dim a As EnumB = 0
Dim c As System.Nullable(Of EnumB) = Nothing
a = CType(c, EnumB)
End Sub
End Class
</file>
</compilation>
VerifyEnumsValue(text, "EnumB", 1000L)
CompileAndVerify(text)
End Sub
' Operator on null and enum
<Fact>
Public Sub OperatorOnNullableAndEnum()
Dim text =
<compilation name="C">
<file name="a.vb">
class c1
Private e As MyEnum = Nothing And MyEnum.One
End Class
enum MyEnum
One
End Enum
</file>
</compilation>
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(text)
CompilationUtils.AssertTheseDeclarationDiagnostics(comp, <errors></errors>)
End Sub
' Operator on enum
<Fact>
Public Sub OperatorOnEnum()
Dim text =
<compilation name="C">
<file name="a.vb">
Class c1
Public Shared Sub Main(args As String())
Dim e1 As Enum1 = e1 + 5L
Dim e2 As Enum2 = e1 + e2
e1 = Enum1.A1 + Enum1.B1
Dim b1 As Boolean = e1 = 1
Dim b7 As Boolean = e1 = e2
e1 += 1 ' OK
e2 -= 1 ' OK
e1 = e1 Xor Enum1.A1 ' OK
e1 = e1 Xor Enum1.B1 ' OK
End Sub
End Class
Public Enum Enum1
A1 = 1
B1 = 2
End Enum
Public Enum Enum2 As Byte
A2
B2
End Enum
</file>
</compilation>
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(text)
CompilationUtils.AssertTheseDeclarationDiagnostics(comp, <errors></errors>)
End Sub
' Operator on enum member
<Fact>
Public Sub OperatorOnEnumMember()
Dim text =
<compilation name="C">
<file name="a.vb">
Imports System
Class c1
Public Shared Sub Main(args As String())
Dim s As E = E.one
Dim b1 = E.three > E.two
Dim b2 = E.three < E.two
Dim b3 = E.three = E.two
Dim b4 = E.three <> E.two
Dim b5 = s > E.two
Dim b6 = s < E.two
Dim b7 = s = E.two
Dim b8 = s <> E.two
Console.WriteLine(b1)
Console.WriteLine(b2)
Console.WriteLine(b3)
Console.WriteLine(b4)
Console.WriteLine(b5)
Console.WriteLine(b6)
Console.WriteLine(b7)
Console.WriteLine(b8)
End Sub
End Class
Public Enum E
one = 1
two = 2
three = 3
End Enum
</file>
</compilation>
CompileAndVerify(text, expectedOutput:="True" & vbCr & vbLf & "False" & vbCr & vbLf & "False" & vbCr & vbLf & "True" & vbCr & vbLf & "False" & vbCr & vbLf & "True" & vbCr & vbLf & "False" & vbCr & vbLf & "True" & vbCr & vbLf)
End Sub
' CLS-Compliant
<Fact>
Public Sub CLSCompliantOnEnum()
Dim text =
<compilation name="C">
<file name="a.vb">
<Assembly: System.CLSCompliant(True)>
Public Class c1
Public Enum COLORS As UInteger
RED
GREEN
BLUE
End Enum
End Class
</file>
</compilation>
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(text)
VerifyEnumsValue(comp, "c1.COLORS", SpecialType.System_UInt32, 0UI, 1UI, 2UI)
End Sub
' No Base type after 'As'
<WorkItem(528031, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528031")>
<Fact>
Public Sub BC30182ERR_UnrecognizedType_NoUnderlyingTypeForEnum()
Dim text =
<compilation name="C">
<file name="a.vb">
Public Enum Figure As
One
Two
Three
End Enum
</file>
</compilation>
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(text)
CompilationUtils.AssertTheseParseDiagnostics(comp, <errors>
BC30182: Type expected.
Public Enum Figure As
~
</errors>)
VerifyEnumsValue(comp, "Figure", SpecialType.System_Int32, 0, 1, 2)
End Sub
' All integral type could be as BASE type
<WorkItem(539945, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539945")>
<Fact>
Public Sub BC30650ERR_InvalidEnumBase_BaseType()
Dim text =
<compilation name="C">
<file name="a.vb">
Public Enum Figure As System.Int64
One
Two
Three
End Enum
</file>
</compilation>
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(text)
CompilationUtils.AssertTheseDeclarationDiagnostics(comp, <errors></errors>)
VerifyEnumsValue(comp, "Figure", SpecialType.System_Int64, CLng(0), CLng(1), CLng(2))
text =
<compilation name="C">
<file name="a.vb">
Class C
End Class
Enum Figure As C
One
Two
Three
End Enum
</file>
</compilation>
comp = CompilationUtils.CreateCompilationWithMscorlib(text)
CompilationUtils.AssertTheseDeclarationDiagnostics(comp, <errors>
BC30650: Enums must be declared as an integral type.
Enum Figure As C
~
</errors>)
VerifyEnumsValue(comp, "Figure", SpecialType.System_Int32, 0, 1, 2)
End Sub
' 'partial' as Enum name
<Fact>
Public Sub partialAsEnumName()
Dim text =
<compilation name="C">
<file name="a.vb">
Partial Class EnumPartial
Friend Enum [partial]
ONE
End Enum
Dim M As [partial]
End Class
</file>
</compilation>
VerifyEnumsValue(text, "EnumPartial.partial", 0)
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(text)
Dim classEnum = TryCast(comp.SourceModule.GlobalNamespace.GetMembers("EnumPartial").Single(), NamedTypeSymbol)
Dim member = TryCast(classEnum.GetMembers("M").Single(), FieldSymbol)
Assert.Equal(TypeKind.Enum, member.Type.TypeKind)
End Sub
' Enum as an optional parameter
<Fact()>
Public Sub EnumAsOptionalParameter()
Dim text =
<compilation name="C">
<file name="a.vb">
Enum ABC
a
b
c
End Enum
Class c1
Public Function Goo(Optional o As ABC = ABC.a Or ABC.b) As Integer
Return 0
End Function
Public Function Moo(Optional o As Object = ABC.a) As Integer
Return 1
End Function
End Class
</file>
</compilation>
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(text)
CompilationUtils.AssertTheseDeclarationDiagnostics(comp, <errors></errors>)
End Sub
<WorkItem(540427, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540427")>
<Fact>
Public Sub EnumInitializerCircularReference()
Dim text =
<compilation name="C">
<file name="a.vb">
Enum Enum1
A = B + 1
B
End Enum
</file>
</compilation>
CompilationUtils.CreateCompilationWithMscorlib(text).VerifyDiagnostics(Diagnostic(ERRID.ERR_CircularEvaluation1, "A").WithArguments("A"))
End Sub
<WorkItem(540526, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540526")>
<Fact>
Public Sub EnumBadMember()
Dim text =
<compilation>
<file name="a.vb">
Enum E
[A
End Enum
</file>
</compilation>
CompilationUtils.CreateCompilationWithMscorlib(text).VerifyDiagnostics(
Diagnostic(ERRID.ERR_MissingEndEnum, "Enum E"),
Diagnostic(ERRID.ERR_InvInsideEndsEnum, ""),
Diagnostic(ERRID.ERR_MissingEndBrack, "[A"),
Diagnostic(ERRID.ERR_InvalidEndEnum, "End Enum"),
Diagnostic(ERRID.ERR_BadEmptyEnum1, "E").WithArguments("E"))
End Sub
<WorkItem(540526, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540526")>
<Fact>
Public Sub EnumBadMember2()
Dim text =
<compilation>
<file name="a.vb">
Enum E
goo:
End Enum
</file>
</compilation>
CompilationUtils.CreateCompilationWithMscorlib(text).VerifyDiagnostics(
Diagnostic(ERRID.ERR_InvInsideEnum, "goo:"))
End Sub
<WorkItem(540557, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540557")>
<Fact>
Public Sub EnumInDifferentFile()
Dim text =
<compilation name="C">
<file name="a.vb">
Imports System
Imports Color
Module M1
Dim passed As Boolean
Dim m_clr As Color
Property Clr As Color
Get
Return m_clr
End Get
Set(value As Color)
m_clr = value
End Set
End Property
End Module
</file>
<file name="color.vb">
Public Enum Color
red
green
blue
End Enum
</file>
</compilation>
Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(text)
CompilationUtils.AssertNoErrors(comp)
Dim globalNS = comp.SourceModule.GlobalNamespace
Dim M1 = DirectCast(globalNS.GetMembers("M1").First(), TypeSymbol)
Dim Clr = DirectCast(M1.GetMembers("Clr").First(), PropertySymbol)
Dim Color = Clr.Type
Assert.Equal("Color", Color.Name)
End Sub
<Fact>
Public Sub EnumMemberInitMustBeConstant()
Dim text =
<compilation name="C">
<file name="a.vb">
Imports System
Class A
Public Const X As Integer = 1
End Class
Class B
Sub New(x As Action)
End Sub
Sub New(x As Integer)
End Sub
Public Const X As Integer = 2
End Class
Class C
Sub New(x As Integer)
End Sub
Public Const X As Integer = 3
End Class
Class D
Sub New(x As Func(Of Integer))
End Sub
Public Const X As Integer = 4
End Class
Module M
Public Enum Bar As Integer
ValueWorks1 = new C(23).X
ValueWorks2 = new A().X
ValueWorks3 = 23 + new A().X
ValueWorks4 = if(nothing, 23)
ValueWorks5 = if(23 = 42, 23, 42)
ValueWorks6 = if(new A().X = 0, 23, 42)
ValueWorks7 = if(new A(), nothing).X
ValueWorks8 = if(23 = 42, 23, new A().X)
ValueWorks9 = if(23 = 42, new A().X, 42)
ValueWorks10 = New B(Sub() Exit Sub).X
ValueWorks11 = New D(Function() 23).X
ValueDoesntWork1 = goo()
End Enum
Public Function goo() As Integer
Return 23
End Function
public sub main()
end sub
End Module
</file>
</compilation>
Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(text)
CompilationUtils.AssertTheseDiagnostics(comp, <errors>
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
ValueWorks1 = new C(23).X
~~~~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
ValueWorks2 = new A().X
~~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
ValueWorks3 = 23 + new A().X
~~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
ValueWorks6 = if(new A().X = 0, 23, 42)
~~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
ValueWorks7 = if(new A(), nothing).X
~~~~~~~~~~~~~~~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
ValueWorks8 = if(23 = 42, 23, new A().X)
~~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
ValueWorks9 = if(23 = 42, new A().X, 42)
~~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
ValueWorks10 = New B(Sub() Exit Sub).X
~~~~~~~~~~~~~~~~~~~~~~~
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
ValueWorks11 = New D(Function() 23).X
~~~~~~~~~~~~~~~~~~~~~~
BC30059: Constant expression is required.
ValueDoesntWork1 = goo()
~~~~~
</errors>)
End Sub
''' bug 8151
<Fact>
Public Sub EnumMemberWithNonConstInitializationAndSelfDependency()
Dim text =
<compilation name="C">
<file name="a.vb">
Imports System
Class D
Sub New(x As Func(Of Integer))
End Sub
Public Const X As Integer = 4
End Class
Module M
Public Enum Bar As Integer
ValueDoesntWork2
ValueDoesntWork3 = New D(Function() ValueDoesntWork2).X
ValueDoesntWork4 = New D(Function() ValueDoesntWork4).X
End Enum
public sub main()
end sub
End Module
</file>
</compilation>
Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(text)
CompilationUtils.AssertTheseDiagnostics(comp, <errors>
BC42025: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.
ValueDoesntWork3 = New D(Function() ValueDoesntWork2).X
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC30500: Constant 'ValueDoesntWork4' cannot depend on its own value.
ValueDoesntWork4 = New D(Function() ValueDoesntWork4).X
~~~~~~~~~~~~~~~~
</errors>)
End Sub
' The value can be used off an enum member
<WorkItem(541364, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541364")>
<Fact>
Public Sub EnumUseQualified()
Dim text =
<compilation name="C">
<file name="a.vb">
Enum Y
X
Y = Y.X
End Enum
</file>
</compilation>
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(text)
CompilationUtils.AssertTheseDiagnostics(comp, <errors>
</errors>)
VerifyEnumsValue(text, "Y", 0, 0)
End Sub
<WorkItem(750553, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/750553")>
<Fact>
Public Sub InvalidEnumUnderlyingType()
Dim text =
<compilation>
<file name="a.vb">
Class C(Of T As Structure)
Enum E As T
A
End Enum
End Class
</file>
</compilation>
Dim errors =
<errors>
BC30650: Enums must be declared as an integral type.
Enum E As T
~
</errors>
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(text)
comp.AssertTheseDiagnostics(errors)
Dim tree = comp.SyntaxTrees(0)
Dim model = comp.GetSemanticModel(tree)
Dim diagnostics = model.GetDeclarationDiagnostics()
AssertTheseDiagnostics(diagnostics, errors)
Dim decl = tree.GetCompilationUnitRoot().DescendantNodes().OfType(Of EnumBlockSyntax).Single()
Dim symbol = model.GetDeclaredSymbol(decl)
Dim type = symbol.EnumUnderlyingType
Assert.Equal(type.SpecialType, SpecialType.System_Int32)
End Sub
<Fact, WorkItem(895284, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/895284")>
Public Sub CircularDefinition_Explicit()
' Bug#895284 Roslyn gives extra error BC30060:
' Conversion from 'E2' to 'Integer' cannot occur in a constant expression.
' Per field
Dim source =
<compilation>
<file name="a.vb">
Enum E1
M10 = 1
M11 = CType(M10, Integer) + 1
M12 = CType(M11, Integer) + 1
End Enum
Enum E2
M20 = CType(M22, Integer) + 1
M21 = CType(M20, Integer) + 1
M22 = CType(M21, Integer) + 1
End Enum
</file>
</compilation>
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(source)
comp.AssertTheseDiagnostics(<errors>
BC30500: Constant 'M20' cannot depend on its own value.
M20 = CType(M22, Integer) + 1
~~~
BC30060: Conversion from 'E2' to 'Integer' cannot occur in a constant expression.
M21 = CType(M20, Integer) + 1
~~~
BC30060: Conversion from 'E2' to 'Integer' cannot occur in a constant expression.
M22 = CType(M21, Integer) + 1
~~~
</errors>)
End Sub
<Fact>
Public Sub CircularDefinitionManyMembers_Implicit()
' Enum E
' M0 = Mn + 1
' M1
' ...
' Mn
' End Enum
Dim source = GenerateEnum(6000, Function(i, n) If(i = 0, String.Format("M{0} + 1", n - 1), ""))
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(source)
comp.AssertTheseDiagnostics(<errors>
BC30500: Constant 'M0' cannot depend on its own value.
M0 = M5999 + 1
~~
</errors>)
End Sub
<Fact,
WorkItem(123937, "https://devdiv.visualstudio.com/defaultcollection/DevDiv/_workitems#_a=edit&id=123937"),
WorkItem(886047, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/886047")>
Public Sub CircularDefinitionManyMembers_Explicit()
' Enum E
' M0 = Mn + 1
' M1 = M0 + 1
' ...
' Mn = Mn-1 + 1
' End Enum
' Dev12 crashes at ~300 members.
Const bug123937IsFixed = False
Dim count As Integer = 2
If bug123937IsFixed Then
count = 6000
End If
Dim source = GenerateEnum(count, Function(i, n) String.Format("M{0} + 1", If(i = 0, n - 1, i - 1)))
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(source)
' Note, native compiler doesn't report BC30060, we should try to suppress it too.
comp.AssertTheseDiagnostics(<errors>
BC30500: Constant 'M0' cannot depend on its own value.
M0 = M1 + 1
~~
BC30060: Conversion from 'E' to 'Integer' cannot occur in a constant expression.
M1 = M0 + 1
~~
</errors>)
End Sub
<Fact,
WorkItem(123937, "https://devdiv.visualstudio.com/defaultcollection/DevDiv/_workitems#_a=edit&id=123937"),
WorkItem(886047, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/886047")>
Public Sub InvertedDefinitionManyMembers_Explicit()
' Enum E
' M0 = M1 - 1
' M1 = M2 - 1
' ...
' Mn = n
' End Enum
' Dev12 crashes at ~300 members.
Const bug123937IsFixed = False
Dim count As Integer = 20
If bug123937IsFixed Then
count = 6000
End If
Dim source = GenerateEnum(count, Function(i, n) If(i < n - 1, String.Format("M{0} - 1", i + 1), i.ToString()))
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(source)
comp.AssertTheseDiagnostics(<errors/>)
End Sub
''' <summary>
''' Generate:
''' <code>
''' Enum E
''' M0 = ...
''' M1 = ...
''' ...
''' Mn = ...
''' End Enum
''' </code>
''' </summary>
Private Shared Function GenerateEnum(n As Integer, getMemberValue As Func(Of Integer, Integer, String)) As XElement
Dim builder As New StringBuilder()
builder.AppendLine("Enum E")
For i = 0 To n - 1
builder.Append(String.Format(" M{0}", i))
Dim value = getMemberValue(i, n)
If Not String.IsNullOrEmpty(value) Then
builder.Append(" = ")
builder.Append(value)
End If
builder.AppendLine()
Next
builder.AppendLine("End Enum")
Return <compilation>
<file name="a.vb"><%= builder.ToString() %></file>
</compilation>
End Function
Private Shared Function VerifyEnumsValue(text As XElement, enumName As String, ParamArray expectedEnumValues As Object()) As List(Of Symbol)
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(text)
Return VerifyEnumsValue(comp, enumName, If(expectedEnumValues.Any() AndAlso expectedEnumValues.First().GetType() Is GetType(Long), SpecialType.System_Int64, SpecialType.System_Int32), expectedEnumValues)
End Function
Private Shared Function VerifyEnumsValue(text As XElement, enumName As String, underlyingType As SpecialType, ParamArray expectedEnumValues As Object()) As List(Of Symbol)
Dim comp = CompilationUtils.CreateCompilationWithMscorlib(text)
Return VerifyEnumsValue(comp, enumName, underlyingType, expectedEnumValues)
End Function
Private Shared Function VerifyEnumsValue(comp As VisualBasicCompilation, enumName As String, underlyingType As SpecialType, ParamArray expectedEnumValues As Object()) As List(Of Symbol)
Dim symEnum = TryCast(GetSymbolByFullName(comp, enumName), NamedTypeSymbol)
Assert.NotNull(symEnum)
Dim type = symEnum.EnumUnderlyingType
Assert.NotNull(type)
Assert.Equal(underlyingType, type.SpecialType)
Dim fields = symEnum.GetMembers().OfType(Of FieldSymbol).Cast(Of Symbol)()
Assert.Equal(expectedEnumValues.Length, fields.Count - 1)
For count = 0 To fields.Count - 1
Dim field = DirectCast(fields(count), FieldSymbol)
Dim fieldDefinition = DirectCast(field, Cci.IFieldDefinition)
If count = 0 Then
Assert.Equal(field.Name, "value__")
Assert.False(field.IsShared)
Assert.False(field.IsConst)
Assert.False(field.IsReadOnly)
Assert.Equal(field.DeclaredAccessibility, Accessibility.Public)
Assert.Equal(field.Type.SpecialType, underlyingType)
Assert.True(fieldDefinition.IsSpecialName)
Assert.True(fieldDefinition.IsRuntimeSpecial)
Else
Assert.Equal(expectedEnumValues(count - 1), field.ConstantValue)
Assert.True(field.IsShared)
Assert.True(field.IsConst)
Assert.False(fieldDefinition.IsSpecialName)
Assert.False(fieldDefinition.IsRuntimeSpecial)
End If
Next
Return fields.ToList()
End Function
Private Shared Function GetSymbolByFullName(compilation As VisualBasicCompilation, memberName As String) As Symbol
Dim names As String() = memberName.Split("."c)
Dim currentSymbol As Symbol = compilation.GlobalNamespace
For Each name In names
Assert.True(TypeOf currentSymbol Is NamespaceOrTypeSymbol, String.Format("{0} does not have members", currentSymbol.ToDisplayString()))
Dim currentContainer = DirectCast(currentSymbol, NamespaceOrTypeSymbol)
Dim members = currentContainer.GetMembers(name)
Assert.True(members.Length > 0, String.Format("No members named {0} inside {1}", name, currentSymbol.ToDisplayString()))
Assert.True(members.Length <= 1, String.Format("Multiple members named {0} inside {1}", name, currentSymbol.ToDisplayString()))
currentSymbol = members.First()
Next
Return currentSymbol
End Function
End Class
End Namespace
|
TyOverby/roslyn
|
src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/Source/EnumTests.vb
|
Visual Basic
|
apache-2.0
| 43,920
|
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("ConsoleApplication1")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("ConsoleApplication1")>
<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("c1cc9096-76f8-4e14-856e-990415f1488a")>
' 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")>
|
mgholam/RaptorDB-Document
|
vbTestConsole/My Project/AssemblyInfo.vb
|
Visual Basic
|
mit
| 1,156
|
' 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.Editor.CSharp.GoToDefinition
Imports Microsoft.CodeAnalysis.Editor.Host
Imports Microsoft.CodeAnalysis.Editor.Shared.Utilities
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Utilities.GoToHelpers
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.Editor.VisualBasic.GoToDefinition
Imports Microsoft.CodeAnalysis.Navigation
Imports Microsoft.VisualStudio.Text
Namespace Microsoft.CodeAnalysis.Editor.UnitTests.GoToDefinition
<[UseExportProvider]>
Public Class GoToDefinitionTests
Friend Shared Sub Test(
workspaceDefinition As XElement,
expectedResult As Boolean,
executeOnDocument As Func(Of Document, Integer, IThreadingContext, IStreamingFindUsagesPresenter, Boolean))
Using workspace = TestWorkspace.Create(workspaceDefinition, composition:=GoToTestHelpers.Composition)
Dim solution = workspace.CurrentSolution
Dim cursorDocument = workspace.Documents.First(Function(d) d.CursorPosition.HasValue)
Dim cursorPosition = cursorDocument.CursorPosition.Value
' Set up mocks. The IDocumentNavigationService should be called if there is one,
' location and the INavigableItemsPresenter should be called if there are
' multiple locations.
' prepare a notification listener
Dim textView = cursorDocument.GetTextView()
Dim textBuffer = textView.TextBuffer
textView.Caret.MoveTo(New SnapshotPoint(textBuffer.CurrentSnapshot, cursorPosition))
Dim cursorBuffer = cursorDocument.GetTextBuffer()
Dim document = workspace.CurrentSolution.GetDocument(cursorDocument.Id)
Dim mockDocumentNavigationService = DirectCast(workspace.Services.GetService(Of IDocumentNavigationService)(), MockDocumentNavigationService)
Dim mockSymbolNavigationService = DirectCast(workspace.Services.GetService(Of ISymbolNavigationService)(), MockSymbolNavigationService)
Dim presenterCalled As Boolean = False
Dim threadingContext = workspace.ExportProvider.GetExportedValue(Of IThreadingContext)()
Dim presenter = New MockStreamingFindUsagesPresenter(Sub() presenterCalled = True)
Dim actualResult = executeOnDocument(document, cursorPosition, threadingContext, presenter)
Assert.Equal(expectedResult, actualResult)
Dim expectedLocations As New List(Of FilePathAndSpan)
For Each testDocument In workspace.Documents
For Each selectedSpan In testDocument.SelectedSpans
expectedLocations.Add(New FilePathAndSpan(testDocument.FilePath, selectedSpan))
Next
Next
expectedLocations.Sort()
Dim context = presenter.Context
If expectedResult Then
If expectedLocations.Count = 0 Then
' if there is not expected locations, it means symbol navigation is used
Assert.True(mockSymbolNavigationService._triedNavigationToSymbol)
Assert.Null(mockDocumentNavigationService._documentId)
Assert.False(presenterCalled)
Else
Assert.False(mockSymbolNavigationService._triedNavigationToSymbol)
If mockDocumentNavigationService._triedNavigationToSpan Then
Dim definitionDocument = workspace.GetTestDocument(mockDocumentNavigationService._documentId)
Assert.Single(definitionDocument.SelectedSpans)
Assert.Equal(definitionDocument.SelectedSpans.Single(), mockDocumentNavigationService._span)
' The INavigableItemsPresenter should not have been called
Assert.False(presenterCalled)
Else
Assert.False(mockDocumentNavigationService._triedNavigationToPosition)
Assert.False(mockDocumentNavigationService._triedNavigationToLineAndOffset)
Assert.True(presenterCalled)
Dim actualLocations As New List(Of FilePathAndSpan)
Dim items = context.GetDefinitions()
For Each location In items
For Each docSpan In location.SourceSpans
actualLocations.Add(New FilePathAndSpan(docSpan.Document.FilePath, docSpan.SourceSpan))
Next
Next
actualLocations.Sort()
Assert.Equal(expectedLocations, actualLocations)
' The IDocumentNavigationService should not have been called
Assert.Null(mockDocumentNavigationService._documentId)
End If
End If
Else
Assert.False(mockSymbolNavigationService._triedNavigationToSymbol)
Assert.Null(mockDocumentNavigationService._documentId)
Assert.False(presenterCalled)
End If
End Using
End Sub
Private Shared Sub Test(workspaceDefinition As XElement, Optional expectedResult As Boolean = True)
Test(workspaceDefinition, expectedResult,
Function(document, cursorPosition, threadingContext, presenter)
Dim goToDefService = If(document.Project.Language = LanguageNames.CSharp,
DirectCast(New CSharpGoToDefinitionService(threadingContext, presenter), IGoToDefinitionService),
New VisualBasicGoToDefinitionService(threadingContext, presenter))
Return goToDefService.TryGoToDefinition(document, cursorPosition, CancellationToken.None)
End Function)
End Sub
#Region "P2P Tests"
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestP2PClassReference()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<ProjectReference>VBAssembly</ProjectReference>
<Document>
using N;
class CSharpClass
{
VBCl$$ass vb
}
</Document>
</Project>
<Project Language="Visual Basic" AssemblyName="VBAssembly" CommonReferences="true">
<Document>
namespace N
public class [|VBClass|]
End Class
End Namespace
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
#End Region
#Region "Normal CSharp Tests"
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGoToDefinition()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class [|SomeClass|] { }
class OtherClass { Some$$Class obj; }
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
<WorkItem(23030, "https://github.com/dotnet/roslyn/issues/23030")>
Public Sub TestCSharpLiteralGoToDefinition()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
int x = 1$$23;
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
<WorkItem(23030, "https://github.com/dotnet/roslyn/issues/23030")>
Public Sub TestCSharpStringLiteralGoToDefinition()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
string x = "wo$$ow";
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(3589, "https://github.com/dotnet/roslyn/issues/3589")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGoToDefinitionOnAnonymousMember()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
public class MyClass
{
public string [|Prop1|] { get; set; }
}
class Program
{
static void Main(string[] args)
{
var instance = new MyClass();
var x = new
{
instance.$$Prop1
};
}
} </Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(3589, "https://github.com/dotnet/roslyn/issues/3589")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicGoToDefinitionOnAnonymousMember()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
public class MyClass1
public property [|Prop1|] as integer
end class
class Program
sub Main()
dim instance = new MyClass1()
dim x as new With { instance.$$Prop1 }
end sub
end class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGoToDefinitionSameClass()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class [|SomeClass|] { Some$$Class someObject; }
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGoToDefinitionNestedClass()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class Outer
{
class [|Inner|]
{
}
In$$ner someObj;
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionDifferentFiles()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class OtherClass { SomeClass obj; }
</Document>
<Document>
class OtherClass2 { Some$$Class obj2; };
</Document>
<Document>
class [|SomeClass|] { }
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionPartialClasses()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
partial class nothing { };
</Document>
<Document>
partial class [|OtherClass|] { int a; }
</Document>
<Document>
partial class [|OtherClass|] { int b; };
</Document>
<Document>
class ConsumingClass { Other$$Class obj; }
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionMethod()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class [|SomeClass|] { int x; };
</Document>
<Document>
class ConsumingClass
{
void goo()
{
Some$$Class x;
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(900438, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/900438")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionPartialMethod()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
partial class Test
{
partial void M();
}
</Document>
<Document>
partial class Test
{
void Goo()
{
var t = new Test();
t.M$$();
}
partial void [|M|]()
{
throw new NotImplementedException();
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionExtendedPartialMethod()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
partial class Test
{
public partial void M();
}
</Document>
<Document>
partial class Test
{
void Goo()
{
var t = new Test();
t.M$$();
}
public partial void [|M|]()
{
throw new NotImplementedException();
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionOnMethodCall1()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class C
{
void [|M|]() { }
void M(int i) { }
void M(int i, string s) { }
void M(string s, int i) { }
void Call()
{
$$M();
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionOnMethodCall2()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class C
{
void M() { }
void [|M|](int i, string s) { }
void M(int i) { }
void M(string s, int i) { }
void Call()
{
$$M(0, "text");
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionOnMethodCall3()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class C
{
void M() { }
void M(int i, string s) { }
void [|M|](int i) { }
void M(string s, int i) { }
void Call()
{
$$M(0);
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionOnMethodCall4()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class C
{
void M() { }
void M(int i, string s) { }
void M(int i) { }
void [|M|](string s, int i) { }
void Call()
{
$$M("text", 0);
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionOnConstructor1()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class [|C|]
{
C() { }
$$C c = new C();
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(3376, "DevDiv_Projects/Roslyn")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionOnConstructor2()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class C
{
[|C|]() { }
C c = new $$C();
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionWithoutExplicitConstruct()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class [|C|]
{
void Method()
{
C c = new $$C();
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionOnLocalVariable1()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class C
{
void method()
{
int [|x|] = 2, y, z = $$x * 2;
y = 10;
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionOnLocalVariable2()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class C
{
void method()
{
int x = 2, [|y|], z = x * 2;
$$y = 10;
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionOnLocalField()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class C
{
int [|_X|] = 1, _Y;
void method()
{
_$$X = 8;
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionOnAttributeClass()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
[FlagsAttribute]
class [|C|]
{
$$C c;
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionTouchLeft()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class [|SomeClass|]
{
$$SomeClass c;
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionTouchRight()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class [|SomeClass|]
{
SomeClass$$ c;
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionOnGenericTypeParameterInPresenceOfInheritedNestedTypeWithSameName()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document><![CDATA[
class B
{
public class T { }
}
class C<[|T|]> : B
{
$$T x;
}]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(538765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538765")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionThroughOddlyNamedType()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document><![CDATA[
class [|dynamic|] { }
class C : dy$$namic { }
]]></Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGoToDefinitionOnConstructorInitializer1()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
private int v;
public Program() : $$this(4)
{
}
public [|Program|](int v)
{
this.v = v;
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGoToDefinitionOnExtensionMethod()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document><![CDATA[
class Program
{
static void Main(string[] args)
{
"1".$$TestExt();
}
}
public static class Ex
{
public static void TestExt<T>(this T ex) { }
public static void [|TestExt|](this string ex) { }
}]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(542004, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542004")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpTestLambdaParameter()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document><![CDATA[
class C
{
delegate int D2(int i, int j);
static void Main()
{
D2 d = (int [|i1|], int i2) => { return $$i1 + i2; };
}
}]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpTestLabel()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document><![CDATA[
class C
{
void M()
{
[|Goo|]:
int Goo;
goto $$Goo;
}
}]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGoToDefinitionFromCref()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document><![CDATA[
/// <see cref="$$SomeClass"/>
class [|SomeClass|]
{
}]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
<WorkItem(16529, "https://github.com/dotnet/roslyn/issues/16529")>
Public Sub TestCSharpGoToOverriddenDefinition_FromDeconstructionDeclaration()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class Two { public void Deconstruct(out int x1, out int x2) => throw null; }
class Four { public void [|Deconstruct|](out int x1, out int x2, out Two x3) => throw null; }
class C
{
void M(Four four)
{
var (a, b, (c, d)) $$= four;
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
<WorkItem(16529, "https://github.com/dotnet/roslyn/issues/16529")>
Public Sub TestCSharpGoToOverriddenDefinition_FromDeconstructionAssignment()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class Two { public void Deconstruct(out int x1, out int x2) => throw null; }
class Four { public void [|Deconstruct|](out int x1, out int x2, out Two x3) => throw null; }
class C
{
void M(Four four)
{
int i;
(i, i, (i, i)) $$= four;
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
<WorkItem(16529, "https://github.com/dotnet/roslyn/issues/16529")>
Public Sub TestCSharpGoToOverriddenDefinition_FromDeconstructionForeach()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class Two { public void Deconstruct(out int x1, out int x2) => throw null; }
class Four { public void [|Deconstruct|](out int x1, out int x2, out Two x3) => throw null; }
class C
{
void M(Four four)
{
foreach (var (a, b, (c, d)) $$in new[] { four }) { }
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGoToOverriddenDefinition_FromOverride()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class Origin { public virtual void Method() { } }
class Base : Origin { public override void [|Method|]() { } }
class Derived : Base { }
class Derived2 : Derived { public ove$$rride void Method() { } }
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGoToOverriddenDefinition_FromOverride2()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class Origin { public virtual void [|Method|]() { } }
class Base : Origin { public ove$$rride void Method() { } }
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGoToOverriddenProperty_FromOverride()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class Origin { public virtual int [|Property|] { get; set; } }
class Base : Origin { public ove$$rride int Property { get; set; } }
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGoToUnmanaged_Keyword()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class C<T> where T : un$$managed
{
}
</Document>
</Project>
</Workspace>
Test(workspace, expectedResult:=False)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGoToUnmanaged_Type()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
interface [|unmanaged|]
{
}
class C<T> where T : un$$managed
{
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(41870, "https://github.com/dotnet/roslyn/issues/41870")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGoToImplementedInterfaceMemberFromImpl1()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
interface IFoo1 { void [|Bar|](); }
class Foo : IFoo1
{
public void $$Bar()
{
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(41870, "https://github.com/dotnet/roslyn/issues/41870")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGoToImplementedInterfaceMemberFromImpl2()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
interface IFoo1 { void [|Bar|](); }
class Foo : IFoo1
{
void IFoo1.$$Bar()
{
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(41870, "https://github.com/dotnet/roslyn/issues/41870")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGoToImplementedInterfaceMemberFromImpl3()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
interface IFoo1 { void [|Bar|](); }
interface IFoo2 { void [|Bar|](); }
class Foo : IFoo1, IFoo2
{
public void $$Bar()
{
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
#End Region
#Region "CSharp TupleTests"
Private ReadOnly tuple2 As XCData =
<![CDATA[
namespace System
{
// struct with two values
public struct ValueTuple<T1, T2>
{
public T1 Item1;
public T2 Item2;
public ValueTuple(T1 item1, T2 item2)
{
this.Item1 = item1;
this.Item2 = item2;
}
public override string ToString()
{
return '{' + Item1?.ToString() + "", "" + Item2?.ToString() + '}';
}
}
}
]]>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionTupleFieldEqualTuples01()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class Program
{
static void Main(string[] args)
{
var x = ([|Alice|]: 1, Bob: 2);
var y = (Alice: 1, Bob: 2);
var z1 = x.$$Alice;
var z2 = y.Alice;
}
}
<%= tuple2 %>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionTupleFieldEqualTuples02()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<!-- intentionally not including tuple2, should still work -->
<Document>
class Program
{
static void Main(string[] args)
{
var x = (Alice: 1, Bob: 2);
var y = ([|Alice|]: 1, Bob: 2);
var z1 = x.Alice;
var z2 = y.$$Alice;
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionTupleFieldMatchToOuter01()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class Program
{
static void Main(string[] args)
{
var x = ([|Program|]: 1, Main: 2);
var z = x.$$Program;
}
}
<%= tuple2 %>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionTupleFieldMatchToOuter02()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class Program
{
static void Main(string[] args)
{
var x = ([|Pro$$gram|]: 1, Main: 2);
var z = x.Program;
}
}
<%= tuple2 %>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionTupleFieldMatchToOuter03()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class Program
{
static void Main(string[] args)
{
var x = (1,2,3,4,5,6,7,8,9,10, [|Program|]: 1, Main: 2);
var z = x.$$Program;
}
}
<%= tuple2 %>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionTupleFieldRedeclared01()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class Program
{
static void Main(string[] args)
{
(int [|Alice|], int Bob) x = (Alice: 1, Bob: 2);
var z1 = x.$$Alice;
}
}
<%= tuple2 %>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionTupleFieldRedeclared02()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class Program
{
static void Main(string[] args)
{
(string Alice, int Bob) x = ([|Al$$ice|]: null, Bob: 2);
var z1 = x.Alice;
}
}
<%= tuple2 %>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionTupleFieldItem01()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class Program
{
static void Main(string[] args)
{
var x = ([|1|], Bob: 2);
var z1 = x.$$Item1;
}
}
<%= tuple2 %>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionTupleFieldItem02()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class Program
{
static void Main(string[] args)
{
var x = ([|Alice|]: 1, Bob: 2);
var z1 = x.$$Item1;
}
}
<%= tuple2 %>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpGotoDefinitionTupleFieldItem03()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class Program
{
static void Main(string[] args)
{
System.ValueTuple<short, short> x = (1, Bob: 2);
var z1 = x.$$Item1;
}
}
<%= tuple2 %>
</Document>
</Project>
</Workspace>
Test(workspace, expectedResult:=False)
End Sub
#End Region
#Region "CSharp Venus Tests"
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpVenusGotoDefinition()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
#line 1 "CSForm1.aspx"
public class [|_Default|]
{
_Defa$$ult a;
#line default
#line hidden
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(545324, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545324")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpFilterGotoDefResultsFromHiddenCodeForUIPresenters()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
public class [|_Default|]
{
#line 1 "CSForm1.aspx"
_Defa$$ult a;
#line default
#line hidden
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(545324, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545324")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpDoNotFilterGotoDefResultsFromHiddenCodeForApis()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
public class [|_Default|]
{
#line 1 "CSForm1.aspx"
_Defa$$ult a;
#line default
#line hidden
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
#End Region
#Region "CSharp Script Tests"
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpScriptGoToDefinition()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
<ParseOptions Kind="Script"/>
class [|SomeClass|] { }
class OtherClass { Some$$Class obj; }
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpScriptGoToDefinitionSameClass()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
<ParseOptions Kind="Script"/>
class [|SomeClass|] { Some$$Class someObject; }
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpScriptGoToDefinitionNestedClass()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
<ParseOptions Kind="Script"/>
class Outer
{
class [|Inner|]
{
}
In$$ner someObj;
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpScriptGotoDefinitionDifferentFiles()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
<ParseOptions Kind="Script"/>
class OtherClass { SomeClass obj; }
</Document>
<Document>
<ParseOptions Kind="Script"/>
class OtherClass2 { Some$$Class obj2; };
</Document>
<Document>
<ParseOptions Kind="Script"/>
class [|SomeClass|] { }
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpScriptGotoDefinitionPartialClasses()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
<ParseOptions Kind="Script"/>
partial class nothing { };
</Document>
<Document>
<ParseOptions Kind="Script"/>
partial class [|OtherClass|] { int a; }
</Document>
<Document>
<ParseOptions Kind="Script"/>
partial class [|OtherClass|] { int b; };
</Document>
<Document>
<ParseOptions Kind="Script"/>
class ConsumingClass { Other$$Class obj; }
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpScriptGotoDefinitionMethod()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
<ParseOptions Kind="Script"/>
class [|SomeClass|] { int x; };
</Document>
<Document>
<ParseOptions Kind="Script"/>
class ConsumingClass
{
void goo()
{
Some$$Class x;
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpScriptGotoDefinitionOnMethodCall1()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
<ParseOptions Kind="Script"/>
class C
{
void [|M|]() { }
void M(int i) { }
void M(int i, string s) { }
void M(string s, int i) { }
void Call()
{
$$M();
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpScriptGotoDefinitionOnMethodCall2()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
<ParseOptions Kind="Script"/>
class C
{
void M() { }
void [|M|](int i, string s) { }
void M(int i) { }
void M(string s, int i) { }
void Call()
{
$$M(0, "text");
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpScriptGotoDefinitionOnMethodCall3()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
<ParseOptions Kind="Script"/>
class C
{
void M() { }
void M(int i, string s) { }
void [|M|](int i) { }
void M(string s, int i) { }
void Call()
{
$$M(0);
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpScriptGotoDefinitionOnMethodCall4()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
<ParseOptions Kind="Script"/>
class C
{
void M() { }
void M(int i, string s) { }
void M(int i) { }
void [|M|](string s, int i) { }
void Call()
{
$$M("text", 0);
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(989476, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/989476")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpDoNotFilterGeneratedSourceLocations()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Nongenerated.cs">
partial class [|C|]
{
void M()
{
$$C c;
}
}
</Document>
<Document FilePath="Generated.g.i.cs">
partial class [|C|]
{
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(989476, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/989476")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpUseGeneratedSourceLocationsIfNoNongeneratedLocationsAvailable()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document FilePath="Generated.g.i.cs">
class [|C|]
{
}
</Document>
<Document FilePath="Nongenerated.g.i.cs">
class D
{
void M()
{
$$C c;
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
#End Region
#Region "Normal Visual Basic Tests"
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicGoToDefinition()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class [|SomeClass|]
End Class
Class OtherClass
Dim obj As Some$$Class
End Class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
<WorkItem(23030, "https://github.com/dotnet/roslyn/issues/23030")>
Public Sub TestVisualBasicLiteralGoToDefinition()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Dim x as Integer = 12$$3
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
<WorkItem(23030, "https://github.com/dotnet/roslyn/issues/23030")>
Public Sub TestVisualBasicStringLiteralGoToDefinition()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Dim x as String = "wo$$ow"
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(541105, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541105")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicPropertyBackingField()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class C
Property [|P|] As Integer
Sub M()
Me.$$_P = 10
End Sub
End Class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicGoToDefinitionSameClass()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class [|SomeClass|]
Dim obj As Some$$Class
End Class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicGoToDefinitionNestedClass()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class Outer
Class [|Inner|]
End Class
Dim obj as In$$ner
End Class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicGotoDefinitionDifferentFiles()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class OtherClass
Dim obj As SomeClass
End Class
</Document>
<Document>
Class OtherClass2
Dim obj As Some$$Class
End Class
</Document>
<Document>
Class [|SomeClass|]
End Class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicGotoDefinitionPartialClasses()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
DummyClass
End Class
</Document>
<Document>
Partial Class [|OtherClass|]
Dim a As Integer
End Class
</Document>
<Document>
Partial Class [|OtherClass|]
Dim b As Integer
End Class
</Document>
<Document>
Class ConsumingClass
Dim obj As Other$$Class
End Class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicGotoDefinitionMethod()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class [|SomeClass|]
Dim x As Integer
End Class
</Document>
<Document>
Class ConsumingClass
Sub goo()
Dim obj As Some$$Class
End Sub
End Class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(900438, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/900438")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicGotoDefinitionPartialMethod()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Partial Class Customer
Private Sub [|OnNameChanged|]()
End Sub
End Class
</Document>
<Document>
Partial Class Customer
Sub New()
Dim x As New Customer()
x.OnNameChanged$$()
End Sub
Partial Private Sub OnNameChanged()
End Sub
End Class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicTouchLeft()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class [|SomeClass|]
Dim x As Integer
End Class
</Document>
<Document>
Class ConsumingClass
Sub goo()
Dim obj As $$SomeClass
End Sub
End Class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicTouchRight()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class [|SomeClass|]
Dim x As Integer
End Class
</Document>
<Document>
Class ConsumingClass
Sub goo()
Dim obj As SomeClass$$
End Sub
End Class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(542872, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542872")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicMe()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class B
Sub New()
End Sub
End Class
Class [|C|]
Inherits B
Sub New()
MyBase.New()
MyClass.Goo()
$$Me.Bar()
End Sub
Private Sub Bar()
End Sub
Private Sub Goo()
End Sub
End Class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(542872, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542872")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicMyClass()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class B
Sub New()
End Sub
End Class
Class [|C|]
Inherits B
Sub New()
MyBase.New()
$$MyClass.Goo()
Me.Bar()
End Sub
Private Sub Bar()
End Sub
Private Sub Goo()
End Sub
End Class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(542872, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542872")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicMyBase()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class [|B|]
Sub New()
End Sub
End Class
Class C
Inherits B
Sub New()
$$MyBase.New()
MyClass.Goo()
Me.Bar()
End Sub
Private Sub Bar()
End Sub
Private Sub Goo()
End Sub
End Class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicGoToOverridenSubDefinition()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class Base
Overridable Sub [|Method|]()
End Sub
End Class
Class Derived
Inherits Base
Overr$$ides Sub Method()
End Sub
End Class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicGoToOverridenFunctionDefinition()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class Base
Overridable Function [|Method|]() As Integer
Return 1
End Function
End Class
Class Derived
Inherits Base
Overr$$ides Function Method() As Integer
Return 1
End Function
End Class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicGoToOverridenPropertyDefinition()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class Base
Overridable Property [|Number|] As Integer
End Class
Class Derived
Inherits Base
Overr$$ides Property Number As Integer
End Class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
#End Region
#Region "Venus Visual Basic Tests"
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicVenusGotoDefinition()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
#ExternalSource ("Default.aspx", 1)
Class [|Program|]
Sub Main(args As String())
Dim f As New Pro$$gram()
End Sub
End Class
#End ExternalSource
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(545324, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545324")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicFilterGotoDefResultsFromHiddenCodeForUIPresenters()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class [|Program|]
Sub Main(args As String())
#ExternalSource ("Default.aspx", 1)
Dim f As New Pro$$gram()
End Sub
End Class
#End ExternalSource
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(545324, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545324")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicDoNotFilterGotoDefResultsFromHiddenCodeForApis()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class [|Program|]
Sub Main(args As String())
#ExternalSource ("Default.aspx", 1)
Dim f As New Pro$$gram()
End Sub
End Class
#End ExternalSource
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
#End Region
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicTestThroughExecuteCommand()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class [|SomeClass|]
Dim x As Integer
End Class
</Document>
<Document>
Class ConsumingClass
Sub goo()
Dim obj As SomeClass$$
End Sub
End Class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicGoToDefinitionOnExtensionMethod()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
<
End Sub
End Module]]>]
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(542220, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542220")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpTestAliasAndTarget1()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
using [|AliasedSomething|] = X.Something;
namespace X
{
class Something { public Something() { } }
}
class Program
{
static void Main(string[] args)
{
$$AliasedSomething x = new AliasedSomething();
X.Something y = new X.Something();
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(542220, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542220")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpTestAliasAndTarget2()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
using [|AliasedSomething|] = X.Something;
namespace X
{
class Something { public Something() { } }
}
class Program
{
static void Main(string[] args)
{
AliasedSomething x = new $$AliasedSomething();
X.Something y = new X.Something();
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(542220, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542220")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpTestAliasAndTarget3()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
using AliasedSomething = X.Something;
namespace X
{
class [|Something|] { public Something() { } }
}
class Program
{
static void Main(string[] args)
{
AliasedSomething x = new AliasedSomething();
X.$$Something y = new X.Something();
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(542220, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542220")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCSharpTestAliasAndTarget4()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
using AliasedSomething = X.Something;
namespace X
{
class Something { public [|Something|]() { } }
}
class Program
{
static void Main(string[] args)
{
AliasedSomething x = new AliasedSomething();
X.Something y = new X.$$Something();
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(543218, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543218")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicQueryRangeVariable()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Imports System
Imports System.Collections.Generic
Imports System.Linq
Module Program
Sub Main(args As String())
Dim arr = New Integer() {4, 5}
Dim q3 = From [|num|] In arr Select $$num
End Sub
End Module
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(529060, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529060")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestVisualBasicGotoConstant()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Module M
Sub Main()
label1: GoTo $$200
[|200|]: GoTo label1
End Sub
End Module
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(10132, "https://github.com/dotnet/roslyn/issues/10132")>
<WorkItem(545661, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545661")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCrossLanguageParameterizedPropertyOverride()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true" AssemblyName="VBProj">
<Document>
Public Class A
Public Overridable ReadOnly Property X(y As Integer) As Integer
[|Get|]
End Get
End Property
End Class
</Document>
</Project>
<Project Language="C#" CommonReferences="true">
<ProjectReference>VBProj</ProjectReference>
<Document>
class B : A
{
public override int get_X(int y)
{
return base.$$get_X(y);
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(866094, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/866094")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestCrossLanguageNavigationToVBModuleMember()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true" AssemblyName="VBProj">
<Document>
Public Module A
Public Sub [|M|]()
End Sub
End Module
</Document>
</Project>
<Project Language="C#" CommonReferences="true">
<ProjectReference>VBProj</ProjectReference>
<Document>
class C
{
static void N()
{
A.$$M();
}
}
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
#Region "Show notification tests"
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestShowNotificationVB()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class SomeClass
End Class
Cl$$ass OtherClass
Dim obj As SomeClass
End Class
</Document>
</Project>
</Workspace>
Test(workspace, expectedResult:=False)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestShowNotificationCS()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class SomeClass { }
cl$$ass OtherClass
{
SomeClass obj;
}
</Document>
</Project>
</Workspace>
Test(workspace, expectedResult:=False)
End Sub
<WorkItem(546341, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546341")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestGoToDefinitionOnGlobalKeyword()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class C
{
gl$$obal::System.String s;
}
</Document>
</Project>
</Workspace>
Test(workspace, expectedResult:=False)
End Sub
<WorkItem(902119, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/902119")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestGoToDefinitionOnInferredFieldInitializer()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Public Class Class2
Sub Test()
Dim var1 = New With {Key .var2 = "Bob", Class2.va$$r3}
End Sub
Shared Property [|var3|]() As Integer
Get
End Get
Set(ByVal value As Integer)
End Set
End Property
End Class
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(885151, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/885151")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestGoToDefinitionGlobalImportAlias()
Dim workspace =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<ProjectReference>VBAssembly</ProjectReference>
<CompilationOptions>
<GlobalImport>Goo = Importable.ImportMe</GlobalImport>
</CompilationOptions>
<Document>
Public Class Class2
Sub Test()
Dim x as Go$$o
End Sub
End Class
</Document>
</Project>
<Project Language="Visual Basic" CommonReferences="true" AssemblyName="VBAssembly">
<Document>
Namespace Importable
Public Class [|ImportMe|]
End Class
End Namespace
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
#End Region
#Region "CSharp Query expressions Tests"
Private Shared Function GetExpressionPatternDefinition(highlight As String, Optional index As Integer = 0) As String
Dim definition As String =
"
using System;
namespace QueryPattern
{
public class C
{
public C<T> Cast<T>() => throw new NotImplementedException();
}
public class C<T> : C
{
public C<T> Where(Func<T, bool> predicate) => throw new NotImplementedException();
public C<U> Select<U>(Func<T, U> selector) => throw new NotImplementedException();
public C<V> SelectMany<U, V>(Func<T, C<U>> selector, Func<T, U, V> resultSelector) => throw new NotImplementedException();
public C<V> Join<U, K, V>(C<U> inner, Func<T, K> outerKeySelector, Func<U, K> innerKeySelector, Func<T, U, V> resultSelector) => throw new NotImplementedException();
public C<V> GroupJoin<U, K, V>(C<U> inner, Func<T, K> outerKeySelector, Func<U, K> innerKeySelector, Func<T, C<U>, V> resultSelector) => throw new NotImplementedException();
public O<T> OrderBy<K>(Func<T, K> keySelector) => throw new NotImplementedException();
public O<T> OrderByDescending<K>(Func<T, K> keySelector) => throw new NotImplementedException();
public C<G<K, T>> GroupBy<K>(Func<T, K> keySelector) => throw new NotImplementedException();
public C<G<K, E>> GroupBy<K, E>(Func<T, K> keySelector, Func<T, E> elementSelector) => throw new NotImplementedException();
}
public class O<T> : C<T>
{
public O<T> ThenBy<K>(Func<T, K> keySelector) => throw new NotImplementedException();
public O<T> ThenByDescending<K>(Func<T, K> keySelector) => throw new NotImplementedException();
}
public class G<K, T> : C<T>
{
public K Key { get; }
}
}
"
If highlight = "" Then
Return definition
End If
Dim searchStartPosition As Integer = 0
Dim searchFound As Integer
For i As Integer = 0 To index
searchFound = definition.IndexOf(highlight, searchStartPosition)
If searchFound < 0 Then
Exit For
End If
Next
If searchFound >= 0 Then
definition = definition.Insert(searchFound + highlight.Length, "|]")
definition = definition.Insert(searchFound, "[|")
Return definition
End If
Throw New InvalidOperationException("Highlight not found")
End Function
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQuerySelect()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("Select") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i in new C<int>()
$$select i;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryWhere()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("Where") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i in new C<int>()
$$where true
select i;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQuerySelectMany1()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("SelectMany") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
$$from i2 in new C<int>()
select i1;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQuerySelectMany2()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("SelectMany") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
from i2 $$in new C<int>()
select i1;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryJoin1()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("Join") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
$$join i2 in new C<int>() on i2 equals i1
select i2;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryJoin2()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("Join") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
join i2 $$in new C<int>() on i1 equals i2
select i2;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryJoin3()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("Join") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
join i2 in new C<int>() $$on i1 equals i2
select i2;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryJoin4()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("Join") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
join i2 in new C<int>() on i1 $$equals i2
select i2;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryGroupJoin1()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("GroupJoin") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
$$join i2 in new C<int>() on i1 equals i2 into g
select g;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryGroupJoin2()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("GroupJoin") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
join i2 $$in new C<int>() on i1 equals i2 into g
select g;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryGroupJoin3()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("GroupJoin") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
join i2 in new C<int>() $$on i1 equals i2 into g
select g;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryGroupJoin4()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("GroupJoin") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
join i2 in new C<int>() on i1 $$equals i2 into g
select g;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryGroupBy1()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("GroupBy") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
$$group i1 by i1;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryGroupBy2()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("GroupBy") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
group i1 $$by i1;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryFromCast1()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("Cast") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = $$from int i1 in new C<int>()
select i1;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryFromCast2()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("Cast") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from int i1 $$in new C<int>()
select i1;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryJoinCast1()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("Cast") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
join int i2 $$in new C<int>() on i1 equals i2
select i2;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryJoinCast2()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("Join") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
$$join int i2 in new C<int>() on i1 equals i2
select i2;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQuerySelectManyCast1()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("Cast") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
from int i2 $$in new C<int>()
select i2;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQuerySelectManyCast2()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("SelectMany") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
$$from int i2 in new C<int>()
select i2;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryOrderBySingleParameter()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("OrderBy") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
$$orderby i1
select i1;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryOrderBySingleParameterWithOrderClause()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("OrderByDescending") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
orderby i1 $$descending
select i1;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryOrderByTwoParameterWithoutOrderClause()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("ThenBy") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
orderby i1,$$ i2
select i1;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryOrderByTwoParameterWithOrderClause()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("ThenByDescending") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
orderby i1, i2 $$descending
select i1;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryDegeneratedSelect()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
where true
$$select i1;
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace, False)
End Sub
<WorkItem(23049, "https://github.com/dotnet/roslyn/pull/23049")>
<WpfFact, Trait(Traits.Feature, Traits.Features.GoToDefinition)>
Public Sub TestQueryLet()
Dim workspace =
<Workspace>
<Project Language="C#" CommonReferences="true" AssemblyName="QueryPattern">
<Document>
<%= GetExpressionPatternDefinition("Select") %>
</Document>
</Project>
<Project Language="C#" CommonReferences="true" AssemblyName="CSharpProj">
<ProjectReference>QueryPattern</ProjectReference>
<Document>
<![CDATA[
using QueryPattern;
class Test
{
static void M()
{
var qry = from i1 in new C<int>()
$$let i2=1
select new { i1, i2 };
}
}
]]>
</Document>
</Project>
</Workspace>
Test(workspace)
End Sub
#End Region
End Class
End Namespace
|
ErikSchierboom/roslyn
|
src/EditorFeatures/Test2/GoToDefinition/GoToDefinitionTests.vb
|
Visual Basic
|
apache-2.0
| 95,355
|
' 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 System.Threading
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.CodeActions
Imports Microsoft.CodeAnalysis.CodeRefactorings
Imports Microsoft.CodeAnalysis.FindSymbols
Imports Microsoft.CodeAnalysis.Formatting
Imports Microsoft.CodeAnalysis.Simplification
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.VisualBasic.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.InlineTemporary
<ExportCodeRefactoringProvider(LanguageNames.VisualBasic, Name:=PredefinedCodeRefactoringProviderNames.InlineTemporary), [Shared]>
Partial Friend Class InlineTemporaryCodeRefactoringProvider
Inherits CodeRefactoringProvider
Public Overloads Overrides Async Function ComputeRefactoringsAsync(context As CodeRefactoringContext) As Task
Dim document = context.Document
Dim textSpan = context.Span
Dim cancellationToken = context.CancellationToken
Dim workspace = document.Project.Solution.Workspace
If workspace.Kind = WorkspaceKind.MiscellaneousFiles Then
Return
End If
Dim root = Await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False)
Dim token = DirectCast(root, SyntaxNode).FindToken(textSpan.Start)
If Not token.Span.Contains(textSpan) Then
Return
End If
Dim node = token.Parent
If Not node.IsKind(SyntaxKind.ModifiedIdentifier) OrElse
Not node.IsParentKind(SyntaxKind.VariableDeclarator) OrElse
Not node.Parent.IsParentKind(SyntaxKind.LocalDeclarationStatement) Then
Return
End If
Dim modifiedIdentifier = DirectCast(node, ModifiedIdentifierSyntax)
Dim variableDeclarator = DirectCast(modifiedIdentifier.Parent, VariableDeclaratorSyntax)
Dim localDeclarationStatement = DirectCast(variableDeclarator.Parent, LocalDeclarationStatementSyntax)
If modifiedIdentifier.Identifier <> token OrElse
Not variableDeclarator.HasInitializer() Then
Return
End If
If localDeclarationStatement.ParentingNodeContainsDiagnostics() Then
Return
End If
Dim references = Await GetReferencesAsync(document, modifiedIdentifier, cancellationToken).ConfigureAwait(False)
If Not references.Any() Then
Return
End If
context.RegisterRefactoring(
New MyCodeAction(VBFeaturesResources.InlineTemporaryVariable, Function(c) InlineTemporaryAsync(document, modifiedIdentifier, c)))
End Function
Private Async Function GetReferencesAsync(
document As Document,
modifiedIdentifier As ModifiedIdentifierSyntax,
cancellationToken As CancellationToken) As Task(Of IEnumerable(Of ReferenceLocation))
Dim semanticModel = Await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(False)
Dim local = TryCast(semanticModel.GetDeclaredSymbol(modifiedIdentifier, cancellationToken), ILocalSymbol)
If local IsNot Nothing Then
Dim solution = document.Project.Solution
Dim findReferencesResult = Await SymbolFinder.FindReferencesAsync(local, solution, cancellationToken).ConfigureAwait(False)
Dim locations = findReferencesResult.Single(Function(r) r.Definition Is local).Locations
If Not locations.Any(Function(loc) semanticModel.SyntaxTree.OverlapsHiddenPosition(loc.Location.SourceSpan, cancellationToken)) Then
Return locations
End If
End If
Return SpecializedCollections.EmptyEnumerable(Of ReferenceLocation)()
End Function
Private Shared Function HasConflict(
identifier As IdentifierNameSyntax,
definition As ModifiedIdentifierSyntax,
expressionToInline As ExpressionSyntax,
semanticModel As SemanticModel
) As Boolean
If identifier.SpanStart < definition.SpanStart Then
Return True
End If
Dim identifierNode = identifier _
.Ancestors() _
.TakeWhile(Function(n)
Return n.Kind = SyntaxKind.ParenthesizedExpression OrElse
TypeOf n Is CastExpressionSyntax OrElse
TypeOf n Is PredefinedCastExpressionSyntax
End Function) _
.LastOrDefault()
If identifierNode Is Nothing Then
identifierNode = identifier
End If
If TypeOf identifierNode.Parent Is AssignmentStatementSyntax Then
Dim assignment = CType(identifierNode.Parent, AssignmentStatementSyntax)
If assignment.Left Is identifierNode Then
Return True
End If
End If
If TypeOf identifierNode.Parent Is ArgumentSyntax Then
If TypeOf expressionToInline Is LiteralExpressionSyntax OrElse
TypeOf expressionToInline Is CastExpressionSyntax OrElse
TypeOf expressionToInline Is PredefinedCastExpressionSyntax Then
Dim argument = DirectCast(identifierNode.Parent, ArgumentSyntax)
Dim parameter = argument.DetermineParameter(semanticModel)
If parameter IsNot Nothing Then
Return parameter.RefKind <> RefKind.None
End If
End If
End If
Return False
End Function
Private Shared ReadOnly s_definitionAnnotation As New SyntaxAnnotation
Private Shared ReadOnly s_referenceAnnotation As New SyntaxAnnotation
Private Shared ReadOnly s_initializerAnnotation As New SyntaxAnnotation
Private Shared ReadOnly s_expressionToInlineAnnotation As New SyntaxAnnotation
Private Async Function InlineTemporaryAsync(document As Document, modifiedIdentifier As ModifiedIdentifierSyntax, cancellationToken As CancellationToken) As Task(Of Document)
' First, annotate the modified identifier so that we can get back to it later.
Dim updatedDocument = Await document.ReplaceNodeAsync(modifiedIdentifier, modifiedIdentifier.WithAdditionalAnnotations(s_definitionAnnotation), cancellationToken).ConfigureAwait(False)
Dim semanticModel = Await updatedDocument.GetSemanticModelAsync(cancellationToken).ConfigureAwait(False)
modifiedIdentifier = Await FindDefinitionAsync(updatedDocument, cancellationToken).ConfigureAwait(False)
' Create the expression that we're actually going to inline
Dim expressionToInline = Await CreateExpressionToInlineAsync(updatedDocument, cancellationToken).ConfigureAwait(False)
' Collect the identifier names for each reference.
Dim local = semanticModel.GetDeclaredSymbol(modifiedIdentifier, cancellationToken)
Dim symbolRefs = Await SymbolFinder.FindReferencesAsync(local, updatedDocument.Project.Solution, cancellationToken).ConfigureAwait(False)
Dim references = symbolRefs.Single(Function(r) r.Definition Is local).Locations
Dim syntaxRoot = Await updatedDocument.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False)
' Collect the target statement for each reference.
Dim nonConflictingIdentifierNodes = references _
.Select(Function(loc) DirectCast(syntaxRoot.FindToken(loc.Location.SourceSpan.Start).Parent, IdentifierNameSyntax)) _
.Where(Function(ident) Not HasConflict(ident, modifiedIdentifier, expressionToInline, semanticModel))
' Add referenceAnnotations to identifier nodes being replaced.
updatedDocument = Await updatedDocument.ReplaceNodesAsync(
nonConflictingIdentifierNodes,
Function(o, n) n.WithAdditionalAnnotations(s_referenceAnnotation),
cancellationToken).ConfigureAwait(False)
semanticModel = Await updatedDocument.GetSemanticModelAsync(cancellationToken).ConfigureAwait(False)
modifiedIdentifier = Await FindDefinitionAsync(updatedDocument, cancellationToken).ConfigureAwait(False)
' Get the annotated reference nodes.
nonConflictingIdentifierNodes = Await FindReferenceAnnotatedNodesAsync(updatedDocument, cancellationToken).ConfigureAwait(False)
Dim topMostStatements = nonConflictingIdentifierNodes _
.Select(Function(ident) GetTopMostStatementForExpression(ident))
' Next, get the top-most statement of the local declaration
Dim variableDeclarator = DirectCast(modifiedIdentifier.Parent, VariableDeclaratorSyntax)
Dim localDeclaration = DirectCast(variableDeclarator.Parent, LocalDeclarationStatementSyntax)
Dim originalInitializerSymbolInfo = DirectCast(semanticModel, SemanticModel).GetSymbolInfo(variableDeclarator.GetInitializer())
Dim topMostStatementOfLocalDeclaration = If(localDeclaration.HasAncestor(Of ExpressionSyntax),
localDeclaration.Ancestors().OfType(Of ExpressionSyntax).Last().FirstAncestorOrSelf(Of StatementSyntax)(),
localDeclaration)
topMostStatements = topMostStatements.Concat(topMostStatementOfLocalDeclaration)
' Next get the statements before and after the top-most statement of the local declaration
Dim previousStatement = topMostStatementOfLocalDeclaration.GetPreviousStatement()
If previousStatement IsNot Nothing Then
topMostStatements = topMostStatements.Concat(previousStatement)
End If
' Now, add the statement *after* each top-level statement.
Dim nextStatements = topMostStatements _
.Select(Function(stmt) stmt.GetNextStatement()) _
.WhereNotNull()
topMostStatements = topMostStatements _
.Concat(nextStatements) _
.Distinct()
' Make each target statement semantically explicit.
updatedDocument = Await updatedDocument.ReplaceNodesAsync(
topMostStatements,
Function(o, n)
Return Simplifier.Expand(DirectCast(n, StatementSyntax), semanticModel, document.Project.Solution.Workspace, cancellationToken:=cancellationToken)
End Function,
cancellationToken).ConfigureAwait(False)
semanticModel = Await updatedDocument.GetSemanticModelAsync(cancellationToken).ConfigureAwait(False)
Dim semanticModelBeforeInline = semanticModel
modifiedIdentifier = Await FindDefinitionAsync(updatedDocument, cancellationToken).ConfigureAwait(False)
Dim scope = GetScope(modifiedIdentifier)
Dim newScope = ReferenceRewriter.Visit(semanticModel, scope, modifiedIdentifier, expressionToInline, cancellationToken)
updatedDocument = Await updatedDocument.ReplaceNodeAsync(scope, newScope.WithAdditionalAnnotations(Formatter.Annotation), cancellationToken).ConfigureAwait(False)
semanticModel = Await updatedDocument.GetSemanticModelAsync(cancellationToken).ConfigureAwait(False)
modifiedIdentifier = Await FindDefinitionAsync(updatedDocument, cancellationToken).ConfigureAwait(False)
newScope = GetScope(modifiedIdentifier)
Dim conflicts = newScope.GetAnnotatedNodesAndTokens(ConflictAnnotation.Kind)
Dim declaratorConflicts = modifiedIdentifier.GetAnnotatedNodesAndTokens(ConflictAnnotation.Kind)
' Note that we only remove the local declaration if there weren't any conflicts,
' unless those conflicts are inside the local declaration.
If conflicts.Count() = declaratorConflicts.Count() Then
' Certain semantic conflicts can be detected only after the reference rewriter has inlined the expression
Dim newDocument = Await DetectSemanticConflicts(updatedDocument,
DirectCast(semanticModel, SemanticModel),
DirectCast(semanticModelBeforeInline, SemanticModel),
originalInitializerSymbolInfo,
cancellationToken).ConfigureAwait(False)
If updatedDocument Is newDocument Then
' No semantic conflicts, we can remove the definition.
updatedDocument = Await updatedDocument.ReplaceNodeAsync(newScope, RemoveDefinition(modifiedIdentifier, newScope), cancellationToken).ConfigureAwait(False)
Else
' There were some semantic conflicts, don't remove the definition.
updatedDocument = newDocument
End If
End If
Return updatedDocument
End Function
Private Shared Async Function FindDefinitionAsync(document As Document, cancellationToken As CancellationToken) As Task(Of ModifiedIdentifierSyntax)
Dim root = Await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False)
Dim result = root _
.GetAnnotatedNodesAndTokens(s_definitionAnnotation) _
.Single() _
.AsNode()
Return DirectCast(result, ModifiedIdentifierSyntax)
End Function
Private Shared Async Function FindReferenceAnnotatedNodesAsync(document As Document, cancellationToken As CancellationToken) As Task(Of IEnumerable(Of IdentifierNameSyntax))
Dim root = Await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False)
Return FindReferenceAnnotatedNodesAsync(root)
End Function
Private Shared Iterator Function FindReferenceAnnotatedNodesAsync(root As SyntaxNode) As IEnumerable(Of IdentifierNameSyntax)
Dim annotatedNodesAndTokens = root.GetAnnotatedNodesAndTokens(s_referenceAnnotation)
For Each nodeOrToken In annotatedNodesAndTokens
If nodeOrToken.IsNode AndAlso nodeOrToken.AsNode.IsKind(SyntaxKind.IdentifierName) Then
Yield DirectCast(nodeOrToken.AsNode, IdentifierNameSyntax)
End If
Next
End Function
Private Shared Function GetScope(modifiedIdentifier As ModifiedIdentifierSyntax) As SyntaxNode
Dim variableDeclarator = DirectCast(modifiedIdentifier.Parent, VariableDeclaratorSyntax)
Dim localDeclaration = DirectCast(variableDeclarator.Parent, LocalDeclarationStatementSyntax)
Return localDeclaration.Parent
End Function
Private Function GetUpdatedDeclaration(modifiedIdentifier As ModifiedIdentifierSyntax) As LocalDeclarationStatementSyntax
Dim variableDeclarator = DirectCast(modifiedIdentifier.Parent, VariableDeclaratorSyntax)
Dim localDeclaration = DirectCast(variableDeclarator.Parent, LocalDeclarationStatementSyntax)
If localDeclaration.Declarators.Count > 1 And variableDeclarator.Names.Count = 1 Then
Return localDeclaration.RemoveNode(variableDeclarator, SyntaxRemoveOptions.KeepEndOfLine)
End If
If variableDeclarator.Names.Count > 1 Then
Return localDeclaration.RemoveNode(modifiedIdentifier, SyntaxRemoveOptions.KeepEndOfLine)
End If
Contract.Fail("Failed to update local declaration")
Return localDeclaration
End Function
Private Function RemoveDefinition(modifiedIdentifier As ModifiedIdentifierSyntax, newBlock As SyntaxNode) As SyntaxNode
Dim variableDeclarator = DirectCast(modifiedIdentifier.Parent, VariableDeclaratorSyntax)
Dim localDeclaration = DirectCast(variableDeclarator.Parent, LocalDeclarationStatementSyntax)
If variableDeclarator.Names.Count > 1 OrElse
localDeclaration.Declarators.Count > 1 Then
' In this case, we need to remove the definition from either the declarators or the names of
' the local declaration.
Dim newDeclaration = GetUpdatedDeclaration(modifiedIdentifier) _
.WithAdditionalAnnotations(Formatter.Annotation)
Dim newStatements = newBlock.GetExecutableBlockStatements().Replace(localDeclaration, newDeclaration)
Return newBlock.ReplaceStatements(newStatements)
Else
' In this case, we're removing the local declaration. Care must be taken to move any
' non-whitespace trivia to the next statement.
Dim blockStatements = newBlock.GetExecutableBlockStatements()
Dim declarationIndex = blockStatements.IndexOf(localDeclaration)
Dim leadingTrivia = localDeclaration _
.GetLeadingTrivia() _
.Reverse() _
.SkipWhile(Function(t) t.IsKind(SyntaxKind.WhitespaceTrivia)) _
.Reverse()
Dim trailingTrivia = localDeclaration _
.GetTrailingTrivia() _
.SkipWhile(Function(t) t.IsKind(SyntaxKind.WhitespaceTrivia, SyntaxKind.EndOfLineTrivia, SyntaxKind.ColonTrivia))
Dim newLeadingTrivia = leadingTrivia.Concat(trailingTrivia)
' Ensure that we leave a line break if our local declaration ended with a comment.
If newLeadingTrivia.Any() AndAlso newLeadingTrivia.Last().IsKind(SyntaxKind.CommentTrivia) Then
newLeadingTrivia = newLeadingTrivia.Concat(SyntaxFactory.CarriageReturnLineFeed)
End If
Dim nextToken = localDeclaration.GetLastToken().GetNextToken()
Dim newNextToken = nextToken _
.WithPrependedLeadingTrivia(newLeadingTrivia.ToSyntaxTriviaList()) _
.WithAdditionalAnnotations(Formatter.Annotation)
Dim previousToken = localDeclaration.GetFirstToken().GetPreviousToken()
' If the previous token has trailing colon trivia, replace it with a new line.
Dim previousTokenTrailingTrivia = previousToken.TrailingTrivia.ToList()
If previousTokenTrailingTrivia.Count > 0 AndAlso previousTokenTrailingTrivia.Last().IsKind(SyntaxKind.ColonTrivia) Then
previousTokenTrailingTrivia(previousTokenTrailingTrivia.Count - 1) = SyntaxFactory.CarriageReturnLineFeed
End If
Dim newPreviousToken = previousToken _
.WithTrailingTrivia(previousTokenTrailingTrivia) _
.WithAdditionalAnnotations(Formatter.Annotation)
newBlock = newBlock.ReplaceTokens({previousToken, nextToken},
Function(oldToken, newToken)
If oldToken = nextToken Then
Return newNextToken
ElseIf oldToken = previousToken Then
Return newPreviousToken
Else
Return newToken
End If
End Function)
Dim newBlockStatements = newBlock.GetExecutableBlockStatements()
Dim newStatements = newBlockStatements.RemoveAt(declarationIndex)
Return newBlock.ReplaceStatements(newStatements)
End If
End Function
Private Shared Function AddExplicitArgumentListIfNeeded(expression As ExpressionSyntax, semanticModel As SemanticModel) As ExpressionSyntax
If expression.IsKind(SyntaxKind.IdentifierName) OrElse
expression.IsKind(SyntaxKind.GenericName) OrElse
expression.IsKind(SyntaxKind.SimpleMemberAccessExpression) Then
Dim symbol = semanticModel.GetSymbolInfo(expression).Symbol
If symbol IsNot Nothing AndAlso
(symbol.Kind = SymbolKind.Method OrElse symbol.Kind = SymbolKind.Property) Then
Dim trailingTrivia = expression.GetTrailingTrivia()
Return SyntaxFactory _
.InvocationExpression(
expression:=expression.WithTrailingTrivia(CType(Nothing, SyntaxTriviaList)),
argumentList:=SyntaxFactory.ArgumentList().WithTrailingTrivia(trailingTrivia)) _
.WithAdditionalAnnotations(Simplifier.Annotation)
End If
End If
Return expression
End Function
Private Shared Async Function CreateExpressionToInlineAsync(document As Document, cancellationToken As CancellationToken) As Task(Of ExpressionSyntax)
' TODO: We should be using a speculative semantic model in the method rather than forking new semantic model every time.
Dim semanticModel = Await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(False)
Dim modifiedIdentifier = Await FindDefinitionAsync(document, cancellationToken).ConfigureAwait(False)
Dim initializer = DirectCast(modifiedIdentifier.Parent, VariableDeclaratorSyntax).GetInitializer()
Dim newInitializer = AddExplicitArgumentListIfNeeded(initializer, semanticModel) _
.WithAdditionalAnnotations(s_initializerAnnotation)
Dim updatedDocument = Await document.ReplaceNodeAsync(initializer, newInitializer, cancellationToken).ConfigureAwait(False)
modifiedIdentifier = Await FindDefinitionAsync(updatedDocument, cancellationToken).ConfigureAwait(False)
initializer = DirectCast(modifiedIdentifier.Parent, VariableDeclaratorSyntax).GetInitializer()
Dim explicitInitializer = Await Simplifier.ExpandAsync(initializer, updatedDocument, cancellationToken:=cancellationToken).ConfigureAwait(False)
Dim lastToken = explicitInitializer.GetLastToken()
explicitInitializer = explicitInitializer.ReplaceToken(lastToken, lastToken.WithTrailingTrivia(CType(Nothing, SyntaxTriviaList)))
updatedDocument = Await updatedDocument.ReplaceNodeAsync(initializer, explicitInitializer, cancellationToken).ConfigureAwait(False)
semanticModel = Await updatedDocument.GetSemanticModelAsync(cancellationToken).ConfigureAwait(False)
modifiedIdentifier = Await FindDefinitionAsync(updatedDocument, cancellationToken).ConfigureAwait(False)
explicitInitializer = DirectCast(modifiedIdentifier.Parent, VariableDeclaratorSyntax).GetInitializer()
Dim local = DirectCast(semanticModel.GetDeclaredSymbol(modifiedIdentifier, cancellationToken), ILocalSymbol)
Dim wasCastAdded As Boolean = False
explicitInitializer = explicitInitializer.CastIfPossible(local.Type,
modifiedIdentifier.SpanStart,
DirectCast(semanticModel, SemanticModel),
wasCastAdded)
Return explicitInitializer.WithAdditionalAnnotations(s_expressionToInlineAnnotation)
End Function
Private Shared Function GetTopMostStatementForExpression(expression As ExpressionSyntax) As StatementSyntax
Return expression.AncestorsAndSelf().OfType(Of ExpressionSyntax).Last().FirstAncestorOrSelf(Of StatementSyntax)()
End Function
Private Shared Async Function DetectSemanticConflicts(
inlinedDocument As Document,
newSemanticModelForInlinedDocument As SemanticModel,
semanticModelBeforeInline As SemanticModel,
originalInitializerSymbolInfo As SymbolInfo,
cancellationToken As CancellationToken
) As Task(Of Document)
' In this method we detect if inlining the expression introduced the following semantic change:
' The symbol info associated with any of the inlined expressions does not match the symbol info for original initializer expression prior to inline.
' If any semantic changes were introduced by inlining, we update the document with conflict annotations.
' Otherwise we return the given inlined document without any changes.
Dim syntaxRootBeforeInline = Await semanticModelBeforeInline.SyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(False)
' Get all the identifier nodes which were replaced with inlined expression.
Dim originalIdentifierNodes = FindReferenceAnnotatedNodesAsync(syntaxRootBeforeInline)
If originalIdentifierNodes.IsEmpty Then
' No conflicts
Return inlinedDocument
End If
' Get all the inlined expression nodes.
Dim syntaxRootAfterInline = Await inlinedDocument.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False)
Dim inlinedExprNodes = syntaxRootAfterInline.GetAnnotatedNodesAndTokens(s_expressionToInlineAnnotation)
Debug.Assert(originalIdentifierNodes.Count() = inlinedExprNodes.Count())
Dim originalNodesEnum = originalIdentifierNodes.GetEnumerator()
Dim inlinedNodesEnum = inlinedExprNodes.GetEnumerator()
Dim replacementNodesWithChangedSemantics As Dictionary(Of SyntaxNode, SyntaxNode) = Nothing
While (originalNodesEnum.MoveNext())
Call inlinedNodesEnum.MoveNext()
Dim originalNode = originalNodesEnum.Current
' expressionToInline is Parenthesized prior to replacement, so get the parenting parenthesized expression.
Dim inlinedNode = DirectCast(inlinedNodesEnum.Current.AsNode.Parent, ExpressionSyntax)
Debug.Assert(inlinedNode.IsKind(SyntaxKind.ParenthesizedExpression))
' inlinedNode is the expanded form of the actual initializer expression in the original document.
' We have annotated the inner initializer with a special syntax annotation "_initializerAnnotation".
' Get this annotated node and compute the symbol info for this node in the inlined document.
Dim innerInitializerInInlineNode = DirectCast(inlinedNode.GetAnnotatedNodesAndTokens(s_initializerAnnotation).Single().AsNode, ExpressionSyntax)
Dim newInitializerSymbolInfo = newSemanticModelForInlinedDocument.GetSymbolInfo(innerInitializerInInlineNode, cancellationToken)
' Verification: The symbol info associated with any of the inlined expressions does not match the symbol info for original initializer expression prior to inline.
If Not SpeculationAnalyzer.SymbolInfosAreCompatible(originalInitializerSymbolInfo, newInitializerSymbolInfo, performEquivalenceCheck:=True) Then
If replacementNodesWithChangedSemantics Is Nothing Then
replacementNodesWithChangedSemantics = New Dictionary(Of SyntaxNode, SyntaxNode)
End If
replacementNodesWithChangedSemantics.Add(inlinedNode, originalNode)
End If
End While
If replacementNodesWithChangedSemantics Is Nothing Then
' No conflicts.
Return inlinedDocument
End If
' Replace the conflicting inlined nodes with the original nodes annotated with conflict annotation.
Dim conflictAnnotationAdder = Function(oldNode As SyntaxNode, newNode As SyntaxNode) As SyntaxNode
Return newNode _
.WithAdditionalAnnotations(ConflictAnnotation.Create(VBFeaturesResources.ConflictsDetected))
End Function
Return Await inlinedDocument.ReplaceNodesAsync(replacementNodesWithChangedSemantics.Keys, conflictAnnotationAdder, cancellationToken).ConfigureAwait(False)
End Function
Private Class MyCodeAction
Inherits CodeAction.DocumentChangeAction
Public Sub New(title As String, createChangedDocument As Func(Of CancellationToken, Task(Of Document)))
MyBase.New(title, createChangedDocument)
End Sub
End Class
End Class
End Namespace
|
VPashkov/roslyn
|
src/Features/VisualBasic/Portable/CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.vb
|
Visual Basic
|
apache-2.0
| 29,246
|
' 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.Completion.Providers
Imports Microsoft.CodeAnalysis.VisualBasic.Extensions.ContextQuery
Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.KeywordRecommenders.Declarations
''' <summary>
''' Recommends the "Const" keyword for the start of a statement.
''' </summary>
Friend Class ConstKeywordRecommender
Inherits AbstractKeywordRecommender
Private Shared ReadOnly s_keywords As ImmutableArray(Of RecommendedKeyword) =
ImmutableArray.Create(New RecommendedKeyword("Const", VBFeaturesResources.Declares_and_defines_one_or_more_constants))
Protected Overrides Function RecommendKeywords(context As VisualBasicSyntaxContext, cancellationToken As CancellationToken) As ImmutableArray(Of RecommendedKeyword)
Return If(context.IsMultiLineStatementContext, s_keywords, ImmutableArray(Of RecommendedKeyword).Empty)
End Function
End Class
End Namespace
|
sharwell/roslyn
|
src/Features/VisualBasic/Portable/Completion/KeywordRecommenders/Declarations/ConstKeywordRecommender.vb
|
Visual Basic
|
mit
| 1,223
|
' 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
Namespace Microsoft.CodeAnalysis.Editor.UnitTests.FindReferences
Partial Public Class FindReferencesTests
<WorkItem(542553, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542553")>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestAnonymousType1() As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Option Infer On
Imports System
Module Program
Sub Main(args As String())
Dim namedCust = New With {.[|$${|Definition:Name|}|] = "Blue Yonder Airlines",
.City = "Snoqualmie"}
Dim product = New With {Key.Name = "paperclips", .Price = 1.29}
End Sub
End Module
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(542553, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542553")>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestAnonymousType2() As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Option Infer On
Imports System
Module Program
Sub Main(args As String())
Dim namedCust = New With {.Name = "Blue Yonder Airlines",
.City = "Snoqualmie"}
Dim product = New With {Key.[|$${|Definition:Name|}|] = "paperclips", .Price = 1.29}
End Sub
End Module
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(542553, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542553")>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestAnonymousType3() As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Option Infer On
Imports System
Module Program
Sub Main(args As String())
Dim namedCust1 = New With {.[|$${|Definition:Name|}|] = "Blue Yonder Airlines",
.City = "Snoqualmie"}
Dim namedCust2 = New With {.[|Name|] = "Blue Yonder Airlines",
.City = "Snoqualmie"}
Dim product = New With {Key.Name = "paperclips", .Price = 1.29}
End Sub
End Module
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(542553, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542553")>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestAnonymousType4() As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Option Infer On
Imports System
Module Program
Sub Main(args As String())
Dim namedCust1 = New With {.[|Name|] = "Blue Yonder Airlines",
.City = "Snoqualmie"}
Dim namedCust2 = New With {.{|Definition:[|$$Name|]|} = "Blue Yonder Airlines",
.City = "Snoqualmie"}
Dim product = New With {Key.Name = "paperclips", .Price = 1.29}
End Sub
End Module
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(542705, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542705")>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestAnonymousType5() As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Imports System
Imports System.Collections.Generic
Imports System.Linq
Class Program1
Shared str As String = "abc"
Shared Sub Main(args As String())
Dim employee08 = New With {.[|$${|Definition:Category|}|] = Category(str), Key.Name = 2 + 1}
Dim employee01 = New With {Key.Category = 2 + 1, Key.Name = "Bob"}
End Sub
Shared Function Category(str As String)
Category = str
End Function
End Class
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(3284, "https://github.com/dotnet/roslyn/issues/3284")>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCaseInsensitiveAnonymousType1() As Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class C
Sub M()
Dim x = New With {.[|$${|Definition:A|}|] = 1}
Dim y = New With {.[|A|] = 2}
Dim z = New With {.[|a|] = 3}
End Sub
End Class
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
<WorkItem(3284, "https://github.com/dotnet/roslyn/issues/3284")>
<Fact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCaseInsensitiveAnonymousType2() As System.Threading.Tasks.Task
Dim input =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class C
Sub M()
Dim x = New With {.[|A|] = 1}
Dim y = New With {.[|A|] = 2}
Dim z = New With {.[|$${|Definition:a|}|] = 3}
End Sub
End Class
</Document>
</Project>
</Workspace>
Await TestAsync(input)
End Function
End Class
End Namespace
|
MatthieuMEZIL/roslyn
|
src/EditorFeatures/Test2/FindReferences/FindReferencesTests.AnonymousTypeSymbols.vb
|
Visual Basic
|
apache-2.0
| 5,746
|
' 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.PooledObjects
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
''' <summary>
''' Base class for all parameters that are emitted.
''' </summary>
Friend MustInherit Class SourceParameterSymbolBase
Inherits ParameterSymbol
Private ReadOnly _containingSymbol As Symbol
Private ReadOnly _ordinal As UShort
Friend Sub New(containingSymbol As Symbol, ordinal As Integer)
_containingSymbol = containingSymbol
_ordinal = CUShort(ordinal)
End Sub
Public NotOverridable Overrides ReadOnly Property Ordinal As Integer
Get
Return _ordinal
End Get
End Property
Public NotOverridable Overrides ReadOnly Property ContainingSymbol As Symbol
Get
Return _containingSymbol
End Get
End Property
Friend MustOverride ReadOnly Property HasParamArrayAttribute As Boolean
Friend MustOverride ReadOnly Property HasDefaultValueAttribute As Boolean
Friend NotOverridable Overrides Sub AddSynthesizedAttributes(compilationState as ModuleCompilationState, ByRef attributes As ArrayBuilder(Of SynthesizedAttributeData))
MyBase.AddSynthesizedAttributes(compilationState, attributes)
' Create the ParamArrayAttribute
If IsParamArray AndAlso Not HasParamArrayAttribute Then
Dim compilation = Me.DeclaringCompilation
AddSynthesizedAttribute(attributes, compilation.TrySynthesizeAttribute(
WellKnownMember.System_ParamArrayAttribute__ctor))
End If
' Create the default attribute
If HasExplicitDefaultValue AndAlso Not HasDefaultValueAttribute Then
' Synthesize DateTimeConstantAttribute or DecimalConstantAttribute when the default
' value is either DateTime or Decimal and there is not an explicit custom attribute.
Dim compilation = Me.DeclaringCompilation
Dim defaultValue = ExplicitDefaultConstantValue
Select Case defaultValue.SpecialType
Case SpecialType.System_DateTime
AddSynthesizedAttribute(attributes, compilation.TrySynthesizeAttribute(
WellKnownMember.System_Runtime_CompilerServices_DateTimeConstantAttribute__ctor,
ImmutableArray.Create(New TypedConstant(compilation.GetSpecialType(SpecialType.System_Int64),
TypedConstantKind.Primitive,
defaultValue.DateTimeValue.Ticks))))
Case SpecialType.System_Decimal
AddSynthesizedAttribute(attributes, compilation.SynthesizeDecimalConstantAttribute(defaultValue.DecimalValue))
End Select
End If
If Me.Type.ContainsTupleNames() Then
AddSynthesizedAttribute(attributes, DeclaringCompilation.SynthesizeTupleNamesAttribute(Type))
End If
End Sub
Friend MustOverride Function WithTypeAndCustomModifiers(type As TypeSymbol, customModifiers As ImmutableArray(Of CustomModifier), refCustomModifiers As ImmutableArray(Of CustomModifier)) As ParameterSymbol
End Class
End Namespace
|
OmarTawfik/roslyn
|
src/Compilers/VisualBasic/Portable/Symbols/Source/SourceParameterSymbolBase.vb
|
Visual Basic
|
apache-2.0
| 3,746
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax
Friend Interface ISyntaxFactoryContext
ReadOnly Property IsWithinAsyncMethodOrLambda As Boolean
ReadOnly Property IsWithinIteratorContext As Boolean
End Interface
End Namespace
|
OmarTawfik/roslyn
|
src/Compilers/VisualBasic/Portable/Parser/ISyntaxFactoryContext.vb
|
Visual Basic
|
apache-2.0
| 432
|
' 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.Threading
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Partial Friend NotInheritable Class AnonymousTypeManager
Private NotInheritable Class AnonymousTypePropertySymbol
Inherits PropertySymbol
Private ReadOnly _containingType As AnonymousTypeTemplateSymbol
Private ReadOnly _type As TypeSymbol
Private ReadOnly _name As String
Private ReadOnly _getMethod As MethodSymbol
Private ReadOnly _setMethod As MethodSymbol
Private ReadOnly _backingField As FieldSymbol
''' <summary> Index of the property in the containing anonymous type </summary>
Friend ReadOnly PropertyIndex As Integer
Public Sub New(container As AnonymousTypeTemplateSymbol, field As AnonymousTypeField, index As Integer, typeSymbol As TypeSymbol)
_containingType = container
_type = typeSymbol
_name = field.Name
PropertyIndex = index
_getMethod = New AnonymousTypePropertyGetAccessorSymbol(Me)
If Not field.IsKey Then
_setMethod = New AnonymousTypePropertySetAccessorSymbol(Me, container.Manager.System_Void)
End If
_backingField = New AnonymousTypePropertyBackingFieldSymbol(Me)
End Sub
Friend ReadOnly Property AnonymousType As AnonymousTypeTemplateSymbol
Get
Return _containingType
End Get
End Property
Friend Overrides ReadOnly Property AssociatedField As FieldSymbol
Get
Return _backingField
End Get
End Property
Public Overrides ReadOnly Property IsDefault As Boolean
Get
Return False
End Get
End Property
Public Overrides ReadOnly Property Parameters As ImmutableArray(Of ParameterSymbol)
Get
Return ImmutableArray(Of ParameterSymbol).Empty
End Get
End Property
Public Overrides ReadOnly Property TypeCustomModifiers As ImmutableArray(Of CustomModifier)
Get
Return ImmutableArray(Of CustomModifier).Empty
End Get
End Property
Public Overrides ReadOnly Property RefCustomModifiers As ImmutableArray(Of CustomModifier)
Get
Return ImmutableArray(Of CustomModifier).Empty
End Get
End Property
Public Overrides ReadOnly Property SetMethod As MethodSymbol
Get
Return _setMethod
End Get
End Property
Public Overrides ReadOnly Property GetMethod As MethodSymbol
Get
Return _getMethod
End Get
End Property
Public Overrides ReadOnly Property ReturnsByRef As Boolean
Get
Return False
End Get
End Property
Public Overrides ReadOnly Property Type As TypeSymbol
Get
Return _type
End Get
End Property
Public Overrides ReadOnly Property Name As String
Get
Return Me._name
End Get
End Property
Public Overrides ReadOnly Property MetadataName As String
Get
Return Me.AnonymousType.GetAdjustedName(Me.PropertyIndex)
End Get
End Property
Friend Overrides ReadOnly Property HasSpecialName As Boolean
Get
Return False
End Get
End Property
Public Overrides ReadOnly Property DeclaredAccessibility As Accessibility
Get
Return Accessibility.Public
End Get
End Property
Friend Overrides ReadOnly Property CallingConvention As Microsoft.Cci.CallingConvention
Get
Return Microsoft.Cci.CallingConvention.HasThis
End Get
End Property
Public Overrides ReadOnly Property ContainingSymbol As Symbol
Get
Return _containingType
End Get
End Property
Public Overrides ReadOnly Property ContainingType As NamedTypeSymbol
Get
Return _containingType
End Get
End Property
Public Overrides ReadOnly Property ExplicitInterfaceImplementations As ImmutableArray(Of PropertySymbol)
Get
Return ImmutableArray(Of PropertySymbol).Empty
End Get
End Property
Public Overrides ReadOnly Property IsMustOverride As Boolean
Get
Return False
End Get
End Property
Public Overrides ReadOnly Property IsNotOverridable As Boolean
Get
Return False ' property is not virtual by default
End Get
End Property
Public Overrides ReadOnly Property IsOverloads As Boolean
Get
Return False
End Get
End Property
Friend Overrides ReadOnly Property ShadowsExplicitly As Boolean
Get
Return False
End Get
End Property
Public Overrides ReadOnly Property IsOverridable As Boolean
Get
Return False
End Get
End Property
Public Overrides ReadOnly Property IsOverrides As Boolean
Get
Return False
End Get
End Property
Public Overrides ReadOnly Property IsShared As Boolean
Get
Return False
End Get
End Property
Public Overrides ReadOnly Property Locations As ImmutableArray(Of Location)
Get
Return ImmutableArray(Of Location).Empty
End Get
End Property
Public Overrides ReadOnly Property DeclaringSyntaxReferences As ImmutableArray(Of SyntaxReference)
Get
Return ImmutableArray(Of SyntaxReference).Empty
End Get
End Property
Public Overrides ReadOnly Property IsImplicitlyDeclared As Boolean
Get
Return True
End Get
End Property
Friend Overrides ReadOnly Property ObsoleteAttributeData As ObsoleteAttributeData
Get
Return Nothing
End Get
End Property
Friend Overrides ReadOnly Property IsMyGroupCollectionProperty As Boolean
Get
Return False
End Get
End Property
End Class
End Class
End Namespace
|
mmitche/roslyn
|
src/Compilers/VisualBasic/Portable/Symbols/AnonymousTypes/SynthesizedSymbols/AnonymousType_PropertySymbol.vb
|
Visual Basic
|
apache-2.0
| 7,539
|
' 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.Reflection.Metadata
Imports System.Runtime.InteropServices
Imports System.Threading
Imports Microsoft.Cci
Imports Microsoft.CodeAnalysis.CodeGen
Imports Microsoft.CodeAnalysis.Emit
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols.Metadata.PE
Namespace Microsoft.CodeAnalysis.VisualBasic.Emit
Friend NotInheritable Class PEDeltaAssemblyBuilder
Inherits PEAssemblyBuilderBase
Implements IPEDeltaAssemblyBuilder
Private ReadOnly _previousGeneration As EmitBaseline
Private ReadOnly _previousDefinitions As VisualBasicDefinitionMap
Private ReadOnly _changes As SymbolChanges
Private ReadOnly _deepTranslator As VisualBasicSymbolMatcher.DeepTranslator
Public Sub New(sourceAssembly As SourceAssemblySymbol,
emitOptions As EmitOptions,
outputKind As OutputKind,
serializationProperties As ModulePropertiesForSerialization,
manifestResources As IEnumerable(Of ResourceDescription),
previousGeneration As EmitBaseline,
edits As IEnumerable(Of SemanticEdit),
isAddedSymbol As Func(Of ISymbol, Boolean))
MyBase.New(sourceAssembly, emitOptions, outputKind, serializationProperties, manifestResources, additionalTypes:=ImmutableArray(Of NamedTypeSymbol).Empty)
Dim initialBaseline = previousGeneration.InitialBaseline
Dim context = New EmitContext(Me, Nothing, New DiagnosticBag())
' Hydrate symbols from initial metadata. Once we do so it is important to reuse these symbols across all generations,
' in order for the symbol matcher to be able to use reference equality once it maps symbols to initial metadata.
Dim metadataSymbols = GetMetadataSymbols(initialBaseline, sourceAssembly.DeclaringCompilation)
Dim metadataDecoder = DirectCast(metadataSymbols.MetadataDecoder, MetadataDecoder)
Dim metadataAssembly = DirectCast(metadataDecoder.ModuleSymbol.ContainingAssembly, PEAssemblySymbol)
Dim matchToMetadata = New VisualBasicSymbolMatcher(initialBaseline.LazyMetadataSymbols.AnonymousTypes, sourceAssembly, context, metadataAssembly)
Dim matchToPrevious As VisualBasicSymbolMatcher = Nothing
If previousGeneration.Ordinal > 0 Then
Dim previousAssembly = DirectCast(previousGeneration.Compilation, VisualBasicCompilation).SourceAssembly
Dim previousContext = New EmitContext(DirectCast(previousGeneration.PEModuleBuilder, PEModuleBuilder), Nothing, New DiagnosticBag())
matchToPrevious = New VisualBasicSymbolMatcher(
previousGeneration.AnonymousTypeMap,
sourceAssembly:=sourceAssembly,
sourceContext:=context,
otherAssembly:=previousAssembly,
otherContext:=previousContext,
otherSynthesizedMembersOpt:=previousGeneration.SynthesizedMembers)
End If
_previousDefinitions = New VisualBasicDefinitionMap(previousGeneration.OriginalMetadata.Module, edits, metadataDecoder, matchToMetadata, matchToPrevious)
_previousGeneration = previousGeneration
_changes = New SymbolChanges(_previousDefinitions, edits, isAddedSymbol)
' Workaround for https://github.com/dotnet/roslyn/issues/3192.
' When compiling state machine we stash types of awaiters and state-machine hoisted variables,
' so that next generation can look variables up and reuse their slots if possible.
'
' When we are about to allocate a slot for a lifted variable while compiling the next generation
' we map its type to the previous generation and then check the slot types that we stashed earlier.
' If the variable type matches we reuse it. In order to compare the previous variable type with the current one
' both need to be completely lowered (translated). Standard translation only goes one level deep.
' Generic arguments are not translated until they are needed by metadata writer.
'
' In order to get the fully lowered form we run the type symbols of stashed variables through a deep translator
' that translates the symbol recursively.
_deepTranslator = New VisualBasicSymbolMatcher.DeepTranslator(sourceAssembly.GetSpecialType(SpecialType.System_Object))
End Sub
Friend Overrides Function EncTranslateLocalVariableType(type As TypeSymbol, diagnostics As DiagnosticBag) As ITypeReference
' Note: The translator is Not aware of synthesized types. If type is a synthesized type it won't get mapped.
' In such case use the type itself. This can only happen for variables storing lambda display classes.
Dim visited = DirectCast(_deepTranslator.Visit(type), TypeSymbol)
Debug.Assert(visited IsNot Nothing OrElse TypeOf type Is LambdaFrame OrElse TypeOf DirectCast(type, NamedTypeSymbol).ConstructedFrom Is LambdaFrame)
Return Translate(If(visited, type), Nothing, diagnostics)
End Function
Public Overrides ReadOnly Property CurrentGenerationOrdinal As Integer
Get
Return _previousGeneration.Ordinal + 1
End Get
End Property
Private Function GetMetadataSymbols(initialBaseline As EmitBaseline, compilation As VisualBasicCompilation) As EmitBaseline.MetadataSymbols
If initialBaseline.LazyMetadataSymbols IsNot Nothing Then
Return initialBaseline.LazyMetadataSymbols
End If
Dim originalMetadata = initialBaseline.OriginalMetadata
' The purpose of this compilation is to provide PE symbols for original metadata.
' We need to transfer the references from the current source compilation but don't need its syntax trees.
Dim metadataCompilation = compilation.RemoveAllSyntaxTrees()
Dim metadataAssembly = metadataCompilation.GetBoundReferenceManager().CreatePEAssemblyForAssemblyMetadata(AssemblyMetadata.Create(originalMetadata), MetadataImportOptions.All)
Dim metadataDecoder = New MetadataDecoder(metadataAssembly.PrimaryModule)
Dim metadataAnonymousTypes = GetAnonymousTypeMapFromMetadata(originalMetadata.MetadataReader, metadataDecoder)
Dim metadataSymbols = New EmitBaseline.MetadataSymbols(metadataAnonymousTypes, metadataDecoder)
Return InterlockedOperations.Initialize(initialBaseline.LazyMetadataSymbols, metadataSymbols)
End Function
' friend for testing
Friend Overloads Shared Function GetAnonymousTypeMapFromMetadata(reader As MetadataReader, metadataDecoder As MetadataDecoder) As IReadOnlyDictionary(Of AnonymousTypeKey, AnonymousTypeValue)
Dim result = New Dictionary(Of AnonymousTypeKey, AnonymousTypeValue)
For Each handle In reader.TypeDefinitions
Dim def = reader.GetTypeDefinition(handle)
If Not def.Namespace.IsNil Then
Continue For
End If
If Not reader.StringComparer.StartsWith(def.Name, GeneratedNames.AnonymousTypeOrDelegateCommonPrefix) Then
Continue For
End If
Dim metadataName = reader.GetString(def.Name)
Dim arity As Short = 0
Dim name = MetadataHelpers.InferTypeArityAndUnmangleMetadataName(metadataName, arity)
Dim index As Integer = 0
If GeneratedNames.TryParseAnonymousTypeTemplateName(GeneratedNames.AnonymousTypeTemplateNamePrefix, name, index) Then
Dim type = DirectCast(metadataDecoder.GetTypeOfToken(handle), NamedTypeSymbol)
Dim key = GetAnonymousTypeKey(type)
Dim value = New AnonymousTypeValue(name, index, type)
result.Add(key, value)
ElseIf GeneratedNames.TryParseAnonymousTypeTemplateName(GeneratedNames.AnonymousDelegateTemplateNamePrefix, name, index) Then
Dim type = DirectCast(metadataDecoder.GetTypeOfToken(handle), NamedTypeSymbol)
Dim key = GetAnonymousDelegateKey(type)
Dim value = New AnonymousTypeValue(name, index, type)
result.Add(key, value)
End If
Next
Return result
End Function
Private Shared Function GetAnonymousTypeKey(type As NamedTypeSymbol) As AnonymousTypeKey
' The key is the set of properties that correspond to type parameters.
' For each type parameter, get the name of the property of that type.
Dim n = type.TypeParameters.Length
If n = 0 Then
Return New AnonymousTypeKey(ImmutableArray(Of AnonymousTypeKeyField).Empty)
End If
' Properties indexed by type parameter ordinal.
Dim properties = New AnonymousTypeKeyField(n - 1) {}
For Each member In type.GetMembers()
If member.Kind <> SymbolKind.Property Then
Continue For
End If
Dim [property] = DirectCast(member, PropertySymbol)
Dim propertyType = [property].Type
If propertyType.TypeKind = TypeKind.TypeParameter Then
Dim typeParameter = DirectCast(propertyType, TypeParameterSymbol)
Debug.Assert(typeParameter.ContainingSymbol = type)
Dim index = typeParameter.Ordinal
Debug.Assert(properties(index).Name Is Nothing)
' ReadOnly anonymous type properties were 'Key' properties.
properties(index) = New AnonymousTypeKeyField([property].Name, isKey:=[property].IsReadOnly, ignoreCase:=True)
End If
Next
Debug.Assert(properties.All(Function(f) Not String.IsNullOrEmpty(f.Name)))
Return New AnonymousTypeKey(ImmutableArray.Create(properties))
End Function
Private Shared Function GetAnonymousDelegateKey(type As NamedTypeSymbol) As AnonymousTypeKey
Debug.Assert(type.BaseTypeNoUseSiteDiagnostics.SpecialType = SpecialType.System_MulticastDelegate)
' The key is the set of parameter names to the Invoke method,
' where the parameters are of the type parameters.
Dim members = type.GetMembers(WellKnownMemberNames.DelegateInvokeName)
Debug.Assert(members.Length = 1 AndAlso members(0).Kind = SymbolKind.Method)
Dim method = DirectCast(members(0), MethodSymbol)
Debug.Assert(method.Parameters.Length + If(method.IsSub, 0, 1) = type.TypeParameters.Length)
Dim parameters = ArrayBuilder(Of AnonymousTypeKeyField).GetInstance()
parameters.AddRange(method.Parameters.SelectAsArray(Function(p) New AnonymousTypeKeyField(p.Name, isKey:=False, ignoreCase:=True)))
parameters.Add(New AnonymousTypeKeyField(AnonymousTypeDescriptor.GetReturnParameterName(Not method.IsSub), isKey:=False, ignoreCase:=True))
Return New AnonymousTypeKey(parameters.ToImmutableAndFree(), isDelegate:=True)
End Function
Friend ReadOnly Property PreviousGeneration As EmitBaseline
Get
Return _previousGeneration
End Get
End Property
Friend ReadOnly Property PreviousDefinitions As VisualBasicDefinitionMap
Get
Return _previousDefinitions
End Get
End Property
Friend Overrides ReadOnly Property SupportsPrivateImplClass As Boolean
Get
' Disable <PrivateImplementationDetails> in ENC since the
' CLR does Not support adding non-private members.
Return False
End Get
End Property
Friend Overloads Function GetAnonymousTypeMap() As IReadOnlyDictionary(Of AnonymousTypeKey, AnonymousTypeValue) Implements IPEDeltaAssemblyBuilder.GetAnonymousTypeMap
Dim anonymousTypes = Compilation.AnonymousTypeManager.GetAnonymousTypeMap()
' Should contain all entries in previous generation.
Debug.Assert(_previousGeneration.AnonymousTypeMap.All(Function(p) anonymousTypes.ContainsKey(p.Key)))
Return anonymousTypes
End Function
Friend Overrides Function TryCreateVariableSlotAllocator(method As MethodSymbol, topLevelMethod As MethodSymbol) As VariableSlotAllocator
Return _previousDefinitions.TryCreateVariableSlotAllocator(_previousGeneration, method, topLevelMethod)
End Function
Friend Overrides Function GetPreviousAnonymousTypes() As ImmutableArray(Of AnonymousTypeKey)
Return ImmutableArray.CreateRange(_previousGeneration.AnonymousTypeMap.Keys)
End Function
Friend Overrides Function GetNextAnonymousTypeIndex(fromDelegates As Boolean) As Integer
Return _previousGeneration.GetNextAnonymousTypeIndex(fromDelegates)
End Function
Friend Overrides Function TryGetAnonymousTypeName(template As NamedTypeSymbol, <Out()> ByRef name As String, <Out()> ByRef index As Integer) As Boolean
Debug.Assert(Compilation Is template.DeclaringCompilation)
Return _previousDefinitions.TryGetAnonymousTypeName(template, name, index)
End Function
Friend ReadOnly Property Changes As SymbolChanges
Get
Return _changes
End Get
End Property
Friend Overrides Function GetTopLevelTypesCore(context As EmitContext) As IEnumerable(Of Cci.INamespaceTypeDefinition)
Return _changes.GetTopLevelTypes(context)
End Function
Friend Sub OnCreatedIndices(diagnostics As DiagnosticBag) Implements IPEDeltaAssemblyBuilder.OnCreatedIndices
Dim embeddedTypesManager = Me.EmbeddedTypesManagerOpt
If embeddedTypesManager IsNot Nothing Then
For Each embeddedType In embeddedTypesManager.EmbeddedTypesMap.Keys
diagnostics.Add(ErrorFactory.ErrorInfo(ERRID.ERR_EncNoPIAReference, embeddedType), Location.None)
Next
End If
End Sub
Friend Overrides ReadOnly Property AllowOmissionOfConditionalCalls As Boolean
Get
Return True
End Get
End Property
Protected Overrides ReadOnly Property LinkedAssembliesDebugInfo As IEnumerable(Of String)
Get
' This debug information is only emitted for the benefit of legacy EE.
' Since EnC requires Roslyn and Roslyn doesn't need this information we don't emit it during EnC.
Return SpecializedCollections.EmptyEnumerable(Of String)()
End Get
End Property
End Class
End Namespace
|
KevinRansom/roslyn
|
src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/PEDeltaAssemblyBuilder.vb
|
Visual Basic
|
apache-2.0
| 15,375
|
Imports System.Management
Imports BurnSoft.Universal
Imports System.Configuration
Public Class FrmMain
Dim TIMER_INTERVAL As Long
Dim APP_PATH As String
Public USELOCAL As Boolean
Dim HEARTBEAT_INTERVAL As Long
Dim DB_REFRESH_INTERVAL As Long
Private Sub FrmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
Me.Visible = False
tmrSched.Enabled = False
Call Init()
Call GetLocalApps()
tmrSched.Enabled = True
tmrSched.Interval = TIMER_INTERVAL
Catch ex As Exception
Call LogError("frmMain.Form1_Load", ex.Message.ToString)
End Try
End Sub
Sub GetLocalApps()
Dim iProcCount As Integer = Convert.ToInt32(ConfigurationManager.AppSettings("APPLICATION_COUNT"))
Dim appName As String = ""
Dim appParam As String = ""
Dim appInterval As Integer = 0
'Dim appSetting As String = ""
Dim ObjS As New BSProcessInfo
Dim ObjF As New FileIO
Dim ProcessID As String = ""
Dim mon_interval As Long = 0
Dim PID As String = ""
Dim ProcessCount As Integer = 0
For x As Integer = 1 To iProcCount
'appSetting = "APPLICATION_" & x
appName = ConfigurationManager.AppSettings("APPLICATION_" & x)
appParam = ConfigurationManager.AppSettings("APPLICATION_PARAM_" & x)
appInterval = Convert.ToInt32(ConfigurationManager.AppSettings("APPLICATION_INTERVAL_" & x))
BuggerMe("Looking for Process:" & appName, "GetLocalApps", "medium")
If ObjS.ProcessExists(ObjF.GetNameOfFile(appName), PID, ProcessCount) Then
Call RunMonitor(appName, PID, mon_interval, appParam)
End If
x += 1
Next
End Sub
''' <summary>
''' Run the Main Monitor application that will collection the information for performance
''' monitoring on the selected process
''' </summary>
''' <param name="ProcessName"></param>
''' <param name="PID"></param>
''' <param name="mon_interval"></param>
Sub RunMonitor(ProcessName As String, PID As String, mon_interval As Long, param As string)
Try
Dim arg As String = "/name=" & ProcessName & " /pid=" & PID & " /param=" & chr(34) & param & chr(34) & " /interval=" & mon_interval & "/offline=true"
if param.Length = 0 Then
arg = "/name=" & ProcessName & " /pid=" & PID & " /interval=" & mon_interval & " /offline=true"
End If
Dim ObjP As New BSProcessInfo
Dim ProcCount As Integer
Dim AppName As String = System.Configuration.ConfigurationManager.AppSettings("RUNPROGRAM")
If Not ObjP.ProcessExists(AppName, arg,, ProcCount) Then
Dim myProcess As New Process
BuggerMe("Starting Monitor Process with with arguments " & arg & " process count: " & ProcCount, "frmmain.runmonitor")
myProcess.StartInfo.WorkingDirectory = Application.StartupPath & "\"
myProcess.StartInfo.FileName = AppName
myProcess.StartInfo.Arguments = arg
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
myProcess.Start()
Else
BuggerMe("Process Already Started with arguments " & arg & " process count: " & ProcCount, "frmmain.runmonitor", "high")
End If
Catch ex As Exception
LogError(Me.Name & "." & "RunMonitor", ex.Message.ToString)
End Try
End Sub
Sub Init()
HEARTBEAT_INTERVAL = 1
If Len(System.Configuration.ConfigurationManager.AppSettings("APP_PATH")) = 0 Then
APP_PATH = Application.StartupPath
Else
APP_PATH = System.Configuration.ConfigurationManager.AppSettings("APP_PATH")
End If
DO_DEBUG = CBool(System.Configuration.ConfigurationManager.AppSettings("DEBUG"))
BUGFILE_LEVEL = System.Configuration.ConfigurationManager.AppSettings("BUGFILE_LEVEL")
DEBUG_LOGFILE = APP_PATH & "\" & System.Configuration.ConfigurationManager.AppSettings("BUGFILE")
MyLogFile = APP_PATH & "\" & System.Configuration.ConfigurationManager.AppSettings("LOGFILE")
CONSOLEMODE = CBool(System.Configuration.ConfigurationManager.AppSettings("CONSOLE"))
USE_LOGFILE = CBool(System.Configuration.ConfigurationManager.AppSettings("USE_LOGFILE"))
TIMER_INTERVAL = 30 * 1000
BuggerMe("App Path: " & APP_PATH, "frmmain.init", "medium")
BuggerMe("DEBUG_LOGFILE: " & DEBUG_LOGFILE, "frmmain.init", "medium")
BuggerMe("MyLogFile: " & MyLogFile, "frmmain.init", "medium")
BuggerMe("Initializing AppSettings to Global Vars Completed", "frmmain.init", "medium")
End Sub
''' <summary>
''' Update the Local App.Confg File
''' </summary>
''' <param name="sKey"></param>
''' <param name="sValue"></param>
Public Sub ChangeAppSettings(ByVal sKey As String, ByVal sValue As String)
Dim Config As Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
Config.AppSettings.Settings.Remove(sKey)
Config.AppSettings.Settings.Add(sKey, sValue)
Config.Save(ConfigurationSaveMode.Modified)
ConfigurationManager.RefreshSection("appSettings")
BuggerMe("Updated App.Config key:" & sKey & " with value=" & sValue, "frmmain.ChangeAppSettings", "medium")
End Sub
Private Sub tmrSched_Tick(sender As Object, e As EventArgs) Handles tmrSched.Tick
Call GetLocalApps()
End Sub
End Class
|
burnsoftnet/BSApplicationProfiler
|
BSApplicationProfilerOffline/FrmMain.vb
|
Visual Basic
|
mit
| 5,801
|
Imports System.IO
Imports System.Text
Public Class fm_enterPw
Dim cred As String
Dim pw_byte As String
Private Sub btn_enterPw_OK_Click(sender As Object, e As EventArgs) Handles btn_enterPw_OK.Click
Try
Dim pw As String = tb_enterPw.Text
If pw = My.Settings.Password Then
fm_blockSites.Show()
Me.Close()
Else
MsgBox("Incorrect Password!", vbInformation)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub tb_enterPw_KeyDown(sender As Object, e As KeyEventArgs) Handles tb_enterPw.KeyDown
If e.KeyCode = Keys.Enter Then
btn_enterPw_OK.PerformClick()
End If
End Sub
End Class
|
UVLabs/Blockify
|
Blockify/fm_enterPw.vb
|
Visual Basic
|
mit
| 792
|
Public MustInherit Class MediaCollection
Inherits Collection
Public EnableUpdates As Boolean = True
MustOverride Function GetAcceptedMediaTypes(ByVal user As System.Security.Principal.IIdentity) As IEnumerable(Of String)
MustOverride Function CreateMedia(ByVal mimeType As String, ByVal mediaData As IO.Stream, ByVal slug As String, ByVal user As System.Security.Principal.IIdentity) As MediaLink
MustOverride Sub UpdateMedia(ByVal itemID As String, ByVal mimeType As String, ByVal mediaData As IO.Stream, ByVal user As System.Security.Principal.IIdentity)
MustOverride Function GetMediaLink(ByVal itemID As String, ByVal user As System.Security.Principal.IIdentity) As MediaLink
End Class
|
jhsoftware/atompub-sl
|
Library/MediaCollection.vb
|
Visual Basic
|
mit
| 708
|
Imports SistFoncreagro.BussinessEntities
Public Interface IAprobarRequerimientoBL
Function SaveNivelAprobarRequerimiento(ByVal aprobarReq As AprobarRequerimiento) As Int32
Function UpdateNivelAprobarRequerimiento(ByVal aprobarReq As AprobarRequerimiento) As Int32
Function DeleteNivelAprobarRequerimiento(ByVal IdAprobarRequerimiento As Int32) As Boolean
Function GetAllFromNivelesAprobarRequerimiento() As List(Of AprobarRequerimiento)
End Interface
|
crackper/SistFoncreagro
|
SistFoncreagro.BussinesLogic/IAprobarRequerimientoBL.vb
|
Visual Basic
|
mit
| 470
|
Imports NUnit.Framework
Namespace CompuMaster.Test.Data
<TestFixture(Category:="PlatformTools")> Public Class PlatformToolsTest
<Test> Public Sub InstalledOleDbProviders()
Dim IsMonoRuntime As Boolean = Type.GetType("Mono.Runtime") IsNot Nothing
If Not IsMonoRuntime AndAlso System.Environment.OSVersion.Platform <> PlatformID.Win32NT Then
Assert.Throws(Of System.PlatformNotSupportedException)(
Sub()
CompuMaster.Data.DataQuery.PlatformTools.InstalledOleDbProviders()
End Sub)
Else
Dim Result As DictionaryEntry() = CompuMaster.Data.DataQuery.PlatformTools.InstalledOleDbProviders
If Result Is Nothing OrElse Result.Length = 0 Then
'Mono .NET Framework and/or Non-Windows platforms (e.g. Linux) don't support this feature currently
Assert.Ignore("Platform " & System.Environment.OSVersion.Platform.ToString & " doesn't provide OleDbProvider list")
Else
'There should be at least 1 entry being found
For Each item As DictionaryEntry In Result
Console.WriteLine(item.Key & "=" & item.Value)
Next
Assert.NotZero(Result.Length)
End If
End If
End Sub
<Test> Public Sub InstalledOdbcDrivers()
Dim Result As String() = Nothing
Try
Result = CompuMaster.Data.DataQuery.PlatformTools.InstalledOdbcDrivers(CompuMaster.Data.DataQuery.PlatformTools.TargetPlatform.Current)
Catch ex As PlatformNotSupportedException
Assert.Ignore("Platform doesn't provide OdbcDriver list")
Catch ex As NotImplementedException
'Mono .NET Framework and/or Non-Windows platforms (e.g. Linux) don't support this feature currently
Assert.Ignore("Platform doesn't provide OdbcDriver list")
End Try
'There should be at least 1 entry being found
For Each item As String In Result
Console.WriteLine(item)
Next
Assert.NotZero(Result.Length)
End Sub
End Class
End Namespace
|
CompuMasterGmbH/CompuMaster.Data
|
CompuMaster.Test.Tools.Data/PlatformToolsTest.vb
|
Visual Basic
|
mit
| 2,306
|
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("WindowsApplication1")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("Microsoft")>
<Assembly: AssemblyProduct("WindowsApplication1")>
<Assembly: AssemblyCopyright("Copyright © Microsoft 2011")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("5e2b1bf9-cf32-4c9b-b8d7-aeb60955c4db")>
' 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")>
|
Edinboro/CSCI-207
|
programs/Temperature Conversion/Temperature Conversion/My Project/AssemblyInfo.vb
|
Visual Basic
|
mit
| 1,209
|
'------------------------------------------------------------------------------
' <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
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
' or if you encounter build errors in this file, go to the Project Designer
' (go to Project Properties or double-click the My Project node in
' Solution Explorer), and make changes on the Application tab.
'
Partial Friend Class MyApplication
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Sub New()
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
Me.IsSingleInstance = false
Me.EnableVisualStyles = true
Me.SaveMySettingsOnExit = true
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
End Sub
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.OtgatniChisloto.Form1
End Sub
End Class
End Namespace
|
kilarionov/cppTopics
|
docs/C++May2016/VS2015/OtgatniChisloto/OtgatniChisloto/My Project/Application.Designer.vb
|
Visual Basic
|
mit
| 1,459
|
Imports System.IO
Imports System.Runtime.InteropServices
Module Example
<STAThread()> _
Sub Main()
Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objPartDocument As SolidEdgePart.PartDocument = Nothing
Dim objModels As SolidEdgePart.Models = Nothing
Dim objModel As SolidEdgePart.Model = Nothing
Dim objIntersecs As SolidEdgePart.Intersects = Nothing
Dim objIntersect As SolidEdgePart.Intersect = Nothing
Try
OleMessageFilter.Register()
objApplication = Marshal.GetActiveObject("SolidEdge.Application")
objPartDocument = objApplication.ActiveDocument
objModels = objPartDocument.Models
objModel = objModels.Item(1)
objIntersecs = objModel.Intersects
objIntersec = objIntersecs.Item(1)
Catch ex As Exception
Console.WriteLine(ex.Message)
Finally
OleMessageFilter.Revoke()
End Try
End Sub
End Module
|
SolidEdgeCommunity/docs
|
docfx_project/snippets/SolidEdgePart.Intersect.vb
|
Visual Basic
|
mit
| 1,027
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.18331
'
' 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("VBCreateRule.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
|
age-killer/Electronic-invoice-document-processing
|
MailSort_CSHARP/packages/Independentsoft.Exchange.3.0.400/Tutorial/VBCreateRule/My Project/Resources.Designer.vb
|
Visual Basic
|
mit
| 2,721
|
'------------------------------------------------------------------------------
' <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
<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
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.APRBase.My.MySettings
Get
Return Global.APRBase.My.MySettings.Default
End Get
End Property
End Module
End Namespace
|
nublet/APRBase
|
APRBase.ConnectionDialog/My Project/Settings.Designer.vb
|
Visual Basic
|
mit
| 2,904
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.36241
'
' 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("WiW_Trial_Handout_Text_Creator.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
|
freefallcid/wiw-trial-handout
|
WiW Trial Handout Text Creator/My Project/Resources.Designer.vb
|
Visual Basic
|
mit
| 2,736
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class pagamentos_form
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.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(pagamentos_form))
Me.pagamentosQuitBtn = New System.Windows.Forms.Button()
Me.Ncc_2015DataSet = New NCC2015.ncc_2015DataSet()
Me.Loo_paymentBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.Loo_paymentTableAdapter = New NCC2015.ncc_2015DataSetTableAdapters.loo_paymentTableAdapter()
Me.TableAdapterManager = New NCC2015.ncc_2015DataSetTableAdapters.TableAdapterManager()
Me.Loo_paymentDataGridView = New System.Windows.Forms.DataGridView()
Me.DataGridViewTextBoxColumn1 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.DataGridViewTextBoxColumn2 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.DataGridViewTextBoxColumn3 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.DataGridViewTextBoxColumn4 = New System.Windows.Forms.DataGridViewTextBoxColumn()
CType(Me.Ncc_2015DataSet, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Loo_paymentBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Loo_paymentDataGridView, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'pagamentosQuitBtn
'
Me.pagamentosQuitBtn.BackColor = System.Drawing.SystemColors.Menu
Me.pagamentosQuitBtn.Image = Global.NCC2015.My.Resources.Resources.Close_Window_24
Me.pagamentosQuitBtn.Location = New System.Drawing.Point(686, 499)
Me.pagamentosQuitBtn.Name = "pagamentosQuitBtn"
Me.pagamentosQuitBtn.Size = New System.Drawing.Size(50, 50)
Me.pagamentosQuitBtn.TabIndex = 20
Me.pagamentosQuitBtn.UseVisualStyleBackColor = False
'
'Ncc_2015DataSet
'
Me.Ncc_2015DataSet.DataSetName = "ncc_2015DataSet"
Me.Ncc_2015DataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
'
'Loo_paymentBindingSource
'
Me.Loo_paymentBindingSource.DataMember = "loo_payment"
Me.Loo_paymentBindingSource.DataSource = Me.Ncc_2015DataSet
'
'Loo_paymentTableAdapter
'
Me.Loo_paymentTableAdapter.ClearBeforeFill = True
'
'TableAdapterManager
'
Me.TableAdapterManager.BackupDataSetBeforeUpdate = False
Me.TableAdapterManager.loo_imageTableAdapter = Nothing
Me.TableAdapterManager.loo_medicTableAdapter = Nothing
Me.TableAdapterManager.loo_partner_classTableAdapter = Nothing
Me.TableAdapterManager.loo_partner_timetableTableAdapter = Nothing
Me.TableAdapterManager.loo_partnerTableAdapter = Nothing
Me.TableAdapterManager.loo_paymentTableAdapter = Me.Loo_paymentTableAdapter
Me.TableAdapterManager.loo_sysTableAdapter = Nothing
Me.TableAdapterManager.loo_userTableAdapter = Nothing
Me.TableAdapterManager.UpdateOrder = NCC2015.ncc_2015DataSetTableAdapters.TableAdapterManager.UpdateOrderOption.InsertUpdateDelete
'
'Loo_paymentDataGridView
'
Me.Loo_paymentDataGridView.AllowUserToAddRows = False
Me.Loo_paymentDataGridView.AllowUserToDeleteRows = False
Me.Loo_paymentDataGridView.AutoGenerateColumns = False
Me.Loo_paymentDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill
Me.Loo_paymentDataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None
Me.Loo_paymentDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.Loo_paymentDataGridView.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.DataGridViewTextBoxColumn1, Me.DataGridViewTextBoxColumn2, Me.DataGridViewTextBoxColumn3, Me.DataGridViewTextBoxColumn4})
Me.Loo_paymentDataGridView.DataSource = Me.Loo_paymentBindingSource
Me.Loo_paymentDataGridView.Location = New System.Drawing.Point(0, 0)
Me.Loo_paymentDataGridView.Name = "Loo_paymentDataGridView"
Me.Loo_paymentDataGridView.ReadOnly = True
Me.Loo_paymentDataGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders
Me.Loo_paymentDataGridView.Size = New System.Drawing.Size(748, 493)
Me.Loo_paymentDataGridView.TabIndex = 21
'
'DataGridViewTextBoxColumn1
'
Me.DataGridViewTextBoxColumn1.DataPropertyName = "payment_id"
Me.DataGridViewTextBoxColumn1.HeaderText = "Número de Pagamento"
Me.DataGridViewTextBoxColumn1.Name = "DataGridViewTextBoxColumn1"
Me.DataGridViewTextBoxColumn1.ReadOnly = True
'
'DataGridViewTextBoxColumn2
'
Me.DataGridViewTextBoxColumn2.DataPropertyName = "payment_date"
Me.DataGridViewTextBoxColumn2.HeaderText = "Data"
Me.DataGridViewTextBoxColumn2.Name = "DataGridViewTextBoxColumn2"
Me.DataGridViewTextBoxColumn2.ReadOnly = True
'
'DataGridViewTextBoxColumn3
'
Me.DataGridViewTextBoxColumn3.DataPropertyName = "payment_value"
Me.DataGridViewTextBoxColumn3.HeaderText = "Valor (€)"
Me.DataGridViewTextBoxColumn3.Name = "DataGridViewTextBoxColumn3"
Me.DataGridViewTextBoxColumn3.ReadOnly = True
'
'DataGridViewTextBoxColumn4
'
Me.DataGridViewTextBoxColumn4.DataPropertyName = "payment_partner"
Me.DataGridViewTextBoxColumn4.HeaderText = "Número de sócio"
Me.DataGridViewTextBoxColumn4.Name = "DataGridViewTextBoxColumn4"
Me.DataGridViewTextBoxColumn4.ReadOnly = True
'
'pagamentos_form
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.Color.CornflowerBlue
Me.ClientSize = New System.Drawing.Size(748, 561)
Me.ControlBox = False
Me.Controls.Add(Me.Loo_paymentDataGridView)
Me.Controls.Add(Me.pagamentosQuitBtn)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "pagamentos_form"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Loomart - SocGest | Pagamentos"
CType(Me.Ncc_2015DataSet, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Loo_paymentBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Loo_paymentDataGridView, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents pagamentosQuitBtn As Button
Friend WithEvents Ncc_2015DataSet As ncc_2015DataSet
Friend WithEvents Loo_paymentBindingSource As BindingSource
Friend WithEvents Loo_paymentTableAdapter As ncc_2015DataSetTableAdapters.loo_paymentTableAdapter
Friend WithEvents TableAdapterManager As ncc_2015DataSetTableAdapters.TableAdapterManager
Friend WithEvents Loo_paymentDataGridView As DataGridView
Friend WithEvents DataGridViewTextBoxColumn1 As DataGridViewTextBoxColumn
Friend WithEvents DataGridViewTextBoxColumn2 As DataGridViewTextBoxColumn
Friend WithEvents DataGridViewTextBoxColumn3 As DataGridViewTextBoxColumn
Friend WithEvents DataGridViewTextBoxColumn4 As DataGridViewTextBoxColumn
End Class
|
Loomart/ncc2017
|
NCC2015/pagamentos_form.Designer.vb
|
Visual Basic
|
apache-2.0
| 8,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
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Extensions
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.VisualStudio.LanguageServices
Imports Microsoft.VisualStudio.LanguageServices.VisualBasic.Snippets
Imports Microsoft.VisualStudio.Text.Projection
Imports Roslyn.Test.Utilities
Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Snippets
Public Class VisualBasicSnippetExpansionClientTests
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
Public Sub AddImport_EmptyDocument()
Dim originalCode = <![CDATA[]]>.Value
Dim namespacesToAdd = {"System"}
Dim expectedUpdatedCode = <![CDATA[Imports System
]]>.Value
TestSnippetAddImports(originalCode, namespacesToAdd, placeSystemNamespaceFirst:=True, expectedUpdatedCode:=expectedUpdatedCode)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
Public Sub AddImport_EmptyDocument_SystemAtTop()
Dim originalCode = <![CDATA[]]>.Value
Dim namespacesToAdd = {"First.Alphabetically", "System.Bar"}
Dim expectedUpdatedCode = <![CDATA[Imports System.Bar
Imports First.Alphabetically
]]>.Value
TestSnippetAddImports(originalCode, namespacesToAdd, placeSystemNamespaceFirst:=True, expectedUpdatedCode:=expectedUpdatedCode)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
Public Sub AddImport_EmptyDocument_SystemNotSortedToTop()
Dim originalCode = <![CDATA[]]>.Value
Dim namespacesToAdd = {"First.Alphabetically", "System.Bar"}
Dim expectedUpdatedCode = <![CDATA[Imports First.Alphabetically
Imports System.Bar
]]>.Value
TestSnippetAddImports(originalCode, namespacesToAdd, placeSystemNamespaceFirst:=False, expectedUpdatedCode:=expectedUpdatedCode)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
Public Sub AddImport_AddsOnlyNewNamespaces()
Dim originalCode = <![CDATA[Imports A.B.C
Imports D.E.F
]]>.Value
Dim namespacesToAdd = {"D.E.F", "G.H.I"}
Dim expectedUpdatedCode = <![CDATA[Imports A.B.C
Imports D.E.F
Imports G.H.I
]]>.Value
TestSnippetAddImports(originalCode, namespacesToAdd, placeSystemNamespaceFirst:=True, expectedUpdatedCode:=expectedUpdatedCode)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
Public Sub AddImport_AddsOnlyNewAliasAndNamespacePairs()
Dim originalCode = <![CDATA[Imports A = B.C
Imports D = E.F
Imports G = H.I
]]>.Value
Dim namespacesToAdd = {"A = E.F", "D = B.C", "G = H.I", "J = K.L"}
Dim expectedUpdatedCode = <![CDATA[Imports A = B.C
Imports A = E.F
Imports D = B.C
Imports D = E.F
Imports G = H.I
Imports J = K.L
]]>.Value
TestSnippetAddImports(originalCode, namespacesToAdd, placeSystemNamespaceFirst:=True, expectedUpdatedCode:=expectedUpdatedCode)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
Public Sub AddImport_DuplicateNamespaceDetectionIgnoresCase()
Dim originalCode = <![CDATA[Imports A.b.C
]]>.Value
Dim namespacesToAdd = {"a.B.C", "A.B.c"}
Dim expectedUpdatedCode = <![CDATA[Imports A.b.C
]]>.Value
TestSnippetAddImports(originalCode, namespacesToAdd, placeSystemNamespaceFirst:=True, expectedUpdatedCode:=expectedUpdatedCode)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
Public Sub AddImport_DuplicateAliasNamespacePairDetectionIgnoresWhitespace1()
Dim originalCode = <![CDATA[Imports A = B.C
]]>.Value
Dim namespacesToAdd = {"A = B.C"}
Dim expectedUpdatedCode = <![CDATA[Imports A = B.C
]]>.Value
TestSnippetAddImports(originalCode, namespacesToAdd, placeSystemNamespaceFirst:=True, expectedUpdatedCode:=expectedUpdatedCode)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
Public Sub AddImport_DuplicateAliasNamespacePairDetectionIgnoresWhitespace2()
Dim originalCode = <![CDATA[Imports A = B.C
]]>.Value
Dim namespacesToAdd = {"A=B.C"}
Dim expectedUpdatedCode = <![CDATA[Imports A = B.C
]]>.Value
TestSnippetAddImports(originalCode, namespacesToAdd, placeSystemNamespaceFirst:=True, expectedUpdatedCode:=expectedUpdatedCode)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
Public Sub AddImport_DuplicateAliasNamespacePairDetectionIgnoresCase()
Dim originalCode = <![CDATA[Imports A = B.C
]]>.Value
Dim namespacesToAdd = {"a = b.C"}
Dim expectedUpdatedCode = <![CDATA[Imports A = B.C
]]>.Value
TestSnippetAddImports(originalCode, namespacesToAdd, placeSystemNamespaceFirst:=True, expectedUpdatedCode:=expectedUpdatedCode)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
Public Sub AddImport_OnlyFormatNewImports()
Dim originalCode = <![CDATA[Imports A = B.C
Imports G= H.I
]]>.Value
Dim namespacesToAdd = {"D =E.F"}
Dim expectedUpdatedCode = <![CDATA[Imports A = B.C
Imports D = E.F
Imports G= H.I
]]>.Value
TestSnippetAddImports(originalCode, namespacesToAdd, placeSystemNamespaceFirst:=True, expectedUpdatedCode:=expectedUpdatedCode)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
Public Sub AddImport_XmlNamespaceImport()
Dim originalCode = <![CDATA[]]>.Value
Dim namespacesToAdd = {"<xmlns:db=""http://example.org/database-two"">"}
Dim expectedUpdatedCode = <![CDATA[Imports <xmlns:db="http://example.org/database-two">
]]>.Value
TestSnippetAddImports(originalCode, namespacesToAdd, placeSystemNamespaceFirst:=True, expectedUpdatedCode:=expectedUpdatedCode)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
Public Sub AddImport_DuplicateXmlNamespaceDetectionIgnoresWhitespace1()
Dim originalCode = <![CDATA[Imports <xmlns:db = "http://example.org/database-two">
]]>.Value
Dim namespacesToAdd = {"<xmlns:db=""http://example.org/database-two"">"}
Dim expectedUpdatedCode = <![CDATA[Imports <xmlns:db = "http://example.org/database-two">
]]>.Value
TestSnippetAddImports(originalCode, namespacesToAdd, placeSystemNamespaceFirst:=True, expectedUpdatedCode:=expectedUpdatedCode)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
Public Sub AddImport_DuplicateXmlNamespaceDetectionIgnoresWhitespace2()
Dim originalCode = <![CDATA[Imports <xmlns:db="http://example.org/database-two">
]]>.Value
Dim namespacesToAdd = {"<xmlns:db = ""http://example.org/database-two"">"}
Dim expectedUpdatedCode = <![CDATA[Imports <xmlns:db="http://example.org/database-two">
]]>.Value
TestSnippetAddImports(originalCode, namespacesToAdd, placeSystemNamespaceFirst:=True, expectedUpdatedCode:=expectedUpdatedCode)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
Public Sub AddImport_DuplicateXmlNamespaceDetectionIgnoresCase()
Dim originalCode = <![CDATA[Imports <xmlns:db="http://example.org/database-two">
]]>.Value
Dim namespacesToAdd = {"<xmlns:Db=""http://example.org/database-two"">", "<xmlns:db=""http://example.org/Database-Two"">"}
Dim expectedUpdatedCode = <![CDATA[Imports <xmlns:db="http://example.org/database-two">
]]>.Value
TestSnippetAddImports(originalCode, namespacesToAdd, placeSystemNamespaceFirst:=True, expectedUpdatedCode:=expectedUpdatedCode)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
<WorkItem(640961)>
Public Sub AddImport_BadNamespaceGetsAdded()
Dim originalCode = <![CDATA[]]>.Value
Dim namespacesToAdd = {"$system"}
Dim expectedUpdatedCode = <![CDATA[Imports $system
]]>.Value
TestSnippetAddImports(originalCode, namespacesToAdd, placeSystemNamespaceFirst:=True, expectedUpdatedCode:=expectedUpdatedCode)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
<WorkItem(640961)>
Public Sub AddImport_TrailingTriviaIsIncluded()
Dim originalCode = <![CDATA[]]>.Value
Dim namespacesToAdd = {"System.Data ' Trivia!"}
Dim expectedUpdatedCode = <![CDATA[Imports System.Data ' Trivia!
]]>.Value
TestSnippetAddImports(originalCode, namespacesToAdd, placeSystemNamespaceFirst:=True, expectedUpdatedCode:=expectedUpdatedCode)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
<WorkItem(640961)>
Public Sub AddImport_TrailingTriviaNotUsedInDuplicationDetection()
Dim originalCode = <![CDATA[Imports System.Data ' Original trivia!
]]>.Value
Dim namespacesToAdd = {"System.Data ' Different trivia, should not be added!", "System ' Different namespace, should be added"}
Dim expectedUpdatedCode = <![CDATA[Imports System ' Different namespace, should be added
Imports System.Data ' Original trivia!
]]>.Value
TestSnippetAddImports(originalCode, namespacesToAdd, placeSystemNamespaceFirst:=True, expectedUpdatedCode:=expectedUpdatedCode)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
Public Sub SnippetFormatting_ProjectionBuffer_FullyInSubjectBuffer()
Dim workspaceXmlWithSubjectBufferDocument =
<Workspace>
<Project Language=<%= LanguageNames.VisualBasic %> CommonReferences="true">
<Document>Class C
Sub M()
@{|S1:For index = 1 to length
$$
Next|}
End Sub
End Class</Document>
</Project>
</Workspace>
Dim surfaceBufferDocument = <Document><div>
@[|{|S1:|} |]
</div></Document>
Dim expectedSurfaceBuffer = <SurfaceBuffer><div>
@For index = 1 to length
Next
</div></SurfaceBuffer>
TestFormatting(workspaceXmlWithSubjectBufferDocument, surfaceBufferDocument, expectedSurfaceBuffer)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
Public Sub SnippetFormatting_ProjectionBuffer_FullyInSubjectBuffer2()
Dim workspaceXmlWithSubjectBufferDocument =
<Workspace>
<Project Language=<%= LanguageNames.VisualBasic %> CommonReferences="true">
<Document>Class C
Sub M()
@{|S1:For index = 1 to length
For index2 = 1 to length
$$
Next
Next|}
End Sub
End Class</Document>
</Project>
</Workspace>
Dim surfaceBufferDocument = <Document><div>
@[|{|S1:|} |]
</div></Document>
Dim expectedSurfaceBuffer = <SurfaceBuffer><div>
@For index = 1 to length
For index2 = 1 to length
Next
Next
</div></SurfaceBuffer>
TestFormatting(workspaceXmlWithSubjectBufferDocument, surfaceBufferDocument, expectedSurfaceBuffer)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
Public Sub SnippetFormatting_ProjectionBuffer_ExpandedIntoSurfaceBuffer()
Dim workspaceXmlWithSubjectBufferDocument =
<Workspace>
<Project Language=<%= LanguageNames.VisualBasic %> CommonReferences="true">
<Document>Class C
Sub M()
@{|S1:For|}
End Sub
End Class</Document>
</Project>
</Workspace>
Dim surfaceBufferDocument = <Document><div>
@[|{|S1:|} index = 1 to length
$$
Next|]
</div></Document>
Dim expectedSurfaceBuffer = <SurfaceBuffer><div>
@For index = 1 to length
Next
</div></SurfaceBuffer>
TestFormatting(workspaceXmlWithSubjectBufferDocument, surfaceBufferDocument, expectedSurfaceBuffer)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.Snippets)>
Public Sub SnippetFormatting_ProjectionBuffer_FullyInSurfaceBuffer()
Dim workspaceXmlWithSubjectBufferDocument =
<Workspace>
<Project Language=<%= LanguageNames.VisualBasic %> CommonReferences="true">
<Document>Class C
Sub M()
@{|S1:|}
End Sub
End Class</Document>
</Project>
</Workspace>
Dim surfaceBufferDocument = <Document><div>
@[|{|S1:|}For index = 1 to length
$$
Next|]
</div></Document>
Dim expectedSurfaceBuffer = <SurfaceBuffer><div>
@For index = 1 to length
Next
</div></SurfaceBuffer>
TestFormatting(workspaceXmlWithSubjectBufferDocument, surfaceBufferDocument, expectedSurfaceBuffer)
End Sub
Private Sub TestSnippetAddImports(originalCode As String, namespacesToAdd As String(), placeSystemNamespaceFirst As Boolean, expectedUpdatedCode As String)
Dim workspaceXml = <Workspace>
<Project Language=<%= LanguageNames.VisualBasic %> CommonReferences="true">
<CompilationOptions/>
<Document><%= originalCode %></Document>
</Project>
</Workspace>
Dim snippetNode = <Snippet>
<Imports>
</Imports>
</Snippet>
For Each namespaceToAdd In namespacesToAdd
snippetNode.Element("Imports").Add(<Import>
<Namespace><%= namespaceToAdd %></Namespace>
</Import>)
Next
Using testWorkspace = TestWorkspaceFactory.CreateWorkspace(workspaceXml)
Dim expansionClient = New SnippetExpansionClient(
Guids.VisualBasicDebuggerLanguageId,
testWorkspace.Documents.Single().GetTextView(),
testWorkspace.Documents.Single().GetTextBuffer(),
Nothing)
Dim updatedDocument = expansionClient.AddImports(
testWorkspace.CurrentSolution.Projects.Single().Documents.Single(),
snippetNode,
placeSystemNamespaceFirst, CancellationToken.None)
Assert.Equal(expectedUpdatedCode.Replace(vbLf, vbCrLf),
updatedDocument.GetTextAsync(CancellationToken.None).Result.ToString())
End Using
End Sub
Sub TestFormatting(workspaceXmlWithSubjectBufferDocument As XElement, surfaceBufferDocumentXml As XElement, expectedSurfaceBuffer As XElement)
Using testWorkspace = TestWorkspaceFactory.CreateWorkspace(workspaceXmlWithSubjectBufferDocument)
Dim subjectBufferDocument = testWorkspace.Documents.Single()
Dim surfaceBufferDocument = testWorkspace.CreateProjectionBufferDocument(
surfaceBufferDocumentXml.NormalizedValue,
{subjectBufferDocument},
LanguageNames.VisualBasic,
options:=ProjectionBufferOptions.WritableLiteralSpans)
Dim snippetExpansionClient = New SnippetExpansionClient(
Guids.CSharpLanguageServiceId,
surfaceBufferDocument.GetTextView(),
subjectBufferDocument.TextBuffer,
Nothing)
SnippetExpansionClientTestsHelper.Test(snippetExpansionClient, subjectBufferDocument, surfaceBufferDocument, expectedSurfaceBuffer)
End Using
End Sub
End Class
End Namespace
|
Felorati/roslyn
|
src/VisualStudio/Core/Test/Snippets/VisualBasicSnippetExpansionClientTests.vb
|
Visual Basic
|
apache-2.0
| 16,113
|
'------------------------------------------------------------------------------
' <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("ResumableUpload.VB.Sample.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
|
googlearchive/google-api-dotnet-client-samples
|
ResumableUpload.VB.Sample/My Project/Resources.Designer.vb
|
Visual Basic
|
apache-2.0
| 2,731
|
Imports Com.Aspose.Tasks.Api
Imports Com.Aspose.Tasks.Model
Imports Com.Aspose.Storage.Api
Namespace Resources
Class AddResource
Public Shared Sub Run()
' ExStart:1
Dim tasksApi As New TasksApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH)
Dim storageApi As New StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH)
' Set input file name
Dim name As [String] = "sample-project.mpp"
Dim resourceName As [String] = "Resource6"
Dim beforeResourceId As Integer = 1
Dim fileName As [String] = ""
Dim storage As [String] = ""
Dim folder As [String] = ""
Try
' Upload source file to aspose cloud storage
storageApi.PutCreate(name, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + name))
' Invoke Aspose.Tasks Cloud SDK API to add resource informations
Dim apiResponse As ResourceItemResponse = tasksApi.PostProjectResource(name, resourceName, beforeResourceId, fileName, storage, folder)
If apiResponse IsNot Nothing Then
Console.WriteLine("Add a Resource To Project, Done!")
Console.ReadKey()
End If
Catch ex As Exception
System.Diagnostics.Debug.WriteLine("error:" + ex.Message + vbLf + ex.StackTrace)
End Try
' ExEnd:1
End Sub
End Class
End Namespace
|
aspose-tasks/Aspose.Tasks-for-Cloud
|
Examples/DotNET/VisualBasic/Resources/AddResource.vb
|
Visual Basic
|
mit
| 1,518
|
' 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 Microsoft.VisualStudio.Text.Editor
Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar
Friend Class MockNavigationBarPresenter
Implements INavigationBarPresenter
Private ReadOnly _textView As ITextView
Private ReadOnly _presentItemsCallback As Action
Private ReadOnly _presentItemsWithValuesCallback As Action(Of IList(Of NavigationBarProjectItem), NavigationBarProjectItem, IList(Of NavigationBarItem), NavigationBarItem, NavigationBarItem)
Public Sub New(textView As ITextView, presentItemsCallback As Action)
_textView = textView
_presentItemsCallback = presentItemsCallback
End Sub
Public Sub New(textView As ITextView, presentItemsWithValuesCallback As Action(Of IList(Of NavigationBarProjectItem), NavigationBarProjectItem, IList(Of NavigationBarItem), NavigationBarItem, NavigationBarItem))
_textView = textView
_presentItemsWithValuesCallback = presentItemsWithValuesCallback
End Sub
Public Event CaretMoved As EventHandler(Of CaretPositionChangedEventArgs) Implements INavigationBarPresenter.CaretMoved
Public Event ItemSelected As EventHandler(Of NavigationBarItemSelectedEventArgs) Implements INavigationBarPresenter.ItemSelected
Public Event ViewFocused As EventHandler(Of EventArgs) Implements INavigationBarPresenter.ViewFocused
Public Sub Disconnect() Implements INavigationBarPresenter.Disconnect
End Sub
Public Sub PresentItems(
projects As ImmutableArray(Of NavigationBarProjectItem),
selectedProject As NavigationBarProjectItem,
typesWithMembers As ImmutableArray(Of NavigationBarItem),
selectedType As NavigationBarItem,
selectedMember As NavigationBarItem) Implements INavigationBarPresenter.PresentItems
If _presentItemsCallback IsNot Nothing Then
_presentItemsCallback()
End If
If _presentItemsWithValuesCallback IsNot Nothing Then
_presentItemsWithValuesCallback(projects, selectedProject, typesWithMembers, selectedType, selectedMember)
End If
End Sub
Public Function TryGetCurrentView() As ITextView Implements INavigationBarPresenter.TryGetCurrentView
Return _textView
End Function
End Class
End Namespace
|
CyrusNajmabadi/roslyn
|
src/EditorFeatures/Test2/NavigationBar/MockNavigationBarPresenter.vb
|
Visual Basic
|
mit
| 2,668
|
' 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.Runtime.CompilerServices
Imports CompilationCreationTestHelpers
Imports Microsoft.CodeAnalysis.ImmutableArrayExtensions
Imports Microsoft.CodeAnalysis.Test.Extensions
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Roslyn.Test.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Symbols.Metadata.PE
Public Class LoadingGenericTypeParameters : Inherits BasicTestBase
<Fact>
Public Sub Test1()
Dim assembly = MetadataTestHelpers.LoadFromBytes(TestMetadata.ResourcesNet40.mscorlib)
Dim module0 = assembly.Modules(0)
Dim objectType = module0.GlobalNamespace.GetMembers("System").
OfType(Of NamespaceSymbol).Single().
GetTypeMembers("Object").Single()
Assert.Equal(0, objectType.Arity)
Assert.Equal(0, objectType.TypeParameters.Length)
Assert.Equal(0, objectType.TypeArguments.Length)
assembly = MetadataTestHelpers.LoadFromBytes(TestResources.General.MDTestLib1)
module0 = assembly.Modules(0)
Dim C1 = module0.GlobalNamespace.GetTypeMembers("C1").Single()
Assert.Equal(1, C1.Arity)
Assert.Equal(1, C1.TypeParameters.Length)
Assert.Equal(1, C1.TypeArguments.Length)
Dim C1_T = C1.TypeParameters(0)
Assert.Equal(C1_T, C1.TypeArguments(0))
Assert.Null(C1_T.BaseType)
Assert.Equal(assembly, C1_T.ContainingAssembly)
Assert.Equal(module0.GlobalNamespace, C1_T.ContainingNamespace) 'Null(C1_T.ContainingNamespace)
Assert.Equal(C1, C1_T.ContainingSymbol)
Assert.Equal(C1, C1_T.ContainingType)
Assert.Equal(Accessibility.NotApplicable, C1_T.DeclaredAccessibility)
Assert.Equal("C1_T", C1_T.Name)
Assert.Equal("C1_T", C1_T.ToTestDisplayString())
Assert.Equal(0, C1_T.GetMembers().Length())
Assert.Equal(0, C1_T.GetMembers("goo").Length())
Assert.Equal(0, C1_T.GetTypeMembers().Length())
Assert.Equal(0, C1_T.GetTypeMembers("goo").Length())
Assert.Equal(0, C1_T.GetTypeMembers("goo", 1).Length())
Assert.False(C1_T.HasConstructorConstraint)
Assert.False(C1_T.HasReferenceTypeConstraint)
Assert.False(C1_T.HasValueTypeConstraint)
Assert.Equal(0, C1_T.Interfaces.Length)
Assert.True(C1_T.IsDefinition)
Assert.False(C1_T.IsMustOverride)
Assert.False(C1_T.IsNamespace)
Assert.False(C1_T.IsNotOverridable)
Assert.False(C1_T.IsOverridable)
Assert.False(C1_T.IsOverrides)
Assert.False(C1_T.IsShared)
Assert.True(C1_T.IsType)
Assert.Equal(SymbolKind.TypeParameter, C1_T.Kind)
Assert.Equal(0, C1_T.Ordinal)
Assert.Equal(C1_T, C1_T.OriginalDefinition)
Assert.Equal(TypeKind.TypeParameter, C1_T.TypeKind)
Assert.Equal(VarianceKind.None, C1_T.Variance)
Assert.Same(module0, C1_T.Locations.Single().MetadataModule)
Assert.Equal(0, C1_T.ConstraintTypes.Length)
Dim C2 = C1.GetTypeMembers("C2").Single()
Assert.Equal(1, C2.Arity)
Assert.Equal(1, C2.TypeParameters.Length)
Assert.Equal(1, C2.TypeArguments.Length)
Dim C2_T = C2.TypeParameters(0)
Assert.Equal("C2_T", C2_T.Name)
Assert.Equal(C2, C2_T.ContainingType)
Dim C3 = C1.GetTypeMembers("C3").Single()
Assert.Equal(0, C3.Arity)
Assert.Equal(0, C3.TypeParameters.Length)
Assert.Equal(0, C3.TypeArguments.Length)
Dim C4 = C3.GetTypeMembers("C4").Single()
Assert.Equal(1, C4.Arity)
Assert.Equal(1, C4.TypeParameters.Length)
Assert.Equal(1, C4.TypeArguments.Length)
Dim C4_T = C4.TypeParameters(0)
Assert.Equal("C4_T", C4_T.Name)
Assert.Equal(C4, C4_T.ContainingType)
Dim TC2 = module0.GlobalNamespace.GetTypeMembers("TC2").Single()
Assert.Equal(2, TC2.Arity)
Assert.Equal(2, TC2.TypeParameters.Length)
Assert.Equal(2, TC2.TypeArguments.Length)
Dim TC2_T1 = TC2.TypeParameters(0)
Dim TC2_T2 = TC2.TypeParameters(1)
Assert.Equal(TC2_T1, TC2.TypeArguments(0))
Assert.Equal(TC2_T2, TC2.TypeArguments(1))
Assert.Equal("TC2_T1", TC2_T1.Name)
Assert.Equal(TC2, TC2_T1.ContainingType)
Assert.Equal(0, TC2_T1.Ordinal)
Assert.Equal("TC2_T2", TC2_T2.Name)
Assert.Equal(TC2, TC2_T2.ContainingType)
Assert.Equal(1, TC2_T2.Ordinal)
Dim C100 = module0.GlobalNamespace.GetTypeMembers("C100").Single()
Dim T = C100.TypeParameters(0)
Assert.False(T.HasConstructorConstraint)
Assert.False(T.HasReferenceTypeConstraint)
Assert.False(T.HasValueTypeConstraint)
Assert.Equal(VarianceKind.Out, T.Variance)
Dim C101 = module0.GlobalNamespace.GetTypeMembers("C101").Single()
T = C101.TypeParameters(0)
Assert.False(T.HasConstructorConstraint)
Assert.False(T.HasReferenceTypeConstraint)
Assert.False(T.HasValueTypeConstraint)
Assert.Equal(VarianceKind.In, T.Variance)
Dim C102 = module0.GlobalNamespace.GetTypeMembers("C102").Single()
T = C102.TypeParameters(0)
Assert.True(T.HasConstructorConstraint)
Assert.False(T.HasReferenceTypeConstraint)
Assert.False(T.HasValueTypeConstraint)
Assert.Equal(VarianceKind.None, T.Variance)
Assert.Equal(0, T.ConstraintTypes.Length)
Dim C103 = module0.GlobalNamespace.GetTypeMembers("C103").Single()
T = C103.TypeParameters(0)
Assert.False(T.HasConstructorConstraint)
Assert.True(T.HasReferenceTypeConstraint)
Assert.False(T.HasValueTypeConstraint)
Assert.Equal(VarianceKind.None, T.Variance)
Assert.Equal(0, T.ConstraintTypes.Length)
Dim C104 = module0.GlobalNamespace.GetTypeMembers("C104").Single()
T = C104.TypeParameters(0)
Assert.False(T.HasConstructorConstraint)
Assert.False(T.HasReferenceTypeConstraint)
Assert.True(T.HasValueTypeConstraint)
Assert.Equal(VarianceKind.None, T.Variance)
Assert.Equal(0, T.ConstraintTypes.Length)
Dim C105 = module0.GlobalNamespace.GetTypeMembers("C105").Single()
T = C105.TypeParameters(0)
Assert.True(T.HasConstructorConstraint)
Assert.True(T.HasReferenceTypeConstraint)
Assert.False(T.HasValueTypeConstraint)
Assert.Equal(VarianceKind.None, T.Variance)
Dim C106 = module0.GlobalNamespace.GetTypeMembers("C106").Single()
T = C106.TypeParameters(0)
Assert.True(T.HasConstructorConstraint)
Assert.True(T.HasReferenceTypeConstraint)
Assert.False(T.HasValueTypeConstraint)
Assert.Equal(VarianceKind.Out, T.Variance)
Dim I101 = module0.GlobalNamespace.GetTypeMembers("I101").Single()
Dim I102 = module0.GlobalNamespace.GetTypeMembers("I102").Single()
Dim C201 = module0.GlobalNamespace.GetTypeMembers("C201").Single()
T = C201.TypeParameters(0)
Assert.Equal(1, T.ConstraintTypes.Length)
Assert.Same(I101, T.ConstraintTypes.ElementAt(0))
Dim C202 = module0.GlobalNamespace.GetTypeMembers("C202").Single()
T = C202.TypeParameters(0)
Assert.Equal(2, T.ConstraintTypes.Length)
Assert.Same(I101, T.ConstraintTypes.ElementAt(0))
Assert.Same(I102, T.ConstraintTypes.ElementAt(1))
End Sub
<WorkItem(619267, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/619267")>
<Fact>
Public Sub InvalidNestedArity_2()
Dim ilSource = <![CDATA[
.class interface public abstract I0
{
.class interface abstract nested public IT<T>
{
.class interface abstract nested public I0 { }
}
}
.class interface public abstract IT<T>
{
.class interface abstract nested public I0
{
.class interface abstract nested public I0 { }
.class interface abstract nested public IT<T> { }
}
.class interface abstract nested public IT<T>
{
.class interface abstract nested public I0 { }
}
.class interface abstract nested public ITU<T, U>
{
.class interface abstract nested public IT<T> { }
}
}
]]>.Value
Dim vbSource =
<compilation>
<file name="c.vb"><![CDATA[
Class C0_T
Implements I0.IT(Of Object)
End Class
Class C0_T_0
Implements I0.IT(Of Object).I0
End Class
Class CT_0
Implements IT(Of Object).I0
End Class
Class CT_0_0
Implements IT(Of Object).I0.I0
End Class
Class CT_0_T
Implements IT(Of Object).I0.IT
End Class
Class CT_T_0
Implements IT(Of Object).IT.I0
End Class
Class CT_TU_T
Implements IT(Of Object).ITU(Of Integer).IT
End Class
]]>
</file>
</compilation>
Dim comp = CreateCompilationWithCustomILSource(vbSource, ilSource)
comp.AssertTheseDiagnostics(<expected>
BC30649: 'I0.IT(Of T).I0' is an unsupported type.
Implements I0.IT(Of Object).I0
~~~~~~~~~~~~~~~~~~~
BC30649: 'IT(Of T).I0' is an unsupported type.
Implements IT(Of Object).I0
~~~~~~~~~~~~~~~~
BC32042: Too few type arguments to 'IT(Of Object).I0.IT(Of T)'.
Implements IT(Of Object).I0.IT
~~~~~~~~~~~~~~~~~~~
BC30649: 'IT(Of T).IT.I0' is an unsupported type.
Implements IT(Of Object).IT.I0
~~~~~~~~~~~~~~~~~~~
BC30649: 'IT(Of T).ITU(Of U).IT' is an unsupported type.
Implements IT(Of Object).ITU(Of Integer).IT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
</expected>)
End Sub
End Class
End Namespace
|
jmarolf/roslyn
|
src/Compilers/VisualBasic/Test/Symbol/SymbolsTests/Metadata/PE/LoadingGenericTypeParameters.vb
|
Visual Basic
|
mit
| 10,544
|
'------------------------------------------------------------------------------
' <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
Imports System
Imports System.Reflection
Namespace Microsoft.CodeAnalysis.VisualBasic.VBFeaturesResources
'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 VBFeaturesResources
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("VBFeaturesResources", GetType(VBFeaturesResources).GetTypeInfo.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
'''<summary>
''' Looks up a localized string similar to AddHandler statement.
'''</summary>
Friend ReadOnly Property AddhandlerStatement() As String
Get
Return ResourceManager.GetString("AddhandlerStatement", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Creates a delegate procedure instance that references the specified procedure.
'''AddressOf <procedureName>.
'''</summary>
Friend ReadOnly Property AddressOfKeywordToolTip() As String
Get
Return ResourceManager.GetString("AddressOfKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Aggregate clause.
'''</summary>
Friend ReadOnly Property AggregateClause() As String
Get
Return ResourceManager.GetString("AggregateClause", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Applies an aggregation function, such as Sum, Average, or Count to a sequence..
'''</summary>
Friend ReadOnly Property AggregateQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("AggregateQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Indicates that an external procedure has another name in its DLL..
'''</summary>
Friend ReadOnly Property AliasKeywordToolTip() As String
Get
Return ResourceManager.GetString("AliasKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to all static local usages defined in the selection must be included in the selection.
'''</summary>
Friend ReadOnly Property AllStaticLocalUsagesDefine() As String
Get
Return ResourceManager.GetString("AllStaticLocalUsagesDefine", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Performs a short-circuit logical conjunction on two expressions. Returns True if both operands evaluate to True. If the first expression evaluates to False, the second is not evaluated.
'''<result> = <expression1> AndAlso <expression2>.
'''</summary>
Friend ReadOnly Property AndAlsoKeywordToolTip() As String
Get
Return ResourceManager.GetString("AndAlsoKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Performs a logical conjunction on two Boolean expressions, or a bitwise conjunction on two numeric expressions. For Boolean expressions, returns True if both operands evaluate to True. Both expressions are always evaluated.
'''<result> = <expression1> And <expression2>.
'''</summary>
Friend ReadOnly Property AndKeywordToolTip() As String
Get
Return ResourceManager.GetString("AndKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Used in a Declare statement. The Ansi modifier specifies that Visual Basic should marshal all strings to ANSI values, and should look up the procedure without modifying its name during the search. If no character set is specified, ANSI is the default..
'''</summary>
Friend ReadOnly Property AnsiKeywordToolTip() As String
Get
Return ResourceManager.GetString("AnsiKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Argument used for ByRef parameter can't be extracted out.
'''</summary>
Friend ReadOnly Property ArgumentUsedForByrefParame() As String
Get
Return ResourceManager.GetString("ArgumentUsedForByrefParame", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies the sort order for an Order By clause in a query. The smallest element will appear first..
'''</summary>
Friend ReadOnly Property AscendingQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("AscendingQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to as clause.
'''</summary>
Friend ReadOnly Property AsClause() As String
Get
Return ResourceManager.GetString("AsClause", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies a data type in a declaration statement..
'''</summary>
Friend ReadOnly Property AsKeywordToolTip() As String
Get
Return ResourceManager.GetString("AsKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that an attribute at the beginning of a source file applies to the entire assembly. Otherwise the attribute will apply only to an individual programming element, such as a class or property..
'''</summary>
Friend ReadOnly Property AssemblyKeywordToolTip() As String
Get
Return ResourceManager.GetString("AssemblyKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Indicates an asynchronous method that can use the Await operator..
'''</summary>
Friend ReadOnly Property AsyncKeywordToolTip() As String
Get
Return ResourceManager.GetString("AsyncKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Defines an asynchronous lambda expression that can use the Await operator. Can be used wherever a delegate type is expected.
'''Async Sub/Function(<parameterList>) <expression>.
'''</summary>
Friend ReadOnly Property AsyncLambdaKeywordToolTip() As String
Get
Return ResourceManager.GetString("AsyncLambdaKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to attributes.
'''</summary>
Friend ReadOnly Property AttributeList() As String
Get
Return ResourceManager.GetString("AttributeList", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Used in a Declare statement. The Auto modifier specifies that Visual Basic should marshal strings according to .NET Framework rules, and should determine the base character set of the run-time platform and possibly modify the external procedure name if the initial search fails..
'''</summary>
Friend ReadOnly Property AutoKeywordToolTip() As String
Get
Return ResourceManager.GetString("AutoKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Await.
'''</summary>
Friend ReadOnly Property Await() As String
Get
Return ResourceManager.GetString("Await", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Awaitable.
'''</summary>
Friend ReadOnly Property Awaitable() As String
Get
Return ResourceManager.GetString("Awaitable", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Awaitable, Extension.
'''</summary>
Friend ReadOnly Property AwaitableExtension() As String
Get
Return ResourceManager.GetString("AwaitableExtension", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Await expression.
'''</summary>
Friend ReadOnly Property AwaitExpression() As String
Get
Return ResourceManager.GetString("AwaitExpression", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Asynchronously waits for the task to finish..
'''</summary>
Friend ReadOnly Property AwaitKeywordToolTip() As String
Get
Return ResourceManager.GetString("AwaitKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Sets the string comparison method specified in Option Compare to a strict binary sort order..
'''</summary>
Friend ReadOnly Property BinaryKeywordToolTip() As String
Get
Return ResourceManager.GetString("BinaryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies the element keys used for grouping (in Group By) or sort order (in Order By)..
'''</summary>
Friend ReadOnly Property ByQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("ByQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that an argument is passed in such a way that the called procedure can change the underlying value of the argument in the calling code..
'''</summary>
Friend ReadOnly Property ByRefKeywordToolTip() As String
Get
Return ResourceManager.GetString("ByRefKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that an argument is passed in such a way that the called procedure or property cannot change the underlying value of the argument in the calling code..
'''</summary>
Friend ReadOnly Property ByValKeywordToolTip() As String
Get
Return ResourceManager.GetString("ByValKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Transfers execution to a Function, Sub, or dynamic-link library (DLL) procedure.
'''[Call] <procedureName> [(<argumentList>)].
'''</summary>
Friend ReadOnly Property CallKeywordToolTip() As String
Get
Return ResourceManager.GetString("CallKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to can't determine valid range of statements to extract out.
'''</summary>
Friend ReadOnly Property CantDetermineValidRangeOf() As String
Get
Return ResourceManager.GetString("CantDetermineValidRangeOf", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Introduces the statements to run if none of the previous cases in the Select Case statement returns True..
'''</summary>
Friend ReadOnly Property CaseElseKeywordToolTip() As String
Get
Return ResourceManager.GetString("CaseElseKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Followed by a comparison operator and then an expression, Case Is introduces the statements to run if the Select Case expression combined with the Case Is expression evaluates to True..
'''</summary>
Friend ReadOnly Property CaseIsKeywordToolTip() As String
Get
Return ResourceManager.GetString("CaseIsKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Introduces a value, or set of values, against which the value of an expression in a Select Case statement is to be tested.
'''Case {<expression>|<expression1> To <expression2>|[Is] <comparisonOperator> <expression>}.
'''</summary>
Friend ReadOnly Property CaseKeywordToolTip() As String
Get
Return ResourceManager.GetString("CaseKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Cast is redundant.
'''</summary>
Friend ReadOnly Property CastIsRedundant() As String
Get
Return ResourceManager.GetString("CastIsRedundant", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Catch clause.
'''</summary>
Friend ReadOnly Property CatchClause() As String
Get
Return ResourceManager.GetString("CatchClause", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Introduces a statement block to be run if the specified exception occurs inside a Try block..
'''</summary>
Friend ReadOnly Property CatchKeywordToolTip() As String
Get
Return ResourceManager.GetString("CatchKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Declares the name of a class and introduces the definitions of the variables, properties, and methods that make up the class..
'''</summary>
Friend ReadOnly Property ClassKeywordToolTip() As String
Get
Return ResourceManager.GetString("ClassKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Sets the default comparison method to use when comparing string data. When set to Text, uses a text sort order that is not case sensitive. When set to Binary, uses a strict binary sort order.
'''Option Compare {Binary | Text}.
'''</summary>
Friend ReadOnly Property CompareKeywordToolTip() As String
Get
Return ResourceManager.GetString("CompareKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Generates a string concatenation of two expressions..
'''</summary>
Friend ReadOnly Property ConcatKeywordToolTip() As String
Get
Return ResourceManager.GetString("ConcatKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Conflict(s) detected..
'''</summary>
Friend ReadOnly Property ConflictsDetected() As String
Get
Return ResourceManager.GetString("ConflictsDetected", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Defines a conditional compiler constant. Conditional compiler constants are always private to the file in which they appear. The expressions used to initialize them can contain only conditional compiler constants and literals..
'''</summary>
Friend ReadOnly Property ConstCCKeywordToolTip() As String
Get
Return ResourceManager.GetString("ConstCCKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Declares and defines one or more constants..
'''</summary>
Friend ReadOnly Property ConstKeywordToolTip() As String
Get
Return ResourceManager.GetString("ConstKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to contains invalid selection.
'''</summary>
Friend ReadOnly Property ContainsInvalidSelection() As String
Get
Return ResourceManager.GetString("ContainsInvalidSelection", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Transfers execution immediately to the next iteration of the Do loop..
'''</summary>
Friend ReadOnly Property ContinueDoKeywordToolTip() As String
Get
Return ResourceManager.GetString("ContinueDoKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Transfers execution immediately to the next iteration of the For loop..
'''</summary>
Friend ReadOnly Property ContinueForKeywordToolTip() As String
Get
Return ResourceManager.GetString("ContinueForKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Transfers execution immediately to the next iteration of the loop. Can be used in a Do loop, a For loop, or a While loop..
'''</summary>
Friend ReadOnly Property ContinueKeywordToolTip() As String
Get
Return ResourceManager.GetString("ContinueKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Transfers execution immediately to the next iteration of the While loop..
'''</summary>
Friend ReadOnly Property ContinueWhileKeywordToolTip() As String
Get
Return ResourceManager.GetString("ContinueWhileKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Convert {0} to Iterator.
'''</summary>
Friend ReadOnly Property ConvertToIterator() As String
Get
Return ResourceManager.GetString("ConvertToIterator", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Use the correct control variable.
'''</summary>
Friend ReadOnly Property CorrectNextControlVariable() As String
Get
Return ResourceManager.GetString("CorrectNextControlVariable", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Use 'In' for a type that will only be used for ByVal arguments to functions..
'''</summary>
Friend ReadOnly Property CovarianceInKeywordToolTip() As String
Get
Return ResourceManager.GetString("CovarianceInKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Use 'Out' for a type that will only be used as a return from functions..
'''</summary>
Friend ReadOnly Property CovarianceOutKeywordToolTip() As String
Get
Return ResourceManager.GetString("CovarianceOutKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to CType function.
'''</summary>
Friend ReadOnly Property CtypeFunction() As String
Get
Return ResourceManager.GetString("CtypeFunction", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that an event has additional, specialized code for adding handlers, removing handlers, and raising events..
'''</summary>
Friend ReadOnly Property CustomEventKeywordToolTip() As String
Get
Return ResourceManager.GetString("CustomEventKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Declares a reference to a procedure implemented in an external file..
'''</summary>
Friend ReadOnly Property DeclareKeywordToolTip() As String
Get
Return ResourceManager.GetString("DeclareKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Identifies a property as the default property of its class, structure, or interface..
'''</summary>
Friend ReadOnly Property DefaultKeywordToolTip() As String
Get
Return ResourceManager.GetString("DefaultKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to 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..
'''</summary>
Friend ReadOnly Property DelegateKeywordToolTip() As String
Get
Return ResourceManager.GetString("DelegateKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Delete the '{0}' statement..
'''</summary>
Friend ReadOnly Property DeleteTheStatement() As String
Get
Return ResourceManager.GetString("DeleteTheStatement", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Deprecated.
'''</summary>
Friend ReadOnly Property Deprecated() As String
Get
Return ResourceManager.GetString("Deprecated", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies the sort order for an Order By clause in a query. The largest element will appear first..
'''</summary>
Friend ReadOnly Property DescendingQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("DescendingQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Declares and allocates storage space for one or more variables.
'''Dim {<var> [As [New] dataType [(boundList)]][= initializer]}[, var2].
'''</summary>
Friend ReadOnly Property DimKeywordToolTip() As String
Get
Return ResourceManager.GetString("DimKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to DirectCast function.
'''</summary>
Friend ReadOnly Property DirectcastFunction() As String
Get
Return ResourceManager.GetString("DirectcastFunction", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Disables reporting of specified warnings in the portion of the source file below the current line..
'''</summary>
Friend ReadOnly Property DisableKeywordToolTip() As String
Get
Return ResourceManager.GetString("DisableKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Restricts the values of a query result to eliminate duplicate values..
'''</summary>
Friend ReadOnly Property DistinctQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("DistinctQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Divides two numbers and returns a floating-point result..
'''</summary>
Friend ReadOnly Property DivisionKeywordToolTip() As String
Get
Return ResourceManager.GetString("DivisionKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Repeats a block of statements while a Boolean condition is true, or until the condition becomes true.
'''Do...Loop {While | Until} <condition>.
'''</summary>
Friend ReadOnly Property DoKeywordToolTip() As String
Get
Return ResourceManager.GetString("DoKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above..
'''</summary>
Friend ReadOnly Property DoNotChangeThisCodeUseDispose() As String
Get
Return ResourceManager.GetString("DoNotChangeThisCodeUseDispose", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Repeats a block of statements until a Boolean condition becomes true.
'''Do Until <condition>...Loop.
'''</summary>
Friend ReadOnly Property DoUntilKeywordToolTip() As String
Get
Return ResourceManager.GetString("DoUntilKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Repeats a block of statements while a Boolean condition is true.
'''Do While <condition>...Loop.
'''</summary>
Friend ReadOnly Property DoWhileKeywordToolTip() As String
Get
Return ResourceManager.GetString("DoWhileKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Introduces a group of statements in an #If statement that is compiled if no previous condition evaluates to True..
'''</summary>
Friend ReadOnly Property ElseCCKeywordToolTip() As String
Get
Return ResourceManager.GetString("ElseCCKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Introduces a condition in an #If statement that is tested if the previous conditional test evaluates to False..
'''</summary>
Friend ReadOnly Property ElseIfCCKeywordToolTip() As String
Get
Return ResourceManager.GetString("ElseIfCCKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Introduces a condition in an If statement that is to be tested if the previous conditional test fails..
'''</summary>
Friend ReadOnly Property ElseIfKeywordToolTip() As String
Get
Return ResourceManager.GetString("ElseIfKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Introduces a group of statements in an If statement that is executed if no previous condition evaluates to True..
'''</summary>
Friend ReadOnly Property ElseKeywordToolTip() As String
Get
Return ResourceManager.GetString("ElseKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to .
'''</summary>
Friend ReadOnly Property EmptyString1() As String
Get
Return ResourceManager.GetString("EmptyString1", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Enables reporting of specified warnings in the portion of the source file below the current line..
'''</summary>
Friend ReadOnly Property EnableKeywordToolTip() As String
Get
Return ResourceManager.GetString("EnableKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Terminates a {0} block..
'''</summary>
Friend ReadOnly Property EndBlockKeywordToolTip1() As String
Get
Return ResourceManager.GetString("EndBlockKeywordToolTip1", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Terminates an {0} block..
'''</summary>
Friend ReadOnly Property EndBlockKeywordToolTip2() As String
Get
Return ResourceManager.GetString("EndBlockKeywordToolTip2", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Terminates the definition of an #If block..
'''</summary>
Friend ReadOnly Property EndIfCCKeywordToolTip() As String
Get
Return ResourceManager.GetString("EndIfCCKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Stops execution immediately..
'''</summary>
Friend ReadOnly Property EndKeywordToolTip() As String
Get
Return ResourceManager.GetString("EndKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Terminates a #Region block..
'''</summary>
Friend ReadOnly Property EndRegionKeywordToolTip() As String
Get
Return ResourceManager.GetString("EndRegionKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Terminates the definition of a {0} statement..
'''</summary>
Friend ReadOnly Property EndStatementKeywordToolTip1() As String
Get
Return ResourceManager.GetString("EndStatementKeywordToolTip1", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Terminates the definition of an {0} statement..
'''</summary>
Friend ReadOnly Property EndStatementKeywordToolTip2() As String
Get
Return ResourceManager.GetString("EndStatementKeywordToolTip2", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Declares an enumeration and defines the values of its members..
'''</summary>
Friend ReadOnly Property EnumKeywordToolTip() As String
Get
Return ResourceManager.GetString("EnumKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Compares two expressions and returns True if they are equal. Otherwise, returns False..
'''</summary>
Friend ReadOnly Property EqualsKeywordToolTip() As String
Get
Return ResourceManager.GetString("EqualsKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies the relationship between element keys to use as the basis of a join operation..
'''</summary>
Friend ReadOnly Property EqualsQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("EqualsQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Used to release array variables and deallocate the memory used for their elements..
'''</summary>
Friend ReadOnly Property EraseKeywordToolTip() As String
Get
Return ResourceManager.GetString("EraseKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Too many arguments to '{0}'..
'''</summary>
Friend ReadOnly Property ERR_TooManyArgs1() As String
Get
Return ResourceManager.GetString("ERR_TooManyArgs1", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Type '{0}' is not defined..
'''</summary>
Friend ReadOnly Property ERR_UndefinedType1() As String
Get
Return ResourceManager.GetString("ERR_UndefinedType1", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Simulates the occurrence of an error..
'''</summary>
Friend ReadOnly Property ErrorKeywordToolTip() As String
Get
Return ResourceManager.GetString("ErrorKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Declares a user-defined event..
'''</summary>
Friend ReadOnly Property EventKeywordToolTip() As String
Get
Return ResourceManager.GetString("EventKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Exits a Do loop and transfers execution immediately to the statement following the Loop statement..
'''</summary>
Friend ReadOnly Property ExitDoKeywordToolTip() As String
Get
Return ResourceManager.GetString("ExitDoKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Exits a For loop and transfers execution immediately to the statement following the Next statement..
'''</summary>
Friend ReadOnly Property ExitForKeywordToolTip() As String
Get
Return ResourceManager.GetString("ExitForKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Exits a procedure or block and transfers execution immediately to the statement following the procedure call or block definition.
'''Exit {Do | For | Function | Property | Select | Sub | Try | While}.
'''</summary>
Friend ReadOnly Property ExitKeywordToolTip() As String
Get
Return ResourceManager.GetString("ExitKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Exits a Select block and transfers execution immediately to the statement following the End Select statement..
'''</summary>
Friend ReadOnly Property ExitSelectKeywordToolTip() As String
Get
Return ResourceManager.GetString("ExitSelectKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Exits a Sub procedure and transfers execution immediately to the statement following the call to the Sub procedure..
'''</summary>
Friend ReadOnly Property ExitSubKeywordToolTip() As String
Get
Return ResourceManager.GetString("ExitSubKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Exits a Try block and transfers execution immediately to the statement following the End Try statement..
'''</summary>
Friend ReadOnly Property ExitTryKeywordToolTip() As String
Get
Return ResourceManager.GetString("ExitTryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Exits a While loop and transfers execution immediately to the statement following the End While statement..
'''</summary>
Friend ReadOnly Property ExitWhileKeywordToolTip() As String
Get
Return ResourceManager.GetString("ExitWhileKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Generate narrowing conversion in '{0}'.
'''</summary>
Friend ReadOnly Property ExplicitConversionDisplayText() As String
Get
Return ResourceManager.GetString("ExplicitConversionDisplayText", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to When set to On, requires explicit declaration of all variables, using a Dim, Private, Public, or ReDim statement.
'''Option Explicit {On | Off}.
'''</summary>
Friend ReadOnly Property ExplicitKeywordToolTip() As String
Get
Return ResourceManager.GetString("ExplicitKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Raises a number to the power of another number..
'''</summary>
Friend ReadOnly Property ExponentiationKeywordToolTip() As String
Get
Return ResourceManager.GetString("ExponentiationKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Extension.
'''</summary>
Friend ReadOnly Property Extension() As String
Get
Return ResourceManager.GetString("Extension", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that the external procedure being referenced in the Declare statement is a Function..
'''</summary>
Friend ReadOnly Property ExternFunctionKeywordToolTip() As String
Get
Return ResourceManager.GetString("ExternFunctionKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that the external procedure being referenced in the Declare statement is a Sub..
'''</summary>
Friend ReadOnly Property ExternSubKeywordToolTip() As String
Get
Return ResourceManager.GetString("ExternSubKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Represents a Boolean value that fails a conditional test..
'''</summary>
Friend ReadOnly Property FalseKeywordToolTip() As String
Get
Return ResourceManager.GetString("FalseKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Finally clause.
'''</summary>
Friend ReadOnly Property FinallyClause() As String
Get
Return ResourceManager.GetString("FinallyClause", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Introduces a statement block to be run before exiting a Try structure..
'''</summary>
Friend ReadOnly Property FinallyKeywordToolTip() As String
Get
Return ResourceManager.GetString("FinallyKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Fix Incorrect Function Return Type.
'''</summary>
Friend ReadOnly Property FixIncorrectFunctionReturnType() As String
Get
Return ResourceManager.GetString("FixIncorrectFunctionReturnType", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to For Each block.
'''</summary>
Friend ReadOnly Property ForEachBlock() As String
Get
Return ResourceManager.GetString("ForEachBlock", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Introduces a loop that is repeated for each element in a collection..
'''</summary>
Friend ReadOnly Property ForEachKeywordToolTip() As String
Get
Return ResourceManager.GetString("ForEachKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to For Each statement.
'''</summary>
Friend ReadOnly Property ForEachStatement() As String
Get
Return ResourceManager.GetString("ForEachStatement", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Introduces a loop that is iterated a specified number of times..
'''</summary>
Friend ReadOnly Property ForKeywordToolTip() As String
Get
Return ResourceManager.GetString("ForKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to TODO: free unmanaged resources (unmanaged objects) and override Finalize() below..
'''</summary>
Friend ReadOnly Property FreeUnmanagedResourcesTodo() As String
Get
Return ResourceManager.GetString("FreeUnmanagedResourcesTodo", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that one or more declared programming elements are accessible only from within the assembly that contains their declaration..
'''</summary>
Friend ReadOnly Property FriendKeywordToolTip() As String
Get
Return ResourceManager.GetString("FriendKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to From clause.
'''</summary>
Friend ReadOnly Property FromClause() As String
Get
Return ResourceManager.GetString("FromClause", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Identifies a list of values as a collection initializer.
'''</summary>
Friend ReadOnly Property FromCollectionInitializerKeywordToolTip() As String
Get
Return ResourceManager.GetString("FromCollectionInitializerKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies a collection and a range variable to use in a query..
'''</summary>
Friend ReadOnly Property FromQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("FromQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to {0} function.
'''</summary>
Friend ReadOnly Property Function1() As String
Get
Return ResourceManager.GetString("Function1", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Function aggregation.
'''</summary>
Friend ReadOnly Property FunctionAggregation() As String
Get
Return ResourceManager.GetString("FunctionAggregation", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Declares the name, parameters, and code that define a Function procedure, that is, a procedure that returns a value to the calling code..
'''</summary>
Friend ReadOnly Property FunctionKeywordToolTip() As String
Get
Return ResourceManager.GetString("FunctionKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Defines a lambda expression that calculates and returns a single value. Can be used wherever a delegate type is expected.
'''Function(<parameterList>) <expression>.
'''</summary>
Friend ReadOnly Property FunctionLambdaKeywordToolTip() As String
Get
Return ResourceManager.GetString("FunctionLambdaKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Create event {0} in {1}.
'''</summary>
Friend ReadOnly Property GeneratedeventnameTargets() As String
Get
Return ResourceManager.GetString("GeneratedeventnameTargets", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Constrains a generic type parameter to require that any type argument passed to it be a reference type..
'''</summary>
Friend ReadOnly Property GenericConstraintsClassKeywordToolTip() As String
Get
Return ResourceManager.GetString("GenericConstraintsClassKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies a constructor constraint on a generic type parameter..
'''</summary>
Friend ReadOnly Property GenericConstraintsNewKeywordToolTip() As String
Get
Return ResourceManager.GetString("GenericConstraintsNewKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Constrains a generic type parameter to require that any type argument passed to it be a value type..
'''</summary>
Friend ReadOnly Property GenericConstraintsStructureKeywordToolTip() As String
Get
Return ResourceManager.GetString("GenericConstraintsStructureKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Declares a Get property procedure that is used to return the current value of a property..
'''</summary>
Friend ReadOnly Property GetPropertyKeywordToolTip() As String
Get
Return ResourceManager.GetString("GetPropertyKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to GetType function.
'''</summary>
Friend ReadOnly Property GettypeFunction() As String
Get
Return ResourceManager.GetString("GettypeFunction", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to GetXmlNamespace function.
'''</summary>
Friend ReadOnly Property GetxmlnamespaceFunction() As String
Get
Return ResourceManager.GetString("GetxmlnamespaceFunction", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Branches unconditionally to a specified line in a procedure..
'''</summary>
Friend ReadOnly Property GotoKeywordToolTip() As String
Get
Return ResourceManager.GetString("GotoKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Compares two expressions and returns True if the first is greater than the second. Otherwise, returns False..
'''</summary>
Friend ReadOnly Property GreaterThanKeywordToolTip() As String
Get
Return ResourceManager.GetString("GreaterThanKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Compares two expressions and returns True if the first is greater than or equal to the second. Otherwise, returns False..
'''</summary>
Friend ReadOnly Property GreaterThanOrEqualsKeywordToolTip() As String
Get
Return ResourceManager.GetString("GreaterThanOrEqualsKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Group By clause.
'''</summary>
Friend ReadOnly Property GroupByClause() As String
Get
Return ResourceManager.GetString("GroupByClause", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Groups elements that have a common key..
'''</summary>
Friend ReadOnly Property GroupByQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("GroupByQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Group Join clause.
'''</summary>
Friend ReadOnly Property GroupJoinClause() As String
Get
Return ResourceManager.GetString("GroupJoinClause", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Combines the elements of two sequences and groups the results. The join operation is based on matching keys..
'''</summary>
Friend ReadOnly Property GroupJoinQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("GroupJoinQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Use 'Group' to specify that a group named '{0}' should be created..
'''</summary>
Friend ReadOnly Property GroupRefNameQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("GroupRefNameQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Use 'Group' to specify that a group named 'Group' should be created..
'''</summary>
Friend ReadOnly Property GroupRefQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("GroupRefQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Declares that a procedure handles a specified event..
'''</summary>
Friend ReadOnly Property HandlesKeywordToolTip() As String
Get
Return ResourceManager.GetString("HandlesKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Conditionally compiles selected blocks of code, depending on the value of an expression..
'''</summary>
Friend ReadOnly Property IfCCKeywordToolTip() As String
Get
Return ResourceManager.GetString("IfCCKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Conditionally executes a group of statements, depending on the value of an expression..
'''</summary>
Friend ReadOnly Property IfKeywordToolTip() As String
Get
Return ResourceManager.GetString("IfKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Implement Abstract Class.
'''</summary>
Friend ReadOnly Property ImplementAbstractClass() As String
Get
Return ResourceManager.GetString("ImplementAbstractClass", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Indicates that a class or structure member is providing the implementation for a member defined in an interface..
'''</summary>
Friend ReadOnly Property ImplementsKeywordAfterMethodDeclarationToolTip() As String
Get
Return ResourceManager.GetString("ImplementsKeywordAfterMethodDeclarationToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies one or more interfaces, or interface members, that must be implemented in the class or structure definition in which the Implements statement appears..
'''</summary>
Friend ReadOnly Property ImplementsKeywordAfterTypeDeclarationToolTip() As String
Get
Return ResourceManager.GetString("ImplementsKeywordAfterTypeDeclarationToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Generate widening conversion in '{0}'.
'''</summary>
Friend ReadOnly Property ImplicitConversionDisplayText() As String
Get
Return ResourceManager.GetString("ImplicitConversionDisplayText", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Implicit member access can't be included in the selection without containing statement.
'''</summary>
Friend ReadOnly Property ImplicitMemberAccessCantB() As String
Get
Return ResourceManager.GetString("ImplicitMemberAccessCantB", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Imports all or specified elements of a namespace into a file..
'''</summary>
Friend ReadOnly Property ImportsKeywordToolTip() As String
Get
Return ResourceManager.GetString("ImportsKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to import.
'''</summary>
Friend ReadOnly Property ImportStatement() As String
Get
Return ResourceManager.GetString("ImportStatement", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to When set to On, allows the use of local type inference in declaring variables.
'''Option Infer {On | Off}.
'''</summary>
Friend ReadOnly Property InferKeywordToolTip() As String
Get
Return ResourceManager.GetString("InferKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies the group that the loop variable in a For Each statement is to traverse..
'''</summary>
Friend ReadOnly Property InForEachKeywordToolTip() As String
Get
Return ResourceManager.GetString("InForEachKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies the group that the loop variable is to traverse in a For Each statement, or specifies the range variable in a query..
'''</summary>
Friend ReadOnly Property InGlobalKeywordToolTip() As String
Get
Return ResourceManager.GetString("InGlobalKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Causes the current class or interface to inherit the attributes, variables, properties, procedures, and events from another class or set of interfaces..
'''</summary>
Friend ReadOnly Property InheritsKeywordToolTip() As String
Get
Return ResourceManager.GetString("InheritsKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Inline temporary variable.
'''</summary>
Friend ReadOnly Property InlineTemporaryVariable() As String
Get
Return ResourceManager.GetString("InlineTemporaryVariable", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies the group that the range variable is to traverse in a query..
'''</summary>
Friend ReadOnly Property InQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("InQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Insert '{0}'..
'''</summary>
Friend ReadOnly Property Insert() As String
Get
Return ResourceManager.GetString("Insert", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Insert 'Await'..
'''</summary>
Friend ReadOnly Property InsertAwait() As String
Get
Return ResourceManager.GetString("InsertAwait", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Insert Missing Cast.
'''</summary>
Friend ReadOnly Property InsertMissingCast() As String
Get
Return ResourceManager.GetString("InsertMissingCast", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Insert the missing '{0}'..
'''</summary>
Friend ReadOnly Property InsertTheMissing() As String
Get
Return ResourceManager.GetString("InsertTheMissing", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Insert the missing 'End Property' statement..
'''</summary>
Friend ReadOnly Property InsertTheMissingEndProper() As String
Get
Return ResourceManager.GetString("InsertTheMissingEndProper", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Divides two numbers and returns an integer result..
'''</summary>
Friend ReadOnly Property IntegerDivisionKeywordToolTip() As String
Get
Return ResourceManager.GetString("IntegerDivisionKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Declares the name of an interface and the definitions of the members of the interface..
'''</summary>
Friend ReadOnly Property InterfaceKeywordToolTip() As String
Get
Return ResourceManager.GetString("InterfaceKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies an identifier that can serve as a reference to the results of a join or grouping subexpression..
'''</summary>
Friend ReadOnly Property IntoQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("IntoQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Invalid selection.
'''</summary>
Friend ReadOnly Property InvalidSelection() As String
Get
Return ResourceManager.GetString("InvalidSelection", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Invert If statement.
'''</summary>
Friend ReadOnly Property InvertIfStatement() As String
Get
Return ResourceManager.GetString("InvertIfStatement", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Determines whether an expression is false. If instances of any class or structure will be used in an OrElse clause, you must define IsFalse on that class or structure..
'''</summary>
Friend ReadOnly Property IsFalseKeywordToolTip() As String
Get
Return ResourceManager.GetString("IsFalseKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Compares two object reference variables and returns True if the objects are equal.
'''<result> = <object1> Is <object2>.
'''</summary>
Friend ReadOnly Property IsKeywordToolTip() As String
Get
Return ResourceManager.GetString("IsKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Compares two object reference variables and returns True if the objects are not equal.
'''<result> = <object1> IsNot <object2>.
'''</summary>
Friend ReadOnly Property IsNotKeywordToolTip() As String
Get
Return ResourceManager.GetString("IsNotKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Determines whether an expression is true. If instances of any class or structure will be used in an OrElse clause, you must define IsTrue on that class or structure..
'''</summary>
Friend ReadOnly Property IsTrueKeywordToolTip() As String
Get
Return ResourceManager.GetString("IsTrueKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Indicates an iterator method that can use the Yield statement..
'''</summary>
Friend ReadOnly Property IteratorKeywordToolTip() As String
Get
Return ResourceManager.GetString("IteratorKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Defines an iterator lambda expression that can use the Yield statement.
'''Iterator Function(<parameterList>) As IEnumerable(Of <T>).
'''</summary>
Friend ReadOnly Property IteratorLambdaKeywordToolTip() As String
Get
Return ResourceManager.GetString("IteratorLambdaKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Join condition.
'''</summary>
Friend ReadOnly Property JoinCondition() As String
Get
Return ResourceManager.GetString("JoinCondition", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Combines the elements of two sequences. The join operation is based on matching keys..
'''</summary>
Friend ReadOnly Property JoinQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("JoinQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Identifies a key field in an anonymous type definition..
'''</summary>
Friend ReadOnly Property KeyKeywordToolTip() As String
Get
Return ResourceManager.GetString("KeyKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Delete the '{0}' statement..
'''</summary>
Friend ReadOnly Property Kind() As String
Get
Return ResourceManager.GetString("Kind", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Move the '{0}' statement to line {1}..
'''</summary>
Friend ReadOnly Property KindLine() As String
Get
Return ResourceManager.GetString("KindLine", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Lambda.
'''</summary>
Friend ReadOnly Property LambdaExpression() As String
Get
Return ResourceManager.GetString("LambdaExpression", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Performs an arithmetic left shift on a bit pattern..
'''</summary>
Friend ReadOnly Property LeftShiftKeywordToolTip() As String
Get
Return ResourceManager.GetString("LeftShiftKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Compares two expressions and returns True if the first is less than the second. Otherwise, returns False..
'''</summary>
Friend ReadOnly Property LessThanKeywordToolTip() As String
Get
Return ResourceManager.GetString("LessThanKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Compares two expressions and returns True if the first is less than or equal to the second. Otherwise, returns False..
'''</summary>
Friend ReadOnly Property LessThanOrEqualsKeywordToolTip() As String
Get
Return ResourceManager.GetString("LessThanOrEqualsKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Let clause.
'''</summary>
Friend ReadOnly Property LetClause() As String
Get
Return ResourceManager.GetString("LetClause", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Computes a value for each item in the query, and assigns the value to a new range variable..
'''</summary>
Friend ReadOnly Property LetQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("LetQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Introduces a clause that identifies the external file (DLL or code resource) containing an external procedure..
'''</summary>
Friend ReadOnly Property LibKeywordToolTip() As String
Get
Return ResourceManager.GetString("LibKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Compares a string against a pattern. Wildcards available include ? to match 1 character and * to match 0 or more characters.
'''<result> = <string> Like <pattern>.
'''</summary>
Friend ReadOnly Property LikeKeywordToolTip() As String
Get
Return ResourceManager.GetString("LikeKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Terminates a loop that is introduced with a Do statement..
'''</summary>
Friend ReadOnly Property LoopKeywordToolTip() As String
Get
Return ResourceManager.GetString("LoopKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Repeats a block of statements until a Boolean condition becomes true.
'''Do...Loop Until <condition>.
'''</summary>
Friend ReadOnly Property LoopUntilKeywordToolTip() As String
Get
Return ResourceManager.GetString("LoopUntilKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Repeats a block of statements while a Boolean condition is true.
'''Do...Loop While <condition>.
'''</summary>
Friend ReadOnly Property LoopWhileKeywordToolTip() As String
Get
Return ResourceManager.GetString("LoopWhileKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Make the containing scope 'Async'..
'''</summary>
Friend ReadOnly Property MakeAsync() As String
Get
Return ResourceManager.GetString("MakeAsync", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Make {0} an Async Function..
'''</summary>
Friend ReadOnly Property MakeAsyncFunction() As String
Get
Return ResourceManager.GetString("MakeAsyncFunction", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Provides a way to refer to the current instance of a class or structure, that is, the instance in which the code is running..
'''</summary>
Friend ReadOnly Property MeKeywordToolTip() As String
Get
Return ResourceManager.GetString("MeKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Mid statement.
'''</summary>
Friend ReadOnly Property MidStatement() As String
Get
Return ResourceManager.GetString("MidStatement", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Returns the difference between two numeric expressions, or the negative value of a numeric expression..
'''</summary>
Friend ReadOnly Property MinusKeywordToolTip() As String
Get
Return ResourceManager.GetString("MinusKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Divides two numbers and returns only the remainder.
'''<number1> Mod <number2>.
'''</summary>
Friend ReadOnly Property ModKeywordToolTip() As String
Get
Return ResourceManager.GetString("ModKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that an attribute at the beginning of a source file applies to the entire module. Otherwise the attribute will apply only to an individual programming element, such as a class or property..
'''</summary>
Friend ReadOnly Property ModuleKeywordToolTip() As String
Get
Return ResourceManager.GetString("ModuleKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to module.
'''</summary>
Friend ReadOnly Property ModuleStatement() As String
Get
Return ResourceManager.GetString("ModuleStatement", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Multiplies two numbers and returns the product..
'''</summary>
Friend ReadOnly Property MultiplicationKeywordToolTip() As String
Get
Return ResourceManager.GetString("MultiplicationKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that a class can be used only as a base class, and that you cannot create an object directly from it..
'''</summary>
Friend ReadOnly Property MustInheritKeywordToolTip() As String
Get
Return ResourceManager.GetString("MustInheritKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that a property or procedure is not implemented in the class and must be overridden in a derived class before it can be used..
'''</summary>
Friend ReadOnly Property MustOverrideKeywordToolTip() As String
Get
Return ResourceManager.GetString("MustOverrideKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Provides a way to refer to the base class of the current class instance. You cannot use MyBase to call MustOverride base methods..
'''</summary>
Friend ReadOnly Property MyBaseKeywordToolTip() As String
Get
Return ResourceManager.GetString("MyBaseKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Provides a way to refer to the class instance members as originally implemented, ignoring any derived class overrides..
'''</summary>
Friend ReadOnly Property MyClassKeywordToolTip() As String
Get
Return ResourceManager.GetString("MyClassKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Name can be simplified.
'''</summary>
Friend ReadOnly Property NameCanBeSimplified() As String
Get
Return ResourceManager.GetString("NameCanBeSimplified", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to NameOf function.
'''</summary>
Friend ReadOnly Property NameOfFunction() As String
Get
Return ResourceManager.GetString("NameOfFunction", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Declares the name of a namespace, and causes the source code following the declaration to be compiled within that namespace..
'''</summary>
Friend ReadOnly Property NamespaceKeywordToolTip() As String
Get
Return ResourceManager.GetString("NamespaceKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Indicates that a conversion operator (CType) converts a class or structure to a type that might not be able to hold some of the possible values of the original class or structure..
'''</summary>
Friend ReadOnly Property NarrowingKeywordToolTip() As String
Get
Return ResourceManager.GetString("NarrowingKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to <new field>.
'''</summary>
Friend ReadOnly Property NewField() As String
Get
Return ResourceManager.GetString("NewField", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Creates a new object instance..
'''</summary>
Friend ReadOnly Property NewKeywordToolTip() As String
Get
Return ResourceManager.GetString("NewKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to <new resource>.
'''</summary>
Friend ReadOnly Property NewResource() As String
Get
Return ResourceManager.GetString("NewResource", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to <new variable>.
'''</summary>
Friend ReadOnly Property NewVariable() As String
Get
Return ResourceManager.GetString("NewVariable", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Terminates a loop that iterates through the values of a loop variable..
'''</summary>
Friend ReadOnly Property NextKeywordToolTip() As String
Get
Return ResourceManager.GetString("NextKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to next statement control variable doesn't have matching declaration statement.
'''</summary>
Friend ReadOnly Property NextStatementControlVariable() As String
Get
Return ResourceManager.GetString("NextStatementControlVariable", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to No common root node for extraction.
'''</summary>
Friend ReadOnly Property NoCommonRootNodeForExtraction() As String
Get
Return ResourceManager.GetString("NoCommonRootNodeForExtraction", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Not all code paths return.
'''</summary>
Friend ReadOnly Property NotAllCodePathReturns() As String
Get
Return ResourceManager.GetString("NotAllCodePathReturns", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Compares two expressions and returns True if they are not equal. Otherwise, returns False..
'''</summary>
Friend ReadOnly Property NotEqualsKeywordToolTip() As String
Get
Return ResourceManager.GetString("NotEqualsKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Note: Space and '=' completion are disabled to avoid potential interference. To insert a name from the list, use tab..
'''</summary>
Friend ReadOnly Property NoteSpaceAndCompletion() As String
Get
Return ResourceManager.GetString("NoteSpaceAndCompletion", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Note: Space completion is disabled to avoid potential interference. To insert a name from the list, use tab..
'''</summary>
Friend ReadOnly Property NoteSpaceCompletionIsDisa() As String
Get
Return ResourceManager.GetString("NoteSpaceCompletionIsDisa", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Note: Use tab for automatic completion; space completion is disabled to avoid interfering with a new name..
'''</summary>
Friend ReadOnly Property NoteUseTabForAutomaticCo() As String
Get
Return ResourceManager.GetString("NoteUseTabForAutomaticCo", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Represents the default value of any data type..
'''</summary>
Friend ReadOnly Property NothingKeywordToolTip() As String
Get
Return ResourceManager.GetString("NothingKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that a class cannot be used as a base class..
'''</summary>
Friend ReadOnly Property NotInheritableKeywordToolTip() As String
Get
Return ResourceManager.GetString("NotInheritableKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Performs logical negation on a Boolean expression, or bitwise negation on a numeric expression.
'''<result> = Not <expression>.
'''</summary>
Friend ReadOnly Property NotKeywordToolTip() As String
Get
Return ResourceManager.GetString("NotKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that a property or procedure cannot be overridden in a derived class..
'''</summary>
Friend ReadOnly Property NotOverridableKeywordToolTip() As String
Get
Return ResourceManager.GetString("NotOverridableKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to No valid selection to perform extraction.
'''</summary>
Friend ReadOnly Property NoValidSelectionToPerform() As String
Get
Return ResourceManager.GetString("NoValidSelectionToPerform", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to no valid statement range to extract out.
'''</summary>
Friend ReadOnly Property NoValidStatementRangeToEx() As String
Get
Return ResourceManager.GetString("NoValidStatementRangeToEx", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Turns a compiler option off..
'''</summary>
Friend ReadOnly Property OffOptionKeywordToolTip() As String
Get
Return ResourceManager.GetString("OffOptionKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Identifies a type parameter on a generic class, structure, interface, delegate, or procedure..
'''</summary>
Friend ReadOnly Property OfKeywordToolTip() As String
Get
Return ResourceManager.GetString("OfKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Enables the error-handling routine that starts at the line specified in the line argument.
'''The specified line must be in the same procedure as the On Error statement.
'''On Error GoTo [<label> | 0 | -1].
'''</summary>
Friend ReadOnly Property OnErrorGotoKeywordToolTip() As String
Get
Return ResourceManager.GetString("OnErrorGotoKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to When a run-time error occurs, execution transfers to the statement following the statement or procedure call that resulted in the error..
'''</summary>
Friend ReadOnly Property OnErrorResumeNextKeywordToolTip() As String
Get
Return ResourceManager.GetString("OnErrorResumeNextKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to On Error statement.
'''</summary>
Friend ReadOnly Property OnErrorStatement() As String
Get
Return ResourceManager.GetString("OnErrorStatement", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Turns a compiler option on..
'''</summary>
Friend ReadOnly Property OnOptionKeywordToolTip() As String
Get
Return ResourceManager.GetString("OnOptionKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies the element keys used to correlate sequences for a join operation..
'''</summary>
Friend ReadOnly Property OnQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("OnQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Returns the result of explicitly converting an expression to a specified data type, object, structure, class, or interface.
'''CType(Object As Expression, Object As Type) As Type.
'''</summary>
Friend ReadOnly Property OperatorCTypeKeywordToolTip() As String
Get
Return ResourceManager.GetString("OperatorCTypeKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Declares the operator symbol, operands, and code that define an operator procedure on a class or structure..
'''</summary>
Friend ReadOnly Property OperatorKeywordToolTip() As String
Get
Return ResourceManager.GetString("OperatorKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that a procedure argument can be omitted when the procedure is called..
'''</summary>
Friend ReadOnly Property OptionalKeywordToolTip() As String
Get
Return ResourceManager.GetString("OptionalKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Introduces a statement that specifies a compiler option that applies to the entire source file..
'''</summary>
Friend ReadOnly Property OptionKeywordToolTip() As String
Get
Return ResourceManager.GetString("OptionKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to option.
'''</summary>
Friend ReadOnly Property OptionStatement() As String
Get
Return ResourceManager.GetString("OptionStatement", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies the sort order for columns in a query. Can be followed by either the Ascending or the Descending keyword. If neither is specified, Ascending is used..
'''</summary>
Friend ReadOnly Property OrderByQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("OrderByQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Ordering clause.
'''</summary>
Friend ReadOnly Property OrderingClause() As String
Get
Return ResourceManager.GetString("OrderingClause", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Performs short-circuit inclusive logical disjunction on two expressions. Returns True if either operand evaluates to True. If the first expression evaluates to True, the second expression is not evaluated.
'''<result> = <expression1> OrElse <expression2>.
'''</summary>
Friend ReadOnly Property OrElseKeywordToolTip() As String
Get
Return ResourceManager.GetString("OrElseKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Organize Imports.
'''</summary>
Friend ReadOnly Property OrganizeImports() As String
Get
Return ResourceManager.GetString("OrganizeImports", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to &Organize Imports.
'''</summary>
Friend ReadOnly Property OrganizeImportsWithAccelerator() As String
Get
Return ResourceManager.GetString("OrganizeImportsWithAccelerator", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Performs an inclusive logical disjunction on two Boolean expressions, or a bitwise disjunction on two numeric expressions. For Boolean expressions, returns True if at least one operand evaluates to True. Both expressions are always evaluated.
'''<result> = <expression1> Or <expression2>.
'''</summary>
Friend ReadOnly Property OrKeywordToolTip() As String
Get
Return ResourceManager.GetString("OrKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that a property or procedure re-declares one or more existing properties or procedures with the same name..
'''</summary>
Friend ReadOnly Property OverloadsKeywordToolTip() As String
Get
Return ResourceManager.GetString("OverloadsKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that a property or procedure can be overridden by an identically named property or procedure in a derived class..
'''</summary>
Friend ReadOnly Property OverridableKeywordToolTip() As String
Get
Return ResourceManager.GetString("OverridableKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to TODO: override Finalize() only if Dispose(disposing As Boolean) above has code to free unmanaged resources..
'''</summary>
Friend ReadOnly Property OverrideFinalizerTodo() As String
Get
Return ResourceManager.GetString("OverrideFinalizerTodo", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that a property or procedure overrides an identically named property or procedure inherited from a base class..
'''</summary>
Friend ReadOnly Property OverridesKeywordToolTip() As String
Get
Return ResourceManager.GetString("OverridesKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that a procedure parameter takes an optional array of elements of the specified type..
'''</summary>
Friend ReadOnly Property ParamArrayKeywordToolTip() As String
Get
Return ResourceManager.GetString("ParamArrayKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to parameters.
'''</summary>
Friend ReadOnly Property ParameterList() As String
Get
Return ResourceManager.GetString("ParameterList", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to <parameter name>.
'''</summary>
Friend ReadOnly Property ParameterName() As String
Get
Return ResourceManager.GetString("ParameterName", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Indicates that a method, class, or structure declaration is a partial definition of the method, class, or structure..
'''</summary>
Friend ReadOnly Property PartialKeywordToolTip() As String
Get
Return ResourceManager.GetString("PartialKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Returns the sum of two numbers, or the positive value of a numeric expression..
'''</summary>
Friend ReadOnly Property PlusKeywordToolTip() As String
Get
Return ResourceManager.GetString("PlusKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Prevents the contents of an array from being cleared when the dimensions of the array are changed..
'''</summary>
Friend ReadOnly Property PreserveKeywordToolTip() As String
Get
Return ResourceManager.GetString("PreserveKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that one or more declared programming elements are accessible only from within their module, class, or structure..
'''</summary>
Friend ReadOnly Property PrivateKeywordToolTip() As String
Get
Return ResourceManager.GetString("PrivateKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to property accessor.
'''</summary>
Friend ReadOnly Property PropertyAccessor() As String
Get
Return ResourceManager.GetString("PropertyAccessor", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Declares the name of a property, and the property procedures used to store and retrieve the value of the property..
'''</summary>
Friend ReadOnly Property PropertyKeywordToolTip() As String
Get
Return ResourceManager.GetString("PropertyKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that one or more declared members of a class are accessible from anywhere in the same assembly, their own classes, and derived classes..
'''</summary>
Friend ReadOnly Property ProtectedFriendKeywordToolTip() As String
Get
Return ResourceManager.GetString("ProtectedFriendKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that one or more declared programming elements are accessible only from within their own class or from a derived class..
'''</summary>
Friend ReadOnly Property ProtectedKeywordToolTip() As String
Get
Return ResourceManager.GetString("ProtectedKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that one or more declared programming elements have no access restrictions..
'''</summary>
Friend ReadOnly Property PublicKeywordToolTip() As String
Get
Return ResourceManager.GetString("PublicKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies the statements to run when the event is raised by the RaiseEvent statement.
'''RaiseEvent(<delegateSignature>)...End RaiseEvent.
'''</summary>
Friend ReadOnly Property RaiseEventKeywordToolTip() As String
Get
Return ResourceManager.GetString("RaiseEventKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Triggers an event declared at module level within a class, form, or document.
'''RaiseEvent <eventName> [(<argumentList>)].
'''</summary>
Friend ReadOnly Property RaiseEventStatementToolTip() As String
Get
Return ResourceManager.GetString("RaiseEventStatementToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that a variable or property can be read but not written to..
'''</summary>
Friend ReadOnly Property ReadOnlyKeywordToolTip() As String
Get
Return ResourceManager.GetString("ReadOnlyKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Reallocates storage space for an array variable..
'''</summary>
Friend ReadOnly Property ReDimKeywordToolTip() As String
Get
Return ResourceManager.GetString("ReDimKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Collapses and hides sections of code in Visual Basic files..
'''</summary>
Friend ReadOnly Property RegionKeywordToolTip() As String
Get
Return ResourceManager.GetString("RegionKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Remove &and Sort Imports.
'''</summary>
Friend ReadOnly Property RemoveAndSortImportsWithAccelerator() As String
Get
Return ResourceManager.GetString("RemoveAndSortImportsWithAccelerator", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to RemoveHandler statement.
'''</summary>
Friend ReadOnly Property RemovehandlerStatement() As String
Get
Return ResourceManager.GetString("RemovehandlerStatement", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Remove Unnecessary Cast.
'''</summary>
Friend ReadOnly Property RemoveUnnecessaryCast() As String
Get
Return ResourceManager.GetString("RemoveUnnecessaryCast", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Remove Unnecessary Imports.
'''</summary>
Friend ReadOnly Property RemoveUnnecessaryImports() As String
Get
Return ResourceManager.GetString("RemoveUnnecessaryImports", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Imports statement is unnecessary..
'''</summary>
Friend ReadOnly Property RemoveUnnecessaryImportsDiagnosticTitle() As String
Get
Return ResourceManager.GetString("RemoveUnnecessaryImportsDiagnosticTitle", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to &Remove Unnecessary Imports.
'''</summary>
Friend ReadOnly Property RemoveUnnecessaryImportsWithAccelerator() As String
Get
Return ResourceManager.GetString("RemoveUnnecessaryImportsWithAccelerator", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Replace 'Return' with 'Yield.
'''</summary>
Friend ReadOnly Property ReplaceReturnWithYield() As String
Get
Return ResourceManager.GetString("ReplaceReturnWithYield", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to <result alias>.
'''</summary>
Friend ReadOnly Property ResultAlias() As String
Get
Return ResourceManager.GetString("ResultAlias", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Resume statement.
'''</summary>
Friend ReadOnly Property ResumeStatement() As String
Get
Return ResourceManager.GetString("ResumeStatement", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Returns execution to the code that called the Function, Sub, Get, Set, or Operator procedure.
'''Return -or- Return <expression>.
'''</summary>
Friend ReadOnly Property ReturnKeywordToolTip() As String
Get
Return ResourceManager.GetString("ReturnKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Performs an arithmetic right shift on a bit pattern.
'''</summary>
Friend ReadOnly Property RightShiftKeywordToolTip() As String
Get
Return ResourceManager.GetString("RightShiftKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Select clause.
'''</summary>
Friend ReadOnly Property SelectClause() As String
Get
Return ResourceManager.GetString("SelectClause", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Selection can't be crossed over preprocessors.
'''</summary>
Friend ReadOnly Property SelectionCantBeCrossedOve() As String
Get
Return ResourceManager.GetString("SelectionCantBeCrossedOve", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Selection can't be parts of constant initializer expression.
'''</summary>
Friend ReadOnly Property SelectionCantBePartsOfCo() As String
Get
Return ResourceManager.GetString("SelectionCantBePartsOfCo", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Selection can't contain throw without enclosing catch block.
'''</summary>
Friend ReadOnly Property SelectionCantContainThrow() As String
Get
Return ResourceManager.GetString("SelectionCantContainThrow", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Selection doesn't contain any valid node.
'''</summary>
Friend ReadOnly Property SelectionDoesntContainAny() As String
Get
Return ResourceManager.GetString("SelectionDoesntContainAny", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Selection doesn't contain any valid token.
'''</summary>
Friend ReadOnly Property SelectionDoesntContainAny0() As String
Get
Return ResourceManager.GetString("SelectionDoesntContainAny0", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Selection must be part of executable statements.
'''</summary>
Friend ReadOnly Property SelectionMustBePartOfExec() As String
Get
Return ResourceManager.GetString("SelectionMustBePartOfExec", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Runs one of several groups of statements, depending on the value of an expression..
'''</summary>
Friend ReadOnly Property SelectKeywordToolTip() As String
Get
Return ResourceManager.GetString("SelectKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies which columns to include in the result of a query..
'''</summary>
Friend ReadOnly Property SelectQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("SelectQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Declares a Set property procedure that is used to assign a value to a property..
'''</summary>
Friend ReadOnly Property SetPropertyKeywordToolTip() As String
Get
Return ResourceManager.GetString("SetPropertyKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that a declared programming element redeclares and hides an identically named element in a base class..
'''</summary>
Friend ReadOnly Property ShadowsKeywordToolTip() As String
Get
Return ResourceManager.GetString("ShadowsKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that one or more declared programming elements are associated with all instances of a class or structure..
'''</summary>
Friend ReadOnly Property SharedKeywordToolTip() As String
Get
Return ResourceManager.GetString("SharedKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Join clause.
'''</summary>
Friend ReadOnly Property SimpleJoinClause() As String
Get
Return ResourceManager.GetString("SimpleJoinClause", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Simplify member access '{0}'.
'''</summary>
Friend ReadOnly Property SimplifyMemberAccess() As String
Get
Return ResourceManager.GetString("SimplifyMemberAccess", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Remove 'Me' qualification.
'''</summary>
Friend ReadOnly Property SimplifyMeQualification() As String
Get
Return ResourceManager.GetString("SimplifyMeQualification", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Simplify name '{0}'.
'''</summary>
Friend ReadOnly Property SimplifyName() As String
Get
Return ResourceManager.GetString("SimplifyName", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Skips elements up to a specified position in the collection..
'''</summary>
Friend ReadOnly Property SkipQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("SkipQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Skip While clause.
'''</summary>
Friend ReadOnly Property SkipWhileClause() As String
Get
Return ResourceManager.GetString("SkipWhileClause", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to &Sort Imports.
'''</summary>
Friend ReadOnly Property SortImportsWithAccelerator() As String
Get
Return ResourceManager.GetString("SortImportsWithAccelerator", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that one or more declared local variables are to remain in existence and retain their latest values after the procedure in which they are declared terminates..
'''</summary>
Friend ReadOnly Property StaticKeywordToolTip() As String
Get
Return ResourceManager.GetString("StaticKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies how much to increment between each loop iteration..
'''</summary>
Friend ReadOnly Property StepKeywordToolTip() As String
Get
Return ResourceManager.GetString("StepKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Suspends program execution..
'''</summary>
Friend ReadOnly Property StopKeywordToolTip() As String
Get
Return ResourceManager.GetString("StopKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to When set to On, restricts implicit data type conversions to only widening conversions.
'''Option Strict {On | Off}.
'''</summary>
Friend ReadOnly Property StrictKeywordToolTip() As String
Get
Return ResourceManager.GetString("StrictKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Declares the name of a structure and introduces the definition of the variables, properties, events, and procedures that make up the structure..
'''</summary>
Friend ReadOnly Property StructureKeywordToolTip() As String
Get
Return ResourceManager.GetString("StructureKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to structure.
'''</summary>
Friend ReadOnly Property StructureStatement() As String
Get
Return ResourceManager.GetString("StructureStatement", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Declares the name, parameters, and code that define a Sub procedure, that is, a procedure that does not return a value to the calling code..
'''</summary>
Friend ReadOnly Property SubKeywordToolTip() As String
Get
Return ResourceManager.GetString("SubKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Defines a lambda expression that can execute statements and does not return a value. Can be used wherever a delegate type is expected.
'''Sub(<parameterList>) <statement>.
'''</summary>
Friend ReadOnly Property SubLambdaKeywordToolTip() As String
Get
Return ResourceManager.GetString("SubLambdaKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to SyncLock block.
'''</summary>
Friend ReadOnly Property SyncLockBlock() As String
Get
Return ResourceManager.GetString("SyncLockBlock", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Ensures that multiple threads do not execute the statement block at the same time.
'''SyncLock <object>...End Synclock.
'''</summary>
Friend ReadOnly Property SyncLockKeywordToolTip() As String
Get
Return ResourceManager.GetString("SyncLockKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to SyncLock statement.
'''</summary>
Friend ReadOnly Property SyncLockStatement() As String
Get
Return ResourceManager.GetString("SyncLockStatement", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Includes elements up to a specified position in the collection..
'''</summary>
Friend ReadOnly Property TakeQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("TakeQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Take While clause.
'''</summary>
Friend ReadOnly Property TakeWhileClause() As String
Get
Return ResourceManager.GetString("TakeWhileClause", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Sets the string comparison method specified in Option Compare to a text sort order that is not case sensitive..
'''</summary>
Friend ReadOnly Property TextKeywordToolTip() As String
Get
Return ResourceManager.GetString("TextKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Introduces a statement block to be compiled or executed if a tested condition is true..
'''</summary>
Friend ReadOnly Property ThenKeywordToolTip() As String
Get
Return ResourceManager.GetString("ThenKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to the selection contains syntactic errors.
'''</summary>
Friend ReadOnly Property TheSelectionContainsSyntact() As String
Get
Return ResourceManager.GetString("TheSelectionContainsSyntact", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to This code added by Visual Basic to correctly implement the disposable pattern..
'''</summary>
Friend ReadOnly Property ThisCodeAddedToCorrectlyImplementDisposable() As String
Get
Return ResourceManager.GetString("ThisCodeAddedToCorrectlyImplementDisposable", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Throws an exception within a procedure so that you can handle it with structured or unstructured exception-handling code..
'''</summary>
Friend ReadOnly Property ThrowKeywordToolTip() As String
Get
Return ResourceManager.GetString("ThrowKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Separates the beginning and ending values of a loop counter or array bounds or that of a value match range..
'''</summary>
Friend ReadOnly Property ToKeywordToolTip() As String
Get
Return ResourceManager.GetString("ToKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Represents a Boolean value that passes a conditional test..
'''</summary>
Friend ReadOnly Property TrueKeywordToolTip() As String
Get
Return ResourceManager.GetString("TrueKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Try block.
'''</summary>
Friend ReadOnly Property TryBlock() As String
Get
Return ResourceManager.GetString("TryBlock", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to TryCast function.
'''</summary>
Friend ReadOnly Property TrycastFunction() As String
Get
Return ResourceManager.GetString("TrycastFunction", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Provides a way to handle some or all possible errors that might occur in a given block of code, while still running the code.
'''Try...[Catch]...{Catch | Finally}...End Try.
'''</summary>
Friend ReadOnly Property TryKeywordToolTip() As String
Get
Return ResourceManager.GetString("TryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Type a name here to declare a new field..
'''</summary>
Friend ReadOnly Property TypeANameHereToDeclareA() As String
Get
Return ResourceManager.GetString("TypeANameHereToDeclareA", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Type a name here to declare a parameter. If no preceding keyword is used; 'ByVal' will be assumed and the argument will be passed by value..
'''</summary>
Friend ReadOnly Property TypeANameHereToDeclareA0() As String
Get
Return ResourceManager.GetString("TypeANameHereToDeclareA0", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Type a new name for the column, followed by '='. Otherwise, the original column name with be used..
'''</summary>
Friend ReadOnly Property TypeANewNameForTheColumn() As String
Get
Return ResourceManager.GetString("TypeANewNameForTheColumn", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Type a new variable name.
'''</summary>
Friend ReadOnly Property TypeANewVariableName() As String
Get
Return ResourceManager.GetString("TypeANewVariableName", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Determines the run-time type of an object reference variable and compares it to a data type. Returns True or False depending, on whether the two types are compatible.
'''<result> = TypeOf <objectExpression> Is <typeName>.
'''</summary>
Friend ReadOnly Property TypeOfKeywordToolTip() As String
Get
Return ResourceManager.GetString("TypeOfKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to type parameters.
'''</summary>
Friend ReadOnly Property TypeParameterList() As String
Get
Return ResourceManager.GetString("TypeParameterList", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to TODO: uncomment the following line if Finalize() is overridden above..
'''</summary>
Friend ReadOnly Property UncommentTheFollowingLineIfFinalizeIsOverridden() As String
Get
Return ResourceManager.GetString("UncommentTheFollowingLineIfFinalizeIsOverridden", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Used in a Declare statement. Specifies that Visual Basic should marshal all strings to Unicode values in a call into an external procedure, and should look up the procedure without modifying its name..
'''</summary>
Friend ReadOnly Property UnicodeKeywordToolTip() As String
Get
Return ResourceManager.GetString("UnicodeKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Using block.
'''</summary>
Friend ReadOnly Property UsingBlock() As String
Get
Return ResourceManager.GetString("UsingBlock", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to A Using block does three things: it creates and initializes variables in the resource list, it runs the code in the block, and it disposes of the variables before exiting. Resources used in the Using block must implement System.IDisposable.
'''Using <resource1>[, <resource2>]...End Using.
'''</summary>
Friend ReadOnly Property UsingKeywordToolTip() As String
Get
Return ResourceManager.GetString("UsingKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Using statement.
'''</summary>
Friend ReadOnly Property UsingStatement() As String
Get
Return ResourceManager.GetString("UsingStatement", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Adds a conditional test to a Catch statement. Exceptions are caught by that Catch statement only when the conditional test that follows the When keyword evaluates to True..
'''</summary>
Friend ReadOnly Property WhenKeywordToolTip() As String
Get
Return ResourceManager.GetString("WhenKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Where clause.
'''</summary>
Friend ReadOnly Property WhereClause() As String
Get
Return ResourceManager.GetString("WhereClause", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies the filtering condition for a range variable in a query..
'''</summary>
Friend ReadOnly Property WhereQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("WhereQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Runs a series of statements as long as a given condition is true..
'''</summary>
Friend ReadOnly Property WhileKeywordToolTip() As String
Get
Return ResourceManager.GetString("WhileKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies a condition for Skip and Take operations. Elements will be bypassed or included as long as the condition is true..
'''</summary>
Friend ReadOnly Property WhileQueryKeywordToolTip() As String
Get
Return ResourceManager.GetString("WhileQueryKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Indicates that a conversion operator (CType) converts a class or structure to a type that can hold all possible values of the original class or structure..
'''</summary>
Friend ReadOnly Property WideningKeywordToolTip() As String
Get
Return ResourceManager.GetString("WideningKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to With block.
'''</summary>
Friend ReadOnly Property WithBlock() As String
Get
Return ResourceManager.GetString("WithBlock", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to WithEvents field.
'''</summary>
Friend ReadOnly Property WithEventsFieldStatement() As String
Get
Return ResourceManager.GetString("WithEventsFieldStatement", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that one or more declared member variables refer to an instance of a class that can raise events.
'''</summary>
Friend ReadOnly Property WithEventsKeywordToolTip() As String
Get
Return ResourceManager.GetString("WithEventsKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies the declaration of property initializations in an object initializer.
'''New <typeName> With {[.<property> = <expression>][,...]}.
'''</summary>
Friend ReadOnly Property WithInitializerKeywordToolTip() As String
Get
Return ResourceManager.GetString("WithInitializerKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Runs a series of statements that refer to a single object or structure.
'''With <object>...End With.
'''</summary>
Friend ReadOnly Property WithKeywordToolTip() As String
Get
Return ResourceManager.GetString("WithKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to With statement.
'''</summary>
Friend ReadOnly Property WithStatement() As String
Get
Return ResourceManager.GetString("WithStatement", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifies that a property can be written to but not read..
'''</summary>
Friend ReadOnly Property WriteOnlyKeywordToolTip() As String
Get
Return ResourceManager.GetString("WriteOnlyKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Performs a logical exclusion on two Boolean expressions, or a bitwise exclusion on two numeric expressions. For Boolean expressions, returns True if exactly one of the expressions evaluates to True. Both expressions are always evaluated.
'''<result> = <expression1> Xor <expression2>.
'''</summary>
Friend ReadOnly Property XorKeywordToolTip() As String
Get
Return ResourceManager.GetString("XorKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Produces an element of an IEnumerable or IEnumerator..
'''</summary>
Friend ReadOnly Property YieldKeywordToolTip() As String
Get
Return ResourceManager.GetString("YieldKeywordToolTip", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Yield statement.
'''</summary>
Friend ReadOnly Property YieldStatement() As String
Get
Return ResourceManager.GetString("YieldStatement", resourceCulture)
End Get
End Property
End Module
End Namespace
|
MihaMarkic/roslyn-prank
|
src/Features/VisualBasic/Portable/VBFeaturesResources.Designer.vb
|
Visual Basic
|
apache-2.0
| 137,800
|
' 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.Runtime.CompilerServices
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Roslyn.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator
Friend Module LocalSymbolExtensions
<Extension>
Friend Function ToOtherMethod(local As LocalSymbol, method As MethodSymbol, typeMap As TypeSubstitution) As LocalSymbol
Dim l = TryCast(local, EELocalSymbolBase)
If l IsNot Nothing Then
Return l.ToOtherMethod(method, typeMap)
End If
Dim type = typeMap.SubstituteType(local.Type)
Return New EELocalSymbol(method, local.Locations, local.Name, -1, local.DeclarationKind, type, local.IsByRef, local.IsPinned, local.CanScheduleToStack)
End Function
End Module
Friend MustInherit Class EELocalSymbolBase
Inherits LocalSymbol
Friend Shared ReadOnly NoLocations As ImmutableArray(Of Location) = ImmutableArray.Create(NoLocation.Singleton)
Friend Sub New(container As Symbol, type As TypeSymbol)
MyBase.New(container, type)
End Sub
Friend Overrides ReadOnly Property IsImportedFromMetadata As Boolean
Get
Return True
End Get
End Property
Friend Overrides Function GetDeclaratorSyntax() As SyntaxNode
Throw ExceptionUtilities.Unreachable
End Function
Friend MustOverride Function ToOtherMethod(method As MethodSymbol, typeMap As TypeSubstitution) As EELocalSymbolBase
Friend NotOverridable Overrides ReadOnly Property SynthesizedKind As SynthesizedLocalKind
Get
Return SynthesizedLocalKind.UserDefined
End Get
End Property
Public NotOverridable Overrides ReadOnly Property IsFunctionValue As Boolean
Get
Return DeclarationKind = LocalDeclarationKind.FunctionValue
End Get
End Property
Friend NotOverridable Overrides Function GetUseSiteErrorInfo() As DiagnosticInfo
Dim localType As TypeSymbol = Me.Type
Dim info As DiagnosticInfo = DeriveUseSiteErrorInfoFromType(localType)
If info IsNot Nothing Then
Return info
End If
If Me.ContainingModule.HasUnifiedReferences Then
' If the member is in an assembly with unified references,
' we check if its definition depends on a type from a unified reference.
Dim unificationCheckedTypes As HashSet(Of TypeSymbol) = Nothing
Return localType.GetUnificationUseSiteDiagnosticRecursive(Me, unificationCheckedTypes)
End If
Return Nothing
End Function
End Class
End Namespace
|
jmarolf/roslyn
|
src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/Symbols/EELocalSymbolBase.vb
|
Visual Basic
|
mit
| 3,031
|
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.CodeActions
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.Formatting
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports System.Collections.Immutable
Imports System.Threading
Namespace Design
<ExportCodeFixProvider(LanguageNames.VisualBasic, Name:=NameOf(EmptyCatchBlockCodeFixProvider)), Composition.Shared>
Public Class EmptyCatchBlockCodeFixProvider
Inherits CodeFixProvider
Public Overrides NotOverridable ReadOnly Property FixableDiagnosticIds As ImmutableArray(Of String) = ImmutableArray.Create(DiagnosticId.EmptyCatchBlock.ToDiagnosticId())
Public Overrides Function GetFixAllProvider() As FixAllProvider
Return WellKnownFixAllProviders.BatchFixer
End Function
Public Overrides Async Function RegisterCodeFixesAsync(context As CodeFixContext) As Task
Dim root = Await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(False)
Dim diag = context.Diagnostics.First
Dim diagSpan = diag.Location.SourceSpan
Dim declaration = root.FindToken(diagSpan.Start).Parent.AncestorsAndSelf.OfType(Of CatchBlockSyntax).First
context.RegisterCodeFix(CodeAction.Create("Remove Empty Catch Block", Function(c) RemoveTry(context.Document, declaration, c), NameOf(EmptyCatchBlockCodeFixProvider) & NameOf(RemoveTry)), diag)
context.RegisterCodeFix(CodeAction.Create("Insert Exception class to Catch", Function(c) InsertExceptionClassCommentAsync(context.Document, declaration, c), NameOf(EmptyCatchBlockCodeFixProvider) & NameOf(InsertExceptionClassCommentAsync)), diag)
End Function
Private Async Function RemoveTry(document As Document, catchBlock As CatchBlockSyntax, cancellationToken As CancellationToken) As Task(Of Document)
Dim tryBlock = DirectCast(catchBlock.Parent, TryBlockSyntax)
Dim statements = tryBlock.Statements
Dim root = Await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False)
Dim newRoot = root.ReplaceNode(catchBlock.Parent,
statements.Select(Function(s) s.
WithLeadingTrivia(catchBlock.Parent.GetLeadingTrivia()).
WithTrailingTrivia(catchBlock.Parent.GetTrailingTrivia())))
Dim newDocument = document.WithSyntaxRoot(newRoot)
Return newDocument
End Function
Private Async Function InsertExceptionClassCommentAsync(document As Document, catchBlock As CatchBlockSyntax, cancellationToken As CancellationToken) As Task(Of Document)
Dim statements = New SyntaxList(Of SyntaxNode)().Add(SyntaxFactory.ThrowStatement())
Dim catchStatement = SyntaxFactory.CatchStatement(
SyntaxFactory.IdentifierName("ex"),
SyntaxFactory.SimpleAsClause(SyntaxFactory.IdentifierName(NameOf(Exception))),
Nothing)
Dim catchClause = SyntaxFactory.CatchBlock(catchStatement, statements).
WithLeadingTrivia(catchBlock.GetLeadingTrivia).
WithTrailingTrivia(catchBlock.GetTrailingTrivia).
WithAdditionalAnnotations(Formatter.Annotation)
Dim root = Await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False)
Dim newRoot = root.ReplaceNode(catchBlock, catchClause)
Dim newDocument = document.WithSyntaxRoot(newRoot)
Return newDocument
End Function
End Class
End Namespace
|
dmgandini/code-cracker
|
src/VisualBasic/CodeCracker/Design/EmptyCatchBlockCodeFixProvider.vb
|
Visual Basic
|
apache-2.0
| 3,695
|
' 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.Diagnostics
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols.Metadata.PE
Friend NotInheritable Class SymbolFactory
Inherits SymbolFactory(Of PEModuleSymbol, TypeSymbol)
Friend Shared ReadOnly Instance As New SymbolFactory()
Friend Overrides Function GetMDArrayTypeSymbol(
moduleSymbol As PEModuleSymbol,
rank As Integer,
elementType As TypeSymbol,
customModifiers As ImmutableArray(Of ModifierInfo(Of TypeSymbol)),
sizes As ImmutableArray(Of Integer),
lowerBounds As ImmutableArray(Of Integer)
) As TypeSymbol
If TypeOf elementType Is UnsupportedMetadataTypeSymbol Then
Return elementType
End If
Return ArrayTypeSymbol.CreateMDArray(
elementType,
VisualBasicCustomModifier.Convert(customModifiers),
rank, sizes, lowerBounds, moduleSymbol.ContainingAssembly)
End Function
Friend Overrides Function GetSpecialType(moduleSymbol As PEModuleSymbol, specialType As SpecialType) As TypeSymbol
Return moduleSymbol.ContainingAssembly.GetSpecialType(specialType)
End Function
Friend Overrides Function GetSystemTypeSymbol(moduleSymbol As PEModuleSymbol) As TypeSymbol
Return moduleSymbol.SystemTypeSymbol
End Function
Friend Overrides Function GetEnumUnderlyingType(moduleSymbol As PEModuleSymbol, type As TypeSymbol) As TypeSymbol
Return type.GetEnumUnderlyingType()
End Function
Friend Overrides Function GetPrimitiveTypeCode(moduleSymbol As PEModuleSymbol, type As TypeSymbol) As Microsoft.Cci.PrimitiveTypeCode
Return type.PrimitiveTypeCode
End Function
Friend Overrides Function IsVolatileModifierType(moduleSymbol As PEModuleSymbol, type As TypeSymbol) As Boolean
' VB doesn't deal with Volatile fields.
Return False
End Function
Friend Overrides Function GetSZArrayTypeSymbol(moduleSymbol As PEModuleSymbol, elementType As TypeSymbol, customModifiers As ImmutableArray(Of ModifierInfo(Of TypeSymbol))) As TypeSymbol
If TypeOf elementType Is UnsupportedMetadataTypeSymbol Then
Return elementType
End If
Return ArrayTypeSymbol.CreateSZArray(
elementType,
VisualBasicCustomModifier.Convert(customModifiers),
moduleSymbol.ContainingAssembly)
End Function
Friend Overrides Function GetUnsupportedMetadataTypeSymbol(moduleSymbol As PEModuleSymbol, exception As BadImageFormatException) As TypeSymbol
Return New UnsupportedMetadataTypeSymbol(exception)
End Function
Friend Overrides Function MakePointerTypeSymbol(moduleSymbol As PEModuleSymbol, type As TypeSymbol, customModifiers As ImmutableArray(Of ModifierInfo(Of TypeSymbol))) As TypeSymbol
Return New PointerTypeSymbol(type, VisualBasicCustomModifier.Convert(customModifiers))
End Function
Friend Overrides Function SubstituteTypeParameters(
moduleSymbol As PEModuleSymbol,
genericTypeDef As TypeSymbol,
arguments As ImmutableArray(Of KeyValuePair(Of TypeSymbol, ImmutableArray(Of ModifierInfo(Of TypeSymbol)))),
refersToNoPiaLocalType As ImmutableArray(Of Boolean)
) As TypeSymbol
If TypeOf genericTypeDef Is UnsupportedMetadataTypeSymbol Then
Return genericTypeDef
End If
' Let's return unsupported metadata type if any argument is unsupported metadata type
For Each arg In arguments
If arg.Key.Kind = SymbolKind.ErrorType AndAlso
TypeOf arg.Key Is UnsupportedMetadataTypeSymbol Then
Return New UnsupportedMetadataTypeSymbol()
End If
Next
Dim genericType As NamedTypeSymbol = DirectCast(genericTypeDef, NamedTypeSymbol)
' See if it is or its enclosing type is a non-interface closed over NoPia local types.
Dim linkedAssemblies As ImmutableArray(Of AssemblySymbol) = moduleSymbol.ContainingAssembly.GetLinkedReferencedAssemblies()
Dim noPiaIllegalGenericInstantiation As Boolean = False
If Not linkedAssemblies.IsDefaultOrEmpty OrElse moduleSymbol.Module.ContainsNoPiaLocalTypes() Then
Dim typeToCheck As NamedTypeSymbol = genericType
Dim argumentIndex As Integer = refersToNoPiaLocalType.Length - 1
Do
If Not typeToCheck.IsInterface Then
Exit Do
Else
argumentIndex -= typeToCheck.Arity
End If
typeToCheck = typeToCheck.ContainingType
Loop While typeToCheck IsNot Nothing
For i As Integer = argumentIndex To 0 Step -1
If refersToNoPiaLocalType(i) OrElse
(Not linkedAssemblies.IsDefaultOrEmpty AndAlso
MetadataDecoder.IsOrClosedOverATypeFromAssemblies(arguments(i).Key, linkedAssemblies)) Then
noPiaIllegalGenericInstantiation = True
Exit For
End If
Next
End If
' Collect generic parameters for the type and its containers in the order
' that matches passed in arguments, i.e. sorted by the nesting.
Dim genericParameters = genericType.GetAllTypeParameters()
Debug.Assert(genericParameters.Length > 0)
If genericParameters.Length <> arguments.Length Then
Return New UnsupportedMetadataTypeSymbol()
End If
Dim substitution As TypeSubstitution = TypeSubstitution.Create(genericTypeDef, genericParameters,
arguments.SelectAsArray(Function(pair) New TypeWithModifiers(pair.Key, VisualBasicCustomModifier.Convert(pair.Value))))
If substitution Is Nothing Then
Return genericTypeDef
End If
Dim constructedType = genericType.Construct(substitution)
If noPiaIllegalGenericInstantiation Then
constructedType = New NoPiaIllegalGenericInstantiationSymbol(constructedType)
End If
Return DirectCast(constructedType, TypeSymbol)
End Function
Friend Overrides Function MakeUnboundIfGeneric(moduleSymbol As PEModuleSymbol, type As TypeSymbol) As TypeSymbol
Dim namedType = TryCast(type, NamedTypeSymbol)
Return If(namedType IsNot Nothing AndAlso namedType.IsGenericType, UnboundGenericType.Create(namedType), type)
End Function
End Class
End Namespace
|
bbarry/roslyn
|
src/Compilers/VisualBasic/Portable/Symbols/Metadata/PE/SymbolFactory.vb
|
Visual Basic
|
apache-2.0
| 7,237
|
' 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.Runtime.CompilerServices
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Extensions
Partial Friend Module MemberAccessExpressionSyntaxExtensions
<Extension()>
Public Function IsConstructorInitializer(memberAccess As MemberAccessExpressionSyntax) As Boolean
Return memberAccess.IsThisConstructorInitializer() OrElse memberAccess.IsBaseConstructorInitializer()
End Function
<Extension()>
Public Function IsThisConstructorInitializer(memberAccess As MemberAccessExpressionSyntax) As Boolean
If memberAccess IsNot Nothing Then
If IsFirstStatementInConstructor(memberAccess) Then
If memberAccess.Expression.IsKind(SyntaxKind.MeExpression) OrElse
memberAccess.Expression.IsKind(SyntaxKind.MyClassExpression) Then
If memberAccess.Name.IsKind(SyntaxKind.IdentifierName) Then
Return memberAccess.Name.Identifier.HasMatchingText(SyntaxKind.NewKeyword)
End If
End If
End If
End If
Return False
End Function
<Extension()>
Public Function IsBaseConstructorInitializer(memberAccess As MemberAccessExpressionSyntax) As Boolean
If memberAccess IsNot Nothing Then
If IsFirstStatementInConstructor(memberAccess) Then
If memberAccess.Expression.IsKind(SyntaxKind.MyBaseExpression) Then
If memberAccess.Name.IsKind(SyntaxKind.IdentifierName) Then
Return memberAccess.Name.Identifier.HasMatchingText(SyntaxKind.NewKeyword)
End If
End If
End If
End If
Return False
End Function
Private Function IsFirstStatementInConstructor(memberAccess As MemberAccessExpressionSyntax) As Boolean
Dim isCall As Boolean
Dim statement As SyntaxNode
If TypeOf memberAccess.Parent Is InvocationExpressionSyntax Then
statement = memberAccess.Parent.Parent
isCall = statement IsNot Nothing AndAlso (statement.Kind = SyntaxKind.CallStatement OrElse statement.Kind = SyntaxKind.ExpressionStatement)
Else
statement = memberAccess.Parent
isCall = statement.IsKind(SyntaxKind.CallStatement)
End If
If isCall Then
Return statement.IsParentKind(SyntaxKind.ConstructorBlock) AndAlso
DirectCast(statement.Parent, ConstructorBlockSyntax).Statements.First() Is statement
End If
Return False
End Function
<Extension>
Public Function GetExpressionOfMemberAccessExpression(
memberAccessExpression As MemberAccessExpressionSyntax,
Optional allowImplicitTarget As Boolean = False) As ExpressionSyntax
If memberAccessExpression Is Nothing Then
Return Nothing
End If
If memberAccessExpression.Expression IsNot Nothing Then
Return memberAccessExpression.Expression
End If
' we have a member access expression with a null expression, this may be one of the
' following forms:
'
' 1) new With { .a = 1, .b = .a <-- .a refers to the anonymous type
' 2) With obj : .m <-- .m refers to the obj type
' 3) new T() With { .a = 1, .b = .a <-- 'a refers to the T type
If allowImplicitTarget Then
Dim conditional = memberAccessExpression.GetRootConditionalAccessExpression()
If conditional IsNot Nothing Then
If conditional.Expression Is Nothing Then
' No expression, maybe we're in a with block
Dim withBlock = conditional.GetAncestor(Of WithBlockSyntax)()
If withBlock IsNot Nothing Then
Return withBlock.WithStatement.Expression
End If
End If
Return conditional.Expression
End If
Dim current As SyntaxNode = memberAccessExpression
While current IsNot Nothing
If TypeOf current Is AnonymousObjectCreationExpressionSyntax Then
Return DirectCast(current, ExpressionSyntax)
ElseIf TypeOf current Is WithBlockSyntax Then
Dim withBlock = DirectCast(current, WithBlockSyntax)
If memberAccessExpression IsNot withBlock.WithStatement.Expression Then
Return withBlock.WithStatement.Expression
End If
ElseIf TypeOf current Is ObjectMemberInitializerSyntax AndAlso
TypeOf current.Parent Is ObjectCreationExpressionSyntax Then
Return DirectCast(current.Parent, ExpressionSyntax)
End If
current = current.Parent
End While
End If
Return Nothing
End Function
End Module
End Namespace
|
AmadeusW/roslyn
|
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Extensions/MemberAccessExpressionSyntaxExtensions.vb
|
Visual Basic
|
apache-2.0
| 5,628
|
' 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.UnitTests.BraceMatching
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.BraceMatching
Public Class VisualBasicBraceMatcherTests
Inherits AbstractBraceMatcherTests
Protected Overrides Function CreateWorkspaceFromCode(code As String) As TestWorkspace
Return VisualBasicWorkspaceFactory.CreateWorkspaceFromLines(code)
End Function
Private Sub TestInClass(code As String, expectedCode As String)
Test(
"Class C" & vbCrLf & code & vbCrLf & "End Class",
"Class C" & vbCrLf & expectedCode & vbCrLf & "End Class")
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestEmptyFile()
Dim code = "$$"
Dim expected = ""
Test(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestAtFirstPositionInFile()
Dim code = "$$Class C" & vbCrLf & vbCrLf & "End Class"
Dim expected = "Class C" & vbCrLf & vbCrLf & "End Class"
Test(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestAtLastPositionInFile()
Dim code = "Class C" & vbCrLf & vbCrLf & "End Class$$"
Dim expected = "Class C" & vbCrLf & vbCrLf & "End Class"
Test(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestCurlyBrace1()
Dim code = "Dim l As New List(Of Integer) From $${}"
Dim expected = "Dim l As New List(Of Integer) From {[|}|]"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestCurlyBrace2()
Dim code = "Dim l As New List(Of Integer) From {$$}"
Dim expected = "Dim l As New List(Of Integer) From {[|}|]"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestCurlyBrace3()
Dim code = "Dim l As New List(Of Integer) From {$$ }"
Dim expected = "Dim l As New List(Of Integer) From { [|}|]"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestCurlyBrace4()
Dim code = "Dim l As New List(Of Integer) From { $$}"
Dim expected = "Dim l As New List(Of Integer) From [|{|] }"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestCurlyBrace5()
Dim code = "Dim l As New List(Of Integer) From { }$$"
Dim expected = "Dim l As New List(Of Integer) From [|{|] }"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestCurlyBrace6()
Dim code = "Dim l As New List(Of Integer) From {}$$"
Dim expected = "Dim l As New List(Of Integer) From [|{|]}"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestNestedParen1()
Dim code = "Dim l As New List$$(Of Func(Of Integer))"
Dim expected = "Dim l As New List(Of Func(Of Integer)[|)|]"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestNestedParen2()
Dim code = "Dim l As New List($$Of Func(Of Integer))"
Dim expected = "Dim l As New List(Of Func(Of Integer)[|)|]"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestNestedParen3()
Dim code = "Dim l As New List(Of Func$$(Of Integer))"
Dim expected = "Dim l As New List(Of Func(Of Integer[|)|])"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestNestedParen4()
Dim code = "Dim l As New List(Of Func($$Of Integer))"
Dim expected = "Dim l As New List(Of Func(Of Integer[|)|])"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestNestedParen5()
Dim code = "Dim l As New List(Of Func(Of Integer$$))"
Dim expected = "Dim l As New List(Of Func[|(|]Of Integer))"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestNestedParen6()
Dim code = "Dim l As New List(Of Func(Of Integer)$$)"
Dim expected = "Dim l As New List(Of Func[|(|]Of Integer))"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestNestedParen7()
Dim code = "Dim l As New List(Of Func(Of Integer)$$ )"
Dim expected = "Dim l As New List(Of Func[|(|]Of Integer) )"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestNestedParen8()
Dim code = "Dim l As New List(Of Func(Of Integer) $$)"
Dim expected = "Dim l As New List[|(|]Of Func(Of Integer) )"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestNestedParen9()
Dim code = "Dim l As New List(Of Func(Of Integer) )$$"
Dim expected = "Dim l As New List[|(|]Of Func(Of Integer) )"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestNestedParen10()
Dim code = "Dim l As New List(Of Func(Of Integer))$$"
Dim expected = "Dim l As New List[|(|]Of Func(Of Integer))"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestAngleBracket1()
Dim code = "$$<Foo()> Dim i As Integer"
Dim expected = "<Foo()[|>|] Dim i As Integer"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestAngleBracket2()
Dim code = "<$$Foo()> Dim i As Integer"
Dim expected = "<Foo()[|>|] Dim i As Integer"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestAngleBracket3()
Dim code = "<Foo$$()> Dim i As Integer"
Dim expected = "<Foo([|)|]> Dim i As Integer"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestAngleBracket4()
Dim code = "<Foo($$)> Dim i As Integer"
Dim expected = "<Foo([|)|]> Dim i As Integer"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestAngleBracket5()
Dim code = "<Foo($$ )> Dim i As Integer"
Dim expected = "<Foo( [|)|]> Dim i As Integer"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestAngleBracket6()
Dim code = "<Foo( $$)> Dim i As Integer"
Dim expected = "<Foo[|(|] )> Dim i As Integer"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestAngleBracket7()
Dim code = "<Foo( )$$> Dim i As Integer"
Dim expected = "<Foo[|(|] )> Dim i As Integer"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestAngleBracket8()
Dim code = "<Foo()$$> Dim i As Integer"
Dim expected = "<Foo[|(|])> Dim i As Integer"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestAngleBracket9()
Dim code = "<Foo()$$ > Dim i As Integer"
Dim expected = "<Foo[|(|]) > Dim i As Integer"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestAngleBracket10()
Dim code = "<Foo() $$> Dim i As Integer"
Dim expected = "[|<|]Foo() > Dim i As Integer"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestAngleBracket11()
Dim code = "<Foo() >$$ Dim i As Integer"
Dim expected = "[|<|]Foo() > Dim i As Integer"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestAngleBracket12()
Dim code = "<Foo()>$$ Dim i As Integer"
Dim expected = "[|<|]Foo()> Dim i As Integer"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestString1()
Dim code = "Dim s As String = $$""Foo"""
Dim expected = "Dim s As String = ""Foo[|""|]"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestString2()
Dim code = "Dim s As String = ""$$Foo"""
Dim expected = "Dim s As String = ""Foo[|""|]"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestString3()
Dim code = "Dim s As String = ""Foo$$"""
Dim expected = "Dim s As String = [|""|]Foo"""
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestString4()
Dim code = "Dim s As String = ""Foo""$$"
Dim expected = "Dim s As String = [|""|]Foo"""
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestString5()
Dim code = "Dim s As String = ""Foo$$"
Dim expected = "Dim s As String = ""Foo"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestInterpolatedString1()
Dim code = "Dim s = $$[||]$""Foo"""
Dim expected = "Dim s = $""Foo[|""|]"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestInterpolatedString2()
Dim code = "Dim s = $""$$Foo"""
Dim expected = "Dim s = $""Foo[|""|]"
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestInterpolatedString3()
Dim code = "Dim s = $""Foo$$"""
Dim expected = "Dim s = [|$""|]Foo"""
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestInterpolatedString4()
Dim code = "Dim s = $""Foo""$$"
Dim expected = "Dim s = [|$""|]Foo"""
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestInterpolatedString5()
Dim code = "Dim s = $"" $${x} """
Dim expected = "Dim s = $"" {x[|}|] """
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestInterpolatedString6()
Dim code = "Dim s = $"" {$$x} """
Dim expected = "Dim s = $"" {x[|}|] """
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestInterpolatedString7()
Dim code = "Dim s = $"" {x$$} """
Dim expected = "Dim s = $"" [|{|]x} """
TestInClass(code, expected)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.BraceMatching)>
Public Sub TestInterpolatedString8()
Dim code = "Dim s = $"" {x}$$ """
Dim expected = "Dim s = $"" [|{|]x} """
TestInClass(code, expected)
End Sub
End Class
End Namespace
|
DanielRosenwasser/roslyn
|
src/EditorFeatures/VisualBasicTest/BraceMatching/VisualBasicBraceMatcherTests.vb
|
Visual Basic
|
apache-2.0
| 13,406
|
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)
Select Case ellipse2d.Orientation
Case SolidEdgeFrameworkSupport.Geom2dOrientationConstants.igGeom2dOrientClockwise
Case SolidEdgeFrameworkSupport.Geom2dOrientationConstants.igGeom2dOrientCounterClockwise
End Select
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.Orientation.vb
|
Visual Basic
|
mit
| 2,399
|
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 bSplineCurve As SolidEdgeGeometry.BSplineCurve = 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.igQuerySpline
edges = CType(body.Edges(EdgeType), SolidEdgeGeometry.Edges)
For i As Integer = 1 To edges.Count
edge = CType(edges.Item(i), SolidEdgeGeometry.Edge)
bSplineCurve = TryCast(edge.Geometry, SolidEdgeGeometry.BSplineCurve)
If bSplineCurve IsNot Nothing Then
Dim isClosed = bSplineCurve.GetIsClosed()
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.BSplineCurve.GetIsClosed.vb
|
Visual Basic
|
mit
| 2,185
|
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 assemblyDocument As SolidEdgeAssembly.AssemblyDocument = Nothing
Dim relations3d As SolidEdgeAssembly.Relations3d = Nothing
Dim axialRelation3d As SolidEdgeAssembly.AxialRelation3d = 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
relations3d = assemblyDocument.Relations3d
For i As Integer = 1 To relations3d.Count
axialRelation3d = TryCast(relations3d.Item(i), SolidEdgeAssembly.AxialRelation3d)
If axialRelation3d IsNot Nothing Then
Dim suppress = axialRelation3d.Suppress
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/SolidEdgeAssembly.AxialRelation3d.Suppress.vb
|
Visual Basic
|
mit
| 1,667
|
'-------------------------------------------------------------------------------------------'
' Inicio del codigo
'-------------------------------------------------------------------------------------------'
' Importando librerias
'-------------------------------------------------------------------------------------------'
Imports System.Data
'-------------------------------------------------------------------------------------------'
' Inicio de clase "fPresupuestos_Posiciones"
'-------------------------------------------------------------------------------------------'
Partial Class fPresupuestos_Posiciones
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("")
loComandoSeleccionar.AppendLine("SELECT Presupuestos.Documento AS Documento,")
loComandoSeleccionar.AppendLine(" '' AS Factura, ")
loComandoSeleccionar.AppendLine(" Presupuestos.Control AS Control, ")
loComandoSeleccionar.AppendLine(" Presupuestos.Status AS Status, ")
loComandoSeleccionar.AppendLine(" Presupuestos.Cod_Pro AS Cod_Pro,")
loComandoSeleccionar.AppendLine(" (CASE WHEN Presupuestos.Nom_Pro = ''")
loComandoSeleccionar.AppendLine(" THEN Proveedores.Nom_Pro ")
loComandoSeleccionar.AppendLine(" ELSE Presupuestos.Nom_Pro")
loComandoSeleccionar.AppendLine(" END) AS Nom_Pro,")
loComandoSeleccionar.AppendLine(" (CASE WHEN Presupuestos.Rif = ''")
loComandoSeleccionar.AppendLine(" THEN Proveedores.Rif ")
loComandoSeleccionar.AppendLine(" ELSE Presupuestos.Rif")
loComandoSeleccionar.AppendLine(" END) AS Rif,")
loComandoSeleccionar.AppendLine(" (CASE WHEN Presupuestos.Dir_Fis = ''")
loComandoSeleccionar.AppendLine(" THEN Proveedores.Dir_Fis ")
loComandoSeleccionar.AppendLine(" ELSE Presupuestos.Dir_Fis")
loComandoSeleccionar.AppendLine(" END) AS Dir_Fis,")
loComandoSeleccionar.AppendLine(" (CASE WHEN Presupuestos.Telefonos = ''")
loComandoSeleccionar.AppendLine(" THEN Proveedores.Telefonos ")
loComandoSeleccionar.AppendLine(" ELSE Presupuestos.Telefonos")
loComandoSeleccionar.AppendLine(" END) AS Telefonos,")
loComandoSeleccionar.AppendLine(" Proveedores.Fax AS Fax, ")
loComandoSeleccionar.AppendLine(" Presupuestos.Fec_Ini AS Fec_Ini, ")
loComandoSeleccionar.AppendLine(" Presupuestos.Fec_Fin AS Fec_Fin, ")
loComandoSeleccionar.AppendLine(" Presupuestos.Mon_Bru AS Mon_Bru, ")
loComandoSeleccionar.AppendLine(" Presupuestos.Mon_Imp1 AS Mon_Imp1, ")
loComandoSeleccionar.AppendLine(" Presupuestos.Por_Des1 AS Por_Des1, ")
loComandoSeleccionar.AppendLine(" Presupuestos.Mon_Des1 AS Mon_Des1, ")
loComandoSeleccionar.AppendLine(" Presupuestos.Por_Rec1 AS Por_Rec1, ")
loComandoSeleccionar.AppendLine(" Presupuestos.Mon_Rec1 AS Mon_Rec1, ")
loComandoSeleccionar.AppendLine(" Presupuestos.Mon_Net AS Mon_Net, ")
loComandoSeleccionar.AppendLine(" Presupuestos.Mon_Sal AS Mon_Sal, ")
loComandoSeleccionar.AppendLine(" Presupuestos.Cod_For AS Cod_For, ")
loComandoSeleccionar.AppendLine(" Presupuestos.Cod_Mon AS Cod_Mon, ")
loComandoSeleccionar.AppendLine(" Presupuestos.Por_Imp1 AS Por_Imp1, ")
loComandoSeleccionar.AppendLine(" Presupuestos.Comentario AS Comentario, ")
loComandoSeleccionar.AppendLine(" Formas_Pagos.Nom_For AS Nom_For, ")
loComandoSeleccionar.AppendLine(" Presupuestos.Cod_Ven AS Cod_Ven, ")
loComandoSeleccionar.AppendLine(" Vendedores.Nom_Ven AS Nom_Ven,")
loComandoSeleccionar.AppendLine(" Posiciones.Cod_Pos AS Cod_Pos,")
loComandoSeleccionar.AppendLine(" Posiciones.Nom_Pos AS Nom_Pos,")
loComandoSeleccionar.AppendLine(" Posiciones.Opcional AS Opcional,")
loComandoSeleccionar.AppendLine(" Posiciones.Automatico AS Automatico,")
loComandoSeleccionar.AppendLine(" CAST(COALESCE(Movimientos_Posiciones.Val_Log, 0) AS BIT) AS Autorizado,")
loComandoSeleccionar.AppendLine(" COALESCE(Movimientos_Posiciones.Comentario,'') AS Comentario_Posicion")
loComandoSeleccionar.AppendLine("FROM Presupuestos")
loComandoSeleccionar.AppendLine(" JOIN Proveedores ON Proveedores.Cod_Pro = Presupuestos.Cod_Pro ")
loComandoSeleccionar.AppendLine(" JOIN Formas_Pagos ON Formas_Pagos.Cod_For = Presupuestos.Cod_For ")
loComandoSeleccionar.AppendLine(" JOIN Vendedores ON Vendedores.Cod_Ven = Presupuestos.Cod_Ven ")
loComandoSeleccionar.AppendLine(" LEFT JOIN Posiciones ")
loComandoSeleccionar.AppendLine(" ON Posiciones.Opcion = 'Presupuestos' ")
loComandoSeleccionar.AppendLine(" AND Posiciones.Status = 'A'")
loComandoSeleccionar.AppendLine(" LEFT JOIN Movimientos_Posiciones ")
loComandoSeleccionar.AppendLine(" ON Movimientos_Posiciones.Origen = 'Presupuestos'")
loComandoSeleccionar.AppendLine(" AND Movimientos_Posiciones.Adicional = ''")
loComandoSeleccionar.AppendLine(" AND Movimientos_Posiciones.Cod_Reg = Presupuestos.Documento")
loComandoSeleccionar.AppendLine(" AND Movimientos_Posiciones.Cod_Pos = Posiciones.Cod_Pos")
loComandoSeleccionar.AppendLine("WHERE " & cusAplicacion.goFormatos.pcCondicionPrincipal)
loComandoSeleccionar.AppendLine("ORDER BY Posiciones.Orden, Posiciones.Cod_Pos")
loComandoSeleccionar.AppendLine("")
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")
'-------------------------------------------------------------------------------------------------------
' 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("fPresupuestos_Posiciones", laDatosReporte)
Me.mTraducirReporte(loObjetoReporte)
Me.mFormatearCamposReporte(loObjetoReporte)
Me.crvfPresupuestos_Posiciones.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
'-------------------------------------------------------------------------------------------'
' RJG: 15/01/15: Codigo inicial
'-------------------------------------------------------------------------------------------'
|
kodeitsolutions/ef-reports
|
fPresupuestos_Posiciones.aspx.vb
|
Visual Basic
|
mit
| 9,868
|
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' Allgemeine Informationen über eine Assembly werden über die folgenden
' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
' die mit einer Assembly verknüpft sind.
' Die Werte der Assemblyattribute überprüfen
<Assembly: AssemblyTitle("Bildbetrachter")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("Bildbetrachter")>
<Assembly: AssemblyCopyright("Copyright © 2014")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
<Assembly: Guid("da6be59e-372f-4df3-a18e-6d149223811b")>
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
'
' Hauptversion
' Nebenversion
' Buildnummer
' Revision
'
' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
severinkaderli/gibb
|
Lehrjahr_2/Modul_303/Bildbetrachter/Bildbetrachter/My Project/AssemblyInfo.vb
|
Visual Basic
|
mit
| 1,203
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.18408
'
' 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("SoxConvertVb.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
|
skor98/DtWPF
|
speechKit/Alvas.Audio/SoxConvertVb/My Project/Resources.Designer.vb
|
Visual Basic
|
mit
| 2,718
|
'-------------------------------------------------------------------------------------------'
' Inicio del codigo
'-------------------------------------------------------------------------------------------'
' Importando librerias
'-------------------------------------------------------------------------------------------'
Imports System.Data
'-------------------------------------------------------------------------------------------'
' Inicio de clase "rECuentas_Cajas_Stratos"
'-------------------------------------------------------------------------------------------'
Partial Class rECuentas_Cajas_Stratos
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), goServicios.enuOpcionesRedondeo.KN_FechaInicioDelDia)
Dim lcParametro0Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(0), goServicios.enuOpcionesRedondeo.KN_FechaFinDelDia)
Dim lcParametro1Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(1), goServicios.enuOpcionesRedondeo.KN_FechaInicioDelDia)
Dim lcParametro1Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(1), goServicios.enuOpcionesRedondeo.KN_FechaFinDelDia)
Dim lcParametro2Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(2), goServicios.enuOpcionesRedondeo.KN_FechaInicioDelDia)
Dim lcParametro2Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(2), goServicios.enuOpcionesRedondeo.KN_FechaFinDelDia)
Dim lcParametro3Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(3), goServicios.enuOpcionesRedondeo.KN_FechaInicioDelDia)
Dim lcParametro3Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(3), goServicios.enuOpcionesRedondeo.KN_FechaFinDelDia)
Dim lcParametro4Desde As String = goServicios.mObtenerListaFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(4))
Dim lcParametro5Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(5), goServicios.enuOpcionesRedondeo.KN_FechaInicioDelDia)
Dim lcParametro5Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(5), goServicios.enuOpcionesRedondeo.KN_FechaFinDelDia)
Dim lcParametro6Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(6), goServicios.enuOpcionesRedondeo.KN_FechaInicioDelDia)
Dim lcParametro6Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(6), goServicios.enuOpcionesRedondeo.KN_FechaFinDelDia)
Dim lcParametro7Desde As String = cusAplicacion.goReportes.paParametrosFinales(7)
Dim lcParametro8Desde As String = goServicios.mObtenerListaFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(8))
Dim lcOrdenamiento As String = cusAplicacion.goReportes.pcOrden
Dim loComandoSeleccionar As New StringBuilder()
loComandoSeleccionar.AppendLine("SELECT ")
loComandoSeleccionar.AppendLine(" Movimientos_Cajas.Cod_Caj, ")
loComandoSeleccionar.AppendLine(" (SUM(Movimientos_Cajas.Mon_Deb)- SUM(Movimientos_Cajas.Mon_Hab)) AS Sal_Ini ")
loComandoSeleccionar.AppendLine("INTO #tempSALDOINICIAL ")
loComandoSeleccionar.AppendLine("FROM Movimientos_Cajas ")
loComandoSeleccionar.AppendLine("WHERE Movimientos_Cajas.Fec_Ini < " & lcParametro1Desde & " ")
loComandoSeleccionar.AppendLine(" AND Movimientos_Cajas.Cod_Caj BETWEEN " & lcParametro0Desde)
loComandoSeleccionar.AppendLine(" AND " & lcParametro0Hasta)
loComandoSeleccionar.AppendLine(" AND Movimientos_Cajas.Cod_Ban BETWEEN " & lcParametro2Desde)
loComandoSeleccionar.AppendLine(" AND " & lcParametro2Hasta)
loComandoSeleccionar.AppendLine(" AND Movimientos_Cajas.Cod_Con BETWEEN " & lcParametro3Desde)
loComandoSeleccionar.AppendLine(" AND " & lcParametro3Hasta)
loComandoSeleccionar.AppendLine(" AND Movimientos_Cajas.Status IN ( " & lcParametro4Desde & ")")
loComandoSeleccionar.AppendLine(" AND Movimientos_Cajas.Cod_Suc BETWEEN " & lcParametro5Desde)
loComandoSeleccionar.AppendLine(" AND " & lcParametro6Hasta)
If lcParametro7Desde = "Igual" Then
loComandoSeleccionar.AppendLine(" AND Movimientos_Cajas.Cod_Rev between " & lcParametro6Desde)
Else
loComandoSeleccionar.AppendLine(" AND Movimientos_Cajas.Cod_Rev NOT between " & lcParametro6Desde)
End If
loComandoSeleccionar.AppendLine(" AND " & lcParametro6Hasta)
loComandoSeleccionar.AppendLine(" AND Movimientos_Cajas.Tipo IN ( " & lcParametro8Desde & ")")
loComandoSeleccionar.AppendLine("GROUP BY Movimientos_Cajas.Cod_Caj ")
loComandoSeleccionar.AppendLine(" SELECT Movimientos_Cajas.Documento, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cajas.Tip_Doc, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cajas.Cod_Caj, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cajas.Cod_Ban, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cajas.Fec_Ini, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cajas.Status, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cajas.Referencia, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cajas.Cod_Con, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cajas.Cod_Mon, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cajas.Comentario,")
loComandoSeleccionar.AppendLine(" Movimientos_Cajas.Mon_Deb, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cajas.Mon_Hab, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cajas.Tip_Ori, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cajas.Doc_Ori, ")
loComandoSeleccionar.AppendLine(" Movimientos_Cajas.Tipo, ")
loComandoSeleccionar.AppendLine(" Cajas.Nom_Caj, ")
loComandoSeleccionar.AppendLine(" Conceptos.Nom_Con ")
loComandoSeleccionar.AppendLine(" INTO #tempMOVIMIENTO")
loComandoSeleccionar.AppendLine(" FROM Movimientos_Cajas ")
loComandoSeleccionar.AppendLine(" JOIN Cajas ON Movimientos_Cajas.Cod_Caj = Cajas.Cod_Caj ")
loComandoSeleccionar.AppendLine(" JOIN Conceptos ON Movimientos_Cajas.Cod_Con = Conceptos.Cod_Con")
loComandoSeleccionar.AppendLine(" WHERE Movimientos_Cajas.Cod_Caj BETWEEN " & lcParametro0Desde)
loComandoSeleccionar.AppendLine(" AND " & lcParametro0Hasta)
loComandoSeleccionar.AppendLine(" AND Movimientos_Cajas.Fec_Ini BETWEEN " & lcParametro1Desde)
loComandoSeleccionar.AppendLine(" AND " & lcParametro1Hasta)
loComandoSeleccionar.AppendLine(" AND Movimientos_Cajas.Cod_Ban BETWEEN " & lcParametro2Desde)
loComandoSeleccionar.AppendLine(" AND " & lcParametro2Hasta)
loComandoSeleccionar.AppendLine(" AND Movimientos_Cajas.Cod_Con BETWEEN " & lcParametro3Desde)
loComandoSeleccionar.AppendLine(" AND " & lcParametro3Hasta)
loComandoSeleccionar.AppendLine(" AND Movimientos_Cajas.Status IN ( " & lcParametro4Desde & ")")
loComandoSeleccionar.AppendLine(" AND Movimientos_Cajas.Cod_Suc BETWEEN " & lcParametro5Desde)
loComandoSeleccionar.AppendLine(" AND " & lcParametro6Hasta)
If lcParametro7Desde = "Igual" Then
loComandoSeleccionar.AppendLine(" AND Movimientos_Cajas.Cod_Rev BETWEEN " & lcParametro6Desde)
Else
loComandoSeleccionar.AppendLine(" AND Movimientos_Cajas.Cod_Rev NOT BETWEEN " & lcParametro6Desde)
End If
loComandoSeleccionar.AppendLine(" AND " & lcParametro6Hasta)
loComandoSeleccionar.AppendLine(" AND Movimientos_Cajas.Tipo IN ( " & lcParametro8Desde & ")")
loComandoSeleccionar.AppendLine("SELECT ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Documento, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Tip_Doc, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Cod_Caj, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Nom_Caj, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Cod_Ban, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Fec_Ini, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Status, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Referencia, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Cod_Con, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Nom_Con, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Cod_Mon, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Mon_Deb, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Mon_Hab, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Tip_Ori, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Doc_Ori, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Comentario, ")
loComandoSeleccionar.AppendLine(" #tempMOVIMIENTO.Tipo, ")
loComandoSeleccionar.AppendLine(" ISNULL(#tempSALDOINICIAL.Sal_Ini,0) AS Sal_Ini, ")
loComandoSeleccionar.AppendLine(" 0 AS Sal_Doc ")
loComandoSeleccionar.AppendLine("FROM #tempMOVIMIENTO ")
loComandoSeleccionar.AppendLine("LEFT JOIN #tempSALDOINICIAL ON #tempSALDOINICIAL.Cod_Caj = #tempMOVIMIENTO.Cod_Caj")
loComandoSeleccionar.AppendLine("ORDER BY #tempMOVIMIENTO." & lcOrdenamiento & ", #tempMOVIMIENTO.Fec_Ini ASC")
'Me.mEscribirConsulta(loComandoSeleccionar.ToString)
Dim loServicios As New cusDatos.goDatos
Dim laDatosReporte As DataSet = loServicios.mObtenerTodosSinEsquema(loComandoSeleccionar.ToString(), "curReportes")
If laDatosReporte.Tables(0).Rows.Count <> 0 Then
'******************************************************************************************
' Se Procesa manualmetne los datos
'******************************************************************************************
Dim loTabla As New DataTable("curReportes")
Dim loColumna As DataColumn
loColumna = New DataColumn("Documento", GetType(String))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Tip_Doc", GetType(String))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Cod_Caj", GetType(String))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Nom_Caj", GetType(String))
loColumna.MaxLength = 50
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Cod_Ban", GetType(String))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Fec_Ini", GetType(String))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Status", GetType(String))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Referencia", GetType(String))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Cod_Con", GetType(String))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Nom_Con", GetType(String))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Cod_Mon", GetType(String))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Cod_Tip", GetType(String))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Mon_Deb", GetType(Decimal))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Mon_Hab", GetType(Decimal))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Tip_Ori", GetType(String))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Doc_Ori", GetType(String))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Tipo", GetType(String))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Comentario", GetType(String))
loColumna.MaxLength = 500
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Sal_Ini", GetType(Decimal))
loTabla.Columns.Add(loColumna)
loColumna = New DataColumn("Sal_Doc", GetType(Decimal))
loTabla.Columns.Add(loColumna)
Dim loNuevaFila As DataRow
Dim Caja_Actual As String
Dim SaldoAnterior As Decimal = 0
Dim lnTotalFilas As Integer = laDatosReporte.Tables(0).Rows.Count
Dim loFila As DataRow
'***************
loFila = laDatosReporte.Tables(0).Rows(0)
loNuevaFila = loTabla.NewRow()
loTabla.Rows.Add(loNuevaFila)
SaldoAnterior = loFila("Sal_Ini")
loColumna = New DataColumn("Documento", GetType(String))
loColumna = New DataColumn("Tip_Doc", GetType(String))
loColumna = New DataColumn("Cod_Caj", GetType(String))
loColumna = New DataColumn("Nom_Caj", GetType(String))
loColumna = New DataColumn("Cod_Ban", GetType(String))
loColumna = New DataColumn("Fec_Ini", GetType(String))
loColumna = New DataColumn("Status", GetType(String))
loColumna = New DataColumn("Referencia", GetType(String))
loColumna = New DataColumn("Cod_Con", GetType(String))
loColumna = New DataColumn("Nom_Con", GetType(String))
loColumna = New DataColumn("Cod_Mon", GetType(String))
loColumna = New DataColumn("Cod_Tip", GetType(String))
loColumna = New DataColumn("Mon_Deb", GetType(Decimal))
loColumna = New DataColumn("Mon_Hab", GetType(Decimal))
loColumna = New DataColumn("Tip_Ori", GetType(String))
loColumna = New DataColumn("Doc_Ori", GetType(String))
loColumna = New DataColumn("Tipo", GetType(String))
loColumna = New DataColumn("Comentario", GetType(String))
loColumna = New DataColumn("Sal_Ini", GetType(Decimal))
loColumna = New DataColumn("Sal_Doc", GetType(Decimal))
loNuevaFila.Item("Documento") = loFila("Documento")
loNuevaFila.Item("Tip_Doc") = loFila("Tip_Doc")
loNuevaFila.Item("Cod_Caj") = loFila("Cod_Caj")
loNuevaFila.Item("Nom_Caj") = loFila("Nom_Caj")
loNuevaFila.Item("Cod_Ban") = loFila("Cod_Ban")
loNuevaFila.Item("Fec_Ini") = Microsoft.VisualBasic.Format(CDate(loFila("Fec_Ini")), "MM/dd/yyyy")
loNuevaFila.Item("Status") = loFila("Status")
loNuevaFila.Item("Referencia") = loFila("Referencia")
loNuevaFila.Item("Cod_Con") = loFila("Cod_Con")
loNuevaFila.Item("Nom_Con") = loFila("Nom_Con")
loNuevaFila.Item("Cod_Mon") = loFila("Cod_Mon")
loNuevaFila.Item("Mon_Deb") = loFila("Mon_Deb")
loNuevaFila.Item("Mon_Hab") = loFila("Mon_Hab")
loNuevaFila.Item("Comentario") = loFila("Comentario")
loNuevaFila.Item("Tip_Ori") = loFila("Tip_Ori")
loNuevaFila.Item("Doc_Ori") = loFila("Doc_Ori")
loNuevaFila.Item("Tipo") = loFila("Tipo")
loNuevaFila.Item("Sal_Ini") = loFila("Sal_Ini")
loNuevaFila.Item("Sal_Doc") = SaldoAnterior + loFila("Mon_Deb") - loFila("Mon_Hab")
SaldoAnterior = SaldoAnterior + loFila("Mon_Deb") - loFila("Mon_Hab")
Caja_Actual = loFila("Cod_Caj")
loTabla.AcceptChanges()
For lnNumeroFila As Integer = 1 To lnTotalFilas - 1
loFila = laDatosReporte.Tables(0).Rows(lnNumeroFila)
loNuevaFila = loTabla.NewRow()
loTabla.Rows.Add(loNuevaFila)
If loFila("Cod_Caj") <> Caja_Actual Then
SaldoAnterior = loFila("Sal_Ini")
End If
loNuevaFila.Item("Documento") = loFila("Documento")
loNuevaFila.Item("Tip_Doc") = loFila("Tip_Doc")
loNuevaFila.Item("Cod_Caj") = loFila("Cod_Caj")
loNuevaFila.Item("Nom_Caj") = loFila("Nom_Caj")
loNuevaFila.Item("Cod_Ban") = loFila("Cod_Ban")
loNuevaFila.Item("Fec_Ini") = Microsoft.VisualBasic.Format(CDate(loFila("Fec_Ini")), "MM/dd/yyyy")
loNuevaFila.Item("Status") = loFila("Status")
loNuevaFila.Item("Referencia") = loFila("Referencia")
loNuevaFila.Item("Cod_Con") = loFila("Cod_Con")
loNuevaFila.Item("Nom_Con") = loFila("Nom_Con")
loNuevaFila.Item("Cod_Mon") = loFila("Cod_Mon")
loNuevaFila.Item("Mon_Deb") = loFila("Mon_Deb")
loNuevaFila.Item("Mon_Hab") = loFila("Mon_Hab")
loNuevaFila.Item("Comentario") = loFila("Comentario")
loNuevaFila.Item("Tip_Ori") = loFila("Tip_Ori")
loNuevaFila.Item("Doc_Ori") = loFila("Doc_Ori")
loNuevaFila.Item("Tipo") = loFila("Tipo")
loNuevaFila.Item("Sal_Ini") = loFila("Sal_Ini")
loNuevaFila.Item("Sal_Doc") = SaldoAnterior + loFila("Mon_Deb") - loFila("Mon_Hab")
SaldoAnterior = SaldoAnterior + loFila("Mon_Deb") - loFila("Mon_Hab")
Caja_Actual = loFila("Cod_Caj")
loTabla.AcceptChanges()
Next lnNumeroFila
Dim loDatosReporteFinal As New DataSet("curReportes")
loDatosReporteFinal.Tables.Add(loTabla)
'---------------------------------------------------------------------------------------'
' Se llena el reporte con la tabla nueva '
'---------------------------------------------------------------------------------------'
loObjetoReporte = cusAplicacion.goReportes.mCargarReporte("rECuentas_Cajas_Stratos", loDatosReporteFinal)
Else
loObjetoReporte = cusAplicacion.goReportes.mCargarReporte("rECuentas_Cajas_Stratos", laDatosReporte)
End If
Me.mTraducirReporte(loObjetoReporte)
Me.mFormatearCamposReporte(loObjetoReporte)
Me.crvrECuentas_Cajas_Stratos.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 '
'-------------------------------------------------------------------------------------------'
' MAT: 08/09/11 : Código Inicial
'-------------------------------------------------------------------------------------------'
|
kodeitsolutions/ef-reports
|
rECuentas_Cajas_Stratos.aspx.vb
|
Visual Basic
|
mit
| 21,594
|
Public Class Loading
Private LooperVerdi As Integer = 0
Private LoadingLoop As Integer = 0
Private OPLoop As Integer = 100
Private Sub ElektroniskTerning(ByVal val As Integer)
Dim a As Integer
If val = 100 Then
Dim rand As New Random
a = rand.Next(1, 7)
Else
a = val
End If
If (a = 1) Then
hideall()
PictureBox5.Show()
ElseIf (a = 2) Then
hideall()
PictureBox3.Show()
PictureBox7.Show()
ElseIf (a = 3) Then
hideall()
PictureBox3.Show()
PictureBox5.Show()
PictureBox7.Show()
ElseIf (a = 4) Then
hideall()
PictureBox1.Show()
PictureBox3.Show()
PictureBox7.Show()
PictureBox9.Show()
ElseIf (a = 5) Then
hideall()
PictureBox1.Show()
PictureBox3.Show()
PictureBox5.Show()
PictureBox7.Show()
PictureBox9.Show()
ElseIf (a = 6) Then
hideall()
PictureBox1.Show()
PictureBox3.Show()
PictureBox4.Show()
PictureBox6.Show()
PictureBox7.Show()
PictureBox9.Show()
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If LooperVerdi = 7 Then
Timer1.Stop()
Timer3.Start()
Else
LooperVerdi += 1
End If
ElektroniskTerning(LooperVerdi)
End Sub
Private Sub hideall()
PictureBox1.Hide()
PictureBox2.Hide()
PictureBox3.Hide()
PictureBox4.Hide()
PictureBox5.Hide()
PictureBox6.Hide()
PictureBox7.Hide()
PictureBox8.Hide()
PictureBox9.Hide()
End Sub
Private Sub Loading_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Start()
Timer2.Start()
Me.Opacity = 1
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
If LoadingLoop = 0 Then
LoadingLoop = 1
Label3.Text = "Laster"
ElseIf LoadingLoop = 4 Then
LoadingLoop = 1
Label3.Text = "Laster"
ElseIf LoadingLoop = 1 Then
Label3.Text = "Laster."
LoadingLoop += 1
ElseIf LoadingLoop = 2 Then
Label3.Text = "Laster.."
LoadingLoop += 1
ElseIf LoadingLoop = 3 Then
Label3.Text = "Laster..."
LoadingLoop += 1
End If
End Sub
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
OPLoop -= 1
Me.Opacity = (Me.Opacity + OPLoop) / 100
If Me.Opacity = 0 Then
Form1.Show()
Timer3.Stop()
Me.Close()
End If
End Sub
End Class
|
niikoo/NProj
|
Windows/Skole/Terning .NET v2.0/Terning .NET v2.0/Loading.vb
|
Visual Basic
|
apache-2.0
| 3,065
|
Imports EIDSS.model.Core
Imports EIDSS.model.Resources
Imports EIDSS.model.Enums
Imports bv.common.Enums
Imports System.Collections.Generic
Public Class SampleDestructionDetail
Inherits bv.common.win.BaseDetailForm
Friend WithEvents colSampleType As DevExpress.XtraGrid.Columns.GridColumn
Friend WithEvents cbPerson As DevExpress.XtraEditors.LookUpEdit
Friend WithEvents Label12 As System.Windows.Forms.Label
Friend WithEvents btnAdd As DevExpress.XtraEditors.SimpleButton
Friend WithEvents btnDelete As DevExpress.XtraEditors.SimpleButton
Friend WithEvents colSampleID As DevExpress.XtraGrid.Columns.GridColumn
Friend WithEvents GridView1 As DevExpress.XtraGrid.Views.Grid.GridView
Friend WithEvents cbDepartment As DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit
Friend WithEvents GridControl1 As DevExpress.XtraGrid.GridControl
Friend WithEvents cbStatus As DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit
Friend WithEvents colDestructionMethod As DevExpress.XtraGrid.Columns.GridColumn
Friend WithEvents cbDestructionMethod As DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit
Friend WithEvents cmReports As System.Windows.Forms.ContextMenu
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
Friend WithEvents btnReport As bv.winclient.Core.PopUpButton
Private DestroyMode As Boolean = False
Public Sub New(mode As Boolean)
Init(mode)
End Sub
Public Sub New()
Init(True)
End Sub
Public Sub SetDestroyMode(ByVal mode As Boolean)
DestroyMode = mode
CType(DbService, SampleDestruction_DB).DestroyMode = mode
If DestroyMode = False Then
Dim shift As Integer = Me.GridControl1.Top - Me.cbPerson.Top
Me.GridControl1.Top -= shift
Me.GridControl1.Height += shift
Me.cbPerson.Visible = False
Me.Label12.Visible = False
Me.ShowSaveButton = True
End If
End Sub
Private Sub Init(mode As Boolean)
InitializeComponent()
Me.AuditObject = New AuditObject(EIDSSAuditObject.daoSampleDestruction, AuditTable.tlbMaterial)
'Me.PermissionObject = eidss.model.Enums.EIDSSPermissionObject.VialDestruction
Dim perm As String = PermissionHelper.DeletePermission(EIDSSPermissionObject.Sample)
Me.Permissions = New StandardAccessPermissions(perm, perm, perm, perm, perm)
Me.DbService = New SampleDestruction_DB()
Me.m_RelatedLists = New String() {"LabSampleDispositionListItem", "LabSampleListItem"}
SetDestroyMode(mode)
MenuItem1.Visible = EIDSS.model.Reports.BaseMenuReportRegistrator.IsPaperFormAllowed("LimSampleDestruction")
End Sub
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(SampleDestructionDetail))
Me.GridControl1 = New DevExpress.XtraGrid.GridControl()
Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.colSampleID = New DevExpress.XtraGrid.Columns.GridColumn()
Me.colSampleType = New DevExpress.XtraGrid.Columns.GridColumn()
Me.colDestructionMethod = New DevExpress.XtraGrid.Columns.GridColumn()
Me.cbDestructionMethod = New DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit()
Me.cbDepartment = New DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit()
Me.cbStatus = New DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit()
Me.cbPerson = New DevExpress.XtraEditors.LookUpEdit()
Me.Label12 = New System.Windows.Forms.Label()
Me.btnAdd = New DevExpress.XtraEditors.SimpleButton()
Me.btnDelete = New DevExpress.XtraEditors.SimpleButton()
Me.cmReports = New System.Windows.Forms.ContextMenu()
Me.MenuItem1 = New System.Windows.Forms.MenuItem()
Me.btnReport = New bv.winclient.Core.PopUpButton()
CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.cbDestructionMethod, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.cbDepartment, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.cbStatus, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.cbPerson.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
bv.common.Resources.BvResourceManagerChanger.GetResourceManager(GetType(SampleDestructionDetail), resources)
'Form Is Localizable: True
'
'GridControl1
'
resources.ApplyResources(Me.GridControl1, "GridControl1")
Me.GridControl1.MainView = Me.GridView1
Me.GridControl1.Name = "GridControl1"
Me.GridControl1.RepositoryItems.AddRange(New DevExpress.XtraEditors.Repository.RepositoryItem() {Me.cbDepartment, Me.cbStatus, Me.cbDestructionMethod})
Me.GridControl1.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView1})
'
'GridView1
'
Me.GridView1.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.colSampleID, Me.colSampleType, Me.colDestructionMethod})
Me.GridView1.GridControl = Me.GridControl1
Me.GridView1.Name = "GridView1"
Me.GridView1.OptionsNavigation.EnterMoveNextColumn = True
Me.GridView1.OptionsView.ShowGroupPanel = False
'
'colSampleID
'
resources.ApplyResources(Me.colSampleID, "colSampleID")
Me.colSampleID.FieldName = "strBarcode"
Me.colSampleID.Name = "colSampleID"
Me.colSampleID.OptionsColumn.AllowEdit = False
'
'colSampleType
'
resources.ApplyResources(Me.colSampleType, "colSampleType")
Me.colSampleType.FieldName = "strSampleName"
Me.colSampleType.Name = "colSampleType"
Me.colSampleType.OptionsColumn.AllowEdit = False
'
'colDestructionMethod
'
resources.ApplyResources(Me.colDestructionMethod, "colDestructionMethod")
Me.colDestructionMethod.ColumnEdit = Me.cbDestructionMethod
Me.colDestructionMethod.FieldName = "idfsDestructionMethod"
Me.colDestructionMethod.Name = "colDestructionMethod"
'
'cbDestructionMethod
'
resources.ApplyResources(Me.cbDestructionMethod, "cbDestructionMethod")
Me.cbDestructionMethod.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(CType(resources.GetObject("cbDestructionMethod.Buttons"), DevExpress.XtraEditors.Controls.ButtonPredefines))})
Me.cbDestructionMethod.Name = "cbDestructionMethod"
'
'cbDepartment
'
resources.ApplyResources(Me.cbDepartment, "cbDepartment")
Me.cbDepartment.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(CType(resources.GetObject("cbDepartment.Buttons"), DevExpress.XtraEditors.Controls.ButtonPredefines))})
Me.cbDepartment.DisplayMember = "Name"
Me.cbDepartment.Name = "cbDepartment"
Me.cbDepartment.ValueMember = "idfDepartment"
'
'cbStatus
'
resources.ApplyResources(Me.cbStatus, "cbStatus")
Me.cbStatus.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(CType(resources.GetObject("cbStatus.Buttons"), DevExpress.XtraEditors.Controls.ButtonPredefines))})
Me.cbStatus.DisplayMember = "Name"
Me.cbStatus.Name = "cbStatus"
Me.cbStatus.ShowHeader = False
Me.cbStatus.ValueMember = "idfsReference"
'
'cbPerson
'
resources.ApplyResources(Me.cbPerson, "cbPerson")
Me.cbPerson.Name = "cbPerson"
Me.cbPerson.Properties.AutoHeight = CType(resources.GetObject("cbPerson.Properties.AutoHeight"), Boolean)
Me.cbPerson.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(CType(resources.GetObject("cbPerson.Properties.Buttons"), DevExpress.XtraEditors.Controls.ButtonPredefines))})
Me.cbPerson.Properties.NullText = resources.GetString("cbPerson.Properties.NullText")
Me.cbPerson.Tag = ""
'
'Label12
'
resources.ApplyResources(Me.Label12, "Label12")
Me.Label12.Name = "Label12"
'
'btnAdd
'
resources.ApplyResources(Me.btnAdd, "btnAdd")
Me.btnAdd.Image = Global.EIDSS.My.Resources.Resources.add
Me.btnAdd.Name = "btnAdd"
'
'btnDelete
'
resources.ApplyResources(Me.btnDelete, "btnDelete")
Me.btnDelete.Image = Global.EIDSS.My.Resources.Resources.Delete_Remove
Me.btnDelete.Name = "btnDelete"
'
'cmReports
'
Me.cmReports.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1})
'
'MenuItem1
'
Me.MenuItem1.Index = 0
resources.ApplyResources(Me.MenuItem1, "MenuItem1")
'
'btnReport
'
resources.ApplyResources(Me.btnReport, "btnReport")
Me.btnReport.ButtonType = bv.winclient.Core.PopUpButton.PopUpButtonStyles.Reports
Me.btnReport.Name = "btnReport"
Me.btnReport.PopUpMenu = Me.cmReports
Me.btnReport.Tag = "{Immovable}{AlwaysEditable}"
'
'SampleDestructionDetail
'
resources.ApplyResources(Me, "$this")
Me.Controls.Add(Me.btnReport)
Me.Controls.Add(Me.btnDelete)
Me.Controls.Add(Me.btnAdd)
Me.Controls.Add(Me.cbPerson)
Me.Controls.Add(Me.GridControl1)
Me.Controls.Add(Me.Label12)
Me.DefaultFormState = System.Windows.Forms.FormWindowState.Normal
Me.FormID = "L08"
Me.HelpTopicID = "lab_l08"
Me.KeyFieldName = "idfMaterial"
Me.LeftIcon = CType(resources.GetObject("$this.LeftIcon"), System.Drawing.Image)
Me.Name = "SampleDestructionDetail"
Me.ObjectName = "Samples"
Me.ShowDeleteButton = False
Me.Sizable = True
Me.Status = bv.common.win.FormStatus.Draft
Me.Controls.SetChildIndex(Me.Label12, 0)
Me.Controls.SetChildIndex(Me.GridControl1, 0)
Me.Controls.SetChildIndex(Me.cbPerson, 0)
Me.Controls.SetChildIndex(Me.btnAdd, 0)
Me.Controls.SetChildIndex(Me.btnDelete, 0)
Me.Controls.SetChildIndex(Me.btnReport, 0)
CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.cbDestructionMethod, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.cbDepartment, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.cbStatus, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.cbPerson.Properties, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Protected Overrides Sub DefineBinding()
Me.GridControl1.DataSource = Me.baseDataSet.Tables("Samples")
Core.LookupBinder.BindPersonLookup(cbPerson, baseDataSet, "User.idfDestroyedByPerson", HACode.All)
Core.LookupBinder.SetPersonFilter(cbPerson)
Core.LookupBinder.BindBaseRepositoryLookup(cbDestructionMethod, db.BaseReferenceType.rftDestructionMethod)
End Sub
Public Overrides Function HasChanges() As Boolean
Return True
End Function
Private Sub Delete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
Me.GridView1.DeleteSelectedRows()
End Sub
Private Sub MenuItem1_Click(sender As Object, e As EventArgs) Handles MenuItem1.Click
If baseDataSet Is Nothing OrElse baseDataSet.Tables.Count = 0 OrElse (Not baseDataSet.Tables.Contains("Samples")) Then
Return
End If
If Post(PostType.FinalPosting) Then
Dim idList As List(Of Long) = New List(Of Long)()
Dim table As DataTable = baseDataSet.Tables("Samples")
For Each row As DataRow In table.Rows
idList.Add(CLng(row("idfMaterial")))
Next
EidssSiteContext.ReportFactory.LimSampleDestruction(idList)
End If
End Sub
End Class
|
EIDSS/EIDSS-Legacy
|
EIDSS v6.1/vb/EIDSS/EIDSS_Lims/Destruction/SampleDestructionDetail.vb
|
Visual Basic
|
bsd-2-clause
| 12,852
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class IntelliListbox
Inherits System.Windows.Forms.UserControl
'UserControl 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.lwIntelliItems = New System.Windows.Forms.ListView()
Me.CHIcon = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.CHText = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.SuspendLayout()
'
'lwIntelliItems
'
Me.lwIntelliItems.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.CHIcon, Me.CHText})
Me.lwIntelliItems.Dock = System.Windows.Forms.DockStyle.Fill
Me.lwIntelliItems.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.125!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lwIntelliItems.FullRowSelect = True
Me.lwIntelliItems.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None
Me.lwIntelliItems.HideSelection = False
Me.lwIntelliItems.LabelWrap = False
Me.lwIntelliItems.Location = New System.Drawing.Point(0, 0)
Me.lwIntelliItems.MultiSelect = False
Me.lwIntelliItems.Name = "lwIntelliItems"
Me.lwIntelliItems.ShowGroups = False
Me.lwIntelliItems.Size = New System.Drawing.Size(540, 300)
Me.lwIntelliItems.TabIndex = 0
Me.lwIntelliItems.UseCompatibleStateImageBehavior = False
Me.lwIntelliItems.View = System.Windows.Forms.View.Details
'
'CHIcon
'
Me.CHIcon.Text = ""
Me.CHIcon.Width = 30
'
'CHText
'
Me.CHText.Text = ""
Me.CHText.Width = 440
'
'IntelliListbox
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(12.0!, 25.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.Controls.Add(Me.lwIntelliItems)
Me.Name = "IntelliListbox"
Me.Size = New System.Drawing.Size(540, 300)
Me.ResumeLayout(False)
End Sub
Friend WithEvents lwIntelliItems As ListView
Friend WithEvents CHIcon As ColumnHeader
Friend WithEvents CHText As ColumnHeader
End Class
|
xeora/v6
|
Tools/XeoraVSExtension/Xeora.VSAddIn/Tools/Creators/IntelliListbox.Designer.vb
|
Visual Basic
|
mit
| 2,968
|
' 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.Composition
Imports System.Threading
Imports System.Threading.Tasks
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Debugging
Imports Microsoft.CodeAnalysis.ErrorReporting
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.EditAndContinue
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.Debugging
<ExportLanguageService(GetType(IBreakpointResolutionService), LanguageNames.VisualBasic), [Shared]>
Partial Friend Class VisualBasicBreakpointResolutionService
Implements IBreakpointResolutionService
<ImportingConstructor>
Public Sub New()
End Sub
Friend Shared Async Function GetBreakpointAsync(document As Document, position As Integer, length As Integer, cancellationToken As CancellationToken) As Task(Of BreakpointResolutionResult)
Try
Dim tree = Await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(False)
' Non-zero length means that the span is passed by the debugger and we may need validate it.
' In a rare VB case, this span may contain multiple methods, e.g.,
'
' [Sub Goo() Handles A
'
' End Sub
'
' Sub Bar() Handles B]
'
' End Sub
'
' It happens when IDE services (e.g., NavBar or CodeFix) inserts a new method at the beginning of the existing one
' which happens to have a breakpoint on its head. In this situation, we should attempt to validate the span of the existing method,
' not that of a newly-prepended method.
Dim descendIntoChildren As Func(Of SyntaxNode, Boolean) =
Function(n)
Return (Not n.IsKind(SyntaxKind.ConstructorBlock)) _
AndAlso (Not n.IsKind(SyntaxKind.SubBlock))
End Function
If length > 0 Then
Dim root = Await tree.GetRootAsync(cancellationToken).ConfigureAwait(False)
Dim item = root.DescendantNodes(New TextSpan(position, length), descendIntoChildren:=descendIntoChildren).OfType(Of MethodBlockSyntax).Skip(1).LastOrDefault()
If item IsNot Nothing Then
position = item.SpanStart
End If
End If
Dim span As TextSpan
If Not BreakpointSpans.TryGetBreakpointSpan(tree, position, cancellationToken, span) Then
Return Nothing
End If
If span.Length = 0 Then
Return BreakpointResolutionResult.CreateLineResult(document)
End If
Return BreakpointResolutionResult.CreateSpanResult(document, span)
Catch e As Exception When FatalError.ReportWithoutCrashUnlessCanceled(e)
Return Nothing
End Try
End Function
Public Function ResolveBreakpointAsync(document As Document, textSpan As TextSpan, Optional cancellationToken As CancellationToken = Nothing) As Task(Of BreakpointResolutionResult) Implements IBreakpointResolutionService.ResolveBreakpointAsync
Return GetBreakpointAsync(document, textSpan.Start, textSpan.Length, cancellationToken)
End Function
Public Function ResolveBreakpointsAsync(
solution As Solution,
name As String,
Optional cancellationToken As CancellationToken = Nothing) As Task(Of IEnumerable(Of BreakpointResolutionResult)) Implements IBreakpointResolutionService.ResolveBreakpointsAsync
Return New BreakpointResolver(solution, name).DoAsync(cancellationToken)
End Function
End Class
End Namespace
|
abock/roslyn
|
src/Features/VisualBasic/Portable/Debugging/VisualBasicBreakpointService.vb
|
Visual Basic
|
mit
| 4,226
|
' 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.EmbeddedLanguages.LanguageServices
Imports Microsoft.CodeAnalysis.Features.EmbeddedLanguages
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.CodeAnalysis.VisualBasic.EmbeddedLanguages.LanguageServices
Namespace Microsoft.CodeAnalysis.VisualBasic.Features.EmbeddedLanguages
<ExportLanguageService(GetType(IEmbeddedLanguagesProvider), LanguageNames.VisualBasic, ServiceLayer.Desktop), [Shared]>
Friend Class VisualBasicEmbeddedLanguageFeaturesProvider
Inherits AbstractEmbeddedLanguageFeaturesProvider
<ImportingConstructor>
<Obsolete(MefConstruction.ImportingConstructorMessage, True)>
Public Sub New()
MyBase.New(VisualBasicEmbeddedLanguagesProvider.Info)
End Sub
Friend Overrides Function EscapeText(text As String, token As SyntaxToken) As String
Return EmbeddedLanguageUtilities.EscapeText(text, token)
End Function
End Class
End Namespace
|
abock/roslyn
|
src/Features/VisualBasic/Portable/EmbeddedLanguages/VisualBasicEmbeddedLanguageFeaturesProvider.vb
|
Visual Basic
|
mit
| 1,210
|
' 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 System.Threading
Imports System.Threading.Tasks
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Shared.Collections
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.Shared.Extensions
Imports System.Collections.Immutable
Namespace Microsoft.CodeAnalysis.CodeCleanup.Providers
<ExportCodeCleanupProvider(PredefinedCodeCleanupProviderNames.NormalizeModifiersOrOperators, LanguageNames.VisualBasic), [Shared]>
<ExtensionOrder(After:=PredefinedCodeCleanupProviderNames.AddMissingTokens, Before:=PredefinedCodeCleanupProviderNames.Format)>
Friend Class NormalizeModifiersOrOperatorsCodeCleanupProvider
Implements ICodeCleanupProvider
Public ReadOnly Property Name As String Implements ICodeCleanupProvider.Name
Get
Return PredefinedCodeCleanupProviderNames.NormalizeModifiersOrOperators
End Get
End Property
Public Async Function CleanupAsync(document As Document, spans As ImmutableArray(Of TextSpan), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Document) Implements ICodeCleanupProvider.CleanupAsync
Dim root = Await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(False)
Dim newRoot = Await CleanupAsync(root, spans, document.Project.Solution.Workspace, cancellationToken).ConfigureAwait(False)
Return If(root Is newRoot, document, document.WithSyntaxRoot(newRoot))
End Function
Public Function CleanupAsync(root As SyntaxNode, spans As ImmutableArray(Of TextSpan), workspace As Workspace, Optional cancellationToken As CancellationToken = Nothing) As Task(Of SyntaxNode) Implements ICodeCleanupProvider.CleanupAsync
Dim rewriter = New Rewriter(spans, cancellationToken)
Dim newRoot = rewriter.Visit(root)
Return Task.FromResult(If(root Is newRoot, root, newRoot))
End Function
Private Class Rewriter
Inherits VisualBasicSyntaxRewriter
' list of modifier syntax kinds in order
' this order will be used when the rewriter re-order modifiers
' PERF: Using UShort instead of SyntaxKind as the element type so that the compiler can use array literal initialization
Private Shared ReadOnly s_modifierKindsInOrder As SyntaxKind() = DirectCast(New UShort() {
SyntaxKind.PartialKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.ProtectedKeyword,
SyntaxKind.PublicKeyword, SyntaxKind.FriendKeyword, SyntaxKind.NotOverridableKeyword, SyntaxKind.OverridableKeyword,
SyntaxKind.MustOverrideKeyword, SyntaxKind.OverloadsKeyword, SyntaxKind.OverridesKeyword, SyntaxKind.MustInheritKeyword,
SyntaxKind.NotInheritableKeyword, SyntaxKind.StaticKeyword, SyntaxKind.SharedKeyword, SyntaxKind.ShadowsKeyword,
SyntaxKind.ReadOnlyKeyword, SyntaxKind.WriteOnlyKeyword, SyntaxKind.DimKeyword, SyntaxKind.ConstKeyword,
SyntaxKind.WithEventsKeyword, SyntaxKind.WideningKeyword, SyntaxKind.NarrowingKeyword, SyntaxKind.CustomKeyword,
SyntaxKind.AsyncKeyword, SyntaxKind.IteratorKeyword},
SyntaxKind())
Private Shared ReadOnly s_removeDimKeywordSet As HashSet(Of SyntaxKind) = New HashSet(Of SyntaxKind)(SyntaxFacts.EqualityComparer) From {
SyntaxKind.PrivateKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.PublicKeyword, SyntaxKind.FriendKeyword,
SyntaxKind.SharedKeyword, SyntaxKind.ShadowsKeyword, SyntaxKind.ReadOnlyKeyword}
Private Shared ReadOnly s_normalizeOperatorsSet As Dictionary(Of SyntaxKind, List(Of SyntaxKind)) = New Dictionary(Of SyntaxKind, List(Of SyntaxKind))(SyntaxFacts.EqualityComparer) From {
{SyntaxKind.LessThanGreaterThanToken, New List(Of SyntaxKind) From {SyntaxKind.GreaterThanToken, SyntaxKind.LessThanToken}},
{SyntaxKind.GreaterThanEqualsToken, New List(Of SyntaxKind) From {SyntaxKind.EqualsToken, SyntaxKind.GreaterThanToken}},
{SyntaxKind.LessThanEqualsToken, New List(Of SyntaxKind) From {SyntaxKind.EqualsToken, SyntaxKind.LessThanToken}}
}
Private ReadOnly _spans As SimpleIntervalTree(Of TextSpan)
Private ReadOnly _cancellationToken As CancellationToken
Public Sub New(spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken)
MyBase.New(visitIntoStructuredTrivia:=True)
_spans = New SimpleIntervalTree(Of TextSpan)(TextSpanIntervalIntrospector.Instance, spans)
_cancellationToken = cancellationToken
End Sub
Public Overrides Function Visit(node As SyntaxNode) As SyntaxNode
_cancellationToken.ThrowIfCancellationRequested()
' if there are no overlapping spans, no need to walk down this node
If node Is Nothing OrElse
Not _spans.HasIntervalThatOverlapsWith(node.FullSpan.Start, node.FullSpan.Length) Then
Return node
End If
' walk down this path
Return MyBase.Visit(node)
End Function
Public Overrides Function VisitModuleStatement(node As ModuleStatementSyntax) As SyntaxNode
Return NormalizeModifiers(node, MyBase.VisitModuleStatement(node), Function(n) n.Modifiers, Function(n, modifiers) n.WithModifiers(modifiers))
End Function
Public Overrides Function VisitStructureStatement(node As StructureStatementSyntax) As SyntaxNode
Return NormalizeModifiers(node, MyBase.VisitStructureStatement(node), Function(n) n.Modifiers, Function(n, modifiers) n.WithModifiers(modifiers))
End Function
Public Overrides Function VisitInterfaceStatement(node As InterfaceStatementSyntax) As SyntaxNode
Return NormalizeModifiers(node, MyBase.VisitInterfaceStatement(node), Function(n) n.Modifiers, Function(n, modifiers) n.WithModifiers(modifiers))
End Function
Public Overrides Function VisitClassStatement(node As ClassStatementSyntax) As SyntaxNode
Return NormalizeModifiers(node, MyBase.VisitClassStatement(node), Function(n) n.Modifiers, Function(n, modifiers) n.WithModifiers(modifiers))
End Function
Public Overrides Function VisitEnumStatement(node As EnumStatementSyntax) As SyntaxNode
Return NormalizeModifiers(node, MyBase.VisitEnumStatement(node), Function(n) n.Modifiers, Function(n, modifiers) n.WithModifiers(modifiers))
End Function
Public Overrides Function VisitMethodStatement(node As MethodStatementSyntax) As SyntaxNode
Return NormalizeModifiers(node, MyBase.VisitMethodStatement(node), Function(n) n.Modifiers, Function(n, modifiers) n.WithModifiers(modifiers))
End Function
Public Overrides Function VisitSubNewStatement(node As SubNewStatementSyntax) As SyntaxNode
Return NormalizeModifiers(node, MyBase.VisitSubNewStatement(node), Function(n) n.Modifiers, Function(n, modifiers) n.WithModifiers(modifiers))
End Function
Public Overrides Function VisitDeclareStatement(node As DeclareStatementSyntax) As SyntaxNode
Return NormalizeModifiers(node, MyBase.VisitDeclareStatement(node), Function(n) n.Modifiers, Function(n, modifiers) n.WithModifiers(modifiers))
End Function
Public Overrides Function VisitDelegateStatement(node As DelegateStatementSyntax) As SyntaxNode
Return NormalizeModifiers(node, MyBase.VisitDelegateStatement(node), Function(n) n.Modifiers, Function(n, modifiers) n.WithModifiers(modifiers))
End Function
Public Overrides Function VisitEventStatement(node As EventStatementSyntax) As SyntaxNode
Return NormalizeModifiers(node, MyBase.VisitEventStatement(node), Function(n) n.Modifiers, Function(n, modifiers) n.WithModifiers(modifiers))
End Function
Public Overrides Function VisitPropertyStatement(node As PropertyStatementSyntax) As SyntaxNode
Return NormalizeModifiers(node, MyBase.VisitPropertyStatement(node), Function(n) n.Modifiers, Function(n, modifiers) n.WithModifiers(modifiers))
End Function
Public Overrides Function VisitAccessorStatement(node As AccessorStatementSyntax) As SyntaxNode
Return NormalizeModifiers(node, MyBase.VisitAccessorStatement(node), Function(n) n.Modifiers, Function(n, modifiers) n.WithModifiers(modifiers))
End Function
Public Overrides Function VisitIncompleteMember(node As IncompleteMemberSyntax) As SyntaxNode
' don't do anything
Return MyBase.VisitIncompleteMember(node)
End Function
Public Overrides Function VisitFieldDeclaration(node As FieldDeclarationSyntax) As SyntaxNode
Return NormalizeModifiers(node, MyBase.VisitFieldDeclaration(node), Function(n) n.Modifiers, Function(n, modifiers) n.WithModifiers(modifiers))
End Function
Public Overrides Function VisitLocalDeclarationStatement(node As LocalDeclarationStatementSyntax) As SyntaxNode
Return NormalizeModifiers(node, MyBase.VisitLocalDeclarationStatement(node), Function(n) n.Modifiers, Function(n, modifiers) n.WithModifiers(modifiers))
End Function
Public Overrides Function VisitParameterList(node As ParameterListSyntax) As SyntaxNode
' whole node must be under the span. otherwise, we just return
Dim newNode = MyBase.VisitParameterList(node)
' bug # 12898
' decide not to automatically remove "ByVal"
#If False Then
Dim span = node.Span
If Not _spans.GetContainingIntervals(span.Start, span.Length).Any() Then
Return newNode
End If
' remove any existing ByVal keyword
Dim currentNode = DirectCast(newNode, ParameterListSyntax)
For i = 0 To node.Parameters.Count - 1
currentNode = RemoveByValKeyword(currentNode, i)
Next
' no changes
If newNode Is currentNode Then
Return newNode
End If
' replace whole parameter list
_textChanges.Add(node.FullSpan, currentNode.GetFullText())
Return currentNode
#End If
Return newNode
End Function
Public Overrides Function VisitLambdaHeader(node As LambdaHeaderSyntax) As SyntaxNode
' lambda can have async and iterator modifiers but we currently don't support those
Return node
End Function
Public Overrides Function VisitOperatorStatement(node As OperatorStatementSyntax) As SyntaxNode
Dim visitedNode = DirectCast(MyBase.VisitOperatorStatement(node), OperatorStatementSyntax)
Dim span = node.Span
If Not _spans.HasIntervalThatContains(span.Start, span.Length) Then
Return visitedNode
End If
' operator sometimes requires a fix up outside of modifiers
Dim fixedUpNode = OperatorStatementSpecialFixup(visitedNode)
' now, normalize modifiers
Dim newNode = NormalizeModifiers(node, fixedUpNode, Function(n) n.Modifiers, Function(n, modifiers) n.WithModifiers(modifiers))
Dim [operator] = NormalizeOperator(
newNode.OperatorToken,
Function(t) t.Kind = SyntaxKind.GreaterThanToken,
Function(t) t.TrailingTrivia,
Function(t) New List(Of SyntaxKind) From {SyntaxKind.LessThanToken},
Function(t, i)
Return t.CopyAnnotationsTo(
SyntaxFactory.Token(
t.LeadingTrivia.Concat(t.TrailingTrivia.Take(i)).ToSyntaxTriviaList(),
SyntaxKind.LessThanGreaterThanToken,
t.TrailingTrivia.Skip(i + 1).ToSyntaxTriviaList()))
End Function)
If [operator].Kind = SyntaxKind.None Then
Return newNode
End If
Return newNode.WithOperatorToken([operator])
End Function
Public Overrides Function VisitBinaryExpression(node As BinaryExpressionSyntax) As SyntaxNode
' normalize binary operators
Dim binaryOperator = DirectCast(MyBase.VisitBinaryExpression(node), BinaryExpressionSyntax)
' quick check. operator must be missing
If Not binaryOperator.OperatorToken.IsMissing Then
Return binaryOperator
End If
Dim span = node.Span
If Not _spans.HasIntervalThatContains(span.Start, span.Length) Then
Return binaryOperator
End If
' and the operator must be one of kinds that we are interested in
Dim [operator] = NormalizeOperator(
binaryOperator.OperatorToken,
Function(t) s_normalizeOperatorsSet.ContainsKey(t.Kind),
Function(t) t.LeadingTrivia,
Function(t) s_normalizeOperatorsSet(t.Kind),
Function(t, i)
Return t.CopyAnnotationsTo(
SyntaxFactory.Token(
t.LeadingTrivia.Take(i).ToSyntaxTriviaList(),
t.Kind,
t.LeadingTrivia.Skip(i + 1).Concat(t.TrailingTrivia).ToSyntaxTriviaList()))
End Function)
If [operator].Kind = SyntaxKind.None Then
Return binaryOperator
End If
Return binaryOperator.WithOperatorToken([operator])
End Function
Public Overrides Function VisitToken(token As SyntaxToken) As SyntaxToken
Dim newToken = MyBase.VisitToken(token)
Dim span = token.Span
If Not _spans.HasIntervalThatContains(span.Start, span.Length) Then
Return newToken
End If
If token.IsMissing OrElse Not (SyntaxFacts.IsOperator(token.Kind) OrElse token.IsKind(SyntaxKind.ColonEqualsToken)) Then
Return newToken
End If
Dim actualText = token.ToString()
Dim expectedText = SyntaxFacts.GetText(token.Kind)
If String.IsNullOrWhiteSpace(expectedText) OrElse actualText = expectedText Then
Return newToken
End If
Return SyntaxFactory.Token(newToken.LeadingTrivia, newToken.Kind, newToken.TrailingTrivia, expectedText)
End Function
''' <summary>
''' this will put operator token and modifier tokens in right order
''' </summary>
Private Function OperatorStatementSpecialFixup(node As OperatorStatementSyntax) As OperatorStatementSyntax
' first check whether operator is missing
If Not node.OperatorToken.IsMissing Then
Return node
End If
' check whether operator has missing stuff in skipped token list
Dim skippedTokens = node.OperatorToken.TrailingTrivia _
.Where(Function(t) t.Kind = SyntaxKind.SkippedTokensTrivia) _
.Select(Function(t) DirectCast(t.GetStructure(), SkippedTokensTriviaSyntax)) _
.SelectMany(Function(t) t.Tokens)
' there must be 2 skipped tokens
If skippedTokens.Count <> 2 Then
Return node
End If
Dim last = skippedTokens.Last()
If Not SyntaxFacts.IsOperatorStatementOperatorToken(last.Kind) Then
Return node
End If
' reorder some tokens
Dim newNode = node.WithModifiers(node.Modifiers.AddRange(skippedTokens.Take(skippedTokens.Count - 1).ToArray())).WithOperatorToken(last)
If Not ValidOperatorStatement(newNode) Then
Return node
End If
Return newNode
End Function
''' <summary>
''' check whether given operator statement is valid or not
''' </summary>
Private Function ValidOperatorStatement(node As OperatorStatementSyntax) As Boolean
Dim parsableStatementText = node.NormalizeWhitespace().ToString()
Dim parsableCompilationUnit = "Class C" + vbCrLf + parsableStatementText + vbCrLf + "End Operator" + vbCrLf + "End Class"
Dim parsedNode = SyntaxFactory.ParseCompilationUnit(parsableCompilationUnit)
Return Not parsedNode.ContainsDiagnostics()
End Function
''' <summary>
''' normalize operator
''' </summary>
Private Function NormalizeOperator(
[operator] As SyntaxToken,
checker As Func(Of SyntaxToken, Boolean),
triviaListGetter As Func(Of SyntaxToken, SyntaxTriviaList),
tokenKindsGetter As Func(Of SyntaxToken, List(Of SyntaxKind)),
operatorCreator As Func(Of SyntaxToken, Integer, SyntaxToken)) As SyntaxToken
If Not checker([operator]) Then
Return Nothing
End If
' now, it should have skipped token trivia in trivia list
Dim skippedTokenTrivia = triviaListGetter([operator]).FirstOrDefault(Function(t) t.Kind = SyntaxKind.SkippedTokensTrivia)
If skippedTokenTrivia.Kind = SyntaxKind.None Then
Return Nothing
End If
' token in the skipped token list must match what we are expecting
Dim skippedTokensList = DirectCast(skippedTokenTrivia.GetStructure(), SkippedTokensTriviaSyntax)
Dim actual = skippedTokensList.Tokens
Dim expected = tokenKindsGetter([operator])
If actual.Count <> expected.Count Then
Return Nothing
End If
Dim i = -1
For Each token In actual
i = i + 1
If token.Kind <> expected(i) Then
Return Nothing
End If
Next
' okay, looks like it is what we are expecting. let's fix it up
' move everything after skippedTokenTrivia to trailing trivia
Dim index = -1
Dim list = triviaListGetter([operator])
For i = 0 To list.Count - 1
If list(i) = skippedTokenTrivia Then
index = i
Exit For
End If
Next
' it must exist
Contract.ThrowIfFalse(index >= 0)
Return operatorCreator([operator], index)
End Function
''' <summary>
''' reorder modifiers in the list
''' </summary>
Private Function ReorderModifiers(modifiers As SyntaxTokenList) As SyntaxTokenList
' quick check - if there is only one or less modifier, return as it is
If modifiers.Count <= 1 Then
Return modifiers
End If
' do quick check to see whether modifiers are already in right order
If AreModifiersInRightOrder(modifiers) Then
Return modifiers
End If
' re-create the list with trivia from old modifier token list
Dim currentModifierIndex = 0
Dim result = New List(Of SyntaxToken)(modifiers.Count)
Dim modifierList = modifiers.ToList()
For Each k In s_modifierKindsInOrder
' we found all modifiers
If currentModifierIndex = modifierList.Count Then
Exit For
End If
Dim tokenInRightOrder = modifierList.FirstOrDefault(Function(m) m.Kind = k)
' if we didn't find, move on to next one
If tokenInRightOrder.Kind = SyntaxKind.None Then
Continue For
End If
' we found a modifier, re-create list in right order with right trivia from right original token
Dim originalToken = modifierList(currentModifierIndex)
result.Add(tokenInRightOrder.With(originalToken.LeadingTrivia, originalToken.TrailingTrivia))
currentModifierIndex += 1
Next
' Verify that all unique modifiers were added to the result.
' The number added to the result count is the duplicate modifier count in the input modifierList.
Debug.Assert(modifierList.Count = result.Count +
modifierList.GroupBy(Function(token) token.Kind).SelectMany(Function(grp) grp.Skip(1)).Count)
Return SyntaxFactory.TokenList(result)
End Function
''' <summary>
''' normalize modifier list of the node and record changes if there is any change
''' </summary>
Private Function NormalizeModifiers(Of T As SyntaxNode)(originalNode As T, node As SyntaxNode, modifiersGetter As Func(Of T, SyntaxTokenList), withModifiers As Func(Of T, SyntaxTokenList, T)) As T
Return NormalizeModifiers(originalNode, DirectCast(node, T), modifiersGetter, withModifiers)
End Function
''' <summary>
''' normalize modifier list of the node and record changes if there is any change
''' </summary>
Private Function NormalizeModifiers(Of T As SyntaxNode)(originalNode As T, node As T, modifiersGetter As Func(Of T, SyntaxTokenList), withModifiers As Func(Of T, SyntaxTokenList, T)) As T
Dim modifiers = modifiersGetter(node)
' if number of modifiers are less than 1, we don't need to do anything
If modifiers.Count <= 1 Then
Return node
End If
' whole node must be under span, otherwise, we will just return
Dim span = originalNode.Span
If Not _spans.HasIntervalThatContains(span.Start, span.Length) Then
Return node
End If
' try normalize modifier list
Dim newNode = withModifiers(node, ReorderModifiers(modifiers))
' new modifier list
Dim newModifiers = modifiersGetter(newNode)
' check whether we need to remove "Dim" keyword or not
If newModifiers.Any(Function(m) s_removeDimKeywordSet.Contains(m.Kind)) Then
newNode = RemoveDimKeyword(newNode, modifiersGetter)
End If
' no change
If newNode Is node Then
Return node
End If
' add text change
Dim originalModifiers = modifiersGetter(originalNode)
Contract.ThrowIfFalse(originalModifiers.Count > 0)
Return newNode
End Function
''' <summary>
''' remove "Dim" keyword if present
''' </summary>
Private Function RemoveDimKeyword(Of T As SyntaxNode)(node As T, modifiersGetter As Func(Of T, SyntaxTokenList)) As T
Return RemoveModifierKeyword(node, modifiersGetter, SyntaxKind.DimKeyword)
End Function
''' <summary>
''' remove ByVal keyword from parameter list
''' </summary>
Private Function RemoveByValKeyword(node As ParameterListSyntax, parameterIndex As Integer) As ParameterListSyntax
Return RemoveModifierKeyword(node, Function(n) n.Parameters(parameterIndex).Modifiers, SyntaxKind.ByValKeyword)
End Function
''' <summary>
''' remove a modifier from the given node
''' </summary>
Private Function RemoveModifierKeyword(Of T As SyntaxNode)(node As T, modifiersGetter As Func(Of T, SyntaxTokenList), modifierKind As SyntaxKind) As T
Dim modifiers = modifiersGetter(node)
' "Dim" doesn't exist
Dim modifier = modifiers.FirstOrDefault(Function(m) m.Kind = modifierKind)
If modifier.Kind = SyntaxKind.None Then
Return node
End If
' merge trivia belong to the modifier to be deleted
Dim trivia = modifier.LeadingTrivia.Concat(modifier.TrailingTrivia)
' we have node which owns tokens around modifiers. just replace tokens in the node in case we need to
' touch tokens outside of the modifier list
Dim previousToken = modifier.GetPreviousToken(includeZeroWidth:=True)
Dim newPreviousToken = previousToken.WithAppendedTrailingTrivia(trivia)
' replace previous token and remove "Dim"
Return node.ReplaceTokens(SpecializedCollections.SingletonEnumerable(modifier).Concat(previousToken),
Function(o, n)
If o = modifier Then
Return Nothing
ElseIf o = previousToken Then
Return newPreviousToken
End If
Return Contract.FailWithReturn(Of SyntaxToken)("shouldn't reach here")
End Function)
End Function
''' <summary>
''' check whether given modifiers are in right order (in sync with ModifierKindsInOrder list)
''' </summary>
Private Function AreModifiersInRightOrder(modifiers As SyntaxTokenList) As Boolean
Dim startIndex = 0
For Each modifier In modifiers
Dim newIndex = s_modifierKindsInOrder.IndexOf(modifier.Kind, startIndex)
If newIndex = 0 AndAlso startIndex = 0 Then
' very first search with matching the very first modifier in the modifier orders
startIndex = newIndex + 1
ElseIf startIndex < newIndex Then
' new one is after the previous one in order
startIndex = newIndex + 1
Else
' oops, in wrong order
Return False
End If
Next
Return True
End Function
End Class
End Class
End Namespace
|
yeaicc/roslyn
|
src/Workspaces/VisualBasic/Portable/CodeCleanup/Providers/NormalizeModifiersOrOperatorsCodeCleanupProvider.vb
|
Visual Basic
|
apache-2.0
| 28,321
|
' 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.Generic
Imports System.Collections.Immutable
Imports System.Runtime.InteropServices
Imports System.Text
Imports System.Threading
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports TypeKind = Microsoft.CodeAnalysis.TypeKind
Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
''' <summary>
''' Represents a type other than an array, a type parameter.
''' </summary>
Friend MustInherit Class NamedTypeSymbol
Inherits TypeSymbol
Implements INamedTypeSymbol
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
' Changes to the public interface of this class should remain synchronized with the C# version.
' Do not make any changes to the public interface without making the corresponding change
' to the C# version.
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
''' <summary>
''' Returns the arity of this type, or the number of type parameters it takes.
''' A non-generic type has zero arity.
''' </summary>
Public MustOverride ReadOnly Property Arity As Integer
''' <summary>
''' Returns the type parameters that this type has. If this is a non-generic type,
''' returns an empty ImmutableArray.
''' </summary>
Public MustOverride ReadOnly Property TypeParameters As ImmutableArray(Of TypeParameterSymbol)
''' <summary>
''' Returns the type arguments that have been substituted for the type parameters.
''' If nothing has been substituted for a give type parameters,
''' then the type parameter itself is consider the type argument.
''' </summary>
Public ReadOnly Property TypeArguments As ImmutableArray(Of TypeSymbol)
Get
Return TypeArgumentsNoUseSiteDiagnostics
End Get
End Property
''' <summary>
''' Returns custom modifiers for the type argument that has been substituted for the type parameter.
''' The modifiers correspond to the type argument at the same ordinal within the <see cref="TypeArgumentsNoUseSiteDiagnostics"/>
''' array.
''' </summary>
Public MustOverride Function GetTypeArgumentCustomModifiers(ordinal As Integer) As ImmutableArray(Of CustomModifier)
Friend Function GetEmptyTypeArgumentCustomModifiers(ordinal As Integer) As ImmutableArray(Of CustomModifier)
If ordinal < 0 OrElse ordinal >= Me.Arity Then
Throw New IndexOutOfRangeException()
End If
Return ImmutableArray(Of CustomModifier).Empty
End Function
Friend MustOverride ReadOnly Property HasTypeArgumentsCustomModifiers As Boolean
Friend MustOverride ReadOnly Property TypeArgumentsNoUseSiteDiagnostics As ImmutableArray(Of TypeSymbol)
Friend Function TypeArgumentsWithDefinitionUseSiteDiagnostics(<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)) As ImmutableArray(Of TypeSymbol)
Dim result = TypeArgumentsNoUseSiteDiagnostics
For Each typeArgument In result
typeArgument.OriginalDefinition.AddUseSiteDiagnostics(useSiteDiagnostics)
Next
Return result
End Function
Friend Function TypeArgumentWithDefinitionUseSiteDiagnostics(index As Integer, <[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)) As TypeSymbol
Dim result = TypeArgumentsNoUseSiteDiagnostics(index)
result.OriginalDefinition.AddUseSiteDiagnostics(useSiteDiagnostics)
Return result
End Function
''' <summary>
''' Returns the type symbol that this type was constructed from. This type symbol
''' has the same containing type, but has type arguments that are the same
''' as the type parameters (although its containing type might not).
''' </summary>
Public MustOverride ReadOnly Property ConstructedFrom As NamedTypeSymbol
''' <summary>
''' For enum types, gets the underlying type. Returns null on all other
''' kinds of types.
''' </summary>
Public Overridable ReadOnly Property EnumUnderlyingType As NamedTypeSymbol
Get
Return Nothing
End Get
End Property
Public Overrides ReadOnly Property ContainingType As NamedTypeSymbol
Get
Return TryCast(Me.ContainingSymbol, NamedTypeSymbol)
End Get
End Property
''' <summary>
''' For implicitly declared delegate types returns the EventSymbol that caused this
''' delegate type to be generated.
''' For all other types returns null.
''' Note, the set of possible associated symbols might be expanded in the future to
''' reflect changes in the languages.
''' </summary>
Public Overridable ReadOnly Property AssociatedSymbol As Symbol
Get
Return Nothing
End Get
End Property
''' <summary>
''' Returns True for one of the types from a set of Structure types if
''' that set represents a cycle. This property is intended for flow
''' analysis only since it is only implemented for source types,
''' and only returns True for one of the types within a cycle, not all.
''' </summary>
Friend Overridable ReadOnly Property KnownCircularStruct As Boolean
Get
Return False
End Get
End Property
''' <summary>
''' Is this a NoPia local type explicitly declared in source, i.e.
''' top level type with a TypeIdentifier attribute on it?
''' </summary>
Friend Overridable ReadOnly Property IsExplicitDefinitionOfNoPiaLocalType As Boolean
Get
Return False
End Get
End Property
''' <summary>
''' Returns true and a string from the first GuidAttribute on the type,
''' the string might be null or an invalid guid representation. False,
''' if there is no GuidAttribute with string argument.
''' </summary>
Friend Overridable Function GetGuidString(ByRef guidString As String) As Boolean
Return GetGuidStringDefaultImplementation(guidString)
End Function
' Named types have the arity suffix added to the metadata name.
Public Overrides ReadOnly Property MetadataName As String
Get
' CLR generally allows names with dots, however some APIs like IMetaDataImport
' can only return full type names combined with namespaces.
' see: http://msdn.microsoft.com/en-us/library/ms230143.aspx (IMetaDataImport::GetTypeDefProps)
' When working with such APIs, names with dots become ambiguous since metadata
' consumer cannot figure where namespace ends and actual type name starts.
' Therefore it is a good practice to avoid type names with dots.
Debug.Assert(Me.IsErrorType OrElse Not (TypeOf Me Is SourceNamedTypeSymbol) OrElse Not Name.Contains("."), "type name contains dots: " + Name)
Return If(MangleName, MetadataHelpers.ComposeAritySuffixedMetadataName(Name, Arity), Name)
End Get
End Property
''' <summary>
''' True if the type itself Is excluded from code covarage instrumentation.
''' True for source types marked with <see cref="AttributeDescription.ExcludeFromCodeCoverageAttribute"/>.
''' </summary>
Friend Overridable ReadOnly Property IsDirectlyExcludedFromCodeCoverage As Boolean
Get
Return False
End Get
End Property
''' <summary>
''' Should the name returned by Name property be mangled with [`arity] suffix in order to get metadata name.
''' Must return False for a type with Arity == 0.
''' </summary>
''' <remarks>
''' Default implementation to force consideration of appropriate implementation for each new subclass
''' </remarks>
Friend MustOverride ReadOnly Property MangleName As Boolean
''' <summary>
''' True if this symbol has a special name (metadata flag SpecialName is set).
''' </summary>
Friend MustOverride ReadOnly Property HasSpecialName As Boolean
''' <summary>
''' True if this type is considered serializable (metadata flag Serializable is set).
''' </summary>
Friend MustOverride ReadOnly Property IsSerializable As Boolean
''' <summary>
''' Type layout information (ClassLayout metadata and layout kind flags).
''' </summary>
Friend MustOverride ReadOnly Property Layout As TypeLayout
''' <summary>
''' The default charset used for type marshalling.
''' Can be changed via <see cref="DefaultCharSetAttribute"/> applied on the containing module.
''' </summary>
Protected ReadOnly Property DefaultMarshallingCharSet As CharSet
Get
Return If(EffectiveDefaultMarshallingCharSet, CharSet.Ansi)
End Get
End Property
''' <summary>
''' Marshalling charset of string data fields within the type (string formatting flags in metadata).
''' </summary>
Friend MustOverride ReadOnly Property MarshallingCharSet As CharSet
''' <summary>
''' For delegate types, gets the delegate's invoke method. Returns null on
''' all other kinds of types. Note that it is possible to have an ill-formed
''' delegate type imported from metadata which does not have an Invoke method.
''' Such a type will be classified as a delegate but its DelegateInvokeMethod
''' would be null.
''' </summary>
Public Overridable ReadOnly Property DelegateInvokeMethod As MethodSymbol
Get
If TypeKind <> TypeKind.Delegate Then
Return Nothing
End If
Dim methods As ImmutableArray(Of Symbol) = GetMembers(WellKnownMemberNames.DelegateInvokeName)
If methods.Length <> 1 Then
Return Nothing
End If
Dim method = TryCast(methods(0), MethodSymbol)
'EDMAURER we used to also check 'method.IsOverridable' because section 13.6
'of the CLI spec dictates that it be virtual, but real world
'working metadata has been found that contains an Invoke method that is
'marked as virtual but not newslot (both of those must be combined to
'meet the definition of virtual). Rather than weaken the check
'I've removed it, as the Dev10 C# compiler makes no check, and we don't
'stand to gain anything by having it.
'Return If(method IsNot Nothing AndAlso method.IsOverridable, method, Nothing)
Return method
End Get
End Property
''' <summary>
''' Returns true if this type was declared as requiring a derived class;
''' i.e., declared with the "MustInherit" modifier. Always true for interfaces.
''' </summary>
Public MustOverride ReadOnly Property IsMustInherit As Boolean
''' <summary>
''' Returns true if this type does not allow derived types; i.e., declared
''' with the NotInheritable modifier, or else declared as a Module, Structure,
''' Enum, or Delegate.
''' </summary>
Public MustOverride ReadOnly Property IsNotInheritable As Boolean
''' <summary>
''' If this property returns false, it is certain that there are no extension
''' methods inside this type. If this property returns true, it is highly likely
''' (but not certain) that this type contains extension methods. This property allows
''' the search for extension methods to be narrowed much more quickly.
'''
''' !!! Note that this property can mutate during lifetime of the symbol !!!
''' !!! from True to False, as we learn more about the type. !!!
''' </summary>
Public MustOverride ReadOnly Property MightContainExtensionMethods As Boolean Implements INamedTypeSymbol.MightContainExtensionMethods
''' <summary>
''' Returns True if the type is marked by 'Microsoft.CodeAnalysis.Embedded' attribute.
''' </summary>
Friend MustOverride ReadOnly Property HasCodeAnalysisEmbeddedAttribute As Boolean
''' <summary>
''' Returns True if the type is marked by 'Microsoft.VisualBasic.Embedded' attribute.
''' </summary>
Friend MustOverride ReadOnly Property HasVisualBasicEmbeddedAttribute As Boolean
''' <summary>
''' A Named type is an extensible interface if both the following are true:
''' (a) It is an interface type and
''' (b) It is either marked with 'TypeLibTypeAttribute( flags w/o TypeLibTypeFlags.FNonExtensible )' attribute OR
''' is marked with 'InterfaceTypeAttribute( flags with ComInterfaceType.InterfaceIsIDispatch )' attribute OR
''' inherits from an extensible interface type.
''' Member resolution for Extensible interfaces is late bound, i.e. members are resolved at run time by looking up the identifier on the actual run-time type of the expression.
''' </summary>
Friend MustOverride ReadOnly Property IsExtensibleInterfaceNoUseSiteDiagnostics As Boolean
''' <summary>
''' This method is an entry point for the Binder to collect extension methods with the given name
''' declared within this named type. Overridden by RetargetingNamedTypeSymbol.
''' </summary>
Friend Overridable Sub AppendProbableExtensionMethods(name As String, methods As ArrayBuilder(Of MethodSymbol))
If Me.MightContainExtensionMethods Then
For Each member As Symbol In Me.GetMembers(name)
If member.Kind = SymbolKind.Method Then
Dim method = DirectCast(member, MethodSymbol)
If method.MayBeReducibleExtensionMethod Then
methods.Add(method)
End If
End If
Next
End If
End Sub
''' <summary>
''' This method is called for a type within a namespace when we are building a map of extension methods
''' for the whole (compilation merged or module level) namespace.
'''
''' The 'appendThrough' parameter allows RetargetingNamespaceSymbol to delegate majority of the work
''' to the underlying named type symbols, but still add RetargetingMethodSymbols to the map.
''' </summary>
Friend Overridable Sub BuildExtensionMethodsMap(
map As Dictionary(Of String, ArrayBuilder(Of MethodSymbol)),
appendThrough As NamespaceSymbol
)
If Me.MightContainExtensionMethods Then
Debug.Assert(False, "Possibly using inefficient implementation of AppendProbableExtensionMethods(map As Dictionary(Of String, ArrayBuilder(Of MethodSymbol)))")
appendThrough.BuildExtensionMethodsMap(map,
From name As String In Me.MemberNames
Select New KeyValuePair(Of String, ImmutableArray(Of Symbol))(name, Me.GetMembers(name)))
End If
End Sub
Friend Overridable Sub GetExtensionMethods(
methods As ArrayBuilder(Of MethodSymbol),
appendThrough As NamespaceSymbol,
Name As String
)
If Me.MightContainExtensionMethods Then
Dim candidates = Me.GetSimpleNonTypeMembers(Name)
For Each member In candidates
appendThrough.AddMemberIfExtension(methods, member)
Next
End If
End Sub
''' <summary>
''' This is an entry point for the Binder. Its purpose is to add names of viable extension methods declared
''' in this type to nameSet parameter.
''' </summary>
Friend Overridable Overloads Sub AddExtensionMethodLookupSymbolsInfo(nameSet As LookupSymbolsInfo,
options As LookupOptions,
originalBinder As Binder)
AddExtensionMethodLookupSymbolsInfo(nameSet, options, originalBinder, appendThrough:=Me)
End Sub
''' <summary>
''' Add names of viable extension methods declared in this type to nameSet parameter.
'''
''' The 'appendThrough' parameter allows RetargetingNamedTypeSymbol to delegate majority of the work
''' to the underlying named type symbol, but still perform viability check on RetargetingMethodSymbol.
''' </summary>
Friend Overridable Overloads Sub AddExtensionMethodLookupSymbolsInfo(nameSet As LookupSymbolsInfo,
options As LookupOptions,
originalBinder As Binder,
appendThrough As NamedTypeSymbol)
If Me.MightContainExtensionMethods Then
Debug.Assert(False, "Possibly using inefficient implementation of AppendExtensionMethodNames(nameSet As HashSet(Of String), options As LookupOptions, originalBinder As Binder, appendThrough As NamespaceOrTypeSymbol)")
appendThrough.AddExtensionMethodLookupSymbolsInfo(nameSet, options, originalBinder,
From name As String In Me.MemberNames
Select New KeyValuePair(Of String, ImmutableArray(Of Symbol))(name, Me.GetMembers(name)))
End If
End Sub
''' <summary>
''' Get the instance constructors for this type.
''' </summary>
Public ReadOnly Property InstanceConstructors As ImmutableArray(Of MethodSymbol)
Get
Return GetConstructors(Of MethodSymbol)(includeInstance:=True, includeShared:=False)
End Get
End Property
''' <summary>
''' Get the shared constructors for this type.
''' </summary>
Public ReadOnly Property SharedConstructors As ImmutableArray(Of MethodSymbol)
Get
Return GetConstructors(Of MethodSymbol)(includeInstance:=False, includeShared:=True)
End Get
End Property
''' <summary>
''' Get the instance and shared constructors for this type.
''' </summary>
Public ReadOnly Property Constructors As ImmutableArray(Of MethodSymbol)
Get
Return GetConstructors(Of MethodSymbol)(includeInstance:=True, includeShared:=True)
End Get
End Property
Private Function GetConstructors(Of TMethodSymbol As {IMethodSymbol, Class})(includeInstance As Boolean, includeShared As Boolean) As ImmutableArray(Of TMethodSymbol)
Debug.Assert(includeInstance OrElse includeShared)
Dim instanceCandidates As ImmutableArray(Of Symbol) = If(includeInstance, GetMembers(WellKnownMemberNames.InstanceConstructorName), ImmutableArray(Of Symbol).Empty)
Dim sharedCandidates As ImmutableArray(Of Symbol) = If(includeShared, GetMembers(WellKnownMemberNames.StaticConstructorName), ImmutableArray(Of Symbol).Empty)
If instanceCandidates.IsEmpty AndAlso sharedCandidates.IsEmpty Then
Return ImmutableArray(Of TMethodSymbol).Empty
End If
Dim constructors As ArrayBuilder(Of TMethodSymbol) = ArrayBuilder(Of TMethodSymbol).GetInstance()
For Each candidate In instanceCandidates
If candidate.Kind = SymbolKind.Method Then
Dim method As TMethodSymbol = TryCast(candidate, TMethodSymbol)
Debug.Assert(method IsNot Nothing)
Debug.Assert(method.MethodKind = MethodKind.Constructor)
constructors.Add(method)
End If
Next
For Each candidate In sharedCandidates
If candidate.Kind = SymbolKind.Method Then
Dim method As TMethodSymbol = TryCast(candidate, TMethodSymbol)
Debug.Assert(method IsNot Nothing)
Debug.Assert(method.MethodKind = MethodKind.StaticConstructor)
constructors.Add(method)
End If
Next
Return constructors.ToImmutableAndFree()
End Function
''' <summary>
''' Returns true if this type is known to be a reference type. It is never the case
''' that IsReferenceType and IsValueType both return true. However, for an unconstrained
''' type parameter, IsReferenceType and IsValueType will both return false.
''' </summary>
Public Overrides ReadOnly Property IsReferenceType As Boolean
Get
' TODO: Is this correct for VB Module?
Return TypeKind <> TypeKind.Enum AndAlso TypeKind <> TypeKind.Structure AndAlso
TypeKind <> TypeKind.Error
End Get
End Property
''' <summary>
''' Returns true if this type is known to be a value type. It is never the case
''' that IsReferenceType and IsValueType both return true. However, for an unconstrained
''' type parameter, IsReferenceType and IsValueType will both return false.
''' </summary>
Public Overrides ReadOnly Property IsValueType As Boolean
Get
' TODO: Is this correct for VB Module?
Return TypeKind = TypeKind.Enum OrElse TypeKind = TypeKind.Structure
End Get
End Property
''' <summary>
''' Returns True if this types has Arity >= 1 and Construct can be called. This is primarily useful
''' when deal with error cases.
''' </summary>
Friend MustOverride ReadOnly Property CanConstruct As Boolean
''' <summary>
''' Returns a constructed type given its type arguments.
''' </summary>
Public Function Construct(ParamArray typeArguments() As TypeSymbol) As NamedTypeSymbol
Return Construct(typeArguments.AsImmutableOrNull())
End Function
''' <summary>
''' Returns a constructed type given its type arguments.
''' </summary>
Public Function Construct(typeArguments As IEnumerable(Of TypeSymbol)) As NamedTypeSymbol
Return Construct(typeArguments.AsImmutableOrNull())
End Function
''' <summary>
''' Construct a new type from this type, substituting the given type arguments for the
''' type parameters. This method should only be called if this named type does not have
''' any substitutions applied for its own type arguments with exception of alpha-rename
''' substitution (although it's container might have substitutions applied).
''' </summary>
''' <param name="typeArguments">A set of type arguments to be applied. Must have the same length
''' as the number of type parameters that this type has.</param>
Public MustOverride Function Construct(typeArguments As ImmutableArray(Of TypeSymbol)) As NamedTypeSymbol
''' <summary> Checks for validity of Construct(...) on this type with these type arguments. </summary>
Protected Sub CheckCanConstructAndTypeArguments(typeArguments As ImmutableArray(Of TypeSymbol))
'This helper is used by Public APIs to perform validation. This exception is part of the public
'contract of Construct()
If Not CanConstruct OrElse Me IsNot ConstructedFrom Then
Throw New InvalidOperationException()
End If
' Check type arguments
typeArguments.CheckTypeArguments(Me.Arity)
End Sub
''' <summary>
''' Construct a new type from this type definition, substituting the given type arguments for the
''' type parameters. This method should only be called on the OriginalDefinition. Unlike previous
''' Construct method, this overload supports type parameter substitution on this type and any number
''' of its containing types. See comments for TypeSubstitution type for more information.
''' </summary>
Friend Function Construct(substitution As TypeSubstitution) As NamedTypeSymbol
Debug.Assert(Me.IsDefinition)
Debug.Assert(Me.IsOrInGenericType())
If substitution Is Nothing Then
Return Me
End If
Debug.Assert(substitution.IsValidToApplyTo(Me))
' Validate the map for use of alpha-renamed type parameters.
substitution.ThrowIfSubstitutingToAlphaRenamedTypeParameter()
Return DirectCast(InternalSubstituteTypeParameters(substitution).AsTypeSymbolOnly(), NamedTypeSymbol)
End Function
''' <summary>
''' Returns an unbound generic type of this generic named type.
''' </summary>
Public Function ConstructUnboundGenericType() As NamedTypeSymbol
Return Me.AsUnboundGenericType()
End Function
''' <summary>
''' Returns Default property name for the type.
''' If there is no default property name, then Nothing is returned.
''' </summary>
Friend MustOverride ReadOnly Property DefaultPropertyName As String
''' <summary>
''' If this is a generic type instantiation or a nested type of a generic type instantiation,
''' return TypeSubstitution for this construction. Nothing otherwise.
''' Returned TypeSubstitution should target OriginalDefinition of the symbol.
''' </summary>
Friend MustOverride ReadOnly Property TypeSubstitution As TypeSubstitution
' These properties of TypeRef, NamespaceOrType, or Symbol must be overridden.
''' <summary>
''' Gets the name of this symbol.
''' </summary>
Public MustOverride Overrides ReadOnly Property Name As String
''' <summary>
''' Collection of names of members declared within this type.
''' </summary>
Public MustOverride ReadOnly Property MemberNames As IEnumerable(Of String)
''' <summary>
''' Returns true if the type is a Script class.
''' It might be an interactive submission class or a Script class in a csx file.
''' </summary>
Public Overridable ReadOnly Property IsScriptClass As Boolean
Get
Return False
End Get
End Property
''' <summary>
''' Returns true if the type is a submission class.
''' </summary>
Public ReadOnly Property IsSubmissionClass As Boolean
Get
Return TypeKind = TypeKind.Submission
End Get
End Property
Friend Function GetScriptConstructor() As SynthesizedConstructorBase
Debug.Assert(IsScriptClass)
Return DirectCast(InstanceConstructors.Single(), SynthesizedConstructorBase)
End Function
Friend Function GetScriptInitializer() As SynthesizedInteractiveInitializerMethod
Debug.Assert(IsScriptClass)
Return DirectCast(GetMembers(SynthesizedInteractiveInitializerMethod.InitializerName).Single(), SynthesizedInteractiveInitializerMethod)
End Function
Friend Function GetScriptEntryPoint() As SynthesizedEntryPointSymbol
Debug.Assert(IsScriptClass)
Dim name = If(TypeKind = TypeKind.Submission, SynthesizedEntryPointSymbol.FactoryName, SynthesizedEntryPointSymbol.MainName)
Return DirectCast(GetMembers(name).Single(), SynthesizedEntryPointSymbol)
End Function
''' <summary>
''' Returns true if the type is the implicit class that holds onto invalid global members (like methods or
''' statements in a non script file).
''' </summary>
Public Overridable ReadOnly Property IsImplicitClass As Boolean
Get
Return False
End Get
End Property
''' <summary>
''' Get all the members of this symbol.
''' </summary>
''' <returns>An ImmutableArray containing all the members of this symbol. If this symbol has no members,
''' returns an empty ImmutableArray. Never returns Nothing.</returns>
Public MustOverride Overrides Function GetMembers() As ImmutableArray(Of Symbol)
''' <summary>
''' Get all the members of this symbol that have a particular name.
''' </summary>
''' <returns>An ImmutableArray containing all the members of this symbol with the given name. If there are
''' no members with this name, returns an empty ImmutableArray. Never returns Nothing.</returns>
Public MustOverride Overrides Function GetMembers(name As String) As ImmutableArray(Of Symbol)
''' <summary>
''' Get all the members of this symbol that are types.
''' </summary>
''' <returns>An ImmutableArray containing all the types that are members of this symbol. If this symbol has no type members,
''' returns an empty ImmutableArray. Never returns Nothing.</returns>
Public MustOverride Overrides Function GetTypeMembers() As ImmutableArray(Of NamedTypeSymbol)
''' <summary>
''' Get all the members of this symbol that are types that have a particular name, and any arity.
''' </summary>
''' <returns>An ImmutableArray containing all the types that are members of this symbol with the given name.
''' If this symbol has no type members with this name,
''' returns an empty ImmutableArray. Never returns Nothing.</returns>
Public MustOverride Overrides Function GetTypeMembers(name As String) As ImmutableArray(Of NamedTypeSymbol)
''' <summary>
''' Get all the members of this symbol that are types that have a particular name and arity.
''' </summary>
''' <returns>An ImmutableArray containing all the types that are members of this symbol with the given name and arity.
''' If this symbol has no type members with this name and arity,
''' returns an empty ImmutableArray. Never returns Nothing.</returns>
Public MustOverride Overrides Function GetTypeMembers(name As String, arity As Integer) As ImmutableArray(Of NamedTypeSymbol)
''' <summary>
''' Get this accessibility that was declared on this symbol. For symbols that do
''' not have accessibility declared on them, returns NotApplicable.
''' </summary>
Public MustOverride Overrides ReadOnly Property DeclaredAccessibility As Accessibility
''' <summary>
''' Supports visitor pattern.
''' </summary>
Friend Overrides Function Accept(Of TArgument, TResult)(visitor As VisualBasicSymbolVisitor(Of TArgument, TResult), arg As TArgument) As TResult
Return visitor.VisitNamedType(Me, arg)
End Function
' Only the compiler can created NamedTypeSymbols.
Friend Sub New()
End Sub
''' <summary>
''' Gets the kind of this symbol.
''' </summary>
Public Overrides ReadOnly Property Kind As SymbolKind ' Cannot seal this method because of the ErrorSymbol.
Get
Return SymbolKind.NamedType
End Get
End Property
''' <summary>
''' Returns a flag indicating whether this symbol is ComImport.
''' </summary>
''' <remarks>
''' A type can me marked as a ComImport type in source by applying the <see cref="System.Runtime.InteropServices.ComImportAttribute"/>
''' </remarks>
Friend MustOverride ReadOnly Property IsComImport As Boolean
''' <summary>
''' If CoClassAttribute was applied to the type returns the type symbol for the argument.
''' Type symbol may be an error type if the type was not found. Otherwise returns Nothing
''' </summary>
Friend MustOverride ReadOnly Property CoClassType As TypeSymbol
''' <summary>
''' Returns a sequence of preprocessor symbols specified in <see cref="ConditionalAttribute"/> applied on this symbol, or null if there are none.
''' </summary>
Friend MustOverride Function GetAppliedConditionalSymbols() As ImmutableArray(Of String)
''' <summary>
''' Returns a flag indicating whether this symbol has at least one applied conditional attribute.
''' </summary>
''' <remarks>
''' Forces binding and decoding of attributes.
''' NOTE: Conditional symbols on base type must be inherited by derived type, but the native VB compiler doesn't do so. We maintain compatibility.
''' </remarks>
Friend ReadOnly Property IsConditional As Boolean
Get
Return Me.GetAppliedConditionalSymbols().Any()
End Get
End Property
Friend Overridable ReadOnly Property AreMembersImplicitlyDeclared As Boolean
Get
Return False
End Get
End Property
''' <summary>
''' Gets the associated <see cref="AttributeUsageInfo"/> for an attribute type.
''' </summary>
Friend MustOverride Function GetAttributeUsageInfo() As AttributeUsageInfo
''' <summary>
''' Declaration security information associated with this type, or null if there is none.
''' </summary>
Friend MustOverride Function GetSecurityInformation() As IEnumerable(Of Microsoft.Cci.SecurityAttribute)
''' <summary>
''' True if the type has declarative security information (HasSecurity flags).
''' </summary>
Friend MustOverride ReadOnly Property HasDeclarativeSecurity As Boolean
'This represents the declared base type and base interfaces, once bound.
Private _lazyDeclaredBase As NamedTypeSymbol = ErrorTypeSymbol.UnknownResultType
Private _lazyDeclaredInterfaces As ImmutableArray(Of NamedTypeSymbol) = Nothing
''' <summary>
''' NamedTypeSymbol calls derived implementations of this method when declared base type
''' is needed for the first time.
'''
''' basesBeingResolved are passed if there are any types already have their bases resolved
''' so that the derived implementation could avoid infinite recursion
''' </summary>
Friend MustOverride Function MakeDeclaredBase(basesBeingResolved As ConsList(Of Symbol), diagnostics As DiagnosticBag) As NamedTypeSymbol
''' <summary>
''' NamedTypeSymbol calls derived implementations of this method when declared interfaces
''' are needed for the first time.
'''
''' basesBeingResolved are passed if there are any types already have their bases resolved
''' so that the derived implementation could avoid infinite recursion
''' </summary>
Friend MustOverride Function MakeDeclaredInterfaces(basesBeingResolved As ConsList(Of Symbol), diagnostics As DiagnosticBag) As ImmutableArray(Of NamedTypeSymbol)
''' <summary>
''' Base type as "declared".
''' Declared base type may contain circularities.
'''
''' If DeclaredBase must be accessed while other DeclaredBases are being resolved,
''' the bases that are being resolved must be specified here to prevent potential infinite recursion.
''' </summary>
Friend Overridable Function GetDeclaredBase(basesBeingResolved As ConsList(Of Symbol)) As NamedTypeSymbol
If _lazyDeclaredBase Is ErrorTypeSymbol.UnknownResultType Then
Dim diagnostics = DiagnosticBag.GetInstance()
AtomicStoreReferenceAndDiagnostics(_lazyDeclaredBase, MakeDeclaredBase(basesBeingResolved, diagnostics), diagnostics, ErrorTypeSymbol.UnknownResultType)
diagnostics.Free()
End If
Return _lazyDeclaredBase
End Function
Friend Overridable Function GetSimpleNonTypeMembers(name As String) As ImmutableArray(Of Symbol)
Return GetMembers(name)
End Function
Private Sub AtomicStoreReferenceAndDiagnostics(Of T As Class)(ByRef variable As T,
value As T,
diagBag As DiagnosticBag,
Optional comparand As T = Nothing)
Debug.Assert(value IsNot comparand)
If diagBag Is Nothing OrElse diagBag.IsEmptyWithoutResolution Then
Interlocked.CompareExchange(variable, value, comparand)
Else
Dim sourceModule = TryCast(Me.ContainingModule, SourceModuleSymbol)
If sourceModule IsNot Nothing Then
sourceModule.AtomicStoreReferenceAndDiagnostics(variable, value, diagBag, CompilationStage.Declare, comparand)
End If
End If
End Sub
Friend Sub AtomicStoreArrayAndDiagnostics(Of T)(ByRef variable As ImmutableArray(Of T),
value As ImmutableArray(Of T),
diagBag As DiagnosticBag)
Debug.Assert(Not value.IsDefault)
If diagBag Is Nothing OrElse diagBag.IsEmptyWithoutResolution Then
ImmutableInterlocked.InterlockedCompareExchange(variable, value, Nothing)
Else
Dim sourceModule = TryCast(Me.ContainingModule, SourceModuleSymbol)
If sourceModule IsNot Nothing Then
sourceModule.AtomicStoreArrayAndDiagnostics(variable, value, diagBag, CompilationStage.Declare)
End If
End If
End Sub
''' <summary>
''' Interfaces as "declared".
''' Declared interfaces may contain circularities.
'''
''' If DeclaredInterfaces must be accessed while other DeclaredInterfaces are being resolved,
''' the bases that are being resolved must be specified here to prevent potential infinite recursion.
''' </summary>
Friend Overridable Function GetDeclaredInterfacesNoUseSiteDiagnostics(basesBeingResolved As ConsList(Of Symbol)) As ImmutableArray(Of NamedTypeSymbol)
If _lazyDeclaredInterfaces.IsDefault Then
Dim diagnostics = DiagnosticBag.GetInstance()
AtomicStoreArrayAndDiagnostics(_lazyDeclaredInterfaces, MakeDeclaredInterfaces(basesBeingResolved, diagnostics), diagnostics)
diagnostics.Free()
End If
Return _lazyDeclaredInterfaces
End Function
Friend Function GetDeclaredInterfacesWithDefinitionUseSiteDiagnostics(basesBeingResolved As ConsList(Of Symbol), <[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)) As ImmutableArray(Of NamedTypeSymbol)
Dim result = GetDeclaredInterfacesNoUseSiteDiagnostics(basesBeingResolved)
For Each iface In result
iface.OriginalDefinition.AddUseSiteDiagnostics(useSiteDiagnostics)
Next
Return result
End Function
Friend Function GetDirectBaseInterfacesNoUseSiteDiagnostics(basesBeingResolved As ConsList(Of Symbol)) As ImmutableArray(Of NamedTypeSymbol)
If Me.TypeKind = TypeKind.Interface Then
If basesBeingResolved Is Nothing Then
Return Me.InterfacesNoUseSiteDiagnostics
Else
Return GetDeclaredBaseInterfacesSafe(basesBeingResolved)
End If
Else
Return ImmutableArray(Of NamedTypeSymbol).Empty
End If
End Function
Friend Overridable Function GetDeclaredBaseInterfacesSafe(basesBeingResolved As ConsList(Of Symbol)) As ImmutableArray(Of NamedTypeSymbol)
Debug.Assert(basesBeingResolved.Any)
If basesBeingResolved.Contains(Me) Then
Return Nothing
End If
Return GetDeclaredInterfacesNoUseSiteDiagnostics(If(basesBeingResolved, ConsList(Of Symbol).Empty).Prepend(Me))
End Function
''' <summary>
''' NamedTypeSymbol calls derived implementations of this method when acyclic base type
''' is needed for the first time.
''' This method typically calls GetDeclaredBase, filters for
''' illegal cycles and other conditions before returning result as acyclic.
''' </summary>
Friend MustOverride Function MakeAcyclicBaseType(diagnostics As DiagnosticBag) As NamedTypeSymbol
''' <summary>
''' NamedTypeSymbol calls derived implementations of this method when acyclic base interfaces
''' are needed for the first time.
''' This method typically calls GetDeclaredInterfaces, filters for
''' illegal cycles and other conditions before returning result as acyclic.
''' </summary>
Friend MustOverride Function MakeAcyclicInterfaces(diagnostics As DiagnosticBag) As ImmutableArray(Of NamedTypeSymbol)
Private _lazyBaseType As NamedTypeSymbol = ErrorTypeSymbol.UnknownResultType
Private _lazyInterfaces As ImmutableArray(Of NamedTypeSymbol)
''' <summary>
''' Base type.
''' Could be Nothing for Interfaces or Object.
''' </summary>
Friend NotOverridable Overrides ReadOnly Property BaseTypeNoUseSiteDiagnostics As NamedTypeSymbol
Get
If Me._lazyBaseType Is ErrorTypeSymbol.UnknownResultType Then
' force resolution of bases in containing type
' to make base resolution errors more deterministic
If ContainingType IsNot Nothing Then
Dim tmp = ContainingType.BaseTypeNoUseSiteDiagnostics
End If
Dim diagnostics = DiagnosticBag.GetInstance
Dim acyclicBase = Me.MakeAcyclicBaseType(diagnostics)
AtomicStoreReferenceAndDiagnostics(Me._lazyBaseType, acyclicBase, diagnostics, ErrorTypeSymbol.UnknownResultType)
diagnostics.Free()
End If
Return Me._lazyBaseType
End Get
End Property
''' <summary>
''' Interfaces that are implemented or inherited (if current type is interface itself).
''' </summary>
Friend NotOverridable Overrides ReadOnly Property InterfacesNoUseSiteDiagnostics As ImmutableArray(Of NamedTypeSymbol)
Get
If Me._lazyInterfaces.IsDefault Then
Dim diagnostics As DiagnosticBag = DiagnosticBag.GetInstance
Dim acyclicInterfaces As ImmutableArray(Of NamedTypeSymbol) = Me.MakeAcyclicInterfaces(diagnostics)
AtomicStoreArrayAndDiagnostics(Me._lazyInterfaces, acyclicInterfaces, diagnostics)
diagnostics.Free()
End If
Return Me._lazyInterfaces
End Get
End Property
''' <summary>
''' Returns declared base type or actual base type if already known
''' This is only used by cycle detection code so that it can observe when cycles are broken
''' while not forcing actual Base to be realized.
''' </summary>
Friend Function GetBestKnownBaseType() As NamedTypeSymbol
'NOTE: we can be at race with another thread here.
' the worst thing that can happen though, is that error on same cycle may be reported twice
' if two threads analyze the same cycle at the same time but start from different ends.
'
' For now we decided that this is something we can live with.
Dim base = Me._lazyBaseType
If base IsNot ErrorTypeSymbol.UnknownResultType Then
Return base
End If
Return GetDeclaredBase(Nothing)
End Function
''' <summary>
''' Returns declared interfaces or actual Interfaces if already known
''' This is only used by cycle detection code so that it can observe when cycles are broken
''' while not forcing actual Interfaces to be realized.
''' </summary>
Friend Function GetBestKnownInterfacesNoUseSiteDiagnostics() As ImmutableArray(Of NamedTypeSymbol)
Dim interfaces = Me._lazyInterfaces
If Not interfaces.IsDefault Then
Return interfaces
End If
Return GetDeclaredInterfacesNoUseSiteDiagnostics(Nothing)
End Function
''' <summary>
''' True iff this type or some containing type has type parameters.
''' </summary>
Public ReadOnly Property IsGenericType As Boolean Implements INamedTypeSymbol.IsGenericType
Get
Dim p As NamedTypeSymbol = Me
Do While p IsNot Nothing
If (p.Arity <> 0) Then
Return True
End If
p = p.ContainingType
Loop
Return False
End Get
End Property
''' <summary>
''' Get the original definition of this symbol. If this symbol is derived from another
''' symbol by (say) type substitution, this gets the original symbol, as it was defined
''' in source or metadata.
''' </summary>
Public Overridable Shadows ReadOnly Property OriginalDefinition As NamedTypeSymbol
Get
' Default implements returns Me.
Return Me
End Get
End Property
Protected NotOverridable Overrides ReadOnly Property OriginalTypeSymbolDefinition As TypeSymbol
Get
Return Me.OriginalDefinition
End Get
End Property
''' <summary>
''' Should return full emitted namespace name for a top level type if the name
''' might be different in case from containing namespace symbol full name, Nothing otherwise.
''' </summary>
Friend Overridable Function GetEmittedNamespaceName() As String
Return Nothing
End Function
''' <summary>
''' Does this type implement all the members of the given interface. Does not include members
''' of interfaces that iface inherits, only direct members.
''' </summary>
Friend Function ImplementsAllMembersOfInterface(iface As NamedTypeSymbol) As Boolean
Dim implementationMap = ExplicitInterfaceImplementationMap
For Each ifaceMember In iface.GetMembersUnordered()
If ifaceMember.RequiresImplementation() AndAlso Not implementationMap.ContainsKey(ifaceMember) Then
Return False
End If
Next
Return True
End Function
Friend Overrides Function GetUseSiteErrorInfo() As DiagnosticInfo
If Me.IsDefinition Then
Return MyBase.GetUseSiteErrorInfo()
End If
' Doing check for constructed types here in order to share implementation across
' constructed non-error and error type symbols.
' Check definition.
Dim definitionErrorInfo As DiagnosticInfo = DeriveUseSiteErrorInfoFromType(Me.OriginalDefinition)
If definitionErrorInfo IsNot Nothing AndAlso definitionErrorInfo.Code = ERRID.ERR_UnsupportedType1 Then
Return definitionErrorInfo
End If
' Check type arguments.
Dim argsErrorInfo As DiagnosticInfo = DeriveUseSiteErrorInfoFromTypeArguments()
Return MergeUseSiteErrorInfo(definitionErrorInfo, argsErrorInfo)
End Function
Private Function DeriveUseSiteErrorInfoFromTypeArguments() As DiagnosticInfo
Dim argsErrorInfo As DiagnosticInfo = Nothing
For Each arg As TypeSymbol In Me.TypeArgumentsNoUseSiteDiagnostics
Dim errorInfo As DiagnosticInfo = DeriveUseSiteErrorInfoFromType(arg)
If errorInfo IsNot Nothing Then
If errorInfo.Code = ERRID.ERR_UnsupportedType1 Then
Return errorInfo
End If
If argsErrorInfo Is Nothing Then
argsErrorInfo = errorInfo
End If
End If
Next
If Me.HasTypeArgumentsCustomModifiers Then
Dim modifiersErrorInfo As DiagnosticInfo = Nothing
For i As Integer = 0 To Me.Arity - 1
modifiersErrorInfo = MergeUseSiteErrorInfo(modifiersErrorInfo, DeriveUseSiteErrorInfoFromCustomModifiers(Me.GetTypeArgumentCustomModifiers(i)))
Next
Return MergeUseSiteErrorInfo(argsErrorInfo, modifiersErrorInfo)
End If
Return argsErrorInfo
End Function
''' <summary>
''' True if this is a reference to an <em>unbound</em> generic type. These occur only
''' within a <code>GetType</code> expression. A generic type is considered <em>unbound</em>
''' if all of the type argument lists in its fully qualified name are empty.
''' Note that the type arguments of an unbound generic type will be returned as error
''' types because they do not really have type arguments. An unbound generic type
''' yields null for its BaseType and an empty result for its Interfaces.
''' </summary>
Public Overridable ReadOnly Property IsUnboundGenericType As Boolean
Get
Return False
End Get
End Property
''' <summary>
''' Force all declaration errors to be generated.
''' </summary>
Friend MustOverride Overrides Sub GenerateDeclarationErrors(cancellationToken As CancellationToken)
''' <summary>
''' Return compiler generated nested types that are created at Declare phase, but not exposed through GetMembers and the like APIs.
''' Should return Nothing if there are no such types.
''' </summary>
Friend Overridable Function GetSynthesizedNestedTypes() As IEnumerable(Of Microsoft.Cci.INestedTypeDefinition)
Return Nothing
End Function
''' <summary>
''' True if the type is a Windows runtime type.
''' </summary>
''' <remarks>
''' A type can me marked as a Windows runtime type in source by applying the WindowsRuntimeImportAttribute.
''' WindowsRuntimeImportAttribute is a pseudo custom attribute defined as an internal class in System.Runtime.InteropServices.WindowsRuntime namespace.
''' This is needed to mark Windows runtime types which are redefined in mscorlib.dll and System.Runtime.WindowsRuntime.dll.
''' These two assemblies are special as they implement the CLR's support for WinRT.
''' </remarks>
Friend MustOverride ReadOnly Property IsWindowsRuntimeImport As Boolean
''' <summary>
''' True if the type should have its WinRT interfaces projected onto .NET types and
''' have missing .NET interface members added to the type.
''' </summary>
Friend MustOverride ReadOnly Property ShouldAddWinRTMembers As Boolean
''' <summary>
''' Requires less computation than <see cref="TypeSymbol.TypeKind"/>== <see cref="TypeKind.Interface"/>.
''' </summary>
''' <remarks>
''' Metadata types need to compute their base types in order to know their TypeKinds, And that can lead
''' to cycles if base types are already being computed.
''' </remarks>
''' <returns>True if this Is an interface type.</returns>
Friend MustOverride ReadOnly Property IsInterface As Boolean
''' <summary>
''' Get synthesized WithEvents overrides that aren't returned by <see cref="GetMembers"/>
''' </summary>
Friend MustOverride Function GetSynthesizedWithEventsOverrides() As IEnumerable(Of PropertySymbol)
#Region "INamedTypeSymbol"
Private ReadOnly Property INamedTypeSymbol_Arity As Integer Implements INamedTypeSymbol.Arity
Get
Return Me.Arity
End Get
End Property
Private ReadOnly Property INamedTypeSymbol_ConstructedFrom As INamedTypeSymbol Implements INamedTypeSymbol.ConstructedFrom
Get
Return Me.ConstructedFrom
End Get
End Property
Private ReadOnly Property INamedTypeSymbol_DelegateInvokeMethod As IMethodSymbol Implements INamedTypeSymbol.DelegateInvokeMethod
Get
Return Me.DelegateInvokeMethod
End Get
End Property
Private ReadOnly Property INamedTypeSymbol_EnumUnderlyingType As INamedTypeSymbol Implements INamedTypeSymbol.EnumUnderlyingType
Get
Return Me.EnumUnderlyingType
End Get
End Property
Private ReadOnly Property INamedTypeSymbol_MemberNames As IEnumerable(Of String) Implements INamedTypeSymbol.MemberNames
Get
Return Me.MemberNames
End Get
End Property
Private ReadOnly Property INamedTypeSymbol_IsUnboundGenericType As Boolean Implements INamedTypeSymbol.IsUnboundGenericType
Get
Return Me.IsUnboundGenericType
End Get
End Property
Private ReadOnly Property INamedTypeSymbol_OriginalDefinition As INamedTypeSymbol Implements INamedTypeSymbol.OriginalDefinition
Get
Return Me.OriginalDefinition
End Get
End Property
Private Function INamedTypeSymbol_GetTypeArgumentCustomModifiers(ordinal As Integer) As ImmutableArray(Of CustomModifier) Implements INamedTypeSymbol.GetTypeArgumentCustomModifiers
Return GetTypeArgumentCustomModifiers(ordinal)
End Function
Private ReadOnly Property INamedTypeSymbol_TypeArguments As ImmutableArray(Of ITypeSymbol) Implements INamedTypeSymbol.TypeArguments
Get
Return StaticCast(Of ITypeSymbol).From(Me.TypeArgumentsNoUseSiteDiagnostics)
End Get
End Property
Private ReadOnly Property INamedTypeSymbol_TypeParameters As ImmutableArray(Of ITypeParameterSymbol) Implements INamedTypeSymbol.TypeParameters
Get
Return StaticCast(Of ITypeParameterSymbol).From(Me.TypeParameters)
End Get
End Property
Private ReadOnly Property INamedTypeSymbol_IsScriptClass As Boolean Implements INamedTypeSymbol.IsScriptClass
Get
Return Me.IsScriptClass
End Get
End Property
Private ReadOnly Property INamedTypeSymbol_IsImplicitClass As Boolean Implements INamedTypeSymbol.IsImplicitClass
Get
' TODO (tomat):
Return False
End Get
End Property
Private Function INamedTypeSymbol_Construct(ParamArray arguments() As ITypeSymbol) As INamedTypeSymbol Implements INamedTypeSymbol.Construct
For Each arg In arguments
arg.EnsureVbSymbolOrNothing(Of TypeSymbol)("typeArguments")
Next
Return Construct(arguments.Cast(Of TypeSymbol).ToArray())
End Function
Private Function INamedTypeSymbol_ConstructUnboundGenericType() As INamedTypeSymbol Implements INamedTypeSymbol.ConstructUnboundGenericType
Return ConstructUnboundGenericType()
End Function
Private ReadOnly Property INamedTypeSymbol_InstanceConstructors As ImmutableArray(Of IMethodSymbol) Implements INamedTypeSymbol.InstanceConstructors
Get
Return GetConstructors(Of IMethodSymbol)(includeInstance:=True, includeShared:=False)
End Get
End Property
Private ReadOnly Property INamedTypeSymbol_StaticConstructors As ImmutableArray(Of IMethodSymbol) Implements INamedTypeSymbol.StaticConstructors
Get
Return GetConstructors(Of IMethodSymbol)(includeInstance:=False, includeShared:=True)
End Get
End Property
Private ReadOnly Property INamedTypeSymbol_Constructors As ImmutableArray(Of IMethodSymbol) Implements INamedTypeSymbol.Constructors
Get
Return GetConstructors(Of IMethodSymbol)(includeInstance:=True, includeShared:=True)
End Get
End Property
Private ReadOnly Property INamedTypeSymbol_AssociatedSymbol As ISymbol Implements INamedTypeSymbol.AssociatedSymbol
Get
Return Me.AssociatedSymbol
End Get
End Property
Private ReadOnly Property INamedTypeSymbol_IsComImport As Boolean Implements INamedTypeSymbol.IsComImport
Get
Return IsComImport
End Get
End Property
#End Region
#Region "ISymbol"
Protected Overrides ReadOnly Property ISymbol_IsAbstract As Boolean
Get
Return Me.IsMustInherit
End Get
End Property
Protected Overrides ReadOnly Property ISymbol_IsSealed As Boolean
Get
Return Me.IsNotInheritable
End Get
End Property
Private ReadOnly Property INamedTypeSymbol_TupleElements As ImmutableArray(Of IFieldSymbol) Implements INamedTypeSymbol.TupleElements
Get
Return StaticCast(Of IFieldSymbol).From(TupleElements)
End Get
End Property
Private ReadOnly Property INamedTypeSymbol_TupleUnderlyingType As INamedTypeSymbol Implements INamedTypeSymbol.TupleUnderlyingType
Get
Return TupleUnderlyingType
End Get
End Property
Public Overrides Sub Accept(visitor As SymbolVisitor)
visitor.VisitNamedType(Me)
End Sub
Public Overrides Function Accept(Of TResult)(visitor As SymbolVisitor(Of TResult)) As TResult
Return visitor.VisitNamedType(Me)
End Function
Public Overrides Sub Accept(visitor As VisualBasicSymbolVisitor)
visitor.VisitNamedType(Me)
End Sub
Public Overrides Function Accept(Of TResult)(visitor As VisualBasicSymbolVisitor(Of TResult)) As TResult
Return visitor.VisitNamedType(Me)
End Function
#End Region
''' <summary>
''' Verify if the given type can be used to back a tuple type
''' and return cardinality of that tuple type in <paramref name="tupleCardinality"/>.
''' </summary>
''' <param name="tupleCardinality">If method returns true, contains cardinality of the compatible tuple type.</param>
''' <returns></returns>
Public NotOverridable Overrides Function IsTupleCompatible(<Out> ByRef tupleCardinality As Integer) As Boolean
If IsTupleType Then
tupleCardinality = 0
Return False
End If
' Should this be optimized for perf (caching for VT<0> to VT<7>, etc.)?
If Not IsUnboundGenericType AndAlso
ContainingSymbol?.Kind = SymbolKind.Namespace AndAlso
ContainingNamespace?.ContainingNamespace?.IsGlobalNamespace = True AndAlso
Name = TupleTypeSymbol.TupleTypeName AndAlso
ContainingNamespace.Name = MetadataHelpers.SystemString Then
Dim arity = Me.Arity
If arity > 0 AndAlso arity < TupleTypeSymbol.RestPosition Then
tupleCardinality = arity
Return True
ElseIf arity = TupleTypeSymbol.RestPosition AndAlso Not IsDefinition Then
' Skip through "Rest" extensions
Dim typeToCheck As TypeSymbol = Me
Dim levelsOfNesting As Integer = 0
Do
levelsOfNesting += 1
typeToCheck = DirectCast(typeToCheck, NamedTypeSymbol).TypeArgumentsNoUseSiteDiagnostics(TupleTypeSymbol.RestPosition - 1)
Loop While typeToCheck.OriginalDefinition = Me.OriginalDefinition AndAlso Not typeToCheck.IsDefinition
If typeToCheck.IsTupleType Then
Dim underlying = typeToCheck.TupleUnderlyingType
If underlying.Arity = TupleTypeSymbol.RestPosition AndAlso underlying.OriginalDefinition <> Me.OriginalDefinition Then
tupleCardinality = 0
Return False
End If
tupleCardinality = (TupleTypeSymbol.RestPosition - 1) * levelsOfNesting + typeToCheck.TupleElementTypes.Length
Return True
End If
arity = If(TryCast(typeToCheck, NamedTypeSymbol)?.Arity, 0)
If arity > 0 AndAlso
arity < TupleTypeSymbol.RestPosition AndAlso
typeToCheck.IsTupleCompatible(tupleCardinality) Then
Debug.Assert(tupleCardinality < TupleTypeSymbol.RestPosition)
tupleCardinality += (TupleTypeSymbol.RestPosition - 1) * levelsOfNesting
Return True
End If
End If
End If
tupleCardinality = 0
Return False
End Function
End Class
End Namespace
|
jkotas/roslyn
|
src/Compilers/VisualBasic/Portable/Symbols/NamedTypeSymbol.vb
|
Visual Basic
|
apache-2.0
| 62,946
|
' 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.Commands
Imports Microsoft.CodeAnalysis.Editor.Shared.Options
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Extensions
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.LineCommit
Public Class CommitOnMiscellaneousCommandsTests
<WpfFact>
<Trait(Traits.Feature, Traits.Features.LineCommit)>
Public Async Function TestCommitOnMultiLinePaste() As Task
Using testData = Await CommitTestData.CreateAsync(<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>$$
</Document>
</Project>
</Workspace>)
testData.CommandHandler.ExecuteCommand(New PasteCommandArgs(testData.View, testData.Buffer), Sub() testData.EditorOperations.InsertText(" imports system" & vbCrLf & " imports system.text"))
Assert.Equal("Imports System", testData.Buffer.CurrentSnapshot.GetLineFromLineNumber(0).GetText())
End Using
End Function
<WpfFact>
<WorkItem(1944, "https://github.com/dotnet/roslyn/issues/1944")>
<Trait(Traits.Feature, Traits.Features.LineCommit)>
Public Async Function TestDontCommitOnMultiLinePasteWithPrettyListingOff() As Task
Using testData = Await CommitTestData.CreateAsync(<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>$$
</Document>
</Project>
</Workspace>)
testData.Workspace.Options = testData.Workspace.Options.WithChangedOption(FeatureOnOffOptions.PrettyListing, LanguageNames.VisualBasic, False)
testData.CommandHandler.ExecuteCommand(New PasteCommandArgs(testData.View, testData.Buffer), Sub() testData.EditorOperations.InsertText("Class Program" & vbCrLf & " Sub M(abc As Integer)" & vbCrLf & " Dim a = 7" & vbCrLf & " End Sub" & vbCrLf & "End Class"))
Assert.Equal(" Dim a = 7", testData.Buffer.CurrentSnapshot.GetLineFromLineNumber(2).GetText())
End Using
End Function
<WpfFact>
<Trait(Traits.Feature, Traits.Features.LineCommit)>
<WorkItem(545493, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545493")>
Public Async Function TestNoCommitOnSingleLinePaste() As Task
Using testData = Await CommitTestData.CreateAsync(<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>$$
</Document>
</Project>
</Workspace>)
testData.CommandHandler.ExecuteCommand(New PasteCommandArgs(testData.View, testData.Buffer), Sub() testData.EditorOperations.InsertText(" imports system"))
Assert.Equal(" imports system", testData.Buffer.CurrentSnapshot.GetLineFromLineNumber(0).GetText())
End Using
End Function
<WpfFact>
<Trait(Traits.Feature, Traits.Features.LineCommit)>
Public Async Function TestCommitOnSave() As Task
Using testData = Await CommitTestData.CreateAsync(<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>$$
</Document>
</Project>
</Workspace>)
testData.Buffer.Insert(0, " imports system")
testData.CommandHandler.ExecuteCommand(New SaveCommandArgs(testData.View, testData.Buffer), Sub() Exit Sub)
Assert.Equal("Imports System", testData.Buffer.CurrentSnapshot.GetLineFromLineNumber(0).GetText())
End Using
End Function
<WpfFact, WorkItem(1944, "https://github.com/dotnet/roslyn/issues/1944")>
<Trait(Traits.Feature, Traits.Features.LineCommit)>
Public Async Function TestDontCommitOnSavePrettyListingOff() As Task
Using testData = Await CommitTestData.CreateAsync(<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>
Class Program
Sub M(abc As Integer)
Dim a $$= 7
End Sub
End Class
</Document>
</Project>
</Workspace>)
testData.Workspace.Options = testData.Workspace.Options.WithChangedOption(FeatureOnOffOptions.PrettyListing, LanguageNames.VisualBasic, False)
testData.Buffer.Insert(57, " ")
testData.CommandHandler.ExecuteCommand(New SaveCommandArgs(testData.View, testData.Buffer), Sub() Exit Sub)
Assert.Equal(" Dim a = 7", testData.Buffer.CurrentSnapshot.GetLineFromLineNumber(3).GetText())
End Using
End Function
<WpfFact>
<Trait(Traits.Feature, Traits.Features.Formatting)>
<WorkItem(545493, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545493")>
Public Async Function TestPerformAddMissingTokenOnFormatDocument() As Task
Using testData = Await CommitTestData.CreateAsync(<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>$$Module Program
Sub Main()
foo
End Sub
Private Sub foo()
End Sub
End Module
</Document>
</Project>
</Workspace>)
testData.CommandHandler.ExecuteCommand(New FormatDocumentCommandArgs(testData.View, testData.Buffer), Sub() Exit Sub)
Assert.Equal(" foo()", testData.Buffer.CurrentSnapshot.GetLineFromLineNumber(2).GetText())
End Using
End Function
<WpfFact>
<Trait(Traits.Feature, Traits.Features.Formatting)>
<WorkItem(867153, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/867153")>
Public Async Function TestFormatDocumentWithPrettyListingDisabled() As Task
Using testData = Await CommitTestData.CreateAsync(<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>Module Program
$$Sub Main()
foo
End Sub
End Module
</Document>
</Project>
</Workspace>)
' Turn off pretty listing
testData.Workspace.Options = testData.Workspace.Options.WithChangedOption(FeatureOnOffOptions.PrettyListing, LanguageNames.VisualBasic, False)
testData.CommandHandler.ExecuteCommand(New FormatDocumentCommandArgs(testData.View, testData.Buffer), Sub() Exit Sub)
Assert.Equal(" Sub Main()", testData.Buffer.CurrentSnapshot.GetLineFromLineNumber(1).GetText())
End Using
End Function
<WpfFact>
<Trait(Traits.Feature, Traits.Features.LineCommit)>
Public Async Function TestDoNotCommitWithUnterminatedString() As Task
Using testData = Await CommitTestData.CreateAsync(<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<Document>Module Module1
Sub Main()
$$
End Sub
Sub SomeUnrelatedCode()
Console.WriteLine("<a>")
End Sub
End Module</Document>
</Project>
</Workspace>)
testData.CommandHandler.ExecuteCommand(New PasteCommandArgs(testData.View, testData.Buffer), Sub() testData.EditorOperations.InsertText("Console.WriteLine(""Hello World"))
Assert.Equal(testData.Buffer.CurrentSnapshot.GetText(),
<Document>Module Module1
Sub Main()
Console.WriteLine("Hello World
End Sub
Sub SomeUnrelatedCode()
Console.WriteLine("<a>")
End Sub
End Module</Document>.NormalizedValue)
End Using
End Function
End Class
End Namespace
|
MatthieuMEZIL/roslyn
|
src/EditorFeatures/VisualBasicTest/LineCommit/CommitOnMiscellaneousCommandsTests.vb
|
Visual Basic
|
apache-2.0
| 9,929
|
' 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.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 VisitTryStatement(node As BoundTryStatement) As BoundNode
Debug.Assert(_unstructuredExceptionHandling.Context Is Nothing)
Dim rewrittenTryBlock = RewriteTryBlock(node.TryBlock)
Dim rewrittenCatchBlocks = VisitList(node.CatchBlocks)
Dim rewrittenFinally = RewriteFinallyBlock(node.FinallyBlockOpt)
Return RewriteTryStatement(node.Syntax, rewrittenTryBlock, rewrittenCatchBlocks, rewrittenFinally, node.ExitLabelOpt)
End Function
''' <summary>
''' Is there any code to execute in the given statement that could have side-effects,
''' such as throwing an exception? This implementation is conservative, in the sense
''' that it may return true when the statement actually may have no side effects.
''' </summary>
Private Shared Function HasSideEffects(statement As BoundStatement) As Boolean
If statement Is Nothing Then
Return False
End If
Select Case statement.Kind
Case BoundKind.NoOpStatement
Return False
Case BoundKind.Block
Dim block = DirectCast(statement, BoundBlock)
For Each s In block.Statements
If HasSideEffects(s) Then
Return True
End If
Next
Return False
Case BoundKind.SequencePoint
Dim sequence = DirectCast(statement, BoundSequencePoint)
Return HasSideEffects(sequence.StatementOpt)
Case BoundKind.SequencePointWithSpan
Dim sequence = DirectCast(statement, BoundSequencePointWithSpan)
Return HasSideEffects(sequence.StatementOpt)
Case Else
Return True
End Select
End Function
Public Function RewriteTryStatement(
syntaxNode As VisualBasicSyntaxNode,
tryBlock As BoundBlock,
catchBlocks As ImmutableArray(Of BoundCatchBlock),
finallyBlockOpt As BoundBlock,
exitLabelOpt As LabelSymbol
) As BoundStatement
If Not Me.OptimizationLevelIsDebug Then
' When optimizing and the try block has no side effects, we can discard the catch blocks.
If Not HasSideEffects(tryBlock) Then
catchBlocks = ImmutableArray(Of BoundCatchBlock).Empty
End If
' A finally block with no side effects can be omitted.
If Not HasSideEffects(finallyBlockOpt) Then
finallyBlockOpt = Nothing
End If
If catchBlocks.IsDefaultOrEmpty AndAlso finallyBlockOpt Is Nothing Then
If exitLabelOpt Is Nothing Then
Return tryBlock
Else
' Ensure implicit label statement is materialized
Return New BoundStatementList(syntaxNode,
ImmutableArray.Create(Of BoundStatement)(tryBlock,
New BoundLabelStatement(syntaxNode, exitLabelOpt)))
End If
End If
End If
Dim newTry As BoundStatement = New BoundTryStatement(syntaxNode, tryBlock, catchBlocks, finallyBlockOpt, exitLabelOpt)
For Each [catch] In catchBlocks
ReportErrorsOnCatchBlockHelpers([catch])
Next
' Add a sequence point for End Try
' Note that scope the point is outside of Try/Catch/Finally
If Me.GenerateDebugInfo Then
Dim syntax = TryCast(syntaxNode, TryBlockSyntax)
If syntax IsNot Nothing Then
newTry = New BoundStatementList(syntaxNode,
ImmutableArray.Create(Of BoundStatement)(
newTry,
New BoundSequencePoint(syntax.EndTryStatement, Nothing)
)
)
End If
End If
Return newTry
End Function
Private Function RewriteFinallyBlock(node As BoundBlock) As BoundBlock
If node Is Nothing Then
Return node
End If
Dim newFinally = DirectCast(Visit(node), BoundBlock)
If GenerateDebugInfo Then
Dim syntax = TryCast(node.Syntax, FinallyBlockSyntax)
If syntax IsNot Nothing Then
newFinally = PrependWithSequencePoint(newFinally, syntax.FinallyStatement)
End If
End If
Return newFinally
End Function
Private Function RewriteTryBlock(node As BoundBlock) As BoundBlock
Dim newTry = DirectCast(Visit(node), BoundBlock)
If GenerateDebugInfo Then
Dim syntax = TryCast(node.Syntax, TryBlockSyntax)
If syntax IsNot Nothing Then
newTry = PrependWithSequencePoint(newTry, syntax.TryStatement)
End If
End If
Return newTry
End Function
Public Overrides Function VisitCatchBlock(node As BoundCatchBlock) As BoundNode
Dim newExceptionSource = VisitExpressionNode(node.ExceptionSourceOpt)
Dim newFilter = VisitExpressionNode(node.ExceptionFilterOpt)
Dim newCatchBody As BoundBlock = DirectCast(Visit(node.Body), BoundBlock)
If GenerateDebugInfo Then
Dim syntax = TryCast(node.Syntax, CatchBlockSyntax)
If syntax IsNot Nothing Then
If newFilter IsNot Nothing Then
' if we have a filter, we want to stop before the filter expression
' and associate the sequence point with whole Catch statement
newFilter = New BoundSequencePointExpression(syntax.CatchStatement,
newFilter,
newFilter.Type)
Else
newCatchBody = PrependWithSequencePoint(newCatchBody, syntax.CatchStatement)
End If
End If
End If
Dim errorLineNumber As BoundExpression = Nothing
If node.ErrorLineNumberOpt IsNot Nothing Then
Debug.Assert(_currentLineTemporary Is Nothing)
Debug.Assert((Me._flags And RewritingFlags.AllowCatchWithErrorLineNumberReference) <> 0)
errorLineNumber = VisitExpressionNode(node.ErrorLineNumberOpt)
ElseIf _currentLineTemporary IsNot Nothing AndAlso _currentMethodOrLambda Is _topMethod Then
errorLineNumber = New BoundLocal(node.Syntax, _currentLineTemporary, isLValue:=False, type:=_currentLineTemporary.Type)
End If
' EnC: We need to insert a hidden sequence point to handle function remapping in case
' the containing method is edited while methods invoked in the condition are being executed.
Return node.Update(node.LocalOpt,
newExceptionSource,
errorLineNumber,
If(newFilter IsNot Nothing, AddConditionSequencePoint(newFilter, node), Nothing),
newCatchBody,
node.IsSynthesizedAsyncCatchAll)
End Function
Private Sub ReportErrorsOnCatchBlockHelpers(node As BoundCatchBlock)
' when starting/finishing any code associated with an exception handler (including exception filters)
' we need to call SetProjectError/ClearProjectError
' NOTE: we do not inject the helper calls via a rewrite.
' SetProjectError is called with implicit argument on the stack and cannot be expressed in the tree.
' ClearProjectError could be added as a rewrite, but for similarity with SetProjectError we will do it in IL gen too.
' we will however check for the presence of the helpers and complain here if we cannot find them.
' TODO: when building VB runtime, this check is unnecessary as we should not emit the helpers.
Dim setProjectError As WellKnownMember = If(node.ErrorLineNumberOpt Is Nothing,
WellKnownMember.Microsoft_VisualBasic_CompilerServices_ProjectData__SetProjectError,
WellKnownMember.Microsoft_VisualBasic_CompilerServices_ProjectData__SetProjectError_Int32)
Dim setProjectErrorMethod As MethodSymbol = DirectCast(Compilation.GetWellKnownTypeMember(setProjectError), MethodSymbol)
ReportMissingOrBadRuntimeHelper(node, setProjectError, setProjectErrorMethod)
If node.ExceptionFilterOpt Is Nothing OrElse node.ExceptionFilterOpt.Kind <> BoundKind.UnstructuredExceptionHandlingCatchFilter Then
Const clearProjectError As WellKnownMember = WellKnownMember.Microsoft_VisualBasic_CompilerServices_ProjectData__ClearProjectError
Dim clearProjectErrorMethod = DirectCast(Compilation.GetWellKnownTypeMember(clearProjectError), MethodSymbol)
ReportMissingOrBadRuntimeHelper(node, clearProjectError, clearProjectErrorMethod)
End If
End Sub
End Class
End Namespace
|
ericfe-ms/roslyn
|
src/Compilers/VisualBasic/Portable/Lowering/LocalRewriter/LocalRewriter_Try.vb
|
Visual Basic
|
apache-2.0
| 10,419
|
' 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
Namespace Microsoft.CodeAnalysis.Editor.UnitTests.FindReferences
Partial Public Class FindReferencesTests
<WpfFact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestConstructorOnDynamicCall() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class A
{
class B
{
public B(){}
public {|Definition:B|}(int d){}
public B(string d){}
}
void Aoo()
{
dynamic d = 1;
B b = new [|$$B|](d);
}
}
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input)
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestConstructorOnOverloadedDynamicDefinition() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class A
{
class B
{
public B(){}
public {|Definition:$$B|}(int d){}
public B(string d){}
}
void Aoo()
{
dynamic d = 1;
B b = new [|B|](d);
}
}
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input)
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestConstructorOnTypeName() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class A
{
class {|Definition:$$B|}
{
public {|Definition:B|}(){}
public {|Definition:B|}(int d){}
}
void Aoo()
{
dynamic d = 1;
[|B|] b1 = new [|B|]();
[|B|] b2 = new [|B|](d);
}
}
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input)
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestConstructorOnNonDynamicCall() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class A
{
class B
{
public {|Definition:B|}(){}
public B(int d){}
}
void Aoo()
{
dynamic d = 1;
B b1 = new [|$$B|]();
B b2 = new B(d);
}
}
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input)
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestConstructorOverloadedOnNonDynamicDefinition() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class A
{
class B
{
public {|Definition:$$B|}(){}
public B(int d){}
}
void Aoo()
{
dynamic d = 1;
B b1 = new [|B|]();
B b2 = new B(d);
}
}
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input)
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestConstructorOverloadedOnDynamicTypeDeclaration() As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
class A
{
class {|Definition:B|}
{
public {|Definition:B|}(){}
public {|Definition:B|}(int d){}
}
void Aoo()
{
dynamic d = 1;
[|B|] b1 = new [|B|]();
[|$$B|] b2 = new [|B|](d);
}
}
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input)
End Function
End Class
End Namespace
|
jhendrixMSFT/roslyn
|
src/EditorFeatures/Test2/FindReferences/FindReferencesTests.DynamicConstructors.vb
|
Visual Basic
|
apache-2.0
| 4,619
|
' 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 Microsoft.CodeAnalysis.Differencing
Imports Microsoft.CodeAnalysis.EditAndContinue
Imports Microsoft.CodeAnalysis.EditAndContinue.UnitTests
Imports Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.EditAndContinue
Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue.UnitTests
Friend Module Extensions
Friend Sub VerifyUnchangedDocument(
source As String,
description As ActiveStatementsDescription)
VisualBasicEditAndContinueTestHelpers.Instance.VerifyUnchangedDocument(
ActiveStatementsDescription.ClearTags(source),
description.OldSpans,
description.OldTrackingSpans,
description.NewSpans,
description.OldRegions,
description.NewRegions)
End Sub
<Extension>
Friend Sub VerifyRudeDiagnostics(editScript As EditScript(Of SyntaxNode),
ParamArray expectedDiagnostics As RudeEditDiagnosticDescription())
VerifyRudeDiagnostics(editScript, ActiveStatementsDescription.Empty, expectedDiagnostics)
End Sub
<Extension>
Friend Sub VerifyRudeDiagnostics(editScript As EditScript(Of SyntaxNode),
description As ActiveStatementsDescription,
ParamArray expectedDiagnostics As RudeEditDiagnosticDescription())
VisualBasicEditAndContinueTestHelpers.Instance.VerifyRudeDiagnostics(editScript, description, expectedDiagnostics)
End Sub
<Extension>
Friend Sub VerifyLineEdits(editScript As EditScript(Of SyntaxNode),
expectedLineEdits As IEnumerable(Of LineChange),
expectedNodeUpdates As IEnumerable(Of String),
ParamArray expectedDiagnostics As RudeEditDiagnosticDescription())
VisualBasicEditAndContinueTestHelpers.Instance.VerifyLineEdits(editScript, expectedLineEdits, expectedNodeUpdates, expectedDiagnostics)
End Sub
<Extension>
Friend Sub VerifySemanticDiagnostics(editScript As EditScript(Of SyntaxNode),
ParamArray expectedDiagnostics As RudeEditDiagnosticDescription())
VerifySemantics(editScript, ActiveStatementsDescription.Empty, Nothing, expectedDiagnostics)
End Sub
<Extension>
Friend Sub VerifySemantics(editScript As EditScript(Of SyntaxNode),
activeStatements As ActiveStatementsDescription,
expectedSemanticEdits As SemanticEditDescription(),
ParamArray expectedDiagnostics As RudeEditDiagnosticDescription())
VerifySemantics(editScript, activeStatements, Nothing, Nothing, expectedSemanticEdits, expectedDiagnostics)
End Sub
<Extension>
Friend Sub VerifySemantics(editScript As EditScript(Of SyntaxNode),
activeStatements As ActiveStatementsDescription,
additionalOldSources As IEnumerable(Of String),
additionalNewSources As IEnumerable(Of String),
expectedSemanticEdits As SemanticEditDescription(),
ParamArray expectedDiagnostics As RudeEditDiagnosticDescription())
VisualBasicEditAndContinueTestHelpers.Instance.VerifySemantics(
editScript,
activeStatements,
additionalOldSources,
additionalNewSources,
expectedSemanticEdits,
expectedDiagnostics)
End Sub
End Module
End Namespace
|
bbarry/roslyn
|
src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/Extensions.vb
|
Visual Basic
|
apache-2.0
| 4,038
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.34003
'
' 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 TestResources.SymbolsTests
'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()> _
Public Class General
Private Shared resourceMan As Global.System.Resources.ResourceManager
Private Shared resourceCulture As Global.System.Globalization.CultureInfo
<Global.System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")> _
Friend Sub New()
MyBase.New
End Sub
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Public Shared 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("General", GetType(General).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)> _
Public Shared Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set
resourceCulture = value
End Set
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property BigVisitor() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("BigVisitor", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property C1() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("C1", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property C2() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("C2", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property CSharpErrors() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("CSharpErrors", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property CSharpExplicitInterfaceImplementation() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("CSharpExplicitInterfaceImplementation", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property CSharpExplicitInterfaceImplementationEvents() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("CSharpExplicitInterfaceImplementationEvents", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property CSharpExplicitInterfaceImplementationProperties() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("CSharpExplicitInterfaceImplementationProperties", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property Culture_AR_SA() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("Culture_AR_SA", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property Culture_EN_US() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("Culture_EN_US", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property DelegateByRefParamArray() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("DelegateByRefParamArray", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property DelegatesWithoutInvoke() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("DelegatesWithoutInvoke", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property Events() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("Events", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property FSharpTestLibrary() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("FSharpTestLibrary", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property ILErrors() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("ILErrors", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property ILExplicitInterfaceImplementation() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("ILExplicitInterfaceImplementation", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property ILExplicitInterfaceImplementationProperties() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("ILExplicitInterfaceImplementationProperties", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property Indexers() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("Indexers", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property InheritIComparable() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("InheritIComparable", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property MDTestLib1() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("MDTestLib1", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property MDTestLib2() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("MDTestLib2", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property nativeCOFFResources() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("nativeCOFFResources", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property Properties() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("Properties", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property PropertiesWithByRef() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("PropertiesWithByRef", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property Regress40025DLL() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("Regress40025DLL", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property snKey() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("snKey", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property snPublicKey() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("snPublicKey", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property snKey2() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("snKey2", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property snPublicKey2() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("snPublicKey2", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property Unavailable() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("Unavailable", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property VBConversions() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("VBConversions", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property With_Spaces() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("With_Spaces", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
'''<summary>
''' Looks up a localized resource of type System.Byte[].
'''</summary>
Public Shared ReadOnly Property With_SpacesModule() As Byte()
Get
Dim obj As Object = ResourceManager.GetObject("With_SpacesModule", resourceCulture)
Return CType(obj,Byte())
End Get
End Property
End Class
End Namespace
|
paladique/roslyn
|
src/Compilers/Test/Resources/Core/SymbolsTests/General.Designer.vb
|
Visual Basic
|
apache-2.0
| 15,193
|
' 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.Queries
''' <summary>
''' Recommends the "On" keyword.
''' </summary>
Friend Class OnKeywordRecommender
Inherits AbstractKeywordRecommender
Protected Overrides Function RecommendKeywords(context As VisualBasicSyntaxContext, cancellationToken As CancellationToken) As IEnumerable(Of RecommendedKeyword)
If context.SyntaxTree.IsFollowingCompleteExpression(Of JoinClauseSyntax)(context.Position, context.TargetToken, Function(joinQuery) joinQuery.JoinedVariables.LastCollectionExpression, cancellationToken) OrElse
context.SyntaxTree.IsFollowingCompleteExpression(Of JoinConditionSyntax)(context.Position, context.TargetToken, Function(joinCondition) joinCondition.Right, cancellationToken) Then
Dim token = context.TargetToken.GetPreviousToken()
' There must be at least one Join clause in this query which doesn't have an On statement. We also recommend
' it if the parser has already placed this On in the tree.
For Each joinClause In token.GetAncestors(Of JoinClauseSyntax)()
If joinClause.OnKeyword.IsMissing OrElse joinClause.OnKeyword = token Then
Return SpecializedCollections.SingletonEnumerable(New RecommendedKeyword("On", VBFeaturesResources.Specifies_the_element_keys_used_to_correlate_sequences_for_a_join_operation))
End If
Next
End If
Return SpecializedCollections.EmptyEnumerable(Of RecommendedKeyword)()
End Function
End Class
End Namespace
|
mmitche/roslyn
|
src/Features/VisualBasic/Portable/Completion/KeywordRecommenders/Queries/OnKeywordRecommender.vb
|
Visual Basic
|
apache-2.0
| 2,033
|
' 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 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:="Foo.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:="Foo.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="Foo.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="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="3" 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:=PdbToXmlOptions.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>
<entryPoint declaringType="C" methodName="F"/>
<methods/>
</symbols>, debugEntryPoint:=f, options:=PdbToXmlOptions.ExcludeScopes Or PdbToXmlOptions.ExcludeSequencePoints Or PdbToXmlOptions.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>
<entryPoint declaringType="C" methodName="F"/>
<methods/>
</symbols>, debugEntryPoint:=f, options:=PdbToXmlOptions.ExcludeScopes Or PdbToXmlOptions.ExcludeSequencePoints Or PdbToXmlOptions.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>
<methods>
<method containingType="C1" name="Method">
<sequencePoints>
<entry offset="0x0" startLine="2" startColumn="5" endLine="2" endColumn="17"/>
<entry offset="0x1" startLine="3" startColumn="9" endLine="3" endColumn="50"/>
<entry offset="0xc" startLine="4" startColumn="5" endLine="4" endColumn="12"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xd">
<currentnamespace name=""/>
</scope>
</method>
<method containingType="My.MyComputer" name=".ctor">
<sequencePoints>
<entry offset="0x0" startLine="107" startColumn="9" endLine="107" endColumn="25"/>
<entry offset="0x1" startLine="108" startColumn="13" endLine="108" endColumn="25"/>
<entry offset="0x8" startLine="109" startColumn="9" endLine="109" endColumn="16"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<currentnamespace name="My"/>
</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"/>
<entry offset="0x1" startLine="122" startColumn="17" endLine="122" endColumn="62"/>
<entry offset="0xe" startLine="123" startColumn="13" endLine="123" endColumn="20"/>
</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"/>
<entry offset="0x1" startLine="134" startColumn="17" endLine="134" endColumn="57"/>
<entry offset="0xe" startLine="135" startColumn="13" endLine="135" endColumn="20"/>
</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"/>
<entry offset="0x1" startLine="145" startColumn="17" endLine="145" endColumn="58"/>
<entry offset="0xe" startLine="146" startColumn="13" endLine="146" endColumn="20"/>
</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"/>
<entry offset="0x1" startLine="238" startColumn="17" endLine="238" endColumn="67"/>
<entry offset="0xe" startLine="239" startColumn="13" endLine="239" endColumn="20"/>
</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="My.MyProject" name=".cctor">
<sequencePoints>
<entry offset="0x0" startLine="126" startColumn="26" endLine="126" endColumn="97"/>
<entry offset="0xa" startLine="137" startColumn="26" endLine="137" endColumn="95"/>
<entry offset="0x14" startLine="148" startColumn="26" endLine="148" endColumn="136"/>
<entry offset="0x1e" startLine="284" startColumn="26" endLine="284" endColumn="105"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x29">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
</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"/>
<entry offset="0x1" startLine="248" startColumn="17" endLine="248" endColumn="40"/>
<entry offset="0x10" startLine="249" startColumn="13" endLine="249" endColumn="25"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x12">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<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"/>
<entry offset="0x1" startLine="252" startColumn="17" endLine="252" endColumn="42"/>
<entry offset="0xa" startLine="253" startColumn="13" endLine="253" endColumn="25"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xc">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<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"/>
<entry offset="0x1" startLine="256" startColumn="17" endLine="256" endColumn="46"/>
<entry offset="0xe" startLine="257" startColumn="13" endLine="257" endColumn="25"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x10">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<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"/>
<entry offset="0x1" startLine="260" startColumn="17" endLine="260" endColumn="39"/>
<entry offset="0xa" startLine="261" startColumn="13" endLine="261" endColumn="25"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xc">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<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"/>
<entry offset="0x1" startLine="265" startColumn="17" endLine="265" endColumn="44"/>
<entry offset="0xb" hidden="true"/>
<entry offset="0xe" startLine="266" startColumn="21" endLine="266" endColumn="35"/>
<entry offset="0x16" startLine="267" startColumn="17" endLine="267" endColumn="21"/>
<entry offset="0x17" startLine="268" startColumn="21" endLine="268" endColumn="36"/>
<entry offset="0x1b" startLine="270" startColumn="13" endLine="270" endColumn="25"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x1d">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<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"/>
<entry offset="0x1" startLine="274" startColumn="17" endLine="274" endColumn="35"/>
<entry offset="0x8" startLine="275" startColumn="13" endLine="275" endColumn="20"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
</scope>
</method>
<method containingType="My.MyProject+MyWebServices" name=".ctor">
<sequencePoints>
<entry offset="0x0" startLine="279" startColumn="13" endLine="279" endColumn="29"/>
<entry offset="0x1" startLine="280" startColumn="16" endLine="280" endColumn="28"/>
<entry offset="0x8" startLine="281" startColumn="13" endLine="281" endColumn="20"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
</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"/>
<entry offset="0x1" startLine="342" startColumn="21" endLine="342" endColumn="59"/>
<entry offset="0xf" hidden="true"/>
<entry offset="0x12" startLine="342" startColumn="60" endLine="342" endColumn="87"/>
<entry offset="0x1c" startLine="343" startColumn="21" endLine="343" endColumn="47"/>
<entry offset="0x24" startLine="344" startColumn="17" endLine="344" endColumn="24"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x26">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<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"/>
<entry offset="0x1" startLine="351" startColumn="17" endLine="351" endColumn="29"/>
<entry offset="0x8" startLine="352" startColumn="13" endLine="352" endColumn="20"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
</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>
<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"/>
<entry offset="0x1" startLine="6" startColumn="13" endLine="6" endColumn="29"/>
<entry offset="0x3" startLine="7" startColumn="9" endLine="7" endColumn="12"/>
<entry offset="0x4" startLine="8" startColumn="17" endLine="8" endColumn="34"/>
<entry offset="0xa" startLine="9" startColumn="1" endLine="9" endColumn="8"/>
<entry offset="0xb" startLine="10" startColumn="1" endLine="10" endColumn="8"/>
<entry offset="0xc" startLine="11" startColumn="13" endLine="11" endColumn="26"/>
<entry offset="0x11" hidden="true"/>
<entry offset="0x14" startLine="12" startColumn="17" endLine="12" endColumn="38"/>
<entry offset="0x1a" startLine="13" startColumn="13" endLine="13" endColumn="19"/>
<entry offset="0x1d" hidden="true"/>
<entry offset="0x24" startLine="14" startColumn="9" endLine="14" endColumn="30"/>
<entry offset="0x25" startLine="15" startColumn="17" endLine="15" endColumn="34"/>
<entry offset="0x2c" startLine="16" startColumn="13" endLine="16" endColumn="33"/>
<entry offset="0x33" startLine="17" startColumn="13" endLine="17" endColumn="18"/>
<entry offset="0x35" startLine="18" startColumn="13" endLine="18" endColumn="24"/>
<entry offset="0x3c" hidden="true"/>
<entry offset="0x3e" startLine="19" startColumn="9" endLine="19" endColumn="16"/>
<entry offset="0x3f" startLine="20" startColumn="17" endLine="20" endColumn="34"/>
<entry offset="0x46" startLine="21" startColumn="13" endLine="21" endColumn="33"/>
<entry offset="0x4e" startLine="22" startColumn="9" endLine="22" endColumn="16"/>
<entry offset="0x4f" startLine="24" startColumn="9" endLine="24" endColumn="29"/>
<entry offset="0x56" startLine="26" startColumn="5" endLine="26" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="6" startColumn="13" endLine="6" endColumn="29"/>
<entry offset="0x3" startLine="7" startColumn="9" endLine="7" endColumn="12"/>
<entry offset="0x4" startLine="8" startColumn="17" endLine="8" endColumn="34"/>
<entry offset="0xa" startLine="9" startColumn="1" endLine="9" endColumn="8"/>
<entry offset="0xb" startLine="10" startColumn="1" endLine="10" endColumn="8"/>
<entry offset="0xc" startLine="11" startColumn="13" endLine="11" endColumn="22"/>
<entry offset="0x12" hidden="true"/>
<entry offset="0x25" startLine="12" startColumn="9" endLine="12" endColumn="60"/>
<entry offset="0x2f" hidden="true"/>
<entry offset="0x35" hidden="true"/>
<entry offset="0x36" startLine="13" startColumn="17" endLine="13" endColumn="34"/>
<entry offset="0x3d" startLine="14" startColumn="13" endLine="14" endColumn="33"/>
<entry offset="0x44" startLine="15" startColumn="13" endLine="15" endColumn="18"/>
<entry offset="0x46" startLine="16" startColumn="13" endLine="16" endColumn="24"/>
<entry offset="0x4d" hidden="true"/>
<entry offset="0x4f" startLine="17" startColumn="9" endLine="17" endColumn="16"/>
<entry offset="0x50" startLine="18" startColumn="17" endLine="18" endColumn="34"/>
<entry offset="0x57" startLine="19" startColumn="13" endLine="19" endColumn="33"/>
<entry offset="0x5f" startLine="20" startColumn="9" endLine="20" endColumn="16"/>
<entry offset="0x60" startLine="22" startColumn="9" endLine="22" endColumn="29"/>
<entry offset="0x67" startLine="24" startColumn="5" endLine="24" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="5" startColumn="13" endLine="5" endColumn="29"/>
<entry offset="0x3" hidden="true"/>
<entry offset="0x5" startLine="7" startColumn="17" endLine="7" endColumn="37"/>
<entry offset="0x9" startLine="8" startColumn="13" endLine="8" endColumn="18"/>
<entry offset="0xb" startLine="9" startColumn="9" endLine="9" endColumn="13"/>
<entry offset="0xc" startLine="6" startColumn="9" endLine="6" endColumn="26"/>
<entry offset="0x14" hidden="true"/>
<entry offset="0x17" startLine="10" startColumn="5" endLine="10" endColumn="12"/>
</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>
<methods>
<method containingType="C1" name=".ctor">
<sequencePoints>
<entry offset="0x0" startLine="2" startColumn="5" endLine="2" endColumn="14"/>
<entry offset="0x8" startLine="3" startColumn="9" endLine="3" endColumn="50"/>
<entry offset="0x13" startLine="4" startColumn="5" endLine="4" endColumn="12"/>
</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>
<methods>
<method containingType="C1" name=".ctor">
<sequencePoints>
<entry offset="0x0" startLine="2" startColumn="5" endLine="2" endColumn="14"/>
<entry offset="0x8" startLine="3" startColumn="9" endLine="3" endColumn="16"/>
<entry offset="0x9" startLine="4" startColumn="9" endLine="4" endColumn="16"/>
<entry offset="0xa" startLine="5" startColumn="9" endLine="5" endColumn="16"/>
<entry offset="0xb" startLine="7" startColumn="9" endLine="7" endColumn="20"/>
</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>
<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"/>
<entry offset="0x1" startLine="5" startColumn="9" endLine="5" endColumn="20"/>
<entry offset="0x8" hidden="true"/>
<entry offset="0xb" startLine="6" startColumn="13" endLine="6" endColumn="33"/>
<entry offset="0x12" startLine="9" startColumn="9" endLine="9" endColumn="15"/>
<entry offset="0x15" startLine="7" startColumn="9" endLine="7" endColumn="13"/>
<entry offset="0x16" startLine="8" startColumn="13" endLine="8" endColumn="33"/>
<entry offset="0x1d" startLine="9" startColumn="9" endLine="9" endColumn="15"/>
<entry offset="0x1e" startLine="11" startColumn="9" endLine="11" endColumn="29"/>
<entry offset="0x25" startLine="12" startColumn="5" endLine="12" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" hidden="true"/>
<entry offset="0x3" startLine="6" startColumn="13" endLine="6" endColumn="33"/>
<entry offset="0xa" startLine="7" startColumn="9" endLine="7" endColumn="13"/>
<entry offset="0xb" startLine="5" startColumn="9" endLine="5" endColumn="21"/>
<entry offset="0x12" hidden="true"/>
<entry offset="0x15" startLine="8" startColumn="5" endLine="8" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="5" startColumn="9" endLine="5" endColumn="11"/>
<entry offset="0x2" startLine="6" startColumn="13" endLine="6" endColumn="33"/>
<entry offset="0x9" startLine="7" startColumn="9" endLine="7" endColumn="23"/>
<entry offset="0x11" hidden="true"/>
<entry offset="0x14" startLine="8" startColumn="5" endLine="8" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="5" startColumn="9" endLine="5" endColumn="39"/>
<entry offset="0x1b" hidden="true"/>
<entry offset="0x1d" startLine="6" startColumn="13" endLine="6" endColumn="33"/>
<entry offset="0x24" startLine="7" startColumn="9" endLine="7" endColumn="13"/>
<entry offset="0x28" hidden="true"/>
<entry offset="0x36" startLine="8" startColumn="5" endLine="8" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="5" startColumn="9" endLine="5" endColumn="25"/>
<entry offset="0xa" startLine="6" startColumn="13" endLine="6" endColumn="22"/>
<entry offset="0x15" hidden="true"/>
<entry offset="0x18" startLine="7" startColumn="17" endLine="7" endColumn="37"/>
<entry offset="0x21" startLine="8" startColumn="13" endLine="8" endColumn="22"/>
<entry offset="0x2c" hidden="true"/>
<entry offset="0x2f" startLine="9" startColumn="17" endLine="9" endColumn="37"/>
<entry offset="0x36" startLine="10" startColumn="9" endLine="10" endColumn="19"/>
<entry offset="0x37" startLine="11" startColumn="5" endLine="11" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="6" startColumn="13" endLine="6" endColumn="29"/>
<entry offset="0x3" startLine="6" startColumn="31" endLine="6" endColumn="49"/>
<entry offset="0xb" startLine="8" startColumn="9" endLine="8" endColumn="23"/>
<entry offset="0x11" hidden="true"/>
<entry offset="0x14" startLine="8" startColumn="28" endLine="8" endColumn="46"/>
<entry offset="0x1a" startLine="8" startColumn="49" endLine="8" endColumn="69"/>
<entry offset="0x23" startLine="8" startColumn="70" endLine="8" endColumn="74"/>
<entry offset="0x24" startLine="8" startColumn="75" endLine="8" endColumn="99"/>
<entry offset="0x2f" startLine="8" startColumn="102" endLine="8" endColumn="127"/>
<entry offset="0x3a" startLine="9" startColumn="9" endLine="9" endColumn="23"/>
<entry offset="0x41" hidden="true"/>
<entry offset="0x45" startLine="9" startColumn="24" endLine="9" endColumn="47"/>
<entry offset="0x50" startLine="9" startColumn="50" endLine="9" endColumn="74"/>
<entry offset="0x5d" startLine="9" startColumn="75" endLine="9" endColumn="79"/>
<entry offset="0x5e" startLine="9" startColumn="84" endLine="9" endColumn="103"/>
<entry offset="0x65" startLine="9" startColumn="106" endLine="9" endColumn="126"/>
<entry offset="0x6d" hidden="true"/>
<entry offset="0x6f" startLine="12" startColumn="13" endLine="12" endColumn="26"/>
<entry offset="0x75" hidden="true"/>
<entry offset="0x79" startLine="13" startColumn="17" endLine="13" endColumn="40"/>
<entry offset="0x84" startLine="23" startColumn="13" endLine="23" endColumn="19"/>
<entry offset="0x87" startLine="14" startColumn="13" endLine="14" endColumn="30"/>
<entry offset="0x8d" hidden="true"/>
<entry offset="0x91" startLine="15" startColumn="21" endLine="15" endColumn="40"/>
<entry offset="0x98" startLine="16" startColumn="17" endLine="16" endColumn="38"/>
<entry offset="0xa0" startLine="23" startColumn="13" endLine="23" endColumn="19"/>
<entry offset="0xa3" startLine="17" startColumn="13" endLine="17" endColumn="30"/>
<entry offset="0xa9" hidden="true"/>
<entry offset="0xad" startLine="18" startColumn="21" endLine="18" endColumn="40"/>
<entry offset="0xb4" startLine="19" startColumn="17" endLine="19" endColumn="38"/>
<entry offset="0xbc" startLine="23" startColumn="13" endLine="23" endColumn="19"/>
<entry offset="0xbf" startLine="20" startColumn="13" endLine="20" endColumn="17"/>
<entry offset="0xc0" startLine="21" startColumn="21" endLine="21" endColumn="42"/>
<entry offset="0xc7" startLine="22" startColumn="17" endLine="22" endColumn="38"/>
<entry offset="0xcf" startLine="23" startColumn="13" endLine="23" endColumn="19"/>
<entry offset="0xd0" startLine="25" startColumn="17" endLine="25" endColumn="40"/>
<entry offset="0xd5" startLine="26" startColumn="13" endLine="26" endColumn="21"/>
<entry offset="0xd8" startLine="27" startColumn="9" endLine="27" endColumn="13"/>
<entry offset="0xd9" startLine="11" startColumn="9" endLine="11" endColumn="23"/>
<entry offset="0xdf" hidden="true"/>
<entry offset="0xe3" startLine="29" startColumn="5" endLine="29" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="6" startColumn="13" endLine="6" endColumn="29"/>
<entry offset="0x3" hidden="true"/>
<entry offset="0x5" startLine="8" startColumn="13" endLine="8" endColumn="26"/>
<entry offset="0xa" hidden="true"/>
<entry offset="0xd" startLine="9" startColumn="17" endLine="9" endColumn="40"/>
<entry offset="0x18" startLine="19" startColumn="13" endLine="19" endColumn="19"/>
<entry offset="0x1b" startLine="10" startColumn="13" endLine="10" endColumn="30"/>
<entry offset="0x20" hidden="true"/>
<entry offset="0x23" startLine="11" startColumn="21" endLine="11" endColumn="40"/>
<entry offset="0x2a" startLine="12" startColumn="17" endLine="12" endColumn="38"/>
<entry offset="0x32" startLine="19" startColumn="13" endLine="19" endColumn="19"/>
<entry offset="0x35" startLine="13" startColumn="13" endLine="13" endColumn="30"/>
<entry offset="0x3b" hidden="true"/>
<entry offset="0x3f" startLine="14" startColumn="21" endLine="14" endColumn="40"/>
<entry offset="0x46" startLine="15" startColumn="17" endLine="15" endColumn="38"/>
<entry offset="0x4e" startLine="19" startColumn="13" endLine="19" endColumn="19"/>
<entry offset="0x51" startLine="16" startColumn="13" endLine="16" endColumn="17"/>
<entry offset="0x52" startLine="17" startColumn="21" endLine="17" endColumn="42"/>
<entry offset="0x59" startLine="18" startColumn="17" endLine="18" endColumn="38"/>
<entry offset="0x61" startLine="19" startColumn="13" endLine="19" endColumn="19"/>
<entry offset="0x62" startLine="21" startColumn="17" endLine="21" endColumn="40"/>
<entry offset="0x66" startLine="22" startColumn="13" endLine="22" endColumn="21"/>
<entry offset="0x68" startLine="23" startColumn="9" endLine="23" endColumn="13"/>
<entry offset="0x69" startLine="7" startColumn="9" endLine="7" endColumn="23"/>
<entry offset="0x6f" hidden="true"/>
<entry offset="0x73" startLine="25" startColumn="5" endLine="25" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="6" startColumn="13" endLine="6" endColumn="29"/>
<entry offset="0x3" startLine="8" startColumn="9" endLine="8" endColumn="11"/>
<entry offset="0x4" startLine="9" startColumn="13" endLine="9" endColumn="26"/>
<entry offset="0x9" hidden="true"/>
<entry offset="0xc" startLine="10" startColumn="17" endLine="10" endColumn="40"/>
<entry offset="0x17" startLine="20" startColumn="13" endLine="20" endColumn="19"/>
<entry offset="0x1a" startLine="11" startColumn="13" endLine="11" endColumn="30"/>
<entry offset="0x1f" hidden="true"/>
<entry offset="0x22" startLine="12" startColumn="21" endLine="12" endColumn="40"/>
<entry offset="0x29" startLine="13" startColumn="17" endLine="13" endColumn="38"/>
<entry offset="0x31" startLine="20" startColumn="13" endLine="20" endColumn="19"/>
<entry offset="0x34" startLine="14" startColumn="13" endLine="14" endColumn="30"/>
<entry offset="0x3a" hidden="true"/>
<entry offset="0x3e" startLine="15" startColumn="21" endLine="15" endColumn="40"/>
<entry offset="0x45" startLine="16" startColumn="17" endLine="16" endColumn="38"/>
<entry offset="0x4d" startLine="20" startColumn="13" endLine="20" endColumn="19"/>
<entry offset="0x50" startLine="17" startColumn="13" endLine="17" endColumn="17"/>
<entry offset="0x51" startLine="18" startColumn="21" endLine="18" endColumn="42"/>
<entry offset="0x58" startLine="19" startColumn="17" endLine="19" endColumn="38"/>
<entry offset="0x60" startLine="20" startColumn="13" endLine="20" endColumn="19"/>
<entry offset="0x61" startLine="22" startColumn="17" endLine="22" endColumn="40"/>
<entry offset="0x65" startLine="23" startColumn="13" endLine="23" endColumn="21"/>
<entry offset="0x67" startLine="24" startColumn="9" endLine="24" endColumn="25"/>
<entry offset="0x6e" hidden="true"/>
<entry offset="0x72" startLine="26" startColumn="5" endLine="26" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="6" startColumn="13" endLine="6" endColumn="29"/>
<entry offset="0x3" startLine="8" startColumn="9" endLine="8" endColumn="11"/>
<entry offset="0x4" startLine="9" startColumn="17" endLine="9" endColumn="40"/>
<entry offset="0x8" startLine="10" startColumn="13" endLine="10" endColumn="21"/>
<entry offset="0xa" startLine="11" startColumn="9" endLine="11" endColumn="13"/>
</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, "DevDiv")>
<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"/>
compilation.VerifyPdb("MyMod.Main",
<symbols>
<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"/>
<entry offset="0x1" startLine="6" startColumn="9" endLine="6" endColumn="37"/>
<entry offset="0x6" hidden="true"/>
<entry offset="0x9" startLine="7" startColumn="13" endLine="7" endColumn="38"/>
<entry offset="0x14" startLine="10" startColumn="9" endLine="10" endColumn="15"/>
<entry offset="0x17" startLine="8" startColumn="9" endLine="8" endColumn="13"/>
<entry offset="0x18" startLine="9" startColumn="13" endLine="9" endColumn="38"/>
<entry offset="0x23" startLine="10" startColumn="9" endLine="10" endColumn="15"/>
<entry offset="0x24" startLine="11" startColumn="5" endLine="11" endColumn="12"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x25">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<WorkItem(538821, "DevDiv")>
<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>
<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"/>
<entry offset="0x1" startLine="6" startColumn="9" endLine="6" endColumn="31"/>
<entry offset="0xc" startLine="8" startColumn="9" endLine="8" endColumn="28"/>
<entry offset="0x10" startLine="10" startColumn="9" endLine="10" endColumn="15"/>
<entry offset="0x11" startLine="12" startColumn="9" endLine="12" endColumn="29"/>
<entry offset="0x15" startLine="14" startColumn="9" endLine="14" endColumn="15"/>
<entry offset="0x16" startLine="16" startColumn="9" endLine="16" endColumn="31"/>
<entry offset="0x21" startLine="17" startColumn="5" endLine="17" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="8" startColumn="9" endLine="8" endColumn="24"/>
<entry offset="0x5" startLine="11" startColumn="9" endLine="11" endColumn="15"/>
<entry offset="0x6" startLine="14" startColumn="9" endLine="14" endColumn="24"/>
<entry offset="0xa" hidden="true"/>
<entry offset="0xb" startLine="16" startColumn="9" endLine="16" endColumn="12"/>
<entry offset="0xe" hidden="true"/>
<entry offset="0x15" startLine="17" startColumn="9" endLine="17" endColumn="30"/>
<entry offset="0x1d" hidden="true"/>
<entry offset="0x1f" startLine="18" startColumn="9" endLine="18" endColumn="16"/>
<entry offset="0x20" startLine="20" startColumn="13" endLine="20" endColumn="28"/>
<entry offset="0x25" hidden="true"/>
<entry offset="0x26" startLine="21" startColumn="9" endLine="21" endColumn="16"/>
<entry offset="0x27" startLine="23" startColumn="5" endLine="23" endColumn="12"/>
</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, "DevDiv")>
<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>
<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"/>
<entry offset="0x1" startLine="8" startColumn="9" endLine="8" endColumn="15"/>
<entry offset="0x5" startLine="9" startColumn="9" endLine="9" endColumn="15"/>
<entry offset="0x9" startLine="10" startColumn="9" endLine="10" endColumn="15"/>
<entry offset="0xd" startLine="11" startColumn="9" endLine="11" endColumn="14"/>
<entry offset="0xf" startLine="12" startColumn="9" endLine="12" endColumn="14"/>
<entry offset="0x12" startLine="13" startColumn="9" endLine="13" endColumn="14"/>
<entry offset="0x15" startLine="14" startColumn="13" endLine="14" endColumn="32"/>
<entry offset="0x19" startLine="15" startColumn="9" endLine="15" endColumn="11"/>
<entry offset="0x1a" startLine="16" startColumn="13" endLine="16" endColumn="44"/>
<entry offset="0x2b" startLine="17" startColumn="13" endLine="17" endColumn="22"/>
<entry offset="0x43" hidden="true"/>
<entry offset="0x48" hidden="true"/>
<entry offset="0x4d" startLine="20" startColumn="21" endLine="20" endColumn="30"/>
<entry offset="0x54" startLine="21" startColumn="21" endLine="21" endColumn="49"/>
<entry offset="0x66" hidden="true"/>
<entry offset="0x68" startLine="23" startColumn="25" endLine="23" endColumn="53"/>
<entry offset="0x79" startLine="24" startColumn="25" endLine="24" endColumn="27"/>
<entry offset="0x7a" startLine="25" startColumn="29" endLine="25" endColumn="57"/>
<entry offset="0x8c" startLine="26" startColumn="29" endLine="26" endColumn="38"/>
<entry offset="0x93" startLine="27" startColumn="25" endLine="27" endColumn="47"/>
<entry offset="0xa8" hidden="true"/>
<entry offset="0xac" startLine="28" startColumn="25" endLine="28" endColumn="34"/>
<entry offset="0xc4" startLine="29" startColumn="21" endLine="29" endColumn="25"/>
<entry offset="0xc5" startLine="22" startColumn="21" endLine="22" endColumn="41"/>
<entry offset="0xdc" hidden="true"/>
<entry offset="0xe0" startLine="30" startColumn="17" endLine="30" endColumn="21"/>
<entry offset="0xe1" startLine="19" startColumn="17" endLine="19" endColumn="46"/>
<entry offset="0xf1" hidden="true"/>
<entry offset="0xf8" startLine="31" startColumn="17" endLine="31" endColumn="26"/>
<entry offset="0x110" startLine="32" startColumn="17" endLine="32" endColumn="46"/>
<entry offset="0x121" startLine="33" startColumn="13" endLine="33" endColumn="22"/>
<entry offset="0x122" startLine="18" startColumn="13" endLine="18" endColumn="26"/>
<entry offset="0x138" hidden="true"/>
<entry offset="0x13f" startLine="34" startColumn="9" endLine="34" endColumn="28"/>
<entry offset="0x158" hidden="true"/>
<entry offset="0x15f" startLine="35" startColumn="5" endLine="35" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="7" startColumn="9" endLine="7" endColumn="20"/>
<entry offset="0x7" startLine="8" startColumn="13" endLine="8" endColumn="34"/>
<entry offset="0xd" startLine="9" startColumn="9" endLine="9" endColumn="15"/>
<entry offset="0xf" hidden="true"/>
<entry offset="0x11" startLine="11" startColumn="13" endLine="11" endColumn="48"/>
<entry offset="0x23" startLine="12" startColumn="13" endLine="12" endColumn="33"/>
<entry offset="0x2a" startLine="13" startColumn="13" endLine="13" endColumn="26"/>
<entry offset="0x30" startLine="14" startColumn="13" endLine="14" endColumn="23"/>
<entry offset="0x34" startLine="15" startColumn="9" endLine="15" endColumn="18"/>
<entry offset="0x35" startLine="10" startColumn="9" endLine="10" endColumn="20"/>
<entry offset="0x3b" hidden="true"/>
<entry offset="0x3f" startLine="16" startColumn="5" endLine="16" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="5" startColumn="13" endLine="6" endColumn="74"/>
<entry offset="0x26" startLine="8" startColumn="13" endLine="8" endColumn="45"/>
<entry offset="0x31" startLine="10" startColumn="9" endLine="10" endColumn="41"/>
<entry offset="0x39" startLine="11" startColumn="9" endLine="11" endColumn="44"/>
<entry offset="0x41" startLine="13" startColumn="9" endLine="13" endColumn="28"/>
<entry offset="0x48" startLine="14" startColumn="5" endLine="14" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="31"/>
<entry offset="0x3" startLine="5" startColumn="9" endLine="5" endColumn="24"/>
<entry offset="0x4" startLine="6" startColumn="9" endLine="6" endColumn="19"/>
<entry offset="0x5" startLine="7" startColumn="5" endLine="7" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="31"/>
<entry offset="0x3" startLine="5" startColumn="9" endLine="5" endColumn="24"/>
<entry offset="0xa" startLine="6" startColumn="13" endLine="6" endColumn="19"/>
<entry offset="0xd" startLine="7" startColumn="9" endLine="7" endColumn="19"/>
<entry offset="0xe" startLine="9" startColumn="9" endLine="9" endColumn="24"/>
<entry offset="0x11" startLine="10" startColumn="13" endLine="10" endColumn="22"/>
<entry offset="0x14" startLine="11" startColumn="9" endLine="11" endColumn="19"/>
<entry offset="0x15" startLine="12" startColumn="5" endLine="12" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="31"/>
<entry offset="0x3" startLine="5" startColumn="9" endLine="5" endColumn="24"/>
<entry offset="0x6" startLine="6" startColumn="13" endLine="6" endColumn="19"/>
<entry offset="0xb" hidden="true"/>
<entry offset="0x10" startLine="7" startColumn="13" endLine="7" endColumn="19"/>
<entry offset="0x15" hidden="true"/>
<entry offset="0x1a" startLine="8" startColumn="13" endLine="8" endColumn="27"/>
<entry offset="0x2f" hidden="true"/>
<entry offset="0x34" startLine="9" startColumn="13" endLine="9" endColumn="22"/>
<entry offset="0x35" startLine="10" startColumn="9" endLine="10" endColumn="19"/>
<entry offset="0x36" startLine="11" startColumn="5" endLine="11" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="31"/>
<entry offset="0x3" startLine="5" startColumn="9" endLine="5" endColumn="24"/>
<entry offset="0x30" startLine="6" startColumn="13" endLine="6" endColumn="19"/>
<entry offset="0x31" startLine="7" startColumn="17" endLine="7" endColumn="39"/>
<entry offset="0x3e" startLine="8" startColumn="13" endLine="8" endColumn="19"/>
<entry offset="0x3f" startLine="9" startColumn="17" endLine="9" endColumn="39"/>
<entry offset="0x4c" startLine="10" startColumn="13" endLine="10" endColumn="42"/>
<entry offset="0x4f" startLine="11" startColumn="13" endLine="11" endColumn="22"/>
<entry offset="0x50" startLine="12" startColumn="17" endLine="12" endColumn="42"/>
<entry offset="0x5d" startLine="13" startColumn="9" endLine="13" endColumn="19"/>
<entry offset="0x5e" startLine="14" startColumn="5" endLine="14" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="31"/>
<entry offset="0x3" startLine="5" startColumn="9" endLine="5" endColumn="28"/>
<entry offset="0x34" startLine="6" startColumn="13" endLine="6" endColumn="19"/>
<entry offset="0x35" startLine="7" startColumn="17" endLine="7" endColumn="38"/>
<entry offset="0x42" startLine="8" startColumn="13" endLine="8" endColumn="19"/>
<entry offset="0x43" startLine="9" startColumn="17" endLine="9" endColumn="39"/>
<entry offset="0x50" startLine="10" startColumn="13" endLine="10" endColumn="42"/>
<entry offset="0x51" startLine="11" startColumn="17" endLine="11" endColumn="39"/>
<entry offset="0x5e" startLine="12" startColumn="13" endLine="12" endColumn="22"/>
<entry offset="0x5f" startLine="13" startColumn="17" endLine="13" endColumn="42"/>
<entry offset="0x6c" startLine="14" startColumn="9" endLine="14" endColumn="19"/>
<entry offset="0x6d" startLine="15" startColumn="5" endLine="15" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="31"/>
<entry offset="0x3" startLine="5" startColumn="9" endLine="5" endColumn="24"/>
<entry offset="0x6" startLine="6" startColumn="13" endLine="6" endColumn="19"/>
<entry offset="0xb" hidden="true"/>
<entry offset="0xe" startLine="7" startColumn="17" endLine="7" endColumn="39"/>
<entry offset="0x1b" startLine="8" startColumn="13" endLine="8" endColumn="19"/>
<entry offset="0x20" hidden="true"/>
<entry offset="0x23" startLine="9" startColumn="17" endLine="9" endColumn="39"/>
<entry offset="0x30" startLine="10" startColumn="13" endLine="10" endColumn="31"/>
<entry offset="0x42" hidden="true"/>
<entry offset="0x47" startLine="12" startColumn="17" endLine="12" endColumn="42"/>
<entry offset="0x52" startLine="13" startColumn="9" endLine="13" endColumn="19"/>
<entry offset="0x53" startLine="14" startColumn="5" endLine="14" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="31"/>
<entry offset="0x3" startLine="5" startColumn="9" endLine="5" endColumn="28"/>
<entry offset="0x8" startLine="6" startColumn="13" endLine="6" endColumn="19"/>
<entry offset="0xd" hidden="true"/>
<entry offset="0x10" startLine="7" startColumn="17" endLine="7" endColumn="38"/>
<entry offset="0x1d" startLine="8" startColumn="13" endLine="8" endColumn="19"/>
<entry offset="0x22" hidden="true"/>
<entry offset="0x25" startLine="9" startColumn="17" endLine="9" endColumn="39"/>
<entry offset="0x32" startLine="10" startColumn="13" endLine="10" endColumn="31"/>
<entry offset="0x44" hidden="true"/>
<entry offset="0x47" startLine="11" startColumn="17" endLine="11" endColumn="39"/>
<entry offset="0x54" startLine="13" startColumn="17" endLine="13" endColumn="42"/>
<entry offset="0x5f" startLine="14" startColumn="9" endLine="14" endColumn="19"/>
<entry offset="0x60" startLine="15" startColumn="5" endLine="15" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="33"/>
<entry offset="0x7" startLine="5" startColumn="9" endLine="5" endColumn="24"/>
<entry offset="0x135" startLine="6" startColumn="13" endLine="6" endColumn="22"/>
<entry offset="0x136" startLine="7" startColumn="17" endLine="7" endColumn="40"/>
<entry offset="0x143" startLine="8" startColumn="13" endLine="8" endColumn="22"/>
<entry offset="0x144" startLine="9" startColumn="17" endLine="9" endColumn="40"/>
<entry offset="0x151" startLine="10" startColumn="13" endLine="10" endColumn="58"/>
<entry offset="0x154" startLine="11" startColumn="13" endLine="11" endColumn="22"/>
<entry offset="0x155" startLine="12" startColumn="17" endLine="12" endColumn="42"/>
<entry offset="0x162" startLine="13" startColumn="9" endLine="13" endColumn="19"/>
<entry offset="0x163" startLine="14" startColumn="5" endLine="14" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="33"/>
<entry offset="0x7" startLine="5" startColumn="9" endLine="5" endColumn="24"/>
<entry offset="0x34" startLine="6" startColumn="13" endLine="6" endColumn="22"/>
<entry offset="0x35" startLine="7" startColumn="17" endLine="7" endColumn="40"/>
<entry offset="0x42" startLine="8" startColumn="13" endLine="8" endColumn="22"/>
<entry offset="0x45" startLine="9" startColumn="13" endLine="9" endColumn="22"/>
<entry offset="0x46" startLine="10" startColumn="17" endLine="10" endColumn="40"/>
<entry offset="0x53" startLine="11" startColumn="13" endLine="11" endColumn="22"/>
<entry offset="0x56" startLine="12" startColumn="9" endLine="12" endColumn="19"/>
<entry offset="0x57" startLine="13" startColumn="5" endLine="13" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="4" startColumn="13" endLine="4" endColumn="33"/>
<entry offset="0x7" startLine="5" startColumn="9" endLine="5" endColumn="24"/>
<entry offset="0xa" startLine="6" startColumn="13" endLine="6" endColumn="22"/>
<entry offset="0x1a" hidden="true"/>
<entry offset="0x1d" startLine="7" startColumn="17" endLine="7" endColumn="40"/>
<entry offset="0x2a" startLine="8" startColumn="13" endLine="8" endColumn="36"/>
<entry offset="0x4f" hidden="true"/>
<entry offset="0x54" startLine="9" startColumn="13" endLine="9" endColumn="22"/>
<entry offset="0x64" hidden="true"/>
<entry offset="0x67" startLine="10" startColumn="17" endLine="10" endColumn="40"/>
<entry offset="0x72" startLine="11" startColumn="9" endLine="11" endColumn="19"/>
<entry offset="0x73" startLine="12" startColumn="5" endLine="12" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="3" startColumn="13" endLine="3" endColumn="36"/>
<entry offset="0x8" startLine="4" startColumn="5" endLine="4" endColumn="12"/>
</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>
<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"/>
<entry offset="0x1" startLine="3" startColumn="13" endLine="3" endColumn="40"/>
<entry offset="0x8" startLine="4" startColumn="5" endLine="4" endColumn="12"/>
</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, "DevDiv")>
<Fact()>
Public Sub Bug727419()
Dim source =
<compilation>
<file><![CDATA[
Option Strict Off
Option Explicit Off
Imports System
Class FooDerived
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 FooDerived()
a.ComputeMatrix(2)
End Sub
End Module
' End of File
]]></file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(
source,
TestOptions.DebugExe)
compilation.VerifyPdb("FooDerived.ComputeMatrix",
<symbols>
<entryPoint declaringType="Variety" methodName="Main"/>
<methods>
<method containingType="FooDerived" 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"/>
<entry offset="0x1" startLine="14" startColumn="15" endLine="14" endColumn="22"/>
<entry offset="0xa" startLine="15" startColumn="15" endLine="15" endColumn="25"/>
<entry offset="0x14" startLine="18" startColumn="9" endLine="18" endColumn="18"/>
<entry offset="0x17" startLine="19" startColumn="9" endLine="19" endColumn="30"/>
<entry offset="0x1e" hidden="true"/>
<entry offset="0x20" startLine="20" startColumn="13" endLine="20" endColumn="21"/>
<entry offset="0x25" startLine="21" startColumn="13" endLine="21" endColumn="34"/>
<entry offset="0x3f" startLine="22" startColumn="13" endLine="22" endColumn="29"/>
<entry offset="0x46" startLine="23" startColumn="9" endLine="23" endColumn="15"/>
<entry offset="0x4a" hidden="true"/>
<entry offset="0x4f" startLine="24" startColumn="5" endLine="24" endColumn="12"/>
</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, "DevDiv")>
<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>
<entryPoint declaringType="SubMod" methodName="Main"/>
<methods>
<method containingType="SubMod" name="Main">
<sequencePoints>
<entry offset="0x0" startLine="3" startColumn="5" endLine="3" endColumn="15"/>
<entry offset="0x1" startLine="4" startColumn="1" endLine="4" endColumn="4"/>
<entry offset="0x2" startLine="5" startColumn="9" endLine="5" endColumn="16"/>
<entry offset="0x4" startLine="6" startColumn="1" endLine="6" endColumn="4"/>
<entry offset="0x5" startLine="7" startColumn="9" endLine="7" endColumn="17"/>
<entry offset="0x7" startLine="8" startColumn="1" endLine="8" endColumn="4"/>
<entry offset="0x8" startLine="9" startColumn="9" endLine="9" endColumn="16"/>
<entry offset="0xa" startLine="10" startColumn="5" endLine="10" endColumn="12"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xb">
<namespace name="System" importlevel="file"/>
<currentnamespace name=""/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<WorkItem(543703, "DevDiv")>
<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>
<methods>
<method containingType="M1" name="Main">
<sequencePoints>
<entry offset="0x0" startLine="3" startColumn="5" endLine="3" endColumn="15"/>
<entry offset="0x1" startLine="4" startColumn="9" endLine="4" endColumn="12"/>
<entry offset="0x7" startLine="5" startColumn="5" endLine="5" endColumn="12"/>
</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"/>
<entry offset="0x1" startLine="11" startColumn="5" endLine="11" endColumn="12"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x2">
<importsforward declaringType="M1" methodName="Main"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<Fact(), WorkItem(529300, "DevDiv")>
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>
<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"/>
<entry offset="0x1" startLine="18" startColumn="13" endLine="18" endColumn="30"/>
<entry offset="0x4" startLine="19" startColumn="13" endLine="19" endColumn="25"/>
<entry offset="0xb" startLine="20" startColumn="5" endLine="20" endColumn="12"/>
</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"/>
<entry offset="0x8" startLine="9" startColumn="13" endLine="9" endColumn="18"/>
<entry offset="0xf" startLine="10" startColumn="9" endLine="10" endColumn="16"/>
</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"/>
<entry offset="0x1" startLine="13" startColumn="13" endLine="13" endColumn="29"/>
<entry offset="0xa" startLine="14" startColumn="9" endLine="14" endColumn="21"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xc">
<importsforward declaringType="Module1" methodName="Main"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<WorkItem(760994, "DevDiv")>
<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>
<methods>
<method containingType="CLAZZ" name=".ctor">
<sequencePoints>
<entry offset="0x0" startLine="8" startColumn="5" endLine="8" endColumn="21"/>
<entry offset="0x1b" startLine="4" startColumn="12" endLine="4" endColumn="31"/>
<entry offset="0x22" startLine="6" startColumn="12" endLine="6" endColumn="31"/>
<entry offset="0x29" startLine="10" startColumn="5" endLine="10" endColumn="12"/>
</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 foo as String = "<%= longStringValue %>"
Console.WriteLine("Hello Word.")
Console.WriteLine(foo)
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("foo", 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("foo", longStringValue.Substring(0, 20) & "...").WithWarningAsError(True),
' Diagnostic(ERRID.ERR_WarningTreatedAsError).WithArguments("The value assigned to the constant string 'foo' 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>
<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"/>
<entry offset="0x1" startLine="5" startColumn="9" endLine="5" endColumn="23"/>
<entry offset="0xa" startLine="6" startColumn="5" endLine="6" endColumn="17"/>
</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, "DevDiv")>
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>
<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"/>
<entry offset="0x1" hidden="true"/>
<entry offset="0xe" startLine="8" startColumn="9" endLine="10" endColumn="21"/>
<entry offset="0x1d" startLine="11" startColumn="5" endLine="11" endColumn="17"/>
</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, "DevDiv")>
<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>
<methods>
<method containingType="C" name=".ctor">
<sequencePoints>
<entry offset="0x0" hidden="true"/>
<entry offset="0x7" startLine="2" startColumn="13" endLine="2" endColumn="39"/>
</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>
<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"/>
</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"/>
<entry offset="0x1" startLine="5" startColumn="108" endLine="5" endColumn="112"/>
</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"/>
<entry offset="0x1" startLine="4" startColumn="17" endLine="4" endColumn="62"/>
<entry offset="0x26" startLine="5" startColumn="17" endLine="5" endColumn="112"/>
<entry offset="0x4b" startLine="6" startColumn="13" endLine="6" endColumn="33"/>
<entry offset="0x5b" startLine="7" startColumn="9" endLine="7" endColumn="21"/>
</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"/>
<entry offset="0x1" startLine="4" startColumn="61" endLine="4" endColumn="62"/>
</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"/>
<entry offset="0x1" hidden="true"/>
<entry offset="0xe" startLine="5" startColumn="96" endLine="5" endColumn="112"/>
</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, "DevDiv")>
<WorkItem(845078, "DevDiv")>
<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>
<methods>
<method containingType="IntervalUpdate" name="Update">
<sequencePoints>
<entry offset="0x0" startLine="2" startColumn="5" endLine="2" endColumn="31"/>
<entry offset="0x1" startLine="3" startColumn="9" endLine="3" endColumn="37"/>
<entry offset="0x11" startLine="4" startColumn="5" endLine="4" endColumn="12"/>
</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"/>
<entry offset="0x1" startLine="7" startColumn="9" endLine="7" endColumn="17"/>
<entry offset="0x7" startLine="8" startColumn="5" endLine="8" endColumn="12"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x8">
<importsforward declaringType="IntervalUpdate" methodName="Update"/>
</scope>
</method>
<method containingType="My.MyComputer" name=".ctor">
<sequencePoints>
<entry offset="0x0" startLine="107" startColumn="9" endLine="107" endColumn="25"/>
<entry offset="0x1" startLine="108" startColumn="13" endLine="108" endColumn="25"/>
<entry offset="0x8" startLine="109" startColumn="9" endLine="109" endColumn="16"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<currentnamespace name="My"/>
</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"/>
<entry offset="0x1" startLine="122" startColumn="17" endLine="122" endColumn="62"/>
<entry offset="0xe" startLine="123" startColumn="13" endLine="123" endColumn="20"/>
</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"/>
<entry offset="0x1" startLine="134" startColumn="17" endLine="134" endColumn="57"/>
<entry offset="0xe" startLine="135" startColumn="13" endLine="135" endColumn="20"/>
</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"/>
<entry offset="0x1" startLine="145" startColumn="17" endLine="145" endColumn="58"/>
<entry offset="0xe" startLine="146" startColumn="13" endLine="146" endColumn="20"/>
</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"/>
<entry offset="0x1" startLine="238" startColumn="17" endLine="238" endColumn="67"/>
<entry offset="0xe" startLine="239" startColumn="13" endLine="239" endColumn="20"/>
</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="My.MyProject" name=".cctor">
<sequencePoints>
<entry offset="0x0" startLine="126" startColumn="26" endLine="126" endColumn="97"/>
<entry offset="0xa" startLine="137" startColumn="26" endLine="137" endColumn="95"/>
<entry offset="0x14" startLine="148" startColumn="26" endLine="148" endColumn="136"/>
<entry offset="0x1e" startLine="284" startColumn="26" endLine="284" endColumn="105"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x29">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
</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"/>
<entry offset="0x1" startLine="248" startColumn="17" endLine="248" endColumn="40"/>
<entry offset="0x10" startLine="249" startColumn="13" endLine="249" endColumn="25"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x12">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<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"/>
<entry offset="0x1" startLine="252" startColumn="17" endLine="252" endColumn="42"/>
<entry offset="0xa" startLine="253" startColumn="13" endLine="253" endColumn="25"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xc">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<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"/>
<entry offset="0x1" startLine="256" startColumn="17" endLine="256" endColumn="46"/>
<entry offset="0xe" startLine="257" startColumn="13" endLine="257" endColumn="25"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x10">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<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"/>
<entry offset="0x1" startLine="260" startColumn="17" endLine="260" endColumn="39"/>
<entry offset="0xa" startLine="261" startColumn="13" endLine="261" endColumn="25"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0xc">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<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"/>
<entry offset="0x1" startLine="265" startColumn="17" endLine="265" endColumn="44"/>
<entry offset="0xb" hidden="true"/>
<entry offset="0xe" startLine="266" startColumn="21" endLine="266" endColumn="35"/>
<entry offset="0x16" startLine="267" startColumn="17" endLine="267" endColumn="21"/>
<entry offset="0x17" startLine="268" startColumn="21" endLine="268" endColumn="36"/>
<entry offset="0x1b" startLine="270" startColumn="13" endLine="270" endColumn="25"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x1d">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<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"/>
<entry offset="0x1" startLine="274" startColumn="17" endLine="274" endColumn="35"/>
<entry offset="0x8" startLine="275" startColumn="13" endLine="275" endColumn="20"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
</scope>
</method>
<method containingType="My.MyProject+MyWebServices" name=".ctor">
<sequencePoints>
<entry offset="0x0" startLine="279" startColumn="13" endLine="279" endColumn="29"/>
<entry offset="0x1" startLine="280" startColumn="16" endLine="280" endColumn="28"/>
<entry offset="0x8" startLine="281" startColumn="13" endLine="281" endColumn="20"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
</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"/>
<entry offset="0x1" startLine="342" startColumn="21" endLine="342" endColumn="59"/>
<entry offset="0xf" hidden="true"/>
<entry offset="0x12" startLine="342" startColumn="60" endLine="342" endColumn="87"/>
<entry offset="0x1c" startLine="343" startColumn="21" endLine="343" endColumn="47"/>
<entry offset="0x24" startLine="344" startColumn="17" endLine="344" endColumn="24"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x26">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
<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"/>
<entry offset="0x1" startLine="351" startColumn="17" endLine="351" endColumn="29"/>
<entry offset="0x8" startLine="352" startColumn="13" endLine="352" endColumn="20"/>
</sequencePoints>
<scope startOffset="0x0" endOffset="0x9">
<importsforward declaringType="My.MyComputer" methodName=".ctor"/>
</scope>
</method>
</methods>
</symbols>)
End Sub
<WorkItem(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>
<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"/>
<entry offset="0x1" startLine="77" startColumn="13" endLine="77" endColumn="16"/>
<entry offset="0x2" startLine="78" startColumn="16" endLine="78" endColumn="133"/>
<entry offset="0xf" startLine="79" startColumn="13" endLine="79" endColumn="20"/>
<entry offset="0x11" startLine="80" startColumn="13" endLine="80" endColumn="20"/>
<entry offset="0x12" startLine="81" startColumn="13" endLine="81" endColumn="37"/>
<entry offset="0x1e" startLine="82" startColumn="9" endLine="82" endColumn="16"/>
</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>
<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"/>
<entry offset="0x1" startLine="4" startColumn="9" endLine="4" endColumn="28"/>
<entry offset="0x32" startLine="5" startColumn="13" endLine="5" endColumn="21"/>
<entry offset="0x33" startLine="6" startColumn="17" endLine="6" endColumn="37"/>
<entry offset="0x3c" startLine="7" startColumn="13" endLine="7" endColumn="21"/>
<entry offset="0x3d" startLine="8" startColumn="17" endLine="8" endColumn="37"/>
<entry offset="0x46" startLine="9" startColumn="13" endLine="9" endColumn="21"/>
<entry offset="0x47" startLine="10" startColumn="17" endLine="10" endColumn="37"/>
<entry offset="0x50" startLine="11" startColumn="9" endLine="11" endColumn="19"/>
<entry offset="0x51" startLine="12" startColumn="5" endLine="12" endColumn="12"/>
</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>
<methods>
<method containingType="C`1" name="F">
<sequencePoints>
<entry offset="0x0" startLine="18" startColumn="5" endLine="18" endColumn="25"/>
<entry offset="0x1" startLine="48" startColumn="5" endLine="48" endColumn="12"/>
</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
End Class
End Namespace
|
jroggeman/roslyn
|
src/Compilers/VisualBasic/Test/Emit/PDB/PDBTests.vb
|
Visual Basic
|
apache-2.0
| 177,137
|
Imports Microsoft.VisualBasic
Imports System.IO
Imports Aspose.Cells
Imports System.Data
Imports System
Namespace Data.Handling.Importing
Public Class ImportingFromDataColumn
Public Shared Sub Run()
' ExStart:1
' The path to the documents directory.
Dim dataDir As String = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
' Create directory if it is not already present.
Dim IsExists As Boolean = System.IO.Directory.Exists(dataDir)
If (Not IsExists) Then
System.IO.Directory.CreateDirectory(dataDir)
End If
' Instantiating a "Products" DataTable object
Dim dataTable As New DataTable("Products")
' Adding columns to the DataTable object
dataTable.Columns.Add("Product ID", GetType(Int32))
dataTable.Columns.Add("Product Name", GetType(String))
dataTable.Columns.Add("Units In Stock", GetType(Int32))
' Creating an empty row in the DataTable object
Dim dr As DataRow = dataTable.NewRow()
' Adding data to the row
dr(0) = 1
dr(1) = "Aniseed Syrup"
dr(2) = 15
' Adding filled row to the DataTable object
dataTable.Rows.Add(dr)
' Creating another empty row in the DataTable object
dr = dataTable.NewRow()
' Adding data to the row
dr(0) = 2
dr(1) = "Boston Crab Meat"
dr(2) = 123
' Adding filled row to the DataTable object
dataTable.Rows.Add(dr)
' Instantiate a new Workbook
Dim book As New Workbook()
Dim sheet As Worksheet = book.Worksheets(0)
' Create import options
Dim importOptions As New ImportTableOptions()
importOptions.IsFieldNameShown = True
importOptions.IsHtmlString = True
' Importing the values of 2nd column of the data table
sheet.Cells.ImportData(dataTable, 1, 1, importOptions)
' Save workbook
book.Save(dataDir & "output.xls")
' ExEnd:1
End Sub
End Class
End Namespace
|
maria-shahid-aspose/Aspose.Cells-for-.NET
|
Examples/VisualBasic/Data/Handling/Importing/ImportingFromDataColumn.vb
|
Visual Basic
|
mit
| 2,274
|
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Namespace Articles
Public Partial Class CopyAndPasteRows
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub CopyAndPasteRows_Load(sender As Object, e As EventArgs)
' ExStart:1
' Indicates whether to copy/paste based on clipboard, so that it can copy/paste with MS-EXCEL.
' It will only copy/paste cell value and will not copy any other setting of the cell like format, border style and so on.
' The default value is false.
gridDesktop1.EnableClipboardCopyPaste = True
' ExEnd:1
End Sub
End Class
End Namespace
|
maria-shahid-aspose/Aspose.Cells-for-.NET
|
Examples.GridDesktop/VisualBasic/GridDesktop.Examples/Articles/CopyAndPasteRows.vb
|
Visual Basic
|
mit
| 762
|
'------------------------------------------------------------------------------
' <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
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("Consultas.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
'''<summary>
''' Looks up a localized resource of type System.Drawing.Bitmap.
'''</summary>
Friend ReadOnly Property apply_16x16() As System.Drawing.Bitmap
Get
Dim obj As Object = ResourceManager.GetObject("apply_16x16", resourceCulture)
Return CType(obj,System.Drawing.Bitmap)
End Get
End Property
End Module
End Namespace
|
jdmg94/SL-Contabilidad
|
ClinicaSL/Consultas/My Project/Resources.Designer.vb
|
Visual Basic
|
mit
| 3,120
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Tempcleaner
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()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Tempcleaner))
Me.HuraForm1 = New Computer_Helper.HuraForm()
Me.RichTextBox1 = New System.Windows.Forms.RichTextBox()
Me.HuraButton3 = New Computer_Helper.HuraButton()
Me.HuraButton2 = New Computer_Helper.HuraButton()
Me.HuraButton1 = New Computer_Helper.HuraButton()
Me.HuraForm1.SuspendLayout()
Me.SuspendLayout()
'
'HuraForm1
'
Me.HuraForm1.AccentColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer))
Me.HuraForm1.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer))
Me.HuraForm1.ColorScheme = Computer_Helper.HuraForm.ColorSchemes.Dark
Me.HuraForm1.Controls.Add(Me.RichTextBox1)
Me.HuraForm1.Controls.Add(Me.HuraButton3)
Me.HuraForm1.Controls.Add(Me.HuraButton2)
Me.HuraForm1.Controls.Add(Me.HuraButton1)
Me.HuraForm1.Dock = System.Windows.Forms.DockStyle.Fill
Me.HuraForm1.Font = New System.Drawing.Font("Segoe UI", 9.5!)
Me.HuraForm1.ForeColor = System.Drawing.Color.Gray
Me.HuraForm1.Location = New System.Drawing.Point(0, 0)
Me.HuraForm1.Name = "HuraForm1"
Me.HuraForm1.Size = New System.Drawing.Size(316, 197)
Me.HuraForm1.TabIndex = 1
Me.HuraForm1.Text = "Temp Cleaner"
'
'RichTextBox1
'
Me.RichTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.RichTextBox1.Location = New System.Drawing.Point(12, 65)
Me.RichTextBox1.Name = "RichTextBox1"
Me.RichTextBox1.ReadOnly = True
Me.RichTextBox1.Size = New System.Drawing.Size(292, 123)
Me.RichTextBox1.TabIndex = 7
Me.RichTextBox1.Text = "This will clean all of the temp files on your computer to make sure that you have" & _
" the most space posible."
'
'HuraButton3
'
Me.HuraButton3.BackColor = System.Drawing.Color.Transparent
Me.HuraButton3.BaseColour = System.Drawing.Color.White
Me.HuraButton3.BorderColour = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(170, Byte), Integer), CType(CType(220, Byte), Integer))
Me.HuraButton3.FontColour = System.Drawing.Color.FromArgb(CType(CType(150, Byte), Integer), CType(CType(150, Byte), Integer), CType(CType(150, Byte), Integer))
Me.HuraButton3.HoverColour = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer))
Me.HuraButton3.Location = New System.Drawing.Point(3, 29)
Me.HuraButton3.Name = "HuraButton3"
Me.HuraButton3.PressedColour = System.Drawing.Color.FromArgb(CType(CType(245, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(245, Byte), Integer))
Me.HuraButton3.ProgressColour = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(191, Byte), Integer), CType(CType(255, Byte), Integer))
Me.HuraButton3.Size = New System.Drawing.Size(310, 30)
Me.HuraButton3.TabIndex = 6
Me.HuraButton3.Text = "Clean Files"
'
'HuraButton2
'
Me.HuraButton2.BackColor = System.Drawing.Color.Transparent
Me.HuraButton2.BaseColour = System.Drawing.Color.White
Me.HuraButton2.BorderColour = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(170, Byte), Integer), CType(CType(220, Byte), Integer))
Me.HuraButton2.Font = New System.Drawing.Font("Segoe UI", 12.0!, System.Drawing.FontStyle.Bold)
Me.HuraButton2.FontColour = System.Drawing.Color.FromArgb(CType(CType(150, Byte), Integer), CType(CType(150, Byte), Integer), CType(CType(150, Byte), Integer))
Me.HuraButton2.ForeColor = System.Drawing.Color.Black
Me.HuraButton2.HoverColour = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer))
Me.HuraButton2.Location = New System.Drawing.Point(261, 3)
Me.HuraButton2.Name = "HuraButton2"
Me.HuraButton2.PressedColour = System.Drawing.Color.FromArgb(CType(CType(245, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(245, Byte), Integer))
Me.HuraButton2.ProgressColour = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(191, Byte), Integer), CType(CType(255, Byte), Integer))
Me.HuraButton2.Size = New System.Drawing.Size(23, 20)
Me.HuraButton2.TabIndex = 5
Me.HuraButton2.Text = "-"
'
'HuraButton1
'
Me.HuraButton1.BackColor = System.Drawing.Color.Transparent
Me.HuraButton1.BaseColour = System.Drawing.Color.White
Me.HuraButton1.BorderColour = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(170, Byte), Integer), CType(CType(220, Byte), Integer))
Me.HuraButton1.Font = New System.Drawing.Font("Segoe UI", 12.0!, System.Drawing.FontStyle.Bold)
Me.HuraButton1.FontColour = System.Drawing.Color.FromArgb(CType(CType(150, Byte), Integer), CType(CType(150, Byte), Integer), CType(CType(150, Byte), Integer))
Me.HuraButton1.ForeColor = System.Drawing.Color.Black
Me.HuraButton1.HoverColour = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer))
Me.HuraButton1.Location = New System.Drawing.Point(290, 3)
Me.HuraButton1.Name = "HuraButton1"
Me.HuraButton1.PressedColour = System.Drawing.Color.FromArgb(CType(CType(245, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(245, Byte), Integer))
Me.HuraButton1.ProgressColour = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(191, Byte), Integer), CType(CType(255, Byte), Integer))
Me.HuraButton1.Size = New System.Drawing.Size(23, 20)
Me.HuraButton1.TabIndex = 4
Me.HuraButton1.Text = "X"
'
'Tempcleaner
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(316, 197)
Me.Controls.Add(Me.HuraForm1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "Tempcleaner"
Me.Text = "Tempcleaner"
Me.HuraForm1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
Friend WithEvents HuraForm1 As Computer_Helper.HuraForm
Friend WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox
Friend WithEvents HuraButton3 As Computer_Helper.HuraButton
Friend WithEvents HuraButton2 As Computer_Helper.HuraButton
Friend WithEvents HuraButton1 As Computer_Helper.HuraButton
End Class
|
MJGC-Jonathan/ComputerHelper
|
Computer Helper/Computer Helper/Tempcleaner.Designer.vb
|
Visual Basic
|
mit
| 8,042
|
'------------------------------------------------------------------------------
' <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
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", "15.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("SampleTemplate.Dev.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
|
alexdresko/HSPI
|
Templates/HspiSampleTemplate.Dev/My Project/Resources.Designer.vb
|
Visual Basic
|
mit
| 2,725
|
Imports LiteDB
Partial Class Search
Inherits System.Web.UI.Page
Public Property c1 As String = "lightgray"
Public Property c2 As String = "lightgray"
Public Property c3 As String = "lightgray"
Public Property c4 As String = "lightgray"
Public Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Request.HttpMethod = "GET" Then
Dim q = Request.QueryString("q")
Dim cat = Request.QueryString("cat")
txtSearch.Text = q
Search(q, cat)
End If
End Sub
Public Sub Search_click(sender As Object, e As EventArgs) Handles btnSearch.Click
Response.Redirect("Search.aspx?cat=" & Request.QueryString("cat") & "&q=" & txtSearch.Text)
End Sub
Public Sub bc1(sender As Object, e As EventArgs) Handles btnUsers.Click
Response.Redirect("Search.aspx?cat=users&q=" & Null(Request.QueryString("q"), ""))
End Sub
Public Sub bc2(sender As Object, e As EventArgs) Handles btnGigs.Click
Response.Redirect("Search.aspx?cat=gigs&q=" & Null(Request.QueryString("q"), ""))
End Sub
Public Sub bc3(sender As Object, e As EventArgs) Handles btnJobs.Click
Response.Redirect("Search.aspx?cat=jobs&q=" & Null(Request.QueryString("q"), ""))
End Sub
Public Sub bc4(sender As Object, e As EventArgs) Handles btnOrgs.Click
Response.Redirect("Search.aspx?cat=orgs&q=" & Null(Request.QueryString("q"), ""))
End Sub
Public Sub Search(q As String, cat As String)
lblRes.Text = "<table style='table-layout: fixed; width: 100%;' cellpadding='10px'>"
Using db = New LiteDatabase(Server.MapPath("~/App_Data/Database.accdb"))
If cat = "jobs" Then
c4 = "skyblue"
Dim tbl = db.GetCollection(Of JobProposal)("Proposals")
Dim src = tbl.FindAll().Where(Function(x) (Not x.Disabled) AndAlso x.Type = GigType.OfferJob)
If q <> "" Then
src = src.Where(Function(x) Relevancy(q, String.Format("{0} {1} {2}", x.Title, x.ShortDescription, x.Description)) > 0).OrderByDescending(Function(x) Relevancy(q, String.Format("{0} {1} {2}", x.Title, x.ShortDescription, x.Description))).ThenBy(Function(x) x.Title)
End If
For Each res In src
lblRes.Text &= RowOf(Null(Null(res.ImageURLs, New String() {"~/Images/profile.jpg"})(0), "~/Images/profile.jpg"), res.Title & " (" & res.Price & " dC)", res.ShortDescription, "JobPage.aspx?job=" & res.Id)
Next
ElseIf cat = "gigs" Then
c3 = "skyblue"
Dim tbl = db.GetCollection(Of JobProposal)("Proposals")
Dim src = tbl.FindAll().Where(Function(x) (Not x.Disabled) AndAlso x.Type = GigType.OfferProduct)
If q <> "" Then
src = src.Where(Function(x) Relevancy(q, String.Format("{0} {1} {2}", x.Title, x.ShortDescription, x.Description)) > 0).OrderByDescending(Function(x) Relevancy(q, String.Format("{0} {1} {2}", x.Title, x.ShortDescription, x.Description))).ThenBy(Function(x) x.Title)
End If
For Each res In src
lblRes.Text &= RowOf(Null(Null(res.ImageURLs, New String() {"~/Images/profile.jpg"})(0), "~/Images/profile.jpg"), res.Title & " (" & res.Price & " dC)", res.ShortDescription, "GigPage.aspx?gig=" & res.Id)
Next
ElseIf cat = "orgs" Then
c2 = "skyblue"
Dim tbl = db.GetCollection(Of Organization)("Organizations")
Dim src = tbl.Find(Function(x) x.Approved)
If q <> "" Then
src = src.Where(Function(x) Relevancy(q, String.Format("{0} {1}", x.OrganizationName, x.Description)) > 0).OrderByDescending(Function(x) Relevancy(q, String.Format("{0} {1}", x.OrganizationName, x.Description))).ThenBy(Function(x) x.OrganizationName)
End If
For Each res In src
lblRes.Text &= RowOf(Null(res.ImageLoc, "~/Images/profile.jpg"), res.OrganizationName, res.Description, "OrganizationPage.aspx?org=" & res.Id)
Next
Else
c1 = "skyblue"
Dim tbl = db.GetCollection(Of User)("Users")
Dim src = tbl.FindAll()
If q <> "" Then
src = src.Where(Function(x) Relevancy(q, String.Format("{0} {1} {2} {3}", x.Username, x.FirstName, x.LastName, x.Description)) > 0).OrderByDescending(Function(x) Relevancy(q, String.Format("{0} {1} {2} {3}", x.Username, x.FirstName, x.LastName, x.Description))).ThenBy(Function(x) x.Username)
End If
For Each res In src
lblRes.Text &= RowOf(Null(res.ProfilePic, "~/Images/profile.jpg").Substring(2), String.Format("{0} {1} <span style='font-size: smaller; color: gray'>(@{2})", res.FirstName, res.LastName, res.Username), res.Description, "Profile.aspx?user=" & res.Username)
Next
End If
End Using
If lblRes.Text = "<table style='table-layout: fixed; width: 100%;' cellpadding='10px'>" Then
lblRes.Text = "<div style='width: 100%; text-align: center;'><h3>Sorry, your search query didn't return any results!</h3></div>"
Else
lblRes.Text &= "</table>"
End If
End Sub
Public Function RowOf(img As String, title As String, desc As String, href As String) As String
Return String.Format("<tr><td style='width: 20%;'><img src='{0}' style='width: 100%; height: auto;'/></td><td><a href='{1}'><h2 style='color: black'>{2}</h2></a><span style='color: darkgray'>{3}</span></td></tr>", img, href, title, desc)
End Function
End Class
|
yotam180/DeedCoin
|
Search.aspx.vb
|
Visual Basic
|
mit
| 5,774
|
namespace JetBrains.ReSharper.Koans.Editing
' Clipboard Ring
'
' Tracks the last 20 copies to the clipboard
'
' ReSharper → Edit → Paste (No shortcut defined in VS)
' Ctrl+Shift+V (IntelliJ)
Public Class ClipboardRing
Public Sub Method()
' 1. Copy each line below in turn
' 2. Invoke Clipboard Ring
' Each copied line is shown in most recent order
' 3. Hit the number to paste
' Next time the dialog is opened, the order is updated
Console.WriteLine("One")
Console.WriteLine("Two")
Console.WriteLine("Three")
Console.WriteLine("Four")
End Sub
End Class
End namespace
|
yskatsumata/resharper-workshop
|
VisualBasic/02-Editing/11-Clipboard_ring.vb
|
Visual Basic
|
apache-2.0
| 736
|
'*******************************************************************************************'
' '
' 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 '
'*******************************************************************************************'
Imports System.IO
Imports System.Net
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq
Module Module1
' The authentication key (API Key).
' Get your own by registering at https://app.pdf.co
Const API_KEY As String = "***********************************"
' --TemplateID--
' Please follow below steps to create your own HTML Template and get "templateId".
' 1. Add new html template in app.pdf.co/templates/html
' 2. Copy paste your html template code into this new template. Sample HTML templates can be found at "https://github.com/bytescout/pdf-co-api-samples/tree/master/PDF%20from%20HTML%20template/TEMPLATES-SAMPLES"
' 3. Save this new template
' 4. Copy its ID to clipboard
' 5. Now set ID of the template into templateId parameter
' HTML template using built-in template
' see https://app.pdf.co/templates/html/3/edit
Dim template_id = 3
' Data to fill the template
Dim templateData As String = File.ReadAllText(".\invoice_data.json")
' Destination PDF file name
Const DestinationFile As String = ".\result.pdf"
Sub Main()
' Create standard .NET web client instance
Dim webClient As WebClient = New WebClient()
' Set API Key
webClient.Headers.Add("x-api-key", API_KEY)
Try
' Prepare URL for HTML to PDF API call
Dim request As String = Uri.EscapeUriString(String.Format(
"https://api.pdf.co/v1/pdf/convert/from/html?name={0}",
Path.GetFileName(DestinationFile)))
' Prepare request body in JSON format
Dim jsonObject As JObject = New JObject(
New JProperty("templateId", template_id),
New JProperty("templateData", templateData))
webClient.Headers.Add("Content-Type", "application/json")
' Execute request
Dim response As String = webClient.UploadString(request, jsonObject.ToString())
' Parse JSON response
Dim json As JObject = JObject.Parse(response)
If json("error").ToObject(Of Boolean) = False Then
' Get URL of generated PDF file
Dim resultFileUrl As String = json("url").ToString()
webClient.Headers.Remove("Content-Type") ' remove the header required for only the previous request
' Download the PDF file
webClient.DownloadFile(resultFileUrl, DestinationFile)
Console.WriteLine("Generated PDF document saved as ""{0}"" file.", DestinationFile)
End If
Catch ex As WebException
Console.WriteLine(ex.ToString())
End Try
webClient.Dispose()
Console.WriteLine()
Console.WriteLine("Press any key...")
Console.ReadKey()
End Sub
End Module
|
bytescout/ByteScout-SDK-SourceCode
|
PDF.co Web API/PDF from HTML template/VB.NET/Invoice With Multiple Pages/Module1.vb
|
Visual Basic
|
apache-2.0
| 3,522
|
Imports BVSoftware.Bvc5.Core
Partial Class BVAdmin_Configuration_Design
Inherits BaseAdminPage
Protected Sub Page_PreInit1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
Me.PageTitle = "Design/Debug Settings"
Me.CurrentTab = AdminTabType.Configuration
ValidateCurrentUserHasPermission(Membership.SystemPermissions.SettingsView)
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
If Membership.UserAccount.DoesUserHavePermission(SessionManager.GetCurrentUserId, Membership.SystemPermissions.SettingsEdit) = False Then
Me.btnSave.Enabled = False
End If
Me.MessageBoxErrorTestModeCheckBox.Checked = WebAppSettings.MessageBoxErrorTestMode
End If
End Sub
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSave.Click
If Page.IsValid Then
If Me.Save() = True Then
Me.MessageBox1.ShowOk("Settings saved successfully.")
End If
End If
End Sub
Private Function Save() As Boolean
Dim result As Boolean = False
WebAppSettings.MessageBoxErrorTestMode = Me.MessageBoxErrorTestModeCheckBox.Checked
result = True
Return result
End Function
End Class
|
ajaydex/Scopelist_2015
|
BVAdmin/Configuration/Design.aspx.vb
|
Visual Basic
|
apache-2.0
| 1,438
|
' Copyright (c) 2015 ZZZ Projects. All rights reserved
' Licensed under MIT License (MIT) (https://github.com/zzzprojects/Z.ExtensionMethods)
' Website: http://www.zzzprojects.com/
' Feedback / Feature Requests / Issues : http://zzzprojects.uservoice.com/forums/283927
' All ZZZ Projects products: Entity Framework Extensions / Bulk Operations / Extension Methods /Icon Library
Public Module Extensions_507
''' <summary>
''' A string extension method that queries if '@this' is not (null or empty).
''' </summary>
''' <param name="this">The @this to act on.</param>
''' <returns>true if '@this' is not (null or empty), false if not.</returns>
<System.Runtime.CompilerServices.Extension> _
Public Function IsNotNullOrEmpty(this As String) As Boolean
Return Not String.IsNullOrEmpty(this)
End Function
End Module
|
zzzprojects/Z.ExtensionMethods
|
src (VB.NET)/Z.ExtensionMethods.VB/Z.Core/System.String/String.IsNotNullOrEmpty.vb
|
Visual Basic
|
mit
| 830
|
' Copyright (c) 2015 ZZZ Projects. All rights reserved
' Licensed under MIT License (MIT) (https://github.com/zzzprojects/Z.ExtensionMethods)
' Website: http://www.zzzprojects.com/
' Feedback / Feature Requests / Issues : http://zzzprojects.uservoice.com/forums/283927
' All ZZZ Projects products: Entity Framework Extensions / Bulk Operations / Extension Methods /Icon Library
Public Module Extensions_434
''' <summary>
''' An object extension method that convert this object into a string representation.
''' </summary>
''' <param name="this">The @this to act on.</param>
''' <returns>A string that represents this object.</returns>
<System.Runtime.CompilerServices.Extension> _
Public Function ToString(this As Object) As String
Return Convert.ToString(this)
End Function
End Module
|
huoxudong125/Z.ExtensionMethods
|
src (VB.NET)/Z.ExtensionMethods.VB/Z.Core/System.Object/Convert/ToValueType/Object.ToString.vb
|
Visual Basic
|
mit
| 806
|
' 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.VisualBasic.EndConstructGeneration
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.VisualStudio.Text
Imports Roslyn.Test.EditorUtilities
Imports Roslyn.Test.Utilities
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.EndConstructGeneration
Public Class MultiLineLambdaTests
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Async Function TestApplyWithFunctionLambda() As Task
Await VerifyStatementEndConstructAppliedAsync(
before:={"Class c1",
" Sub foo()",
" Dim x = Function()",
" End Sub",
"End Class"},
beforeCaret:={2, -1},
after:={"Class c1",
" Sub foo()",
" Dim x = Function()",
"",
" End Function",
" End Sub",
"End Class"},
afterCaret:={3, -1})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Async Function TestApplyWithFunctionLambdaWithMissingEndFunction() As Task
Await VerifyStatementEndConstructAppliedAsync(
before:={"Class c1",
" Function foo()",
" Dim x = Function()",
"End Class"},
beforeCaret:={2, -1},
after:={"Class c1",
" Function foo()",
" Dim x = Function()",
"",
" End Function",
"End Class"},
afterCaret:={3, -1})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Async Function TestApplyWithSubLambda() As Task
Await VerifyStatementEndConstructAppliedAsync(
before:={"Class c1",
" Function foo()",
" Dim x = Sub()",
" End Function",
"End Class"},
beforeCaret:={2, -1},
after:={"Class c1",
" Function foo()",
" Dim x = Sub()",
"",
" End Sub",
" End Function",
"End Class"},
afterCaret:={3, -1})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration), WorkItem(544362)>
Public Async Function TestApplyWithSubLambdaWithNoParameterParenthesis() As Task
Await VerifyStatementEndConstructAppliedAsync(
before:={"Class c1",
" Function foo()",
" Dim x = Sub",
" End Function",
"End Class"},
beforeCaret:={2, -1},
after:={"Class c1",
" Function foo()",
" Dim x = Sub()",
"",
" End Sub",
" End Function",
"End Class"},
afterCaret:={3, -1})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration), WorkItem(544362)>
Public Async Function TestApplyWithSubLambdaInsideMethodCall() As Task
Await VerifyStatementEndConstructAppliedAsync(
before:={"Class c1",
" Function foo()",
" M(Sub())",
" End Function",
"End Class"},
beforeCaret:={2, 11},
after:={"Class c1",
" Function foo()",
" M(Sub()",
"",
" End Sub)",
" End Function",
"End Class"},
afterCaret:={3, -1})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration), WorkItem(544362)>
Public Async Function TestApplyWithSubLambdaAndStatementInsideMethodCall() As Task
Await VerifyStatementEndConstructAppliedAsync(
before:={"Class c1",
" Function foo()",
" M(Sub() Exit Sub)",
" End Function",
"End Class"},
beforeCaret:={2, 11},
after:={"Class c1",
" Function foo()",
" M(Sub()",
" Exit Sub",
" End Sub)",
" End Function",
"End Class"},
afterCaret:={3, 10})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration), WorkItem(544362)>
Public Async Function TestApplyWithFunctionLambdaInsideMethodCall() As Task
Await VerifyStatementEndConstructAppliedAsync(
before:={"Class c1",
" Function foo()",
" M(Function() 1)",
" End Function",
"End Class"},
beforeCaret:={2, 17},
after:={"Class c1",
" Function foo()",
" M(Function()",
" Return 1",
" End Function)",
" End Function",
"End Class"},
afterCaret:={3, 17})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Async Function TestVerifyAnonymousType() As Task
Await VerifyStatementEndConstructAppliedAsync(
before:={"Class C",
" Sub s()",
" Dim x = New With {.x = Function(x)",
" End Sub",
"End Class"},
beforeCaret:={2, -1},
after:={"Class C",
" Sub s()",
" Dim x = New With {.x = Function(x)",
"",
" End Function",
" End Sub",
"End Class"},
afterCaret:={3, -1})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Async Function VerifySingleLineLambdaFunc() As Threading.Tasks.Task
Await VerifyStatementEndConstructNotAppliedAsync(
text:={"Class C",
" Sub s()",
" Dim x = Function(x) x",
" End Sub",
"End Class"},
caret:={2, -1})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Async Function VerifySingleLineLambdaSub() As Threading.Tasks.Task
Await VerifyStatementEndConstructNotAppliedAsync(
text:={"Class C",
" Sub s()",
" Dim y = Sub(x As Integer) x.ToString()",
" End Sub",
"End Class"},
caret:={2, -1})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Async Function TestVerifyAsDefaultParameterValue() As Task
Await VerifyStatementEndConstructAppliedAsync(
before:={"Class C",
" Sub s(Optional ByVal f As Func(Of String, String) = Function(x As String)",
"End Class"},
beforeCaret:={1, -1},
after:={"Class C",
" Sub s(Optional ByVal f As Func(Of String, String) = Function(x As String)",
"",
" End Function",
"End Class"},
afterCaret:={2, -1})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Async Function TestVerifyNestedLambda() As Task
Await VerifyStatementEndConstructAppliedAsync(
before:={"Class C",
" sub s",
" Dim x = Function (x)",
" Dim y = function(y)",
" End Function",
" End sub",
"End Class"},
beforeCaret:={3, -1},
after:={"Class C",
" sub s",
" Dim x = Function (x)",
" Dim y = function(y)",
"",
" End function",
" End Function",
" End sub",
"End Class"},
afterCaret:={4, -1})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Async Function TestVerifyInField() As Task
Await VerifyStatementEndConstructAppliedAsync(
before:={"Class C",
" Dim x = Sub()",
"End Class"},
beforeCaret:={1, -1},
after:={"Class C",
" Dim x = Sub()",
"",
" End Sub",
"End Class"},
afterCaret:={2, -1})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Async Function VerifyInvalidLambdaSyntax() As Threading.Tasks.Task
Await VerifyStatementEndConstructNotAppliedAsync(
text:={"Class C",
" Sub s()",
" Sub(x)",
" End Sub",
"End Class"},
caret:={2, -1})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Async Function VerifyNotAppliedIfSubLambdaContainsEndSub() As Threading.Tasks.Task
Await VerifyStatementEndConstructNotAppliedAsync(
text:={"Class C",
" Sub s()",
" Dim x = Sub() End Sub",
" End Sub",
"End Class"},
caret:={2, 21})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Async Function VerifyNotAppliedIfSyntaxIsFunctionLambdaContainsEndFunction() As Threading.Tasks.Task
Await VerifyStatementEndConstructNotAppliedAsync(
text:={"Class C",
" Sub s()",
" Dim x = Function() End Function",
" End Sub",
"End Class"},
caret:={2, 26})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Async Function VerifyLambdaWithImplicitLC() As Threading.Tasks.Task
Await VerifyStatementEndConstructNotAppliedAsync(
text:={"Class C",
" Sub s()",
" Dim x = Function(y As Integer) y +",
" End Sub",
"End Class"},
caret:={2, -1})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Async Function TestVerifyLambdaWithMissingParenthesis() As Task
Await VerifyStatementEndConstructAppliedAsync(
before:={"Class C",
" Sub s()",
" Dim x = Function",
" End Sub",
"End Class"},
beforeCaret:={2, -1},
after:={"Class C",
" Sub s()",
" Dim x = Function()",
"",
" End Function",
" End Sub",
"End Class"},
afterCaret:={3, -1})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Async Function TestVerifySingleLineSubLambdaToMultiLine() As Task
Await VerifyStatementEndConstructAppliedAsync(
before:={"Class C",
" Sub s()",
" Dim x = Sub() f()",
" End Sub",
"End Class"},
beforeCaret:={2, 21},
after:={"Class C",
" Sub s()",
" Dim x = Sub()",
" f()",
" End Sub",
" End Sub",
"End Class"},
afterCaret:={3, 20})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration), WorkItem(530683)>
Public Async Function TestVerifySingleLineSubLambdaToMultiLineWithTrailingTrivia() As Task
Await VerifyStatementEndConstructAppliedAsync(
before:={"Class C",
" Sub s()",
" Dim x = Sub() f() ' Invokes f()",
" End Sub",
"End Class"},
beforeCaret:={2, 21},
after:={"Class C",
" Sub s()",
" Dim x = Sub()",
" f() ' Invokes f()",
" End Sub",
" End Sub",
"End Class"},
afterCaret:={3, 20})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)>
Public Async Function TestVerifySingleLineFunctionLambdaToMultiLine() As Task
Await VerifyStatementEndConstructAppliedAsync(
before:={"Class C",
" Sub s()",
" Dim x = Function() f()",
" End Sub",
"End Class"},
beforeCaret:={2, 27},
after:={"Class C",
" Sub s()",
" Dim x = Function()",
" Return f()",
" End Function",
" End Sub",
"End Class"},
afterCaret:={3, 27})
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration), WorkItem(530683)>
Public Async Function TestVerifySingleLineFunctionLambdaToMultiLineWithTrailingTrivia() As Task
Await VerifyStatementEndConstructAppliedAsync(
before:={"Class C",
" Sub s()",
" Dim x = Function() 4 ' Returns Constant 4",
" End Sub",
"End Class"},
beforeCaret:={2, 27},
after:={"Class C",
" Sub s()",
" Dim x = Function()",
" Return 4 ' Returns Constant 4",
" End Function",
" End Sub",
"End Class"},
afterCaret:={3, 27})
End Function
<WorkItem(1922, "https://github.com/dotnet/roslyn/issues/1922")>
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration), WorkItem(530683)>
Public Async Function TestVerifySingleLineFunctionLambdaToMultiLineInsideXMLTag() As Task
Await VerifyStatementEndConstructAppliedAsync(
before:={"Class C",
" Sub s()",
" Dim x = <xml><%= Function()%></xml>",
" End Sub",
"End Class"},
beforeCaret:={2, 35},
after:={"Class C",
" Sub s()",
" Dim x = <xml><%= Function()",
"",
" End Function %></xml>",
" End Sub",
"End Class"},
afterCaret:={3, -1})
End Function
<WorkItem(1922, "https://github.com/dotnet/roslyn/issues/1922")>
<WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration), WorkItem(530683)>
Public Async Function TestVerifySingleLineSubLambdaToMultiLineInsideXMLTag() As Task
Await VerifyStatementEndConstructAppliedAsync(
before:={"Class C",
" Sub s()",
" Dim x = <xml><%= Sub()%></xml>",
" End Sub",
"End Class"},
beforeCaret:={2, 30},
after:={"Class C",
" Sub s()",
" Dim x = <xml><%= Sub()",
"",
" End Sub %></xml>",
" End Sub",
"End Class"},
afterCaret:={3, -1})
End Function
End Class
End Namespace
|
HellBrick/roslyn
|
src/EditorFeatures/VisualBasicTest/EndConstructGeneration/MultiLineLambdaTests.vb
|
Visual Basic
|
apache-2.0
| 19,092
|
' 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.Threading
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Completion
Imports Microsoft.CodeAnalysis.Completion.Providers
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.LanguageServices
Imports Microsoft.CodeAnalysis.VisualBasic.Extensions.ContextQuery
Imports Microsoft.CodeAnalysis.Options
Imports Microsoft.CodeAnalysis.Shared.Extensions.ContextQuery
Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers
Partial Friend Class ImplementsClauseCompletionProvider
Inherits AbstractSymbolCompletionProvider
Friend Overrides Function IsInsertionTrigger(text As SourceText, characterPosition As Integer, options As OptionSet) As Boolean
Return CompletionUtilities.IsDefaultTriggerCharacter(text, characterPosition, options)
End Function
Protected Overrides Function IsExclusive() As Boolean
Return True
End Function
Protected Overrides Function GetSymbolsWorker(context As AbstractSyntaxContext, position As Integer, options As OptionSet, cancellationToken As CancellationToken) As Task(Of IEnumerable(Of ISymbol))
If context.TargetToken.Kind = SyntaxKind.None Then
Return SpecializedTasks.EmptyEnumerable(Of ISymbol)()
End If
If context.SyntaxTree.IsInNonUserCode(position, cancellationToken) OrElse
context.SyntaxTree.IsInSkippedText(position, cancellationToken) Then
Return SpecializedTasks.EmptyEnumerable(Of ISymbol)()
End If
' We only care about Methods, Properties, and Events
Dim memberKindKeyword As SyntaxKind = Nothing
Dim methodDeclaration = context.TargetToken.GetAncestor(Of MethodStatementSyntax)()
If methodDeclaration IsNot Nothing Then
memberKindKeyword = methodDeclaration.DeclarationKeyword.Kind
End If
Dim propertyDeclaration = context.TargetToken.GetAncestor(Of PropertyStatementSyntax)()
If propertyDeclaration IsNot Nothing Then
memberKindKeyword = propertyDeclaration.DeclarationKeyword.Kind
End If
Dim eventDeclaration = context.TargetToken.GetAncestor(Of EventStatementSyntax)()
If eventDeclaration IsNot Nothing Then
memberKindKeyword = eventDeclaration.DeclarationKeyword.Kind
End If
' We couldn't find a declaration. Bail.
If memberKindKeyword = Nothing Then
Return SpecializedTasks.EmptyEnumerable(Of ISymbol)()
End If
Dim result As IEnumerable(Of ISymbol) = Nothing
' Valid positions: Immediately after 'Implements, after ., or after a ,
If context.TargetToken.Kind = SyntaxKind.ImplementsKeyword AndAlso context.TargetToken.Parent.IsKind(SyntaxKind.ImplementsClause) Then
result = GetInterfacesAndContainers(position, context.TargetToken.Parent, context.SemanticModel, memberKindKeyword, cancellationToken)
End If
If context.TargetToken.Kind = SyntaxKind.CommaToken AndAlso context.TargetToken.Parent.IsKind(SyntaxKind.ImplementsClause) Then
result = GetInterfacesAndContainers(position, context.TargetToken.Parent, context.SemanticModel, memberKindKeyword, cancellationToken)
End If
If context.TargetToken.IsKindOrHasMatchingText(SyntaxKind.DotToken) AndAlso WalkUpQualifiedNames(context.TargetToken) Then
result = GetDottedMembers(position, DirectCast(context.TargetToken.Parent, QualifiedNameSyntax), context.SemanticModel, memberKindKeyword, cancellationToken)
End If
If result IsNot Nothing Then
Return Task.FromResult(result.Where(Function(s) MatchesMemberKind(s, memberKindKeyword)))
End If
Return SpecializedTasks.EmptyEnumerable(Of ISymbol)()
End Function
Private Function MatchesMemberKind(symbol As ISymbol, memberKindKeyword As SyntaxKind) As Boolean
If symbol.Kind = SymbolKind.Alias Then
symbol = DirectCast(symbol, IAliasSymbol).Target
End If
If TypeOf symbol Is INamespaceOrTypeSymbol Then
Return True
End If
Dim method = TryCast(symbol, IMethodSymbol)
If method IsNot Nothing Then
If Not method.ReturnsVoid Then
Return memberKindKeyword = SyntaxKind.FunctionKeyword
End If
Return memberKindKeyword = SyntaxKind.SubKeyword
End If
Dim [property] = TryCast(symbol, IPropertySymbol)
If [property] IsNot Nothing Then
Return memberKindKeyword = SyntaxKind.PropertyKeyword
End If
Return memberKindKeyword = SyntaxKind.EventKeyword
End Function
Private Function GetDottedMembers(position As Integer, qualifiedName As QualifiedNameSyntax, semanticModel As SemanticModel, memberKindKeyword As SyntaxKind, cancellationToken As CancellationToken) As IEnumerable(Of ISymbol)
Dim containingType = semanticModel.GetEnclosingNamedType(position, cancellationToken)
If containingType Is Nothing Then
Return Nothing
End If
Dim unimplementedInterfacesAndMembers = From item In containingType.GetAllUnimplementedMembersInThis(containingType.Interfaces, cancellationToken)
Select New With {.interface = item.Item1, .members = item.Item2.Where(Function(s) MatchesMemberKind(s, memberKindKeyword))}
Dim interfaces = unimplementedInterfacesAndMembers.Where(Function(i) i.members.Any()) _
.Select(Function(i) i.interface)
Dim members = unimplementedInterfacesAndMembers.SelectMany(Function(i) i.members)
Dim interfacesAndContainers = New HashSet(Of ISymbol)(interfaces)
For Each [interface] In interfaces
AddAliasesAndContainers([interface], interfacesAndContainers, Nothing, Nothing)
Next
Dim namespaces = interfacesAndContainers.OfType(Of INamespaceSymbol)()
Dim left = qualifiedName.Left
Dim leftHandTypeInfo = semanticModel.GetTypeInfo(left, cancellationToken)
Dim leftHandBinding = semanticModel.GetSymbolInfo(left, cancellationToken)
Dim container As INamespaceOrTypeSymbol = leftHandTypeInfo.Type
If container Is Nothing OrElse container.IsErrorType Then
container = TryCast(leftHandBinding.Symbol, INamespaceOrTypeSymbol)
End If
If container Is Nothing Then
container = TryCast(leftHandBinding.CandidateSymbols.FirstOrDefault(), INamespaceOrTypeSymbol)
End If
If container Is Nothing Then
Return Nothing
End If
Dim symbols = semanticModel.LookupSymbols(position, container)
Return New HashSet(Of ISymbol)(symbols.ToArray() _
.Where(Function(s As ISymbol) interfacesAndContainers.Contains(s, SymbolEquivalenceComparer.Instance) OrElse
(TypeOf (s) Is INamespaceSymbol AndAlso namespaces.Contains(TryCast(s, INamespaceSymbol), INamespaceSymbolExtensions.EqualityComparer)) OrElse
members.Contains(s)))
End Function
Private Function interfaceMemberGetter([interface] As ITypeSymbol, within As ISymbol) As ImmutableArray(Of ISymbol)
Return ImmutableArray.CreateRange(Of ISymbol)([interface].AllInterfaces.SelectMany(Function(i) i.GetMembers()).Where(Function(s) s.IsAccessibleWithin(within))) _
.AddRange([interface].GetMembers())
End Function
Private Function GetInterfacesAndContainers(position As Integer, node As SyntaxNode, semanticModel As SemanticModel, kind As SyntaxKind, cancellationToken As CancellationToken) As IEnumerable(Of ISymbol)
Dim containingType = semanticModel.GetEnclosingNamedType(position, cancellationToken)
If containingType Is Nothing Then
Return Nothing
End If
Dim interfaceWithUnimplementedMembers = containingType.GetAllUnimplementedMembersInThis(containingType.Interfaces, AddressOf interfaceMemberGetter, cancellationToken) _
.Where(Function(i) i.Item2.Any(Function(s) MatchesMemberKind(s, kind))) _
.Select(Function(i) i.Item1)
Dim interfacesAndContainers = New HashSet(Of ISymbol)(interfaceWithUnimplementedMembers)
For Each i In interfaceWithUnimplementedMembers
AddAliasesAndContainers(i, interfacesAndContainers, node, semanticModel)
Next
Dim symbols = semanticModel.LookupSymbols(position)
Dim result = TryAddGlobalTo(interfacesAndContainers.Intersect(symbols.ToArray()))
' Even if there's not anything left to implement, we'll show the list of interfaces,
' the global namespace, and the project root namespace (if any), as long as the class implements something.
If Not result.Any() AndAlso containingType.Interfaces.Any() Then
Dim defaultListing = New List(Of ISymbol)(containingType.Interfaces.ToArray())
defaultListing.Add(semanticModel.Compilation.GlobalNamespace)
If containingType.ContainingNamespace IsNot Nothing Then
defaultListing.Add(containingType.ContainingNamespace)
AddAliasesAndContainers(containingType.ContainingNamespace, defaultListing, node, semanticModel)
End If
Return defaultListing
End If
Return result
End Function
Private Sub AddAliasesAndContainers(symbol As ISymbol, interfacesAndContainers As ICollection(Of ISymbol), node As SyntaxNode, semanticModel As SemanticModel)
' Add aliases, if any for 'symbol'
AddAlias(symbol, interfacesAndContainers, node, semanticModel)
' Add containers for 'symbol'
Dim containingSymbol = symbol.ContainingSymbol
If containingSymbol IsNot Nothing AndAlso Not interfacesAndContainers.Contains(containingSymbol) Then
interfacesAndContainers.Add(containingSymbol)
' Add aliases, if any for 'containingSymbol'
AddAlias(containingSymbol, interfacesAndContainers, node, semanticModel)
If Not IsGlobal(containingSymbol) Then
AddAliasesAndContainers(containingSymbol, interfacesAndContainers, node, semanticModel)
End If
End If
End Sub
Private Shared Sub AddAlias(symbol As ISymbol, interfacesAndContainers As ICollection(Of ISymbol), node As SyntaxNode, semanticModel As SemanticModel)
If node IsNot Nothing AndAlso semanticModel IsNot Nothing AndAlso TypeOf symbol Is INamespaceOrTypeSymbol Then
Dim aliasSymbol = DirectCast(symbol, INamespaceOrTypeSymbol).GetAliasForSymbol(node, semanticModel)
If aliasSymbol IsNot Nothing AndAlso Not interfacesAndContainers.Contains(aliasSymbol) Then
interfacesAndContainers.Add(aliasSymbol)
End If
End If
End Sub
Private Function IsGlobal(containingSymbol As ISymbol) As Boolean
Dim [namespace] = TryCast(containingSymbol, INamespaceSymbol)
Return [namespace] IsNot Nothing AndAlso [namespace].IsGlobalNamespace
End Function
Private Function TryAddGlobalTo(symbols As IEnumerable(Of ISymbol)) As IEnumerable(Of ISymbol)
Dim withGlobalContainer = symbols.FirstOrDefault(Function(s) s.ContainingNamespace.IsGlobalNamespace)
If withGlobalContainer IsNot Nothing Then
Return symbols.Concat(SpecializedCollections.SingletonEnumerable(withGlobalContainer.ContainingNamespace))
End If
Return symbols
End Function
Private Function WalkUpQualifiedNames(token As SyntaxToken) As Boolean
Dim parent = token.Parent
While parent IsNot Nothing AndAlso parent.IsKind(SyntaxKind.QualifiedName)
parent = parent.Parent
End While
Return parent IsNot Nothing AndAlso parent.IsKind(SyntaxKind.ImplementsClause)
End Function
Protected Overrides Function GetDisplayAndInsertionText(symbol As ISymbol, context As AbstractSyntaxContext) As ValueTuple(Of String, String)
If IsGlobal(symbol) Then
Return ValueTuple.Create("Global", "Global")
End If
Dim displayText As String = Nothing
Dim insertionText As String = Nothing
If symbol.MatchesKind(SymbolKind.NamedType) AndAlso symbol.GetAllTypeArguments().Any() Then
displayText = symbol.ToMinimalDisplayString(context.SemanticModel, context.Position)
insertionText = displayText
Else
Dim displayAndInsertionText = CompletionUtilities.GetDisplayAndInsertionText(
symbol, isAttributeNameContext:=False, isAfterDot:=context.IsRightOfNameSeparator,
isWithinAsyncMethod:=False,
syntaxFacts:=context.GetLanguageService(Of ISyntaxFactsService)())
displayText = displayAndInsertionText.Item1
insertionText = displayAndInsertionText.Item2
End If
Return ValueTuple.Create(displayText, insertionText)
End Function
Protected Overrides Async Function CreateContext(document As Document, position As Integer, cancellationToken As CancellationToken) As Task(Of AbstractSyntaxContext)
Dim semanticModel = Await document.GetSemanticModelForSpanAsync(New TextSpan(position, 0), cancellationToken).ConfigureAwait(False)
Return Await VisualBasicSyntaxContext.CreateContextAsync(document.Project.Solution.Workspace, semanticModel, position, cancellationToken).ConfigureAwait(False)
End Function
Protected Overrides Function GetCompletionItemRules(symbols As IReadOnlyList(Of ISymbol), context As AbstractSyntaxContext) As CompletionItemRules
Return CompletionItemRules.Default
End Function
Public Overrides Async Function GetTextChangeAsync(document As Document, selectedItem As CompletionItem, ch As Char?, cancellationToken As CancellationToken) As Task(Of TextChange?)
If SymbolCompletionItem.HasSymbols(selectedItem) Then
Dim insertionText As String
If ch Is Nothing Then
insertionText = SymbolCompletionItem.GetInsertionText(selectedItem)
Else
Dim symbols = Await SymbolCompletionItem.GetSymbolsAsync(selectedItem, document, cancellationToken).ConfigureAwait(False)
Dim position = SymbolCompletionItem.GetContextPosition(selectedItem)
Dim context = Await CreateContext(document, position, cancellationToken).ConfigureAwait(False)
If symbols.Length > 0 Then
insertionText = GetInsertionTextAtInsertionTime(symbols(0), context, ch.Value)
Else
insertionText = selectedItem.DisplayText
End If
End If
Return New TextChange(selectedItem.Span, insertionText)
End If
Return Await MyBase.GetTextChangeAsync(document, selectedItem, ch, cancellationToken).ConfigureAwait(False)
End Function
Protected Overrides Function GetInsertionText(symbol As ISymbol, context As AbstractSyntaxContext, ch As Char) As String
Return CompletionUtilities.GetInsertionTextAtInsertionTime(symbol, context, ch)
End Function
End Class
End Namespace
|
ericfe-ms/roslyn
|
src/Features/VisualBasic/Portable/Completion/CompletionProviders/ImplementsClauseCompletionProvider.vb
|
Visual Basic
|
apache-2.0
| 16,566
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.