Raycast Does not Detect Collider

Probably going to feel stupid after getting an answer, but 4 hours of looking isn’t getting me anywhere.
I have a player move script that is supposed to send a raycast and not allow movement if the raycast hits a collider. However, no matter what, the raycast does not detect any colliders (the integer is always 0)

Here is my code:
using UnityEngine;
using System.Collections;

namespace Player.control {
	public class PlayerMove : MonoBehaviour {

		[SerializeField] private float speed = 0.25f;
		[SerializeField] private Rigidbody2D rb2d;
		[SerializeField] private BoxCollider2D bc2d;

		void Update () {
			if (false) {
				// Switches colliding list
			} else {
				// Moves the player
				float x = Input.GetAxis ("Horizontal") * speed;
				float y = Input.GetAxis ("Vertical") * speed;

				RaycastHit2D[] results = {};
				if (bc2d.Raycast (new Vector2 (x, y),
					    results, 1.2f, Physics2D.AllLayers, Mathf.NegativeInfinity, Mathf.Infinity) != 0)
					return;

				rb2d.MovePosition (new Vector2 (this.transform.position.x + x, this.transform.position.y + y));
			}
		}
	}
}

Here’s the documentation: https://docs.unity3d.com/ScriptReference/Collider2D.Raycast.html

Here it states:

This function is similar to the [[Physics2D::RaycastNonAlloc]] function and in the same way, the results are returned in the supplied array. The integer return value is the number of objects that intersect the ray (possibly zero) but the results array will not be resized if it doesn’t contain enough elements to report all the results. The significance of this is that no memory is allocated for the results and so garbage collection performance is improved when raycasts are performed frequently.

You pass in an empty array therefore you get zero results back.

Also note, you do not need to pass in the Physics2D.AllLayers, Mathf.NegativeInfinity, Mathf.Infinity as they are use the same values by default as the documentation shows.

Maybe try a different approach. Here is a script I just wrote that works for me:

    void CheckForObstacle()
        {
            // Looks ahead of character for obstacle
            Debug.DrawRay(transform.position, fwd * viewDistance);
            RaycastHit2D hitSolid = Physics2D.Raycast(transform.position, fwd, viewDistance, 1 << LayerMask.NameToLayer("Solid"));
            if (hitSolid)
            {
                // If a collision was made, make sure the enemy is patrolling and move to the next position after it reaches the obstacle.
                status = Status.patroling;
                if (IsAtPosition(hitSolid.transform.position))
                    currentPoint++;
            }
        }

The layer “Solid” are objects that should block the character. I believe you should just use Mathf.Infinity and make sure the direction vector is facing the towards were the character is going. Also, you probably don’t need to make an array of hits as it will always just return the first collider it finds.