Hack Forums
[.NET] Overload resolution failed because no accessible 'New' can be called - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Overload resolution failed because no accessible 'New' can be called (/showthread.php?tid=4284353)



Overload resolution failed because no accessible 'New' can be called - loopy90 - Jun 13, 2014

Hello, I'm working on a program that uses codedom and in my source code I have this

PHP Code

<?php 
Dim t 
As New Thread(AddressOf DoExecute)
t.TrySetApartmentState(ApartmentState.STA)
t.Start(bytes) 

The Error "Overload resolution failed because no accessible 'New' can be called" Is thrown whenever I try to compile the codedom at what I would assume to be "Dim t As New Thread(AddressOf DoExecute)"

I've googled around and all the threads that I've read on it haven't helped, so please refrain from posting links.

Here is the entire code that I'm trying to compile with codedom.
Spoiler (Click to View)


* - +Haze - Jun 13, 2014

If you are trying to use multi threading then..
Code
Dim thread As System.Threading.Thread
thread = New System.Threading.Thread(AddressOf DoExecute)
thread.Start()

If you get an error type in, Me.CheckForIllegalCrossThreadCalls = False
Should work If you do not use parenthesis.


* - loopy90 - Jun 13, 2014

(Jun 13, 2014 08:53 PM)Haze. Wrote:  If you are trying to use multi threading then..
Code
Dim thread As System.Threading.Thread
thread = New System.Threading.Thread(AddressOf DoExecute)
thread.Start()

If you get an error type in, Me.CheckForIllegalCrossThreadCalls = False
Should work If you do not use parenthesis.

This still throws the same error
Code
Dim thread As System.Threading.Thread
thread = New System.Threading.Thread(AddressOf DoExecute)
thread.Start()

And where would you want me to use Me.CheckForIllegalCrossThreadCalls = False, would it be in the source that I'm compiling or in the compiler itself? Sorry just a bit unclear with what you said.


* - NETExplorer - Jun 13, 2014

(Jun 13, 2014 08:54 PM)NegativeIon Wrote:  This still throws the same error
Code
Dim thread As System.Threading.Thread
thread = New System.Threading.Thread(AddressOf DoExecute)
thread.Start()

And where would you want me to use Me.CheckForIllegalCrossThreadCalls = False, would it be in the source that I'm compiling or in the compiler itself? Sorry just a bit unclear with what you said.

The above user has no clue what he is talking about, refrain from using his advice.


* - loopy90 - Jun 13, 2014

(Jun 13, 2014 09:27 PM)PatPositron Wrote:  The above user has no clue what he is talking about, refrain from using his advice.

Thanks, I thought I would also add that this code compiles/runs perfectly fine If I'm using VS but when I try to compile with codedom it throws the error.