Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

CodeDom Error (VB)

EDIT: I have fixed this issue, It was a common bug found in .net framework 2.0, I switched to 4.5.2 and it fixed the issue :)


I'm getting this error on the Dim results line:
{"Object reference not set to an instance of an object."}

Code:

Form1 Button Press (i have 2 text boxes, one for message and one for title)
Quote: Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
SaveFileDialog1.ShowDialog()

Dim compiler As System.CodeDom.Compiler.ICodeCompiler = New VBCodeProvider().CreateCompiler
Dim parameters As New System.CodeDom.Compiler.CompilerParameters
parameters.ReferencedAssemblies.Add("System.Windows.Forms.dll")
parameters.GenerateExecutable = True
parameters.OutputAssembly = SaveFileDialog1.FileName
parameters.CompilerOptions = "/target:winexe"
Dim title As String = TextBox1.Text
Dim message As String = TextBox2.Text
Dim results As System.CodeDom.Compiler.CompilerResults = compiler.CompileAssemblyFromSource(parameters, My.Resources.SourceCode.Replace("title", title).Replace("message", message)) 'line that i'm getting the error on'
End Sub


SourceCode.txt (the stub)
Quote:Imports System
Imports System.Windows.Forms
Namespace MyApp
Public Class EntryPoint
Public Shared Sub Main()
MessageBox.Show("message", "title", MessageBoxButtons.YesNoCancel)
End Sub

End Class

End Namespace

Need Something? HMU i can provide almost anything.



Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by sara_221540Jun 27, 2020 11:08 AM 4 175 Jun 27, 2020 11:08 AM
Last Post: Anemone¹
[C#] by NimrodSep 18, 2017 01:06 PM 11 263 Sep 18, 2017 01:06 PM
Last Post: Nimrod
[.NET] by Slavoj ŽižekJun 17, 2015 01:00 AM 13 1,216 Jun 17, 2015 01:00 AM
Last Post: ShittyAdvice